ReactOS  0.4.15-dev-1150-g593bcce
CNtObjectFolder Class Reference

#include <ntobjfolder.h>

Inheritance diagram for CNtObjectFolder:
Collaboration diagram for CNtObjectFolder:

Public Member Functions

 CNtObjectFolder ()
 
virtual ~CNtObjectFolder ()
 
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)
 
HRESULT STDMETHODCALLTYPE Initialize (PCIDLIST_ABSOLUTE pidl, PCWSTR ntPath)
 
- Public Member Functions inherited from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >
 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 NtPidlEntry *info, LPITEMIDLIST first, LPCITEMIDLIST rest, LPITEMIDLIST fullPidl, LPBC pbcReserved, IShellFolder **ppsfChild)
 
virtual HRESULT STDMETHODCALLTYPE ResolveSymLink (const NtPidlEntry *info, LPITEMIDLIST *fullPidl)
 
virtual HRESULT STDMETHODCALLTYPE CompareIDs (LPARAM lParam, const NtPidlEntry *first, const NtPidlEntry *second)
 
virtual ULONG STDMETHODCALLTYPE ConvertAttributes (const NtPidlEntry *entry, PULONG inMask)
 
virtual BOOL STDMETHODCALLTYPE IsFolder (const NtPidlEntry *info)
 
virtual BOOL STDMETHODCALLTYPE IsSymLink (const NtPidlEntry *info)
 
virtual HRESULT GetInfoFromPidl (LPCITEMIDLIST pcidl, const NtPidlEntry **pentry)
 
HRESULT FormatValueData (DWORD contentType, PVOID td, DWORD contentsLength, PCWSTR *strContents)
 
HRESULT FormatContentsForDisplay (const NtPidlEntry *info, HKEY rootKey, LPCWSTR ntPath, PCWSTR *strContents)
 
- Protected Member Functions inherited from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >
virtual HRESULT STDMETHODCALLTYPE CompareName (LPARAM lParam, const NtPidlEntry *first, const NtPidlEntry *second)
 
virtual BOOL STDMETHODCALLTYPE IsFolder (LPCITEMIDLIST pcidl)
 
virtual BOOL STDMETHODCALLTYPE IsSymLink (LPCITEMIDLIST pcidl)
 

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< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >
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< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >
WCHAR m_NtPath [MAX_PATH]
 
LPITEMIDLIST m_shellPidl
 

Detailed Description

Definition at line 49 of file ntobjfolder.h.

Constructor & Destructor Documentation

◆ CNtObjectFolder()

CNtObjectFolder::CNtObjectFolder ( )

Definition at line 107 of file ntobjfolder.cpp.

108 {
109 }

◆ ~CNtObjectFolder()

CNtObjectFolder::~CNtObjectFolder ( )
virtual

Definition at line 111 of file ntobjfolder.cpp.

112 {
113 }

Member Function Documentation

◆ CompareIDs()

HRESULT CNtObjectFolder::CompareIDs ( LPARAM  lParam,
const NtPidlEntry first,
const NtPidlEntry second 
)
protectedvirtual

Reimplemented from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >.

Definition at line 422 of file ntobjfolder.cpp.

