Author: dquintana
Date: Fri Aug 21 15:01:04 2015
New Revision: 68785
URL:
http://svn.reactos.org/svn/reactos?rev=68785&view=rev
Log:
[NTOBJSHEX]
* Improve the filenames to better represent their purpose at a glance.
Added:
trunk/reactos/dll/shellext/ntobjshex/ntobjenum.cpp
- copied, changed from r68784, trunk/reactos/dll/shellext/ntobjshex/ntobjutil.cpp
trunk/reactos/dll/shellext/ntobjshex/ntobjenum.h
- copied unchanged from r68784, trunk/reactos/dll/shellext/ntobjshex/ntobjutil.h
trunk/reactos/dll/shellext/ntobjshex/ntobjfolder.cpp
- copied, changed from r68784, trunk/reactos/dll/shellext/ntobjshex/ntobjns.cpp
trunk/reactos/dll/shellext/ntobjshex/ntobjfolder.h
- copied unchanged from r68784, trunk/reactos/dll/shellext/ntobjshex/ntobjns.h
Removed:
trunk/reactos/dll/shellext/ntobjshex/ntobjns.cpp
trunk/reactos/dll/shellext/ntobjshex/ntobjns.h
trunk/reactos/dll/shellext/ntobjshex/ntobjutil.cpp
trunk/reactos/dll/shellext/ntobjshex/ntobjutil.h
Modified:
trunk/reactos/dll/shellext/ntobjshex/CMakeLists.txt
trunk/reactos/dll/shellext/ntobjshex/precomp.h
trunk/reactos/dll/shellext/ntobjshex/regfolder.cpp
Modified: trunk/reactos/dll/shellext/ntobjshex/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/ntobjshex/CMa…
==============================================================================
--- trunk/reactos/dll/shellext/ntobjshex/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/ntobjshex/CMakeLists.txt [iso-8859-1] Fri Aug 21 15:01:04
2015
@@ -15,9 +15,9 @@
spec2def(ntobjshex.dll ntobjshex.spec)
add_library(ntobjshex SHARED
- ntobjns.cpp
+ ntobjenum.cpp
+ ntobjfolder.cpp
ntobjshex.cpp
- ntobjutil.cpp
ntobjshex.rc
regfolder.cpp
${CMAKE_CURRENT_BINARY_DIR}/ntobjshex.def)
Copied: trunk/reactos/dll/shellext/ntobjshex/ntobjenum.cpp (from r68784,
trunk/reactos/dll/shellext/ntobjshex/ntobjutil.cpp)
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/ntobjshex/nto…
==============================================================================
--- trunk/reactos/dll/shellext/ntobjshex/ntobjutil.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/ntobjshex/ntobjenum.cpp [iso-8859-1] Fri Aug 21 15:01:04
2015
@@ -18,7 +18,7 @@
#include <precomp.h>
-#include "ntobjutil.h"
+#include "ntobjenum.h"
#include <strsafe.h>
WINE_DEFAULT_DEBUG_CHANNEL(ntobjshex);
Copied: trunk/reactos/dll/shellext/ntobjshex/ntobjfolder.cpp (from r68784,
trunk/reactos/dll/shellext/ntobjshex/ntobjns.cpp)
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/ntobjshex/nto…
==============================================================================
--- trunk/reactos/dll/shellext/ntobjshex/ntobjns.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/ntobjshex/ntobjfolder.cpp [iso-8859-1] Fri Aug 21 15:01:04
2015
@@ -7,7 +7,7 @@
*/
#include "precomp.h"
-#include "ntobjutil.h"
+#include "ntobjenum.h"
#include <ntquery.h>
#include "util.h"
Removed: trunk/reactos/dll/shellext/ntobjshex/ntobjns.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/ntobjshex/nto…
==============================================================================
--- trunk/reactos/dll/shellext/ntobjshex/ntobjns.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/ntobjshex/ntobjns.cpp (removed)
@@ -1,1044 +0,0 @@
-/*
- * PROJECT: ReactOS shell extensions
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: dll\shellext\ntobjshex\ntobjns.cpp
- * PURPOSE: NT Object Namespace shell extension
- * PROGRAMMERS: David Quintana <gigaherz(a)gmail.com>
- */
-
-#include "precomp.h"
-#include "ntobjutil.h"
-#include <ntquery.h>
-#include "util.h"
-
-#define DFM_MERGECONTEXTMENU 1 // uFlags LPQCMINFO
-#define DFM_INVOKECOMMAND 2 // idCmd pszArgs
-#define DFM_INVOKECOMMANDEX 12 // idCmd PDFMICS
-#define DFM_GETDEFSTATICID 14 // idCmd * 0
-
-#define SHCIDS_ALLFIELDS 0x80000000L
-#define SHCIDS_CANONICALONLY 0x10000000L
-
-#define GET_SHGDN_FOR(dwFlags) ((DWORD)dwFlags & (DWORD)0x0000FF00)
-#define GET_SHGDN_RELATION(dwFlags) ((DWORD)dwFlags & (DWORD)0x000000FF)
-
-WINE_DEFAULT_DEBUG_CHANNEL(ntobjshex);
-
-// {845B0FB2-66E0-416B-8F91-314E23F7C12D}
-const GUID CLSID_NtObjectFolder = { 0x845b0fb2, 0x66e0, 0x416b, { 0x8f, 0x91, 0x31, 0x4e,
0x23, 0xf7, 0xc1, 0x2d } };
-
-// {F4C430C3-3A8D-4B56-A018-E598DA60C2E0}
-static const GUID GUID_NtObjectColumns = { 0xf4c430c3, 0x3a8d, 0x4b56, { 0xa0, 0x18,
0xe5, 0x98, 0xda, 0x60, 0xc2, 0xe0 } };
-
-enum NtObjectColumns
-{
- NTOBJECT_COLUMN_NAME = 0,
- NTOBJECT_COLUMN_TYPE,
- NTOBJECT_COLUMN_LINKTARGET,
- NTOBJECT_COLUMN_END
-};
-
-class CNtObjectFolderExtractIcon :
- public CComObjectRootEx<CComMultiThreadModelNoCS>,
- public IExtractIconW
-{
- PCITEMID_CHILD m_pcidlChild;
- LPCWSTR m_NtPath;
-
-public:
- CNtObjectFolderExtractIcon() :
- m_pcidlChild(NULL), m_NtPath(NULL)
- {
-
- }
-
- virtual ~CNtObjectFolderExtractIcon()
- {
- if (m_pcidlChild)
- ILFree((LPITEMIDLIST) m_pcidlChild);
- }
-
- HRESULT Initialize(LPCWSTR ntPath, UINT cidl, PCUITEMID_CHILD_ARRAY apidl)
- {
- m_NtPath = ntPath;
- if (cidl != 1)
- return E_INVALIDARG;
- m_pcidlChild = ILClone(apidl[0]);
- return S_OK;
- }
-
- virtual HRESULT STDMETHODCALLTYPE GetIconLocation(
- UINT uFlags,
- LPWSTR szIconFile,
- UINT cchMax,
- INT *piIndex,
- UINT *pwFlags)
- {
- const NtPidlEntry * entry = (NtPidlEntry *) m_pcidlChild;
-
- if ((entry->cb < sizeof(NtPidlEntry)) || (entry->magic !=
NT_OBJECT_PIDL_MAGIC))
- return E_INVALIDARG;
-
- UINT flags = 0;
-
- switch (entry->objectType)
- {
- case DIRECTORY_OBJECT:
- case SYMBOLICLINK_OBJECT:
- GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
- *piIndex = -((uFlags & GIL_OPENICON) ? IDI_NTOBJECTDIROPEN :
IDI_NTOBJECTDIR);
- *pwFlags = flags;
- return S_OK;
- case DEVICE_OBJECT:
- GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
- *piIndex = -IDI_NTOBJECTDEVICE;
- *pwFlags = flags;
- return S_OK;
- case PORT_OBJECT:
- GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
- *piIndex = -IDI_NTOBJECTPORT;
- *pwFlags = flags;
- return S_OK;
- case KEY_OBJECT:
- GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
- *piIndex = -IDI_REGISTRYKEY;
- *pwFlags = flags;
- return S_OK;
- default:
- GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
- *piIndex = -IDI_NTOBJECTITEM;
- *pwFlags = flags;
- return S_OK;
- }
- }
-
- virtual HRESULT STDMETHODCALLTYPE Extract(
- LPCWSTR pszFile,
- UINT nIconIndex,
- HICON *phiconLarge,
- HICON *phiconSmall,
- UINT nIconSize)
- {
- return SHDefExtractIconW(pszFile, nIconIndex, 0, phiconLarge, phiconSmall,
nIconSize);
- }
-
- DECLARE_NOT_AGGREGATABLE(CNtObjectFolderExtractIcon)
- DECLARE_PROTECT_FINAL_CONSTRUCT()
-
- BEGIN_COM_MAP(CNtObjectFolderExtractIcon)
- COM_INTERFACE_ENTRY_IID(IID_IExtractIconW, IExtractIconW)
- END_COM_MAP()
-
-};
-
-class CNtObjectPidlManager
-{
-private:
- PWSTR m_ntPath;
-
-public:
- CNtObjectPidlManager() :
- m_ntPath(NULL)
- {
- }
-
- ~CNtObjectPidlManager()
- {
- }
-
- HRESULT Initialize(PWSTR ntPath)
- {
- m_ntPath = ntPath;
-
- return S_OK;
- }
-
- static HRESULT CompareIDs(LPARAM lParam, const NtPidlEntry * first, const NtPidlEntry
* second)
- {
- if ((lParam & 0xFFFF0000) == SHCIDS_ALLFIELDS)
- {
- if (lParam != 0)
- return E_INVALIDARG;
-
- int minsize = min(first->cb, second->cb);
- int ord = memcmp(second, first, minsize);
-
- if (ord != 0)
- return MAKE_HRESULT(0, 0, (USHORT) ord);
-
- if (second->cb > first->cb)
- return MAKE_HRESULT(0, 0, (USHORT) 1);
- if (second->cb < first->cb)
- return MAKE_HRESULT(0, 0, (USHORT) -1);
- }
- else
- {
- bool canonical = ((lParam & 0xFFFF0000) == SHCIDS_CANONICALONLY);
-
- switch (lParam & 0xFFFF)
- {
- case NTOBJECT_COLUMN_NAME:
- {
- bool f1 = (first->objectType == KEY_OBJECT) || (first->objectType
== DIRECTORY_OBJECT);
- bool f2 = (second->objectType == KEY_OBJECT) || (second->objectType
== DIRECTORY_OBJECT);
-
- if (f1 && !f2)
- return MAKE_HRESULT(0, 0, (USHORT) -1);
- if (f2 && !f1)
- return MAKE_HRESULT(0, 0, (USHORT) 1);
-
- if (canonical)
- {
- // Shortcut: avoid comparing contents if not necessary when the
results are not for display.
- if (second->entryNameLength > first->entryNameLength)
- return MAKE_HRESULT(0, 0, (USHORT) 1);
- if (second->entryNameLength < first->entryNameLength)
- return MAKE_HRESULT(0, 0, (USHORT) -1);
-
- int minlength = min(first->entryNameLength,
second->entryNameLength);
- if (minlength > 0)
- {
- int ord = memcmp(first->entryName, second->entryName,
minlength);
- if (ord != 0)
- return MAKE_HRESULT(0, 0, (USHORT) ord);
- }
- return S_OK;
- }
- else
- {
- int minlength = min(first->entryNameLength,
second->entryNameLength);
- if (minlength > 0)
- {
- int ord = StrCmpNW(first->entryName, second->entryName,
minlength / sizeof(WCHAR));
- if (ord != 0)
- return MAKE_HRESULT(0, 0, (USHORT) ord);
- }
-
- if (second->entryNameLength > first->entryNameLength)
- return MAKE_HRESULT(0, 0, (USHORT) 1);
- if (second->entryNameLength < first->entryNameLength)
- return MAKE_HRESULT(0, 0, (USHORT) -1);
-
- return S_OK;
- }
- }
- case NTOBJECT_COLUMN_TYPE:
- {
- int ord = second->objectType - first->objectType;
- if (ord > 0)
- return MAKE_HRESULT(0, 0, (USHORT) 1);
- if (ord < 0)
- return MAKE_HRESULT(0, 0, (USHORT) -1);
-
- return S_OK;
- }
- case NTOBJECT_COLUMN_LINKTARGET:
- {
- // Can't sort by value
- return E_INVALIDARG;
- }
- default:
- {
- DbgPrint("Unsupported sorting mode.\n");
- return E_INVALIDARG;
- }
- }
- }
-
- return E_INVALIDARG;
- }
-
- static HRESULT CompareIDs(LPARAM lParam, const NtPidlEntry * first, LPCITEMIDLIST
pcidl)
- {
- LPCITEMIDLIST p = pcidl;
- NtPidlEntry * second = (NtPidlEntry*) &(p->mkid);
- if ((second->cb < sizeof(NtPidlEntry)) || (second->magic !=
NT_OBJECT_PIDL_MAGIC))
- return E_INVALIDARG;
-
- return CompareIDs(lParam, first, second);
- }
-
- static HRESULT CompareIDs(LPARAM lParam, LPCITEMIDLIST pcidl1, LPCITEMIDLIST pcidl2)
- {
- LPCITEMIDLIST p = pcidl1;
- NtPidlEntry * first = (NtPidlEntry*) &(p->mkid);
- if ((first->cb < sizeof(NtPidlEntry)) || (first->magic !=
NT_OBJECT_PIDL_MAGIC))
- return E_INVALIDARG;
-
- return CompareIDs(lParam, first, pcidl2);
- }
-
- static ULONG ConvertAttributes(const NtPidlEntry * entry, PULONG inMask)
- {
- ULONG mask = inMask ? *inMask : 0xFFFFFFFF;
- ULONG flags = SFGAO_HASPROPSHEET | SFGAO_CANLINK;
-
- if (entry->objectType == DIRECTORY_OBJECT)
- flags |= SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_BROWSABLE;
-
- if (entry->objectType == SYMBOLICLINK_OBJECT)
- flags |= SFGAO_LINK | SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_BROWSABLE;
-
- if (entry->objectType == KEY_OBJECT)
- flags |= SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_BROWSABLE;
-
- return flags & mask;
- }
-
- BOOL IsFolder(LPCITEMIDLIST pcidl)
- {
- NtPidlEntry * entry = (NtPidlEntry*) &(pcidl->mkid);
- if ((entry->cb < sizeof(NtPidlEntry)) || (entry->magic !=
NT_OBJECT_PIDL_MAGIC))
- return FALSE;
-
- return (entry->objectType == DIRECTORY_OBJECT) ||
- (entry->objectType == SYMBOLICLINK_OBJECT) ||
- (entry->objectType == KEY_OBJECT);
- }
-
- HRESULT GetInfoFromPidl(LPCITEMIDLIST pcidl, const NtPidlEntry ** pentry)
- {
- NtPidlEntry * entry = (NtPidlEntry*) &(pcidl->mkid);
-
- if (entry->cb < sizeof(NtPidlEntry))
- {
- DbgPrint("PCIDL too small %l (required %l)\n", entry->cb,
sizeof(NtPidlEntry));
- return E_INVALIDARG;
- }
-
- if (entry->magic != NT_OBJECT_PIDL_MAGIC)
- {
- DbgPrint("PCIDL magic mismatch %04x (expected %04x)\n",
entry->magic, NT_OBJECT_PIDL_MAGIC);
- return E_INVALIDARG;
- }
-
- *pentry = entry;
- return S_OK;
- }
-};
-
-//-----------------------------------------------------------------------------
-// CNtObjectFolder
-
-CNtObjectFolder::CNtObjectFolder() :
- m_PidlManager(NULL),
- m_shellPidl(NULL)
-{
-}
-
-CNtObjectFolder::~CNtObjectFolder()
-{
- if (m_shellPidl)
- ILFree(m_shellPidl);
- if (m_PidlManager)
- delete m_PidlManager;
-}
-
-// IShellFolder
-HRESULT STDMETHODCALLTYPE CNtObjectFolder::ParseDisplayName(
- HWND hwndOwner,
- LPBC pbcReserved,
- LPOLESTR lpszDisplayName,
- ULONG *pchEaten,
- LPITEMIDLIST *ppidl,
- ULONG *pdwAttributes)
-{
- if (!ppidl)
- return E_POINTER;
-
- if (pchEaten)
- *pchEaten = 0;
-
- if (pdwAttributes)
- *pdwAttributes = 0;
-
- TRACE("CNtObjectFolder::ParseDisplayName name=%S (ntPath=%S)\n",
lpszDisplayName, m_NtPath);
-
- const NtPidlEntry * info;
- IEnumIDList * it;
- HRESULT hr = GetEnumNTDirectory(m_NtPath, &it);
- if (FAILED(hr))
- return hr;
-
- while (TRUE)
- {
- hr = it->Next(1, ppidl, NULL);
-
- if (FAILED(hr))
- return hr;
-
- if (hr != S_OK)
- break;
-
- hr = m_PidlManager->GetInfoFromPidl(*ppidl, &info);
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- if (StrCmpW(info->entryName, lpszDisplayName) == 0)
- break;
- }
-
- if (hr != S_OK)
- {
- return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
- }
-
- if (pchEaten || pdwAttributes)
- {
- if (pchEaten)
- *pchEaten = wcslen(info->entryName);
-
- if (pdwAttributes)
- *pdwAttributes = m_PidlManager->ConvertAttributes(info, pdwAttributes);
- }
-
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE CNtObjectFolder::EnumObjects(
- HWND hwndOwner,
- SHCONTF grfFlags,
- IEnumIDList **ppenumIDList)
-{
- return GetEnumNTDirectory(m_NtPath, ppenumIDList);
-}
-
-HRESULT STDMETHODCALLTYPE CNtObjectFolder::BindToObject(
- LPCITEMIDLIST pidl,
- LPBC pbcReserved,
- REFIID riid,
- void **ppvOut)
-{
- const NtPidlEntry * info;
-
- if (IsEqualIID(riid, IID_IShellFolder))
- {
- HRESULT hr = m_PidlManager->GetInfoFromPidl(pidl, &info);
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- WCHAR path[MAX_PATH];
-
- StringCbCopyW(path, _countof(path), m_NtPath);
-
- PathAppendW(path, info->entryName);
-
- LPITEMIDLIST first = ILCloneFirst(pidl);
- LPCITEMIDLIST rest = ILGetNext(pidl);
-
- LPITEMIDLIST fullPidl = ILCombine(m_shellPidl, first);
-
- if (info->objectType == SYMBOLICLINK_OBJECT)
- {
- WCHAR wbLink[MAX_PATH] = { 0 };
- UNICODE_STRING link;
- RtlInitEmptyUnicodeString(&link, wbLink, sizeof(wbLink));
-
- hr = GetNTObjectSymbolicLinkTarget(m_NtPath, info->entryName, &link);
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- if (link.Length > 0)
- {
- if (link.Buffer[1] == L':' && isalphaW(link.Buffer[0]))
- {
- CComPtr<IShellFolder> psfDesktop;
- hr = SHGetDesktopFolder(&psfDesktop);
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- hr = psfDesktop->ParseDisplayName(NULL, NULL, path, NULL,
&first, NULL);
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- return psfDesktop->BindToObject(rest, pbcReserved, riid, ppvOut);
- }
-
- StringCbCopyW(path, _countof(path),
L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{845B0FB2-66E0-416B-8F91-314E23F7C12D}");
- PathAppend(path, link.Buffer);
-
- CComPtr<IShellFolder> psfDesktop;
- hr = SHGetDesktopFolder(&psfDesktop);
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- hr = psfDesktop->ParseDisplayName(NULL, NULL, path, NULL, &first,
NULL);
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
- }
- else
- {
- return E_UNEXPECTED;
- }
- }
-
- CComPtr<IShellFolder> psfChild;
-
- if (info->objectType == KEY_OBJECT)
- {
- hr = ShellObjectCreatorInit<CRegistryFolder>(fullPidl, path, (HKEY)
NULL, IID_PPV_ARG(IShellFolder, &psfChild));
- }
- else
- {
- hr = ShellObjectCreatorInit<CNtObjectFolder>(fullPidl, path,
IID_PPV_ARG(IShellFolder, &psfChild));
- }
-
- ILFree(fullPidl);
- ILFree(first);
-
- if (rest->mkid.cb > 0)
- {
- return psfChild->BindToObject(rest, pbcReserved, riid, ppvOut);
- }
-
- return psfChild->QueryInterface(riid, ppvOut);
- }
-
- return E_NOTIMPL;
-}
-
-HRESULT STDMETHODCALLTYPE CNtObjectFolder::BindToStorage(
- LPCITEMIDLIST pidl,
- LPBC pbcReserved,
- REFIID riid,
- void **ppvObj)
-{
- UNIMPLEMENTED;
- return E_NOTIMPL;
-}
-
-HRESULT STDMETHODCALLTYPE CNtObjectFolder::CompareIDs(
- LPARAM lParam,
- LPCITEMIDLIST pidl1,
- LPCITEMIDLIST pidl2)
-{
- TRACE("CompareIDs\n");
-
- HRESULT hr = m_PidlManager->CompareIDs(lParam, pidl1, pidl2);
- if (hr != S_OK)
- return hr;
-
- LPCITEMIDLIST rest1 = ILGetNext(pidl1);
- LPCITEMIDLIST rest2 = ILGetNext(pidl2);
-
- bool hasNext1 = (rest1->mkid.cb > 0);
- bool hasNext2 = (rest2->mkid.cb > 0);
-
- if (hasNext1 || hasNext2)
- {
- if (hasNext1 && !hasNext2)
- return MAKE_HRESULT(0, 0, (USHORT) -1);
-
- if (hasNext2 && !hasNext1)
- return MAKE_HRESULT(0, 0, (USHORT) 1);
-
- LPCITEMIDLIST first1 = ILCloneFirst(pidl1);
-
- CComPtr<IShellFolder> psfNext;
- hr = BindToObject(first1, NULL, IID_PPV_ARG(IShellFolder, &psfNext));
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- return psfNext->CompareIDs(lParam, rest1, rest2);
- }
-
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE CNtObjectFolder::CreateViewObject(
- HWND hwndOwner,
- REFIID riid,
- void **ppvOut)
-{
- if (!IsEqualIID(riid, IID_IShellView))
- return E_NOINTERFACE;
-
- SFV_CREATE sfv;
- sfv.cbSize = sizeof(sfv);
- sfv.pshf = this;
- sfv.psvOuter = NULL;
- sfv.psfvcb = this;
-
- return SHCreateShellFolderView(&sfv, (IShellView**) ppvOut);
-}
-
-HRESULT STDMETHODCALLTYPE CNtObjectFolder::GetAttributesOf(
- UINT cidl,
- PCUITEMID_CHILD_ARRAY apidl,
- SFGAOF *rgfInOut)
-{
- const NtPidlEntry * info;
-
- TRACE("GetAttributesOf %d\n", cidl);
-
- if (cidl == 0)
- {
- *rgfInOut &= SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_BROWSABLE;
- return S_OK;
- }
-
- for (int i = 0; i < (int) cidl; i++)
- {
- PCUITEMID_CHILD pidl = apidl[i];
-
- HRESULT hr = m_PidlManager->GetInfoFromPidl(pidl, &info);
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- // Update attributes.
- *rgfInOut = m_PidlManager->ConvertAttributes(info, rgfInOut);
- }
-
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE CNtObjectFolder::GetUIObjectOf(
- HWND hwndOwner,
- UINT cidl,
- PCUITEMID_CHILD_ARRAY apidl,
- REFIID riid,
- UINT *prgfInOut,
- void **ppvOut)
-{
- DWORD res;
- TRACE("GetUIObjectOf\n");
-
- if (IsEqualIID(riid, IID_IContextMenu) ||
- IsEqualIID(riid, IID_IContextMenu2) ||
- IsEqualIID(riid, IID_IContextMenu3))
- {
- CComPtr<IContextMenu> pcm;
-
- HKEY keys[1];
-
- int nkeys = _countof(keys);
- if (cidl == 1 && m_PidlManager->IsFolder(apidl[0]))
- {
- res = RegOpenKey(HKEY_CLASSES_ROOT, L"Folder", keys + 0);
- if (!NT_SUCCESS(res))
- return HRESULT_FROM_NT(res);
- }
- else
- {
- nkeys = 0;
- }
-
- HRESULT hr = CDefFolderMenu_Create2(m_shellPidl, hwndOwner, cidl, apidl, this,
DefCtxMenuCallback, nkeys, keys, &pcm);
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- return pcm->QueryInterface(riid, ppvOut);
- }
-
- if (IsEqualIID(riid, IID_IExtractIconW))
- {
- return ShellObjectCreatorInit<CNtObjectFolderExtractIcon>(m_NtPath, cidl,
apidl, riid, ppvOut);
- }
-
- if (IsEqualIID(riid, IID_IDataObject))
- {
- return CIDLData_CreateFromIDArray(m_shellPidl, cidl, apidl, (IDataObject**)
ppvOut);
- }
-
- if (IsEqualIID(riid, IID_IQueryAssociations))
- {
- if (cidl == 1 && m_PidlManager->IsFolder(apidl[0]))
- {
- CComPtr<IQueryAssociations> pqa;
- HRESULT hr = AssocCreate(CLSID_QueryAssociations,
IID_PPV_ARG(IQueryAssociations, &pqa));
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- hr = pqa->Init(ASSOCF_INIT_DEFAULTTOFOLDER,
L"NTObjShEx.NTDirectory", NULL, hwndOwner);
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- return pqa->QueryInterface(riid, ppvOut);
- }
- }
-
- return E_NOTIMPL;
-}
-
-HRESULT STDMETHODCALLTYPE CNtObjectFolder::GetDisplayNameOf(
- LPCITEMIDLIST pidl,
- SHGDNF uFlags,
- STRRET *lpName)
-{
- const NtPidlEntry * info;
-
- TRACE("GetDisplayNameOf %p\n", pidl);
-
- HRESULT hr = m_PidlManager->GetInfoFromPidl(pidl, &info);
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- if ((GET_SHGDN_RELATION(uFlags) == SHGDN_NORMAL) &&
- (GET_SHGDN_FOR(uFlags) & SHGDN_FORPARSING))
- {
- WCHAR path[MAX_PATH] = { 0 };
-
- hr = GetFullName(m_shellPidl, uFlags, path, _countof(path));
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- PathAppendW(path, info->entryName);
-
- hr = MakeStrRetFromString(path, lpName);
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- LPCITEMIDLIST pidlFirst = ILCloneFirst(pidl);
- LPCITEMIDLIST pidlNext = ILGetNext(pidl);
-
- if (pidlNext && pidlNext->mkid.cb > 0)
- {
- CComPtr<IShellFolder> psfChild;
- hr = BindToObject(pidlFirst, NULL, IID_PPV_ARG(IShellFolder,
&psfChild));
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- WCHAR temp[MAX_PATH];
- STRRET childName;
-
- hr = psfChild->GetDisplayNameOf(pidlNext, uFlags | SHGDN_INFOLDER,
&childName);
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- hr = StrRetToBufW(&childName, pidlNext, temp, _countof(temp));
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- PathAppendW(path, temp);
- }
-
- ILFree((LPITEMIDLIST) pidlFirst);
- }
- else
- {
- MakeStrRetFromString(info->entryName, info->entryNameLength, lpName);
- }
-
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE CNtObjectFolder::SetNameOf(
- HWND hwnd,
- LPCITEMIDLIST pidl,
- LPCOLESTR lpszName,
- SHGDNF uFlags,
- LPITEMIDLIST *ppidlOut)
-{
- UNIMPLEMENTED;
- return E_NOTIMPL;
-}
-
-// IPersist
-HRESULT STDMETHODCALLTYPE CNtObjectFolder::GetClassID(CLSID *lpClassId)
-{
- if (!lpClassId)
- return E_POINTER;
-
- *lpClassId = CLSID_NtObjectFolder;
- return S_OK;
-}
-
-// IPersistFolder
-HRESULT STDMETHODCALLTYPE CNtObjectFolder::Initialize(LPCITEMIDLIST pidl)
-{
- m_shellPidl = ILClone(pidl);
-
- PCWSTR ntPath = L"\\";
-
- if (!m_PidlManager)
- {
- m_PidlManager = new CNtObjectPidlManager();
-
- StringCbCopy(m_NtPath, _countof(m_NtPath), ntPath);
- }
-
- return m_PidlManager->Initialize(m_NtPath);
-}
-
-// Internal
-HRESULT STDMETHODCALLTYPE CNtObjectFolder::Initialize(LPCITEMIDLIST pidl, PCWSTR ntPath)
-{
- m_shellPidl = ILClone(pidl);
-
- if (!m_PidlManager)
- m_PidlManager = new CNtObjectPidlManager();
-
- StringCbCopy(m_NtPath, _countof(m_NtPath), ntPath);
- return m_PidlManager->Initialize(m_NtPath);
-}
-
-// IPersistFolder2
-HRESULT STDMETHODCALLTYPE CNtObjectFolder::GetCurFolder(LPITEMIDLIST * pidl)
-{
- if (pidl)
- *pidl = ILClone(m_shellPidl);
- if (!m_shellPidl)
- return S_FALSE;
- return S_OK;
-}
-
-// IShellFolder2
-HRESULT STDMETHODCALLTYPE CNtObjectFolder::GetDefaultSearchGUID(
- GUID *lpguid)
-{
- UNIMPLEMENTED;
- return E_NOTIMPL;
-}
-
-HRESULT STDMETHODCALLTYPE CNtObjectFolder::EnumSearches(
- IEnumExtraSearch **ppenum)
-{
- UNIMPLEMENTED;
- return E_NOTIMPL;
-}
-
-HRESULT STDMETHODCALLTYPE CNtObjectFolder::GetDefaultColumn(
- DWORD dwReserved,
- ULONG *pSort,
- ULONG *pDisplay)
-{
- if (pSort)
- *pSort = 0;
- if (pDisplay)
- *pDisplay = 0;
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE CNtObjectFolder::GetDefaultColumnState(
- UINT iColumn,
- SHCOLSTATEF *pcsFlags)
-{
- switch (iColumn)
- {
- case NTOBJECT_COLUMN_NAME:
- *pcsFlags = SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT;
- return S_OK;
- case NTOBJECT_COLUMN_TYPE:
- *pcsFlags = SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT;
- return S_OK;
- case NTOBJECT_COLUMN_LINKTARGET:
- *pcsFlags = SHCOLSTATE_TYPE_STR | SHCOLSTATE_SLOW;
- return S_OK;
- }
-
- return E_INVALIDARG;
-}
-
-HRESULT STDMETHODCALLTYPE CNtObjectFolder::GetDetailsEx(
- LPCITEMIDLIST pidl,
- const SHCOLUMNID *pscid,
- VARIANT *pv)
-{
- const NtPidlEntry * info;
-
- TRACE("GetDetailsEx\n");
-
- if (pidl)
- {
- HRESULT hr = m_PidlManager->GetInfoFromPidl(pidl, &info);
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- static const GUID storage = PSGUID_STORAGE;
- if (IsEqualGUID(pscid->fmtid, storage))
- {
- if (pscid->pid == PID_STG_NAME)
- {
- return MakeVariantString(pv, info->entryName);
- }
- else if (pscid->pid == PID_STG_STORAGETYPE)
- {
- if (info->objectType < 0)
- {
- NtPidlTypeData * td = (NtPidlTypeData*) (((PBYTE) info) +
FIELD_OFFSET(NtPidlEntry, entryName) + info->entryNameLength + sizeof(WCHAR));
-
- if (td->typeNameLength > 0)
- {
- return MakeVariantString(pv, td->typeName);
- }
- else
- {
- return MakeVariantString(pv, L"Unknown");
- }
- }
- else
- {
- return MakeVariantString(pv, ObjectTypeNames[info->objectType]);
- }
- }
- }
- else if (IsEqualGUID(pscid->fmtid, GUID_NtObjectColumns))
- {
- if (pscid->pid == NTOBJECT_COLUMN_LINKTARGET &&
info->objectType == SYMBOLICLINK_OBJECT)
- {
- WCHAR wbLink[MAX_PATH] = { 0 };
- UNICODE_STRING link;
- RtlInitEmptyUnicodeString(&link, wbLink, sizeof(wbLink));
-
- HRESULT hr = GetNTObjectSymbolicLinkTarget(m_NtPath, info->entryName,
&link);
-
- if (!FAILED_UNEXPECTEDLY(hr) && link.Length > 0)
- {
- return MakeVariantString(pv, link.Buffer);
- }
- }
-
- V_VT(pv) = VT_EMPTY;
- return S_OK;
- }
- }
-
- return E_INVALIDARG;
-}
-
-HRESULT STDMETHODCALLTYPE CNtObjectFolder::GetDetailsOf(
- LPCITEMIDLIST pidl,
- UINT iColumn,
- SHELLDETAILS *psd)
-{
- const NtPidlEntry * info;
-
- TRACE("GetDetailsOf\n");
-
- if (pidl)
- {
- HRESULT hr = m_PidlManager->GetInfoFromPidl(pidl, &info);
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
-
- switch (iColumn)
- {
- case NTOBJECT_COLUMN_NAME:
- psd->fmt = LVCFMT_LEFT;
-
- MakeStrRetFromString(info->entryName, info->entryNameLength,
&(psd->str));
- return S_OK;
- case NTOBJECT_COLUMN_TYPE:
- psd->fmt = LVCFMT_LEFT;
-
- if (info->objectType < 0)
- {
- NtPidlTypeData * td = (NtPidlTypeData*) (((PBYTE) info) +
FIELD_OFFSET(NtPidlEntry, entryName) + info->entryNameLength + sizeof(WCHAR));
-
- if (td->typeNameLength > 0)
- MakeStrRetFromString(td->typeName, td->typeNameLength,
&(psd->str));
- else
- MakeStrRetFromString(L"Unknown", &(psd->str));
- }
- else
- MakeStrRetFromString(ObjectTypeNames[info->objectType],
&(psd->str));
- return S_OK;
- case NTOBJECT_COLUMN_LINKTARGET:
- {
- psd->fmt = LVCFMT_LEFT;
-
- if (info->objectType == SYMBOLICLINK_OBJECT)
- {
- WCHAR wbLink[MAX_PATH] = { 0 };
- UNICODE_STRING link;
- RtlInitEmptyUnicodeString(&link, wbLink, sizeof(wbLink));
-
- HRESULT hr = GetNTObjectSymbolicLinkTarget(m_NtPath, info->entryName,
&link);
-
- if (!FAILED_UNEXPECTEDLY(hr) && link.Length > 0)
- {
- MakeStrRetFromString(link.Buffer, link.Length, &(psd->str));
- return S_OK;
- }
- }
-
- MakeStrRetFromString(L"", &(psd->str));
- return S_OK;
- }
- }
- }
- else
- {
- switch (iColumn)
- {
- case NTOBJECT_COLUMN_NAME:
- psd->fmt = LVCFMT_LEFT;
- psd->cxChar = 30;
-
- // TODO: Make localizable
- MakeStrRetFromString(L"Object Name", &(psd->str));
- return S_OK;
- case NTOBJECT_COLUMN_TYPE:
- psd->fmt = LVCFMT_LEFT;
- psd->cxChar = 20;
-
- // TODO: Make localizable
- MakeStrRetFromString(L"Object Type", &(psd->str));
- return S_OK;
- case NTOBJECT_COLUMN_LINKTARGET:
- psd->fmt = LVCFMT_LEFT;
- psd->cxChar = 30;
-
- // TODO: Make localizable
- MakeStrRetFromString(L"Symlink Target", &(psd->str));
- return S_OK;
- }
- }
-
- return E_INVALIDARG;
-}
-
-HRESULT STDMETHODCALLTYPE CNtObjectFolder::MapColumnToSCID(
- UINT iColumn,
- SHCOLUMNID *pscid)
-{
- static const GUID storage = PSGUID_STORAGE;
- switch (iColumn)
- {
- case NTOBJECT_COLUMN_NAME:
- pscid->fmtid = storage;
- pscid->pid = PID_STG_NAME;
- return S_OK;
- case NTOBJECT_COLUMN_TYPE:
- pscid->fmtid = storage;
- pscid->pid = PID_STG_STORAGETYPE;
- return S_OK;
- case NTOBJECT_COLUMN_LINKTARGET:
- pscid->fmtid = GUID_NtObjectColumns;
- pscid->pid = NTOBJECT_COLUMN_LINKTARGET;
- return S_OK;
- }
- return E_INVALIDARG;
-}
-
-HRESULT STDMETHODCALLTYPE CNtObjectFolder::MessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM
lParam)
-{
- switch (uMsg)
- {
- case SFVM_DEFVIEWMODE:
- {
- FOLDERVIEWMODE* pViewMode = (FOLDERVIEWMODE*) lParam;
- *pViewMode = FVM_DETAILS;
- return S_OK;
- }
- case SFVM_COLUMNCLICK:
- return S_FALSE;
- case SFVM_BACKGROUNDENUM:
- return S_OK;
- }
- return E_NOTIMPL;
-}
-
-HRESULT CNtObjectFolder::DefCtxMenuCallback(IShellFolder * /*psf*/, HWND /*hwnd*/,
IDataObject * /*pdtobj*/, UINT uMsg, WPARAM /*wParam*/, LPARAM /*lParam*/)
-{
- switch (uMsg)
- {
- case DFM_MERGECONTEXTMENU:
- return S_OK;
- case DFM_INVOKECOMMAND:
- case DFM_INVOKECOMMANDEX:
- case DFM_GETDEFSTATICID: // Required for Windows 7 to pick a default
- return S_FALSE;
- }
- return E_NOTIMPL;
-}
Removed: trunk/reactos/dll/shellext/ntobjshex/ntobjns.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/ntobjshex/nto…
==============================================================================
--- trunk/reactos/dll/shellext/ntobjshex/ntobjns.h [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/ntobjshex/ntobjns.h (removed)
@@ -1,155 +0,0 @@
-/*
- * PROJECT: ReactOS shell extensions
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: dll\shellext\ntobjshex\ntobjns.h
- * PURPOSE: NT Object Namespace shell extension
- * PROGRAMMERS: David Quintana <gigaherz(a)gmail.com>
- */
-#pragma once
-
-extern const GUID CLSID_NtObjectFolder;
-
-class CNtObjectPidlManager;
-
-class CNtObjectFolder :
- public CComCoClass<CNtObjectFolder, &CLSID_NtObjectFolder>,
- public CComObjectRootEx<CComMultiThreadModelNoCS>,
- public IShellFolder2,
- public IPersistFolder2,
- public IShellFolderViewCB
-{
- CNtObjectPidlManager * m_PidlManager;
-
- WCHAR m_NtPath[MAX_PATH];
-
- LPITEMIDLIST m_shellPidl;
-
-public:
-
- CNtObjectFolder();
- virtual ~CNtObjectFolder();
-
- CNtObjectPidlManager& GetManager() { return *m_PidlManager; }
-
- // IShellFolder
- 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);
-
- 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);
-
- // IShellFolder2
- 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);
-
- 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);
-
- // IPersist
- virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *lpClassId);
-
- // IPersistFolder
- virtual HRESULT STDMETHODCALLTYPE Initialize(LPCITEMIDLIST pidl);
-
- // IPersistFolder2
- virtual HRESULT STDMETHODCALLTYPE GetCurFolder(LPITEMIDLIST * pidl);
-
- // IShellFolderViewCB
- virtual HRESULT STDMETHODCALLTYPE MessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM
lParam);
-
- // Internal
- HRESULT STDMETHODCALLTYPE Initialize(LPCITEMIDLIST pidl, PCWSTR ntPath);
-
- static HRESULT CALLBACK DefCtxMenuCallback(IShellFolder *, HWND, IDataObject *, UINT,
WPARAM, LPARAM);
-
- DECLARE_REGISTRY_RESOURCEID(IDR_NTOBJECTFOLDER)
- DECLARE_NOT_AGGREGATABLE(CNtObjectFolder)
- DECLARE_PROTECT_FINAL_CONSTRUCT()
-
- BEGIN_COM_MAP(CNtObjectFolder)
- COM_INTERFACE_ENTRY_IID(IID_IShellFolder, IShellFolder)
- COM_INTERFACE_ENTRY_IID(IID_IShellFolder2, IShellFolder2)
- COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
- COM_INTERFACE_ENTRY_IID(IID_IPersistFolder, IPersistFolder)
- COM_INTERFACE_ENTRY_IID(IID_IPersistFolder2, IPersistFolder2)
- COM_INTERFACE_ENTRY_IID(IID_IShellFolderViewCB, IShellFolderViewCB)
- END_COM_MAP()
-
-};
Removed: trunk/reactos/dll/shellext/ntobjshex/ntobjutil.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/ntobjshex/nto…
==============================================================================
--- trunk/reactos/dll/shellext/ntobjshex/ntobjutil.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/ntobjshex/ntobjutil.cpp (removed)
@@ -1,744 +0,0 @@
-/*
- * Copyright 2004, 2005 Martin Fuchs
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <precomp.h>
-
-#include "ntobjutil.h"
-#include <strsafe.h>
-
-WINE_DEFAULT_DEBUG_CHANNEL(ntobjshex);
-
-static struct RootKeyEntry {
- HKEY key;
- PCWSTR keyName;
-} RootKeys [] = {
- { HKEY_CLASSES_ROOT, L"HKEY_CLASSES_ROOT" },
- { HKEY_CURRENT_USER, L"HKEY_CURRENT_USER" },
- { HKEY_LOCAL_MACHINE, L"HKEY_LOCAL_MACHINE" },
- { HKEY_USERS, L"HKEY_USERS" },
- { HKEY_CURRENT_CONFIG, L"HKEY_CURRENT_CONFIG" }
-};
-
-typedef NTSTATUS(__stdcall* pfnNtGenericOpen)(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
-typedef NTSTATUS(__stdcall* pfnNtOpenFile)(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
PIO_STATUS_BLOCK, ULONG, ULONG);
-
-const LPCWSTR ObjectTypeNames [] = {
- L"Directory", L"SymbolicLink",
- L"Mutant", L"Section", L"Event",
L"Semaphore",
- L"Timer", L"Key", L"EventPair",
L"IoCompletion",
- L"Device", L"File", L"Controller",
L"Profile",
- L"Type", L"Desktop", L"WindowStatiom",
L"Driver",
- L"Token", L"Process", L"Thread", L"Adapter",
L"Port",
- 0
-};
-
-const LPCWSTR RegistryTypeNames [] = {
- L"REG_NONE",
- L"REG_SZ",
- L"REG_EXPAND_SZ",
- L"REG_BINARY",
- L"REG_DWORD",
- L"REG_DWORD_BIG_ENDIAN",
- L"REG_LINK",
- L"REG_MULTI_SZ",
- L"REG_RESOURCE_LIST",
- L"REG_FULL_RESOURCE_DESCRIPTOR",
- L"REG_RESOURCE_REQUIREMENTS_LIST ",
- L"REG_QWORD"
-};
-
-static DWORD NtOpenObject(OBJECT_TYPE type, PHANDLE phandle, DWORD access, LPCWSTR path)
-{
- UNICODE_STRING ustr;
-
- RtlInitUnicodeString(&ustr, path);
-
- OBJECT_ATTRIBUTES open_struct = { sizeof(OBJECT_ATTRIBUTES), 0x00, &ustr, 0x40
};
-
- if (type != FILE_OBJECT)
- access |= STANDARD_RIGHTS_READ;
-
- IO_STATUS_BLOCK ioStatusBlock;
-
- switch (type)
- {
- case DIRECTORY_OBJECT: return NtOpenDirectoryObject(phandle, access,
&open_struct);
- case SYMBOLICLINK_OBJECT: return NtOpenSymbolicLinkObject(phandle, access,
&open_struct);
- case MUTANT_OBJECT: return NtOpenMutant(phandle, access, &open_struct);
- case SECTION_OBJECT: return NtOpenSection(phandle, access, &open_struct);
- case EVENT_OBJECT: return NtOpenEvent(phandle, access, &open_struct);
- case SEMAPHORE_OBJECT: return NtOpenSemaphore(phandle, access,
&open_struct);
- case TIMER_OBJECT: return NtOpenTimer(phandle, access, &open_struct);
- case KEY_OBJECT: return NtOpenKey(phandle, access, &open_struct);
- case EVENTPAIR_OBJECT: return NtOpenEventPair(phandle, access,
&open_struct);
- case IOCOMPLETITION_OBJECT: return NtOpenIoCompletion(phandle, access,
&open_struct);
- case FILE_OBJECT: return NtOpenFile(phandle, access, &open_struct,
&ioStatusBlock, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 0);
- default:
- return ERROR_INVALID_FUNCTION;
- }
-}
-
-OBJECT_TYPE MapTypeNameToType(LPCWSTR TypeName, DWORD cbTypeName)
-{
- if (!TypeName)
- return UNKNOWN_OBJECT_TYPE;
-
- for (UINT i = 0; i < _countof(ObjectTypeNames); i++)
- {
- LPCWSTR typeName = ObjectTypeNames[i];
- if (!StrCmpNW(typeName, TypeName, cbTypeName / sizeof(WCHAR)))
- {
- return (OBJECT_TYPE) i;
- }
- }
-
- return UNKNOWN_OBJECT_TYPE;
-}
-
-HRESULT ReadRegistryValue(HKEY root, PCWSTR path, PCWSTR valueName, PVOID * valueData,
PDWORD valueLength)
-{
- HKEY hkey;
-
- DWORD res;
- if (root)
- {
- res = RegOpenKeyExW(root, *path == '\\' ? path + 1 : path, 0,
STANDARD_RIGHTS_READ | KEY_QUERY_VALUE, &hkey);
- }
- else
- {
- res = NtOpenObject(KEY_OBJECT, (PHANDLE) &hkey, STANDARD_RIGHTS_READ |
KEY_QUERY_VALUE, path);
- }
- if (!NT_SUCCESS(res))
- {
- ERR("RegOpenKeyExW failed for path %S with status=%x\n", path, res);
- return HRESULT_FROM_NT(res);
- }
-
- res = RegQueryValueExW(hkey, valueName, NULL, NULL, NULL, valueLength);
- if (!NT_SUCCESS(res))
- {
- ERR("RegQueryValueExW failed for path %S with status=%x\n", path,
res);
- return HRESULT_FROM_NT(res);
- }
-
- if (*valueLength > 0)
- {
- PBYTE data = (PBYTE) CoTaskMemAlloc(*valueLength);;
- *valueData = data;
-
- res = RegQueryValueExW(hkey, valueName, NULL, NULL, data, valueLength);
- if (!NT_SUCCESS(res))
- {
- CoTaskMemFree(data);
- *valueData = NULL;
-
- RegCloseKey(hkey);
-
- ERR("RegOpenKeyExW failed for path %S with status=%x\n", path,
res);
- return HRESULT_FROM_NT(res);
- }
- }
- else
- {
- *valueData = NULL;
- }
-
- RegCloseKey(hkey);
-
- return S_OK;
-}
-
-HRESULT GetNTObjectSymbolicLinkTarget(LPCWSTR path, LPCWSTR entryName, PUNICODE_STRING
LinkTarget)
-{
- HANDLE handle;
- WCHAR buffer[MAX_PATH];
- LPWSTR pend = buffer;
-
- StringCbCopyExW(buffer, sizeof(buffer), path, &pend, NULL, 0);
-
- if (pend[-1] != '\\')
- *pend++ = '\\';
-
- StringCbCatW(buffer, sizeof(buffer), entryName);
-
- DbgPrint("GetNTObjectSymbolicLinkTarget %d\n", buffer);
-
- LinkTarget->Length = 0;
-
- DWORD err = NtOpenObject(SYMBOLICLINK_OBJECT, &handle, 0, buffer);
- if (!NT_SUCCESS(err))
- return HRESULT_FROM_NT(err);
-
- err = NT_SUCCESS(NtQuerySymbolicLinkObject(handle, LinkTarget, NULL));
- if (!NT_SUCCESS(err))
- return HRESULT_FROM_NT(err);
-
- NtClose(handle);
-
- return S_OK;
-}
-
-class CEnumRegRoot :
- public CComObjectRootEx<CComMultiThreadModelNoCS>,
- public IEnumIDList
-{
- UINT m_idx;
-
-public:
- CEnumRegRoot()
- : m_idx(0)
- {
- }
-
- ~CEnumRegRoot()
- {
- }
-
- HRESULT EnumerateNext(LPITEMIDLIST* ppidl)
- {
- if (m_idx >= _countof(RootKeys))
- return S_FALSE;
-
- RootKeyEntry& key = RootKeys[m_idx++];
-
- PCWSTR name = key.keyName;
- DWORD cchName = wcslen(name);
-
- REG_ENTRY_TYPE otype = REG_ENTRY_ROOT;
-
- DWORD entryBufferLength = FIELD_OFFSET(RegPidlEntry, entryName) + sizeof(WCHAR) +
cchName * sizeof(WCHAR);
-
- // allocate space for the terminator
- entryBufferLength += 2;
-
- RegPidlEntry* entry = (RegPidlEntry*) CoTaskMemAlloc(entryBufferLength);
- if (!entry)
- return E_OUTOFMEMORY;
-
- memset(entry, 0, entryBufferLength);
-
- entry->cb = FIELD_OFFSET(RegPidlEntry, entryName);
- entry->magic = REGISTRY_PIDL_MAGIC;
- entry->entryType = otype;
- entry->rootKey = key.key;
-
- if (cchName > 0)
- {
- entry->entryNameLength = cchName * sizeof(WCHAR);
- StringCbCopyNW(entry->entryName, entryBufferLength, name,
entry->entryNameLength);
- entry->cb += entry->entryNameLength + sizeof(WCHAR);
- }
- else
- {
- entry->entryNameLength = 0;
- entry->entryName[0] = 0;
- entry->cb += sizeof(WCHAR);
- }
-
- *ppidl = (LPITEMIDLIST) entry;
- return S_OK;
- }
-
- virtual HRESULT STDMETHODCALLTYPE Next(ULONG celt, LPITEMIDLIST *rgelt, ULONG
*pceltFetched)
- {
- if (pceltFetched)
- *pceltFetched = 0;
-
- while (celt-- > 0)
- {
- HRESULT hr = EnumerateNext(rgelt);
- if (hr != S_OK)
- return hr;
-
- if (pceltFetched)
- (*pceltFetched)++;
- if (rgelt)
- rgelt++;
- }
-
- return S_OK;
- }
-
- virtual HRESULT STDMETHODCALLTYPE Skip(ULONG celt)
- {
- while (celt > 0)
- {
- HRESULT hr = EnumerateNext(NULL);
- if (FAILED(hr))
- return hr;
- if (hr != S_OK)
- break;
- }
-
- return S_OK;
- }
-
- virtual HRESULT STDMETHODCALLTYPE Reset()
- {
- return E_NOTIMPL;
- }
-
- virtual HRESULT STDMETHODCALLTYPE Clone(IEnumIDList **ppenum)
- {
- return E_NOTIMPL;
- }
-
- DECLARE_NOT_AGGREGATABLE(CEnumRegRoot)
- DECLARE_PROTECT_FINAL_CONSTRUCT()
-
- BEGIN_COM_MAP(CEnumRegRoot)
- COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList)
- END_COM_MAP()
-
-};
-
-class CEnumRegKey :
- public CComObjectRootEx<CComMultiThreadModelNoCS>,
- public IEnumIDList
-{
- PCWSTR m_path;
- HKEY m_hkey;
- BOOL m_values;
- int m_idx;
-
-public:
- CEnumRegKey()
- : m_path(NULL), m_hkey(NULL), m_values(FALSE), m_idx(0)
- {
- }
-
- ~CEnumRegKey()
- {
- RegCloseKey(m_hkey);
- }
-
- HRESULT Initialize(PCWSTR path, HKEY root)
- {
- m_path = path;
-
- DWORD res;
- if (root)
- {
- res = RegOpenKeyExW(root, *path == '\\' ? path + 1 : path, 0,
STANDARD_RIGHTS_READ | KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, &m_hkey);
- }
- else
- {
- res = NtOpenObject(KEY_OBJECT, (PHANDLE) &m_hkey, STANDARD_RIGHTS_READ |
KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, path);
- }
- if (!NT_SUCCESS(res))
- {
- ERR("RegOpenKeyExW failed for path %S with status=%x\n", path,
res);
- return HRESULT_FROM_NT(res);
- }
-
- return S_OK;
- }
-
- HRESULT NextKey(LPITEMIDLIST* ppidl)
- {
- WCHAR name[MAX_PATH];
- DWORD cchName = _countof(name);
-
- WCHAR className[MAX_PATH];
- DWORD cchClass = _countof(className);
-
- if (RegEnumKeyExW(m_hkey, m_idx++, name, &cchName, 0, className,
&cchClass, NULL))
- return S_FALSE;
-
- name[cchName] = 0;
- className[cchClass] = 0;
-
- REG_ENTRY_TYPE otype = REG_ENTRY_KEY;
-
- DWORD entryBufferLength = FIELD_OFFSET(RegPidlEntry, entryName) + sizeof(WCHAR) +
cchName * sizeof(WCHAR);
-
- if (cchClass > 0)
- {
- entryBufferLength += sizeof(WCHAR) + cchClass * sizeof(WCHAR);
- }
-
- // allocate space for the terminator
- entryBufferLength += 2;
-
- RegPidlEntry* entry = (RegPidlEntry*) CoTaskMemAlloc(entryBufferLength);
- if (!entry)
- return E_OUTOFMEMORY;
-
- memset(entry, 0, entryBufferLength);
-
- entry->cb = FIELD_OFFSET(RegPidlEntry, entryName);
- entry->magic = REGISTRY_PIDL_MAGIC;
- entry->entryType = otype;
-
- if (cchName > 0)
- {
- entry->entryNameLength = cchName * sizeof(WCHAR);
- StringCbCopyNW(entry->entryName, entryBufferLength, name,
entry->entryNameLength);
- entry->cb += entry->entryNameLength + sizeof(WCHAR);
- }
- else
- {
- entry->entryNameLength = 0;
- entry->entryName[0] = 0;
- entry->cb += sizeof(WCHAR);
- }
-
- if (cchClass)
- {
- PWSTR contentData = (PWSTR) ((PBYTE) entry + entry->cb);
- DWORD remainingSpace = entryBufferLength - entry->cb;
-
- entry->contentsLength = cchClass * sizeof(WCHAR);
- StringCbCopyNW(contentData, remainingSpace, className,
entry->contentsLength);
-
- entry->cb += entry->contentsLength + sizeof(WCHAR);
- }
-
- *ppidl = (LPITEMIDLIST) entry;
- return S_OK;
- }
-
- HRESULT NextValue(LPITEMIDLIST* ppidl)
- {
- WCHAR name[MAX_PATH];
- DWORD cchName = _countof(name);
- DWORD type = 0;
- DWORD dataSize = 0;
-
- if (RegEnumValueW(m_hkey, m_idx++, name, &cchName, 0, &type, NULL,
&dataSize))
- return S_FALSE;
-
- REG_ENTRY_TYPE otype = REG_ENTRY_VALUE;
-
- DWORD entryBufferLength = FIELD_OFFSET(RegPidlEntry, entryName) + sizeof(WCHAR) +
cchName * sizeof(WCHAR);
-
- BOOL copyData = dataSize < 32;
- if (copyData)
- {
- entryBufferLength += dataSize + sizeof(WCHAR);
-
- otype = REG_ENTRY_VALUE_WITH_CONTENT;
- }
-
- RegPidlEntry* entry = (RegPidlEntry*) CoTaskMemAlloc(entryBufferLength + 2);
- if (!entry)
- return E_OUTOFMEMORY;
-
- memset(entry, 0, entryBufferLength);
-
- entry->cb = FIELD_OFFSET(RegPidlEntry, entryName);
- entry->magic = REGISTRY_PIDL_MAGIC;
- entry->entryType = otype;
- entry->contentType = type;
-
- if (cchName > 0)
- {
- entry->entryNameLength = cchName * sizeof(WCHAR);
- StringCbCopyNW(entry->entryName, entryBufferLength, name,
entry->entryNameLength);
- entry->cb += entry->entryNameLength + sizeof(WCHAR);
- }
- else
- {
- entry->entryNameLength = 0;
- entry->entryName[0] = 0;
- entry->cb += sizeof(WCHAR);
- }
-
- if (copyData)
- {
- PBYTE contentData = (PBYTE) ((PBYTE) entry + entry->cb);
-
- entry->contentsLength = dataSize;
-
- // In case it's an unterminated string, RegGetValue will add the NULL
termination
- dataSize += sizeof(WCHAR);
-
- if (!RegQueryValueExW(m_hkey, name, NULL, NULL, contentData, &dataSize))
- {
- entry->cb += entry->contentsLength + sizeof(WCHAR);
- }
- else
- {
- entry->contentsLength = 0;
- entry->cb += sizeof(WCHAR);
- }
-
- }
-
- *ppidl = (LPITEMIDLIST) entry;
- return S_OK;
- }
-
- HRESULT EnumerateNext(LPITEMIDLIST* ppidl)
- {
- if (!m_values)
- {
- HRESULT hr = NextKey(ppidl);
- if (hr != S_FALSE)
- return hr;
-
- // switch to values.
- m_values = TRUE;
- m_idx = 0;
- }
-
- return NextValue(ppidl);
- }
-
- virtual HRESULT STDMETHODCALLTYPE Next(ULONG celt, LPITEMIDLIST *rgelt, ULONG
*pceltFetched)
- {
- if (pceltFetched)
- *pceltFetched = 0;
-
- while (celt-- > 0)
- {
- HRESULT hr = EnumerateNext(rgelt);
- if (hr != S_OK)
- return hr;
-
- if (pceltFetched)
- (*pceltFetched)++;
- if (rgelt)
- rgelt++;
- }
-
- return S_OK;
- }
-
- virtual HRESULT STDMETHODCALLTYPE Skip(ULONG celt)
- {
- while (celt > 0)
- {
- HRESULT hr = EnumerateNext(NULL);
- if (FAILED(hr))
- return hr;
- if (hr != S_OK)
- break;
- }
-
- return S_OK;
- }
-
- virtual HRESULT STDMETHODCALLTYPE Reset()
- {
- return E_NOTIMPL;
- }
-
- virtual HRESULT STDMETHODCALLTYPE Clone(IEnumIDList **ppenum)
- {
- return E_NOTIMPL;
- }
-
- DECLARE_NOT_AGGREGATABLE(CEnumRegKey)
- DECLARE_PROTECT_FINAL_CONSTRUCT()
-
- BEGIN_COM_MAP(CEnumRegKey)
- COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList)
- END_COM_MAP()
-};
-
-class CEnumNTDirectory :
- public CComObjectRootEx<CComMultiThreadModelNoCS>,
- public IEnumIDList
-{
- WCHAR buffer[MAX_PATH];
- HANDLE m_directory;
- BOOL m_first;
- ULONG m_enumContext;
- PWSTR m_pend;
-
-public:
- CEnumNTDirectory()
- : m_directory(NULL), m_first(TRUE), m_enumContext(0), m_pend(NULL)
- {
- }
-
- ~CEnumNTDirectory()
- {
- NtClose(m_directory);
- }
-
- HRESULT Initialize(PCWSTR path)
- {
- StringCbCopyExW(buffer, sizeof(buffer), path, &m_pend, NULL, 0);
-
- DWORD err = NtOpenObject(DIRECTORY_OBJECT, &m_directory, FILE_LIST_DIRECTORY,
buffer);
- if (!NT_SUCCESS(err))
- {
- ERR("NtOpenDirectoryObject failed for path %S with status=%x\n",
buffer, err);
- return HRESULT_FROM_NT(err);
- }
-
- if (m_pend[-1] != '\\')
- *m_pend++ = '\\';
-
- return S_OK;
- }
-
- HRESULT EnumerateNext(LPITEMIDLIST* ppidl)
- {
- BYTE dirbuffer[2048];
- if (!NT_SUCCESS(NtQueryDirectoryObject(m_directory, dirbuffer, 2048, TRUE,
m_first, &m_enumContext, NULL)))
- return S_FALSE;
-
- // if ppidl is NULL, assume the caller was Skip(),
- // so we don't care about the info
- if (!ppidl)
- return S_OK;
-
- m_first = FALSE;
- POBJECT_DIRECTORY_INFORMATION info = (POBJECT_DIRECTORY_INFORMATION) dirbuffer;
-
- if (info->Name.Buffer)
- {
- StringCbCopyNW(m_pend, sizeof(buffer), info->Name.Buffer,
info->Name.Length);
- }
-
- OBJECT_TYPE otype = MapTypeNameToType(info->TypeName.Buffer,
info->TypeName.Length);
-
- DWORD entryBufferLength = FIELD_OFFSET(NtPidlEntry, entryName) + sizeof(WCHAR);
- if (info->Name.Buffer)
- entryBufferLength += info->Name.Length;
-
- if (otype < 0)
- {
- entryBufferLength += FIELD_OFFSET(NtPidlTypeData, typeName) + sizeof(WCHAR);
-
- if (info->TypeName.Buffer)
- {
- entryBufferLength += info->TypeName.Length;
- }
- }
-
- // allocate space for the terminator
- entryBufferLength += 2;
-
- NtPidlEntry* entry = (NtPidlEntry*) CoTaskMemAlloc(entryBufferLength);
- if (!entry)
- return E_OUTOFMEMORY;
-
- memset(entry, 0, entryBufferLength);
-
- entry->cb = FIELD_OFFSET(NtPidlEntry, entryName);
- entry->magic = NT_OBJECT_PIDL_MAGIC;
- entry->objectType = otype;
-
- if (info->Name.Buffer)
- {
- entry->entryNameLength = info->Name.Length;
- StringCbCopyNW(entry->entryName, entryBufferLength, info->Name.Buffer,
info->Name.Length);
- entry->cb += entry->entryNameLength + sizeof(WCHAR);
- }
- else
- {
- entry->entryNameLength = 0;
- entry->entryName[0] = 0;
- entry->cb += sizeof(WCHAR);
- }
-
- if (otype < 0)
- {
- NtPidlTypeData * typedata = (NtPidlTypeData*) ((PBYTE) entry +
entry->cb);
- DWORD remainingSpace = entryBufferLength - ((PBYTE) (typedata->typeName) -
(PBYTE) entry);
-
- if (info->TypeName.Buffer)
- {
- typedata->typeNameLength = info->TypeName.Length;
- StringCbCopyNW(typedata->typeName, remainingSpace,
info->TypeName.Buffer, info->TypeName.Length);
-
- entry->cb += typedata->typeNameLength + sizeof(WCHAR);
- }
- else
- {
- typedata->typeNameLength = 0;
- typedata->typeName[0] = 0;
- entry->cb += typedata->typeNameLength + sizeof(WCHAR);
- }
- }
-
- *ppidl = (LPITEMIDLIST) entry;
-
- return S_OK;
- }
-
- virtual HRESULT STDMETHODCALLTYPE Next(ULONG celt, LPITEMIDLIST *rgelt, ULONG
*pceltFetched)
- {
- if (pceltFetched)
- *pceltFetched = 0;
-
- while (celt-- > 0)
- {
- HRESULT hr = EnumerateNext(rgelt);
- if (hr != S_OK)
- return hr;
-
- if (pceltFetched)
- (*pceltFetched)++;
- if (rgelt)
- rgelt++;
- }
-
- return S_OK;
- }
-
- virtual HRESULT STDMETHODCALLTYPE Skip(ULONG celt)
- {
- while (celt > 0)
- {
- HRESULT hr = EnumerateNext(NULL);
- if (FAILED(hr))
- return hr;
- if (hr != S_OK)
- break;
- }
-
- return S_OK;
- }
-
- virtual HRESULT STDMETHODCALLTYPE Reset()
- {
- return E_NOTIMPL;
- }
-
- virtual HRESULT STDMETHODCALLTYPE Clone(IEnumIDList **ppenum)
- {
- return E_NOTIMPL;
- }
-
- DECLARE_NOT_AGGREGATABLE(CEnumNTDirectory)
- DECLARE_PROTECT_FINAL_CONSTRUCT()
-
- BEGIN_COM_MAP(CEnumNTDirectory)
- COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList)
- END_COM_MAP()
-};
-
-HRESULT GetEnumRegistryRoot(IEnumIDList ** ppil)
-{
- return ShellObjectCreator<CEnumRegRoot>(IID_PPV_ARG(IEnumIDList, ppil));
-}
-
-HRESULT GetEnumRegistryKey(LPCWSTR path, HKEY root, IEnumIDList ** ppil)
-{
- return ShellObjectCreatorInit<CEnumRegKey>(path, root, IID_PPV_ARG(IEnumIDList,
ppil));
-}
-
-HRESULT GetEnumNTDirectory(LPCWSTR path, IEnumIDList ** ppil)
-{
- return ShellObjectCreatorInit<CEnumNTDirectory>(path, IID_PPV_ARG(IEnumIDList,
ppil));
-}
Removed: trunk/reactos/dll/shellext/ntobjshex/ntobjutil.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/ntobjshex/nto…
==============================================================================
--- trunk/reactos/dll/shellext/ntobjshex/ntobjutil.h [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/ntobjshex/ntobjutil.h (removed)
@@ -1,107 +0,0 @@
-/*
- * Copyright 2004 Martin Fuchs
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-extern "C" {
-#define NTOS_MODE_USER
-#include <ndk/ntndk.h>
-#include <ndk/rtlfuncs.h>
-}
-
-// All the possible values are defined here because I want the type field to be
-// "persistable" and not change if more types are added in the future.
-enum OBJECT_TYPE {
- DIRECTORY_OBJECT, SYMBOLICLINK_OBJECT,
- MUTANT_OBJECT, SECTION_OBJECT, EVENT_OBJECT, SEMAPHORE_OBJECT,
- TIMER_OBJECT, KEY_OBJECT, EVENTPAIR_OBJECT, IOCOMPLETITION_OBJECT,
- DEVICE_OBJECT, FILE_OBJECT, CONTROLLER_OBJECT, PROFILE_OBJECT,
- TYPE_OBJECT, DESKTOP_OBJECT, WINDOWSTATION_OBJECT, DRIVER_OBJECT,
- TOKEN_OBJECT, PROCESS_OBJECT, THREAD_OBJECT, ADAPTER_OBJECT, PORT_OBJECT,
-
- UNKNOWN_OBJECT_TYPE = -1
-};
-extern const LPCWSTR ObjectTypeNames[];
-
-#define NT_OBJECT_PIDL_MAGIC (USHORT)0x9A03
-#define REGISTRY_PIDL_MAGIC (USHORT)0x5364
-
-#include <pshpack1.h>
-
-// NT OBJECT browser
-struct NtPidlEntry
-{
- USHORT cb;
- USHORT magic; // 0x9A03 ~~~ "NTOB"
-
- // If this is -1, there will be a NtPidlTypeData following this, and before any other
extensions
- OBJECT_TYPE objectType;
-
- USHORT entryNameLength;
- WCHAR entryName[ANYSIZE_ARRAY];
-};
-
-struct NtPidlTypeData
-{
- USHORT typeNameLength;
- WCHAR typeName[ANYSIZE_ARRAY];
-};
-
-// REGISTRY browser
-enum REG_ENTRY_TYPE
-{
- REG_ENTRY_ROOT,
- REG_ENTRY_KEY,
- REG_ENTRY_VALUE,
- REG_ENTRY_VALUE_WITH_CONTENT
- // any more?
-};
-extern const LPCWSTR RegistryTypeNames [];
-
-struct RegPidlEntry
-{
- USHORT cb;
- USHORT magic; // 0x5364 ~~~ "REGK"
-
- REG_ENTRY_TYPE entryType;
-
- USHORT entryNameLength;
-
- union {
- struct {
- // For Value entries, this contains the value contents, if it's resonably
small.
- // For Key entries, this contains the custom class name
- DWORD contentType;
- USHORT contentsLength;
- };
-
- HKEY rootKey;
- };
-
- WCHAR entryName[ANYSIZE_ARRAY];
-
-};
-
-
-#include <poppack.h>
-
-HRESULT ReadRegistryValue(HKEY root, PCWSTR path, PCWSTR valueName, PVOID * valueData,
PDWORD valueLength);
-
-HRESULT GetEnumRegistryRoot(IEnumIDList ** ppil);
-HRESULT GetEnumRegistryKey(LPCWSTR path, HKEY root, IEnumIDList ** ppil);
-HRESULT GetEnumNTDirectory(LPCWSTR path, IEnumIDList ** ppil);
-
-HRESULT GetNTObjectSymbolicLinkTarget(LPCWSTR path, LPCWSTR entryName, PUNICODE_STRING
LinkTarget);
Modified: trunk/reactos/dll/shellext/ntobjshex/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/ntobjshex/pre…
==============================================================================
--- trunk/reactos/dll/shellext/ntobjshex/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/ntobjshex/precomp.h [iso-8859-1] Fri Aug 21 15:01:04 2015
@@ -46,5 +46,5 @@
DEFINE_GUID(CLSID_NtObjectFolder,
0x845b0fb2, 0x66e0, 0x416b, 0x8f, 0x91, 0x31, 0x4e, 0x23, 0xf7, 0xc1, 0x2d);
-#include "ntobjns.h"
+#include "ntobjfolder.h"
#include "regfolder.h"
Modified: trunk/reactos/dll/shellext/ntobjshex/regfolder.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/ntobjshex/reg…
==============================================================================
--- trunk/reactos/dll/shellext/ntobjshex/regfolder.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/ntobjshex/regfolder.cpp [iso-8859-1] Fri Aug 21 15:01:04
2015
@@ -7,7 +7,7 @@
*/
#include "precomp.h"
-#include "ntobjutil.h"
+#include "ntobjenum.h"
#include <ntquery.h>
#include "util.h"