ReactOS  0.4.15-dev-4594-g505ac65
devsett.c File Reference
#include "desk.h"
#include <cfgmgr32.h>
#include <debug.h>
Include dependency graph for devsett.c:

Go to the source code of this file.

Classes

struct  _CDevSettings
 

Macros

#define NDEBUG
 
#define DEBUG_DEVSETTINGS
 
#define impl_to_interface(impl, iface)   (struct iface *)(&(impl)->lp##iface##Vtbl)
 

Typedefs

typedef struct _CDevSettings CDevSettings
 
typedef struct _CDevSettingsPCDevSettings
 

Functions

static __inline PCDevSettings impl_from_IDataObject (struct IDataObject *iface)
 
static __inline VOID pCDevSettings_FreeString (PWCHAR *psz)
 
static PWSTR pCDevSettings_AllocAndCopyString (const TCHAR *pszSrc)
 
static PWSTR pCDevSettings_GetMonitorName (const WCHAR *pszDisplayDevice)
 
static PWSTR pCDevSettings_GetMonitorDevice (const WCHAR *pszDisplayDevice)
 
static PWSTR pCDevSettings_GetDeviceInstanceId (const WCHAR *pszDevice)
 Converts a Hardware ID (DeviceID from EnumDisplayDevices) to an unique Device Instance ID. More...
 
static HKEY pCDevSettings_OpenDeviceKey (PCDevSettings This, BOOL ReadOnly)
 
PDEVMODEW DESK_EXT_CALLBACK CDevSettings_EnumAllModes (PVOID Context, DWORD Index)
 
PDEVMODEW DESK_EXT_CALLBACK CDevSettings_GetCurrentMode (PVOID Context)
 
BOOL DESK_EXT_CALLBACK CDevSettings_SetCurrentMode (PVOID Context, const DEVMODEW *pDevMode)
 
VOID DESK_EXT_CALLBACK CDevSettings_GetPruningMode (PVOID Context, PBOOL pbModesPruned, PBOOL pbKeyIsReadOnly, PBOOL pbPruningOn)
 
VOID DESK_EXT_CALLBACK CDevSettings_SetPruningMode (PVOID Context, BOOL PruningOn)
 
static VOID pCDevSettings_ReadHardwareInfo (HKEY hKey, LPCTSTR lpValueName, LPWSTR lpBuffer)
 
static VOID pCDevSettings_InitializeExtInterface (PCDevSettings This)
 
static HRESULT pCDevSettings_Initialize (PCDevSettings This, PDISPLAY_DEVICE_ENTRY DisplayDeviceInfo)
 
static VOID pCDevSettings_Free (PCDevSettings This)
 
static HRESULT STDMETHODCALLTYPE CDevSettings_QueryInterface (IDataObject *iface, REFIID riid, void **ppvObject)
 
static ULONG STDMETHODCALLTYPE CDevSettings_AddRef (IDataObject *iface)
 
static ULONG STDMETHODCALLTYPE CDevSettings_Release (IDataObject *iface)
 
static HRESULT STDMETHODCALLTYPE CDevSettings_GetData (IDataObject *iface, FORMATETC *pformatetcIn, STGMEDIUM *pmedium)
 
static HRESULT STDMETHODCALLTYPE CDevSettings_GetDataHere (IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium)
 
static HRESULT STDMETHODCALLTYPE CDevSettings_QueryGetData (IDataObject *iface, FORMATETC *pformatetc)
 
static HRESULT STDMETHODCALLTYPE CDevSettings_GetCanonicalFormatEtc (IDataObject *iface, FORMATETC *pformatectIn, FORMATETC *pformatetcOut)
 