423 {
424  HRESULT hr;
425 
426  DWORD sortMode = lParam & 0xFFFF0000;
427  DWORD column = lParam & 0x0000FFFF;
428 
429  if (sortMode == SHCIDS_ALLFIELDS)
430  {
431  if (column != 0)
432  return E_INVALIDARG;
433 
434  int minsize = min(first->cb, second->cb);
435  hr = MAKE_COMPARE_HRESULT(memcmp(second, first, minsize));
436  if (hr != S_EQUAL)
437  return hr;
438 
439  return MAKE_COMPARE_HRESULT(second->cb - first->cb);
440  }
441 
442  switch (column)
443  {
445  return CompareName(lParam, first, second);
446 
448  return MAKE_COMPARE_HRESULT(second->objectType - first->objectType);
449 
451  // Can't sort by link target yet
452  return E_INVALIDARG;
453  }
454 
455  DbgPrint("Unsupported sorting mode.\n");
456  return E_INVALIDARG;
457 }
USHORT cb
Definition: ntobjenum.h:43
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
OBJECT_TYPE objectType
Definition: ntobjenum.h:47
#define SHCIDS_ALLFIELDS
Definition: precomp.h:49
#define E_INVALIDARG
Definition: ddrawi.h:101
LONG HRESULT
Definition: typedefs.h:79
virtual HRESULT STDMETHODCALLTYPE CompareName(LPARAM lParam, const NtPidlEntry *first, const NtPidlEntry *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 CNtObjectFolder::ConvertAttributes ( const NtPidlEntry entry,
PULONG  inMask 
)
protectedvirtual

Reimplemented from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >.

Definition at line 459 of file ntobjfolder.cpp.

460 {
461  ULONG mask = inMask ? *inMask : 0xFFFFFFFF;
462  ULONG flags = SFGAO_HASPROPSHEET | SFGAO_CANLINK;
463 
464  if (entry->objectType == DIRECTORY_OBJECT)
465  flags |= SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_BROWSABLE;
466 
467  if (entry->objectType == SYMBOLICLINK_OBJECT)
468  flags |= SFGAO_LINK | SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_BROWSABLE;
469 
470  if (entry->objectType == KEY_OBJECT)
471  flags |= SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_BROWSABLE;
472 
473  return flags & mask;
474 }
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 CNtObjectFolder::EnumObjects ( HWND  hwndOwner,
SHCONTF  grfFlags,
IEnumIDList **  ppenumIDList 
)
virtual

Reimplemented from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >.

Definition at line 117 of file ntobjfolder.cpp.

121 {
122  return GetEnumNTDirectory(m_NtPath, ppenumIDList);
123 }
HRESULT GetEnumNTDirectory(LPCWSTR path, IEnumIDList **ppil)
Definition: ntobjenum.cpp:748

◆ FormatContentsForDisplay()

HRESULT CNtObjectFolder::FormatContentsForDisplay ( const NtPidlEntry info,
HKEY  rootKey,
LPCWSTR  ntPath,
PCWSTR strContents 
)
protected

◆ FormatValueData()

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

◆ GetDefaultColumnState()

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

Reimplemented from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >.

Definition at line 220 of file ntobjfolder.cpp.

223 {
224  switch (iColumn)
225  {
228  return S_OK;
231  return S_OK;
234  return S_OK;
235  }
236 
237  return E_INVALIDARG;
238 }
#define E_INVALIDARG
Definition: ddrawi.h:101
#define S_OK
Definition: intsafe.h:51

◆ GetDetailsEx()

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

Reimplemented from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >.

Definition at line 240 of file ntobjfolder.cpp.

244 {
245  const NtPidlEntry * info;
246 
247  TRACE("GetDetailsEx\n");
248 
249  if (pidl)
250  {
251  HRESULT hr = GetInfoFromPidl(pidl, &info);
252  if (FAILED_UNEXPECTEDLY(hr))
253  return hr;
254 
255  static const GUID storage = PSGUID_STORAGE;
256  if (IsEqualGUID(pscid->fmtid, storage))
257  {
258  if (pscid->pid == PID_STG_NAME)
259  {
260  return MakeVariantString(pv, info->entryName);
261  }
262  else if (pscid->pid == PID_STG_STORAGETYPE)
263  {
264  if (info->objectType < 0)
265  {
266  NtPidlTypeData * td = (NtPidlTypeData*) (((PBYTE) info) + FIELD_OFFSET(NtPidlEntry, entryName) + info->entryNameLength + sizeof(WCHAR));
267 
268  if (td->typeNameLength > 0)
269  {
270  return MakeVariantString(pv, td->typeName);
271  }
272  else
273  {
274  return MakeVariantString(pv, L"Unknown");
275  }
276  }
277  else
278  {
279  return MakeVariantString(pv, ObjectTypeNames[info->objectType]);
280  }
281  }
282  }
283  else if (IsEqualGUID(pscid->fmtid, GUID_NtObjectColumns))
284  {
285  if (pscid->pid == NTOBJECT_COLUMN_LINKTARGET && info->objectType == SYMBOLICLINK_OBJECT)
286  {
287  WCHAR wbLink[MAX_PATH] = { 0 };
289  RtlInitEmptyUnicodeString(&link, wbLink, sizeof(wbLink));
290 
292 
293  if (!FAILED_UNEXPECTEDLY(hr) && link.Length > 0)
294  {
295  return MakeVariantString(pv, link.Buffer);
296  }
297  }
298 
299  V_VT(pv) = VT_EMPTY;
300  return S_OK;
301  }
302  }
303 
304  return E_INVALIDARG;
305 }
HRESULT hr
Definition: shlfolder.c:183
const LPCWSTR ObjectTypeNames[]
Definition: ntobjenum.cpp:36
#define PID_STG_NAME
Definition: ntquery.h:56
HRESULT INLINE MakeVariantString(VARIANT *pv, PCWSTR string)
Definition: util.h:22
WCHAR typeName[ANYSIZE_ARRAY]
Definition: ntobjenum.h:56
struct _test_info info[]
Definition: SetCursorPos.c:19
#define PSGUID_STORAGE
Definition: ntquery.h:47
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT GetNTObjectSymbolicLinkTarget(LPCWSTR path, LPCWSTR entryName, PUNICODE_STRING LinkTarget)
Definition: ntobjenum.cpp:162
USHORT typeNameLength
Definition: ntobjenum.h:55
#define PID_STG_STORAGETYPE
Definition: ntquery.h:50
#define TRACE(s)
Definition: solgame.cpp:4
virtual HRESULT GetInfoFromPidl(LPCITEMIDLIST pcidl, const NtPidlEntry **pentry)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define MAX_PATH
Definition: compat.h:34
static const WCHAR L[]
Definition: oid.c:1250
#define V_VT(A)
Definition: oleauto.h:211
#define S_OK
Definition: intsafe.h:51
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
const WCHAR * link
Definition: db.cpp:989
BYTE * PBYTE
Definition: pedump.c:66
static const GUID GUID_NtObjectColumns
Definition: ntobjfolder.cpp:17

◆ GetDetailsOf()

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

Reimplemented from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >.

Definition at line 307 of file ntobjfolder.cpp.

311 {
312  const NtPidlEntry * info;
313 
314  TRACE("GetDetailsOf\n");
315 
316  if (pidl)
317  {
318  HRESULT hr = GetInfoFromPidl(pidl, &info);
319  if (FAILED_UNEXPECTEDLY(hr))
320  return hr;
321 
322  switch (iColumn)
323  {
325  psd->fmt = LVCFMT_LEFT;
326 
327  MakeStrRetFromString(info->entryName, info->entryNameLength, &(psd->str));
328  return S_OK;
330  psd->fmt = LVCFMT_LEFT;
331 
332  if (info->objectType < 0)
333  {
334  NtPidlTypeData * td = (NtPidlTypeData*) (((PBYTE) info) + FIELD_OFFSET(NtPidlEntry, entryName) + info->entryNameLength + sizeof(WCHAR));
335 
336  if (td->typeNameLength > 0)
337  MakeStrRetFromString(td->typeName, td->typeNameLength, &(psd->str));
338  else
339  MakeStrRetFromString(L"Unknown", &(psd->str));
340  }
341  else
342  MakeStrRetFromString(ObjectTypeNames[info->objectType], &(psd->str));
343  return S_OK;
345  {
346  psd->fmt = LVCFMT_LEFT;
347 
348  if (info->objectType == SYMBOLICLINK_OBJECT)
349  {
350  WCHAR wbLink[MAX_PATH] = { 0 };
352  RtlInitEmptyUnicodeString(&link, wbLink, sizeof(wbLink));
353 
355 
356  if (!FAILED_UNEXPECTEDLY(hr) && link.Length > 0)
357  {
358  MakeStrRetFromString(link.Buffer, link.Length, &(psd->str));
359  return S_OK;
360  }
361  }
362 
363  MakeStrRetFromString(L"", &(psd->str));
364  return S_OK;
365  }
366  }
367  }
368  else
369  {
370  switch (iColumn)
371  {
373  psd->fmt = LVCFMT_LEFT;
374  psd->cxChar = 30;
375 
376  // TODO: Make localizable
377  MakeStrRetFromString(L"Object Name", &(psd->str));
378  return S_OK;
380  psd->fmt = LVCFMT_LEFT;
381  psd->cxChar = 20;
382 
383  // TODO: Make localizable
384  MakeStrRetFromString(L"Object Type", &(psd->str));
385  return S_OK;
387  psd->fmt = LVCFMT_LEFT;
388  psd->cxChar = 30;
389 
390  // TODO: Make localizable
391  MakeStrRetFromString(L"Symlink Target", &(psd->str));
392  return S_OK;
393  }
394  }
395 
396  return E_INVALIDARG;
397 }
HRESULT hr
Definition: shlfolder.c:183
const LPCWSTR ObjectTypeNames[]
Definition: ntobjenum.cpp:36
#define LVCFMT_LEFT
Definition: commctrl.h:2594
WCHAR typeName[ANYSIZE_ARRAY]
Definition: ntobjenum.h:56
STRRET str
Definition: shtypes.idl:108
struct _test_info info[]
Definition: SetCursorPos.c:19
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT GetNTObjectSymbolicLinkTarget(LPCWSTR path, LPCWSTR entryName, PUNICODE_STRING LinkTarget)
Definition: ntobjenum.cpp:162
USHORT typeNameLength
Definition: ntobjenum.h:55
#define TRACE(s)
Definition: solgame.cpp:4
virtual HRESULT GetInfoFromPidl(LPCITEMIDLIST pcidl, const NtPidlEntry **pentry)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define MAX_PATH
Definition: compat.h:34
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:51
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
const WCHAR * link
Definition: db.cpp:989
BYTE * PBYTE
Definition: pedump.c:66
HRESULT INLINE MakeStrRetFromString(LPCWSTR string, DWORD cbLength, STRRET *str)
Definition: util.h:7

◆ GetInfoFromPidl()

HRESULT CNtObjectFolder::GetInfoFromPidl ( LPCITEMIDLIST  pcidl,
const NtPidlEntry **  pentry 
)
protectedvirtual

Reimplemented from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >.

Definition at line 483 of file ntobjfolder.cpp.

484 {
485  NtPidlEntry * entry = (NtPidlEntry*) &(pcidl->mkid);
486 
487  if (entry->cb < sizeof(NtPidlEntry))
488  {
489  DbgPrint("PCIDL too small %l (required %l)\n", entry->cb, sizeof(NtPidlEntry));
490  return E_INVALIDARG;
491  }
492 
493  if (entry->magic != NT_OBJECT_PIDL_MAGIC)
494  {
495  DbgPrint("PCIDL magic mismatch %04x (expected %04x)\n", entry->magic, NT_OBJECT_PIDL_MAGIC);
496  return E_INVALIDARG;
497  }
498 
499  *pentry = entry;
500  return S_OK;
501 }
#define DbgPrint
Definition: loader.c:25
#define NT_OBJECT_PIDL_MAGIC
Definition: ntobjenum.h:35
#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 CNtObjectFolder::Initialize ( PCIDLIST_ABSOLUTE  pidl)
virtual

Reimplemented from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >.

Definition at line 201 of file ntobjfolder.cpp.

202 {
203  m_shellPidl = ILClone(pidl);
204 
205  StringCbCopyW(m_NtPath, sizeof(m_NtPath), L"\\");
206 
207  return S_OK;
208 }
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 CNtObjectFolder::Initialize ( PCIDLIST_ABSOLUTE  pidl,
PCWSTR  ntPath 
)

Definition at line 211 of file ntobjfolder.cpp.

212 {
213  m_shellPidl = ILClone(pidl);
214 
215  StringCbCopyW(m_NtPath, sizeof(m_NtPath), ntPath);
216 
217  return S_OK;
218 }
#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 CNtObjectFolder::InternalBindToObject ( PWSTR  path,
const NtPidlEntry info,
LPITEMIDLIST  first,
LPCITEMIDLIST  rest,
LPITEMIDLIST  fullPidl,
LPBC  pbcReserved,
IShellFolder **  ppsfChild 
)
protectedvirtual

