ReactOS 0.4.15-dev-7659-ga55345b
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 EnumObjects (HWND hwndOwner, SHCONTF grfFlags, IEnumIDList **ppenumIDList) PURE
 
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 GetDefaultColumnState (UINT iColumn, SHCOLSTATEF *pcsFlags) PURE
 
virtual HRESULT STDMETHODCALLTYPE GetDetailsEx (LPCITEMIDLIST pidl, const SHCOLUMNID *pscid, VARIANT *pv) PURE
 
virtual HRESULT STDMETHODCALLTYPE GetDetailsOf (LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS *psd) PURE
 
virtual HRESULT STDMETHODCALLTYPE MapColumnToSCID (UINT iColumn, SHCOLUMNID *pscid) PURE
 
virtual HRESULT STDMETHODCALLTYPE GetClassID (CLSID *lpClassId)
 
virtual HRESULT STDMETHODCALLTYPE Initialize (PCIDLIST_ABSOLUTE pidl)
 
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 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

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

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< 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
 
- 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 110 of file ntobjfolder.cpp.

111{
112}

◆ ~CNtObjectFolder()

CNtObjectFolder::~CNtObjectFolder ( )
virtual

Definition at line 114 of file ntobjfolder.cpp.

115{
116}

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 437 of file ntobjfolder.cpp.

438{
439 HRESULT hr;
440
441 DWORD sortMode = lParam & 0xFFFF0000;
442 DWORD column = lParam & 0x0000FFFF;
443
444 if (sortMode == SHCIDS_ALLFIELDS)
445 {
446 if (column != 0)
447 return E_INVALIDARG;
448
449 int minsize = min(first->cb, second->cb);
450 hr = MAKE_COMPARE_HRESULT(memcmp(second, first, minsize));
451 if (hr != S_EQUAL)
452 return hr;
453
454 return MAKE_COMPARE_HRESULT(second->cb - first->cb);
455 }
456
457 switch (column)
458 {
460 return CompareName(lParam, first, second);
461
463 return MAKE_COMPARE_HRESULT(second->objectType - first->objectType);
464
466 {
467 if (first->objectType != SYMBOLICLINK_OBJECT && second->objectType != SYMBOLICLINK_OBJECT)
468 return CompareName(lParam, first, second);
469
470 if (first->objectType != SYMBOLICLINK_OBJECT || second->objectType != SYMBOLICLINK_OBJECT)
471 return first->objectType != SYMBOLICLINK_OBJECT ? S_GREATERTHAN : S_LESSTHAN;
472
473 WCHAR wbLink1[MAX_PATH] = { 0 }, wbLink2[MAX_PATH] = { 0 };
474 UNICODE_STRING firstLink, secondLink;
475 RtlInitEmptyUnicodeString(&firstLink, wbLink1, sizeof(wbLink1));
476
478 return E_INVALIDARG;
479
480 RtlInitEmptyUnicodeString(&secondLink, wbLink2, sizeof(wbLink2));
481
483 return E_INVALIDARG;
484
485 return MAKE_COMPARE_HRESULT(RtlCompareUnicodeString(&firstLink, &secondLink, TRUE));
486 }
487 }
488
489 DbgPrint("Unsupported sorting mode.\n");
490 return E_INVALIDARG;
491}
#define SHCIDS_ALLFIELDS
Definition: CFontExt.cpp:15
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
virtual HRESULT STDMETHODCALLTYPE CompareName(LPARAM lParam, const NtPidlEntry *first, const NtPidlEntry *second)
Definition: foldercommon.h:291
LPARAM lParam
Definition: combotst.c:139
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRUE
Definition: types.h:120
#define MAX_PATH
Definition: compat.h:34
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
Definition: string_lib.cpp:31
unsigned long DWORD
Definition: ntddk_ex.h:95
const GLint * first
Definition: glext.h:5794
#define DbgPrint
Definition: hal.h:12
#define min(a, b)
Definition: monoChain.cc:55
HRESULT GetNTObjectSymbolicLinkTarget(LPCWSTR path, LPCWSTR entryName, PUNICODE_STRING LinkTarget)
Definition: ntobjenum.cpp:151
@ SYMBOLICLINK_OBJECT
Definition: ntobjenum.h:14
@ NTOBJECT_COLUMN_NAME
Definition: ntobjfolder.cpp:20
@ NTOBJECT_COLUMN_LINKTARGET
Definition: ntobjfolder.cpp:22
@ NTOBJECT_COLUMN_TYPE
Definition: ntobjfolder.cpp:21
#define S_LESSTHAN
Definition: shellutils.h:570
#define S_GREATERTHAN
Definition: shellutils.h:572
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:573
#define S_EQUAL
Definition: shellutils.h:571
HRESULT hr
Definition: shlfolder.c:183
OBJECT_TYPE objectType
Definition: ntobjenum.h:37
USHORT cb
Definition: ntobjenum.h:33
WCHAR entryName[ANYSIZE_ARRAY]
Definition: ntobjenum.h:40
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ ConvertAttributes()

