ReactOS 0.4.15-dev-8241-g63935f8
CRegistryFolder Class Reference

#include <regfolder.h>

Inheritance diagram for CRegistryFolder:
Collaboration diagram for CRegistryFolder:

Public Member Functions

 CRegistryFolder ()
 
virtual ~CRegistryFolder ()
 
STDMETHOD() EnumObjects (HWND hwndOwner, SHCONTF grfFlags, IEnumIDList **ppenumIDList) override
 
STDMETHOD() GetDefaultColumnState (UINT iColumn, SHCOLSTATEF *pcsFlags) override
 
STDMETHOD() GetDetailsEx (LPCITEMIDLIST pidl, const SHCOLUMNID *pscid, VARIANT *pv) override
 
STDMETHOD() GetDetailsOf (LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS *psd) override
 
STDMETHOD() MapColumnToSCID (UINT iColumn, SHCOLUMNID *pscid) override
 
STDMETHOD() Initialize (PCIDLIST_ABSOLUTE pidl) override
 
STDMETHOD() Initialize (PCIDLIST_ABSOLUTE pidl, PCWSTR ntPath, HKEY hRoot)
 
- Public Member Functions inherited from CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >
 CCommonFolder ()
 
virtual ~CCommonFolder ()
 
STDMETHODIMP ParseDisplayName (HWND hwndOwner, LPBC pbcReserved, LPOLESTR lpszDisplayName, ULONG *pchEaten, LPITEMIDLIST *ppidl, ULONG *pdwAttributes) override
 
STDMETHOD() EnumObjects (HWND hwndOwner, SHCONTF grfFlags, IEnumIDList **ppenumIDList) PURE
 
STDMETHODIMP BindToObject (LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, void **ppvOut) override
 
STDMETHODIMP BindToStorage (LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, void **ppvObj) override
 
STDMETHODIMP CompareIDs (LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) override
 
STDMETHODIMP CreateViewObject (HWND hwndOwner, REFIID riid, void **ppvOut) override
 
STDMETHODIMP GetAttributesOf (UINT cidl, PCUITEMID_CHILD_ARRAY apidl, SFGAOF *rgfInOut) override
 
STDMETHODIMP GetUIObjectOf (HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, void **ppvOut) override
 
STDMETHODIMP GetDisplayNameOf (LPCITEMIDLIST pidl, SHGDNF uFlags, STRRET *lpName) override
 
STDMETHODIMP SetNameOf (HWND hwnd, LPCITEMIDLIST pidl, LPCOLESTR lpszName, SHGDNF uFlags, LPITEMIDLIST *ppidlOut) override
 
STDMETHODIMP GetDefaultSearchGUID (GUID *lpguid) override
 
STDMETHODIMP EnumSearches (IEnumExtraSearch **ppenum) override
 
STDMETHODIMP GetDefaultColumn (DWORD dwReserved, ULONG *pSort, ULONG *pDisplay) override
 
STDMETHOD() GetDefaultColumnState (UINT iColumn, SHCOLSTATEF *pcsFlags) PURE
 
STDMETHOD() GetDetailsEx (LPCITEMIDLIST pidl, const SHCOLUMNID *pscid, VARIANT *pv) PURE
 
STDMETHOD() GetDetailsOf (LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS *psd) PURE
 
STDMETHOD() MapColumnToSCID (UINT iColumn, SHCOLUMNID *pscid) PURE
 
STDMETHODIMP GetClassID (CLSID *lpClassId) override
 
STDMETHODIMP Initialize (PCIDLIST_ABSOLUTE pidl) override
 
STDMETHODIMP GetCurFolder (PIDLIST_ABSOLUTE *pidl) override
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 
- Public Member Functions inherited from IShellFolder2
HRESULT GetDefaultSearchGUID ([out] GUID *lpguid)
 
HRESULT EnumSearches ([out] IEnumExtraSearch **ppenum)
 
HRESULT GetDefaultColumn ([in] DWORD dwReserved, [out] ULONG *pSort, [out] ULONG *pDisplay)
 
HRESULT GetDefaultColumnState ([in] UINT iColumn, [out] SHCOLSTATEF *pcsFlags)
 
HRESULT GetDetailsEx ([in] PCUITEMID_CHILD pidl, [in] const SHCOLUMNID *pscid, [out] VARIANT *pv)
 
HRESULT GetDetailsOf ([in] PCUITEMID_CHILD pidl, [in] UINT iColumn, [out] SHELLDETAILS *psd)
 
HRESULT MapColumnToSCID ([in] UINT iColumn, [in] SHCOLUMNID *pscid)
 
