ReactOS  0.4.13-dev-479-gec9c8fd
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)
 
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 531 of file devsett.c.

532 {
534  return (ULONG)InterlockedIncrement((PLONG)&This->ref);
535 }
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 846 of file devsett.c.

851 {
852  *pdwConnection = 0;
854 }
#define OLE_E_ADVISENOTSUPPORTED
Definition: winerror.h:2617

◆ CDevSettings_DUnadvise()

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

Definition at line 857 of file devsett.c.

859 {
861 }
#define OLE_E_ADVISENOTSUPPORTED
Definition: winerror.h:2617

◆ CDevSettings_EnumAllModes()

PDEVMODEW DESK_EXT_CALLBACK CDevSettings_EnumAllModes ( PVOID  Context,
DWORD  Index 
)

Definition at line 255 of file devsett.c.

257 {
258  //PCDevSettings This = impl_from_IDataObject((IDataObject *)Context);
259  /* FIXME: Implement */
260  DPRINT1("CDevSettings::EnumAllModes(%u)\n", Index);
261  return NULL;
262 }
smooth NULL
Definition: ftsmooth.c:416
static const UCHAR Index[8]
Definition: usbohci.c:18
#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 864 of file devsett.c.

866 {
867  *ppenumAdvise = NULL;
869 }
smooth NULL
Definition: ftsmooth.c:416
#define OLE_E_ADVISENOTSUPPORTED
Definition: winerror.h:2617

◆ CDevSettings_EnumFormatEtc()

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

Definition at line 804 of file devsett.c.

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 }
static __inline VOID pCDevSettings_FillFormatEtc(FORMATETC *pFormatEtc, CLIPFORMAT cf)
Definition: devsett.c:793
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI SHCreateStdEnumFmtEtc(UINT cFormats, const FORMATETC *lpFormats, LPENUMFORMATETC *ppenumFormatetc)
Definition: shellord.c:1804
smooth NULL
Definition: ftsmooth.c:416
static __inline PCDevSettings impl_from_IDataObject(struct IDataObject *iface)
Definition: devsett.c:58
LONG HRESULT
Definition: typedefs.h:77
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ CDevSettings_GetCanonicalFormatEtc()

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

Definition at line 748 of file devsett.c.

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 }
HRESULT hr
Definition: shlfolder.c:183
#define DATA_S_SAMEFORMATETC
Definition: winerror.h:2674
#define ZeroMemory
Definition: winbase.h:1635
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define CopyMemory
Definition: winbase.h:1633
#define S_OK
Definition: intsafe.h:59
#define DPRINT1
Definition: precomp.h:8
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ CDevSettings_GetCurrentMode()

PDEVMODEW DESK_EXT_CALLBACK CDevSettings_GetCurrentMode ( PVOID  Context)

Definition at line 265 of file devsett.c.

266 {
267  //PCDevSettings This = impl_from_IDataObject((IDataObject *)Context);
268  /* FIXME: Implement */
269  DPRINT1("CDevSettings::GetCurrentMode\n");
270  return NULL;
271 }
smooth NULL
Definition: ftsmooth.c:416
#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 550 of file devsett.c.

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 = StringCbCopy(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 }
const uint16_t * PCWSTR
Definition: typedefs.h:55
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:54
#define ZeroMemory
Definition: winbase.h:1635
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR szEmpty[]
Definition: provider.c:47
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:77
#define CopyMemory
Definition: winbase.h:1633
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
#define StringCbCopy
Definition: strsafe.h:155
#define S_OK
Definition: intsafe.h:59
DWORD * PDWORD
Definition: pedump.c:68
#define DPRINT1
Definition: precomp.h:8
BYTE * PBYTE
Definition: pedump.c:66
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ CDevSettings_GetDataHere()

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

Definition at line 688 of file devsett.c.

691 {
692  ZeroMemory(pformatetc,
693  sizeof(*pformatetc));
694  return E_NOTIMPL;
695 }
#define ZeroMemory
Definition: winbase.h:1635
#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 284 of file devsett.c.

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 }
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 698 of file devsett.c.

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 }
#define GetClipboardFormatName
Definition: winuser.h:5650
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:59
#define DPRINT1
Definition: precomp.h:8