static HRESULT STDMETHODCALLTYPE CDevSettings_SetData (IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
 
static __inline VOID pCDevSettings_FillFormatEtc (FORMATETC *pFormatEtc, CLIPFORMAT cf)
 
static HRESULT STDMETHODCALLTYPE CDevSettings_EnumFormatEtc (IDataObject *iface, DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc)
 
static HRESULT STDMETHODCALLTYPE CDevSettings_DAdvise (IDataObject *iface, FORMATETC *pformatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection)
 
static HRESULT STDMETHODCALLTYPE CDevSettings_DUnadvise (IDataObject *iface, DWORD dwConnection)
 
static HRESULT STDMETHODCALLTYPE CDevSettings_EnumDAdvise (IDataObject *iface, IEnumSTATDATA **ppenumAdvise)
 
IDataObjectCreateDevSettings (PDISPLAY_DEVICE_ENTRY DisplayDeviceInfo)
 
LONG WINAPI DisplaySaveSettings (PVOID pContext, HWND hwndPropSheet)
 

Variables

static const struct IDataObjectVtbl vtblIDataObject
 

Macro Definition Documentation

◆ DEBUG_DEVSETTINGS

#define DEBUG_DEVSETTINGS

Definition at line 15 of file devsett.c.

◆ impl_to_interface

#define impl_to_interface (   impl,
  iface 
)    (struct iface *)(&(impl)->lp##iface##Vtbl)

Definition at line 55 of file devsett.c.

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file devsett.c.

Typedef Documentation

◆ CDevSettings

◆ PCDevSettings

Function Documentation

◆ CDevSettings_AddRef()

static ULONG STDMETHODCALLTYPE CDevSettings_AddRef ( IDataObject iface)
static

Definition at line 561 of file devsett.c.

562 {
564  return (ULONG)InterlockedIncrement((PLONG)&This->ref);
565 }
static __inline PCDevSettings impl_from_IDataObject(struct IDataObject *iface)
Definition: devsett.c:58
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1
signed int * PLONG
Definition: retypes.h:5

◆ CDevSettings_DAdvise()

static HRESULT STDMETHODCALLTYPE CDevSettings_DAdvise ( IDataObject iface,
FORMATETC *  pformatetc,
DWORD  advf,
IAdviseSink pAdvSink,
DWORD pdwConnection 
)
static

Definition at line 876 of file devsett.c.

881 {
882  *pdwConnection = 0;
884 }
#define OLE_E_ADVISENOTSUPPORTED
Definition: winerror.h:2617

◆ CDevSettings_DUnadvise()

static HRESULT STDMETHODCALLTYPE CDevSettings_DUnadvise ( IDataObject iface,
DWORD  dwConnection 
)
static

Definition at line 887 of file devsett.c.

889 {
891 }
#define OLE_E_ADVISENOTSUPPORTED
Definition: winerror.h:2617

◆ CDevSettings_EnumAllModes()

PDEVMODEW DESK_EXT_CALLBACK CDevSettings_EnumAllModes ( PVOID  Context,
DWORD  Index 
)

Definition at line 285 of file devsett.c.

287 {
288  //PCDevSettings This = impl_from_IDataObject((IDataObject *)Context);
289  /* FIXME: Implement */
290  DPRINT1("CDevSettings::EnumAllModes(%u)\n", Index);
291  return NULL;
292 }
_In_ WDFCOLLECTION _In_ ULONG Index
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8

Referenced by pCDevSettings_InitializeExtInterface().

◆ CDevSettings_EnumDAdvise()

static HRESULT STDMETHODCALLTYPE CDevSettings_EnumDAdvise ( IDataObject iface,
IEnumSTATDATA **  ppenumAdvise 
)
static

Definition at line 894 of file devsett.c.

896 {
897  *ppenumAdvise = NULL;
899 }
#define OLE_E_ADVISENOTSUPPORTED
Definition: winerror.h:2617
#define NULL
Definition: types.h:112

◆ CDevSettings_EnumFormatEtc()

static HRESULT STDMETHODCALLTYPE CDevSettings_EnumFormatEtc ( IDataObject iface,
DWORD  dwDirection,
IEnumFORMATETC **  ppenumFormatEtc 
)
static

Definition at line 834 of file devsett.c.

837 {
838  HRESULT hr;
839  FORMATETC fetc[9];
841 
842  *ppenumFormatEtc = NULL;
843 
844  if (dwDirection == DATADIR_GET)
845  {
847  This->cfExtInterface);
849  This->cfDisplayDevice);
851  This->cfDisplayName);
853  This->cfDisplayId);
855  This->cfDisplayKey);
857  This->cfDisplayStateFlags);
859  This->cfMonitorName);
861  This->cfMonitorDevice);
863  This->cfPruningMode);
864 
865  hr = SHCreateStdEnumFmtEtc(sizeof(fetc) / sizeof(fetc[0]),
866  fetc,
867  ppenumFormatEtc);
868  }
869  else
870  hr = E_NOTIMPL;
871 
872  return hr;
873 }
static __inline VOID pCDevSettings_FillFormatEtc(FORMATETC *pFormatEtc, CLIPFORMAT cf)
Definition: devsett.c:823
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI SHCreateStdEnumFmtEtc(UINT cFormats, const FORMATETC *lpFormats, LPENUMFORMATETC *ppenumFormatetc)
Definition: shellord.c:2199
static __inline PCDevSettings impl_from_IDataObject(struct IDataObject *iface)
Definition: devsett.c:58
LONG HRESULT
Definition: typedefs.h:79
#define E_NOTIMPL
Definition: ddrawi.h:99
#define NULL
Definition: types.h:112

◆ CDevSettings_GetCanonicalFormatEtc()

static HRESULT STDMETHODCALLTYPE CDevSettings_GetCanonicalFormatEtc ( IDataObject iface,
FORMATETC *  pformatectIn,
FORMATETC *  pformatetcOut 
)
static

Definition at line 778 of file devsett.c.

781 {
782  HRESULT hr;
783 
784  DPRINT1("CDevSettings::GetCanonicalFormatEtc\n");
785 
786  hr = IDataObject_QueryGetData(iface,
787  pformatectIn);
788  if (SUCCEEDED(hr))
789  {
790  CopyMemory(pformatetcOut,
791  pformatectIn,
792  sizeof(FORMATETC));
793 
794  /* Make sure the data is target device independent */
795  if (pformatectIn->ptd == NULL)
797  else
798  {
799  pformatetcOut->ptd = NULL;
800  hr = S_OK;
801  }
802  }
803  else
804  {
805  ZeroMemory(pformatetcOut,
806  sizeof(FORMATETC));
807  }
808 
809  return hr;
810 }
HRESULT hr
Definition: shlfolder.c:183
#define DATA_S_SAMEFORMATETC
Definition: winerror.h:2674
#define ZeroMemory
Definition: winbase.h:1667
if SUCCEEDED(hr)
LONG HRESULT
Definition: typedefs.h:79
#define CopyMemory
Definition: winbase.h:1665
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8

◆ CDevSettings_GetCurrentMode()

PDEVMODEW DESK_EXT_CALLBACK CDevSettings_GetCurrentMode ( PVOID  Context)

Definition at line 295 of file devsett.c.

296 {
297  //PCDevSettings This = impl_from_IDataObject((IDataObject *)Context);
298  /* FIXME: Implement */
299  DPRINT1("CDevSettings::GetCurrentMode\n");
300  return NULL;
301 }
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8

Referenced by pCDevSettings_InitializeExtInterface().

◆ CDevSettings_GetData()

static HRESULT STDMETHODCALLTYPE CDevSettings_GetData ( IDataObject iface,
FORMATETC *  pformatetcIn,
STGMEDIUM *  pmedium 
)
static

Definition at line 580 of file devsett.c.

