[NTOBJSHEX]

* Introduce a shell extension that allows the user to browse the NT Object namespace from within the shell.
CORE-9243 #resolve

svn path=/trunk/; revision=66396
This commit is contained in:
David Quintana 2015-02-21 21:21:02 +00:00
parent 988950d2f3
commit ea2b914576
21 changed files with 2023 additions and 1 deletions

View file

@ -4,5 +4,6 @@ add_subdirectory(deskmon)
add_subdirectory(devcpux)
add_subdirectory(fontext)
add_subdirectory(netshell)
add_subdirectory(ntobjshex)
add_subdirectory(slayer)
add_subdirectory(stobject)

View file

@ -24,6 +24,9 @@ list(APPEND SOURCE
lanstatusui.cpp
precomp.h)
list(APPEND atl_rc_deps
${CMAKE_CURRENT_SOURCE_DIR}/resources/rgs/ntobjectfolder.rgs)
add_library(netshell SHARED
${SOURCE}
netshell.rc

View file

@ -0,0 +1,41 @@
project(SHELL)
set_cpp(WITH_RUNTIME)
if(NOT MSVC)
# HACK: this should be enabled globally!
add_compile_flags_language("-std=c++11" "CXX")
endif()
include_directories(
${REACTOS_SOURCE_DIR}/lib/atl
${REACTOS_SOURCE_DIR})
spec2def(ntobjshex.dll ntobjshex.spec)
add_library(ntobjshex SHARED
ntobjns.cpp
ntobjshex.cpp
ntobjutil.cpp
ntobjshex.rc
${CMAKE_CURRENT_BINARY_DIR}/ntobjshex.def)
set_module_type(ntobjshex win32dll UNICODE)
target_link_libraries(ntobjshex uuid wine atlnew)
add_importlibs(ntobjshex
advapi32
winmm
ole32
oleaut32
shlwapi
shell32
comctl32
msvcrt
gdi32
user32
kernel32
ntdll)
add_cd_file(TARGET ntobjshex DESTINATION reactos/system32 FOR all)

View file

@ -0,0 +1,6 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
STRINGTABLE
BEGIN
IDS_NAME "NT Object Namespace"
END

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,149 @@
/*
* PROJECT: ReactOS system libraries
* LICENSE: GPL - See COPYING in the top level directory
* FILE: dll\win32\stobject\stobject.cpp
* PURPOSE: Systray shell service object
* PROGRAMMERS: Robert Naumann
David Quintana <gigaherz@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
{
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,
LPCITEMIDLIST *apidl,
SFGAOF *rgfInOut);
virtual HRESULT STDMETHODCALLTYPE GetUIObjectOf(
HWND hwndOwner,
UINT cidl,
LPCITEMIDLIST *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);
// Internal
HRESULT STDMETHODCALLTYPE Initialize(LPCITEMIDLIST pidl, PWSTR ntPath);
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)
END_COM_MAP()
};

View file

@ -0,0 +1,74 @@
/*
* PROJECT: ReactOS system libraries
* LICENSE: GPL - See COPYING in the top level directory
* FILE: dll\win32\stobject\stobject.cpp
* PURPOSE: COM registration services for STobject.dll
* PROGRAMMERS: Robert Naumann
David Quintana <gigaherz@gmail.com>
*/
#include "precomp.h"
#include <atlwin.h>
WINE_DEFAULT_DEBUG_CHANNEL(ntobjshex);
BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_NtObjectFolder, CNtObjectFolder)
END_OBJECT_MAP()
HINSTANCE g_hInstance;
CComModule g_Module;
void *operator new (size_t, void *buf)
{
return buf;
}
STDAPI_(BOOL)
DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
{
if (fdwReason == DLL_PROCESS_ATTACH)
{
g_hInstance = hinstDLL;
DisableThreadLibraryCalls(g_hInstance);
/* HACK - the global constructors don't run, so I placement new them here */
new (&g_Module) CComModule;
new (&_AtlWinModule) CAtlWinModule;
new (&_AtlBaseModule) CAtlBaseModule;
new (&_AtlComModule) CAtlComModule;
g_Module.Init(ObjectMap, g_hInstance, NULL);
}
else if (fdwReason == DLL_PROCESS_DETACH)
{
g_hInstance = NULL;
g_Module.Term();
}
return TRUE;
}
STDAPI
DllRegisterServer(void)
{
return g_Module.DllRegisterServer(FALSE);
}
STDAPI
DllUnregisterServer(void)
{
return g_Module.DllUnregisterServer(FALSE);
}
STDAPI
DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
return g_Module.DllGetClassObject(rclsid, riid, ppv);
}
STDAPI
DllCanUnloadNow(void)
{
return g_Module.DllCanUnloadNow();
}

View file