ULONG CNtObjectFolder::ConvertAttributes ( const NtPidlEntry entry,
PULONG  inMask 
)
protectedvirtual

Reimplemented from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >.

Definition at line 493 of file ntobjfolder.cpp.

494{
495 ULONG mask = inMask ? *inMask : 0xFFFFFFFF;
496 ULONG flags = SFGAO_HASPROPSHEET | SFGAO_CANLINK;
497
498 if (entry->objectType == DIRECTORY_OBJECT)
499 flags |= SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_BROWSABLE;
500
501 if (entry->objectType == SYMBOLICLINK_OBJECT)
502 flags |= SFGAO_LINK | SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_BROWSABLE;
503
504 if (entry->objectType == KEY_OBJECT)
505 flags |= SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_BROWSABLE;
506
507 return flags & mask;
508}
GLenum GLint GLuint mask
Definition: glext.h:6028
GLbitfield flags
Definition: glext.h:7161
uint32_t entry
Definition: isohybrid.c:63
@ KEY_OBJECT
Definition: ntobjenum.h:16
@ DIRECTORY_OBJECT
Definition: ntobjenum.h:14
uint32_t ULONG
Definition: typedefs.h:59

◆ EnumObjects()

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

Reimplemented from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >.

Definition at line 120 of file ntobjfolder.cpp.

124{
125 return GetEnumNTDirectory(m_NtPath, ppenumIDList);
126}
HRESULT GetEnumNTDirectory(LPCWSTR path, IEnumIDList **ppil)
Definition: ntobjenum.cpp:737

◆ 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 223 of file ntobjfolder.cpp.

226{
227 switch (iColumn)
228 {
231 return S_OK;
232
235 return S_OK;
236
239 return S_OK;
240 }
241
242 return E_INVALIDARG;
243}
#define S_OK
Definition: intsafe.h:52
@ SHCOLSTATE_TYPE_STR
Definition: shtypes.idl:121
@ SHCOLSTATE_SLOW
Definition: shtypes.idl:126
@ SHCOLSTATE_ONBYDEFAULT
Definition: shtypes.idl:125

◆ GetDetailsEx()

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

Reimplemented from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >.

Definition at line 245 of file ntobjfolder.cpp.

249{
250 const NtPidlEntry * info;
251
252 TRACE("GetDetailsEx\n");
253
254 if (pidl)
255 {
256 HRESULT hr = GetInfoFromPidl(pidl, &info);
258 return hr;
259
260 static const GUID storage = PSGUID_STORAGE;
261 if (IsEqualGUID(pscid->fmtid, storage))
262 {
263 if (pscid->pid == PID_STG_NAME)
264 {
265 return MakeVariantString(pv, info->entryName);
266 }
267 else if (pscid->pid == PID_STG_STORAGETYPE)
268 {
269 if (info->objectType < 0)
270 {
271 NtPidlTypeData * td = (NtPidlTypeData*) (((PBYTE) info) + FIELD_OFFSET(NtPidlEntry, entryName) + info->entryNameLength + sizeof(WCHAR));
272
273 if (td->typeNameLength > 0)
274 {
275 return MakeVariantString(pv, td->typeName);
276 }
277 else
278 {
279 return MakeVariantString(pv, L"Unknown");
280 }
281 }
282 else
283 {
284 return MakeVariantString(pv, ObjectTypeNames[info->objectType]);
285 }
286 }
287 }
288 else if (IsEqualGUID(pscid->fmtid, GUID_NtObjectColumns))
289 {
290 if (pscid->pid == NTOBJECT_COLUMN_LINKTARGET && info->objectType == SYMBOLICLINK_OBJECT)
291 {
292 WCHAR wbLink[MAX_PATH] = { 0 };
294 RtlInitEmptyUnicodeString(&link, wbLink, sizeof(wbLink));
295
297
298 if (!FAILED_UNEXPECTEDLY(hr) && link.Length > 0)
299 {
300 return MakeVariantString(pv, link.Buffer);
301 }
302 }
303
304 V_VT(pv) = VT_EMPTY;
305 return S_OK;
306 }
307 }
308
309 return E_INVALIDARG;
310}
virtual HRESULT GetInfoFromPidl(LPCITEMIDLIST pcidl, const NtPidlEntry **pentry)
const WCHAR * link
Definition: db.cpp:997
HRESULT INLINE MakeVariantString(VARIANT *pv, PCWSTR string)
Definition: util.h:22
@ VT_EMPTY
Definition: compat.h:2295
const LPCWSTR ObjectTypeNames[]
Definition: ntobjenum.cpp:25
static const GUID GUID_NtObjectColumns
Definition: ntobjfolder.cpp:16
#define PSGUID_STORAGE
Definition: ntquery.h:47
#define PID_STG_STORAGETYPE
Definition: ntquery.h:50
#define PID_STG_NAME
Definition: ntquery.h:56
#define L(x)
Definition: ntvdm.h:50
#define V_VT(A)
Definition: oleauto.h:211
BYTE * PBYTE
Definition: pedump.c:66
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define TRACE(s)
Definition: solgame.cpp:4
WCHAR typeName[ANYSIZE_ARRAY]
Definition: ntobjenum.h:46
USHORT typeNameLength
Definition: ntobjenum.h:45
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