◆ CDevSettings_QueryInterface()

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

Definition at line 506 of file devsett.c.

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 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
const GUID IID_IDataObject
smooth NULL
Definition: ftsmooth.c:416
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:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
#define DPRINT1
Definition: precomp.h:8

◆ CDevSettings_Release()

static ULONG STDMETHODCALLTYPE CDevSettings_Release ( IDataObject iface)
static

Definition at line 538 of file devsett.c.

539 {
540  ULONG refs;
542  refs = (ULONG)InterlockedDecrement((PLONG)&This->ref);
543  if (refs == 0)
545 
546  return refs;
547 }
static VOID pCDevSettings_Free(PCDevSettings This)
Definition: devsett.c:495
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 274 of file devsett.c.

276 {
277  //PCDevSettings This = impl_from_IDataObject((IDataObject *)Context);
278  /* FIXME: Implement */
279  DPRINT1("CDevSettings::SetCurrentMode(0x%p)\n", pDevMode);
280  return FALSE;
281 }
#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 783 of file devsett.c.

787 {
788  DPRINT1("CDevSettings::SetData UNIMPLEMENTED\n");
789  return E_NOTIMPL;
790 }
#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 299 of file devsett.c.

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 }
#define DWORD
Definition: nt_native.h:44
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
static HKEY pCDevSettings_OpenDeviceKey(PCDevSettings This, BOOL ReadOnly)
Definition: devsett.c:219
smooth NULL
Definition: ftsmooth.c:416
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: mem.h:68
#define TEXT(s)
Definition: k32.h:26
#define DPRINT1
Definition: precomp.h:8
#define REG_DWORD
Definition: sdbapi.c:596
#define RegSetValueEx
Definition: winreg.h:533

Referenced by pCDevSettings_InitializeExtInterface().

◆ CreateDevSettings()

IDataObject* CreateDevSettings ( PDISPLAY_DEVICE_ENTRY  DisplayDeviceInfo)

Definition at line 887 of file devsett.c.

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 }
static const struct IDataObjectVtbl vtblIDataObject
Definition: devsett.c:871
smooth NULL
Definition: ftsmooth.c:416
#define impl_to_interface(impl, iface)
Definition: devsett.c:55
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static ULONG STDMETHODCALLTYPE CDevSettings_Release(IDataObject *iface)
Definition: devsett.c:538
static HRESULT pCDevSettings_Initialize(PCDevSettings This, PDISPLAY_DEVICE_ENTRY DisplayDeviceInfo)
Definition: devsett.c:424
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by DisplayAdvancedSettings().

◆ DisplaySaveSettings()

LONG WINAPI DisplaySaveSettings ( PVOID  pContext,
HWND  hwndPropSheet 
)

Definition at line 912 of file devsett.c.

914 {
915  //PCDevSettings This = impl_from_IDataObject((IDataObject *)Context);
916  DPRINT("DisplaySaveSettings() UNIMPLEMENTED!\n");
917  return DISP_CHANGE_BADPARAM;
918 }
#define DISP_CHANGE_BADPARAM
Definition: winuser.h:193
void DPRINT(...)
Definition: polytest.cpp:61

◆ 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:54
#define CP_ACP
Definition: compat.h:99
const WCHAR * str
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
smooth NULL
Definition: ftsmooth.c:416
#define LMEM_FIXED
Definition: winbase.h:349
__wchar_t WCHAR
Definition: xmlstorage.h:180
const GLubyte * c
Definition: glext.h:8905
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define MultiByteToWideChar
Definition: compat.h:100
#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 793 of file devsett.c.

795 {
796  pFormatEtc->cfFormat = cf;
797  pFormatEtc->ptd = NULL;
798  pFormatEtc->dwAspect = DVASPECT_CONTENT;
799  pFormatEtc->lindex = -1;
800  pFormatEtc->tymed = TYMED_HGLOBAL;
801 }
static IClassFactory * cf
smooth NULL
Definition: ftsmooth.c:416

Referenced by CDevSettings_EnumFormatEtc().

◆ pCDevSettings_Free()

static VOID pCDevSettings_Free ( PCDevSettings  This)
static