583 {
584  static const WCHAR szEmpty[] = {0};
585  HRESULT hr;
586  PCWSTR pszRet = NULL;
587  PWSTR pszBuf;
589 
590  ZeroMemory(pmedium,
591  sizeof(STGMEDIUM));
592 
593  hr = IDataObject_QueryGetData(iface,
594  pformatetcIn);
595  if (SUCCEEDED(hr))
596  {
597  /* Return the requested data back to the shell extension */
598 
599  if (pformatetcIn->cfFormat == This->cfDisplayDevice)
600  {
601  pszRet = This->pDisplayDevice;
602  DPRINT1("CDevSettings::GetData returns display device %ws\n", pszRet);
603  }
604  else if (pformatetcIn->cfFormat == This->cfDisplayName)
605  {
606  pszRet = This->pDisplayName;
607  DPRINT1("CDevSettings::GetData returns display name %ws\n", pszRet);
608  }
609  else if (pformatetcIn->cfFormat == This->cfDisplayKey)
610  {
611  pszRet = This->pDisplayKey;
612  DPRINT1("CDevSettings::GetData returns display key %ws\n", pszRet);
613  }
614  else if (pformatetcIn->cfFormat == This->cfDisplayId)
615  {
616  pszRet = This->pDisplayId;
617  DPRINT1("CDevSettings::GetData returns display id %ws\n", pszRet);
618  }
619  else if (pformatetcIn->cfFormat == This->cfMonitorName)
620  {
621  pszRet = This->pMonitorName;
622  DPRINT1("CDevSettings::GetData returns monitor name %ws\n", pszRet);
623  }
624  else if (pformatetcIn->cfFormat == This->cfMonitorDevice)
625  {
626  pszRet = This->pMonitorDevice;
627  DPRINT1("CDevSettings::GetData returns monitor device %ws\n", pszRet);
628  }
629  else if (pformatetcIn->cfFormat == This->cfExtInterface)
630  {
631  PDESK_EXT_INTERFACE pIface;
632 
633  pIface = GlobalAlloc(GPTR,
634  sizeof(*pIface));
635  if (pIface != NULL)
636  {
637  CopyMemory(pIface,
638  &This->ExtInterface,
639  sizeof(This->ExtInterface));
640 
641  DPRINT1("CDevSettings::GetData returns the desk.cpl extension interface\n");
642 
643  pmedium->tymed = TYMED_HGLOBAL;
644  pmedium->hGlobal = pIface;
645 
646  return S_OK;
647  }
648  else
649  return E_OUTOFMEMORY;
650  }
651  else if (pformatetcIn->cfFormat == This->cfDisplayStateFlags)
652  {
653  PDWORD pdw;
654 
655  pdw = GlobalAlloc(GPTR,
656  sizeof(*pdw));
657  if (pdw != NULL)
658  {
659  *pdw = This->StateFlags;
660 
661  DPRINT1("CDevSettings::GetData returns the display state flags %x\n", This->StateFlags);
662 
663  pmedium->tymed = TYMED_HGLOBAL;
664  pmedium->hGlobal = pdw;
665 
666  return S_OK;
667  }
668  else
669  return E_OUTOFMEMORY;
670  }
671  else if (pformatetcIn->cfFormat == This->cfPruningMode)
672  {
673  PBYTE pb;
674 
675  pb = GlobalAlloc(GPTR,
676  sizeof(*pb));
677  if (pb != NULL)
678  {
679  *pb = (This->bModesPruned && This->bPruningOn);
680 
681  pmedium->tymed = TYMED_HGLOBAL;
682  pmedium->hGlobal = pb;
683 
684  return S_OK;
685  }
686  else
687  return E_OUTOFMEMORY;
688  }
689 
690  /* NOTE: This only returns null-terminated strings! */
691  if (pszRet == NULL)
692  pszRet = szEmpty;
693 
694  pszBuf = GlobalAlloc(GPTR,
695  (wcslen(pszRet) + 1) * sizeof(WCHAR));
696  if (pszBuf != NULL)
697  {
698  hr = StringCbCopyW(pszBuf, (wcslen(pszRet) + 1) * sizeof(WCHAR), pszRet);
699  if (FAILED(hr))
700  {
701  GlobalFree(pszBuf);
702  return hr;
703  }
704 
705  pmedium->tymed = TYMED_HGLOBAL;
706  pmedium->hGlobal = pszBuf;
707 
708  hr = S_OK;
709  }
710  else
711  hr = E_OUTOFMEMORY;
712  }
713 
714  return hr;
715 }
const uint16_t * PCWSTR
Definition: typedefs.h:57
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
HRESULT hr
Definition: shlfolder.c:183
#define GPTR
Definition: winbase.h:293
uint16_t * PWSTR
Definition: typedefs.h:56
#define ZeroMemory
Definition: winbase.h:1667
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
if SUCCEEDED(hr)
static const WCHAR szEmpty[]
Definition: provider.c:50
static __inline PCDevSettings impl_from_IDataObject(struct IDataObject *iface)
Definition: devsett.c:58
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define CopyMemory
Definition: winbase.h:1665
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
DWORD * PDWORD
Definition: pedump.c:68
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define DPRINT1
Definition: precomp.h:8
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
BYTE * PBYTE
Definition: pedump.c:66

◆ CDevSettings_GetDataHere()

static HRESULT STDMETHODCALLTYPE CDevSettings_GetDataHere ( IDataObject iface,
FORMATETC *  pformatetc,
STGMEDIUM *  pmedium 
)
static

Definition at line 718 of file devsett.c.

721 {
722  ZeroMemory(pformatetc,
723  sizeof(*pformatetc));
724  return E_NOTIMPL;
725 }
#define ZeroMemory
Definition: winbase.h:1667
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ CDevSettings_GetPruningMode()

VOID DESK_EXT_CALLBACK CDevSettings_GetPruningMode ( PVOID  Context,
PBOOL  pbModesPruned,
PBOOL  pbKeyIsReadOnly,
PBOOL  pbPruningOn 
)

Definition at line 314 of file devsett.c.

318 {
320 
321  DPRINT1("CDevSettings::GetPruningMode(%p,%p,%p)\n", pbModesPruned, pbKeyIsReadOnly, pbPruningOn);
322 
323  *pbModesPruned = This->bModesPruned;
324  *pbKeyIsReadOnly = This->bKeyIsReadOnly;
325  *pbPruningOn = This->bPruningOn;
326 }
static __inline PCDevSettings impl_from_IDataObject(struct IDataObject *iface)
Definition: devsett.c:58
#define DPRINT1
Definition: precomp.h:8

Referenced by pCDevSettings_InitializeExtInterface().

◆ CDevSettings_QueryGetData()

static HRESULT STDMETHODCALLTYPE CDevSettings_QueryGetData ( IDataObject iface,
FORMATETC *  pformatetc 
)
static

Definition at line 728 of file devsett.c.

