ReactOS 0.4.15-dev-8109-gd7be748
ntobjenum.cpp
Go to the documentation of this file.
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 functions
5 * COPYRIGHT: Copyright 2004-2005 Martin Fuchs <martin-fuchs@gmx.net>
6 */
7
8#include "precomp.h"
9#include <strsafe.h>
10
11static struct RootKeyEntry {
14} RootKeys [] = {
15 { HKEY_CLASSES_ROOT, L"HKEY_CLASSES_ROOT" },
16 { HKEY_CURRENT_USER, L"HKEY_CURRENT_USER" },
17 { HKEY_LOCAL_MACHINE, L"HKEY_LOCAL_MACHINE" },
18 { HKEY_USERS, L"HKEY_USERS" },
19 { HKEY_CURRENT_CONFIG, L"HKEY_CURRENT_CONFIG" }
20};
21
24
26 L"Directory", L"SymbolicLink",
27 L"Mutant", L"Section", L"Event", L"Semaphore",
28 L"Timer", L"Key", L"EventPair", L"IoCompletion",
29 L"Device", L"File", L"Controller", L"Profile",
30 L"Type", L"Desktop", L"WindowStation", L"Driver",
31 L"Token", L"Process", L"Thread", L"Adapter", L"Port",
32 0
33};
34
36 L"REG_NONE",
37 L"REG_SZ",
38 L"REG_EXPAND_SZ",
39 L"REG_BINARY",
40 L"REG_DWORD",
41 L"REG_DWORD_BIG_ENDIAN",
42 L"REG_LINK",
43 L"REG_MULTI_SZ",
44 L"REG_RESOURCE_LIST",
45 L"REG_FULL_RESOURCE_DESCRIPTOR",
46 L"REG_RESOURCE_REQUIREMENTS_LIST",
47 L"REG_QWORD"
48};
49
51{
52 UNICODE_STRING ustr;
53
55
56 OBJECT_ATTRIBUTES open_struct = { sizeof(OBJECT_ATTRIBUTES), 0x00, &ustr, 0x40 };
57
58 if (type != FILE_OBJECT)
60
61 IO_STATUS_BLOCK ioStatusBlock;
62
63 switch (type)
64 {
65 case DIRECTORY_OBJECT: return NtOpenDirectoryObject(phandle, access, &open_struct);
66 case SYMBOLICLINK_OBJECT: return NtOpenSymbolicLinkObject(phandle, access, &open_struct);
67 case MUTANT_OBJECT: return NtOpenMutant(phandle, access, &open_struct);
68 case SECTION_OBJECT: return NtOpenSection(phandle, access, &open_struct);
69 case EVENT_OBJECT: return NtOpenEvent(phandle, access, &open_struct);
70 case SEMAPHORE_OBJECT: return NtOpenSemaphore(phandle, access, &open_struct);
71 case TIMER_OBJECT: return NtOpenTimer(phandle, access, &open_struct);
72 case KEY_OBJECT: return NtOpenKey(phandle, access, &open_struct);
73 case EVENTPAIR_OBJECT: return NtOpenEventPair(phandle, access, &open_struct);
74 case IOCOMPLETION_OBJECT: return NtOpenIoCompletion(phandle, access, &open_struct);
75 case FILE_OBJECT: return NtOpenFile(phandle, access, &open_struct, &ioStatusBlock, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 0);
76 default:
78 }
79}
80
82{
83 if (!TypeName)
85
86 for (UINT i = 0; i < _countof(ObjectTypeNames); i++)
87 {
88 LPCWSTR typeName = ObjectTypeNames[i];
89 if (!StrCmpNW(typeName, TypeName, cbTypeName / sizeof(WCHAR)))
90 {
91 return (OBJECT_TYPE) i;
92 }
93 }
94
96}
97
98HRESULT ReadRegistryValue(HKEY root, PCWSTR path, PCWSTR valueName, PVOID * valueData, PDWORD valueLength)
99{
100 HKEY hkey;
101
102 DWORD res;
103 if (root)
104 {
105 res = RegOpenKeyExW(root, *path == '\\' ? path + 1 : path, 0, STANDARD_RIGHTS_READ | KEY_QUERY_VALUE, &hkey);
106 }
107 else
108 {
110 }
111 if (!NT_SUCCESS(res))
112 {
113 ERR("RegOpenKeyExW failed for path %S with status=%x\n", path, res);
114 return HRESULT_FROM_NT(res);
115 }
116
117 res = RegQueryValueExW(hkey, valueName, NULL, NULL, NULL, valueLength);
118 if (!NT_SUCCESS(res))
119 {
120 ERR("RegQueryValueExW failed for path %S with status=%x\n", path, res);
121 return HRESULT_FROM_NT(res);
122 }
123
124 if (*valueLength > 0)
125 {
126 PBYTE data = (PBYTE) CoTaskMemAlloc(*valueLength);
127 *valueData = data;
128
129 res = RegQueryValueExW(hkey, valueName, NULL, NULL, data, valueLength);
130 if (!NT_SUCCESS(res))
131 {
133 *valueData = NULL;
134
135 RegCloseKey(hkey);
136
137 ERR("RegOpenKeyExW failed for path %S with status=%x\n", path, res);
138 return HRESULT_FROM_NT(res);
139 }
140 }
141 else
142 {
143 *valueData = NULL;
144 }
145
146 RegCloseKey(hkey);
147
148 return S_OK;
149}
150
152{
155 LPWSTR pend = buffer;
156
157 StringCbCopyExW(buffer, sizeof(buffer), path, &pend, NULL, 0);
158
159 if (pend[-1] != '\\')
160 {
161 *pend++ = '\\';
162 *pend = 0;
163 }
164
165 StringCbCatW(buffer, sizeof(buffer), entryName);
166
167 DbgPrint("GetNTObjectSymbolicLinkTarget %d\n", buffer);
168
169 LinkTarget->Length = 0;
170
172 if (!NT_SUCCESS(err))
173 return HRESULT_FROM_NT(err);
174
176 if (!NT_SUCCESS(err))
177 return HRESULT_FROM_NT(err);
178
180
181 return S_OK;
182}
183
185 public CComObjectRootEx<CComMultiThreadModelNoCS>,
186 public IEnumIDList
187{
189
190public:
192 : m_idx(0)
193 {
194 }
195
197 {
198 }
199
201 {
202 if (m_idx >= _countof(RootKeys))
203 return S_FALSE;
204
206
207 PCWSTR name = key.keyName;
209
211
212 DWORD entryBufferLength = FIELD_OFFSET(RegPidlEntry, entryName) + sizeof(WCHAR) + cchName * sizeof(WCHAR);
213
214 // allocate space for the terminator
215 entryBufferLength += FIELD_OFFSET(SHITEMID, abID);
216
217 RegPidlEntry* entry = (RegPidlEntry*) CoTaskMemAlloc(entryBufferLength);
218 if (!entry)
219 return E_OUTOFMEMORY;
220
221 memset(entry, 0, entryBufferLength);
222
223 entry->cb = FIELD_OFFSET(RegPidlEntry, entryName);
224 entry->magic = REGISTRY_PIDL_MAGIC;
225 entry->entryType = otype;
226 entry->rootKey = key.key;
227
228 if (cchName > 0)
229 {
230 entry->entryNameLength = cchName * sizeof(WCHAR);
231 StringCbCopyNW(entry->entryName, entryBufferLength, name, entry->entryNameLength);
232 entry->cb += entry->entryNameLength + sizeof(WCHAR);
233 }
234 else
235 {
236 entry->entryNameLength = 0;
237 entry->entryName[0] = 0;
238 entry->cb += sizeof(WCHAR);
239 }
240
241 if (ppidl)
242 *ppidl = (LPITEMIDLIST) entry;
243 return S_OK;
244 }
245
246 STDMETHODIMP Next(ULONG celt, LPITEMIDLIST *rgelt, ULONG *pceltFetched) override
247 {
248 if (pceltFetched)
249 *pceltFetched = 0;
250
251 while (celt-- > 0)
252 {
253 HRESULT hr = EnumerateNext(rgelt);
254 if (hr != S_OK)
255 return hr;
256
257 if (pceltFetched)
258 (*pceltFetched)++;
259 if (rgelt)
260 rgelt++;
261 }
262
263 return S_OK;
264 }
265
266 STDMETHODIMP Skip(ULONG celt) override
267 {
268 while (celt > 0)
269 {
271 if (FAILED(hr))
272 return hr;
273 if (hr != S_OK)
274 break;
275 }
276
277 return S_OK;
278 }
279
281 {
282 return E_NOTIMPL;
283 }
284
285 STDMETHODIMP Clone(IEnumIDList **ppenum) override
286 {
287 return E_NOTIMPL;
288 }
289
292
294 COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList)
296
297};
298
300 public CComObjectRootEx<CComMultiThreadModelNoCS>,
301 public IEnumIDList
302{
306 int m_idx;
307
308public:
310 : m_path(NULL), m_hkey(NULL), m_values(FALSE), m_idx(0)
311 {
312 }
313
315 {
316 RegCloseKey(m_hkey);
317 }
318
320 {
321 m_path = path;
322
323 DWORD res;
324 if (root)
325 {
327 }
328 else
329 {
331 }
332 if (!NT_SUCCESS(res))
333 {
334 ERR("RegOpenKeyExW failed for path %S with status=%x\n", path, res);
335 return HRESULT_FROM_NT(res);
336 }
337
338 return S_OK;
339 }
340
342 {
345
346 WCHAR className[MAX_PATH];
347 DWORD cchClass = _countof(className);
348
349 if (RegEnumKeyExW(m_hkey, m_idx++, name, &cchName, 0, className, &cchClass, NULL))
350 return S_FALSE;
351
352 name[cchName] = 0;
353 className[cchClass] = 0;
354
356
357 DWORD entryBufferLength = FIELD_OFFSET(RegPidlEntry, entryName) + sizeof(WCHAR) + cchName * sizeof(WCHAR);
358
359 if (cchClass > 0)
360 {
361 entryBufferLength += sizeof(WCHAR) + cchClass * sizeof(WCHAR);
362 }
363
364 // allocate space for the terminator
365 entryBufferLength += FIELD_OFFSET(SHITEMID, abID);
366
367 RegPidlEntry* entry = (RegPidlEntry*) CoTaskMemAlloc(entryBufferLength);
368 if (!entry)
369 return E_OUTOFMEMORY;
370
371 memset(entry, 0, entryBufferLength);
372
373 entry->cb = FIELD_OFFSET(RegPidlEntry, entryName);
374 entry->magic = REGISTRY_PIDL_MAGIC;
375 entry->entryType = otype;
376
377 if (cchName > 0)
378 {
379 entry->entryNameLength = cchName * sizeof(WCHAR);
380 StringCbCopyNW(entry->entryName, entryBufferLength, name, entry->entryNameLength);
381 entry->cb += entry->entryNameLength + sizeof(WCHAR);
382 }
383 else
384 {
385 entry->entryNameLength = 0;
386 entry->entryName[0] = 0;
387 entry->cb += sizeof(WCHAR);
388 }
389
390 if (cchClass)
391 {
392 PWSTR contentData = (PWSTR) ((PBYTE) entry + entry->cb);
393 DWORD remainingSpace = entryBufferLength - entry->cb;
394
395 entry->contentsLength = cchClass * sizeof(WCHAR);
396 StringCbCopyNW(contentData, remainingSpace, className, entry->contentsLength);
397
398 entry->cb += entry->contentsLength + sizeof(WCHAR);
399 }
400
401 if (ppidl)
402 *ppidl = (LPITEMIDLIST) entry;
403 return S_OK;
404 }
405
407 {
410 DWORD type = 0;
411 DWORD dataSize = 0;
412
413 if (RegEnumValueW(m_hkey, m_idx++, name, &cchName, 0, &type, NULL, &dataSize))
414 return S_FALSE;
415
417
418 DWORD entryBufferLength = FIELD_OFFSET(RegPidlEntry, entryName) + sizeof(WCHAR) + cchName * sizeof(WCHAR);
419
420#define MAX_EMBEDDED_DATA 32
421 BOOL copyData = dataSize <= MAX_EMBEDDED_DATA;
422 if (copyData)
423 {
424 entryBufferLength += dataSize + sizeof(WCHAR);
425
427 }
428
429 // allocate space for the terminator
430 entryBufferLength += FIELD_OFFSET(SHITEMID, abID);
431
432 RegPidlEntry* entry = (RegPidlEntry*) CoTaskMemAlloc(entryBufferLength);
433 if (!entry)
434 return E_OUTOFMEMORY;
435
436 memset(entry, 0, entryBufferLength);
437
438 entry->cb = FIELD_OFFSET(RegPidlEntry, entryName);
439 entry->magic = REGISTRY_PIDL_MAGIC;
440 entry->entryType = otype;
441 entry->contentType = type;
442
443 if (cchName > 0)
444 {
445 entry->entryNameLength = cchName * sizeof(WCHAR);
446 StringCbCopyNW(entry->entryName, entryBufferLength, name, entry->entryNameLength);
447 entry->cb += entry->entryNameLength + sizeof(WCHAR);
448 }
449 else
450 {
451 entry->entryNameLength = 0;
452 entry->entryName[0] = 0;
453 entry->cb += sizeof(WCHAR);
454 }
455
456 if (copyData)
457 {
458 PBYTE contentData = (PBYTE) ((PBYTE) entry + entry->cb);
459
460 entry->contentsLength = dataSize;
461
462 // In case it's an unterminated string, RegGetValue will add the NULL termination
463 dataSize += sizeof(WCHAR);
464
465 if (!RegQueryValueExW(m_hkey, name, NULL, NULL, contentData, &dataSize))
466 {
467 entry->cb += entry->contentsLength + sizeof(WCHAR);
468 }
469 else
470 {
471 entry->contentsLength = 0;
472 entry->cb += sizeof(WCHAR);
473 }
474
475 }
476
477 if (ppidl)
478 *ppidl = (LPITEMIDLIST) entry;
479 return S_OK;
480 }
481
483 {
484 if (!m_values)
485 {
486 HRESULT hr = NextKey(ppidl);
487 if (hr != S_FALSE)
488 return hr;
489
490 // switch to values.
491 m_values = TRUE;
492 m_idx = 0;
493 }
494
495 return NextValue(ppidl);
496 }
497
498 STDMETHODIMP Next(ULONG celt, LPITEMIDLIST *rgelt, ULONG *pceltFetched) override
499 {
500 if (pceltFetched)
501 *pceltFetched = 0;
502
503 while (celt-- > 0)
504 {
505 HRESULT hr = EnumerateNext(rgelt);
506 if (hr != S_OK)
507 return hr;
508
509 if (pceltFetched)
510 (*pceltFetched)++;
511 if (rgelt)
512 rgelt++;
513 }
514
515 return S_OK;
516 }
517
518 STDMETHODIMP Skip(ULONG celt) override
519 {
520 while (celt > 0)
521 {
523 if (FAILED(hr))
524 return hr;
525 if (hr != S_OK)
526 break;
527 }
528
529 return S_OK;
530 }
531
533 {
534 return E_NOTIMPL;
535 }
536
537 STDMETHODIMP Clone(IEnumIDList **ppenum) override
538 {
539 return E_NOTIMPL;
540 }
541
544
546 COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList)
548};
549
551 public CComObjectRootEx<CComMultiThreadModelNoCS>,
552 public IEnumIDList
553{
559
560public:
562 : m_directory(NULL), m_first(TRUE), m_enumContext(0), m_pend(NULL)
563 {
564 }
565
567 {
568 NtClose(m_directory);
569 }
570
572 {
573 StringCbCopyExW(buffer, sizeof(buffer), path, &m_pend, NULL, 0);
574
576 if (!NT_SUCCESS(err))
577 {
578 ERR("NtOpenDirectoryObject failed for path %S with status=%x\n", buffer, err);
579 return HRESULT_FROM_NT(err);
580 }
581
582 if (m_pend[-1] != '\\')
583 *m_pend++ = '\\';
584
585 return S_OK;
586 }
587
589 {
590 BYTE dirbuffer[2048];
591 if (!NT_SUCCESS(NtQueryDirectoryObject(m_directory, dirbuffer, 2048, TRUE, m_first, &m_enumContext, NULL)))
592 return S_FALSE;
593
594 m_first = FALSE;
595
596 // if ppidl is NULL, assume the caller was Skip(),
597 // so we don't care about the info
598 if (!ppidl)
599 return S_OK;
600
602
603 if (info->Name.Buffer)
604 {
605 StringCbCopyNW(m_pend, sizeof(buffer), info->Name.Buffer, info->Name.Length);
606 }
607
608 OBJECT_TYPE otype = MapTypeNameToType(info->TypeName.Buffer, info->TypeName.Length);
609
610 DWORD entryBufferLength = FIELD_OFFSET(NtPidlEntry, entryName) + sizeof(WCHAR);
611 if (info->Name.Buffer)
612 entryBufferLength += info->Name.Length;
613
614 if (otype < 0)
615 {
616 entryBufferLength += FIELD_OFFSET(NtPidlTypeData, typeName) + sizeof(WCHAR);
617
618 if (info->TypeName.Buffer)
619 {
620 entryBufferLength += info->TypeName.Length;
621 }
622 }
623
624 // allocate space for the terminator
625 entryBufferLength += FIELD_OFFSET(SHITEMID, abID);
626
627 NtPidlEntry* entry = (NtPidlEntry*) CoTaskMemAlloc(entryBufferLength);
628 if (!entry)
629 return E_OUTOFMEMORY;
630
631 memset(entry, 0, entryBufferLength);
632
633 entry->cb = FIELD_OFFSET(NtPidlEntry, entryName);
635 entry->objectType = otype;
636
637 if (info->Name.Buffer)
638 {
639 entry->entryNameLength = info->Name.Length;
640 StringCbCopyNW(entry->entryName, entryBufferLength, info->Name.Buffer, info->Name.Length);
641 entry->cb += entry->entryNameLength + sizeof(WCHAR);
642 }
643 else
644 {
645 entry->entryNameLength = 0;
646 entry->entryName[0] = 0;
647 entry->cb += sizeof(WCHAR);
648 }
649
650 if (otype < 0)
651 {
652 NtPidlTypeData * typedata = (NtPidlTypeData*) ((PBYTE) entry + entry->cb);
653 DWORD remainingSpace = entryBufferLength - ((PBYTE) (typedata->typeName) - (PBYTE) entry);
654
655 if (info->TypeName.Buffer)
656 {
657 typedata->typeNameLength = info->TypeName.Length;
658 StringCbCopyNW(typedata->typeName, remainingSpace, info->TypeName.Buffer, info->TypeName.Length);
659
660 entry->cb += typedata->typeNameLength + sizeof(WCHAR);
661 }
662 else
663 {
664 typedata->typeNameLength = 0;
665 typedata->typeName[0] = 0;
666 entry->cb += typedata->typeNameLength + sizeof(WCHAR);
667 }
668 }
669
670 *ppidl = (LPITEMIDLIST) entry;
671
672 return S_OK;
673 }
674
675 STDMETHODIMP Next(ULONG celt, LPITEMIDLIST *rgelt, ULONG *pceltFetched) override
676 {
677 if (pceltFetched)
678 *pceltFetched = 0;
679
680 while (celt-- > 0)
681 {
682 HRESULT hr = EnumerateNext(rgelt);
683 if (hr != S_OK)
684 return hr;
685
686 if (pceltFetched)
687 (*pceltFetched)++;
688 if (rgelt)
689 rgelt++;
690 }
691
692 return S_OK;
693 }
694
695 STDMETHODIMP Skip(ULONG celt) override
696 {
697 while (celt > 0)
698 {
700 if (FAILED(hr))
701 return hr;
702 if (hr != S_OK)
703 break;
704 }
705
706 return S_OK;
707 }
708
710 {
711 return E_NOTIMPL;
712 }
713
714 STDMETHODIMP Clone(IEnumIDList **ppenum) override
715 {
716 return E_NOTIMPL;
717 }
718
721
723 COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList)
725};
726
728{
729 return ShellObjectCreator<CEnumRegRoot>(IID_PPV_ARG(IEnumIDList, ppil));
730}
731
733{
734 return ShellObjectCreatorInit<CEnumRegKey>(path, root, IID_PPV_ARG(IEnumIDList, ppil));
735}
736
738{
739 return ShellObjectCreatorInit<CEnumNTDirectory>(path, IID_PPV_ARG(IEnumIDList, ppil));
740}
NTSTATUS NTAPI NtOpenSection(OUT PHANDLE SectionHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: section.c:3202
const WCHAR * class
Definition: main.c:68
#define STDMETHODIMP
Definition: basetyps.h:43
#define ERR(fmt,...)
Definition: debug.h:113
#define RegCloseKey(hKey)
Definition: registry.h:49
STDMETHODIMP Skip(ULONG celt) override
Definition: ntobjenum.cpp:695
STDMETHODIMP Next(ULONG celt, LPITEMIDLIST *rgelt, ULONG *pceltFetched) override
Definition: ntobjenum.cpp:675
STDMETHODIMP Reset() override
Definition: ntobjenum.cpp:709
HRESULT EnumerateNext(LPITEMIDLIST *ppidl)
Definition: ntobjenum.cpp:588
STDMETHODIMP Clone(IEnumIDList **ppenum) override
Definition: ntobjenum.cpp:714
HRESULT Initialize(PCWSTR path)
Definition: ntobjenum.cpp:571
STDMETHODIMP Skip(ULONG celt) override
Definition: ntobjenum.cpp:518
HRESULT NextKey(LPITEMIDLIST *ppidl)
Definition: ntobjenum.cpp:341
HRESULT NextValue(LPITEMIDLIST *ppidl)
Definition: ntobjenum.cpp:406
STDMETHODIMP Reset() override
Definition: ntobjenum.cpp:532
PCWSTR m_path
Definition: ntobjenum.cpp:303
STDMETHODIMP Next(ULONG celt, LPITEMIDLIST *rgelt, ULONG *pceltFetched) override
Definition: ntobjenum.cpp:498
HRESULT EnumerateNext(LPITEMIDLIST *ppidl)
Definition: ntobjenum.cpp:482
HRESULT Initialize(PCWSTR path, HKEY root)
Definition: ntobjenum.cpp:319
STDMETHODIMP Clone(IEnumIDList **ppenum) override
Definition: ntobjenum.cpp:537
STDMETHODIMP Skip(ULONG celt) override
Definition: ntobjenum.cpp:266
STDMETHODIMP Next(ULONG celt, LPITEMIDLIST *rgelt, ULONG *pceltFetched) override
Definition: ntobjenum.cpp:246
STDMETHODIMP Clone(IEnumIDList **ppenum) override
Definition: ntobjenum.cpp:285
HRESULT EnumerateNext(LPITEMIDLIST *ppidl)
Definition: ntobjenum.cpp:200
STDMETHODIMP Reset() override
Definition: ntobjenum.cpp:280
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_NOTIMPL
Definition: ddrawi.h:99
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define NTSTATUS
Definition: precomp.h:21
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2504
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2830
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
INT WINAPI StrCmpNW(LPCWSTR lpszStr, LPCWSTR lpszComp, INT iLen)
Definition: string.c:504
#define MAX_PATH
Definition: compat.h:34
#define FILE_SHARE_READ
Definition: compat.h:136
struct _IO_STATUS_BLOCK * PIO_STATUS_BLOCK
Definition: change.c:34
NTSTATUS NTAPI NtOpenEventPair(OUT PHANDLE EventPairHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: evtpair.c:136
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint res
Definition: glext.h:9613
GLuint buffer
Definition: glext.h:5915
GLenum GLsizei dataSize
Definition: glext.h:11123
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define DbgPrint
Definition: hal.h:12
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
NTSTATUS NTAPI NtOpenIoCompletion(OUT PHANDLE IoCompletionHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: iocomp.c:326
uint32_t entry
Definition: isohybrid.c:63
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:581
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:601
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:679
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:651
#define END_COM_MAP()
Definition: atlcom.h:592
NTSTATUS NTAPI NtOpenMutant(OUT PHANDLE MutantHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: mutant.c:162
unsigned int UINT
Definition: ndis.h:50
struct _OBJECT_DIRECTORY_INFORMATION * POBJECT_DIRECTORY_INFORMATION
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3952
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define SYMBOLIC_LINK_QUERY
Definition: nt_native.h:1265
ULONG ACCESS_MASK
Definition: nt_native.h:40
#define FILE_LIST_DIRECTORY
Definition: nt_native.h:629
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define STANDARD_RIGHTS_READ
Definition: nt_native.h:65
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
HRESULT ReadRegistryValue(HKEY root, PCWSTR path, PCWSTR valueName, PVOID *valueData, PDWORD valueLength)
Definition: ntobjenum.cpp:98
const LPCWSTR ObjectTypeNames[]
Definition: ntobjenum.cpp:25
HRESULT GetEnumRegistryKey(LPCWSTR path, HKEY root, IEnumIDList **ppil)
Definition: ntobjenum.cpp:732
static DWORD NtOpenObject(OBJECT_TYPE type, PHANDLE phandle, DWORD access, LPCWSTR path)
Definition: ntobjenum.cpp:50
HRESULT GetEnumNTDirectory(LPCWSTR path, IEnumIDList **ppil)
Definition: ntobjenum.cpp:737
static struct RootKeyEntry RootKeys[]
NTSTATUS(__stdcall * pfnNtGenericOpen)(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES)
Definition: ntobjenum.cpp:22
#define MAX_EMBEDDED_DATA
HRESULT GetNTObjectSymbolicLinkTarget(LPCWSTR path, LPCWSTR entryName, PUNICODE_STRING LinkTarget)
Definition: ntobjenum.cpp:151
OBJECT_TYPE MapTypeNameToType(LPCWSTR TypeName, DWORD cbTypeName)
Definition: ntobjenum.cpp:81
const LPCWSTR RegistryTypeNames[]
Definition: ntobjenum.cpp:35
NTSTATUS(__stdcall * pfnNtOpenFile)(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, PIO_STATUS_BLOCK, ULONG, ULONG)
Definition: ntobjenum.cpp:23
HRESULT GetEnumRegistryRoot(IEnumIDList **ppil)
Definition: ntobjenum.cpp:727
#define REGISTRY_PIDL_MAGIC
Definition: ntobjenum.h:26
OBJECT_TYPE
Definition: ntobjenum.h:13
@ KEY_OBJECT
Definition: ntobjenum.h:16
@ MUTANT_OBJECT
Definition: ntobjenum.h:15
@ EVENT_OBJECT
Definition: ntobjenum.h:15
@ SYMBOLICLINK_OBJECT
Definition: ntobjenum.h:14
@ FILE_OBJECT
Definition: ntobjenum.h:17
@ IOCOMPLETION_OBJECT
Definition: ntobjenum.h:16
@ SECTION_OBJECT
Definition: ntobjenum.h:15
@ DIRECTORY_OBJECT
Definition: ntobjenum.h:14
@ SEMAPHORE_OBJECT
Definition: ntobjenum.h:15
@ EVENTPAIR_OBJECT
Definition: ntobjenum.h:16
@ UNKNOWN_OBJECT_TYPE
Definition: ntobjenum.h:21
@ TIMER_OBJECT
Definition: ntobjenum.h:16
REG_ENTRY_TYPE
Definition: ntobjenum.h:51
@ REG_ENTRY_KEY
Definition: ntobjenum.h:53
@ REG_ENTRY_VALUE_WITH_CONTENT
Definition: ntobjenum.h:55
@ REG_ENTRY_VALUE
Definition: ntobjenum.h:54
@ REG_ENTRY_ROOT
Definition: ntobjenum.h:52
#define NT_OBJECT_PIDL_MAGIC
Definition: ntobjenum.h:25
NTSTATUS NTAPI NtOpenEvent(OUT PHANDLE EventHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: event.c:181
NTSTATUS NTAPI NtOpenTimer(OUT PHANDLE TimerHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: timer.c:463
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:455
#define L(x)
Definition: ntvdm.h:50
NTSTATUS NTAPI NtOpenDirectoryObject(OUT PHANDLE DirectoryHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: obdir.c:393
NTSTATUS NTAPI NtQueryDirectoryObject(IN HANDLE DirectoryHandle, OUT PVOID Buffer, IN ULONG BufferLength, IN BOOLEAN ReturnSingleEntry, IN BOOLEAN RestartScan, IN OUT PULONG Context, OUT PULONG ReturnLength OPTIONAL)
Definition: obdir.c:490
BYTE * PBYTE
Definition: pedump.c:66
DWORD * PDWORD
Definition: pedump.c:68
#define err(...)
#define memset(x, y, z)
Definition: compat.h:39
LOCAL char * m_path
Definition: stream.c:51
NTSTATUS NTAPI NtOpenSemaphore(OUT PHANDLE SemaphoreHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: sem.c:161
HRESULT hr
Definition: shlfolder.c:183
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
#define _countof(array)
Definition: sndvol32.h:70
STRSAFEAPI StringCbCopyNW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, size_t cbToCopy)
Definition: strsafe.h:255
STRSAFEAPI StringCbCopyExW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags)
Definition: strsafe.h:210
STRSAFEAPI StringCbCatW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:342
WCHAR typeName[ANYSIZE_ARRAY]
Definition: ntobjenum.h:46
USHORT typeNameLength
Definition: ntobjenum.h:45
PCWSTR keyName
Definition: ntobjenum.cpp:13
Definition: copy.c:22
Definition: name.c:39
uint16_t * PWSTR
Definition: typedefs.h:56
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define __stdcall
Definition: typedefs.h:25
uint32_t ULONG
Definition: typedefs.h:59
struct _OBJECT_ATTRIBUTES * POBJECT_ATTRIBUTES
Definition: file.c:85
struct _OBJECT_ATTRIBUTES OBJECT_ATTRIBUTES
_In_ PSID _Out_writes_to_opt_ cchName LPSTR _Inout_ LPDWORD cchName
Definition: winbase.h:2767
#define HRESULT_FROM_NT(x)
Definition: winerror.h:94
#define S_FALSE
Definition: winerror.h:2357
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_CONFIG
Definition: winreg.h:15
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define HKEY_USERS
Definition: winreg.h:13
#define IID_PPV_ARG(Itype, ppType)
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
unsigned char BYTE
Definition: xxhash.c:193
_Inout_ PUNICODE_STRING LinkTarget
Definition: zwfuncs.h:292