Definition at line 495 of file devsett.c.

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 }
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 }
smooth NULL
Definition: ftsmooth.c:416
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577

Referenced by pCDevSettings_Free().

◆ pCDevSettings_GetDeviceInstanceId()

static PWSTR pCDevSettings_GetDeviceInstanceId ( const WCHAR pszDevice)
static

Definition at line 172 of file devsett.c.

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 }
#define BufLen
Definition: fatfs.h:167
_Null_terminated_ WCHAR * DEVINSTID_W
Definition: cfgmgr32.h:80
#define CR_SUCCESS
Definition: cfgmgr32.h:842
CONFIGRET WINAPI CM_Get_Device_IDW(_In_ DEVINST dnDevInst, _Out_writes_(BufferLen) PWCHAR Buffer, _In_ ULONG BufferLen, _In_ ULONG ulFlags)
Definition: cfgmgr.c:3526
smooth NULL
Definition: ftsmooth.c:416
#define LMEM_FIXED
Definition: winbase.h:349
__wchar_t WCHAR
Definition: xmlstorage.h:180
CONFIGRET WINAPI CM_Locate_DevNodeW(_Out_ PDEVINST pdnDevInst, _In_opt_ DEVINSTID_W pDeviceID, _In_ ULONG ulFlags)
Definition: cfgmgr.c:5637
DWORD DEVINST
Definition: cfgmgr32.h:76
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
CONFIGRET WINAPI CM_Get_Device_ID_Size(_Out_ PULONG pulLen, _In_ DEVINST dnDevInst, _In_ ULONG ulFlags)
Definition: cfgmgr.c:3923
RETURN_TYPE CONFIGRET
Definition: cfgmgr32.h:74
#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 CM_LOCATE_DEVNODE_NORMAL
Definition: cfgmgr32.h:760
WCHAR * LPWSTR
Definition: xmlstorage.h:184

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:54
WCHAR DeviceName[32]
Definition: wingdi.h:2796
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI EnumDisplayDevicesW(LPCWSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICEW lpDisplayDevice, DWORD dwFlags)
Definition: display.c:78
#define LMEM_FIXED
Definition: winbase.h:349
__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)
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

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:54
WCHAR DeviceString[128]
Definition: wingdi.h:2797
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
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI EnumDisplayDevicesW(LPCWSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICEW lpDisplayDevice, DWORD dwFlags)
Definition: display.c:78
#define IDS_UNKNOWNMONITOR
Definition: resource.h:146
#define LMEM_FIXED
Definition: winbase.h:349
#define IDS_MULTIPLEMONITORS
Definition: resource.h:145
__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)
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by pCDevSettings_Initialize().

◆ pCDevSettings_Initialize()

static HRESULT pCDevSettings_Initialize ( PCDevSettings  This,
PDISPLAY_DEVICE_ENTRY  DisplayDeviceInfo 
)
static

Definition at line 424 of file devsett.c.

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 }
#define RegQueryValueEx
Definition: winreg.h:524
#define DISPLAY_DEVICE_MODESPRUNED
Definition: wingdi.h:1386
#define TRUE
Definition: types.h:120
LPWSTR DeviceKey
Definition: precomp.h:72
#define DESK_EXT_DISPLAYNAME
Definition: deskcplx.h:9
#define ERROR_SUCCESS
Definition: deptool.c:10
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:347
static PWSTR pCDevSettings_GetDeviceInstanceId(const WCHAR *pszDevice)
Definition: devsett.c:172
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
static HKEY pCDevSettings_OpenDeviceKey(PCDevSettings This, BOOL ReadOnly)
Definition: devsett.c:219
smooth NULL
Definition: ftsmooth.c:416
#define DESK_EXT_DISPLAYKEY
Definition: deskcplx.h:11
#define DESK_EXT_EXTINTERFACE
Definition: deskcplx.h:6
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID LPVOID DWORD dw
Definition: atlbase.h:40
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:5704
#define S_OK
Definition: intsafe.h:59
#define TEXT(s)
Definition: k32.h:26
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
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by CreateDevSettings().

◆ pCDevSettings_InitializeExtInterface()

static VOID pCDevSettings_InitializeExtInterface ( PCDevSettings  This)
static