730 {
731 #if DEBUG
732  TCHAR szFormatName[255];
733 #endif
735 
736  if (pformatetc->dwAspect != DVASPECT_CONTENT)
737  return DV_E_DVASPECT;
738 
739  if (pformatetc->lindex != -1)
740  return DV_E_LINDEX;
741 
742  if (!(pformatetc->tymed & TYMED_HGLOBAL))
743  return DV_E_TYMED;
744 
745  /* Check if the requested data can be provided */
746  if (pformatetc->cfFormat == This->cfExtInterface ||
747  pformatetc->cfFormat == This->cfDisplayDevice ||
748  pformatetc->cfFormat == This->cfDisplayName ||
749  pformatetc->cfFormat == This->cfDisplayId ||
750  pformatetc->cfFormat == This->cfDisplayKey ||
751  pformatetc->cfFormat == This->cfDisplayStateFlags ||
752  pformatetc->cfFormat == This->cfMonitorDevice ||
753  pformatetc->cfFormat == This->cfMonitorName ||
754  pformatetc->cfFormat == This->cfPruningMode)
755  {
756  return S_OK;
757  }
758 #if DEBUG
759  else
760  {
761  if (GetClipboardFormatName(pformatetc->cfFormat,
762  szFormatName,
763  sizeof(szFormatName) / sizeof(szFormatName[0])))
764  {
765  DPRINT1("CDevSettings::QueryGetData(\"%ws\")\n", szFormatName);
766  }
767  else
768  {
769  DPRINT1("CDevSettings::QueryGetData(Format %u)\n", (unsigned int)pformatetc->cfFormat);
770  }
771  }
772 #endif
773 
774  return DV_E_FORMATETC;
775 }
#define GetClipboardFormatName
Definition: winuser.h:5764
char TCHAR
Definition: xmlstorage.h:189
#define DV_E_FORMATETC
Definition: winerror.h:2633
static __inline PCDevSettings impl_from_IDataObject(struct IDataObject *iface)
Definition: devsett.c:58
#define DV_E_TYMED
Definition: winerror.h:2638
#define DV_E_DVASPECT
Definition: winerror.h:2640
#define DV_E_LINDEX
Definition: winerror.h:2637
#define S_OK
Definition: intsafe.h:52
#define DPRINT1
Definition: precomp.h:8

◆ CDevSettings_QueryInterface()

static HRESULT STDMETHODCALLTYPE CDevSettings_QueryInterface ( IDataObject iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 536 of file devsett.c.

539 {
541 
542  *ppvObject = NULL;
543 
544  if (IsEqualGUID(riid,
545  &IID_IUnknown) ||
547  &IID_IDataObject))
548  {
550  return S_OK;
551  }
552  else
553  {
554  DPRINT1("CDevSettings::QueryInterface: Queried unknown interface\n");
555  }
556 
557  return E_NOINTERFACE;
558 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
const GUID IID_IDataObject
void * PVOID
Definition: retypes.h:9
#define impl_to_interface(impl, iface)
Definition: devsett.c:55
static __inline PCDevSettings impl_from_IDataObject(struct IDataObject *iface)
Definition: devsett.c:58
const GUID IID_IUnknown
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define DPRINT1
Definition: precomp.h:8

◆ CDevSettings_Release()

static ULONG STDMETHODCALLTYPE CDevSettings_Release ( IDataObject iface)
static

Definition at line 568 of file devsett.c.

569 {
570  ULONG refs;
572  refs = (ULONG)InterlockedDecrement((PLONG)&This->ref);
573  if (refs == 0)
575 
576  return refs;
577 }
static VOID pCDevSettings_Free(PCDevSettings This)
Definition: devsett.c:525
static __inline PCDevSettings impl_from_IDataObject(struct IDataObject *iface)
Definition: devsett.c:58
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
signed int * PLONG
Definition: retypes.h:5

Referenced by CreateDevSettings().

◆ CDevSettings_SetCurrentMode()

BOOL DESK_EXT_CALLBACK CDevSettings_SetCurrentMode ( PVOID  Context,
const DEVMODEW pDevMode 
)

Definition at line 304 of file devsett.c.

306 {
307  //PCDevSettings This = impl_from_IDataObject((IDataObject *)Context);
308  /* FIXME: Implement */
309  DPRINT1("CDevSettings::SetCurrentMode(0x%p)\n", pDevMode);
310  return FALSE;
311 }
#define FALSE
Definition: types.h:117
#define DPRINT1
Definition: precomp.h:8

Referenced by pCDevSettings_InitializeExtInterface().

◆ CDevSettings_SetData()

static HRESULT STDMETHODCALLTYPE CDevSettings_SetData ( IDataObject iface,
FORMATETC *  pformatetc,
STGMEDIUM *  pmedium,
BOOL  fRelease 
)
static

Definition at line 813 of file devsett.c.

817 {
818  DPRINT1("CDevSettings::SetData UNIMPLEMENTED\n");
819  return E_NOTIMPL;
820 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define DPRINT1
Definition: precomp.h:8

◆ CDevSettings_SetPruningMode()

VOID DESK_EXT_CALLBACK CDevSettings_SetPruningMode ( PVOID  Context,
BOOL  PruningOn 
)

Definition at line 329 of file devsett.c.

331 {
332  HKEY hKey;
333  DWORD dwValue;
335 
336  DPRINT1("CDevSettings::SetPruningMode(%d)\n", PruningOn);
337 
338  if (This->bModesPruned && !This->bKeyIsReadOnly &&
339  PruningOn != This->bPruningOn)
340  {
341  This->bPruningOn = (PruningOn != FALSE);
342 
344  FALSE);
345  if (hKey != NULL)
346  {
347  dwValue = (DWORD)This->bPruningOn;
348 
350  TEXT("PruningMode"),
351  0,
352  REG_DWORD,
353  (const BYTE *)&dwValue,
354  sizeof(dwValue));
355 
356  RegCloseKey(hKey);
357  }
358  }
359 }
#define DWORD
Definition: nt_native.h:44
#define FALSE
Definition: types.h:117
static HKEY pCDevSettings_OpenDeviceKey(PCDevSettings This, BOOL ReadOnly)
Definition: devsett.c:249
static __inline PCDevSettings impl_from_IDataObject(struct IDataObject *iface)
Definition: devsett.c:58
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned char BYTE
Definition: xxhash.c:193
#define TEXT(s)
Definition: k32.h:26
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
#define REG_DWORD
Definition: sdbapi.c:596
#define RegCloseKey(hKey)
Definition: registry.h:47
#define RegSetValueEx
Definition: winreg.h:533