◆ GetDetailsOf()

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

Reimplemented from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >.

Definition at line 312 of file ntobjfolder.cpp.

316{
317 const NtPidlEntry * info;
318
319 TRACE("GetDetailsOf\n");
320
321 if (pidl)
322 {
323 HRESULT hr = GetInfoFromPidl(pidl, &info);
325 return hr;
326
327 switch (iColumn)
328 {
330 {
331 psd->fmt = LVCFMT_LEFT;
332
333 MakeStrRetFromString(info->entryName, info->entryNameLength, &(psd->str));
334 return S_OK;
335 }
336
338 {
339 psd->fmt = LVCFMT_LEFT;
340
341 if (info->objectType < 0)
342 {
343 NtPidlTypeData * td = (NtPidlTypeData*) (((PBYTE) info) + FIELD_OFFSET(NtPidlEntry, entryName) + info->entryNameLength + sizeof(WCHAR));
344
345 if (td->typeNameLength > 0)
347 else
348 MakeStrRetFromString(L"Unknown", &(psd->str));
349 }
350 else
351 MakeStrRetFromString(ObjectTypeNames[info->objectType], &(psd->str));
352 return S_OK;
353 }
354
356 {
357 psd->fmt = LVCFMT_LEFT;
358
359 if (info->objectType == SYMBOLICLINK_OBJECT)
360 {
361 WCHAR wbLink[MAX_PATH] = { 0 };
363 RtlInitEmptyUnicodeString(&link, wbLink, sizeof(wbLink));
364
366
367 if (!FAILED_UNEXPECTEDLY(hr) && link.Length > 0)
368 {
369 MakeStrRetFromString(link.Buffer, link.Length, &(psd->str));
370 return S_OK;
371 }
372 }
373
374 MakeStrRetFromString(L"", &(psd->str));
375 return S_OK;
376 }
377 }
378 }
379 else
380 {
381 switch (iColumn)
382 {
384 psd->fmt = LVCFMT_LEFT;
385 psd->cxChar = 30;
386
387 // TODO: Make localizable
388 MakeStrRetFromString(L"Object Name", &(psd->str));
389 return S_OK;
390
392 psd->fmt = LVCFMT_LEFT;
393 psd->cxChar = 20;
394
395 // TODO: Make localizable
396 MakeStrRetFromString(L"Object Type", &(psd->str));
397 return S_OK;
398
400 psd->fmt = LVCFMT_LEFT;
401 psd->cxChar = 30;
402
403 // TODO: Make localizable
404 MakeStrRetFromString(L"Symlink Target", &(psd->str));
405 return S_OK;
406 }
407 }
408
409 return E_INVALIDARG;
410}
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 CNtObjectFolder::GetInfoFromPidl ( LPCITEMIDLIST  pcidl,
const NtPidlEntry **  pentry 
)
protectedvirtual

Reimplemented from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >.

Definition at line 517 of file ntobjfolder.cpp.

518{
519 if (!pcidl)
520 {
521 DbgPrint("PCIDL is NULL\n");
522 return E_INVALIDARG;
523 }
524
525 NtPidlEntry * entry = (NtPidlEntry*) &(pcidl->mkid);
526 if (entry->cb < sizeof(NtPidlEntry))
527 {
528 DbgPrint("PCIDL too small %l (required %l)\n", entry->cb, sizeof(NtPidlEntry));
529 return E_INVALIDARG;
530 }
531
532 if (entry->magic != NT_OBJECT_PIDL_MAGIC)
533 {
534 DbgPrint("PCIDL magic mismatch %04x (expected %04x)\n", entry->magic, NT_OBJECT_PIDL_MAGIC);
535 return E_INVALIDARG;
536 }
537
538 *pentry = entry;
539 return S_OK;
540}
#define NT_OBJECT_PIDL_MAGIC
Definition: ntobjenum.h:25

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 204 of file ntobjfolder.cpp.