- Public Member Functions inherited from IShellFolder
HRESULT ParseDisplayName ([in] HWND hwndOwner, [in] LPBC pbcReserved, [in, string] LPOLESTR lpszDisplayName, [out] ULONG *pchEaten, [out] PIDLIST_RELATIVE *ppidl, [in, out, unique] ULONG *pdwAttributes)
 
HRESULT EnumObjects ([in] HWND hwndOwner, [in] SHCONTF grfFlags, [out] IEnumIDList **ppenumIDList)
 
HRESULT BindToObject ([in] PCUIDLIST_RELATIVE pidl, [in] LPBC pbcReserved, [in] REFIID riid, [out, iid_is(riid)] void **ppvOut)
 
HRESULT BindToStorage ([in] PCUIDLIST_RELATIVE pidl, [in] LPBC pbcReserved, [in] REFIID riid, [out, iid_is(riid)] void **ppvObj)
 
HRESULT CompareIDs ([in] LPARAM lParam, [in] PCUIDLIST_RELATIVE pidl1, [in] PCUIDLIST_RELATIVE pidl2)
 
HRESULT CreateViewObject ([in] HWND hwndOwner, [in] REFIID riid, [out, iid_is(riid)] void **ppvOut)
 
HRESULT GetAttributesOf ([in] UINT cidl, [in, size_is(cidl)] PCUITEMID_CHILD_ARRAY apidl, [in, out] SFGAOF *rgfInOut)
 
HRESULT GetUIObjectOf ([in] HWND hwndOwner, [in] UINT cidl, [in, size_is(cidl)] PCUITEMID_CHILD_ARRAY apidl, [in] REFIID riid, [in, out, unique] UINT *prgfInOut, [out, iid_is(riid)] void **ppvOut)
 
HRESULT GetDisplayNameOf ([in] PCUITEMID_CHILD pidl, [in] SHGDNF uFlags, [out] STRRET *lpName)
 
HRESULT SetNameOf ([in] HWND hwnd, [in] PCUITEMID_CHILD pidl, [in, string] LPCOLESTR lpszName, [in] SHGDNF uFlags, [out] PITEMID_CHILD *ppidlOut)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 
HRESULT GetCurFolder ([out] PIDLIST_ABSOLUTE *ppidl)
 
HRESULT Initialize ([in] PCIDLIST_ABSOLUTE pidl)
 
HRESULT GetClassID ([out] CLSID *pClassID)
 

Protected Member Functions

STDMETHOD() InternalBindToObject (PWSTR path, const RegPidlEntry *info, LPITEMIDLIST first, LPCITEMIDLIST rest, LPITEMIDLIST fullPidl, LPBC pbcReserved, IShellFolder **ppsfChild) override
 