Referenced by pCDevSettings_InitializeExtInterface().

◆ CreateDevSettings()

IDataObject* CreateDevSettings ( PDISPLAY_DEVICE_ENTRY  DisplayDeviceInfo)

Definition at line 917 of file devsett.c.

918 {
920 
922  0,
923  sizeof(*This));
924  if (This != NULL)
925  {
926  This->lpIDataObjectVtbl = &vtblIDataObject;
927  This->ref = 1;
928 
930  DisplayDeviceInfo)))
931  {
933  }
934 
936  }
937 
938  return NULL;
939 }
static const struct IDataObjectVtbl vtblIDataObject
Definition: devsett.c:901
if SUCCEEDED(hr)
#define impl_to_interface(impl, iface)
Definition: devsett.c:55
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static ULONG STDMETHODCALLTYPE CDevSettings_Release(IDataObject *iface)
Definition: devsett.c:568
#define NULL
Definition: types.h:112
static HRESULT pCDevSettings_Initialize(PCDevSettings This, PDISPLAY_DEVICE_ENTRY DisplayDeviceInfo)
Definition: devsett.c:454

Referenced by DisplayAdvancedSettings().

◆ DisplaySaveSettings()

LONG WINAPI DisplaySaveSettings ( PVOID  pContext,
HWND  hwndPropSheet 
)

Definition at line 942 of file devsett.c.

944 {
945  //PCDevSettings This = impl_from_IDataObject((IDataObject *)Context);
946  DPRINT("DisplaySaveSettings() UNIMPLEMENTED!\n");
947  return DISP_CHANGE_BADPARAM;
948 }
#define DISP_CHANGE_BADPARAM
Definition: winuser.h:193
#define DPRINT
Definition: sndvol32.h:71

◆ impl_from_IDataObject()

static __inline PCDevSettings impl_from_IDataObject ( struct IDataObject iface)
static

◆ pCDevSettings_AllocAndCopyString()

static PWSTR pCDevSettings_AllocAndCopyString ( const TCHAR pszSrc)
static

Definition at line 75 of file devsett.c.

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 }
uint16_t * PWSTR
Definition: typedefs.h:56
#define CP_ACP
Definition: compat.h:109
const WCHAR * str
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
#define LMEM_FIXED
Definition: winbase.h:365
__wchar_t WCHAR
Definition: xmlstorage.h:180
const GLubyte * c
Definition: glext.h:8905
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
#define c
Definition: ke_i.h:80
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166

Referenced by pCDevSettings_Initialize().

◆ pCDevSettings_FillFormatEtc()

static __inline VOID pCDevSettings_FillFormatEtc ( FORMATETC *  pFormatEtc,
CLIPFORMAT  cf 
)
static

Definition at line 823 of file devsett.c.

825 {
826  pFormatEtc->cfFormat = cf;
827  pFormatEtc->ptd = NULL;
828  pFormatEtc->dwAspect = DVASPECT_CONTENT;
829  pFormatEtc->lindex = -1;
830  pFormatEtc->tymed = TYMED_HGLOBAL;
831 }
static IClassFactory * cf
#define NULL
Definition: types.h:112

Referenced by CDevSettings_EnumFormatEtc().

◆ pCDevSettings_Free()

static VOID pCDevSettings_Free ( PCDevSettings  This)
static

Definition at line 525 of file devsett.c.

526 {
527  pCDevSettings_FreeString(&This->pDisplayDevice);
528  pCDevSettings_FreeString(&This->pDisplayName);
529  pCDevSettings_FreeString(&This->pDisplayKey);
530  pCDevSettings_FreeString(&This->pDisplayId);
531  pCDevSettings_FreeString(&This->pMonitorName);
532  pCDevSettings_FreeString(&This->pMonitorDevice);
533 }
static __inline VOID pCDevSettings_FreeString(PWCHAR *psz)
Definition: devsett.c:65

Referenced by CDevSettings_Release().

◆ pCDevSettings_FreeString()

static __inline VOID pCDevSettings_FreeString ( PWCHAR psz)
static

Definition at line 65 of file devsett.c.

66 {
67  if (*psz != NULL)
68  {
69  LocalFree((HLOCAL)*psz);
70  *psz = NULL;
71  }
72 }
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define NULL
Definition: types.h:112

Referenced by pCDevSettings_Free().

◆ pCDevSettings_GetDeviceInstanceId()

static PWSTR pCDevSettings_GetDeviceInstanceId ( const WCHAR pszDevice)
static

Converts a Hardware ID (DeviceID from EnumDisplayDevices) to an unique Device Instance ID.

Parameters
[in]pszDeviceA pointer to a null-terminated Unicode string containing a Hardware ID. e.g. "PCI\VEN_80EE&DEV_BEEF&SUBSYS_00000000&REV_00"
Returns
A pointer to a null-terminated Unicode string containing an unique Device Instance ID or NULL in case of error. e.g. "PCI\VEN_80EE&DEV_BEEF&SUBSYS_00000000&REV_00\3&267A616A&0&10"
Remarks
The caller must free the returned string with LocalFree.

Definition at line 191 of file devsett.c.

