ReactOS  0.4.15-dev-1054-gd029a62
CRegistryFolder Class Reference

#include <regfolder.h>

Inheritance diagram for CRegistryFolder:
Collaboration diagram for CRegistryFolder:

Public Member Functions

 CRegistryFolder ()
 
virtual ~CRegistryFolder ()
 
virtual HRESULT STDMETHODCALLTYPE EnumObjects (HWND hwndOwner, SHCONTF grfFlags, IEnumIDList **ppenumIDList)
 
virtual HRESULT STDMETHODCALLTYPE GetDefaultColumnState (UINT iColumn, SHCOLSTATEF *pcsFlags)
 
virtual HRESULT STDMETHODCALLTYPE GetDetailsEx (LPCITEMIDLIST pidl, const SHCOLUMNID *pscid, VARIANT *pv)
 
virtual HRESULT STDMETHODCALLTYPE GetDetailsOf (LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS *psd)
 
virtual HRESULT STDMETHODCALLTYPE MapColumnToSCID (UINT iColumn, SHCOLUMNID *pscid)
 
virtual HRESULT STDMETHODCALLTYPE Initialize (PCIDLIST_ABSOLUTE pidl)
 
virtual HRESULT STDMETHODCALLTYPE Initialize (PCIDLIST_ABSOLUTE pidl, PCWSTR ntPath, HKEY hRoot)
 
- Public Member Functions inherited from CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >
 CCommonFolder ()
 
virtual ~CCommonFolder ()
 
virtual HRESULT STDMETHODCALLTYPE ParseDisplayName (HWND hwndOwner, LPBC pbcReserved, LPOLESTR lpszDisplayName, ULONG *pchEaten, LPITEMIDLIST *ppidl, ULONG *pdwAttributes)
 
virtual HRESULT STDMETHODCALLTYPE BindToObject (LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, void **ppvOut)
 
virtual HRESULT STDMETHODCALLTYPE BindToStorage (LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, void **ppvObj)
 
