1 /* 2 * Copyright 2004 Martin Fuchs 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 */ 18 #pragma once 19 20 21 // All the possible values are defined here because I want the type field to be 22 // "persistable" and not change if more types are added in the future. 23 enum OBJECT_TYPE { 24 DIRECTORY_OBJECT, SYMBOLICLINK_OBJECT, 25 MUTANT_OBJECT, SECTION_OBJECT, EVENT_OBJECT, SEMAPHORE_OBJECT, 26 TIMER_OBJECT, KEY_OBJECT, EVENTPAIR_OBJECT, IOCOMPLETION_OBJECT, 27 DEVICE_OBJECT, FILE_OBJECT, CONTROLLER_OBJECT, PROFILE_OBJECT, 28 TYPE_OBJECT, DESKTOP_OBJECT, WINDOWSTATION_OBJECT, DRIVER_OBJECT, 29 TOKEN_OBJECT, PROCESS_OBJECT, THREAD_OBJECT, ADAPTER_OBJECT, PORT_OBJECT, 30 31 UNKNOWN_OBJECT_TYPE = -1 32 }; 33 extern const LPCWSTR ObjectTypeNames[]; 34 35 #define NT_OBJECT_PIDL_MAGIC (USHORT)0x9A03 36 #define REGISTRY_PIDL_MAGIC (USHORT)0x5364 37 38 #include <pshpack1.h> 39 40 // NT OBJECT browser 41 struct NtPidlEntry 42 { 43 USHORT cb; 44 USHORT magic; // 0x9A03 ~~~ "NTOB" 45 46 // If this is -1, there will be a NtPidlTypeData following this, and before any other extensions 47 OBJECT_TYPE objectType; 48 49 USHORT entryNameLength; 50 WCHAR entryName[ANYSIZE_ARRAY]; 51 }; 52 53 struct NtPidlTypeData 54 { 55 USHORT typeNameLength; 56 WCHAR typeName[ANYSIZE_ARRAY]; 57 }; 58 59 // REGISTRY browser 60 enum REG_ENTRY_TYPE 61 { 62 REG_ENTRY_ROOT, 63 REG_ENTRY_KEY, 64 REG_ENTRY_VALUE, 65 REG_ENTRY_VALUE_WITH_CONTENT 66 // any more? 67 }; 68 extern const LPCWSTR RegistryTypeNames []; 69 70 struct RegPidlEntry 71 { 72 USHORT cb; 73 USHORT magic; // 0x5364 ~~~ "REGK" 74 75 REG_ENTRY_TYPE entryType; 76 77 USHORT entryNameLength; 78 79 union { 80 struct { 81 // For Value entries, this contains the value contents, if it's reasonably small. 82 // For Key entries, this contains the custom class name 83 DWORD contentType; 84 USHORT contentsLength; 85 }; 86 87 HKEY rootKey; 88 }; 89 90 WCHAR entryName[ANYSIZE_ARRAY]; 91 92 }; 93 94 95 #include <poppack.h> 96 97 HRESULT ReadRegistryValue(HKEY root, PCWSTR path, PCWSTR valueName, PVOID * valueData, PDWORD valueLength); 98 99 HRESULT GetEnumRegistryRoot(IEnumIDList ** ppil); 100 HRESULT GetEnumRegistryKey(LPCWSTR path, HKEY root, IEnumIDList ** ppil); 101 HRESULT GetEnumNTDirectory(LPCWSTR path, IEnumIDList ** ppil); 102 103 HRESULT GetNTObjectSymbolicLinkTarget(LPCWSTR path, LPCWSTR entryName, PUNICODE_STRING LinkTarget);