192 {
193  HDEVINFO DevInfo;
194  SP_DEVINFO_DATA InfoData;
195  ULONG BufLen;
196  LPWSTR lpDevInstId = NULL;
197 
198  DPRINT("CDevSettings::GetDeviceInstanceId(%ws)!\n", pszDevice);
199 
200  DevInfo = SetupDiGetClassDevsW(NULL, pszDevice, NULL, DIGCF_ALLCLASSES | DIGCF_PRESENT);
201  if (DevInfo == INVALID_HANDLE_VALUE)
202  {
203  DPRINT1("SetupDiGetClassDevsW(\"%ws\") failed: %d\n", pszDevice, GetLastError());
204  return NULL;
205  }
206 
207  ZeroMemory(&InfoData, sizeof(InfoData));
208  InfoData.cbSize = sizeof(InfoData);
209 
210  /* Try to enumerate the first matching device */
211  if (!SetupDiEnumDeviceInfo(DevInfo, 0, &InfoData))
212  {
213  DPRINT1("SetupDiEnumDeviceInfo failed: %d\n", GetLastError());
214  return NULL;
215  }
216 
217  if (SetupDiGetDeviceInstanceId(DevInfo, &InfoData, NULL, 0, &BufLen) ||
219  {
220  DPRINT1("SetupDiGetDeviceInstanceId failed: %d\n", GetLastError());
221  return NULL;
222  }
223 
224  lpDevInstId = LocalAlloc(LMEM_FIXED,
225  (BufLen + 1) * sizeof(WCHAR));
226 
227  if (lpDevInstId == NULL)
228  {
229  DPRINT1("LocalAlloc failed\n");
230  return NULL;
231  }
232 
233  if (!SetupDiGetDeviceInstanceId(DevInfo, &InfoData, lpDevInstId, BufLen, NULL))
234  {
235  DPRINT1("SetupDiGetDeviceInstanceId failed: %d\n", GetLastError());
236  LocalFree((HLOCAL)lpDevInstId);
237  lpDevInstId = NULL;
238  }
239  else
240  {
241  DPRINT("instance id: %ws\n", lpDevInstId);
242  }
243 
244  return lpDevInstId;
245 }
BOOL WINAPI SetupDiEnumDeviceInfo(HDEVINFO devinfo, DWORD index, PSP_DEVINFO_DATA info)
Definition: devinst.c:1787
#define BufLen
Definition: fatfs.h:167
HDEVINFO WINAPI SetupDiGetClassDevsW(CONST GUID *class, LPCWSTR enumstr, HWND parent, DWORD flags)
Definition: devinst.c:2292
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define ZeroMemory
Definition: winbase.h:1667
#define LMEM_FIXED
Definition: winbase.h:365
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define DIGCF_ALLCLASSES
Definition: setupapi.h:172
#define SetupDiGetDeviceInstanceId
Definition: setupapi.h:2600
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
#define DPRINT
Definition: sndvol32.h:71
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define DIGCF_PRESENT
Definition: setupapi.h:171
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by pCDevSettings_Initialize().

◆ pCDevSettings_GetMonitorDevice()

static PWSTR pCDevSettings_GetMonitorDevice ( const WCHAR pszDisplayDevice)
static

Definition at line 148 of file devsett.c.

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 }
uint16_t * PWSTR
Definition: typedefs.h:56
WCHAR DeviceName[32]
Definition: wingdi.h:2818
const WCHAR * str
BOOL WINAPI EnumDisplayDevicesW(LPCWSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICEW lpDisplayDevice, DWORD dwFlags)
Definition: display.c:78
#define LMEM_FIXED
Definition: winbase.h:365
__wchar_t WCHAR
Definition: xmlstorage.h:180
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373

Referenced by pCDevSettings_Initialize().

◆ pCDevSettings_GetMonitorName()

static PWSTR pCDevSettings_GetMonitorName ( const WCHAR pszDisplayDevice)
static

Definition at line 102 of file devsett.c.

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 }
uint16_t * PWSTR
Definition: typedefs.h:56
WCHAR DeviceString[128]
Definition: wingdi.h:2819
HINSTANCE hApplet
Definition: access.c:17
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
const WCHAR * str
BOOL WINAPI EnumDisplayDevicesW(LPCWSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICEW lpDisplayDevice, DWORD dwFlags)
Definition: display.c:78
#define IDS_UNKNOWNMONITOR
Definition: resource.h:154
#define LMEM_FIXED
Definition: winbase.h:365
#define IDS_MULTIPLEMONITORS
Definition: resource.h:153
__wchar_t WCHAR
Definition: xmlstorage.h:180
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373

Referenced by pCDevSettings_Initialize().

◆ pCDevSettings_Initialize()

static HRESULT pCDevSettings_Initialize ( PCDevSettings  This,
PDISPLAY_DEVICE_ENTRY  DisplayDeviceInfo 
)
static

Definition at line 454 of file devsett.c.