virtual HRESULT STDMETHODCALLTYPE CompareIDs (LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
 
virtual HRESULT STDMETHODCALLTYPE CreateViewObject (HWND hwndOwner, REFIID riid, void **ppvOut)
 
virtual HRESULT STDMETHODCALLTYPE GetAttributesOf (UINT cidl, PCUITEMID_CHILD_ARRAY apidl, SFGAOF *rgfInOut)
 
virtual HRESULT STDMETHODCALLTYPE GetUIObjectOf (HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, void **ppvOut)
 
virtual HRESULT STDMETHODCALLTYPE GetDisplayNameOf (LPCITEMIDLIST pidl, SHGDNF uFlags, STRRET *lpName)
 
virtual HRESULT STDMETHODCALLTYPE SetNameOf (HWND hwnd, LPCITEMIDLIST pidl, LPCOLESTR lpszName, SHGDNF uFlags, LPITEMIDLIST *ppidlOut)
 
virtual HRESULT STDMETHODCALLTYPE GetDefaultSearchGUID (GUID *lpguid)
 
virtual HRESULT STDMETHODCALLTYPE EnumSearches (IEnumExtraSearch **ppenum)
 
virtual HRESULT STDMETHODCALLTYPE GetDefaultColumn (DWORD dwReserved, ULONG *pSort, ULONG *pDisplay)
 
virtual HRESULT STDMETHODCALLTYPE GetClassID (CLSID *lpClassId)
 
virtual HRESULT STDMETHODCALLTYPE GetCurFolder (PIDLIST_ABSOLUTE *pidl)
 
- 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 GetDetailsEx ([in] PCUITEMID_CHILD pidl, [in] const SHCOLUMNID *pscid, [out] VARIANT *pv)
 
HRESULT GetDetailsOf ([in] PCUITEMID_CHILD pidl, [in] UINT iColumn, [out] SHELLDETAILS *psd)
 
- 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 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 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 ()
 

Protected Member Functions

virtual HRESULT STDMETHODCALLTYPE InternalBindToObject (PWSTR path, const RegPidlEntry *info, LPITEMIDLIST first, LPCITEMIDLIST rest, LPITEMIDLIST fullPidl, LPBC pbcReserved, IShellFolder **ppsfChild)
 
virtual HRESULT STDMETHODCALLTYPE CompareIDs (LPARAM lParam, const RegPidlEntry *first, const RegPidlEntry *second)
 
virtual ULONG STDMETHODCALLTYPE ConvertAttributes (const RegPidlEntry *entry, PULONG inMask)
 
virtual BOOL STDMETHODCALLTYPE 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 >
virtual HRESULT STDMETHODCALLTYPE ResolveSymLink (const RegPidlEntry *info, LPITEMIDLIST *fullPidl)
 
virtual HRESULT STDMETHODCALLTYPE CompareName (LPARAM lParam, const RegPidlEntry *first, const RegPidlEntry *second)
 
virtual BOOL STDMETHODCALLTYPE IsFolder (LPCITEMIDLIST pcidl)
 
virtual BOOL STDMETHODCALLTYPE IsSymLink (LPCITEMIDLIST pcidl)
 
virtual BOOL STDMETHODCALLTYPE IsSymLink (const RegPidlEntry *info)
 

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
 
- 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
 
- Public Attributes inherited from IShellFolder
SFGAO_STORAGEANCESTOR typedef ULONG SFGAOF
 
- Protected Attributes inherited from CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >
WCHAR m_NtPath [MAX_PATH]
 
LPITEMIDLIST m_shellPidl
 

Detailed Description

Definition at line 49 of file regfolder.h.

Constructor & Destructor Documentation

◆ CRegistryFolder()

CRegistryFolder::CRegistryFolder ( )

Definition at line 98 of file regfolder.cpp.

99 {
100 }

◆ ~CRegistryFolder()

CRegistryFolder::~CRegistryFolder ( )
virtual

Definition at line 102 of file regfolder.cpp.

103 {
104 }

Member Function Documentation

◆ CompareIDs()

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

Reimplemented from CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >.

Definition at line 373 of file regfolder.cpp.

374 {
375  HRESULT hr;
376 
377  DWORD sortMode = lParam & 0xFFFF0000;
378  DWORD column = lParam & 0x0000FFFF;
379 
380  if (sortMode == SHCIDS_ALLFIELDS)
381  {
382  if (column != 0)
383  return E_INVALIDARG;
384 
385  int minsize = min(first->cb, second->cb);
386  hr = MAKE_COMPARE_HRESULT(memcmp(second, first, minsize));
387  if (hr != S_EQUAL)
388  return hr;
389 
390  return MAKE_COMPARE_HRESULT(second->cb - first->cb);
391  }
392 
393  switch (column)
394  {
396  return CompareName(lParam, first, second);
397 
399  return MAKE_COMPARE_HRESULT(second->contentType - first->contentType);
400 
402  // Can't sort by link target yet
403  return E_INVALIDARG;
404  }
405 
406  DbgPrint("Unsupported sorting mode.\n");
407  return E_INVALIDARG;
408 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
HRESULT hr
Definition: shlfolder.c:183
#define DbgPrint
Definition: loader.c:25
const GLint * first
Definition: glext.h:5794
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:535
#define SHCIDS_ALLFIELDS
Definition: precomp.h:49
DWORD contentType
Definition: ntobjenum.h:83
#define E_INVALIDARG
Definition: ddrawi.h:101
USHORT cb
Definition: ntobjenum.h:72
LONG HRESULT
Definition: typedefs.h:79
virtual HRESULT STDMETHODCALLTYPE CompareName(LPARAM lParam, const RegPidlEntry *first, const RegPidlEntry *second)
Definition: foldercommon.h:289
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_EQUAL
Definition: shellutils.h:533
#define min(a, b)
Definition: monoChain.cc:55
LPARAM lParam
Definition: combotst.c:139

◆ ConvertAttributes()

ULONG CRegistryFolder::ConvertAttributes ( const RegPidlEntry entry,
PULONG  inMask 
)
protectedvirtual

Reimplemented from CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >.

Definition at line 410 of file regfolder.cpp.

411 {
412  ULONG mask = inMask ? *inMask : 0xFFFFFFFF;
413  ULONG flags = 0;
414 
415  if ((entry->entryType == REG_ENTRY_KEY) ||
416  (entry->entryType == REG_ENTRY_ROOT))
417  flags |= SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_BROWSABLE;
418 
419  return flags & mask;
420 }
GLenum GLint GLuint mask
Definition: glext.h:6028
GLbitfield flags
Definition: glext.h:7161
uint32_t entry
Definition: isohybrid.c:63
unsigned int ULONG
Definition: retypes.h:1

◆ EnumObjects()

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

Reimplemented from CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >.

Definition at line 107 of file regfolder.cpp.

111 {
112  if (m_NtPath[0] == 0 && m_hRoot == NULL)
113  {
114  return GetEnumRegistryRoot(ppenumIDList);
115  }
116  else
117  {
118  return GetEnumRegistryKey(m_NtPath, m_hRoot, ppenumIDList);
119  }
120 }
smooth NULL
Definition: ftsmooth.c:416
HRESULT GetEnumRegistryRoot(IEnumIDList **ppil)
Definition: ntobjenum.cpp:738
HRESULT GetEnumRegistryKey(LPCWSTR path, HKEY root, IEnumIDList **ppil)
Definition: ntobjenum.cpp:743

◆ FormatContentsForDisplay()

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

Definition at line 547 of file regfolder.cpp.

548 {
549  PVOID td = (((PBYTE)info) + FIELD_OFFSET(RegPidlEntry, entryName) + info->entryNameLength + sizeof(WCHAR));
550 
551  if (info->entryType == REG_ENTRY_VALUE_WITH_CONTENT)
552  {
553  if (info->contentsLength > 0)
554  {
555  return FormatValueData(info->contentType, td, info->contentsLength, strContents);
556  }
557  }
558  else if (info->entryType == REG_ENTRY_VALUE)
559  {
560  PVOID valueData;
561  DWORD valueLength;
562  HRESULT hr = ReadRegistryValue(rootKey, ntPath, info->entryName, &valueData, &valueLength);
563  if (FAILED_UNEXPECTEDLY(hr))
564  {
565  PCWSTR strEmpty = L"(Error reading value)";
566  DWORD bufferLength = (wcslen(strEmpty) + 1) * sizeof(WCHAR);
567  PWSTR strValue = (PWSTR)CoTaskMemAlloc(bufferLength);
568  StringCbCopyW(strValue, bufferLength, strEmpty);
569  *strContents = strValue;
570  return S_OK;
571  }
572 
573  if (valueLength > 0)
574  {
575  hr = FormatValueData(info->contentType, valueData, valueLength, strContents);
576 
577  CoTaskMemFree(valueData);
578 
579  return hr;
580  }
581  }
582  else
583  {
584  PCWSTR strEmpty = L"";
585  DWORD bufferLength = (wcslen(strEmpty) + 1) * sizeof(WCHAR);
586  PWSTR strValue = (PWSTR)CoTaskMemAlloc(bufferLength);
587  StringCbCopyW(strValue, bufferLength, strEmpty);
588  *strContents = strValue;
589  return S_OK;
590  }
591 
592  PCWSTR strEmpty = L"(Empty)";
593  DWORD bufferLength = (wcslen(strEmpty) + 1) * sizeof(WCHAR);
594  PWSTR strValue = (PWSTR)CoTaskMemAlloc(bufferLength);
595  StringCbCopyW(strValue, bufferLength, strEmpty);
596  *strContents = strValue;
597  return S_OK;
598 }
const uint16_t * PCWSTR
Definition: typedefs.h:57
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
HRESULT hr
Definition: shlfolder.c:183
uint16_t * PWSTR
Definition: typedefs.h:56
HRESULT FormatValueData(DWORD contentType, PVOID td, DWORD contentsLength, PCWSTR *strContents)
Definition: regfolder.cpp:447
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL ReadRegistryValue(IN DWORD ValueType, IN LPCSTR ValueName, OUT LPBYTE DataBuffer, IN OUT LPDWORD DataBufferSize)
Definition: d3d9_helpers.c:19
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:51
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
BYTE * PBYTE
Definition: pedump.c:66
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by GetDetailsEx(), and GetDetailsOf().

◆ FormatValueData()

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

Definition at line 447 of file regfolder.cpp.

448 {
449  switch (contentType)
450  {
451  case 0:
452  {
453  PCWSTR strTodo = L"";
454  DWORD bufferLength = (wcslen(strTodo) + 1) * sizeof(WCHAR);
455  PWSTR strValue = (PWSTR)CoTaskMemAlloc(bufferLength);
456  StringCbCopyW(strValue, bufferLength, strTodo);
457  *strContents = strValue;
458  return S_OK;
459  }
460  case REG_SZ:
461  case REG_EXPAND_SZ:
462  {
463  PWSTR strValue = (PWSTR)CoTaskMemAlloc(contentsLength + sizeof(WCHAR));
464  StringCbCopyNW(strValue, contentsLength + sizeof(WCHAR), (LPCWSTR)td, contentsLength);
465  *strContents = strValue;
466  return S_OK;
467  }
468  case REG_MULTI_SZ:
469  {
470  PCWSTR separator = L" "; // To match regedit
471  size_t sepChars = wcslen(separator);
472  int strings = 0;
473  int stringChars = 0;
474 
475  PCWSTR strData = (PCWSTR)td;
476  while (*strData)
477  {
478  size_t len = wcslen(strData);
479  stringChars += len;
480  strData += len + 1; // Skips null-terminator
481  strings++;
482  }
483 
484  int cch = stringChars + (strings - 1) * sepChars + 1;
485 
486  PWSTR strValue = (PWSTR)CoTaskMemAlloc(cch * sizeof(WCHAR));
487 
488  strValue[0] = 0;
489 
490  strData = (PCWSTR)td;
491  while (*strData)
492  {
493  StrCatW(strValue, strData);
494  strData += wcslen(strData) + 1;
495  if (*strData)
496  StrCatW(strValue, separator);
497  }
498 
499  *strContents = strValue;
500  return S_OK;
501  }
502  case REG_DWORD:
503  {
504  DWORD bufferLength = 64 * sizeof(WCHAR);
505  PWSTR strValue = (PWSTR)CoTaskMemAlloc(bufferLength);
506  StringCbPrintfW(strValue, bufferLength, L"0x%08x (%d)",
507  *(DWORD*)td, *(DWORD*)td);
508  *strContents = strValue;
509  return S_OK;
510  }
511  case REG_QWORD:
512  {
513  DWORD bufferLength = 64 * sizeof(WCHAR);
514  PWSTR strValue = (PWSTR)CoTaskMemAlloc(bufferLength);
515  StringCbPrintfW(strValue, bufferLength, L"0x%016llx (%lld)",
516  *(LARGE_INTEGER*)td, ((LARGE_INTEGER*)td)->QuadPart);
517  *strContents = strValue;
518  return S_OK;
519  }
520  case REG_BINARY:
521  {
522  DWORD bufferLength = (contentsLength * 3 + 1) * sizeof(WCHAR);
523  PWSTR strValue = (PWSTR)CoTaskMemAlloc(bufferLength);
524  PWSTR strTemp = strValue;
525  PBYTE data = (PBYTE)td;
526  for (DWORD i = 0; i < contentsLength; i++)
527  {
528  StringCbPrintfW(strTemp, bufferLength, L"%02x ", data[i]);
529  strTemp += 3;
530  bufferLength -= 3;
531  }
532  *strContents = strValue;
533  return S_OK;
534  }
535  default:
536  {
537  PCWSTR strFormat = L"<Unimplemented value type %d>";
538  DWORD bufferLength = (wcslen(strFormat) + 15) * sizeof(WCHAR);
539  PWSTR strValue = (PWSTR)CoTaskMemAlloc(bufferLength);
540  StringCbPrintfW(strValue, bufferLength, strFormat, contentType);
541  *strContents = strValue;
542  return S_OK;
543  }
544  }
545 }
const uint16_t * PCWSTR
Definition: typedefs.h:57
LPWSTR WINAPI StrCatW(LPWSTR lpszStr, LPCWSTR lpszSrc)
Definition: string.c:452
static const WCHAR separator[]
Definition: asmname.c:65
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
STRSAFEAPI StringCbCopyNW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, size_t cbToCopy)
Definition: strsafe.h:255
#define REG_BINARY
Definition: nt_native.h:1496
uint16_t * PWSTR
Definition: typedefs.h:56
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_MULTI_SZ
Definition: nt_native.h:1501
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:201
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizei const GLchar *const * strings
Definition: glext.h:7622
static const WCHAR L[]
Definition: oid.c:1250
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:51
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
ret QuadPart
Definition: rtlfuncs.h:3091
#define REG_QWORD
Definition: sdbapi.c:597
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
#define REG_DWORD
Definition: sdbapi.c:596
BYTE * PBYTE
Definition: pedump.c:66
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define REG_SZ
Definition: layer.c:22

Referenced by FormatContentsForDisplay().

◆ GetDefaultColumnState()

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

Reimplemented from CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >.

Definition at line 157 of file regfolder.cpp.

160 {
161  switch (iColumn)
162  {
165  return S_OK;
168  return S_OK;
171  return S_OK;
172  }
173 
174  return E_INVALIDARG;
175 }
#define E_INVALIDARG
Definition: ddrawi.h:101
#define S_OK
Definition: intsafe.h:51

◆ GetDetailsEx()

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

Reimplemented from CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >.

Definition at line 177 of file regfolder.cpp.

181 {
182  const RegPidlEntry * info;
183 
184  TRACE("GetDetailsEx\n");
185 
186  if (pidl)
187  {
188  HRESULT hr = GetInfoFromPidl(pidl, &info);
189  if (FAILED_UNEXPECTEDLY(hr))
190  return hr;
191 
192  static const GUID storage = PSGUID_STORAGE;
193  if (IsEqualGUID(pscid->fmtid, storage))
194  {
195  if (pscid->pid == PID_STG_NAME)
196  {
197  if (info->entryNameLength > 0)
198  {
199  return MakeVariantString(pv, info->entryName);
200  }
201  return MakeVariantString(pv, L"(Default)");
202  }
203  else if (pscid->pid == PID_STG_STORAGETYPE)
204  {
205  if (info->entryType == REG_ENTRY_ROOT)
206  {
207  return MakeVariantString(pv, L"Key");
208  }
209 
210  if (info->entryType == REG_ENTRY_KEY)
211  {
212  if (info->contentsLength > 0)
213  {
214  PWSTR td = (PWSTR)(((PBYTE)info) + FIELD_OFFSET(RegPidlEntry, entryName) + info->entryNameLength + sizeof(WCHAR));
215 
216  return MakeVariantString(pv, td);
217  }
218  return MakeVariantString(pv, L"Key");
219  }
220 
221  return MakeVariantString(pv, RegistryTypeNames[info->contentType]);
222  }
223  else if (pscid->pid == PID_STG_CONTENTS)
224  {
225  PCWSTR strValueContents;
226 
227  hr = FormatContentsForDisplay(info, m_hRoot, m_NtPath, &strValueContents);
228  if (FAILED_UNEXPECTEDLY(hr))
229  return hr;
230 
231  if (hr == S_FALSE)
232  {
233  V_VT(pv) = VT_EMPTY;
234  return S_OK;
235  }
236 
237  hr = MakeVariantString(pv, strValueContents);
238 
239  CoTaskMemFree((PVOID)strValueContents);
240 
241  return hr;
242 
243  }
244  }
245  }
246 
247  return E_INVALIDARG;
248 }
const uint16_t * PCWSTR
Definition: typedefs.h:57
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
HRESULT hr
Definition: shlfolder.c:183
uint16_t * PWSTR
Definition: typedefs.h:56
HRESULT FormatContentsForDisplay(const RegPidlEntry *info, HKEY rootKey, LPCWSTR ntPath, PCWSTR *strContents)
Definition: regfolder.cpp:547
#define PID_STG_NAME
Definition: ntquery.h:56
HRESULT INLINE MakeVariantString(VARIANT *pv, PCWSTR string)
Definition: util.h:22
virtual HRESULT GetInfoFromPidl(LPCITEMIDLIST pcidl, const RegPidlEntry **pentry)
Definition: regfolder.cpp:427
struct _test_info info[]
Definition: SetCursorPos.c:19
#define PSGUID_STORAGE
Definition: ntquery.h:47
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
#define PID_STG_STORAGETYPE
Definition: ntquery.h:50
#define TRACE(s)
Definition: solgame.cpp:4
const LPCWSTR RegistryTypeNames[]
Definition: ntobjenum.cpp:46
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
static const WCHAR L[]
Definition: oid.c:1250
#define V_VT(A)
Definition: oleauto.h:211
#define S_OK
Definition: intsafe.h:51
#define PID_STG_CONTENTS
Definition: ntquery.h:64
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
BYTE * PBYTE
Definition: pedump.c:66

◆ GetDetailsOf()

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

Reimplemented from CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >.

Definition at line 250 of file regfolder.cpp.

254 {
255  const RegPidlEntry * info;
256 
257  TRACE("GetDetailsOf\n");
258 
259  if (pidl)
260  {
261  HRESULT hr = GetInfoFromPidl(pidl, &info);
262  if (FAILED_UNEXPECTEDLY(hr))
263  return hr;
264 
265  switch (iColumn)
266  {
268  psd->fmt = LVCFMT_LEFT;
269 
270  if (info->entryNameLength > 0)
271  {
272  return MakeStrRetFromString(info->entryName, info->entryNameLength, &(psd->str));
273  }
274  return MakeStrRetFromString(L"(Default)", &(psd->str));
275 
277  psd->fmt = LVCFMT_LEFT;
278 
279  if (info->entryType == REG_ENTRY_ROOT)
280  {
281  return MakeStrRetFromString(L"Key", &(psd->str));
282  }
283 
284  if (info->entryType == REG_ENTRY_KEY)
285  {
286  if (info->contentsLength > 0)
287  {
288  PWSTR td = (PWSTR)(((PBYTE)info) + FIELD_OFFSET(RegPidlEntry, entryName) + info->entryNameLength + sizeof(WCHAR));
289 
290  return MakeStrRetFromString(td, info->contentsLength, &(psd->str));
291  }
292 
293  return MakeStrRetFromString(L"Key", &(psd->str));
294  }
295 
296  return MakeStrRetFromString(RegistryTypeNames[info->entryType], &(psd->str));
297 
299  psd->fmt = LVCFMT_LEFT;
300 
301  PCWSTR strValueContents;
302 
303  hr = FormatContentsForDisplay(info, m_hRoot, m_NtPath, &strValueContents);
304  if (FAILED_UNEXPECTEDLY(hr))
305  return hr;
306 
307  if (hr == S_FALSE)
308  {
309  return MakeStrRetFromString(L"(Empty)", &(psd->str));
310  }
311 
312  hr = MakeStrRetFromString(strValueContents, &(psd->str));
313 
314  CoTaskMemFree((PVOID)strValueContents);
315 
316  return hr;
317  }
318  }
319  else
320  {
321  switch (iColumn)
322  {
324  psd->fmt = LVCFMT_LEFT;
325  psd->cxChar = 30;
326 
327  // TODO: Make localizable
328  MakeStrRetFromString(L"Object Name", &(psd->str));
329  return S_OK;
331  psd->fmt = LVCFMT_LEFT;
332  psd->cxChar = 20;
333 
334  // TODO: Make localizable
335  MakeStrRetFromString(L"Content Type", &(psd->str));
336  return S_OK;
338  psd->fmt = LVCFMT_LEFT;
339  psd->cxChar = 20;
340 
341  // TODO: Make localizable
342  MakeStrRetFromString(L"Value", &(psd->str));
343  return S_OK;
344  }
345  }
346 
347  return E_INVALIDARG;
348 }
const uint16_t * PCWSTR
Definition: typedefs.h:57
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
HRESULT hr
Definition: shlfolder.c:183
uint16_t * PWSTR
Definition: typedefs.h:56
HRESULT FormatContentsForDisplay(const RegPidlEntry *info, HKEY rootKey, LPCWSTR ntPath, PCWSTR *strContents)
Definition: regfolder.cpp:547
#define LVCFMT_LEFT
Definition: commctrl.h:2594
virtual HRESULT GetInfoFromPidl(LPCITEMIDLIST pcidl, const RegPidlEntry **pentry)
Definition: regfolder.cpp:427
STRRET str
Definition: shtypes.idl:108
struct _test_info info[]
Definition: SetCursorPos.c:19
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
const LPCWSTR RegistryTypeNames[]
Definition: ntobjenum.cpp:46
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:51
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
BYTE * PBYTE
Definition: pedump.c:66
HRESULT INLINE MakeStrRetFromString(LPCWSTR string, DWORD cbLength, STRRET *str)
Definition: util.h:7

◆ GetInfoFromPidl()

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

Reimplemented from CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >.

Definition at line 427 of file regfolder.cpp.

428 {
429  RegPidlEntry * entry = (RegPidlEntry*) &(pcidl->mkid);
430 
431  if (entry->cb < sizeof(RegPidlEntry))
432  {
433  DbgPrint("PCIDL too small %l (required %l)\n", entry->cb, sizeof(RegPidlEntry));
434  return E_INVALIDARG;
435  }
436 
437  if (entry->magic != REGISTRY_PIDL_MAGIC)
438  {
439  DbgPrint("PCIDL magic mismatch %04x (expected %04x)\n", entry->magic, REGISTRY_PIDL_MAGIC);
440  return E_INVALIDARG;
441  }
442 
443  *pentry = entry;
444  return S_OK;
445 }
#define DbgPrint
Definition: loader.c:25
#define REGISTRY_PIDL_MAGIC
Definition: ntobjenum.h:36
#define E_INVALIDARG
Definition: ddrawi.h:101
uint32_t entry
Definition: isohybrid.c:63
#define S_OK
Definition: intsafe.h:51

Referenced by GetDetailsEx(), and GetDetailsOf().

◆ Initialize() [1/2]

HRESULT STDMETHODCALLTYPE CRegistryFolder::Initialize ( PCIDLIST_ABSOLUTE  pidl)
virtual

Reimplemented from CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >.

Definition at line 139 of file regfolder.cpp.

140 {
141  m_shellPidl = ILClone(pidl);
142  m_hRoot = NULL;
143 
144  StringCbCopyW(m_NtPath, sizeof(m_NtPath), L"");
145  return S_OK;
146 }
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:51
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166

◆ Initialize() [2/2]

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

Definition at line 148 of file regfolder.cpp.

149 {
150  m_shellPidl = ILClone(pidl);
151  m_hRoot = hRoot;
152 
153  StringCbCopyW(m_NtPath, sizeof(m_NtPath), ntPath);
154  return S_OK;
155 }
static HTREEITEM hRoot
Definition: treeview.c:381
#define S_OK
Definition: intsafe.h:51
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166

◆ InternalBindToObject()

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

Reimplemented from CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >.

Definition at line 122 of file regfolder.cpp.

130 {
131  if (wcslen(m_NtPath) == 0 && m_hRoot == NULL)
132  {
133  return ShellObjectCreatorInit<CRegistryFolder>(fullPidl, L"", info->rootKey, IID_PPV_ARG(IShellFolder, ppsfChild));
134  }
135 
136  return ShellObjectCreatorInit<CRegistryFolder>(fullPidl, path, m_hRoot, IID_PPV_ARG(IShellFolder, ppsfChild));
137 }
#define IID_PPV_ARG(Itype, ppType)
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR L[]
Definition: oid.c:1250
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

◆ IsFolder()

BOOL CRegistryFolder::IsFolder ( const RegPidlEntry info)
protectedvirtual

Reimplemented from CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >.

Definition at line 422 of file regfolder.cpp.

423 {
424  return (info->entryType == REG_ENTRY_KEY) ||(info->entryType == REG_ENTRY_ROOT);
425 }

◆ MapColumnToSCID()

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

Reimplemented from CCommonFolder< CRegistryFolder, RegPidlEntry, CRegistryFolderExtractIcon >.

Definition at line 350 of file regfolder.cpp.

353 {
354  static const GUID storage = PSGUID_STORAGE;
355  switch (iColumn)
356  {
358  pscid->fmtid = storage;
359  pscid->pid = PID_STG_NAME;
360  return S_OK;
362  pscid->fmtid = storage;
363  pscid->pid = PID_STG_STORAGETYPE;
364  return S_OK;
366  pscid->fmtid = storage;
367  pscid->pid = PID_STG_CONTENTS;
368  return S_OK;
369  }
370  return E_INVALIDARG;
371 }
#define PID_STG_NAME
Definition: ntquery.h:56
#define PSGUID_STORAGE
Definition: ntquery.h:47
#define E_INVALIDARG
Definition: ddrawi.h:101
#define PID_STG_STORAGETYPE
Definition: ntquery.h:50
#define S_OK
Definition: intsafe.h:51
#define PID_STG_CONTENTS
Definition: ntquery.h:64

Member Data Documentation

◆ m_hRoot

HKEY CRegistryFolder::m_hRoot
private

Definition at line 53 of file regfolder.h.

Referenced by EnumObjects(), GetDetailsEx(), GetDetailsOf(), Initialize(), and InternalBindToObject().


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