15 #define DEBUG_DEVSETTINGS 55 #define impl_to_interface(impl,iface) (struct iface *)(&(impl)->lp##iface##Vtbl) 113 dd2.
cb =
sizeof(dd2);
179 DPRINT1(
"CDevSettings::GetDeviceInstanceId(%ws) UNIMPLEMENTED!\n", pszDevice);
196 if (lpDevInstId !=
NULL)
209 DPRINT1(
"instance id: %ws\n", lpDevInstId);
222 static const WCHAR szRegPrefix[] =
L"\\Registry\\Machine\\";
227 lpRegKey =
This->pDisplayKey;
228 if (lpRegKey !=
NULL)
235 lpRegKey +=
wcslen(szRegPrefix);
269 DPRINT1(
"CDevSettings::GetCurrentMode\n");
279 DPRINT1(
"CDevSettings::SetCurrentMode(0x%p)\n", pDevMode);
286 PBOOL pbKeyIsReadOnly,
291 DPRINT1(
"CDevSettings::GetPruningMode(%p,%p,%p)\n", pbModesPruned, pbKeyIsReadOnly, pbPruningOn);
293 *pbModesPruned =
This->bModesPruned;
294 *pbKeyIsReadOnly =
This->bKeyIsReadOnly;
295 *pbPruningOn =
This->bPruningOn;
306 DPRINT1(
"CDevSettings::SetPruningMode(%d)\n", PruningOn);
308 if (
This->bModesPruned && !
This->bKeyIsReadOnly &&
309 PruningOn !=
This->bPruningOn)
323 (
const BYTE *)&dwValue,
369 DWORD dwType, dwMemSize = 0;
373 TEXT(
"HardwareInformation.MemorySize"),
379 dwSize ==
sizeof(dwMemSize))
383 if (dwMemSize > 1024)
386 if (dwMemSize > 1024)
408 TEXT(
"HardwareInformation.ChipType"),
411 TEXT(
"HardwareInformation.DacType"),
414 TEXT(
"HardwareInformation.AdapterString"),
417 TEXT(
"HardwareInformation.BiosString"),
431 DPRINT1(
"This->StateFlags: %x\n",
This->StateFlags);
446 DPRINT1(
"This->pDisplayDevice: %ws\n",
This->pDisplayDevice);
448 DPRINT1(
"This->pDisplayName: %ws\n",
This->pDisplayName);
450 DPRINT1(
"This->pDisplayKey: %ws\n",
This->pDisplayKey);
452 DPRINT1(
"This->pDisplayId: %ws\n",
This->pDisplayId);
454 DPRINT1(
"This->pMonitorName: %ws\n",
This->pMonitorName);
456 DPRINT1(
"This->pMonitorDevice: %ws\n",
This->pMonitorDevice);
482 This->bPruningOn = (
dw != 0);
524 DPRINT1(
"CDevSettings::QueryInterface: Queried unknown interface\n");
551 FORMATETC* pformatetcIn,
563 hr = IDataObject_QueryGetData(iface,
569 if (pformatetcIn->cfFormat ==
This->cfDisplayDevice)
571 pszRet =
This->pDisplayDevice;
572 DPRINT1(
"CDevSettings::GetData returns display device %ws\n", pszRet);
574 else if (pformatetcIn->cfFormat ==
This->cfDisplayName)
576 pszRet =
This->pDisplayName;
577 DPRINT1(
"CDevSettings::GetData returns display name %ws\n", pszRet);
579 else if (pformatetcIn->cfFormat ==
This->cfDisplayKey)
581 pszRet =
This->pDisplayKey;
582 DPRINT1(
"CDevSettings::GetData returns display key %ws\n", pszRet);
584 else if (pformatetcIn->cfFormat ==
This->cfDisplayId)
586 pszRet =
This->pDisplayId;
587 DPRINT1(
"CDevSettings::GetData returns display id %ws\n", pszRet);
589 else if (pformatetcIn->cfFormat ==
This->cfMonitorName)
591 pszRet =
This->pMonitorName;
592 DPRINT1(
"CDevSettings::GetData returns monitor name %ws\n", pszRet);
594 else if (pformatetcIn->cfFormat ==
This->cfMonitorDevice)
596 pszRet =
This->pMonitorDevice;
597 DPRINT1(
"CDevSettings::GetData returns monitor device %ws\n", pszRet);
599 else if (pformatetcIn->cfFormat ==
This->cfExtInterface)
609 sizeof(
This->ExtInterface));
611 DPRINT1(
"CDevSettings::GetData returns the desk.cpl extension interface\n");
613 pmedium->tymed = TYMED_HGLOBAL;
614 pmedium->hGlobal = pIface;
621 else if (pformatetcIn->cfFormat ==
This->cfDisplayStateFlags)
629 *pdw =
This->StateFlags;
631 DPRINT1(
"CDevSettings::GetData returns the display state flags %x\n",
This->StateFlags);
633 pmedium->tymed = TYMED_HGLOBAL;
634 pmedium->hGlobal = pdw;
641 else if (pformatetcIn->cfFormat ==
This->cfPruningMode)
649 *pb = (
This->bModesPruned &&
This->bPruningOn);
651 pmedium->tymed = TYMED_HGLOBAL;
652 pmedium->hGlobal = pb;
675 pmedium->tymed = TYMED_HGLOBAL;
676 pmedium->hGlobal = pszBuf;
689 FORMATETC* pformatetc,
693 sizeof(*pformatetc));
699 FORMATETC* pformatetc)
702 TCHAR szFormatName[255];
706 if (pformatetc->dwAspect != DVASPECT_CONTENT)
709 if (pformatetc->lindex != -1)
712 if (!(pformatetc->tymed & TYMED_HGLOBAL))
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)
733 sizeof(szFormatName) /
sizeof(szFormatName[0])))
735 DPRINT1(
"CDevSettings::QueryGetData(\"%ws\")\n", szFormatName);
739 DPRINT1(
"CDevSettings::QueryGetData(Format %u)\n", (
unsigned int)pformatetc->cfFormat);
749 FORMATETC* pformatectIn,
750 FORMATETC* pformatetcOut)
754 DPRINT1(
"CDevSettings::GetCanonicalFormatEtc\n");
756 hr = IDataObject_QueryGetData(iface,
765 if (pformatectIn->ptd ==
NULL)
769 pformatetcOut->ptd =
NULL;
784 FORMATETC* pformatetc,
788 DPRINT1(
"CDevSettings::SetData UNIMPLEMENTED\n");
796 pFormatEtc->cfFormat =
cf;
797 pFormatEtc->ptd =
NULL;
798 pFormatEtc->dwAspect = DVASPECT_CONTENT;
799 pFormatEtc->lindex = -1;
800 pFormatEtc->tymed = TYMED_HGLOBAL;
812 *ppenumFormatEtc =
NULL;
814 if (dwDirection == DATADIR_GET)
817 This->cfExtInterface);
819 This->cfDisplayDevice);
821 This->cfDisplayName);
827 This->cfDisplayStateFlags);
829 This->cfMonitorName);
831 This->cfMonitorDevice);
833 This->cfPruningMode);
847 FORMATETC* pformatetc,
850 DWORD* pdwConnection)
867 *ppenumAdvise =
NULL;
916 DPRINT(
"DisplaySaveSettings() UNIMPLEMENTED!\n");
#define DISPLAY_DEVICE_MODESPRUNED
static __inline VOID pCDevSettings_FillFormatEtc(FORMATETC *pFormatEtc, CLIPFORMAT cf)
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
#define DESK_EXT_DISPLAYNAME
static const struct IDataObjectVtbl vtblIDataObject
LONG WINAPI DisplaySaveSettings(PVOID pContext, HWND hwndPropSheet)
static HRESULT STDMETHODCALLTYPE CDevSettings_GetData(IDataObject *iface, FORMATETC *pformatetcIn, STGMEDIUM *pmedium)
#define DATA_S_SAMEFORMATETC
_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)
CLIPFORMAT cfMonitorDevice
const GUID IID_IDataObject
static HRESULT STDMETHODCALLTYPE CDevSettings_EnumDAdvise(IDataObject *iface, IEnumSTATDATA **ppenumAdvise)
static VOID pCDevSettings_Free(PCDevSettings This)
#define DESK_EXT_DISPLAYID
#define DESK_EXT_PRUNINGMODE
static VOID pCDevSettings_ReadHardwareInfo(HKEY hKey, LPCTSTR lpValueName, LPWSTR lpBuffer)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define DESK_EXT_DISPLAYSTATEFLAGS
_Null_terminated_ WCHAR * DEVINSTID_W
static VOID pCDevSettings_InitializeExtInterface(PCDevSettings This)
#define GetClipboardFormatName
BOOL DESK_EXT_CALLBACK CDevSettings_SetCurrentMode(PVOID Context, const DEVMODEW *pDevMode)
static HRESULT STDMETHODCALLTYPE CDevSettings_QueryInterface(IDataObject *iface, REFIID riid, void **ppvObject)
static PWSTR pCDevSettings_GetDeviceInstanceId(const WCHAR *pszDevice)
LONG WINAPI RegCloseKey(HKEY hKey)
struct _CDevSettings CDevSettings
const struct IDataObjectVtbl * lpIDataObjectVtbl
static HRESULT STDMETHODCALLTYPE CDevSettings_GetCanonicalFormatEtc(IDataObject *iface, FORMATETC *pformatectIn, FORMATETC *pformatetcOut)
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
CLIPFORMAT cfExtInterface
static HRESULT STDMETHODCALLTYPE CDevSettings_GetDataHere(IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium)
#define DISP_CHANGE_BADPARAM
REFIID LPVOID DWORD_PTR dw
HRESULT WINAPI SHCreateStdEnumFmtEtc(UINT cFormats, const FORMATETC *lpFormats, LPENUMFORMATETC *ppenumFormatetc)
static HKEY pCDevSettings_OpenDeviceKey(PCDevSettings This, BOOL ReadOnly)
static HRESULT STDMETHODCALLTYPE CDevSettings_EnumFormatEtc(IDataObject *iface, DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc)
size_t __cdecl _tcslen(const _TCHAR *str)
CONFIGRET WINAPI CM_Get_Device_IDW(_In_ DEVINST dnDevInst, _Out_writes_(BufferLen) PWCHAR Buffer, _In_ ULONG BufferLen, _In_ ULONG ulFlags)
#define DESK_EXT_CALLBACK
BOOL WINAPI EnumDisplayDevicesW(LPCWSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICEW lpDisplayDevice, DWORD dwFlags)
#define DESK_EXT_DISPLAYKEY
#define impl_to_interface(impl, iface)
#define IDS_UNKNOWNMONITOR
static const WCHAR szEmpty[]
VOID DESK_EXT_CALLBACK CDevSettings_GetPruningMode(PVOID Context, PBOOL pbModesPruned, PBOOL pbKeyIsReadOnly, PBOOL pbPruningOn)
static HRESULT STDMETHODCALLTYPE CDevSettings_QueryGetData(IDataObject *iface, FORMATETC *pformatetc)
#define IDS_MULTIPLEMONITORS
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static __inline PCDevSettings impl_from_IDataObject(struct IDataObject *iface)
static HRESULT STDMETHODCALLTYPE CDevSettings_DAdvise(IDataObject *iface, FORMATETC *pformatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection)
#define DESK_EXT_EXTINTERFACE
_In_ WDFCOLLECTION _In_ ULONG Index
#define STDMETHODCALLTYPE
CLIPFORMAT cfDisplayStateFlags
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
CONFIGRET WINAPI CM_Locate_DevNodeW(_Out_ PDEVINST pdnDevInst, _In_opt_ DEVINSTID_W pDeviceID, _In_ ULONG ulFlags)
static HRESULT STDMETHODCALLTYPE CDevSettings_SetData(IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
static PWSTR pCDevSettings_GetMonitorDevice(const WCHAR *pszDisplayDevice)
#define DESK_EXT_MONITORDEVICE
_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)
#define InterlockedDecrement
REFIID LPVOID * ppvObject
IDataObject * CreateDevSettings(PDISPLAY_DEVICE_ENTRY DisplayDeviceInfo)
#define RegisterClipboardFormat
#define OLE_E_ADVISENOTSUPPORTED
PDEVMODEW DESK_EXT_CALLBACK CDevSettings_GetCurrentMode(PVOID Context)
#define InterlockedIncrement
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
CLIPFORMAT cfDisplayDevice
HLOCAL NTAPI LocalFree(HLOCAL hMem)
#define FIELD_OFFSET(t, f)
static HRESULT STDMETHODCALLTYPE CDevSettings_DUnadvise(IDataObject *iface, DWORD dwConnection)
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
CONFIGRET WINAPI CM_Get_Device_ID_Size(_Out_ PULONG pulLen, _In_ DEVINST dnDevInst, _In_ ULONG ulFlags)
static PWSTR pCDevSettings_GetMonitorName(const WCHAR *pszDisplayDevice)
struct _CDevSettings * PCDevSettings
#define MultiByteToWideChar
DESK_EXT_INTERFACE ExtInterface
static __inline VOID pCDevSettings_FreeString(PWCHAR *psz)
PDEVMODEW DESK_EXT_CALLBACK CDevSettings_EnumAllModes(PVOID Context, DWORD Index)
VOID DESK_EXT_CALLBACK CDevSettings_SetPruningMode(PVOID Context, BOOL PruningOn)
#define DESK_EXT_DISPLAYDEVICE
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
GLuint GLuint GLsizei GLenum type
static ULONG STDMETHODCALLTYPE CDevSettings_AddRef(IDataObject *iface)
#define CM_LOCATE_DEVNODE_NORMAL
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
static HRESULT pCDevSettings_Initialize(PCDevSettings This, PDISPLAY_DEVICE_ENTRY DisplayDeviceInfo)
#define DESK_EXT_MONITORNAME
static PWSTR pCDevSettings_AllocAndCopyString(const TCHAR *pszSrc)
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
#define HKEY_LOCAL_MACHINE