456 {
457  HKEY hKey;
458 
459  This->Flags = 0;
460  This->StateFlags = DisplayDeviceInfo->DeviceStateFlags;
461  DPRINT1("This->StateFlags: %x\n", This->StateFlags);
462 
463  /* Register clipboard formats */
473 
474  /* Copy the device name */
475  This->pDisplayDevice = pCDevSettings_AllocAndCopyString(DisplayDeviceInfo->DeviceName);
476  DPRINT1("This->pDisplayDevice: %ws\n", This->pDisplayDevice);
477  This->pDisplayName = pCDevSettings_AllocAndCopyString(DisplayDeviceInfo->DeviceDescription);
478  DPRINT1("This->pDisplayName: %ws\n", This->pDisplayName);
479  This->pDisplayKey = pCDevSettings_AllocAndCopyString(DisplayDeviceInfo->DeviceKey);
480  DPRINT1("This->pDisplayKey: %ws\n", This->pDisplayKey);
481  This->pDisplayId = pCDevSettings_GetDeviceInstanceId(DisplayDeviceInfo->DeviceID);
482  DPRINT1("This->pDisplayId: %ws\n", This->pDisplayId);
483  This->pMonitorName = pCDevSettings_GetMonitorName(This->pDisplayDevice);
484  DPRINT1("This->pMonitorName: %ws\n", This->pMonitorName);
485  This->pMonitorDevice = pCDevSettings_GetMonitorDevice(This->pDisplayDevice);
486  DPRINT1("This->pMonitorDevice: %ws\n", This->pMonitorDevice);
487 
488  /* Check pruning mode */
489  This->bModesPruned = ((DisplayDeviceInfo->DeviceStateFlags & DISPLAY_DEVICE_MODESPRUNED) != 0);
491  FALSE);
492  if (hKey == NULL)
493  {
495  FALSE);
496  This->bKeyIsReadOnly = TRUE;
497  }
498  if (hKey != NULL)
499  {
500  DWORD dw = 0;
501  DWORD dwType, dwSize;
502 
503  dwSize = sizeof(dw);
504  if (RegQueryValueEx(hKey,
505  TEXT("PruningMode"),
506  NULL,
507  &dwType,
508  (PBYTE)&dw,
509  &dwSize) == ERROR_SUCCESS)
510  {
511  if (dwType == REG_DWORD && dwSize == sizeof(dw))
512  This->bPruningOn = (dw != 0);
513  }
514 
515  RegCloseKey(hKey);
516  }
517 
518  /* Initialize the shell extension interface */
520 
521  return S_OK;
522 }
#define RegQueryValueEx
Definition: winreg.h:524
#define DISPLAY_DEVICE_MODESPRUNED
Definition: wingdi.h:1404
LPWSTR DeviceKey
Definition: precomp.h:72
#define DESK_EXT_DISPLAYNAME
Definition: deskcplx.h:9
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
LPWSTR DeviceName
Definition: precomp.h:71
#define DESK_EXT_DISPLAYID
Definition: deskcplx.h:10
#define DESK_EXT_PRUNINGMODE
Definition: deskcplx.h:7
#define DESK_EXT_DISPLAYSTATEFLAGS
Definition: deskcplx.h:12
static VOID pCDevSettings_InitializeExtInterface(PCDevSettings This)
Definition: devsett.c:377
static PWSTR pCDevSettings_GetDeviceInstanceId(const WCHAR *pszDevice)
Converts a Hardware ID (DeviceID from EnumDisplayDevices) to an unique Device Instance ID.
Definition: devsett.c:191
#define FALSE
Definition: types.h:117
REFIID LPVOID DWORD_PTR dw
Definition: atlbase.h:40
static HKEY pCDevSettings_OpenDeviceKey(PCDevSettings This, BOOL ReadOnly)
Definition: devsett.c:249
#define DESK_EXT_DISPLAYKEY
Definition: deskcplx.h:11
#define DESK_EXT_EXTINTERFACE
Definition: deskcplx.h:6
unsigned long DWORD
Definition: ntddk_ex.h:95
static PWSTR pCDevSettings_GetMonitorDevice(const WCHAR *pszDisplayDevice)
Definition: devsett.c:148
#define DESK_EXT_MONITORDEVICE
Definition: deskcplx.h:14
DWORD DeviceStateFlags
Definition: precomp.h:74
LPWSTR DeviceID
Definition: precomp.h:73
#define RegisterClipboardFormat
Definition: winuser.h:5818
#define S_OK
Definition: intsafe.h:52
#define TEXT(s)
Definition: k32.h:26
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
static PWSTR pCDevSettings_GetMonitorName(const WCHAR *pszDisplayDevice)
Definition: devsett.c:102
#define DPRINT1
Definition: precomp.h:8
#define DESK_EXT_DISPLAYDEVICE
Definition: deskcplx.h:8
LPWSTR DeviceDescription
Definition: precomp.h:70
#define REG_DWORD
Definition: sdbapi.c:596
#define DESK_EXT_MONITORNAME
Definition: deskcplx.h:13
BYTE * PBYTE
Definition: pedump.c:66
static PWSTR pCDevSettings_AllocAndCopyString(const TCHAR *pszSrc)
Definition: devsett.c:75
#define RegCloseKey(hKey)
Definition: registry.h:47
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56

Referenced by CreateDevSettings().

◆ pCDevSettings_InitializeExtInterface()

static VOID pCDevSettings_InitializeExtInterface ( PCDevSettings  This)
static

Definition at line 377 of file devsett.c.

378 {
379  PDESK_EXT_INTERFACE Interface = &This->ExtInterface;
380  HKEY hKeyDev;
381 
383  sizeof(*Interface));
384  Interface->cbSize = sizeof(*Interface);
385 
386  /* Initialize the callback table */
388  Interface->EnumAllModes = CDevSettings_EnumAllModes;
389  Interface->SetCurrentMode = CDevSettings_SetCurrentMode;
390  Interface->GetCurrentMode = CDevSettings_GetCurrentMode;
391  Interface->SetPruningMode = CDevSettings_SetPruningMode;
392  Interface->GetPruningMode = CDevSettings_GetPruningMode;
393 
394  /* Read the HardwareInformation.* values from the registry key */
396  TRUE);
397  if (hKeyDev != NULL)
398  {
399  DWORD dwType, dwMemSize = 0;
400  DWORD dwSize = sizeof(dwMemSize);
401 
402  if (RegQueryValueEx(hKeyDev,
403  TEXT("HardwareInformation.MemorySize"),
404  NULL,
405  &dwType,
406  (PBYTE)&dwMemSize,
407  &dwSize) == ERROR_SUCCESS &&
408  (dwType == REG_BINARY || dwType == REG_DWORD) &&
409  dwSize == sizeof(dwMemSize))
410  {
411  dwMemSize /= 1024;
412 
413  if (dwMemSize > 1024)
414  {
415  dwMemSize /= 1024;
416  if (dwMemSize > 1024)
417  {
418  wsprintf(Interface->MemorySize,
419  _T("%u GB"),
420  dwMemSize / 1024);
421  }
422  else
423  {
424  wsprintf(Interface->MemorySize,
425  _T("%u MB"),
426  dwMemSize);
427  }
428  }
429  else
430  {
431  wsprintf(Interface->MemorySize,
432  _T("%u KB"),
433  dwMemSize);
434  }
435  }
436 
438  TEXT("HardwareInformation.ChipType"),
439  Interface->ChipType);
441  TEXT("HardwareInformation.DacType"),
442  Interface->DacType);
444  TEXT("HardwareInformation.AdapterString"),
445  Interface->AdapterString);
447  TEXT("HardwareInformation.BiosString"),
448  Interface->BiosString);
449  RegCloseKey(hKeyDev);
450  }
451 }
#define RegQueryValueEx
Definition: winreg.h:524
#define ERROR_SUCCESS
Definition: deptool.c:10
#define REG_BINARY
Definition: nt_native.h:1496
#define TRUE
Definition: types.h:120
#define ZeroMemory
Definition: winbase.h:1667
static VOID pCDevSettings_ReadHardwareInfo(HKEY hKey, LPCTSTR lpValueName, LPWSTR lpBuffer)
Definition: devsett.c:362
BOOL DESK_EXT_CALLBACK CDevSettings_SetCurrentMode(PVOID Context, const DEVMODEW *pDevMode)
Definition: devsett.c:304
static HKEY pCDevSettings_OpenDeviceKey(PCDevSettings This, BOOL ReadOnly)
Definition: devsett.c:249
#define impl_to_interface(impl, iface)
Definition: devsett.c:55
VOID DESK_EXT_CALLBACK CDevSettings_GetPruningMode(PVOID Context, PBOOL pbModesPruned, PBOOL pbKeyIsReadOnly, PBOOL pbPruningOn)
Definition: devsett.c:314
#define _T(x)
Definition: vfdio.h:22
unsigned long DWORD
Definition: ntddk_ex.h:95
PDEVMODEW DESK_EXT_CALLBACK CDevSettings_GetCurrentMode(PVOID Context)
Definition: devsett.c:295
#define TEXT(s)
Definition: k32.h:26
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:361
#define NULL
Definition: types.h:112
PDEVMODEW DESK_EXT_CALLBACK CDevSettings_EnumAllModes(PVOID Context, DWORD Index)
Definition: devsett.c:285
VOID DESK_EXT_CALLBACK CDevSettings_SetPruningMode(PVOID Context, BOOL PruningOn)
Definition: devsett.c:329
#define wsprintf
Definition: winuser.h:5845
#define REG_DWORD
Definition: sdbapi.c:596
BYTE * PBYTE
Definition: pedump.c:66
#define RegCloseKey(hKey)
Definition: registry.h:47
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56