205{
206 m_shellPidl = ILClone(pidl);
207
208 StringCbCopyW(m_NtPath, sizeof(m_NtPath), L"\\");
209
210 return S_OK;
211}
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 214 of file ntobjfolder.cpp.

215{
216 m_shellPidl = ILClone(pidl);
217
218 StringCbCopyW(m_NtPath, sizeof(m_NtPath), ntPath);
219
220 return S_OK;
221}

◆ 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 185 of file ntobjfolder.cpp.

193{
194
195 if (info->objectType == KEY_OBJECT)
196 {
197 return ShellObjectCreatorInit<CRegistryFolder>(fullPidl, path, (HKEY) NULL, IID_PPV_ARG(IShellFolder, ppsfChild));
198 }
199
200 return ShellObjectCreatorInit<CNtObjectFolder>(fullPidl, path, IID_PPV_ARG(IShellFolder, ppsfChild));
201}
#define NULL
Definition: types.h:112
#define IID_PPV_ARG(Itype, ppType)

◆ IsFolder()

BOOL CNtObjectFolder::IsFolder ( const NtPidlEntry info)
protectedvirtual

Reimplemented from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >.

Definition at line 510 of file ntobjfolder.cpp.

511{
512 return (info->objectType == DIRECTORY_OBJECT) ||
513 (info->objectType == SYMBOLICLINK_OBJECT) ||
514 (info->objectType == KEY_OBJECT);
515}

◆ IsSymLink()

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

Reimplemented from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >.

Definition at line 128 of file ntobjfolder.cpp.

129{
130 return info->objectType == SYMBOLICLINK_OBJECT;
131}

◆ MapColumnToSCID()

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

Reimplemented from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >.

Definition at line 412 of file ntobjfolder.cpp.

415{
416 static const GUID storage = PSGUID_STORAGE;
417 switch (iColumn)
418 {
420 pscid->fmtid = storage;
421 pscid->pid = PID_STG_NAME;
422 return S_OK;
423
425 pscid->fmtid = storage;
426 pscid->pid = PID_STG_STORAGETYPE;
427 return S_OK;
428
430 pscid->fmtid = GUID_NtObjectColumns;
431 pscid->pid = NTOBJECT_COLUMN_LINKTARGET;
432 return S_OK;
433 }
434 return E_INVALIDARG;
435}

◆ ResolveSymLink()

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

Reimplemented from CCommonFolder< CNtObjectFolder, NtPidlEntry, CNtObjectFolderExtractIcon >.

Definition at line 133 of file ntobjfolder.cpp.

136{
137 WCHAR wbLink[MAX_PATH] = { 0 };
139 RtlInitEmptyUnicodeString(&link, wbLink, sizeof(wbLink));
140
141 *fullPidl = NULL;
142
145 return hr;
146
148
149 if (link.Length == 0)
150 return E_UNEXPECTED;
151
152 if (link.Buffer[1] == L':' && isalphaW(link.Buffer[0]))
153 {
154 StringCbCopyNW(path, sizeof(path), link.Buffer, link.Length);
155
156 CComPtr<IShellFolder> psfDesktop;
157 hr = SHGetDesktopFolder(&psfDesktop);
159 return hr;
160
161 return psfDesktop->ParseDisplayName(NULL, NULL, path, NULL, fullPidl, NULL);
162 }
163
164 StringCbCopyW(path, sizeof(path), L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{845B0FB2-66E0-416B-8F91-314E23F7C12D}");
165 PathAppend(path, link.Buffer);
166
167 CComPtr<IShellFolder> psfDesktop;
168 hr = SHGetDesktopFolder(&psfDesktop);
170 return hr;
171
172 LPITEMIDLIST pidl;
173
174 hr = psfDesktop->ParseDisplayName(NULL, NULL, path, NULL, &pidl, NULL);
175 if (FAILED(hr))
176 return hr;
177
178 *fullPidl = pidl;
179
180 DumpIdList(pidl);
181
182 return S_OK;
183}
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
#define FAILED(hr)
Definition: intsafe.h:51
#define isalphaW(n)
Definition: unicode.h:48
#define PathAppend
Definition: shlwapi.h:801
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
STRSAFEAPI StringCbCopyNW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, size_t cbToCopy)
Definition: strsafe.h:255
#define E_UNEXPECTED
Definition: winerror.h:2456

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