ReactOS  0.4.14-dev-49-gfb4591c
ntobjenum.h File Reference
#include <pshpack1.h>
#include <poppack.h>
Include dependency graph for ntobjenum.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  NtPidlEntry
 
struct  NtPidlTypeData
 
struct  RegPidlEntry
 

Macros

#define NT_OBJECT_PIDL_MAGIC   (USHORT)0x9A03
 
#define REGISTRY_PIDL_MAGIC   (USHORT)0x5364
 

Enumerations

enum  OBJECT_TYPE {
  DIRECTORY_OBJECT, SYMBOLICLINK_OBJECT, MUTANT_OBJECT, SECTION_OBJECT,
  EVENT_OBJECT, SEMAPHORE_OBJECT, TIMER_OBJECT, KEY_OBJECT,
  EVENTPAIR_OBJECT, IOCOMPLETION_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,
  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
}
 
enum  REG_ENTRY_TYPE { REG_ENTRY_ROOT, REG_ENTRY_KEY, REG_ENTRY_VALUE, REG_ENTRY_VALUE_WITH_CONTENT }
 

Functions

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)
 

Variables

const LPCWSTR ObjectTypeNames []
 
const LPCWSTR RegistryTypeNames []
 

Macro Definition Documentation

◆ NT_OBJECT_PIDL_MAGIC

#define NT_OBJECT_PIDL_MAGIC   (USHORT)0x9A03

Definition at line 35 of file ntobjenum.h.

◆ REGISTRY_PIDL_MAGIC

#define REGISTRY_PIDL_MAGIC   (USHORT)0x5364

Definition at line 36 of file ntobjenum.h.

Enumeration Type Documentation

◆ OBJECT_TYPE

Enumerator
DIRECTORY_OBJECT 
SYMBOLICLINK_OBJECT 
MUTANT_OBJECT 
SECTION_OBJECT 
EVENT_OBJECT 
SEMAPHORE_OBJECT 
TIMER_OBJECT 
KEY_OBJECT 
EVENTPAIR_OBJECT 
IOCOMPLETION_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 
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 

Definition at line 23 of file ntobjenum.h.

◆ REG_ENTRY_TYPE

Enumerator
REG_ENTRY_ROOT 
REG_ENTRY_KEY 
REG_ENTRY_VALUE 
REG_ENTRY_VALUE_WITH_CONTENT 

Definition at line 60 of file ntobjenum.h.

Function Documentation

◆ GetEnumNTDirectory()

HRESULT GetEnumNTDirectory ( LPCWSTR  path,
IEnumIDList **  ppil 
)

Definition at line 748 of file ntobjenum.cpp.

749 {
750  return ShellObjectCreatorInit<CEnumNTDirectory>(path, IID_PPV_ARG(IEnumIDList, ppil));
751 }
#define IID_PPV_ARG(Itype, ppType)
Definition: services.c:325

Referenced by CNtObjectFolder::EnumObjects().

◆ GetEnumRegistryKey()

HRESULT GetEnumRegistryKey ( LPCWSTR  path,
HKEY  root,
IEnumIDList **  ppil 
)

Definition at line 743 of file ntobjenum.cpp.

744 {
745  return ShellObjectCreatorInit<CEnumRegKey>(path, root, IID_PPV_ARG(IEnumIDList, ppil));
746 }
#define IID_PPV_ARG(Itype, ppType)
Definition: services.c:325

Referenced by CRegistryFolder::EnumObjects().

◆ GetEnumRegistryRoot()

HRESULT GetEnumRegistryRoot ( IEnumIDList **  ppil)

Definition at line 738 of file ntobjenum.cpp.

739 {
740  return ShellObjectCreator<CEnumRegRoot>(IID_PPV_ARG(IEnumIDList, ppil));
741 }
#define IID_PPV_ARG(Itype, ppType)

Referenced by CRegistryFolder::EnumObjects().

◆ GetNTObjectSymbolicLinkTarget()

HRESULT GetNTObjectSymbolicLinkTarget ( LPCWSTR  path,
LPCWSTR  entryName,
PUNICODE_STRING  LinkTarget 
)

Definition at line 162 of file ntobjenum.cpp.

