1 /* 2 * PROJECT: NT Object Namespace shell extension 3 * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later) 4 * PURPOSE: NT Object Namespace enumeration header 5 * COPYRIGHT: Copyright 2004 Martin Fuchs <martin-fuchs@gmx.net> 6 */ 7 8 #pragma once 9 10 11 // All the possible values are defined here because I want the type field to be 12 // "persistable" and not change if more types are added in the future. 13 enum OBJECT_TYPE { 14 DIRECTORY_OBJECT, SYMBOLICLINK_OBJECT, 15 MUTANT_OBJECT, SECTION_OBJECT, EVENT_OBJECT, SEMAPHORE_OBJECT, 16 TIMER_OBJECT, KEY_OBJECT, EVENTPAIR_OBJECT, IOCOMPLETION_OBJECT, 17 DEVICE_OBJECT, FILE_OBJECT, CONTROLLER_OBJECT, PROFILE_OBJECT, 18 TYPE_OBJECT, DESKTOP_OBJECT, WINDOWSTATION_OBJECT, DRIVER_OBJECT, 19 TOKEN_OBJECT, PROCESS_OBJECT, THREAD_OBJECT, ADAPTER_OBJECT, PORT_OBJECT, 20 21 UNKNOWN_OBJECT_TYPE = -1 22 }; 23 extern const LPCWSTR ObjectTypeNames[]; 24 25 #define NT_OBJECT_PIDL_MAGIC (USHORT)0x9A03 26 #define REGISTRY_PIDL_MAGIC (USHORT)0x5364 27 28 #include <pshpack1.h> 29 30 // NT OBJECT browser 31 struct NtPidlEntry 32 { 33 USHORT cb; 34 USHORT magic; // 0x9A03 ~~~ "NTOB" 35 36 // If this is -1, there will be a NtPidlTypeData following this, and before any other extensions 37 OBJECT_TYPE objectType; 38 39 USHORT entryNameLength; 40 WCHAR entryName[ANYSIZE_ARRAY]; 41 }; 42 43 struct NtPidlTypeData 44 { 45 USHORT typeNameLength; 46 WCHAR typeName[ANYSIZE_ARRAY]; 47 }; 48 49 // REGISTRY browser 50 enum REG_ENTRY_TYPE 51 { 52 REG_ENTRY_ROOT, 53 REG_ENTRY_KEY, 54 REG_ENTRY_VALUE, 55 REG_ENTRY_VALUE_WITH_CONTENT 56 // any more? 57 }; 58 extern const LPCWSTR RegistryTypeNames []; 59 60 struct RegPidlEntry 61 { 62 USHORT cb; 63 USHORT magic; // 0x5364 ~~~ "REGK" 64 65 REG_ENTRY_TYPE entryType; 66 67 USHORT entryNameLength; 68 69 union { 70 struct { 71 // For Value entries, this contains the value contents, if it's reasonably small. 72 // For Key entries, this contains the custom class name 73 DWORD contentType; 74 USHORT contentsLength; 75 }; 76 77 HKEY rootKey; 78 }; 79 80 WCHAR entryName[ANYSIZE_ARRAY]; 81 82 }; 83 84 85 #include <poppack.h> 86 87 HRESULT ReadRegistryValue(HKEY root, PCWSTR path, PCWSTR valueName, PVOID * valueData, PDWORD valueLength); 88 89 HRESULT GetEnumRegistryRoot(IEnumIDList ** ppil); 90 HRESULT GetEnumRegistryKey(LPCWSTR path, HKEY root, IEnumIDList ** ppil); 91 HRESULT GetEnumNTDirectory(LPCWSTR path, IEnumIDList ** ppil); 92 93 HRESULT GetNTObjectSymbolicLinkTarget(LPCWSTR path, LPCWSTR entryName, PUNICODE_STRING LinkTarget); 94