ReactOS  0.4.15-dev-4916-gd519b11
deskmon.c
Go to the documentation of this file.
1 #include "precomp.h"
2 
3 #include <tchar.h>
4 #include <winreg.h>
5 #include <cfgmgr32.h>
6 
7 #define NDEBUG
8 #include <debug.h>
9 
10 #include "resource.h"
11 
15 
16 #ifdef UNICODE
18 #define FUNC_DEVICEPROPERTIES "DevicePropertiesW"
19 #else
21 #define FUNC_DEVICEPROPERTIES "DevicePropertiesA"
22 #endif
23 
43 static LPTSTR
45 {
46  CONFIGRET cr;
47  DEVINST diChild;
48  TCHAR szProperty[256];
49  DWORD dwSize;
50  LPTSTR lpDevInstId = NULL;
51 
52  if (!bFoundAdapter)
53  return NULL;
54 
55  /* Look for child monitor devices of selected video adapter */
56  cr = CM_Get_Child(&diChild, diAdapter, 0);
57  if (cr != CR_SUCCESS)
58  {
59  DPRINT1("CM_Get_Child failed: %d\n", cr);
60  return NULL;
61  }
62 
63  do
64  {
65  /* Get Hardware ID for each of them */
66  dwSize = sizeof(szProperty) - sizeof(TCHAR);
67 
70  NULL,
71  szProperty,
72  &dwSize,
73  0);
74  if (cr != CR_SUCCESS)
75  {
76  DPRINT1("CM_Get_DevNode_Registry_Property failed: %d\n", cr);
77  continue;
78  }
79 
80  /* Concatenate with driver key */
81  _tcscat(szProperty, TEXT("\\"));
82  dwSize = sizeof(szProperty) - sizeof(TCHAR);
83  dwSize -= _tcslen(szProperty) * sizeof(TCHAR);
84 
87  NULL,
88  szProperty + _tcslen(szProperty),
89  &dwSize,
90  0);
91  if (cr != CR_SUCCESS)
92  {
93  DPRINT1("CM_Get_DevNode_Registry_Property failed: %d\n", cr);
94  continue;
95  }
96 
97  /* If the strings match, this is our monitor device node */
98  if (_tcscmp(szProperty, lpDeviceID) == 0)
99  {
101  diChild,
102  0);
103  if (cr != CR_SUCCESS)
104  {
105  DPRINT1("CM_Get_Device_ID_Size failed: %d\n", cr);
106  break;
107  }
108 
109  lpDevInstId = LocalAlloc(LMEM_FIXED,
110  (dwSize + 1) * sizeof(TCHAR));
111  if (lpDevInstId == NULL)
112  {
113  DPRINT1("LocalAlloc failed\n");
114  break;
115  }
116 
117  cr = CM_Get_Device_ID(diChild,
118  lpDevInstId,
119  dwSize + 1,
120  0);
121  if (cr != CR_SUCCESS)
122  {
123  DPRINT1("CM_Get_Device_ID failed: %d\n", cr);
124  LocalFree((HLOCAL)lpDevInstId);
125  lpDevInstId = NULL;
126  }
127 
128  break;
129  }
130  } while (CM_Get_Sibling(&diChild, diChild, 0) == CR_SUCCESS);
131 
132  return lpDevInstId;
133 }
134 
135 static VOID
137 {
138  HMODULE hDevMgr;
139  PDEVICEPROPERTIES pDeviceProperties;
140  LPTSTR lpDevInstID;
141 
142  if (This->SelMonitor != NULL)
143  {
144  lpDevInstID = GetMonitorDevInstID(This->SelMonitor->dd.DeviceID);
145  if (lpDevInstID != NULL)
146  {
147  hDevMgr = LoadLibrary(TEXT("devmgr.dll"));
148  if (hDevMgr != NULL)
149  {
150  pDeviceProperties = (PDEVICEPROPERTIES)GetProcAddress(hDevMgr,
152  if (pDeviceProperties != NULL)
153  {
154  pDeviceProperties(This->hwndDlg,
155  NULL,
156  lpDevInstID,
157  FALSE);
158  }
159 
160  FreeLibrary(hDevMgr);
161  }
162 
163  LocalFree((HLOCAL)lpDevInstID);
164  }
165  }
166 }
167 
168 static VOID
170 {
171  INT i;
172  LPTSTR lpDevInstID = NULL;
173 
174  if (This->dwMonitorCount > 1)
175  {
176  This->SelMonitor = NULL;
177 
178  i = (INT)SendDlgItemMessage(This->hwndDlg,
180  LB_GETCURSEL,
181  0,
182  0);
183  if (i >= 0)
184  {
185  This->SelMonitor = (PDESKMONINFO)SendDlgItemMessage(This->hwndDlg,
188  (WPARAM)i,
189  0);
190  }
191  }
192  else
193  This->SelMonitor = This->Monitors;
194 
195  if (This->SelMonitor != NULL)
196  lpDevInstID = GetMonitorDevInstID(This->SelMonitor->dd.DeviceID);
197 
198  EnableWindow(GetDlgItem(This->hwndDlg,
200  lpDevInstID != NULL && lpDevInstID[0] != TEXT('\0'));
201 
202  if (lpDevInstID != NULL)
203  LocalFree((HLOCAL)lpDevInstID);
204 }
205 
206 static VOID
208 {
209  EnableWindow(GetDlgItem(This->hwndDlg,
211  This->bModesPruned && !This->bKeyIsReadOnly);
212  CheckDlgButton(This->hwndDlg,
214  (This->bModesPruned && This->bPruningOn) ? BST_CHECKED : BST_UNCHECKED);
215 }
216 
217 static VOID
219 {
220  BOOL bModesPruned = FALSE, bKeyIsReadOnly = FALSE, bPruningOn = FALSE;
221 
222  if (This->DeskExtInterface != NULL)
223  {
224  This->DeskExtInterface->GetPruningMode(This->DeskExtInterface->Context,
225  &bModesPruned,
226  &bKeyIsReadOnly,
227  &bPruningOn);
228  }
229 
230  /* Check the boolean values against zero before assigning it to the bitfields! */
231  This->bModesPruned = (bModesPruned != FALSE);
232  This->bKeyIsReadOnly = (bKeyIsReadOnly != FALSE);
233  This->bPruningOn = (bPruningOn != FALSE);
234 
236 }
237 
238 static VOID
240 {
241  PDEVMODEW lpCurrentMode, lpMode;
242  TCHAR szBuffer[64];
243  DWORD dwIndex;
244  INT i;
245  BOOL bHasDef = FALSE;
246  BOOL bAdded = FALSE;
247 
248  /* Fill the refresh rate combo box */
249  SendDlgItemMessage(This->hwndDlg,
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 &&
263  lpMode->dmBitsPerPel == lpCurrentMode->dmBitsPerPel &&
264  lpMode->dmPelsWidth == lpCurrentMode->dmPelsWidth &&
265  lpMode->dmPelsHeight == lpCurrentMode->dmPelsHeight)
266  {
267  /* We're only interested in refresh rates for the current resolution and color depth */
268 
269  if (lpMode->dmDisplayFrequency <= 1)
270  {
271  /* Default hardware frequency */
272  if (bHasDef)
273  continue;
274 
275  bHasDef = TRUE;
276 
277  if (!LoadString(hInstance,
279  szBuffer,
280  sizeof(szBuffer) / sizeof(szBuffer[0])))
281  {
282  szBuffer[0] = TEXT('\0');
283  }
284  }
285  else
286  {
287  TCHAR szFmt[64];
288 
289  if (!LoadString(hInstance,
290  IDS_FREQFMT,
291  szFmt,
292  sizeof(szFmt) / sizeof(szFmt[0])))
293  {
294  szFmt[0] = TEXT('\0');
295  }
296 
297  _sntprintf(szBuffer,
298  sizeof(szBuffer) / sizeof(szBuffer[0]),
299  szFmt,
300  lpMode->dmDisplayFrequency);
301  }
302 
303  i = (INT)SendDlgItemMessage(This->hwndDlg,
305  CB_ADDSTRING,
306  0,
307  (LPARAM)szBuffer);
308  if (i >= 0)
309  {
310  bAdded = TRUE;
311 
312  SendDlgItemMessage(This->hwndDlg,
315  (WPARAM)i,
316  (LPARAM)lpMode);
317 
318  if (lpMode->dmDisplayFrequency == lpCurrentMode->dmDisplayFrequency)
319  {
320  SendDlgItemMessage(This->hwndDlg,
322  CB_SETCURSEL,
323  (WPARAM)i,
324  0);
325  }
326  }
327  }
328 
329  } while (lpMode != NULL);
330 
331  EnableWindow(GetDlgItem(This->hwndDlg,
333  bAdded);
334  EnableWindow(GetDlgItem(This->hwndDlg,
336  bAdded);
337  EnableWindow(GetDlgItem(This->hwndDlg,
339  bAdded);
340 
342 }
343 
344 static VOID
346 {
347  PDESKMONINFO pmi, pminext, *pmilink;
348  LPTSTR lpDeviceId;
349  CONFIGRET cr;
350  DISPLAY_DEVICE dd;
351  BOOL bRet;
352  INT i;
353  DWORD dwIndex;
354 
355  /* Free all allocated monitors */
356  pmi = This->Monitors;
357  This->Monitors = NULL;
358  while (pmi != NULL)
359  {
360  pminext = pmi->Next;
361  LocalFree((HLOCAL)pmi);
362  pmi = pminext;
363  }
364 
365  This->SelMonitor = NULL;
366  This->dwMonitorCount = 0;
367 
369  lpDeviceId = QueryDeskCplString(This->pdtobj,
371 
372  if (lpDeviceId != NULL && lpDeviceId[0] != TEXT('\0'))
373  {
375  lpDeviceId,
377  bFoundAdapter = (cr == CR_SUCCESS);
378 
379  if (!bFoundAdapter)
380  DPRINT1("CM_Locate_DevNode failed: %d\n", cr);
381  }
382 
383  if (This->lpDisplayDevice != NULL)
384  LocalFree((HLOCAL)This->lpDisplayDevice);
385 
386  This->lpDisplayDevice = QueryDeskCplString(This->pdtobj,
388 
389  if (This->DeskExtInterface != NULL)
390  {
391  if (This->lpDisplayDevice != NULL)
392  {
393  /* Enumerate all monitors */
394  dwIndex = 0;
395  pmilink = &This->Monitors;
396 
397  do
398  {
399  dd.cb = sizeof(dd);
400  bRet = EnumDisplayDevices(This->lpDisplayDevice,
401  dwIndex++,
402  &dd,
403  0);
404  if (bRet)
405  {
406  pmi = LocalAlloc(LMEM_FIXED,
407  sizeof(*pmi));
408  if (pmi != NULL)
409  {
410  CopyMemory(&pmi->dd,
411  &dd,
412  sizeof(dd));
413  pmi->Next = NULL;
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
426  This->lpDevModeOnInit = NULL;
427 
428  This->lpSelDevMode = This->lpDevModeOnInit;
429 
430  /* Setup the UI depending on how many monitors are attached */
431  if (This->dwMonitorCount == 0)
432  {
433  LPTSTR lpMonitorName;
434 
435  /* This is a fallback, let's hope that desk.cpl can provide us with a monitor name */
436  lpMonitorName = QueryDeskCplString(This->pdtobj,
438 
439  SetDlgItemText(This->hwndDlg,
441  lpMonitorName);
442 
443  if (lpMonitorName != NULL)
444  LocalFree((HLOCAL)lpMonitorName);
445  }
446  else if (This->dwMonitorCount == 1)
447  {
448  This->SelMonitor = This->Monitors;
449  SetDlgItemText(This->hwndDlg,
451  This->Monitors->dd.DeviceString);
452  }
453  else
454  {
455  SendDlgItemMessage(This->hwndDlg,
458  0,
459  0);
460 
461  pmi = This->Monitors;
462  while (pmi != NULL)
463  {
464  i = (INT)SendDlgItemMessage(This->hwndDlg,
466  LB_ADDSTRING,
467  0,
468  (LPARAM)pmi->dd.DeviceString);
469  if (i >= 0)
470  {
471  SendDlgItemMessage(This->hwndDlg,
474  (WPARAM)i,
475  (LPARAM)pmi);
476 
477  if (This->SelMonitor == NULL)
478  {
479  SendDlgItemMessage(This->hwndDlg,
481  LB_SETCURSEL,
482  (WPARAM)i,
483  0);
484 
485  This->SelMonitor = pmi;
486  }
487  }
488 
489  pmi = pmi->Next;
490  }
491  }
492 
493  /* Show/Hide controls */
494  ShowWindow(GetDlgItem(This->hwndDlg,
496  (This->dwMonitorCount <= 1 ? SW_SHOW : SW_HIDE));
497  ShowWindow(GetDlgItem(This->hwndDlg,
499  (This->dwMonitorCount > 1 ? SW_SHOW : SW_HIDE));
500 
503 }
504 
505 static VOID
507 {
508  BOOL bPruningOn;
509 
510  if (This->DeskExtInterface != NULL && This->bModesPruned && !This->bKeyIsReadOnly)
511  {
512  bPruningOn = IsDlgButtonChecked(This->hwndDlg,
514 
515  if (bPruningOn != This->bPruningOn)
516  {
517  /* Tell desk.cpl to turn on/off pruning mode */
518  This->bPruningOn = bPruningOn;
519  This->DeskExtInterface->SetPruningMode(This->DeskExtInterface->Context,
520  bPruningOn);
521 
522  /* Fill the refresh rate combobox again, we now receive a filtered
523  or unfiltered device mode list from desk.cpl (depending on whether
524  pruning is active or not) */
526 
528  This->hwndDlg);
529  }
530  }
531 }
532 
533 static VOID
535 {
536  PDEVMODEW lpCurrentDevMode;
537  INT i;
538 
539  if (This->DeskExtInterface != NULL)
540  {
541  i = (INT)SendDlgItemMessage(This->hwndDlg,
543  CB_GETCURSEL,
544  0,
545  0);
546  if (i >= 0)
547  {
548  lpCurrentDevMode = This->lpSelDevMode;
549  This->lpSelDevMode = (PDEVMODEW)SendDlgItemMessage(This->hwndDlg,
552  (WPARAM)i,
553  0);
554 
555  if (This->lpSelDevMode != NULL && This->lpSelDevMode != lpCurrentDevMode)
556  {
557  This->DeskExtInterface->SetCurrentMode(This->DeskExtInterface->Context,
558  This->lpSelDevMode);
559 
561 
563  This->hwndDlg);
564  }
565  }
566  }
567 }
568 
569 static LONG
571 {
572  LONG lChangeRet;
573 
574  if (This->DeskExtInterface != NULL)
575  {
576  /* Change the display settings through desk.cpl */
577  lChangeRet = DeskCplExtDisplaySaveSettings(This->DeskExtInterface,
578  This->hwndDlg);
579  if (lChangeRet == DISP_CHANGE_SUCCESSFUL)
580  {
581  /* Save the new mode */
582  This->lpDevModeOnInit = This->DeskExtInterface->GetCurrentMode(This->DeskExtInterface->Context);
583  This->lpSelDevMode = This->lpDevModeOnInit;
584  return PSNRET_NOERROR;
585  }
586  else if (lChangeRet == DISP_CHANGE_RESTART)
587  {
588  /* Notify desk.cpl that the user needs to reboot */
590  return PSNRET_NOERROR;
591  }
592  }
593 
595 
597 }
598 
599 static VOID
601 {
602  if (This->DeskExtInterface != NULL && This->lpDevModeOnInit != NULL)
603  {
604  This->DeskExtInterface->SetCurrentMode(This->DeskExtInterface->Context,
605  This->lpDevModeOnInit);
606  }
607 }
608 
609 static INT_PTR CALLBACK
611  UINT uMsg,
612  WPARAM wParam,
613  LPARAM lParam)
614 {
616  INT_PTR Ret = 0;
617 
618  if (uMsg != WM_INITDIALOG)
619  {
621  }
622 
623  switch (uMsg)
624  {
625  case WM_INITDIALOG:
627  This->hwndDlg = hwndDlg;
629 
631  Ret = TRUE;
632  break;
633 
634  case WM_COMMAND:
635  switch (LOWORD(wParam))
636  {
639  break;
640 
641  case IDC_MONITORLIST:
642  if (HIWORD(wParam) == LBN_SELCHANGE)
644  break;
645 
646  case IDC_PRUNINGCHECK:
647  if (HIWORD(wParam) == BN_CLICKED)
649  break;
650 
651  case IDC_REFRESHRATE:
652  if (HIWORD(wParam) == CBN_SELCHANGE)
654  break;
655  }
656  break;
657 
658  case WM_NOTIFY:
659  {
660  NMHDR *nmh = (NMHDR *)lParam;
661 
662  switch (nmh->code)
663  {
664  case PSN_APPLY:
665  {
666  SetWindowLongPtr(hwndDlg,
669  Ret = TRUE;
670  break;
671  }
672 
673  case PSN_RESET:
675  break;
676 
677  case PSN_SETACTIVE:
679  break;
680  }
681  break;
682  }
683  }
684 
685  return Ret;
686 }
687 
688 static VOID
690 {
691  PDESKMONINFO pmi, pminext;
692 
693  if (This->pdtobj != NULL)
694  {
695  IDataObject_Release(This->pdtobj);
696  This->pdtobj = NULL;
697  }
698 
699  if (This->DeskExtInterface != NULL)
700  {
701  LocalFree((HLOCAL)This->DeskExtInterface);
702  This->DeskExtInterface = NULL;
703  }
704 
705  if (This->lpDisplayDevice != NULL)
706  {
707  LocalFree((HLOCAL)This->lpDisplayDevice);
708  This->lpDisplayDevice = NULL;
709  }
710 
711  /* Free all monitors */
712  pmi = This->Monitors;
713  This->Monitors = NULL;
714  while (pmi != NULL)
715  {
716  pminext = pmi->Next;
717  LocalFree((HLOCAL)pmi);
718  pmi = pminext;
719  }
720 }
721 
722 ULONG
724 {
725  ULONG ret;
726 
728  if (ret == 1)
730 
731  return ret;
732 }
733 
734 ULONG
736 {
737  ULONG ret;
738 
740  if (ret == 0)
741  {
744 
746  0,
747  This);
748  }
749 
750  return ret;
751 }
752 
755  REFIID iid,
756  PVOID *pvObject)
757 {
758  *pvObject = NULL;
759 
760  if (IsEqualIID(iid,
761  &IID_IShellPropSheetExt) ||
762  IsEqualIID(iid,
763  &IID_IUnknown))
764  {
766  }
767  else if (IsEqualIID(iid,
768  &IID_IShellExtInit))
769  {
770  *pvObject = impl_to_interface(This, IShellExtInit);
771  }
772  else if (IsEqualIID(iid,
774  {
775  *pvObject = impl_to_interface(This, IClassFactory);
776  }
777  else
778  {
779  DPRINT1("IDeskMonitor::QueryInterface(%p,%p): E_NOINTERFACE\n", iid, pvObject);
780  return E_NOINTERFACE;
781  }
782 
784  return S_OK;
785 }
786 
787 HRESULT
789  LPCITEMIDLIST pidlFolder,
790  IDataObject *pdtobj,
791  HKEY hkeyProgID)
792 {
793  DPRINT1("IDeskMonitor::Initialize(%p,%p,%p)\n", pidlFolder, pdtobj, hkeyProgID);
794 
795  if (pdtobj != NULL)
796  {
797  IDataObject_AddRef(pdtobj);
798  This->pdtobj = pdtobj;
799 
800  /* Get a copy of the desk.cpl extension interface */
801  This->DeskExtInterface = QueryDeskCplExtInterface(This->pdtobj);
802  if (This->DeskExtInterface != NULL)
803  return S_OK;
804  }
805 
806  return S_FALSE;
807 }
808 
809 HRESULT
811  LPFNADDPROPSHEETPAGE pfnAddPage,
812  LPARAM lParam)
813 {
814  HPROPSHEETPAGE hpsp;
815  PROPSHEETPAGE psp;
816 
817  DPRINT1("IDeskMonitor::AddPages(%p,%p)\n", pfnAddPage, lParam);
818 
819  psp.dwSize = sizeof(psp);
820  psp.dwFlags = PSP_DEFAULT;
821  psp.hInstance = hInstance;
822  psp.pszTemplate = MAKEINTRESOURCE(IDD_MONITOR);
823  psp.pfnDlgProc = MonitorDlgProc;
824  psp.lParam = (LPARAM)This;
825 
826  hpsp = CreatePropertySheetPage(&psp);
827  if (hpsp != NULL && pfnAddPage(hpsp, lParam))
828  return S_OK;
829 
830  return S_FALSE;
831 }
832 
833 HRESULT
835  EXPPS uPageID,
836  LPFNADDPROPSHEETPAGE pfnReplacePage,
837  LPARAM lParam)
838 {
839  DPRINT1("IDeskMonitor::ReplacePage(%u,%p,%p)\n", uPageID, pfnReplacePage, lParam);
840  return E_NOTIMPL;
841 }
842 
843 HRESULT
845  LPVOID *ppv)
846 {
848  HRESULT hRet = E_OUTOFMEMORY;
849 
850  DPRINT1("IDeskMonitor::Constructor(%p,%p)\n", riid, ppv);
851 
853  0,
854  sizeof(*This));
855  if (This != NULL)
856  {
858  sizeof(*This));
859 
861 
863  riid,
864  ppv);
865  if (!SUCCEEDED(hRet))
867  }
868 
869  return hRet;
870 }
871 
872 BOOL WINAPI
874  DWORD dwReason,
876 {
877  switch (dwReason)
878  {
879  case DLL_PROCESS_ATTACH:
880  hInstance = hinstDLL;
882  break;
883  }
884 
885  return TRUE;
886 }
HRESULT IDeskMonitor_Initialize(PDESKMONITOR This, LPCITEMIDLIST pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID)
Definition: deskmon.c:788
#define LB_SETCURSEL
Definition: winuser.h:2050
#define CB_SETITEMDATA
Definition: winuser.h:1953
#define MAKEINTRESOURCE
Definition: winuser.h:591
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define IDC_PRUNINGCHECK
Definition: resource.h:11
#define REFIID
Definition: guiddef.h:118
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
struct _DESKMONINFO * Next
Definition: deskmon.h:6
#define CM_Get_DevNode_Registry_Property
Definition: cfgmgr32.h:1733
#define E_NOINTERFACE
Definition: winerror.h:2364
#define IDS_USEDEFFRQUENCY
Definition: resource.h:14
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
struct _devicemodeW * PDEVMODEW
DECLSPEC_HIDDEN LONG dll_refs
Definition: devenum_main.c:28
#define LoadLibrary
Definition: winbase.h:3723
static INT_PTR CALLBACK MonitorDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: deskmon.c:610
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define DISP_CHANGE_RESTART
Definition: winuser.h:191
#define LB_ADDSTRING
Definition: winuser.h:2018
static VOID IDeskMonitor_Destroy(PDESKMONITOR This)
Definition: deskmon.c:689
static BOOL bFoundAdapter
Definition: deskmon.c:13
CHAR DeviceString[128]
Definition: wingdi.h:2811
static VOID UpdatePruningSelection(PDESKMONITOR This)
Definition: deskmon.c:506
int _tcscmp(const _TCHAR *s1, const _TCHAR *s2)
Definition: tcscmp.h:8
#define TRUE
Definition: types.h:120
#define SW_HIDE
Definition: winuser.h:762
REFIID riid
Definition: precomp.h:44
#define LB_GETITEMDATA
Definition: winuser.h:2028
#define CB_GETITEMDATA
Definition: winuser.h:1937
static __inline PDESK_EXT_INTERFACE QueryDeskCplExtInterface(IDataObject *pdo)
Definition: deskcplx.h:48
#define PropSheet_RestartWindows(d)
Definition: prsht.h:352
#define INT
Definition: polytest.cpp:20
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define CALLBACK
Definition: compat.h:35
REFIID LPVOID * ppv
Definition: atlbase.h:39
HANDLE HWND
Definition: compat.h:19
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
static VOID ShowMonitorProperties(PDESKMONITOR This)
Definition: deskmon.c:136
#define ZeroMemory
Definition: winbase.h:1667
static VOID UpdateRefreshRateSelection(PDESKMONITOR This)
Definition: deskmon.c:534
#define CM_Locate_DevNode
Definition: cfgmgr32.h:2403
BOOL(CALLBACK * LPFNADDPROPSHEETPAGE)(HPROPSHEETPAGE, LPARAM)
Definition: prsht.h:327
CONFIGRET WINAPI CM_Get_Sibling(_Out_ PDEVINST pdnDevInst, _In_ DEVINST dnDevInst, _In_ ULONG ulFlags)
Definition: cfgmgr.c:5530
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
UINT_PTR WPARAM
Definition: windef.h:207
DISPLAY_DEVICE dd
Definition: deskmon.h:5
#define SendDlgItemMessage
Definition: winuser.h:5822
static LPTSTR GetMonitorDevInstID(LPCTSTR lpDeviceID)
Converts a Hardware ID (DeviceID from EnumDisplayDevices) to an unique Device Instance ID.
Definition: deskmon.c:44
#define PSN_APPLY
Definition: prsht.h:117
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
DWORD dmBitsPerPel
Definition: wingdi.h:1647
int32_t INT_PTR
Definition: typedefs.h:64
#define DESK_EXT_DISPLAYID
Definition: deskcplx.h:10
static __inline LONG DeskCplExtDisplaySaveSettings(PDESK_EXT_INTERFACE DeskExtInterface, HWND hwndDlg)
Definition: deskcplx.h:122
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
Definition: deskmon.c:873
#define BOOL
Definition: nt_native.h:43
#define LBN_SELCHANGE
Definition: winuser.h:2062
#define PSN_SETACTIVE
Definition: prsht.h:115
int32_t INT
Definition: typedefs.h:58
#define SetWindowLongPtr
Definition: treelist.c:70
#define CB_GETCURSEL
Definition: winuser.h:1930
WPARAM wParam
Definition: combotst.c:138
CHAR * LPTSTR
Definition: xmlstorage.h:192
static IN DWORD IN LPVOID lpvReserved
#define DWLP_MSGRESULT
Definition: winuser.h:864
HRESULT STDMETHODCALLTYPE IDeskMonitor_QueryInterface(PDESKMONITOR This, REFIID iid, PVOID *pvObject)
Definition: deskmon.c:754
static VOID UpdateMonitorSelection(PDESKMONITOR This)
Definition: deskmon.c:169
UINT code
Definition: winuser.h:3139
DWORD dwReason
Definition: misc.cpp:154
#define LB_RESETCONTENT
Definition: winuser.h:2042
struct _DESKMONITOR * PDESKMONITOR
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
HRESULT IDeskMonitor_ReplacePage(PDESKMONITOR This, EXPPS uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam)
Definition: deskmon.c:834
if SUCCEEDED(hr)
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
#define IDC_REFRESHRATE
Definition: resource.h:10
CONFIGRET WINAPI CM_Get_Child(_Out_ PDEVINST pdnDevInst, _In_ DEVINST dnDevInst, _In_ ULONG ulFlags)
Definition: cfgmgr.c:2530
#define CR_SUCCESS
Definition: cfgmgr32.h:842
#define S_FALSE
Definition: winerror.h:2357
static VOID UpdatePruningControls(PDESKMONITOR This)
Definition: deskmon.c:207
#define CB_ADDSTRING
Definition: winuser.h:1923
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
#define PSNRET_INVALID_NOCHANGEPAGE
Definition: prsht.h:131
LONG_PTR LPARAM
Definition: windef.h:208
HRESULT IDeskMonitor_Constructor(REFIID riid, LPVOID *ppv)
Definition: deskmon.c:844
const char * LPCSTR
Definition: xmlstorage.h:183
#define SW_SHOW
Definition: winuser.h:769
#define CB_RESETCONTENT
Definition: winuser.h:1946
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define CreatePropertySheetPage
Definition: prsht.h:399
#define IDS_MONITORSETTINGSGROUP
Definition: resource.h:8
#define LMEM_FIXED
Definition: winbase.h:365
char TCHAR
Definition: xmlstorage.h:189
#define PSP_DEFAULT
Definition: prsht.h:22
#define FreeLibrary(x)
Definition: compat.h:607
static VOID ResetMonitorChanges(PDESKMONITOR This)
Definition: deskmon.c:600
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
LONG HRESULT
Definition: typedefs.h:79
const GUID IID_IUnknown
#define CM_DRP_HARDWAREID
Definition: cfgmgr32.h:677
static VOID UpdateRefreshFrequencyList(PDESKMONITOR This)
Definition: deskmon.c:239
#define WINAPI
Definition: msvc.h:6
#define DISP_CHANGE_SUCCESSFUL
Definition: winuser.h:190
#define CopyMemory
Definition: winbase.h:1665
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
#define FUNC_DEVICEPROPERTIES
Definition: deskmon.c:21
#define BN_CLICKED
Definition: winuser.h:1912
unsigned long DWORD
Definition: ntddk_ex.h:95
ULONG IDeskMonitor_Release(PDESKMONITOR This)
Definition: deskmon.c:735
#define LPCPROPSHEETPAGE
Definition: prsht.h:391
#define LB_SETITEMDATA
Definition: winuser.h:2052
#define SetDlgItemText
Definition: winuser.h:5829
static VOID GetPruningSettings(PDESKMONITOR This)
Definition: deskmon.c:218
DWORD dmPelsWidth
Definition: wingdi.h:1648
#define PSNRET_NOERROR
Definition: prsht.h:129
#define CM_DRP_DRIVER
Definition: cfgmgr32.h:685
int ret
#define IDC_MONITORPROPERTIES
Definition: resource.h:7
#define InterlockedDecrement
Definition: armddk.h:52
VOID IDeskMonitor_InitIface(PDESKMONITOR This)
Definition: shxiface.c:176
#define DWLP_USER
Definition: winuser.h:866
static DEVINST diAdapter
Definition: deskmon.c:14
#define _sntprintf
Definition: xmlstorage.h:201
static VOID InitMonitorDialog(PDESKMONITOR This)
Definition: deskmon.c:345
#define CB_SETCURSEL
Definition: winuser.h:1948
#define WM_COMMAND
Definition: winuser.h:1727
static HINSTANCE hInstance
Definition: deskmon.c:12
#define IDS_REFRESHRATELABEL
Definition: resource.h:9
#define BST_UNCHECKED
Definition: winuser.h:199
#define RegisterClipboardFormat
Definition: winuser.h:5818
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
ULONG IDeskMonitor_AddRef(PDESKMONITOR This)
Definition: deskmon.c:723
static LONG ApplyMonitorChanges(PDESKMONITOR This)
Definition: deskmon.c:570
DWORD dmDisplayFrequency
Definition: wingdi.h:1654
HWND WINAPI GetParent(_In_ HWND)
#define S_OK
Definition: intsafe.h:52
#define TEXT(s)
Definition: k32.h:26
DWORD DEVINST
Definition: cfgmgr32.h:76
#define InterlockedIncrement
Definition: armddk.h:53
#define impl_to_interface(impl, iface)
Definition: dwnl.c:35
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
Definition: glfuncs.h:248
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define PSN_RESET
Definition: prsht.h:118
#define E_NOTIMPL
Definition: ddrawi.h:99
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define LB_GETCURSEL
Definition: winuser.h:2026
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define CM_Get_Device_ID
Definition: cfgmgr32.h:1565
CONFIGRET WINAPI CM_Get_Device_ID_Size(_Out_ PULONG pulLen, _In_ DEVINST dnDevInst, _In_ ULONG ulFlags)
Definition: cfgmgr.c:4074
#define CBN_SELCHANGE
Definition: winuser.h:1966
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#define IDD_MONITOR
Definition: resource.h:3
#define BST_CHECKED
Definition: winuser.h:197
#define DPRINT1
Definition: precomp.h:8
DWORD dmPelsHeight
Definition: wingdi.h:1649
_TCHAR * _tcscat(_TCHAR *s, const _TCHAR *append)
Definition: tcscat.h:8
HRESULT IDeskMonitor_AddPages(PDESKMONITOR This, LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam)
Definition: deskmon.c:810
static __inline LPTSTR QueryDeskCplString(IDataObject *pdo, UINT cfFormat)
Definition: deskcplx.h:84
#define HIWORD(l)
Definition: typedefs.h:247
unsigned int ULONG
Definition: retypes.h:1
#define DESK_EXT_DISPLAYDEVICE
Definition: deskcplx.h:8
struct _DESKMONINFO * PDESKMONINFO
#define IDC_MONITORNAME
Definition: resource.h:5
#define IDC_MONITORLIST
Definition: resource.h:6
#define GetProcAddress(x, y)
Definition: compat.h:612
#define IDS_FREQFMT
Definition: resource.h:15
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
#define GetWindowLongPtr
Definition: treelist.c:73
#define CM_LOCATE_DEVNODE_NORMAL
Definition: cfgmgr32.h:760
INT_PTR(WINAPI * PDEVICEPROPERTIES)(HWND, LPCSTR, LPCSTR, BOOL)
Definition: deskmon.c:20
const GUID IID_IClassFactory
#define DESK_EXT_MONITORNAME
Definition: deskcplx.h:13
signed int * PLONG
Definition: retypes.h:5
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:594
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define LoadString
Definition: winuser.h:5799
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define PROPSHEETPAGE
Definition: prsht.h:389
#define WM_NOTIFY
Definition: richedit.h:61