Reimplemented from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >.

Definition at line 182 of file ntobjfolder.cpp.

190 {
191 
192  if (info->objectType == KEY_OBJECT)
193  {
194  return ShellObjectCreatorInit<CRegistryFolder>(fullPidl, path, (HKEY) NULL, IID_PPV_ARG(IShellFolder, ppsfChild));
195  }
196 
197  return ShellObjectCreatorInit<CNtObjectFolder>(fullPidl, path, IID_PPV_ARG(IShellFolder, ppsfChild));
198 }
#define IID_PPV_ARG(Itype, ppType)
smooth NULL
Definition: ftsmooth.c:416

◆ IsFolder()

BOOL CNtObjectFolder::IsFolder ( const NtPidlEntry info)
protectedvirtual

Reimplemented from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >.

Definition at line 476 of file ntobjfolder.cpp.

477 {
478  return (info->objectType == DIRECTORY_OBJECT) ||
479  (info->objectType == SYMBOLICLINK_OBJECT) ||
480  (info->objectType == KEY_OBJECT);
481 }

◆ IsSymLink()

BOOL STDMETHODCALLTYPE CNtObjectFolder::IsSymLink ( const NtPidlEntry info)
protectedvirtual

Reimplemented from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >.

Definition at line 125 of file ntobjfolder.cpp.