Definition at line 347 of file devsett.c.

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 }
#define RegQueryValueEx
Definition: winreg.h:524
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define REG_BINARY
Definition: nt_native.h:1496
#define ZeroMemory
Definition: winbase.h:1635
static VOID pCDevSettings_ReadHardwareInfo(HKEY hKey, LPCTSTR lpValueName, LPWSTR lpBuffer)
Definition: devsett.c:332
BOOL DESK_EXT_CALLBACK CDevSettings_SetCurrentMode(PVOID Context, const DEVMODEW *pDevMode)
Definition: devsett.c:274
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
static HKEY pCDevSettings_OpenDeviceKey(PCDevSettings This, BOOL ReadOnly)
Definition: devsett.c:219
smooth NULL
Definition: ftsmooth.c:416
#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:284
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:359
#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:265
#define TEXT(s)
Definition: k32.h:26
PDEVMODEW DESK_EXT_CALLBACK CDevSettings_EnumAllModes(PVOID Context, DWORD Index)
Definition: devsett.c:255
VOID DESK_EXT_CALLBACK CDevSettings_SetPruningMode(PVOID Context, BOOL PruningOn)
Definition: devsett.c:299
#define wsprintf
Definition: winuser.h:5731
#define REG_DWORD
Definition: sdbapi.c:596
BYTE * PBYTE
Definition: pedump.c:66
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by pCDevSettings_Initialize().

◆ pCDevSettings_OpenDeviceKey()

static HKEY pCDevSettings_OpenDeviceKey ( PCDevSettings  This,
BOOL  ReadOnly 
)
static

Definition at line 219 of file devsett.c.

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 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
uint16_t * PWSTR
Definition: typedefs.h:54
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)
smooth NULL
Definition: ftsmooth.c:416
#define KEY_WRITE
Definition: nt_native.h:1031
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR L[]
Definition: oid.c:1250
#define RegOpenKeyEx
Definition: winreg.h:520
ACCESS_MASK REGSAM
Definition: winreg.h:69
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 332 of file devsett.c.

335 {
337  DWORD size = 128 * sizeof(WCHAR);
338  RegQueryValueEx(hKey,
339  lpValueName,
340  NULL,
341  &type,
342  (PBYTE)lpBuffer,
343  &size);
344 }
#define RegQueryValueEx
Definition: winreg.h:524
#define REG_BINARY
Definition: nt_native.h:1496
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
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:550
static HRESULT STDMETHODCALLTYPE CDevSettings_EnumDAdvise(IDataObject *iface, IEnumSTATDATA **ppenumAdvise)
Definition: devsett.c:864
static HRESULT STDMETHODCALLTYPE CDevSettings_QueryInterface(IDataObject *iface, REFIID riid, void **ppvObject)
Definition: devsett.c:506
static HRESULT STDMETHODCALLTYPE CDevSettings_GetCanonicalFormatEtc(IDataObject *iface, FORMATETC *pformatectIn, FORMATETC *pformatetcOut)
Definition: devsett.c:748
static HRESULT STDMETHODCALLTYPE CDevSettings_GetDataHere(IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium)
Definition: devsett.c:688
static HRESULT STDMETHODCALLTYPE CDevSettings_EnumFormatEtc(IDataObject *iface, DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc)
Definition: devsett.c:804
static HRESULT STDMETHODCALLTYPE CDevSettings_QueryGetData(IDataObject *iface, FORMATETC *pformatetc)
Definition: devsett.c:698
static HRESULT STDMETHODCALLTYPE CDevSettings_DAdvise(IDataObject *iface, FORMATETC *pformatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection)
Definition: devsett.c:846
static HRESULT STDMETHODCALLTYPE CDevSettings_SetData(IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
Definition: devsett.c:783
static ULONG STDMETHODCALLTYPE CDevSettings_Release(IDataObject *iface)
Definition: devsett.c:538
static HRESULT STDMETHODCALLTYPE CDevSettings_DUnadvise(IDataObject *iface, DWORD dwConnection)
Definition: devsett.c:857
static ULONG STDMETHODCALLTYPE CDevSettings_AddRef(IDataObject *iface)
Definition: devsett.c:531

Definition at line 871 of file devsett.c.

Referenced by CreateDevSettings().