ReactOS  0.4.12-dev-708-g95ed44e
obdir.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Kernel
3  * LICENSE: GPL - See COPYING in the top level directory
4  * FILE: ntoskrnl/ob/obdir.c
5  * PURPOSE: Manages the Object Manager's Directory Implementation,
6  * such as functions for addition, deletion and lookup into
7  * the Object Manager's namespace. These routines are separate
8  * from the Namespace Implementation because they are largely
9  * independent and could be used for other namespaces.
10  * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
11  * Thomas Weidenmueller (w3seek@reactos.org)
12  */
13 
14 /* INCLUDES ***************************************************************/
15 
16 #include <ntoskrnl.h>
17 #define NDEBUG
18 #include <debug.h>
19 
22 
23 /* PRIVATE FUNCTIONS ******************************************************/
24 
25 /*++
26 * @name ObpInsertEntryDirectory
27 *
28 * The ObpInsertEntryDirectory routine <FILLMEIN>.
29 *
30 * @param Parent
31 * <FILLMEIN>.
32 *
33 * @param Context
34 * <FILLMEIN>.
35 *
36 * @param ObjectHeader
37 * <FILLMEIN>.
38 *
39 * @return TRUE if the object was inserted, FALSE otherwise.
40 *
41 * @remarks None.
42 *
43 *--*/
44 BOOLEAN
45 NTAPI
48  IN POBJECT_HEADER ObjectHeader)
49 {
50  POBJECT_DIRECTORY_ENTRY *AllocatedEntry;
51  POBJECT_DIRECTORY_ENTRY NewEntry;
52  POBJECT_HEADER_NAME_INFO HeaderNameInfo;
53 
54  /* Make sure we have a name */
55  ASSERT(ObjectHeader->NameInfoOffset != 0);
56 
57  /* Validate the context */
58  if ((Context->Object) ||
59  !(Context->DirectoryLocked) ||
60  (Parent != Context->Directory))
61  {
62  /* Invalid context */
63  DPRINT1("OB: ObpInsertEntryDirectory - invalid context %p %u\n",
64  Context, Context->DirectoryLocked);
65  ASSERT(FALSE);
66  return FALSE;
67  }
68 
69  /* Allocate a new Directory Entry */
71  sizeof(OBJECT_DIRECTORY_ENTRY),
72  OB_DIR_TAG);
73  if (!NewEntry) return FALSE;
74 
75  /* Save the hash */
76  NewEntry->HashValue = Context->HashValue;
77 
78  /* Get the Object Name Information */
79  HeaderNameInfo = OBJECT_HEADER_TO_NAME_INFO(ObjectHeader);
80 
81  /* Get the Allocated entry */
82  AllocatedEntry = &Parent->HashBuckets[Context->HashIndex];
83 
84  /* Set it */
85  NewEntry->ChainLink = *AllocatedEntry;
86  *AllocatedEntry = NewEntry;
87 
88  /* Associate the Object */
89  NewEntry->Object = &ObjectHeader->Body;
90 
91  /* Associate the Directory */
92  HeaderNameInfo->Directory = Parent;
93  return TRUE;
94 }
95 
96 /*++
97 * @name ObpLookupEntryDirectory
98 *
99 * The ObpLookupEntryDirectory routine <FILLMEIN>.
100 *
101 * @param Directory
102 * <FILLMEIN>.
103 *
104 * @param Name
105 * <FILLMEIN>.
106 *
107 * @param Attributes
108 * <FILLMEIN>.
109 *
110 * @param SearchShadow
111 * <FILLMEIN>.
112 *
113 * @param Context
114 * <FILLMEIN>.
115 *
116 * @return Pointer to the object which was found, or NULL otherwise.
117 *
118 * @remarks None.
119 *
120 *--*/
121 PVOID
122 NTAPI
126  IN UCHAR SearchShadow,
128 {
130  POBJECT_HEADER_NAME_INFO HeaderNameInfo;
131  POBJECT_HEADER ObjectHeader;
133  ULONG HashIndex;
134  LONG TotalChars;
135  WCHAR CurrentChar;
136  POBJECT_DIRECTORY_ENTRY *AllocatedEntry;
137  POBJECT_DIRECTORY_ENTRY *LookupBucket;
138  POBJECT_DIRECTORY_ENTRY CurrentEntry;
139  PVOID FoundObject = NULL;
140  PWSTR Buffer;
141  PAGED_CODE();
142 
143  /* Check if we should search the shadow directory */
144  if (!ObpLUIDDeviceMapsEnabled) SearchShadow = FALSE;
145 
146  /* Fail if we don't have a directory or name */
147  if (!(Directory) || !(Name)) goto Quickie;
148 
149  /* Get name information */
150  TotalChars = Name->Length / sizeof(WCHAR);
151  Buffer = Name->Buffer;
152 
153  /* Set up case-sensitivity */
155 
156  /* Fail if the name is empty */
157  if (!(Buffer) || !(TotalChars)) goto Quickie;
158 
159  /* Create the Hash */
160  for (HashValue = 0; TotalChars; TotalChars--)
161  {
162  /* Go to the next Character */
163  CurrentChar = *Buffer++;
164 
165  /* Prepare the Hash */
166  HashValue += (HashValue << 1) + (HashValue >> 1);
167 
168  /* Create the rest based on the name */
169  if (CurrentChar < 'a') HashValue += CurrentChar;
170  else if (CurrentChar > 'z') HashValue += RtlUpcaseUnicodeChar(CurrentChar);
171  else HashValue += (CurrentChar - ('a'-'A'));
172  }
173 
174  /* Merge it with our number of hash buckets */
175  HashIndex = HashValue % 37;
176 
177  /* Save the result */
178  Context->HashValue = HashValue;
179  Context->HashIndex = (USHORT)HashIndex;
180 
181  /* Get the root entry and set it as our lookup bucket */
182  AllocatedEntry = &Directory->HashBuckets[HashIndex];
183  LookupBucket = AllocatedEntry;
184 
185  /* Check if the directory is already locked */
186  if (!Context->DirectoryLocked)
187  {
188  /* Lock it */
190  }
191 
192  /* Start looping */
193  while ((CurrentEntry = *AllocatedEntry))
194  {
195  /* Do the hashes match? */
196  if (CurrentEntry->HashValue == HashValue)
197  {
198  /* Make sure that it has a name */
199  ObjectHeader = OBJECT_TO_OBJECT_HEADER(CurrentEntry->Object);
200 
201  /* Get the name information */
202  ASSERT(ObjectHeader->NameInfoOffset != 0);
203  HeaderNameInfo = OBJECT_HEADER_TO_NAME_INFO(ObjectHeader);
204 
205  /* Do the names match? */
206  if ((Name->Length == HeaderNameInfo->Name.Length) &&
207  (RtlEqualUnicodeString(Name, &HeaderNameInfo->Name, CaseInsensitive)))
208  {
209  break;
210  }
211  }
212 
213  /* Move to the next entry */
214  AllocatedEntry = &CurrentEntry->ChainLink;
215  }
216 
217  /* Check if we still have an entry */
218  if (CurrentEntry)
219  {
220  /* Set this entry as the first, to speed up incoming insertion */
221  if (AllocatedEntry != LookupBucket)
222  {
223  /* Check if the directory was locked or convert the lock */
224  if ((Context->DirectoryLocked) ||
226  {
227  /* Set the Current Entry */
228  *AllocatedEntry = CurrentEntry->ChainLink;
229 
230  /* Link to the old Hash Entry */
231  CurrentEntry->ChainLink = *LookupBucket;
232 
233  /* Set the new Hash Entry */
234  *LookupBucket = CurrentEntry;
235  }
236  }
237 
238  /* Save the found object */
239  FoundObject = CurrentEntry->Object;
240  goto Quickie;
241  }
242  else
243  {
244  /* Check if the directory was locked */
245  if (!Context->DirectoryLocked)
246  {
247  /* Release the lock */
249  }
250 
251  /* Check if we should scan the shadow directory */
252  if ((SearchShadow) && (Directory->DeviceMap))
253  {
254  /* FIXME: We don't support this yet */
255  ASSERT(FALSE);
256  }
257  }
258 
259 Quickie:
260  /* Check if we inserted an object */
261  if (FoundObject)
262  {
263  /* Get the object name information */
264  ObjectHeader = OBJECT_TO_OBJECT_HEADER(FoundObject);
265  ObpReferenceNameInfo(ObjectHeader);
266 
267  /* Reference the object being looked up */
268  ObReferenceObject(FoundObject);
269 
270  /* Check if the directory was locked */
271  if (!Context->DirectoryLocked)
272  {
273  /* Release the lock */
275  }
276  }
277 
278  /* Check if we found an object already */
279  if (Context->Object)
280  {
281  /* We already did a lookup, so remove this object's query reference */
282  ObjectHeader = OBJECT_TO_OBJECT_HEADER(Context->Object);
283  HeaderNameInfo = OBJECT_HEADER_TO_NAME_INFO(ObjectHeader);
284  ObpDereferenceNameInfo(HeaderNameInfo);
285 
286  /* Also dereference the object itself */
287  ObDereferenceObject(Context->Object);
288  }
289 
290  /* Return the object we found */
291  Context->Object = FoundObject;
292  return FoundObject;
293 }
294 
295 /*++
296 * @name ObpDeleteEntryDirectory
297 *
298 * The ObpDeleteEntryDirectory routine <FILLMEIN>.
299 *
300 * @param Context
301 * <FILLMEIN>.
302 *
303 * @return TRUE if the object was deleted, FALSE otherwise.
304 *
305 * @remarks None.
306 *
307 *--*/
308 BOOLEAN
309 NTAPI
311 {
313  POBJECT_DIRECTORY_ENTRY *AllocatedEntry;
314  POBJECT_DIRECTORY_ENTRY CurrentEntry;
315 
316  /* Get the Directory */
317  Directory = Context->Directory;
318  if (!Directory) return FALSE;
319 
320  /* Get the Entry */
321  AllocatedEntry = &Directory->HashBuckets[Context->HashIndex];
322  CurrentEntry = *AllocatedEntry;
323 
324  /* Unlink the Entry */
325  *AllocatedEntry = CurrentEntry->ChainLink;
326  CurrentEntry->ChainLink = NULL;
327 
328  /* Free it */
329  ExFreePoolWithTag(CurrentEntry, OB_DIR_TAG);
330 
331  /* Return */
332  return TRUE;
333 }
334 
335 /* FUNCTIONS **************************************************************/
336 
337 /*++
338 * @name NtOpenDirectoryObject
339 * @implemented NT4
340 *
341 * The NtOpenDirectoryObject routine opens a namespace directory object.
342 *
343 * @param DirectoryHandle
344 * Variable which receives the directory handle.
345 *
346 * @param DesiredAccess
347 * Desired access to the directory.
348 *
349 * @param ObjectAttributes
350 * Structure describing the directory.
351 *
352 * @return STATUS_SUCCESS or appropriate error value.
353 *
354 * @remarks None.
355 *
356 *--*/
357 NTSTATUS
358 NTAPI
362 {
366  PAGED_CODE();
367 
368  /* Check if we need to do any probing */
369  if (PreviousMode != KernelMode)
370  {
371  _SEH2_TRY
372  {
373  /* Probe the return handle */
375  }
377  {
378  /* Return the exception code */
380  }
381  _SEH2_END;
382  }
383 
384  /* Open the directory object */
387  PreviousMode,
388  NULL,
390  NULL,
391  &Directory);
392  if (NT_SUCCESS(Status))
393  {
394  _SEH2_TRY
395  {
396  /* Write back the handle to the caller */
398  }
400  {
401  /* Get the exception code */
403  }
404  _SEH2_END;
405  }
406 
407  /* Return the status to the caller */
408  return Status;
409 }
410 
411 /*++
412 * @name NtQueryDirectoryObject
413 * @implemented NT4
414 *
415 * The NtQueryDirectoryObject routine reads information from a directory in
416 * the system namespace.
417 *
418 * @param DirectoryHandle
419 * Handle obtained with NtOpenDirectoryObject which
420 * must grant DIRECTORY_QUERY access to the directory object.
421 *
422 * @param Buffer
423 * Buffer to hold the data read.
424 *
425 * @param BufferLength
426 * Size of the buffer in bytes.
427 *
428 * @param ReturnSingleEntry
429 * When TRUE, only 1 entry is written in DirObjInformation;
430 * otherwise as many as will fit in the buffer.
431 *
432 * @param RestartScan
433 * If TRUE start reading at index 0.
434 * If FALSE start reading at the index specified by *ObjectIndex.
435 *
436 * @param Context
437 * Zero based index into the directory, interpretation
438 * depends on RestartScan.
439 *
440 * @param ReturnLength
441 * Caller supplied storage for the number of bytes
442 * written (or NULL).
443 *
444 * @return STATUS_SUCCESS or appropriate error value.
445 *
446 * @remarks Although you can iterate over the directory by calling this
447 * function multiple times, the directory is unlocked between
448 * calls. This means that another thread can change the directory
449 * and so iterating doesn't guarantee a consistent picture of the
450 * directory. Best thing is to retrieve all directory entries in
451 * one call.
452 *
453 *--*/
454 NTSTATUS
455 NTAPI
457  OUT PVOID Buffer,
463 {
466  ULONG SkipEntries = 0;
468  PVOID LocalBuffer;
469  POBJECT_DIRECTORY_INFORMATION DirectoryInfo;
471  ULONG Count, CurrentEntry;
472  ULONG Hash;
474  POBJECT_HEADER ObjectHeader;
475  POBJECT_HEADER_NAME_INFO ObjectNameInfo;
477  PWSTR p;
478  OBP_LOOKUP_CONTEXT LookupContext;
479  PAGED_CODE();
480 
481  /* Initialize lookup */
482  ObpInitializeLookupContext(&LookupContext);
483 
484  /* Check if we need to do any probing */
485  if (PreviousMode != KernelMode)
486  {
487  _SEH2_TRY
488  {
489  /* Probe the buffer (assuming it will hold Unicode characters) */
491 
492  /* Probe the context and copy it unless scan-restart was requested */
494  if (!RestartScan) SkipEntries = *Context;
495 
496  /* Probe the return length if the caller specified one */
498  }
500  {
501  /* Return the exception code */
503  }
504  _SEH2_END;
505  }
506  else if (!RestartScan)
507  {
508  /* This is kernel mode, save the context without probing, if needed */
509  SkipEntries = *Context;
510  }
511 
512  /* Allocate a buffer */
513  LocalBuffer = ExAllocatePoolWithTag(PagedPool,
515  BufferLength,
516  OB_NAME_TAG);
517  if (!LocalBuffer) return STATUS_INSUFFICIENT_RESOURCES;
518  RtlZeroMemory(LocalBuffer, BufferLength);
519 
520  /* Get a reference to directory */
524  PreviousMode,
525  (PVOID*)&Directory,
526  NULL);
527  if (!NT_SUCCESS(Status))
528  {
529  /* Free the buffer and fail */
530  ExFreePoolWithTag(LocalBuffer, OB_NAME_TAG);
531  return Status;
532  }
533 
534  /* Lock directory in shared mode */
535  ObpAcquireDirectoryLockShared(Directory, &LookupContext);
536 
537  /* Start at position 0 */
538  DirectoryInfo = (POBJECT_DIRECTORY_INFORMATION)LocalBuffer;
540 
541  /* Start with 0 entries */
542  Count = 0;
543  CurrentEntry = 0;
544 
545  /* Set default status and start looping */
547  for (Hash = 0; Hash < 37; Hash++)
548  {
549  /* Get this entry and loop all of them */
550  Entry = Directory->HashBuckets[Hash];
551  while (Entry)
552  {
553  /* Check if we should process this entry */
554  if (SkipEntries == CurrentEntry++)
555  {
556  /* Get the header data */
557  ObjectHeader = OBJECT_TO_OBJECT_HEADER(Entry->Object);
558  ObjectNameInfo = OBJECT_HEADER_TO_NAME_INFO(ObjectHeader);
559 
560  /* Get the object name */
561  if (ObjectNameInfo)
562  {
563  /* Use the one we have */
564  Name = ObjectNameInfo->Name;
565  }
566  else
567  {
568  /* Otherwise, use an empty one */
569  RtlInitEmptyUnicodeString(&Name, NULL, 0);
570  }
571 
572  /* Calculate the length for this entry */
574  Name.Length + sizeof(UNICODE_NULL) +
575  ObjectHeader->Type->Name.Length + sizeof(UNICODE_NULL);
576 
577  /* Make sure this entry won't overflow */
578  if ((TotalLength + Length) > BufferLength)
579  {
580  /* Check if the caller wanted only an entry */
581  if (ReturnSingleEntry)
582  {
583  /* Then we'll fail and ask for more buffer */
584  TotalLength += Length;
586  }
587  else
588  {
589  /* Otherwise, we'll say we're done for now */
591  }
592 
593  /* Decrease the entry since we didn't process */
594  CurrentEntry--;
595  goto Quickie;
596  }
597 
598  /* Now fill in the buffer */
599  DirectoryInfo->Name.Length = Name.Length;
600  DirectoryInfo->Name.MaximumLength = Name.Length +
601  sizeof(UNICODE_NULL);
602  DirectoryInfo->Name.Buffer = Name.Buffer;
603  DirectoryInfo->TypeName.Length = ObjectHeader->
604  Type->Name.Length;
605  DirectoryInfo->TypeName.MaximumLength = ObjectHeader->
606  Type->Name.Length +
607  sizeof(UNICODE_NULL);
608  DirectoryInfo->TypeName.Buffer = ObjectHeader->
609  Type->Name.Buffer;
610 
611  /* Set success */
613 
614  /* Increase statistics */
615  TotalLength += Length;
616  DirectoryInfo++;
617  Count++;
618 
619  /* If the caller only wanted an entry, bail out */
620  if (ReturnSingleEntry) goto Quickie;
621 
622  /* Increase the key by one */
623  SkipEntries++;
624  }
625 
626  /* Move to the next directory */
627  Entry = Entry->ChainLink;
628  }
629  }
630 
631 Quickie:
632  /* Make sure we got success */
633  if (NT_SUCCESS(Status))
634  {
635  /* Clear the current pointer and set it */
636  RtlZeroMemory(DirectoryInfo, sizeof(OBJECT_DIRECTORY_INFORMATION));
637  DirectoryInfo++;
638 
639  /* Set the buffer here now and loop entries */
640  p = (PWSTR)DirectoryInfo;
641  DirectoryInfo = LocalBuffer;
642  while (Count--)
643  {
644  /* Copy the name buffer */
646  DirectoryInfo->Name.Buffer,
647  DirectoryInfo->Name.Length);
648 
649  /* Now fixup the pointers */
650  DirectoryInfo->Name.Buffer = (PVOID)((ULONG_PTR)Buffer +
651  ((ULONG_PTR)p -
652  (ULONG_PTR)LocalBuffer));
653 
654  /* Advance in buffer and NULL-terminate */
655  p = (PVOID)((ULONG_PTR)p + DirectoryInfo->Name.Length);
656  *p++ = UNICODE_NULL;
657 
658  /* Now copy the type name buffer */
660  DirectoryInfo->TypeName.Buffer,
661  DirectoryInfo->TypeName.Length);
662 
663  /* Now fixup the pointers */
664  DirectoryInfo->TypeName.Buffer = (PVOID)((ULONG_PTR)Buffer +
665  ((ULONG_PTR)p -
666  (ULONG_PTR)LocalBuffer));
667 
668  /* Advance in buffer and NULL-terminate */
669  p = (PVOID)((ULONG_PTR)p + DirectoryInfo->TypeName.Length);
670  *p++ = UNICODE_NULL;
671 
672  /* Move to the next entry */
673  DirectoryInfo++;
674  }
675 
676  /* Set the key */
677  *Context = CurrentEntry;
678  }
679 
680  _SEH2_TRY
681  {
682  /* Copy the buffer */
684  LocalBuffer,
687 
688  /* Check if the caller requested the return length and return it*/
690  }
692  {
693  /* Get the exception code */
695  }
696  _SEH2_END;
697 
698  /* Unlock the directory */
699  ObpReleaseDirectoryLock(Directory, &LookupContext);
700 
701  /* Dereference the directory and free our buffer */
703  ExFreePoolWithTag(LocalBuffer, OB_NAME_TAG);
704 
705  /* Return status to caller */
706  return Status;
707 }
708 
709 /*++
710 * @name NtCreateDirectoryObject
711 * @implemented NT4
712 *
713 * The NtOpenDirectoryObject routine creates or opens a directory object.
714 *
715 * @param DirectoryHandle
716 * Variable which receives the directory handle.
717 *
718 * @param DesiredAccess
719 * Desired access to the directory.
720 *
721 * @param ObjectAttributes
722 * Structure describing the directory.
723 *
724 * @return STATUS_SUCCESS or appropriate error value.
725 *
726 * @remarks None.
727 *
728 *--*/
729 NTSTATUS
730 NTAPI
734 {
736  HANDLE NewHandle;
739  PAGED_CODE();
740 
741  /* Check if we need to do any probing */
742  if (PreviousMode != KernelMode)
743  {
744  _SEH2_TRY
745  {
746  /* Probe the return handle */
748  }
750  {
751  /* Return the exception code */
753  }
754  _SEH2_END;
755  }
756 
757  /* Create the object */
761  PreviousMode,
762  NULL,
763  sizeof(OBJECT_DIRECTORY),
764  0,
765  0,
766  (PVOID*)&Directory);
767  if (!NT_SUCCESS(Status)) return Status;
768 
769  /* Setup the object */
772  Directory->SessionId = -1;
773 
774  /* Insert it into the handle table */
776  NULL,
778  0,
779  NULL,
780  &NewHandle);
781 
782  /* Enter SEH to protect write */
783  _SEH2_TRY
784  {
785  /* Return the handle back to the caller */
786  *DirectoryHandle = NewHandle;
787  }
789  {
790  /* Get the exception code */
792  }
793  _SEH2_END;
794 
795  /* Return status to caller */
796  return Status;
797 }
798 
799 /* EOF */
#define ProbeForWriteUlong(Ptr)
Definition: probe.h:36
NTSTATUS NTAPI ObOpenObjectByName(IN POBJECT_ATTRIBUTES ObjectAttributes, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, IN PACCESS_STATE PassedAccessState, IN ACCESS_MASK DesiredAccess, IN OUT PVOID ParseContext, OUT PHANDLE Handle)
Definition: obhandle.c:2529
POBJECT_DIRECTORY Directory
Definition: obtypes.h:432
static int Hash(const char *)
Definition: reader.c:2257
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
#define IN
Definition: typedefs.h:38
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
Type
Definition: Type.h:6
#define STATUS_NO_MORE_ENTRIES
Definition: ntstatus.h:193
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ BOOLEAN _In_ ULONG _In_opt_ PULONG _In_ BOOLEAN RestartScan
Definition: fltkernel.h:2298
struct _Entry Entry
Definition: kefuncs.h:640
USHORT MaximumLength
Definition: env_spec_w32.h:370
__wchar_t WCHAR
Definition: xmlstorage.h:180
uint16_t * PWSTR
Definition: typedefs.h:54
NTSTATUS NTAPI NtOpenDirectoryObject(OUT PHANDLE DirectoryHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: obdir.c:359
LONG NTSTATUS
Definition: precomp.h:26
UNICODE_STRING Name
Definition: obtypes.h:433
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ BOOLEAN ReturnSingleEntry
Definition: fltkernel.h:2295
_In_ BOOLEAN _In_ ULONG _Out_ PULONG HashValue
Definition: rtlfuncs.h:2039
static HANDLE DirectoryHandle
Definition: ObType.c:48
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
#define OBJECT_HEADER_TO_NAME_INFO(h)
Definition: obtypes.h:114
UCHAR NameInfoOffset
Definition: obtypes.h:494
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:2966
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:716
_In_ ULONG TotalLength
Definition: usbdlib.h:145
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:456
#define WCHAR
Definition: msvc.h:43
NTSYSAPI WCHAR NTAPI RtlUpcaseUnicodeChar(WCHAR Source)
PVOID Object
Definition: obtypes.h:401
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define PAGED_CODE()
Definition: video.h:57
FORCEINLINE VOID ObpReleaseDirectoryLock(IN POBJECT_DIRECTORY Directory, IN POBP_LOOKUP_CONTEXT Context)
Definition: ob_x.h:210
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
_SEH2_TRY
Definition: create.c:4250
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define OBJECT_TO_OBJECT_HEADER(o)
Definition: obtypes.h:111
struct _OBJECT_DIRECTORY_INFORMATION * POBJECT_DIRECTORY_INFORMATION
#define OB_DIR_TAG
Definition: tag.h:152
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:496
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define UNICODE_NULL
long LONG
Definition: pedump.c:60
_In_ ULONG BufferLength
Definition: usbdlib.h:225
struct NameRec_ * Name
Definition: cdprocs.h:464
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
FORCEINLINE VOID ObpAcquireDirectoryLockShared(IN POBJECT_DIRECTORY Directory, IN POBP_LOOKUP_CONTEXT Context)
Definition: ob_x.h:174
PVOID NTAPI ObpLookupEntryDirectory(IN POBJECT_DIRECTORY Directory, IN PUNICODE_STRING Name, IN ULONG Attributes, IN UCHAR SearchShadow, IN POBP_LOOKUP_CONTEXT Context)
Definition: obdir.c:123
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
POBJECT_TYPE ObpDirectoryObjectType
Definition: obdir.c:21
#define ExInitializePushLock
Definition: ex.h:985
_In_ const STRING _In_ BOOLEAN CaseInsensitive
Definition: rtlfuncs.h:2245
Definition: bufpool.h:45
void * PVOID
Definition: retypes.h:9
NTSTATUS NTAPI ObCreateObject(IN KPROCESSOR_MODE ProbeMode OPTIONAL, IN POBJECT_TYPE Type, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN KPROCESSOR_MODE AccessMode, IN OUT PVOID ParseContext OPTIONAL, IN ULONG ObjectSize, IN ULONG PagedPoolCharge OPTIONAL, IN ULONG NonPagedPoolCharge OPTIONAL, OUT PVOID *Object)
Definition: oblife.c:952
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
#define OB_NAME_TAG
Definition: tag.h:151
BOOLEAN ObpLUIDDeviceMapsEnabled
Definition: obdir.c:20
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
FORCEINLINE POBJECT_HEADER_NAME_INFO ObpReferenceNameInfo(IN POBJECT_HEADER ObjectHeader)
Definition: ob_x.h:102
ULONG HashValue
Definition: obtypes.h:403
Definition: obtypes.h:398
#define ProbeForWriteHandle(Ptr)
Definition: probe.h:43
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
unsigned char UCHAR
Definition: xmlstorage.h:181
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:414
#define STATUS_MORE_ENTRIES
Definition: udferr_usr.h:124
struct _OBJECT_DIRECTORY_INFORMATION OBJECT_DIRECTORY_INFORMATION
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI NtCreateDirectoryObject(OUT PHANDLE DirectoryHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: obdir.c:731
_Must_inspect_result_ _In_ USHORT _In_ PHIDP_PREPARSED_DATA _Out_writes_to_ LengthAttributes PHIDP_EXTENDED_ATTRIBUTES Attributes
Definition: hidpi.h:348
_SEH2_END
Definition: create.c:4424
FORCEINLINE VOID ObpInitializeLookupContext(IN POBP_LOOKUP_CONTEXT Context)
Definition: ob_x.h:221
NTSTATUS NTAPI ObInsertObject(IN PVOID Object, IN PACCESS_STATE AccessState OPTIONAL, IN ACCESS_MASK DesiredAccess, IN ULONG ObjectPointerBias, OUT PVOID *NewObject OPTIONAL, OUT PHANDLE Handle)
Definition: obhandle.c:2932
LONG NTAPI ExSystemExceptionFilter(VOID)
Definition: harderr.c:351
unsigned short USHORT
Definition: pedump.c:61
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
BOOLEAN NTAPI ObpInsertEntryDirectory(IN POBJECT_DIRECTORY Parent, IN POBP_LOOKUP_CONTEXT Context, IN POBJECT_HEADER ObjectHeader)
Definition: obdir.c:46
FORCEINLINE BOOLEAN ExConvertPushLockSharedToExclusive(IN PEX_PUSH_LOCK PushLock)
Definition: ex.h:1111
struct _OBJECT_DIRECTORY_ENTRY * ChainLink
Definition: obtypes.h:400
unsigned int * PULONG
Definition: retypes.h:1
#define DPRINT1
Definition: precomp.h:8
BOOLEAN NTAPI ObpDeleteEntryDirectory(POBP_LOOKUP_CONTEXT Context)
Definition: obdir.c:310
#define OUT
Definition: typedefs.h:39
#define ObReferenceObject
Definition: obfuncs.h:204
struct tagContext Context
Definition: acpixf.h:1012
unsigned int ULONG
Definition: retypes.h:1
#define DIRECTORY_QUERY
Definition: nt_native.h:1254
base for all directory entries
Definition: entries.h:138
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define ULONG_PTR
Definition: config.h:101
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
UNICODE_STRING Name
Definition: obtypes.h:383
GLfloat GLfloat p
Definition: glext.h:8902
POBJECT_TYPE Type
Definition: obtypes.h:493
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
_In_ BOOLEAN _In_ USHORT Directory
Definition: rtlfuncs.h:3718
return STATUS_SUCCESS
Definition: btrfs.c:2725
FORCEINLINE VOID ObpDereferenceNameInfo(IN POBJECT_HEADER_NAME_INFO HeaderNameInfo)
Definition: ob_x.h:143
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
ULONG ACCESS_MASK
Definition: nt_native.h:40
base of all file and directory entries
Definition: entries.h:82
UNICODE_STRING TypeName
Definition: obtypes.h:279
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68