126 {
127  return info->objectType == SYMBOLICLINK_OBJECT;
128 }

◆ MapColumnToSCID()

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

Reimplemented from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >.

Definition at line 399 of file ntobjfolder.cpp.

402 {
403  static const GUID storage = PSGUID_STORAGE;
404  switch (iColumn)
405  {
407  pscid->fmtid = storage;
408  pscid->pid = PID_STG_NAME;
409  return S_OK;
411  pscid->fmtid = storage;
412  pscid->pid = PID_STG_STORAGETYPE;
413  return S_OK;
415  pscid->fmtid = GUID_NtObjectColumns;
416  pscid->pid = NTOBJECT_COLUMN_LINKTARGET;
417  return S_OK;
418  }
419  return E_INVALIDARG;
420 }
#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
static const GUID GUID_NtObjectColumns
Definition: ntobjfolder.cpp:17

◆ ResolveSymLink()

HRESULT STDMETHODCALLTYPE CNtObjectFolder::ResolveSymLink ( const NtPidlEntry info,
LPITEMIDLIST fullPidl 
)
protectedvirtual

Reimplemented from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >.

Definition at line 130 of file ntobjfolder.cpp.

133 {
134  WCHAR wbLink[MAX_PATH] = { 0 };
136  RtlInitEmptyUnicodeString(&link, wbLink, sizeof(wbLink));
137 
138  *fullPidl = NULL;
139 
141  if (FAILED_UNEXPECTEDLY(hr))
142  return hr;
143 
145 
146  if (link.Length == 0)
147  return E_UNEXPECTED;
148 
149  if (link.Buffer[1] == L':' && isalphaW(link.Buffer[0]))
150  {
151  StringCbCopyNW(path, sizeof(path), link.Buffer, link.Length);
152 
153  CComPtr<IShellFolder> psfDesktop;
154  hr = SHGetDesktopFolder(&psfDesktop);
155  if (FAILED_UNEXPECTEDLY(hr))
156  return hr;
157 
158  return psfDesktop->ParseDisplayName(NULL, NULL, path, NULL, fullPidl, NULL);
159  }
160 
161  StringCbCopyW(path, sizeof(path), L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{845B0FB2-66E0-416B-8F91-314E23F7C12D}");
162  PathAppend(path, link.Buffer);
163 
164  CComPtr<IShellFolder> psfDesktop;
165  hr = SHGetDesktopFolder(&psfDesktop);
166  if (FAILED_UNEXPECTEDLY(hr))
167  return hr;
168 
169  LPITEMIDLIST pidl;
170 
171  hr = psfDesktop->ParseDisplayName(NULL, NULL, path, NULL, &pidl, NULL);
172  if (FAILED(hr))
173  return hr;
174 
175  *fullPidl = pidl;
176 
177  DumpIdList(pidl);
178 
179  return S_OK;
180 }
HRESULT hr
Definition: shlfolder.c:183
STRSAFEAPI StringCbCopyNW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, size_t cbToCopy)
Definition: strsafe.h:255
#define PathAppend
Definition: shlwapi.h:801
smooth NULL
Definition: ftsmooth.c:416
HRESULT GetNTObjectSymbolicLinkTarget(LPCWSTR path, LPCWSTR entryName, PUNICODE_STRING LinkTarget)
Definition: ntobjenum.cpp:162
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define MAX_PATH
Definition: compat.h:34
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:51
#define E_UNEXPECTED
Definition: winerror.h:2456
const WCHAR * link
Definition: db.cpp:989
WINE_UNICODE_INLINE int isalphaW(WCHAR wc)
Definition: unicode.h:195
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

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