Referenced by pCDevSettings_Initialize().

◆ pCDevSettings_OpenDeviceKey()

static HKEY pCDevSettings_OpenDeviceKey ( PCDevSettings  This,
BOOL  ReadOnly 
)
static

Definition at line 249 of file devsett.c.

251 {
252  static const WCHAR szRegPrefix[] = L"\\Registry\\Machine\\";
253  PWSTR lpRegKey;
254  REGSAM Access = KEY_READ;
255  HKEY hKey;
256 
257  lpRegKey = This->pDisplayKey;
258  if (lpRegKey != NULL)
259  {
260  if (wcslen(lpRegKey) >= wcslen(szRegPrefix) &&
261  !_wcsnicmp(lpRegKey,
262  szRegPrefix,
263  wcslen(szRegPrefix)))
264  {
265  lpRegKey += wcslen(szRegPrefix);
266  }
267 
268  if (!ReadOnly)
269  Access |= KEY_WRITE;
270 
272  lpRegKey,
273  0,
274  Access,
275  &hKey) == ERROR_SUCCESS)
276  {
277  return hKey;
278  }
279  }
280 
281  return NULL;
282 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
uint16_t * PWSTR
Definition: typedefs.h:56
Definition: arc.h:80
_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)
#define L(x)
Definition: ntvdm.h:50
#define KEY_WRITE
Definition: nt_native.h:1031
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define RegOpenKeyEx
Definition: winreg.h:520
FxAutoRegKey hKey
ACCESS_MASK REGSAM
Definition: winreg.h:69
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by CDevSettings_SetPruningMode(), pCDevSettings_Initialize(), and pCDevSettings_InitializeExtInterface().

◆ pCDevSettings_ReadHardwareInfo()

static VOID pCDevSettings_ReadHardwareInfo ( HKEY  hKey,
LPCTSTR  lpValueName,
LPWSTR  lpBuffer 
)
static

Definition at line 362 of file devsett.c.

365 {
367  DWORD size = 128 * sizeof(WCHAR);
369  lpValueName,
370  NULL,
371  &type,
372  (PBYTE)lpBuffer,
373  &size);
374 }
#define RegQueryValueEx
Definition: winreg.h:524
#define REG_BINARY
Definition: nt_native.h:1496
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:175
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
#define NULL
Definition: types.h:112
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
BYTE * PBYTE
Definition: pedump.c:66

Referenced by pCDevSettings_InitializeExtInterface().

Variable Documentation

◆ vtblIDataObject

const struct IDataObjectVtbl vtblIDataObject
static
Initial value:
= {
}
static HRESULT STDMETHODCALLTYPE CDevSettings_GetData(IDataObject *iface, FORMATETC *pformatetcIn, STGMEDIUM *pmedium)
Definition: devsett.c:580
static HRESULT STDMETHODCALLTYPE CDevSettings_EnumDAdvise(IDataObject *iface, IEnumSTATDATA **ppenumAdvise)
Definition: devsett.c:894
static HRESULT STDMETHODCALLTYPE CDevSettings_QueryInterface(IDataObject *iface, REFIID riid, void **ppvObject)
Definition: devsett.c:536
static HRESULT STDMETHODCALLTYPE CDevSettings_GetCanonicalFormatEtc(IDataObject *iface, FORMATETC *pformatectIn, FORMATETC *pformatetcOut)
Definition: devsett.c:778
static HRESULT STDMETHODCALLTYPE CDevSettings_GetDataHere(IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium)
Definition: devsett.c:718
static HRESULT STDMETHODCALLTYPE CDevSettings_EnumFormatEtc(IDataObject *iface, DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc)
Definition: devsett.c:834
static HRESULT STDMETHODCALLTYPE CDevSettings_QueryGetData(IDataObject *iface, FORMATETC *pformatetc)
Definition: devsett.c:728
static HRESULT STDMETHODCALLTYPE CDevSettings_DAdvise(IDataObject *iface, FORMATETC *pformatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection)
Definition: devsett.c:876
static HRESULT STDMETHODCALLTYPE CDevSettings_SetData(IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
Definition: devsett.c:813
static ULONG STDMETHODCALLTYPE CDevSettings_Release(IDataObject *iface)
Definition: devsett.c:568
static HRESULT STDMETHODCALLTYPE CDevSettings_DUnadvise(IDataObject *iface, DWORD dwConnection)
Definition: devsett.c:887
static ULONG STDMETHODCALLTYPE CDevSettings_AddRef(IDataObject *iface)
Definition: devsett.c:561

Definition at line 901 of file devsett.c.

Referenced by CreateDevSettings().