163 {
164  HANDLE handle;
166  LPWSTR pend = buffer;
167 
168  StringCbCopyExW(buffer, sizeof(buffer), path, &pend, NULL, 0);
169 
170  if (pend[-1] != '\\')
171  {
172  *pend++ = '\\';
173  *pend = 0;
174  }
175 
176  StringCbCatW(buffer, sizeof(buffer), entryName);
177 
178  DbgPrint("GetNTObjectSymbolicLinkTarget %d\n", buffer);
179 
180  LinkTarget->Length = 0;
181 
183  if (!NT_SUCCESS(err))
184  return HRESULT_FROM_NT(err);
185 
187  if (!NT_SUCCESS(err))
188  return HRESULT_FROM_NT(err);
189 
190  NtClose(handle);
191 
192  return S_OK;
193 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define DbgPrint
Definition: loader.c:25
GLuint buffer
Definition: glext.h:5915
STRSAFEAPI StringCbCatW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:342
STRSAFEAPI StringCbCopyExW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags)
Definition: strsafe.h:210
_Inout_ PUNICODE_STRING LinkTarget
Definition: zwfuncs.h:292
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define HRESULT_FROM_NT(x)
Definition: winerror.h:94
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define err(...)
#define S_OK
Definition: intsafe.h:59
Definition: services.c:325
#define SYMBOLIC_LINK_QUERY
Definition: nt_native.h:1265
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static DWORD NtOpenObject(OBJECT_TYPE type, PHANDLE phandle, DWORD access, LPCWSTR path)
Definition: ntobjenum.cpp:61

Referenced by CNtObjectFolder::GetDetailsEx(), CNtObjectFolder::GetDetailsOf(), and CNtObjectFolder::ResolveSymLink().

◆ ReadRegistryValue()

HRESULT ReadRegistryValue ( HKEY  root,
PCWSTR  path,
PCWSTR  valueName,
PVOID valueData,
PDWORD  valueLength 
)

Definition at line 109 of file ntobjenum.cpp.

110 {
111  HKEY hkey;
112 
113  DWORD res;
114  if (root)
115  {
116  res = RegOpenKeyExW(root, *path == '\\' ? path + 1 : path, 0, STANDARD_RIGHTS_READ | KEY_QUERY_VALUE, &hkey);
117  }
118  else
119  {
121  }
122  if (!NT_SUCCESS(res))
123  {
124  ERR("RegOpenKeyExW failed for path %S with status=%x\n", path, res);
125  return HRESULT_FROM_NT(res);
126  }
127 
128  res = RegQueryValueExW(hkey, valueName, NULL, NULL, NULL, valueLength);
129  if (!NT_SUCCESS(res))
130  {
131  ERR("RegQueryValueExW failed for path %S with status=%x\n", path, res);
132  return HRESULT_FROM_NT(res);
133  }
134 
135  if (*valueLength > 0)
136  {
137  PBYTE data = (PBYTE) CoTaskMemAlloc(*valueLength);
138  *valueData = data;
139 
140  res = RegQueryValueExW(hkey, valueName, NULL, NULL, data, valueLength);
141  if (!NT_SUCCESS(res))
142  {
144  *valueData = NULL;
145 
146  RegCloseKey(hkey);
147 
148  ERR("RegOpenKeyExW failed for path %S with status=%x\n", path, res);
149  return HRESULT_FROM_NT(res);
150  }
151  }
152  else
153  {
154  *valueData = NULL;
155  }
156 
157  RegCloseKey(hkey);
158 
159  return S_OK;
160 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
smooth NULL
Definition: ftsmooth.c:416
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define HRESULT_FROM_NT(x)
Definition: winerror.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:414
#define STANDARD_RIGHTS_READ
Definition: nt_native.h:65
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
Definition: services.c:325
GLuint res
Definition: glext.h:9613
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
static DWORD NtOpenObject(OBJECT_TYPE type, PHANDLE phandle, DWORD access, LPCWSTR path)
Definition: ntobjenum.cpp:61
BYTE * PBYTE
Definition: pedump.c:66
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406

Variable Documentation

◆ ObjectTypeNames

const LPCWSTR ObjectTypeNames[]

◆ RegistryTypeNames

const LPCWSTR RegistryTypeNames[]

Definition at line 46 of file ntobjenum.cpp.

Referenced by CRegistryFolder::GetDetailsEx(), and CRegistryFolder::GetDetailsOf().