@ -0,0 +1,23 @@
#include <windef.h>
#include <winuser.h>
#include <commctrl.h>
#include "resource.h"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDI_NTOBJECTFOLDER ICON "resources/1.ico"
IDI_NTOBJECTDIR ICON "resources/2.ico"
IDI_NTOBJECTDIROPEN ICON "resources/3.ico"
IDI_NTOBJECTITEM ICON "resources/4.ico"
IDI_NTOBJECTDEVICE ICON "resources/5.ico"
IDI_NTOBJECTPORT ICON "resources/6.ico"
IDR_NTOBJECTFOLDER REGISTRY "resources/rgs/ntobjectfolder.rgs"
/* UTF-8 */
#pragma code_page(65001)
#ifdef LANGUAGE_EN_US
#include "lang/en-US.rc"
#endif

View file

@ -0,0 +1,4 @@
@ stdcall -private DllCanUnloadNow()
@ stdcall -private DllGetClassObject(ptr ptr ptr)
@ stdcall -private DllRegisterServer()
@ stdcall -private DllUnregisterServer()

View file

@ -0,0 +1,244 @@
/*
* 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);
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
};
static DWORD NtOpenObject(OBJECT_TYPE type, HANDLE* 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 EnumerateNtDirectory(HDPA hdpa, PCWSTR path, UINT * hdpaCount)
{
WCHAR buffer[MAX_PATH];
PWSTR pend;
*hdpaCount = 0;
StringCbCopyExW(buffer, sizeof(buffer), path, &pend, NULL, 0);
ULONG enumContext = 0;
HANDLE directory = NULL;
DWORD err = NtOpenObject(DIRECTORY_OBJECT, &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 (pend[-1] != '\\')
*pend++ = '\\';
BYTE dirbuffer[2048];
BOOL first = TRUE;
while (NtQueryDirectoryObject(directory, dirbuffer, 2048, TRUE, first, &enumContext, NULL) == STATUS_SUCCESS)
{
first = FALSE;
POBJECT_DIRECTORY_INFORMATION info = (POBJECT_DIRECTORY_INFORMATION) dirbuffer;
//for (; info->Name.Buffer != NULL; info++)
{
if (info->Name.Buffer)
{
StringCbCopyNW(pend, sizeof(buffer), info->Name.Buffer, info->Name.Length);
}
OBJECT_TYPE otype = MapTypeNameToType(info->TypeName.Buffer, info->TypeName.Length);
OBJECT_BASIC_INFORMATION object = { 0 };
WCHAR wbLink[_MAX_PATH] = { 0 };
UNICODE_STRING link;
RtlInitEmptyUnicodeString(&link, wbLink, sizeof(wbLink));
DWORD entryBufferLength = sizeof(NtPidlEntry) + sizeof(WCHAR);
if (info->Name.Buffer)
entryBufferLength += info->Name.Length;
if (otype < 0)
{
entryBufferLength += sizeof(NtPidlTypeData) + sizeof(WCHAR);
if (info->TypeName.Buffer)
{
entryBufferLength += info->TypeName.Length;
}
}
if (otype == SYMBOLICLINK_OBJECT)
{
entryBufferLength += sizeof(NtPidlSymlinkData) + sizeof(WCHAR);
}
DWORD access = STANDARD_RIGHTS_READ;
if ((otype == DIRECTORY_OBJECT) ||
(otype == SYMBOLICLINK_OBJECT))
access |= FILE_LIST_DIRECTORY;
HANDLE handle;
if (!NtOpenObject(otype, &handle, access, buffer))
{
DWORD read;
if (!NT_SUCCESS(NtQueryObject(handle, ObjectBasicInformation, &object, sizeof(OBJECT_BASIC_INFORMATION), &read)))
{
ZeroMemory(&object, sizeof(OBJECT_BASIC_INFORMATION));
}
if (otype == SYMBOLICLINK_OBJECT)
{
if (NtQuerySymbolicLinkObject(handle, &link, NULL) == STATUS_SUCCESS)
{
entryBufferLength += link.Length;
}
else
{
link.Length = 0;
}
}
NtClose(handle);
}
NtPidlEntry* entry = (NtPidlEntry*) CoTaskMemAlloc(entryBufferLength);
if (!entry)
return E_OUTOFMEMORY;
memset(entry, 0, entryBufferLength);
entry->cb = sizeof(NtPidlEntry);
entry->magic = NT_OBJECT_PIDL_MAGIC;
entry->objectType = otype;
entry->objectInformation = object;
memset(entry->objectInformation.Reserved, 0, sizeof(entry->objectInformation.Reserved));
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);
}
}
if (otype == SYMBOLICLINK_OBJECT)
{
NtPidlSymlinkData * symlink = (NtPidlSymlinkData*) ((PBYTE) entry + entry->cb);
DWORD remainingSpace = entryBufferLength - ((PBYTE) (symlink->targetName) - (PBYTE) entry);
symlink->targetNameLength = link.Length;
StringCbCopyNW(symlink->targetName, remainingSpace, link.Buffer, link.Length);
entry->cb += symlink->targetNameLength + sizeof(WCHAR);
}
DPA_AppendPtr(hdpa, entry);
(*hdpaCount)++;
}
}
NtClose(directory);
return S_OK;
}

View file

@ -0,0 +1,70 @@
/*
* 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
#include <pshpack1.h>
struct NtPidlEntry
{
SHORT cb;
USHORT magic; // 0x9A03 ~~~ "NTOB"
// If this is -1, there will be a NtPidlTypeData following this, and before any other extensions
OBJECT_TYPE objectType;
OBJECT_BASIC_INFORMATION objectInformation;
USHORT entryNameLength;
WCHAR entryName[0];
};
struct NtPidlTypeData
{
USHORT typeNameLength;
WCHAR typeName[0];
};
struct NtPidlSymlinkData
{
USHORT targetNameLength;
WCHAR targetName[0];
};
#include <poppack.h>
HRESULT EnumerateNtDirectory(HDPA hdpa, PCWSTR path, UINT * hdpaCount);

View file

@ -0,0 +1,49 @@
#pragma once
#define WIN32_NO_STATUS
#include <stdarg.h>
#include <tchar.h>
#define COBJMACROS
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
#define NTOS_MODE_USER
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <winuser.h>
#include <wincon.h>
#include <ddeml.h>
#include <shlguid_undoc.h>
#include <shlwapi.h>
#include <shlobj.h>
#include <shlobj_undoc.h>
#include <shlwapi_undoc.h>
#include <tchar.h>
#include <strsafe.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
#include <undocshell.h>
#include <shellutils.h>
#include <shellapi.h>
#include <wine/debug.h>
#include <wine/unicode.h>
#include "resource.h"
#undef DbgPrint
extern HINSTANCE g_hInstance;
#define ID_ICON_VOLUME (WM_APP + 0x4CB)
// {845B0FB2-66E0-416B-8F91-314E23F7C12D}
DEFINE_GUID(CLSID_NtObjectFolder,
0x845b0fb2, 0x66e0, 0x416b, 0x8f, 0x91, 0x31, 0x4e, 0x23, 0xf7, 0xc1, 0x2d);
#include "ntobjns.h"

View file

@ -0,0 +1,12 @@
#pragma once
#define IDI_NTOBJECTFOLDER 1
#define IDI_NTOBJECTDIR 2
#define IDI_NTOBJECTDIROPEN 3
#define IDI_NTOBJECTITEM 4
#define IDI_NTOBJECTDEVICE 5
#define IDI_NTOBJECTPORT 6
#define IDS_NAME 101
#define IDR_NTOBJECTFOLDER 1001

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -0,0 +1,47 @@
HKCR
{
NoRemove CLSID
{
ForceRemove {845B0FB2-66E0-416B-8F91-314E23F7C12D} = s 'NT Object Namespace Extension'
{
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Both'
}
val InfoTip = s 'Allows browsing of the NT Object Namespace'
DefaultIcon = s '%MODULE%,0'
ShellFolder
{
val Attributes = d '0xA8000000'
val BrowserFlags = d '0x22'
}
}
}
}
HKLM
{
NoRemove Software
{
NoRemove Microsoft
{
NoRemove Windows
{
NoRemove CurrentVersion
{
NoRemove Explorer
{
NoRemove MyComputer
{
NoRemove NameSpace
{
ForceRemove {845B0FB2-66E0-416B-8F91-314E23F7C12D} = s 'NT Object Namespace Extension'
{
}
}
}
}
}
}
}
}
}

View file

@ -32,7 +32,7 @@ extern "C" {
#endif
#if 1
#define FAILED_UNEXPECTEDLY(hr) (FAILED(hr) && (DbgPrint("Unexpected failure %08x.\n", hr), TRUE))
#define FAILED_UNEXPECTEDLY(hr) (FAILED(hr) && (Win32DbgPrint(__FILE__, __LINE__, "Unexpected failure %08x.\n", hr), TRUE))
#else
#define FAILED_UNEXPECTEDLY(hr) FAILED(hr)
#endif
@ -263,6 +263,52 @@ HRESULT inline ShellObjectCreatorInit(T1 initArg1, REFIID riid, void ** ppv)
return S_OK;
}
template<class T, class T1, class T2>
HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, REFIID riid, void ** ppv)
{
CComPtr<T> obj;
HRESULT hResult;
if (ppv == NULL)
return E_POINTER;
*ppv = NULL;
ATLTRY(obj = new _CComObject<T>);
if (obj.p == NULL)
return E_OUTOFMEMORY;
hResult = obj->QueryInterface(riid, ppv);
if (FAILED(hResult))
return hResult;
hResult = obj->Initialize(initArg1, initArg2);
if (FAILED(hResult))
return hResult;
return S_OK;
}
template<class T, class T1, class T2, class T3>
HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, T3 initArg3, REFIID riid, void ** ppv)
{
CComPtr<T> obj;
HRESULT hResult;
if (ppv == NULL)
return E_POINTER;
*ppv = NULL;
ATLTRY(obj = new _CComObject<T>);
if (obj.p == NULL)
return E_OUTOFMEMORY;
hResult = obj->QueryInterface(riid, ppv);
if (FAILED(hResult))
return hResult;
hResult = obj->Initialize(initArg1, initArg2, initArg3);
if (FAILED(hResult))
return hResult;
return S_OK;
}
template<class T, class T1, class R>
HRESULT inline ShellObjectCreatorInit(T1 initArg1, REFIID riid, R ** ppv)
{