ReactOS  0.4.14-dev-606-g14ebc0b
devsett.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS Display Control Panel
4  * FILE: dll/cpl/desk/devsett.c
5  * PURPOSE: ReactOS Display Control Panel Shell Extension Support
6  */
7 
8 #include "desk.h"
9 
10 #include <cfgmgr32.h>
11 
12 #define NDEBUG
13 #include <debug.h>
14 
15 #define DEBUG_DEVSETTINGS
16 
17 typedef struct _CDevSettings
18 {
19  const struct IDataObjectVtbl *lpIDataObjectVtbl;
21 
22  CLIPFORMAT cfExtInterface; /* "Desk.cpl extension interface" */
23  CLIPFORMAT cfDisplayDevice; /* "Display Device" */
24  CLIPFORMAT cfDisplayName; /* "Display Name" */
25  CLIPFORMAT cfDisplayId; /* "Display ID" */
26  CLIPFORMAT cfMonitorName; /* "Monitor Name" */
27  CLIPFORMAT cfMonitorDevice; /* "Monitor Device" */
28  CLIPFORMAT cfDisplayKey; /* "Display Key" */
29  CLIPFORMAT cfDisplayStateFlags; /* "Display State Flags" */
30  CLIPFORMAT cfPruningMode; /* "Pruning Mode" */
31 
38 
40 
42 
43  union
44  {
46  struct
47  {
51  };
52  };
54 
55 #define impl_to_interface(impl,iface) (struct iface *)(&(impl)->lp##iface##Vtbl)
56 
57 static __inline PCDevSettings
59 {
61  lpIDataObjectVtbl));
62 }
63 
64 static __inline VOID
66 {
67  if (*psz != NULL)
68  {
69  LocalFree((HLOCAL)*psz);
70  *psz = NULL;
71  }
72 }
73 
74 static PWSTR
76 {
77  SIZE_T c;
78  PWSTR str;
79 
80  c = _tcslen(pszSrc) + 1;
82  c * sizeof(WCHAR));
83  if (str != NULL)
84  {
85 #ifdef UNICODE
86  StringCbCopyW(str, c * sizeof(WCHAR),
87  pszSrc);
88 #else
90  0,
91  pszSrc,
92  -1,
93  str,
94  c);
95 #endif
96  }
97 
98  return str;
99 }
100 
101 static PWSTR
102 pCDevSettings_GetMonitorName(const WCHAR *pszDisplayDevice)
103 {
104  DISPLAY_DEVICEW dd, dd2;
105  PWSTR str = NULL;
106 
107  dd.cb = sizeof(dd);
108  if (EnumDisplayDevicesW(pszDisplayDevice,
109  0,
110  &dd,
111  0))
112  {
113  dd2.cb = sizeof(dd2);
114  if (EnumDisplayDevicesW(pszDisplayDevice,
115  1,
116  &dd2,
117  0))
118  {
119  /* There's more than one monitor connected... */
122  dd.DeviceString,
123  sizeof(dd.DeviceString) / sizeof(dd.DeviceString[0]));
124  }
125  }
126  else
127  {
128  /* We can't enumerate a monitor, make sure this fact is reported
129  to the user! */
132  dd.DeviceString,
133  sizeof(dd.DeviceString) / sizeof(dd.DeviceString[0]));
134  }
135 
137  (wcslen(dd.DeviceString) + 1) * sizeof(WCHAR));
138  if (str != NULL)
139  {
140  wcscpy(str,
141  dd.DeviceString);
142  }
143 
144  return str;
145 }
146 
147 static PWSTR
148 pCDevSettings_GetMonitorDevice(const WCHAR *pszDisplayDevice)
149 {
150  DISPLAY_DEVICEW dd;
151  PWSTR str = NULL;
152 
153  dd.cb = sizeof(dd);
154  if (EnumDisplayDevicesW(pszDisplayDevice,
155  0,
156  &dd,
157  0))
158  {
160  (wcslen(dd.DeviceName) + 1) * sizeof(WCHAR));
161  if (str != NULL)
162  {
163  wcscpy(str,
164  dd.DeviceName);
165  }
166  }
167 
168  return str;
169 }
170 
171 static PWSTR
173 {
174  DEVINST DevInst;
175  CONFIGRET cr;
176  ULONG BufLen;
177  LPWSTR lpDevInstId = NULL;
178 
179  DPRINT1("CDevSettings::GetDeviceInstanceId(%ws) UNIMPLEMENTED!\n", pszDevice);
180 
181  cr = CM_Locate_DevNodeW(&DevInst,
182  (DEVINSTID_W)pszDevice,
184  if (cr == CR_SUCCESS)
185  {
186  DPRINT1("Success1\n");
188  DevInst,
189  0);
190  if (cr == CR_SUCCESS)
191  {
192  DPRINT1("Success2\n");
193  lpDevInstId = LocalAlloc(LMEM_FIXED,
194  (BufLen + 1) * sizeof(WCHAR));
195 
196  if (lpDevInstId != NULL)
197  {
198  DPRINT1("Success3\n");
199  cr = CM_Get_Device_IDW(DevInst,
200  lpDevInstId,
201  BufLen,
202  0);
203 
204  if (cr != CR_SUCCESS)
205  {
206  LocalFree((HLOCAL)lpDevInstId);
207  lpDevInstId = NULL;
208  }
209  DPRINT1("instance id: %ws\n", lpDevInstId);
210  }
211  }
212  }
213 
214  return lpDevInstId;
215 }
216 
217 
218 static HKEY
220  BOOL ReadOnly)
221 {
222  static const WCHAR szRegPrefix[] = L"\\Registry\\Machine\\";
223  PWSTR lpRegKey;
224  REGSAM Access = KEY_READ;
225  HKEY hKey;
226 
227  lpRegKey = This->pDisplayKey;
228  if (lpRegKey != NULL)
229  {
230  if (wcslen(lpRegKey) >= wcslen(szRegPrefix) &&
231  !_wcsnicmp(lpRegKey,
232  szRegPrefix,
233  wcslen(szRegPrefix)))
234  {
235  lpRegKey += wcslen(szRegPrefix);
236  }
237 
238  if (!ReadOnly)
239  Access |= KEY_WRITE;
240 
242  lpRegKey,
243  0,
244  Access,
245  &hKey) == ERROR_SUCCESS)
246  {
247  return hKey;
248  }
249  }
250 
251  return NULL;
252 }
253 
256  DWORD Index)
257 {
258  //PCDevSettings This = impl_from_IDataObject((IDataObject *)Context);
259  /* FIXME: Implement */
260  DPRINT1("CDevSettings::EnumAllModes(%u)\n", Index);
261  return NULL;
262 }
263 
266 {
267  //PCDevSettings This = impl_from_IDataObject((IDataObject *)Context);
268  /* FIXME: Implement */
269  DPRINT1("CDevSettings::GetCurrentMode\n");
270  return NULL;
271 }
272 
275  const DEVMODEW *pDevMode)
276 {
277  //PCDevSettings This = impl_from_IDataObject((IDataObject *)Context);
278  /* FIXME: Implement */
279  DPRINT1("CDevSettings::SetCurrentMode(0x%p)\n", pDevMode);
280  return FALSE;
281 }
282 
285  PBOOL pbModesPruned,
286  PBOOL pbKeyIsReadOnly,
287  PBOOL pbPruningOn)
288 {
290 
291  DPRINT1("CDevSettings::GetPruningMode(%p,%p,%p)\n", pbModesPruned, pbKeyIsReadOnly, pbPruningOn);
292 
293  *pbModesPruned = This->bModesPruned;
294  *pbKeyIsReadOnly = This->bKeyIsReadOnly;
295  *pbPruningOn = This->bPruningOn;
296 }
297 
300  BOOL PruningOn)
301 {
302  HKEY hKey;
303  DWORD dwValue;
305 
306  DPRINT1("CDevSettings::SetPruningMode(%d)\n", PruningOn);
307 
308  if (This->bModesPruned && !This->bKeyIsReadOnly &&
309  PruningOn != This->bPruningOn)
310  {
311  This->bPruningOn = (PruningOn != FALSE);
312 
314  FALSE);
315  if (hKey != NULL)
316  {
317  dwValue = (DWORD)This->bPruningOn;
318 
319  RegSetValueEx(hKey,
320  TEXT("PruningMode"),
321  0,
322  REG_DWORD,
323  (const BYTE *)&dwValue,
324  sizeof(dwValue));
325 
326  RegCloseKey(hKey);
327  }
328  }
329 }
330 
331 static VOID
333  LPCTSTR lpValueName,
335 {
337  DWORD size = 128 * sizeof(WCHAR);
338  RegQueryValueEx(hKey,
339  lpValueName,
340  NULL,
341  &type,
342  (PBYTE)lpBuffer,
343  &size);
344 }
345 
346 static VOID
348 {
349  PDESK_EXT_INTERFACE Interface = &This->ExtInterface;
350  HKEY hKeyDev;
351 
353  sizeof(*Interface));
354  Interface->cbSize = sizeof(*Interface);
355 
356  /* Initialize the callback table */
358  Interface->EnumAllModes = CDevSettings_EnumAllModes;
359  Interface->SetCurrentMode = CDevSettings_SetCurrentMode;
360  Interface->GetCurrentMode = CDevSettings_GetCurrentMode;
361  Interface->SetPruningMode = CDevSettings_SetPruningMode;
362  Interface->GetPruningMode = CDevSettings_GetPruningMode;
363 
364  /* Read the HardwareInformation.* values from the registry key */
366  TRUE);
367  if (hKeyDev != NULL)
368  {
369  DWORD dwType, dwMemSize = 0;
370  DWORD dwSize = sizeof(dwMemSize);
371 
372  if (RegQueryValueEx(hKeyDev,
373  TEXT("HardwareInformation.MemorySize"),
374  NULL,
375  &dwType,
376  (PBYTE)&dwMemSize,
377  &dwSize) == ERROR_SUCCESS &&
378  (dwType == REG_BINARY || dwType == REG_DWORD) &&
379  dwSize == sizeof(dwMemSize))
380  {
381  dwMemSize /= 1024;
382 
383  if (dwMemSize > 1024)
384  {
385  dwMemSize /= 1024;
386  if (dwMemSize > 1024)
387  {
388  wsprintf(Interface->MemorySize,
389  _T("%u GB"),
390  dwMemSize / 1024);
391  }
392  else
393  {
394  wsprintf(Interface->MemorySize,
395  _T("%u MB"),
396  dwMemSize);
397  }
398  }
399  else
400  {
401  wsprintf(Interface->MemorySize,
402  _T("%u KB"),
403  dwMemSize);
404  }
405  }
406 
408  TEXT("HardwareInformation.ChipType"),
409  Interface->ChipType);
411  TEXT("HardwareInformation.DacType"),
412  Interface->DacType);
414  TEXT("HardwareInformation.AdapterString"),
415  Interface->AdapterString);
417  TEXT("HardwareInformation.BiosString"),
418  Interface->BiosString);
419  RegCloseKey(hKeyDev);
420  }
421 }
422 
423 static HRESULT
425  PDISPLAY_DEVICE_ENTRY DisplayDeviceInfo)
426 {
427  HKEY hKey;
428 
429  This->Flags = 0;
430  This->StateFlags = DisplayDeviceInfo->DeviceStateFlags;
431  DPRINT1("This->StateFlags: %x\n", This->StateFlags);
432 
433  /* Register clipboard formats */
443 
444  /* Copy the device name */
445  This->pDisplayDevice = pCDevSettings_AllocAndCopyString(DisplayDeviceInfo->DeviceName);
446  DPRINT1("This->pDisplayDevice: %ws\n", This->pDisplayDevice);
447  This->pDisplayName = pCDevSettings_AllocAndCopyString(DisplayDeviceInfo->DeviceDescription);
448  DPRINT1("This->pDisplayName: %ws\n", This->pDisplayName);
449  This->pDisplayKey = pCDevSettings_AllocAndCopyString(DisplayDeviceInfo->DeviceKey);
450  DPRINT1("This->pDisplayKey: %ws\n", This->pDisplayKey);
451  This->pDisplayId = pCDevSettings_GetDeviceInstanceId(DisplayDeviceInfo->DeviceID);
452  DPRINT1("This->pDisplayId: %ws\n", This->pDisplayId);
453  This->pMonitorName = pCDevSettings_GetMonitorName(This->pDisplayDevice);
454  DPRINT1("This->pMonitorName: %ws\n", This->pMonitorName);
455  This->pMonitorDevice = pCDevSettings_GetMonitorDevice(This->pDisplayDevice);
456  DPRINT1("This->pMonitorDevice: %ws\n", This->pMonitorDevice);
457 
458  /* Check pruning mode */
459  This->bModesPruned = ((DisplayDeviceInfo->DeviceStateFlags & DISPLAY_DEVICE_MODESPRUNED) != 0);
461  FALSE);
462  if (hKey == NULL)
463  {
465  FALSE);
466  This->bKeyIsReadOnly = TRUE;
467  }
468  if (hKey != NULL)
469  {
470  DWORD dw = 0;
471  DWORD dwType, dwSize;
472 
473  dwSize = sizeof(dw);
474  if (RegQueryValueEx(hKey,
475  TEXT("PruningMode"),
476  NULL,
477  &dwType,
478  (PBYTE)&dw,
479  &dwSize) == ERROR_SUCCESS)
480  {
481  if (dwType == REG_DWORD && dwSize == sizeof(dw))
482  This->bPruningOn = (dw != 0);
483  }
484 
485  RegCloseKey(hKey);
486  }
487 
488  /* Initialize the shell extension interface */
490 
491  return S_OK;
492 }
493 
494 static VOID
496 {
497  pCDevSettings_FreeString(&This->pDisplayDevice);
498  pCDevSettings_FreeString(&This->pDisplayName);
499  pCDevSettings_FreeString(&This->pDisplayKey);
500  pCDevSettings_FreeString(&This->pDisplayId);
501  pCDevSettings_FreeString(&This->pMonitorName);
502  pCDevSettings_FreeString(&This->pMonitorDevice);
503 }
504 
507  REFIID riid,
508  void** ppvObject)
509 {
511 
512  *ppvObject = NULL;
513 
514  if (IsEqualGUID(riid,
515  &IID_IUnknown) ||
517  &IID_IDataObject))
518  {
520  return S_OK;
521  }
522  else
523  {
524  DPRINT1("CDevSettings::QueryInterface: Queried unknown interface\n");
525  }
526 
527  return E_NOINTERFACE;
528 }
529 
532 {
534  return (ULONG)InterlockedIncrement((PLONG)&This->ref);
535 }
536 
539 {
540  ULONG refs;
542  refs = (ULONG)InterlockedDecrement((PLONG)&This->ref);
543  if (refs == 0)
545 
546  return refs;
547 }
548 
551  FORMATETC* pformatetcIn,
552  STGMEDIUM* pmedium)
553 {
554  static const WCHAR szEmpty[] = {0};
555  HRESULT hr;
556  PCWSTR pszRet = NULL;
557  PWSTR pszBuf;
559 
560  ZeroMemory(pmedium,
561  sizeof(STGMEDIUM));
562 
563  hr = IDataObject_QueryGetData(iface,
564  pformatetcIn);
565  if (SUCCEEDED(hr))
566  {
567  /* Return the requested data back to the shell extension */
568 
569  if (pformatetcIn->cfFormat == This->cfDisplayDevice)
570  {
571  pszRet = This->pDisplayDevice;
572  DPRINT1("CDevSettings::GetData returns display device %ws\n", pszRet);
573  }
574  else if (pformatetcIn->cfFormat == This->cfDisplayName)
575  {
576  pszRet = This->pDisplayName;
577  DPRINT1("CDevSettings::GetData returns display name %ws\n", pszRet);
578  }
579  else if (pformatetcIn->cfFormat == This->cfDisplayKey)
580  {
581  pszRet = This->pDisplayKey;
582  DPRINT1("CDevSettings::GetData returns display key %ws\n", pszRet);
583  }
584  else if (pformatetcIn->cfFormat == This->cfDisplayId)
585  {
586  pszRet = This->pDisplayId;
587  DPRINT1("CDevSettings::GetData returns display id %ws\n", pszRet);
588  }
589  else if (pformatetcIn->cfFormat == This->cfMonitorName)
590  {
591  pszRet = This->pMonitorName;
592  DPRINT1("CDevSettings::GetData returns monitor name %ws\n", pszRet);
593  }
594  else if (pformatetcIn->cfFormat == This->cfMonitorDevice)
595  {
596  pszRet = This->pMonitorDevice;
597  DPRINT1("CDevSettings::GetData returns monitor device %ws\n", pszRet);
598  }
599  else if (pformatetcIn->cfFormat == This->cfExtInterface)
600  {
601  PDESK_EXT_INTERFACE pIface;
602 
603  pIface = GlobalAlloc(GPTR,
604  sizeof(*pIface));
605  if (pIface != NULL)
606  {
607  CopyMemory(pIface,
608  &This->ExtInterface,
609  sizeof(This->ExtInterface));
610 
611  DPRINT1("CDevSettings::GetData returns the desk.cpl extension interface\n");
612 
613  pmedium->tymed = TYMED_HGLOBAL;
614  pmedium->hGlobal = pIface;
615 
616  return S_OK;
617  }
618  else
619  return E_OUTOFMEMORY;
620  }
621  else if (pformatetcIn->cfFormat == This->cfDisplayStateFlags)
622  {
623  PDWORD pdw;
624 
625  pdw = GlobalAlloc(GPTR,
626  sizeof(*pdw));
627  if (pdw != NULL)
628  {
629  *pdw = This->StateFlags;
630 
631  DPRINT1("CDevSettings::GetData returns the display state flags %x\n", This->StateFlags);
632 
633  pmedium->tymed = TYMED_HGLOBAL;
634  pmedium->hGlobal = pdw;
635 
636  return S_OK;
637  }
638  else
639  return E_OUTOFMEMORY;
640  }
641  else if (pformatetcIn->cfFormat == This->cfPruningMode)
642  {
643  PBYTE pb;
644 
645  pb = GlobalAlloc(GPTR,
646  sizeof(*pb));
647  if (pb != NULL)
648  {
649  *pb = (This->bModesPruned && This->bPruningOn);
650 
651  pmedium->tymed = TYMED_HGLOBAL;
652  pmedium->hGlobal = pb;
653 
654  return S_OK;
655  }
656  else
657  return E_OUTOFMEMORY;
658  }
659 
660  /* NOTE: This only returns null-terminated strings! */
661  if (pszRet == NULL)
662  pszRet = szEmpty;
663 
664  pszBuf = GlobalAlloc(GPTR,
665  (wcslen(pszRet) + 1) * sizeof(WCHAR));
666  if (pszBuf != NULL)
667  {
668  hr = StringCbCopyW(pszBuf, (wcslen(pszRet) + 1) * sizeof(WCHAR), pszRet);
669  if (FAILED(hr))
670  {
671  GlobalFree(pszBuf);
672  return hr;
673  }
674 
675  pmedium->tymed = TYMED_HGLOBAL;
676  pmedium->hGlobal = pszBuf;
677 
678  hr = S_OK;
679  }
680  else
681  hr = E_OUTOFMEMORY;
682  }
683 
684  return hr;
685 }
686 
689  FORMATETC* pformatetc,
690  STGMEDIUM* pmedium)
691 {
692  ZeroMemory(pformatetc,
693  sizeof(*pformatetc));
694  return E_NOTIMPL;
695 }
696 
699  FORMATETC* pformatetc)
700 {
701 #if DEBUG
702  TCHAR szFormatName[255];
703 #endif
705 
706  if (pformatetc->dwAspect != DVASPECT_CONTENT)
707  return DV_E_DVASPECT;
708 
709  if (pformatetc->lindex != -1)
710  return DV_E_LINDEX;
711 
712  if (!(pformatetc->tymed & TYMED_HGLOBAL))
713  return DV_E_TYMED;
714 
715  /* Check if the requested data can be provided */
716  if (pformatetc->cfFormat == This->cfExtInterface ||
717  pformatetc->cfFormat == This->cfDisplayDevice ||
718  pformatetc->cfFormat == This->cfDisplayName ||
719  pformatetc->cfFormat == This->cfDisplayId ||
720  pformatetc->cfFormat == This->cfDisplayKey ||
721  pformatetc->cfFormat == This->cfDisplayStateFlags ||
722  pformatetc->cfFormat == This->cfMonitorDevice ||
723  pformatetc->cfFormat == This->cfMonitorName ||
724  pformatetc->cfFormat == This->cfPruningMode)
725  {
726  return S_OK;
727  }
728 #if DEBUG
729  else
730  {
731  if (GetClipboardFormatName(pformatetc->cfFormat,
732  szFormatName,
733  sizeof(szFormatName) / sizeof(szFormatName[0])))
734  {
735  DPRINT1("CDevSettings::QueryGetData(\"%ws\")\n", szFormatName);
736  }
737  else
738  {
739  DPRINT1("CDevSettings::QueryGetData(Format %u)\n", (unsigned int)pformatetc->cfFormat);
740  }
741  }
742 #endif
743 
744  return DV_E_FORMATETC;
745 }
746 
749  FORMATETC* pformatectIn,
750  FORMATETC* pformatetcOut)
751 {
752  HRESULT hr;
753 
754  DPRINT1("CDevSettings::GetCanonicalFormatEtc\n");
755 
756  hr = IDataObject_QueryGetData(iface,
757  pformatectIn);
758  if (SUCCEEDED(hr))
759  {
760  CopyMemory(pformatetcOut,
761  pformatectIn,
762  sizeof(FORMATETC));
763 
764  /* Make sure the data is target device independent */
765  if (pformatectIn->ptd == NULL)
767  else
768  {
769  pformatetcOut->ptd = NULL;
770  hr = S_OK;
771  }
772  }
773  else
774  {
775  ZeroMemory(pformatetcOut,
776  sizeof(FORMATETC));
777  }
778 
779  return hr;
780 }
781 
784  FORMATETC* pformatetc,
785  STGMEDIUM* pmedium,
786  BOOL fRelease)
787 {
788  DPRINT1("CDevSettings::SetData UNIMPLEMENTED\n");
789  return E_NOTIMPL;
790 }
791 
792 static __inline VOID
793 pCDevSettings_FillFormatEtc(FORMATETC *pFormatEtc,
794  CLIPFORMAT cf)
795 {
796  pFormatEtc->cfFormat = cf;
797  pFormatEtc->ptd = NULL;
798  pFormatEtc->dwAspect = DVASPECT_CONTENT;
799  pFormatEtc->lindex = -1;
800  pFormatEtc->tymed = TYMED_HGLOBAL;
801 }
802 
805  DWORD dwDirection,
806  IEnumFORMATETC** ppenumFormatEtc)
807 {
808  HRESULT hr;
809  FORMATETC fetc[9];
811 
812  *ppenumFormatEtc = NULL;
813 
814  if (dwDirection == DATADIR_GET)
815  {
817  This->cfExtInterface);
819  This->cfDisplayDevice);
821  This->cfDisplayName);
823  This->cfDisplayId);
825  This->cfDisplayKey);
827  This->cfDisplayStateFlags);
829  This->cfMonitorName);
831  This->cfMonitorDevice);
833  This->cfPruningMode);
834 
835  hr = SHCreateStdEnumFmtEtc(sizeof(fetc) / sizeof(fetc[0]),
836  fetc,
837  ppenumFormatEtc);
838  }
839  else
840  hr = E_NOTIMPL;
841 
842  return hr;
843 }
844 
847  FORMATETC* pformatetc,
848  DWORD advf,
849  IAdviseSink* pAdvSink,
850  DWORD* pdwConnection)
851 {
852  *pdwConnection = 0;
854 }
855 
858  DWORD dwConnection)
859 {
861 }
862 
865  IEnumSTATDATA** ppenumAdvise)
866 {
867  *ppenumAdvise = NULL;
869 }
870 
871 static const struct IDataObjectVtbl vtblIDataObject = {
884 };
885 
886 IDataObject *
888 {
890 
892  0,
893  sizeof(*This));
894  if (This != NULL)
895  {
896  This->lpIDataObjectVtbl = &vtblIDataObject;
897  This->ref = 1;
898 
900  DisplayDeviceInfo)))
901  {
903  }
904 
906  }
907 
908  return NULL;
909 }
910 
911 LONG WINAPI
913  HWND hwndPropSheet)
914 {
915  //PCDevSettings This = impl_from_IDataObject((IDataObject *)Context);
916  DPRINT("DisplaySaveSettings() UNIMPLEMENTED!\n");
917  return DISP_CHANGE_BADPARAM;
918 }
#define RegQueryValueEx
Definition: winreg.h:524
static IClassFactory * cf
#define DISPLAY_DEVICE_MODESPRUNED
Definition: wingdi.h:1403
static __inline VOID pCDevSettings_FillFormatEtc(FORMATETC *pFormatEtc, CLIPFORMAT cf)
Definition: devsett.c:793
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define REFIID
Definition: guiddef.h:118
#define TRUE
Definition: types.h:120
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define E_NOINTERFACE
Definition: winerror.h:2364
LPWSTR DeviceKey
Definition: precomp.h:72
#define DESK_EXT_DISPLAYNAME
Definition: deskcplx.h:9
static const struct IDataObjectVtbl vtblIDataObject
Definition: devsett.c:871
CLIPFORMAT cfDisplayId
Definition: devsett.c:25
LONG WINAPI DisplaySaveSettings(PVOID pContext, HWND hwndPropSheet)
Definition: devsett.c:912
#define ERROR_SUCCESS
Definition: deptool.c:10
CLIPFORMAT cfDisplayName
Definition: devsett.c:24
static HRESULT STDMETHODCALLTYPE CDevSettings_GetData(IDataObject *iface, FORMATETC *pformatetcIn, STGMEDIUM *pmedium)
Definition: devsett.c:550
HRESULT hr
Definition: shlfolder.c:183
#define DATA_S_SAMEFORMATETC
Definition: winerror.h:2674
#define GPTR
Definition: winbase.h:293
#define BufLen
Definition: fatfs.h:167
#define REG_BINARY
Definition: nt_native.h:1496
#define KEY_READ
Definition: nt_native.h:1023
REFIID riid
Definition: precomp.h:44
uint16_t * PWSTR
Definition: typedefs.h:54
#define CP_ACP
Definition: compat.h:99
Definition: arc.h:80
WCHAR DeviceString[128]
Definition: wingdi.h:2818
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
PWSTR pMonitorDevice
Definition: devsett.c:37
CLIPFORMAT cfMonitorDevice
Definition: devsett.c:27
Definition: precomp.h:67
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define ZeroMemory
Definition: winbase.h:1642
LPWSTR DeviceName
Definition: precomp.h:71
HINSTANCE hApplet
Definition: access.c:17
const GUID IID_IDataObject
uint16_t * PWCHAR
Definition: typedefs.h:54
static HRESULT STDMETHODCALLTYPE CDevSettings_EnumDAdvise(IDataObject *iface, IEnumSTATDATA **ppenumAdvise)
Definition: devsett.c:864
static VOID pCDevSettings_Free(PCDevSettings This)
Definition: devsett.c:495
#define DESK_EXT_DISPLAYID
Definition: deskcplx.h:10
#define DESK_EXT_PRUNINGMODE
Definition: deskcplx.h:7
static VOID pCDevSettings_ReadHardwareInfo(HKEY hKey, LPCTSTR lpValueName, LPWSTR lpBuffer)
Definition: devsett.c:332
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define DWORD
Definition: nt_native.h:44
#define DESK_EXT_DISPLAYSTATEFLAGS
Definition: deskcplx.h:12
WCHAR DeviceName[32]
Definition: wingdi.h:2817
_Null_terminated_ WCHAR * DEVINSTID_W
Definition: cfgmgr32.h:80
static VOID pCDevSettings_InitializeExtInterface(PCDevSettings This)
Definition: devsett.c:347
#define GetClipboardFormatName
Definition: winuser.h:5759
BOOL DESK_EXT_CALLBACK CDevSettings_SetCurrentMode(PVOID Context, const DEVMODEW *pDevMode)
Definition: devsett.c:274
static HRESULT STDMETHODCALLTYPE CDevSettings_QueryInterface(IDataObject *iface, REFIID riid, void **ppvObject)
Definition: devsett.c:506
DWORD StateFlags
Definition: devsett.c:41
static PWSTR pCDevSettings_GetDeviceInstanceId(const WCHAR *pszDevice)
Definition: devsett.c:172
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
struct _CDevSettings CDevSettings
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
CLIPFORMAT cfPruningMode
Definition: devsett.c:30
DWORD bPruningOn
Definition: devsett.c:50
unsigned int BOOL
Definition: ntddk_ex.h:94
const struct IDataObjectVtbl * lpIDataObjectVtbl
Definition: devsett.c:19
long LONG
Definition: pedump.c:60
static HRESULT STDMETHODCALLTYPE CDevSettings_GetCanonicalFormatEtc(IDataObject *iface, FORMATETC *pformatectIn, FORMATETC *pformatetcOut)
Definition: devsett.c:748
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
CLIPFORMAT cfExtInterface
Definition: devsett.c:22
static HRESULT STDMETHODCALLTYPE CDevSettings_GetDataHere(IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium)
Definition: devsett.c:688
#define DISP_CHANGE_BADPARAM
Definition: winuser.h:193
#define CR_SUCCESS
Definition: cfgmgr32.h:842
PWSTR pDisplayId
Definition: devsett.c:35
HRESULT WINAPI SHCreateStdEnumFmtEtc(UINT cFormats, const FORMATETC *lpFormats, LPENUMFORMATETC *ppenumFormatetc)
Definition: shellord.c:1804
static HKEY pCDevSettings_OpenDeviceKey(PCDevSettings This, BOOL ReadOnly)
Definition: devsett.c:219
const WCHAR * str
static HRESULT STDMETHODCALLTYPE CDevSettings_EnumFormatEtc(IDataObject *iface, DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc)
Definition: devsett.c:804
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
CONFIGRET WINAPI CM_Get_Device_IDW(_In_ DEVINST dnDevInst, _Out_writes_(BufferLen) PWCHAR Buffer, _In_ ULONG BufferLen, _In_ ULONG ulFlags)
Definition: cfgmgr.c:3665
smooth NULL
Definition: ftsmooth.c:416
#define DESK_EXT_CALLBACK
Definition: deskcplx.h:4
PWSTR pDisplayDevice
Definition: devsett.c:32
void DPRINT(...)
Definition: polytest.cpp:61
CLIPFORMAT cfMonitorName
Definition: devsett.c:26
BOOL WINAPI EnumDisplayDevicesW(LPCWSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICEW lpDisplayDevice, DWORD dwFlags)
Definition: display.c:78
#define DESK_EXT_DISPLAYKEY
Definition: deskcplx.h:11
void * PVOID
Definition: retypes.h:9
#define impl_to_interface(impl, iface)
Definition: devsett.c:55
BOOL * PBOOL
Definition: windef.h:161
#define IDS_UNKNOWNMONITOR
Definition: resource.h:146
#define LMEM_FIXED
Definition: winbase.h:349
static const WCHAR szEmpty[]
Definition: provider.c:50
VOID DESK_EXT_CALLBACK CDevSettings_GetPruningMode(PVOID Context, PBOOL pbModesPruned, PBOOL pbKeyIsReadOnly, PBOOL pbPruningOn)
Definition: devsett.c:284
#define KEY_WRITE
Definition: nt_native.h:1031
static HRESULT STDMETHODCALLTYPE CDevSettings_QueryGetData(IDataObject *iface, FORMATETC *pformatetc)
Definition: devsett.c:698
#define IDS_MULTIPLEMONITORS
Definition: resource.h:145
char TCHAR
Definition: xmlstorage.h:189
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:359
#define _T(x)
Definition: vfdio.h:22
GLsizeiptr size
Definition: glext.h:5919
#define DV_E_FORMATETC
Definition: winerror.h:2633
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static __inline PCDevSettings impl_from_IDataObject(struct IDataObject *iface)
Definition: devsett.c:58
CLIPFORMAT cfDisplayKey
Definition: devsett.c:28
static HRESULT STDMETHODCALLTYPE CDevSettings_DAdvise(IDataObject *iface, FORMATETC *pformatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection)
Definition: devsett.c:846
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define DESK_EXT_EXTINTERFACE
Definition: deskcplx.h:6
PWSTR pDisplayName
Definition: devsett.c:33
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
#define WINAPI
Definition: msvc.h:6
const GLubyte * c
Definition: glext.h:8905
#define CopyMemory
Definition: winbase.h:1640
static const UCHAR Index[8]
Definition: usbohci.c:18
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
CLIPFORMAT cfDisplayStateFlags
Definition: devsett.c:29
unsigned long DWORD
Definition: ntddk_ex.h:95
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
REFIID LPVOID DWORD dw
Definition: atlbase.h:40
CONFIGRET WINAPI CM_Locate_DevNodeW(_Out_ PDEVINST pdnDevInst, _In_opt_ DEVINSTID_W pDeviceID, _In_ ULONG ulFlags)
Definition: cfgmgr.c:5776
static HRESULT STDMETHODCALLTYPE CDevSettings_SetData(IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
Definition: devsett.c:783
#define DV_E_TYMED
Definition: winerror.h:2638
static PWSTR pCDevSettings_GetMonitorDevice(const WCHAR *pszDisplayDevice)
Definition: devsett.c:148
#define DESK_EXT_MONITORDEVICE
Definition: deskcplx.h:14
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static ULONG STDMETHODCALLTYPE CDevSettings_Release(IDataObject *iface)
Definition: devsett.c:538
static const WCHAR L[]
Definition: oid.c:1250
#define InterlockedDecrement
Definition: armddk.h:52
#define DV_E_DVASPECT
Definition: winerror.h:2640
DWORD DeviceStateFlags
Definition: precomp.h:74
unsigned char BYTE
Definition: mem.h:68
DWORD Flags
Definition: devsett.c:45
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define DV_E_LINDEX
Definition: winerror.h:2637
IDataObject * CreateDevSettings(PDISPLAY_DEVICE_ENTRY DisplayDeviceInfo)
Definition: devsett.c:887
LPWSTR DeviceID
Definition: precomp.h:73
#define RegisterClipboardFormat
Definition: winuser.h:5813
#define OLE_E_ADVISENOTSUPPORTED
Definition: winerror.h:2617
ULONG_PTR SIZE_T
Definition: typedefs.h:78
PDEVMODEW DESK_EXT_CALLBACK CDevSettings_GetCurrentMode(PVOID Context)
Definition: devsett.c:265
#define S_OK
Definition: intsafe.h:59
#define RegOpenKeyEx
Definition: winreg.h:520
#define TEXT(s)
Definition: k32.h:26
DWORD DEVINST
Definition: cfgmgr32.h:76
#define InterlockedIncrement
Definition: armddk.h:53
CLIPFORMAT cfDisplayDevice
Definition: devsett.c:23
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define E_NOTIMPL
Definition: ddrawi.h:99
ACCESS_MASK REGSAM
Definition: winreg.h:69
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
DWORD bModesPruned
Definition: devsett.c:48
static HRESULT STDMETHODCALLTYPE CDevSettings_DUnadvise(IDataObject *iface, DWORD dwConnection)
Definition: devsett.c:857
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
CONFIGRET WINAPI CM_Get_Device_ID_Size(_Out_ PULONG pulLen, _In_ DEVINST dnDevInst, _In_ ULONG ulFlags)
Definition: cfgmgr.c:4062
static PWSTR pCDevSettings_GetMonitorName(const WCHAR *pszDisplayDevice)
Definition: devsett.c:102
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
DWORD * PDWORD
Definition: pedump.c:68
struct _CDevSettings * PCDevSettings
#define MultiByteToWideChar
Definition: compat.h:100
PWSTR pMonitorName
Definition: devsett.c:36
#define DPRINT1
Definition: precomp.h:8
DESK_EXT_INTERFACE ExtInterface
Definition: devsett.c:39
static __inline VOID pCDevSettings_FreeString(PWCHAR *psz)
Definition: devsett.c:65
PDEVMODEW DESK_EXT_CALLBACK CDevSettings_EnumAllModes(PVOID Context, DWORD Index)
Definition: devsett.c:255
#define c
Definition: ke_i.h:80
VOID DESK_EXT_CALLBACK CDevSettings_SetPruningMode(PVOID Context, BOOL PruningOn)
Definition: devsett.c:299
unsigned int ULONG
Definition: retypes.h:1
#define DESK_EXT_DISPLAYDEVICE
Definition: deskcplx.h:8
#define ULONG_PTR
Definition: config.h:101
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
PWSTR pDisplayKey
Definition: devsett.c:34
static ULONG STDMETHODCALLTYPE CDevSettings_AddRef(IDataObject *iface)
Definition: devsett.c:531
#define CM_LOCATE_DEVNODE_NORMAL
Definition: cfgmgr32.h:760
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define wsprintf
Definition: winuser.h:5840
LPWSTR DeviceDescription
Definition: precomp.h:70
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
static HRESULT pCDevSettings_Initialize(PCDevSettings This, PDISPLAY_DEVICE_ENTRY DisplayDeviceInfo)
Definition: devsett.c:424
#define REG_DWORD
Definition: sdbapi.c:596
#define DESK_EXT_MONITORNAME
Definition: deskcplx.h:13
signed int * PLONG
Definition: retypes.h:5
BYTE * PBYTE
Definition: pedump.c:66
static PWSTR pCDevSettings_AllocAndCopyString(const TCHAR *pszSrc)
Definition: devsett.c:75
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define RegSetValueEx
Definition: winreg.h:533
DWORD ref
Definition: devsett.c:20
#define SUCCEEDED(hr)
Definition: intsafe.h:57
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
DWORD bKeyIsReadOnly
Definition: devsett.c:49