#include "precomp.h"
#include <tchar.h>
#include <winreg.h>
#include <cfgmgr32.h>
#include <debug.h>
#include "resource.h"
Go to the source code of this file.
|
static LPTSTR | GetMonitorDevInstID (LPCTSTR lpDeviceID) |
| Converts a Hardware ID (DeviceID from EnumDisplayDevices) to an unique Device Instance ID.
|
|
static VOID | ShowMonitorProperties (PDESKMONITOR This) |
|
static VOID | UpdateMonitorSelection (PDESKMONITOR This) |
|
static VOID | UpdatePruningControls (PDESKMONITOR This) |
|
static VOID | GetPruningSettings (PDESKMONITOR This) |
|
static VOID | UpdateRefreshFrequencyList (PDESKMONITOR This) |
|
static VOID | InitMonitorDialog (PDESKMONITOR This) |
|
static VOID | UpdatePruningSelection (PDESKMONITOR This) |
|
static VOID | UpdateRefreshRateSelection (PDESKMONITOR This) |
|
static LONG | ApplyMonitorChanges (PDESKMONITOR This) |
|
static VOID | ResetMonitorChanges (PDESKMONITOR This) |
|
static INT_PTR CALLBACK | MonitorDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
|
static VOID | IDeskMonitor_Destroy (PDESKMONITOR This) |
|
ULONG | IDeskMonitor_AddRef (PDESKMONITOR This) |
|
ULONG | IDeskMonitor_Release (PDESKMONITOR This) |
|
HRESULT STDMETHODCALLTYPE | IDeskMonitor_QueryInterface (PDESKMONITOR This, REFIID iid, PVOID *pvObject) |
|
HRESULT | IDeskMonitor_Initialize (PDESKMONITOR This, LPCITEMIDLIST pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID) |
|
HRESULT | IDeskMonitor_AddPages (PDESKMONITOR This, LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam) |
|
HRESULT | IDeskMonitor_ReplacePage (PDESKMONITOR This, EXPPS uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam) |
|
HRESULT | IDeskMonitor_Constructor (REFIID riid, LPVOID *ppv) |
|
BOOL WINAPI | DllMain (HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved) |
|
◆ FUNC_DEVICEPROPERTIES
#define FUNC_DEVICEPROPERTIES "DevicePropertiesA" |
◆ NDEBUG
◆ PDEVICEPROPERTIES
◆ ApplyMonitorChanges()
Definition at line 570 of file deskmon.c.
571{
573
575 {
576
580 {
581
582 This->lpDevModeOnInit =
This->DeskExtInterface->GetCurrentMode(
This->DeskExtInterface->Context);
583 This->lpSelDevMode =
This->lpDevModeOnInit;
585 }
587 {
588
591 }
592 }
593
595
597}
static __inline LONG DeskCplExtDisplaySaveSettings(PDESK_EXT_INTERFACE DeskExtInterface, HWND hwndDlg)
static VOID InitMonitorDialog(PDESKMONITOR This)
#define PSNRET_INVALID_NOCHANGEPAGE
#define PropSheet_RestartWindows(d)
#define DISP_CHANGE_SUCCESSFUL
HWND WINAPI GetParent(_In_ HWND)
#define DISP_CHANGE_RESTART
Referenced by MonitorDlgProc().
◆ DllMain()
Definition at line 873 of file deskmon.c.
876{
878 {
882 break;
883 }
884
886}
static HINSTANCE hInstance
#define DLL_PROCESS_ATTACH
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
◆ GetMonitorDevInstID()
Converts a Hardware ID (DeviceID from EnumDisplayDevices) to an unique Device Instance ID.
- Parameters
-
[in] | lpDeviceID | A pointer to a null-terminated string containing a Hardware ID concatenated with driver key. e.g. "Monitor\Default_Monitor\{4D36E96E-E325-11CE-BFC1-08002BE10318}\0000" |
- Returns
- A pointer to a null-terminated string containing an unique Device Instance ID or NULL in case of error. e.g. "DISPLAY\DEFAULT_MONITOR\4&2ABFAA30&0&00000001&00&02"
Definition at line 44 of file deskmon.c.
45{
48 TCHAR szProperty[256];
51
54
55
58 {
59 DPRINT1(
"CM_Get_Child failed: %d\n", cr);
61 }
62
63 do
64 {
65
67
71 szProperty,
73 0);
75 {
76 DPRINT1(
"CM_Get_DevNode_Registry_Property failed: %d\n", cr);
77 continue;
78 }
79
80
84
88 szProperty +
_tcslen(szProperty),
90 0);
92 {
93 DPRINT1(
"CM_Get_DevNode_Registry_Property failed: %d\n", cr);
94 continue;
95 }
96
97
98 if (
_tcscmp(szProperty, lpDeviceID) == 0)
99 {
101 diChild,
102 0);
104 {
105 DPRINT1(
"CM_Get_Device_ID_Size failed: %d\n", cr);
106 break;
107 }
108
111 if (lpDevInstId ==
NULL)
112 {
113 DPRINT1(
"LocalAlloc failed\n");
114 break;
115 }
116
118 lpDevInstId,
120 0);
122 {
123 DPRINT1(
"CM_Get_Device_ID failed: %d\n", cr);
126 }
127
128 break;
129 }
131
132 return lpDevInstId;
133}
#define CM_Get_DevNode_Registry_Property
#define CM_DRP_HARDWAREID
CONFIGRET WINAPI CM_Get_Child(_Out_ PDEVINST pdnDevInst, _In_ DEVINST dnDevInst, _In_ ULONG ulFlags)
CONFIGRET WINAPI CM_Get_Device_ID_Size(_Out_ PULONG pulLen, _In_ DEVINST dnDevInst, _In_ ULONG ulFlags)
CONFIGRET WINAPI CM_Get_Sibling(_Out_ PDEVINST pdnDevInst, _In_ DEVINST dnDevInst, _In_ ULONG ulFlags)
static BOOL bFoundAdapter
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
HLOCAL NTAPI LocalFree(HLOCAL hMem)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Referenced by ShowMonitorProperties(), and UpdateMonitorSelection().
◆ GetPruningSettings()
Definition at line 218 of file deskmon.c.
219{
221
223 {
224 This->DeskExtInterface->GetPruningMode(
This->DeskExtInterface->Context,
225 &bModesPruned,
226 &bKeyIsReadOnly,
227 &bPruningOn);
228 }
229
230
231 This->bModesPruned = (bModesPruned !=
FALSE);
232 This->bKeyIsReadOnly = (bKeyIsReadOnly !=
FALSE);
233 This->bPruningOn = (bPruningOn !=
FALSE);
234
236}
static VOID UpdatePruningControls(PDESKMONITOR This)
Referenced by UpdateRefreshFrequencyList().
◆ IDeskMonitor_AddPages()
Definition at line 810 of file deskmon.c.
813{
816
817 DPRINT1(
"IDeskMonitor::AddPages(%p,%p)\n", pfnAddPage,
lParam);
818
819 psp.dwSize = sizeof(psp);
825
829
831}
static INT_PTR CALLBACK MonitorDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
struct _PSP * HPROPSHEETPAGE
#define CreatePropertySheetPage
Referenced by IDeskMonitor_IShellPropSheetExt_AddPages().
◆ IDeskMonitor_AddRef()
◆ IDeskMonitor_Constructor()
Definition at line 844 of file deskmon.c.
846{
849
851
853 0,
856 {
859
861
867 }
868
869 return hRet;
870}
ULONG IDeskMonitor_Release(PDESKMONITOR This)
HRESULT STDMETHODCALLTYPE IDeskMonitor_QueryInterface(PDESKMONITOR This, REFIID iid, PVOID *pvObject)
VOID IDeskMonitor_InitIface(PDESKMONITOR This)
Referenced by DllGetClassObject(), and IDeskMonitor_IClassFactory_CreateInstance().
◆ IDeskMonitor_Destroy()
Definition at line 689 of file deskmon.c.
690{
692
694 {
695 IDataObject_Release(
This->pdtobj);
697 }
698
700 {
703 }
704
706 {
709 }
710
711
712 pmi =
This->Monitors;
715 {
718 pmi = pminext;
719 }
720}
struct _DESKMONINFO * Next
Referenced by IDeskMonitor_Release().
◆ IDeskMonitor_Initialize()
Definition at line 788 of file deskmon.c.
792{
793 DPRINT1(
"IDeskMonitor::Initialize(%p,%p,%p)\n", pidlFolder, pdtobj, hkeyProgID);
794
796 {
797 IDataObject_AddRef(pdtobj);
798 This->pdtobj = pdtobj;
799
800
804 }
805
807}
static __inline PDESK_EXT_INTERFACE QueryDeskCplExtInterface(IDataObject *pdo)
Referenced by IDeskMonitor_IShellExtInit_Initialize().
◆ IDeskMonitor_QueryInterface()
◆ IDeskMonitor_Release()
◆ IDeskMonitor_ReplacePage()
◆ InitMonitorDialog()
Definition at line 345 of file deskmon.c.
346{
354
355
356 pmi =
This->Monitors;
359 {
362 pmi = pminext;
363 }
364
366 This->dwMonitorCount = 0;
367
371
372 if (lpDeviceId !=
NULL && lpDeviceId[0] !=
TEXT(
'\0'))
373 {
375 lpDeviceId,
378
380 DPRINT1(
"CM_Locate_DevNode failed: %d\n", cr);
381 }
382
385
388
390 {
392 {
393
394 dwIndex = 0;
395 pmilink = &
This->Monitors;
396
397 do
398 {
400 bRet = EnumDisplayDevices(
This->lpDisplayDevice,
401 dwIndex++,
402 &dd,
403 0);
404 if (bRet)
405 {
407 sizeof(*pmi));
409 {
411 &dd,
412 sizeof(dd));
414 *pmilink = pmi;
415 pmilink = &pmi->
Next;
416
417 This->dwMonitorCount++;
418 }
419 }
420 } while (bRet);
421 }
422
423 This->lpDevModeOnInit =
This->DeskExtInterface->GetCurrentMode(
This->DeskExtInterface->Context);
424 }
425 else
427
428 This->lpSelDevMode =
This->lpDevModeOnInit;
429
430
431 if (
This->dwMonitorCount == 0)
432 {
434
435
438
441 lpMonitorName);
442
443 if (lpMonitorName !=
NULL)
445 }
446 else if (
This->dwMonitorCount == 1)
447 {
451 This->Monitors->dd.DeviceString);
452 }
453 else
454 {
458 0,
459 0);
460
461 pmi =
This->Monitors;
463 {
467 0,
470 {
476
478 {
483 0);
484
485 This->SelMonitor = pmi;
486 }
487 }
488
490 }
491 }
492
493
500
503}
#define CM_Locate_DevNode
#define CM_LOCATE_DEVNODE_NORMAL
#define DESK_EXT_MONITORNAME
static __inline LPTSTR QueryDeskCplString(IDataObject *pdo, UINT cfFormat)
#define DESK_EXT_DISPLAYDEVICE
#define DESK_EXT_DISPLAYID
static VOID UpdateRefreshFrequencyList(PDESKMONITOR This)
static VOID UpdateMonitorSelection(PDESKMONITOR This)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define RegisterClipboardFormat
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define SendDlgItemMessage
Referenced by ApplyMonitorChanges(), and MonitorDlgProc().
◆ MonitorDlgProc()
Definition at line 610 of file deskmon.c.
614{
617
619 {
621 }
622
623 switch (uMsg)
624 {
627 This->hwndDlg = hwndDlg;
629
632 break;
633
636 {
639 break;
640
644 break;
645
649 break;
650
654 break;
655 }
656 break;
657
659 {
661
663 {
665 {
670 break;
671 }
672
675 break;
676
679 break;
680 }
681 break;
682 }
683 }
684
685 return Ret;
686}
static LONG ApplyMonitorChanges(PDESKMONITOR This)
static VOID ShowMonitorProperties(PDESKMONITOR This)
static VOID UpdateRefreshRateSelection(PDESKMONITOR This)
static VOID UpdatePruningSelection(PDESKMONITOR This)
static VOID ResetMonitorChanges(PDESKMONITOR This)
struct _DESKMONITOR * PDESKMONITOR
#define IDC_MONITORPROPERTIES
Referenced by IDeskMonitor_AddPages().
◆ ResetMonitorChanges()
◆ ShowMonitorProperties()
Definition at line 136 of file deskmon.c.
137{
141
143 {
145 if (lpDevInstID !=
NULL)
146 {
149 {
152 if (pDeviceProperties !=
NULL)
153 {
154 pDeviceProperties(
This->hwndDlg,
156 lpDevInstID,
158 }
159
161 }
162
164 }
165 }
166}
static LPTSTR GetMonitorDevInstID(LPCTSTR lpDeviceID)
Converts a Hardware ID (DeviceID from EnumDisplayDevices) to an unique Device Instance ID.
INT_PTR(WINAPI * PDEVICEPROPERTIES)(HWND, LPCSTR, LPCSTR, BOOL)
#define FUNC_DEVICEPROPERTIES
#define GetProcAddress(x, y)
Referenced by MonitorDlgProc().
◆ UpdateMonitorSelection()
Definition at line 169 of file deskmon.c.
170{
173
174 if (
This->dwMonitorCount > 1)
175 {
177
181 0,
182 0);
184 {
189 0);
190 }
191 }
192 else
194
197
200 lpDevInstID !=
NULL && lpDevInstID[0] !=
TEXT(
'\0'));
201
202 if (lpDevInstID !=
NULL)
204}
struct _DESKMONINFO * PDESKMONINFO
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
Referenced by InitMonitorDialog(), and MonitorDlgProc().
◆ UpdatePruningControls()
◆ UpdatePruningSelection()
Definition at line 506 of file deskmon.c.
507{
509
510 if (
This->DeskExtInterface !=
NULL &&
This->bModesPruned && !
This->bKeyIsReadOnly)
511 {
514
515 if (bPruningOn !=
This->bPruningOn)
516 {
517
518 This->bPruningOn = bPruningOn;
519 This->DeskExtInterface->SetPruningMode(
This->DeskExtInterface->Context,
520 bPruningOn);
521
522
523
524
526
529 }
530 }
531}
#define PropSheet_Changed(d, w)
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
Referenced by MonitorDlgProc().
◆ UpdateRefreshFrequencyList()
Definition at line 239 of file deskmon.c.
240{
247
248
252 0,
253 0);
254
255 lpCurrentMode =
This->DeskExtInterface->GetCurrentMode(
This->DeskExtInterface->Context);
256 dwIndex = 0;
257
258 do
259 {
260 lpMode =
This->DeskExtInterface->EnumAllModes(
This->DeskExtInterface->Context,
261 dwIndex++);
262 if (lpMode !=
NULL &&
266 {
267
268
270 {
271
272 if (bHasDef)
273 continue;
274
276
279 szBuffer,
280 sizeof(szBuffer) / sizeof(szBuffer[0])))
281 {
282 szBuffer[0] =
TEXT(
'\0');
283 }
284 }
285 else
286 {
288
291 szFmt,
292 sizeof(szFmt) / sizeof(szFmt[0])))
293 {
294 szFmt[0] =
TEXT(
'\0');
295 }
296
298 sizeof(szBuffer) / sizeof(szBuffer[0]),
299 szFmt,
301 }
302
306 0,
309 {
311
317
319 {
324 0);
325 }
326 }
327 }
328
329 }
while (lpMode !=
NULL);
330
333 bAdded);
336 bAdded);
339 bAdded);
340
342}
static VOID GetPruningSettings(PDESKMONITOR This)
#define IDS_MONITORSETTINGSGROUP
#define IDS_REFRESHRATELABEL
#define IDS_USEDEFFRQUENCY
Referenced by InitMonitorDialog(), MonitorDlgProc(), UpdatePruningSelection(), and UpdateRefreshRateSelection().
◆ UpdateRefreshRateSelection()
Definition at line 534 of file deskmon.c.
535{
538
540 {
544 0,
545 0);
547 {
548 lpCurrentDevMode =
This->lpSelDevMode;
553 0);
554
555 if (
This->lpSelDevMode !=
NULL &&
This->lpSelDevMode != lpCurrentDevMode)
556 {
557 This->DeskExtInterface->SetCurrentMode(
This->DeskExtInterface->Context,
559
561
564 }
565 }
566 }
567}
struct _devicemodeW * PDEVMODEW
Referenced by MonitorDlgProc().
◆ bFoundAdapter
◆ diAdapter
◆ hInstance