STDMETHOD() CompareIDs (LPARAM lParam, const RegPidlEntry *first, const RegPidlEntry *second)
 
 STDMETHOD_ (ULONG, ConvertAttributes)(const RegPidlEntry *entry
 
 STDMETHOD_ (BOOL, IsFolder)(const RegPidlEntry *info)
 
virtual HRESULT GetInfoFromPidl (LPCITEMIDLIST pcidl, const RegPidlEntry **pentry)
 
HRESULT FormatValueData (DWORD contentType, PVOID td, DWORD contentsLength, PCWSTR *strContents)
 
HRESULT FormatContentsForDisplay (const RegPidlEntry *info, HKEY rootKey, LPCWSTR ntPath, PCWSTR *strContents)
 
- Protected Member Functions inherited from CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >
STDMETHOD() InternalBindToObject (PWSTR path, const RegPidlEntry *info, LPITEMIDLIST first, LPCITEMIDLIST rest, LPITEMIDLIST fullPidl, LPBC pbcReserved, IShellFolder **ppsfChild) PURE
 
STDMETHOD() ResolveSymLink (const RegPidlEntry *info, LPITEMIDLIST *fullPidl)
 
STDMETHOD() CompareIDs (LPARAM lParam, const RegPidlEntry *first, const RegPidlEntry *second) PURE
 
STDMETHOD() CompareName (LPARAM lParam, const RegPidlEntry *first, const RegPidlEntry *second)
 
 STDMETHOD_ (ULONG, ConvertAttributes)(const RegPidlEntry *entry
 
 STDMETHOD_ (BOOL, IsFolder)(LPCITEMIDLIST pcidl)
 
 STDMETHOD_ (BOOL, IsFolder)(const RegPidlEntry *info) PURE
 
 STDMETHOD_ (BOOL, IsSymLink)(LPCITEMIDLIST pcidl)
 
 STDMETHOD_ (BOOL, IsSymLink)(const RegPidlEntry *info)
 
virtual HRESULT GetInfoFromPidl (LPCITEMIDLIST pcidl, const RegPidlEntry **pentry) PURE
 

Protected Attributes

PULONG inMask
 
- Protected Attributes inherited from CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >
WCHAR m_NtPath [MAX_PATH]
 
LPITEMIDLIST m_shellPidl
 
PULONG inMask PURE
 

Private Attributes

HKEY m_hRoot
 

Additional Inherited Members

- Public Types inherited from IShellFolder2
typedef struct IShellFolder2::SHCOLUMNIDLPSHCOLUMNID
 
typedef const SHCOLUMNIDLPCSHCOLUMNID
 
- Public Types inherited from IShellFolder
enum  tagSHGDN {
  SHGDN_NORMAL = 0 , SHGDN_INFOLDER = 1 , SHGDN_FOREDITING = 0x1000 , SHGDN_INCLUDE_NONFILESYS = 0x2000 ,
  SHGDN_FORADDRESSBAR = 0x4000 , SHGDN_FORPARSING = 0x8000
}
 
enum  tagSHCONTF {
  SHCONTF_FOLDERS = 32 , SHCONTF_NONFOLDERS = 64 , SHCONTF_INCLUDEHIDDEN = 128 , SHCONTF_INIT_ON_FIRST_NEXT = 256 ,
  SHCONTF_NETPRINTERSRCH = 512 , SHCONTF_SHAREABLE = 1024 , SHCONTF_STORAGE = 2048 , SHCONTF_NAVIGATION_ENUM = 0x01000 ,
  SHCONTF_FASTITEMS = 0x02000 , SHCONTF_FLATLIST = 0x04000 , SHCONTF_ENABLE_ASYNC = 0x08000 , SHCONTF_INCLUDESUPERHIDDEN = 0x10000
}
 
typedef IShellFolderLPSHELLFOLDER
 
typedef enum IShellFolder::tagSHGDN SHGNO
 
typedef DWORD SHGDNF
 
typedef DWORD SHCONTF
 
typedef ULONG SFGAOF
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Public Types inherited from IPersistFolder2
typedef IPersistFolder2LPPERSISTFOLDER2
 
- Public Types inherited from IPersistFolder
typedef IPersistFolderLPPERSISTFOLDER
 
- Public Types inherited from IPersist
typedef IPersistLPPERSIST
 
- Static Public Member Functions inherited from CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >
static HRESULT CALLBACK DefCtxMenuCallback (IShellFolder *, HWND, IDataObject *, UINT uMsg, WPARAM, LPARAM)
 
- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 

Detailed Description

Definition at line 49 of file regfolder.h.

Constructor & Destructor Documentation

◆ CRegistryFolder()

CRegistryFolder::CRegistryFolder ( )

Definition at line 100 of file regfolder.cpp.

101{
102}

◆ ~CRegistryFolder()

CRegistryFolder::~CRegistryFolder ( )
virtual

Definition at line 104 of file regfolder.cpp.

105{
106}

Member Function Documentation

◆ CompareIDs()

HRESULT CRegistryFolder::CompareIDs ( LPARAM  lParam,
const RegPidlEntry first,
const RegPidlEntry second 
)
protected

Definition at line 387 of file regfolder.cpp.

388{
389 HRESULT hr;
390
391 DWORD sortMode = lParam & 0xFFFF0000;
392 DWORD column = lParam & 0x0000FFFF;
393
394 if (sortMode == SHCIDS_ALLFIELDS)
395 {
396 if (column != 0)
397 return E_INVALIDARG;
398
399 int minsize = min(first->cb, second->cb);
400 hr = MAKE_COMPARE_HRESULT(memcmp(second, first, minsize));
401 if (hr != S_EQUAL)
402 return hr;
403
404 return MAKE_COMPARE_HRESULT(second->cb - first->cb);
405 }
406
407 switch (column)
408 {
410 return CompareName(lParam, first, second);
411
413 {
414 if (first->entryType != second->entryType)
415 return MAKE_COMPARE_HRESULT(second->entryType - first->entryType);
416
417 if (first->entryType == REG_ENTRY_KEY)
418 {
419 if (first->contentsLength == 0 || second->contentsLength == 0)
420 return (first->contentsLength == 0) ? S_GREATERTHAN : S_LESSTHAN;
421
422 PWSTR firstKey = (PWSTR)(((PBYTE)first) + FIELD_OFFSET(RegPidlEntry, entryName) + first->entryNameLength + sizeof(WCHAR));
423 PWSTR secondKey = (PWSTR)(((PBYTE)second) + FIELD_OFFSET(RegPidlEntry, entryName) + second->entryNameLength + sizeof(WCHAR));
424 return MAKE_COMPARE_HRESULT(lstrcmpW(firstKey, secondKey));
425 }
426
427 return CompareName(lParam, first, second);
428 }
429
431 {
432 PCWSTR firstContent, secondContent;
433
435 return E_INVALIDARG;
436
437 if (FAILED_UNEXPECTEDLY(FormatContentsForDisplay(second, m_hRoot, m_NtPath, &secondContent)))
438 return E_INVALIDARG;
439
440 hr = MAKE_COMPARE_HRESULT(lstrcmpW(firstContent, secondContent));
441
442 CoTaskMemFree((LPVOID)firstContent);
443 CoTaskMemFree((LPVOID)secondContent);
444
445 return hr;
446 }
447 }
448
449 DbgPrint("Unsupported sorting mode.\n");
450 return E_INVALIDARG;
451}
#define SHCIDS_ALLFIELDS
Definition: CFontExt.cpp:15
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
STDMETHOD() CompareName(LPARAM lParam, const RegPidlEntry *first, const RegPidlEntry *second)
Definition: foldercommon.h:290
HRESULT FormatContentsForDisplay(const RegPidlEntry *info, HKEY rootKey, LPCWSTR ntPath, PCWSTR *strContents)
Definition: regfolder.cpp:601
LPARAM lParam
Definition: combotst.c:139
#define E_INVALIDARG
Definition: ddrawi.h:101
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4242
unsigned long DWORD
Definition: ntddk_ex.h:95
const GLint * first
Definition: glext.h:5794
#define DbgPrint
Definition: hal.h:12
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define min(a, b)
Definition: monoChain.cc:55
@ REG_ENTRY_KEY
Definition: ntobjenum.h:53
BYTE * PBYTE
Definition: pedump.c:66
@ REGISTRY_COLUMN_NAME
Definition: regfolder.cpp:18
@ REGISTRY_COLUMN_TYPE
Definition: regfolder.cpp:19
@ REGISTRY_COLUMN_VALUE
Definition: regfolder.cpp:20
#define S_LESSTHAN
Definition: shellutils.h:604
#define S_GREATERTHAN
Definition: shellutils.h:606
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:607
#define S_EQUAL
Definition: shellutils.h:605
HRESULT hr
Definition: shlfolder.c:183
USHORT cb
Definition: ntobjenum.h:62
USHORT entryNameLength
Definition: ntobjenum.h:67
USHORT contentsLength
Definition: ntobjenum.h:74
REG_ENTRY_TYPE entryType
Definition: ntobjenum.h:65
uint16_t * PWSTR
Definition: typedefs.h:56
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ EnumObjects()

HRESULT STDMETHODCALLTYPE CRegistryFolder::EnumObjects ( HWND  hwndOwner,
SHCONTF  grfFlags,
IEnumIDList **  ppenumIDList 
)
override

Implements IShellFolder.

Definition at line 109 of file regfolder.cpp.

113{
114 if (m_NtPath[0] == 0 && m_hRoot == NULL)
115 {
116 return GetEnumRegistryRoot(ppenumIDList);
117 }
118 else
119 {
120 return GetEnumRegistryKey(m_NtPath, m_hRoot, ppenumIDList);
121 }
122}
#define NULL
Definition: types.h:112
HRESULT GetEnumRegistryKey(LPCWSTR path, HKEY root, IEnumIDList **ppil)
Definition: ntobjenum.cpp:732
HRESULT GetEnumRegistryRoot(IEnumIDList **ppil)
Definition: ntobjenum.cpp:727

◆ FormatContentsForDisplay()

HRESULT CRegistryFolder::FormatContentsForDisplay ( const RegPidlEntry info,
HKEY  rootKey,
LPCWSTR  ntPath,
PCWSTR strContents 
)
protected

Definition at line 601 of file regfolder.cpp.

602{
603 PVOID td = (((PBYTE)info) + FIELD_OFFSET(RegPidlEntry, entryName) + info->entryNameLength + sizeof(WCHAR));
604
605 if (info->entryType == REG_ENTRY_VALUE_WITH_CONTENT)
606 {
607 if (info->contentsLength > 0)
608 {
609 return FormatValueData(info->contentType, td, info->contentsLength, strContents);
610 }
611 }
612 else if (info->entryType == REG_ENTRY_VALUE)
613 {
614 PVOID valueData;
615 DWORD valueLength;
616 HRESULT hr = ReadRegistryValue(rootKey, ntPath, info->entryName, &valueData, &valueLength);
618 {
619 PCWSTR strEmpty = L"(Error reading value)";
620 DWORD bufferLength = (wcslen(strEmpty) + 1) * sizeof(WCHAR);
622 StringCbCopyW(strValue, bufferLength, strEmpty);
623 *strContents = strValue;
624 return S_OK;
625 }
626
627 if (valueLength > 0)
628 {
629 hr = FormatValueData(info->contentType, valueData, valueLength, strContents);
630
631 CoTaskMemFree(valueData);
632
633 return hr;
634 }
635 }
636 else
637 {
638 PCWSTR strEmpty = L"";
639 DWORD bufferLength = (wcslen(strEmpty) + 1) * sizeof(WCHAR);
641 StringCbCopyW(strValue, bufferLength, strEmpty);
642 *strContents = strValue;
643 return S_OK;
644 }
645
646 PCWSTR strEmpty = L"(Empty)";
647 DWORD bufferLength = (wcslen(strEmpty) + 1) * sizeof(WCHAR);
649 StringCbCopyW(strValue, bufferLength, strEmpty);
650 *strContents = strValue;
651 return S_OK;
652}
HRESULT FormatValueData(DWORD contentType, PVOID td, DWORD contentsLength, PCWSTR *strContents)
Definition: regfolder.cpp:495
BOOL ReadRegistryValue(IN DWORD ValueType, IN LPCSTR ValueName, OUT LPBYTE DataBuffer, IN OUT LPDWORD DataBufferSize)
Definition: d3d9_helpers.c:19
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define S_OK
Definition: intsafe.h:52
@ REG_ENTRY_VALUE_WITH_CONTENT
Definition: ntobjenum.h:55
@ REG_ENTRY_VALUE
Definition: ntobjenum.h:54
#define L(x)
Definition: ntvdm.h:50
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
_In_opt_ PVOID _In_ ULONG bufferLength
Definition: wdfdriver.h:109

Referenced by CompareIDs(), GetDetailsEx(), and GetDetailsOf().

◆ FormatValueData()

HRESULT CRegistryFolder::FormatValueData ( DWORD  contentType,
PVOID  td,
DWORD  contentsLength,
PCWSTR strContents 
)
protected

Definition at line 495 of file regfolder.cpp.

496{
497 switch (contentType)
498 {
499 case REG_NONE:
500 {
501 PCWSTR strTodo = L"";
502 DWORD bufferLength = (wcslen(strTodo) + 1) * sizeof(WCHAR);
504 StringCbCopyW(strValue, bufferLength, strTodo);
505 *strContents = strValue;
506 return S_OK;
507 }
508
509 case REG_SZ:
510 case REG_EXPAND_SZ:
511 {
512 PWSTR strValue = (PWSTR)CoTaskMemAlloc(contentsLength + sizeof(WCHAR));
513 StringCbCopyNW(strValue, contentsLength + sizeof(WCHAR), (LPCWSTR)td, contentsLength);
514 *strContents = strValue;
515 return S_OK;
516 }
517
518 case REG_MULTI_SZ:
519 {
520 PCWSTR separator = L" "; // To match regedit
521 size_t sepChars = wcslen(separator);
522 int strings = 0;
523 int stringChars = 0;
524
525 PCWSTR strData = (PCWSTR)td;
526 while (*strData)
527 {
528 size_t len = wcslen(strData);
529 stringChars += len;
530 strData += len + 1; // Skips null-terminator
531 strings++;
532 }
533
534 int cch = stringChars + (strings - 1) * sepChars + 1;
535
536 PWSTR strValue = (PWSTR)CoTaskMemAlloc(cch * sizeof(WCHAR));
537
538 strValue[0] = 0;
539
540 strData = (PCWSTR)td;
541 while (*strData)
542 {
543 StrCatW(strValue, strData);
544 strData += wcslen(strData) + 1;
545 if (*strData)
546 StrCatW(strValue, separator);
547 }
548
549 *strContents = strValue;
550 return S_OK;
551 }
552
553 case REG_DWORD:
554 {
555 DWORD bufferLength = 64 * sizeof(WCHAR);
557 StringCbPrintfW(strValue, bufferLength, L"0x%08x (%d)",
558 *(DWORD*)td, *(DWORD*)td);
559 *strContents = strValue;
560 return S_OK;
561 }
562
563 case REG_QWORD:
564 {
565 DWORD bufferLength = 64 * sizeof(WCHAR);
567 StringCbPrintfW(strValue, bufferLength, L"0x%016llx (%lld)",
568 *(LARGE_INTEGER*)td, ((LARGE_INTEGER*)td)->QuadPart);
569 *strContents = strValue;
570 return S_OK;
571 }
572
573 case REG_BINARY:
574 {
575 DWORD bufferLength = (contentsLength * 3 + 1) * sizeof(WCHAR);
577 PWSTR strTemp = strValue;
578 PBYTE data = (PBYTE)td;
579 for (DWORD i = 0; i < contentsLength; i++)
580 {
581 StringCbPrintfW(strTemp, bufferLength, L"%02x ", data[i]);
582 strTemp += 3;
583 bufferLength -= 3;
584 }
585 *strContents = strValue;
586 return S_OK;
587 }
588
589 default:
590 {
591 PCWSTR strFormat = L"<Unimplemented value type %d>";
592 DWORD bufferLength = (wcslen(strFormat) + 15) * sizeof(WCHAR);
594 StringCbPrintfW(strValue, bufferLength, strFormat, contentType);
595 *strContents = strValue;
596 return S_OK;
597 }
598 }
599}
static const WCHAR separator[]
Definition: asmname.c:65
LPWSTR WINAPI StrCatW(LPWSTR lpszStr, LPCWSTR lpszSrc)
Definition: string.c:452
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizei const GLchar *const * strings
Definition: glext.h:7622
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define REG_SZ
Definition: layer.c:22
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:202
#define REG_BINARY
Definition: nt_native.h:1496
#define REG_MULTI_SZ
Definition: nt_native.h:1501
#define REG_NONE
Definition: nt_native.h:1492
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define REG_QWORD
Definition: sdbapi.c:597
#define REG_DWORD
Definition: sdbapi.c:596
STRSAFEAPI StringCbCopyNW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, size_t cbToCopy)
Definition: strsafe.h:255
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
ret QuadPart
Definition: rtlfuncs.h:3089
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by FormatContentsForDisplay().

◆ GetDefaultColumnState()

HRESULT STDMETHODCALLTYPE CRegistryFolder::GetDefaultColumnState ( UINT  iColumn,
SHCOLSTATEF pcsFlags 
)
override

Implements IShellFolder2.

Definition at line 159 of file regfolder.cpp.

162{
163 switch (iColumn)
164 {
167 return S_OK;
168
171 return S_OK;
172
175 return S_OK;
176 }
177
178 return E_INVALIDARG;
179}
@ SHCOLSTATE_TYPE_STR
Definition: shtypes.idl:121
@ SHCOLSTATE_SLOW
Definition: shtypes.idl:126
@ SHCOLSTATE_ONBYDEFAULT
Definition: shtypes.idl:125

◆ GetDetailsEx()

HRESULT STDMETHODCALLTYPE CRegistryFolder::GetDetailsEx ( LPCITEMIDLIST  pidl,
const SHCOLUMNID pscid,
VARIANT pv 
)
override

Definition at line 181 of file regfolder.cpp.

185{
186 const RegPidlEntry * info;
187
188 TRACE("GetDetailsEx\n");
189
190 if (pidl)
191 {
192 HRESULT hr = GetInfoFromPidl(pidl, &info);
194 return hr;
195
196 static const GUID storage = PSGUID_STORAGE;
197 if (IsEqualGUID(pscid->fmtid, storage))
198 {
199 if (pscid->pid == PID_STG_NAME)
200 {
201 if (info->entryNameLength > 0)
202 {
203 return MakeVariantString(pv, info->entryName);
204 }
205 return MakeVariantString(pv, L"(Default)");
206 }
207 else if (pscid->pid == PID_STG_STORAGETYPE)
208 {
209 if (info->entryType == REG_ENTRY_ROOT)
210 {
211 return MakeVariantString(pv, L"Key");
212 }
213
214 if (info->entryType == REG_ENTRY_KEY)
215 {
216 if (info->contentsLength > 0)
217 {
218 PWSTR td = (PWSTR)(((PBYTE)info) + FIELD_OFFSET(RegPidlEntry, entryName) + info->entryNameLength + sizeof(WCHAR));
219
220 return MakeVariantString(pv, td);
221 }
222 return MakeVariantString(pv, L"Key");
223 }
224
225 return MakeVariantString(pv, RegistryTypeNames[info->contentType]);
226 }
227 else if (pscid->pid == PID_STG_CONTENTS)
228 {
229 PCWSTR strValueContents;
230
231 hr = FormatContentsForDisplay(info, m_hRoot, m_NtPath, &strValueContents);
233 return hr;
234
235 if (hr == S_FALSE)
236 {
237 V_VT(pv) = VT_EMPTY;
238 return S_OK;
239 }
240
241 hr = MakeVariantString(pv, strValueContents);
242
243 CoTaskMemFree((PVOID)strValueContents);
244
245 return hr;
246
247 }
248 }
249 }
250
251 return E_INVALIDARG;
252}
virtual HRESULT GetInfoFromPidl(LPCITEMIDLIST pcidl, const RegPidlEntry **pentry)
Definition: regfolder.cpp:470
HRESULT INLINE MakeVariantString(VARIANT *pv, PCWSTR string)
Definition: util.h:22
@ VT_EMPTY
Definition: compat.h:2295
const LPCWSTR RegistryTypeNames[]
Definition: ntobjenum.cpp:35
@ REG_ENTRY_ROOT
Definition: ntobjenum.h:52
#define PSGUID_STORAGE
Definition: ntquery.h:47
#define PID_STG_STORAGETYPE
Definition: ntquery.h:50
#define PID_STG_CONTENTS
Definition: ntquery.h:64
#define PID_STG_NAME
Definition: ntquery.h:56
#define V_VT(A)
Definition: oleauto.h:211
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define TRACE(s)
Definition: solgame.cpp:4
#define S_FALSE
Definition: winerror.h:2357

◆ GetDetailsOf()

HRESULT STDMETHODCALLTYPE CRegistryFolder::GetDetailsOf ( LPCITEMIDLIST  pidl,
UINT  iColumn,
SHELLDETAILS psd 
)
override

Definition at line 254 of file regfolder.cpp.

258{
259 const RegPidlEntry * info;
260
261 TRACE("GetDetailsOf\n");
262
263 if (pidl)
264 {
265 HRESULT hr = GetInfoFromPidl(pidl, &info);
267 return hr;
268
269 switch (iColumn)
270 {
272 {
273 psd->fmt = LVCFMT_LEFT;
274
275 if (info->entryNameLength > 0)
276 {
277 return MakeStrRetFromString(info->entryName, info->entryNameLength, &(psd->str));
278 }
279 return MakeStrRetFromString(L"(Default)", &(psd->str));
280 }
281
283 {
284 psd->fmt = LVCFMT_LEFT;
285
286 if (info->entryType == REG_ENTRY_ROOT)
287 {
288 return MakeStrRetFromString(L"Key", &(psd->str));
289 }
290
291 if (info->entryType == REG_ENTRY_KEY)
292 {
293 if (info->contentsLength > 0)
294 {
295 PWSTR td = (PWSTR)(((PBYTE)info) + FIELD_OFFSET(RegPidlEntry, entryName) + info->entryNameLength + sizeof(WCHAR));
296
297 return MakeStrRetFromString(td, info->contentsLength, &(psd->str));
298 }
299
300 return MakeStrRetFromString(L"Key", &(psd->str));
301 }
302
303 return MakeStrRetFromString(RegistryTypeNames[info->contentType], &(psd->str));
304 }
305
307 {
308 psd->fmt = LVCFMT_LEFT;
309
310 PCWSTR strValueContents;
311
312 hr = FormatContentsForDisplay(info, m_hRoot, m_NtPath, &strValueContents);
314 return hr;
315
316 if (hr == S_FALSE)
317 {
318 return MakeStrRetFromString(L"(Empty)", &(psd->str));
319 }
320
321 hr = MakeStrRetFromString(strValueContents, &(psd->str));
322
323 CoTaskMemFree((PVOID)strValueContents);
324
325 return hr;
326 }
327 }
328 }
329 else
330 {
331 switch (iColumn)
332 {
334 psd->fmt = LVCFMT_LEFT;
335 psd->cxChar = 30;
336
337 // TODO: Make localizable
338 MakeStrRetFromString(L"Object Name", &(psd->str));
339 return S_OK;
340
342 psd->fmt = LVCFMT_LEFT;
343 psd->cxChar = 20;
344
345 // TODO: Make localizable
346 MakeStrRetFromString(L"Content Type", &(psd->str));
347 return S_OK;
348
350 psd->fmt = LVCFMT_LEFT;
351 psd->cxChar = 20;
352
353 // TODO: Make localizable
354 MakeStrRetFromString(L"Value", &(psd->str));
355 return S_OK;
356 }
357 }
358
359 return E_INVALIDARG;
360}
HRESULT INLINE MakeStrRetFromString(LPCWSTR string, DWORD cbLength, STRRET *str)
Definition: util.h:7
#define LVCFMT_LEFT
Definition: commctrl.h:2598
STRRET str
Definition: shtypes.idl:108

◆ GetInfoFromPidl()

HRESULT CRegistryFolder::GetInfoFromPidl ( LPCITEMIDLIST  pcidl,
const RegPidlEntry **  pentry 
)
protectedvirtual

Reimplemented from CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >.

Definition at line 470 of file regfolder.cpp.

471{
472 if (!pcidl)
473 {
474 DbgPrint("PCIDL is NULL\n");
475 return E_INVALIDARG;
476 }
477
478 RegPidlEntry * entry = (RegPidlEntry*) &(pcidl->mkid);
479 if (entry->cb < sizeof(RegPidlEntry))
480 {
481 DbgPrint("PCIDL too small %l (required %l)\n", entry->cb, sizeof(RegPidlEntry));
482 return E_INVALIDARG;
483 }
484
485 if (entry->magic != REGISTRY_PIDL_MAGIC)
486 {
487 DbgPrint("PCIDL magic mismatch %04x (expected %04x)\n", entry->magic, REGISTRY_PIDL_MAGIC);
488 return E_INVALIDARG;
489 }
490
491 *pentry = entry;
492 return S_OK;
493}
uint32_t entry
Definition: isohybrid.c:63
#define REGISTRY_PIDL_MAGIC
Definition: ntobjenum.h:26

Referenced by GetDetailsEx(), and GetDetailsOf().

◆ Initialize() [1/2]

HRESULT STDMETHODCALLTYPE CRegistryFolder::Initialize ( PCIDLIST_ABSOLUTE  pidl)
override

Implements IPersistFolder.

Definition at line 141 of file regfolder.cpp.

142{
143 m_shellPidl = ILClone(pidl);
144 m_hRoot = NULL;
145
146 StringCbCopyW(m_NtPath, sizeof(m_NtPath), L"");
147 return S_OK;
148}
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:237

◆ Initialize() [2/2]

HRESULT STDMETHODCALLTYPE CRegistryFolder::Initialize ( PCIDLIST_ABSOLUTE  pidl,
PCWSTR  ntPath,
HKEY  hRoot 
)

Definition at line 150 of file regfolder.cpp.

151{
152 m_shellPidl = ILClone(pidl);
153 m_hRoot = hRoot;
154
155 StringCbCopyW(m_NtPath, sizeof(m_NtPath), ntPath);
156 return S_OK;
157}
static HTREEITEM hRoot
Definition: treeview.c:381

◆ InternalBindToObject()

HRESULT STDMETHODCALLTYPE CRegistryFolder::InternalBindToObject ( PWSTR  path,
const RegPidlEntry info,
LPITEMIDLIST  first,
LPCITEMIDLIST  rest,
LPITEMIDLIST  fullPidl,
LPBC  pbcReserved,
IShellFolder **  ppsfChild 
)
overrideprotected

Definition at line 124 of file regfolder.cpp.

132{
133 if (wcslen(m_NtPath) == 0 && m_hRoot == NULL)
134 {
135 return ShellObjectCreatorInit<CRegistryFolder>(fullPidl, L"", info->rootKey, IID_PPV_ARG(IShellFolder, ppsfChild));
136 }
137
138 return ShellObjectCreatorInit<CRegistryFolder>(fullPidl, path, m_hRoot, IID_PPV_ARG(IShellFolder, ppsfChild));
139}
#define IID_PPV_ARG(Itype, ppType)

◆ MapColumnToSCID()

HRESULT STDMETHODCALLTYPE CRegistryFolder::MapColumnToSCID ( UINT  iColumn,
SHCOLUMNID pscid 
)
override

Implements IShellFolder2.

Definition at line 362 of file regfolder.cpp.

365{
366 static const GUID storage = PSGUID_STORAGE;
367 switch (iColumn)
368 {
370 pscid->fmtid = storage;
371 pscid->pid = PID_STG_NAME;
372 return S_OK;
373
375 pscid->fmtid = storage;
376 pscid->pid = PID_STG_STORAGETYPE;
377 return S_OK;
378
380 pscid->fmtid = storage;
381 pscid->pid = PID_STG_CONTENTS;
382 return S_OK;
383 }
384 return E_INVALIDARG;
385}

◆ STDMETHOD_() [1/2]

CRegistryFolder::STDMETHOD_ ( BOOL  ,
IsFolder   
) const
protected

◆ STDMETHOD_() [2/2]

CRegistryFolder::STDMETHOD_ ( ULONG  ,
ConvertAttributes   
) const
protected

Member Data Documentation

◆ inMask

PULONG CRegistryFolder::inMask
protected

Definition at line 104 of file regfolder.h.

◆ m_hRoot

HKEY CRegistryFolder::m_hRoot
private

The documentation for this class was generated from the following files: