ReactOS  0.4.14-dev-98-gb0d4763
devicemap.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/devicemap.c
5  * PURPOSE: Device map implementation
6  * PROGRAMMERS: Eric Kohl (eric.kohl@reactos.org)
7  * Alex Ionescu (alex.ionescu@reactos.org)
8  * Pierre Schweitzer (pierre@reactos.org)
9  */
10 
11 /* INCLUDES ***************************************************************/
12 
13 #include <ntoskrnl.h>
14 #define NDEBUG
15 #include <debug.h>
16 
19 
20 /* PRIVATE FUNCTIONS ******************************************************/
21 
23 NTAPI
26 {
27  POBJECT_DIRECTORY DirectoryObject = NULL;
28  PDEVICE_MAP DeviceMap = NULL, NewDeviceMap = NULL, OldDeviceMap;
30  PEPROCESS WorkProcess;
31  BOOLEAN MakePermanant = FALSE;
32 
37  (PVOID*)&DirectoryObject,
38  NULL);
39  if (!NT_SUCCESS(Status))
40  {
41  DPRINT("ObReferenceObjectByHandle() failed (Status 0x%08lx)\n", Status);
42  return Status;
43  }
44 
45  /* Allocate and initialize a new device map */
46  DeviceMap = ExAllocatePoolWithTag(PagedPool,
47  sizeof(*DeviceMap),
48  'mDbO');
49  if (DeviceMap == NULL)
50  {
51  ObDereferenceObject(DirectoryObject);
53  }
54 
55  /* Initialize the device map */
56  RtlZeroMemory(DeviceMap, sizeof(*DeviceMap));
57  DeviceMap->ReferenceCount = 1;
58  DeviceMap->DosDevicesDirectory = DirectoryObject;
59 
60  /* Acquire the device map lock */
62 
63  /* Attach the device map to the directory object */
64  if (DirectoryObject->DeviceMap == NULL)
65  {
66  DirectoryObject->DeviceMap = DeviceMap;
67  }
68  else
69  {
70  NewDeviceMap = DeviceMap;
71 
72  /* There's already a device map,
73  so reuse it */
74  DeviceMap = DirectoryObject->DeviceMap;
75  ++DeviceMap->ReferenceCount;
76  }
77 
78  /* Caller gave a process, use it */
79  if (Process != NULL)
80  {
81  WorkProcess = Process;
82  }
83  /* If no process given, use current and
84  * set system device map */
85  else
86  {
87  WorkProcess = PsGetCurrentProcess();
88  ObSystemDeviceMap = DeviceMap;
89  }
90 
91  /* If current object isn't system one, save system one in current
92  * device map */
93  if (DirectoryObject != ObSystemDeviceMap->DosDevicesDirectory)
94  {
95  /* We also need to make the object permanant */
97  MakePermanant = TRUE;
98  }
99 
100  /* Save old process device map */
101  OldDeviceMap = WorkProcess->DeviceMap;
102  /* Attach the device map to the process */
103  WorkProcess->DeviceMap = DeviceMap;
104 
105  /* Release the device map lock */
107 
108  /* If we have to make the object permamant, do it now */
109  if (MakePermanant)
110  {
111  POBJECT_HEADER ObjectHeader;
112  POBJECT_HEADER_NAME_INFO HeaderNameInfo;
113 
114  ObjectHeader = OBJECT_TO_OBJECT_HEADER(DirectoryObject);
115  HeaderNameInfo = ObpReferenceNameInfo(ObjectHeader);
116 
117  ObpEnterObjectTypeMutex(ObjectHeader->Type);
118  if (HeaderNameInfo != NULL && HeaderNameInfo->Directory != NULL)
119  {
120  ObjectHeader->Flags |= OB_FLAG_PERMANENT;
121  }
122  ObpLeaveObjectTypeMutex(ObjectHeader->Type);
123 
124  if (HeaderNameInfo != NULL)
125  {
126  ObpDereferenceNameInfo(HeaderNameInfo);
127  }
128  }
129 
130  /* Release useless device map if required */
131  if (NewDeviceMap != NULL)
132  {
133  ObDereferenceObject(DirectoryObject);
134  ExFreePoolWithTag(NewDeviceMap, 'mDbO');
135  }
136 
137  /* And dereference previous process device map */
138  if (OldDeviceMap != NULL)
139  {
140  ObfDereferenceDeviceMap(OldDeviceMap);
141  }
142 
143  return STATUS_SUCCESS;
144 }
145 
146 
147 NTSTATUS
148 NTAPI
151 {
152  POBJECT_DIRECTORY DirectoryObject = NULL;
153  PDEVICE_MAP LocalMap = NULL, NewDeviceMap = NULL;
155  POBJECT_HEADER ObjectHeader;
156  POBJECT_HEADER_NAME_INFO HeaderNameInfo;
157 
161  KernelMode,
162  (PVOID*)&DirectoryObject,
163  NULL);
164  if (!NT_SUCCESS(Status))
165  {
166  DPRINT("ObReferenceObjectByHandle() failed (Status 0x%08lx)\n", Status);
167  return Status;
168  }
169 
170  /* Allocate and initialize a new device map */
171  LocalMap = ExAllocatePoolWithTag(PagedPool,
172  sizeof(*LocalMap),
173  'mDbO');
174  if (LocalMap == NULL)
175  {
176  ObDereferenceObject(DirectoryObject);
178  }
179 
180  /* Initialize the device map */
181  RtlZeroMemory(LocalMap, sizeof(*LocalMap));
182  LocalMap->ReferenceCount = 1;
183  LocalMap->DosDevicesDirectory = DirectoryObject;
184 
185  /* Acquire the device map lock */
187 
188  /* Attach the device map to the directory object */
189  if (DirectoryObject->DeviceMap == NULL)
190  {
191  DirectoryObject->DeviceMap = LocalMap;
192  }
193  else
194  {
195  NewDeviceMap = LocalMap;
196 
197  /* There's already a device map,
198  so reuse it */
199  LocalMap = DirectoryObject->DeviceMap;
200  ++LocalMap->ReferenceCount;
201  }
202 
203  /* If current object isn't system one, save system one in current
204  * device map */
205  if (DirectoryObject != ObSystemDeviceMap->DosDevicesDirectory)
206  {
207  /* We also need to make the object permanant */
209  }
210 
211  /* Release the device map lock */
213 
214  if (DeviceMap != NULL)
215  {
216  *DeviceMap = LocalMap;
217  }
218 
219  /* Caller expects us to make the object permanant, so do it! */
220  ObjectHeader = OBJECT_TO_OBJECT_HEADER(DirectoryObject);
221  HeaderNameInfo = ObpReferenceNameInfo(ObjectHeader);
222 
223  ObpEnterObjectTypeMutex(ObjectHeader->Type);
224  if (HeaderNameInfo != NULL && HeaderNameInfo->Directory != NULL)
225  {
226  ObjectHeader->Flags |= OB_FLAG_PERMANENT;
227  }
228  ObpLeaveObjectTypeMutex(ObjectHeader->Type);
229 
230  if (HeaderNameInfo != NULL)
231  {
232  ObpDereferenceNameInfo(HeaderNameInfo);
233  }
234 
235  /* Release useless device map if required */
236  if (NewDeviceMap != NULL)
237  {
238  ObDereferenceObject(DirectoryObject);
239  ExFreePoolWithTag(NewDeviceMap, 'mDbO');
240  }
241 
242  return Status;
243 }
244 
245 
246 NTSTATUS
247 NTAPI
249 {
250  PTOKEN Token;
251  LUID LogonId;
254  LUID SystemLuid = SYSTEM_LUID;
255  PDEVICE_MAP DeviceMap, OldDeviceMap;
256 
257  /* Get our impersonation token */
260  if (Token == NULL)
261  {
262  return STATUS_NO_TOKEN;
263  }
264 
265  /* Query the Logon ID */
267  if (!NT_SUCCESS(Status))
268  {
269  goto done;
270  }
271 
272  /* If that's system, then use system device map */
273  if (RtlEqualLuid(&LogonId, &SystemLuid))
274  {
275  DeviceMap = ObSystemDeviceMap;
276  }
277  /* Otherwise ask Se for the device map */
278  else
279  {
280  Status = SeGetLogonIdDeviceMap(&LogonId, &DeviceMap);
281  if (!NT_SUCCESS(Status))
282  {
283  /* Normalize failure status */
285  goto done;
286  }
287  }
288 
289  /* Fail if no device map */
290  if (DeviceMap == NULL)
291  {
293  goto done;
294  }
295 
296  /* Acquire the device map lock */
298 
299  /* Save old device map attached to the process */
300  OldDeviceMap = CurrentProcess->DeviceMap;
301 
302  /* Set new device map & reference it */
303  ++DeviceMap->ReferenceCount;
304  CurrentProcess->DeviceMap = DeviceMap;
305 
306  /* Release the device map lock */
308 
309  /* If we had a device map, dereference it */
310  if (OldDeviceMap != NULL)
311  {
312  ObfDereferenceDeviceMap(OldDeviceMap);
313  }
314 
315 done:
316  /* We're done with the token! */
318 
319  return Status;
320 }
321 
322 
324 NTAPI
326 {
327  LUID LogonId;
329  PTOKEN Token = NULL;
330  PDEVICE_MAP DeviceMap;
331  PETHREAD CurrentThread;
332  BOOLEAN LookingForSystem;
333  LUID SystemLuid = SYSTEM_LUID;
336 
337  LookingForSystem = FALSE;
338 
339  /* If LUID mapping is enable, try to get appropriate device map */
340  if (ObpLUIDDeviceMapsEnabled != 0)
341  {
342  /* In case of impersonation, we've got a bit of work to do */
343  CurrentThread = PsGetCurrentThread();
344  if (CurrentThread->ActiveImpersonationInfo)
345  {
346  /* Get impersonation token */
347  Token = PsReferenceImpersonationToken(CurrentThread,
348  &CopyOnOpen,
349  &EffectiveOnly,
351  /* Get logon LUID */
352  if (Token != NULL)
353  {
355  }
356  else
357  {
358  /* Force failure */
360  }
361 
362  /* If we got logon LUID */
363  if (NT_SUCCESS(Status))
364  {
365  /*
366  * Check it's not system, system is easy to handle,
367  * we just need to return ObSystemDeviceMap
368  */
369  if (!RtlEqualLuid(&LogonId, &SystemLuid))
370  {
371  /* Ask Se for the device map */
372  Status = SeGetLogonIdDeviceMap(&LogonId, &DeviceMap);
373  if (NT_SUCCESS(Status))
374  {
375  /* Acquire the device map lock */
377 
378  /* Reference the device map if any */
379  if (DeviceMap != NULL)
380  {
381  ++DeviceMap->ReferenceCount;
382  }
383 
384  /* Release the device map lock */
386 
387  /* If we got the device map, we're done! */
388  if (DeviceMap != NULL)
389  {
391 
392  return DeviceMap;
393  }
394  }
395  }
396  else
397  {
398  LookingForSystem = TRUE;
399  }
400  }
401  }
402 
403  /*
404  * Fall back case of the LUID mapping, make sure there's a
405  * a device map attached to the current process
406  */
407  if (PsGetCurrentProcess()->DeviceMap == NULL &&
409  {
410  /* We may have failed after we got impersonation token */
411  if (Token != NULL)
412  {
414  }
415 
416  return NULL;
417  }
418  }
419 
420  /* Acquire the device map lock */
422 
423  /* If we're looking for system map, use it */
424  if (LookingForSystem)
425  {
426  DeviceMap = ObSystemDeviceMap;
427  }
428  /* Otherwise, use current process device map */
429  else
430  {
431  DeviceMap = PsGetCurrentProcess()->DeviceMap;
432  }
433 
434  /* If we got one, reference it */
435  if (DeviceMap != NULL)
436  {
437  ++DeviceMap->ReferenceCount;
438  }
439 
440  /* Release the device map lock */
442 
443  /* We may have impersonation token (if we failed in impersonation branch) */
444  if (Token != NULL)
445  {
447  }
448 
449  /* Return the potentially found device map */
450  return DeviceMap;
451 }
452 
453 
454 VOID
455 NTAPI
457 {
458  PDEVICE_MAP DeviceMap;
459 
460  DPRINT("ObDereferenceDeviceMap()\n");
461 
462  /* Get the pointer to this process devicemap and reset it
463  holding the device map lock */
465  DeviceMap = Process->DeviceMap;
466  Process->DeviceMap = NULL;
468 
469  /* Continue only if there is a device map */
470  if (DeviceMap != NULL)
471  ObfDereferenceDeviceMap(DeviceMap);
472 }
473 
474 
475 VOID
476 FASTCALL
478 {
479  DPRINT("ObfDereferenceDeviceMap()\n");
480 
481  /* Acquire the device map lock */
483 
484  /* Decrement the reference counter */
485  DeviceMap->ReferenceCount--;
486  DPRINT("ReferenceCount: %lu\n", DeviceMap->ReferenceCount);
487 
488  /* Leave, if there are still references to this device map */
489  if (DeviceMap->ReferenceCount != 0)
490  {
491  /* Release the device map lock and leave */
493  return;
494  }
495 
496  /* Nobody is referencing it anymore, unlink the DOS directory */
497  DeviceMap->DosDevicesDirectory->DeviceMap = NULL;
498 
499  /* Release the devicemap lock */
501 
502  /* Dereference the DOS Devices Directory and free the Device Map */
503  ObMakeTemporaryObject(DeviceMap->DosDevicesDirectory);
504  ObDereferenceObject(DeviceMap->DosDevicesDirectory);
505  ExFreePoolWithTag(DeviceMap, 'mDbO');
506 }
507 
508 
509 VOID
510 NTAPI
513 {
514  PDEVICE_MAP DeviceMap;
515 
516  DPRINT("ObInheritDeviceMap()\n");
517 
518  /* Acquire the device map lock */
520 
521  /* Get the parent process device map or the system device map */
522  DeviceMap = (Parent != NULL) ? Parent->DeviceMap : ObSystemDeviceMap;
523  if (DeviceMap != NULL)
524  {
525  /* Reference the device map and attach it to the new process */
526  DeviceMap->ReferenceCount++;
527  DPRINT("ReferenceCount: %lu\n", DeviceMap->ReferenceCount);
528 
529  Process->DeviceMap = DeviceMap;
530  }
531 
532  /* Release the device map lock */
534 }
535 
536 
537 NTSTATUS
538 NTAPI
540  IN PPROCESS_DEVICEMAP_INFORMATION DeviceMapInfo,
541  IN ULONG Flags)
542 {
543  PDEVICE_MAP DeviceMap = NULL, GlobalDeviceMap;
544  BOOLEAN Dereference;
546  ULONG BitMask, i;
547  BOOLEAN ReturnAny;
549 
550  /* Validate flags */
552  {
554  }
555 
556  Dereference = FALSE;
557  /* Do we want to return anything? */
558  ReturnAny = ~Flags & PROCESS_LUID_DOSDEVICES_ONLY;
559 
560  /* If LUID mappings are enabled... */
561  if (ObpLUIDDeviceMapsEnabled != 0)
562  {
563  /* Check for process parameter validness */
564  if (Process != NULL && Process != PsGetCurrentProcess())
565  {
567  }
568 
569  /* And get the device map */
570  DeviceMap = ObpReferenceDeviceMap();
571  }
572 
573  /* Acquire the device map lock */
575 
576  /*
577  * If we had a device map, if because of LUID mappings,
578  * we'll have to dereference it afterwards
579  */
580  if (DeviceMap != NULL)
581  {
582  Dereference = TRUE;
583  }
584  else
585  {
586  /* Get the process device map or the system device map */
587  DeviceMap = (Process != NULL) ? Process->DeviceMap : ObSystemDeviceMap;
588  }
589 
590  /* Fail if no device map */
591  if (DeviceMap == NULL)
592  {
594  return STATUS_END_OF_FILE;
595  }
596 
597  /* At that point, assume success */
599 
600  /* Try to get the global device map if any */
601  GlobalDeviceMap = DeviceMap;
602  if (DeviceMap->GlobalDosDevicesDirectory != NULL)
603  {
604  if (DeviceMap->GlobalDosDevicesDirectory->DeviceMap != NULL)
605  {
606  GlobalDeviceMap = DeviceMap->GlobalDosDevicesDirectory->DeviceMap;
607  }
608  }
609 
610  /* Now, setup our device map info, especially drive types */
611  MapInfo.Query.DriveMap = DeviceMap->DriveMap;
612  /* Browse every device */
613  for (i = 0, BitMask = 1; i < 32; ++i, BitMask *= 2)
614  {
615  /* Set the type given current device map */
616  MapInfo.Query.DriveType[i] = DeviceMap->DriveType[i];
617 
618  /*
619  * If device is not existing and we're asked to return
620  * more than just LUID mapped, get the entry
621  * from global device map if not remote
622  */
623  if (!(MapInfo.Query.DriveMap & BitMask) && ReturnAny)
624  {
625  if (ObpLUIDDeviceMapsEnabled != 0 ||
626  (GlobalDeviceMap->DriveType[i] != DOSDEVICE_DRIVE_REMOTE &&
627  GlobalDeviceMap->DriveType[i] != DOSDEVICE_DRIVE_CALCULATE))
628  {
629  MapInfo.Query.DriveType[i] = GlobalDeviceMap->DriveType[i];
630  MapInfo.Query.DriveMap |= BitMask & GlobalDeviceMap->DriveMap;
631  }
632  }
633  }
634 
635  /* Release the device map lock */
637 
638  /* Dereference LUID device map */
639  if (Dereference)
640  {
641  ObfDereferenceDeviceMap(DeviceMap);
642  }
643 
644  /* Copy back data */
645  _SEH2_TRY
646  {
647  RtlCopyMemory(DeviceMapInfo, &MapInfo, sizeof(PROCESS_DEVICEMAP_INFORMATION));
648  }
650  {
652  }
653  _SEH2_END;
654 
655  return Status;
656 }
657 
658 
659 ULONG
660 NTAPI
662 {
664 }
665 
666 
667 #if 0
668 NTSTATUS
669 NTAPI
670 ObIsDosDeviceLocallyMapped(
671  IN ULONG Index,
672  OUT PUCHAR DosDeviceState)
673 {
674  /* Check the index */
675  if (Index < 1 || Index > 26)
677 
678  /* Acquire the device map lock */
680 
681  /* Get drive mapping status */
682  *DosDeviceState = (ObSystemDeviceMap->DriveMap & (1 << Index)) != 0;
683 
684  /* Release the device map lock */
686 
687  return STATUS_SUCCESS;
688 }
689 #endif
690 
691 /* EOF */
POBJECT_DIRECTORY Directory
Definition: obtypes.h:432
#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
#define DOSDEVICE_DRIVE_REMOTE
Definition: obtypes.h:167
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
VOID FASTCALL KeAcquireGuardedMutex(IN PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:42
ULONG ObpLUIDDeviceMapsEnabled
Definition: devicemap.c:18
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
ULONG ObpLUIDDeviceMapsDisabled
Definition: devicemap.c:17
unsigned char * PUCHAR
Definition: retypes.h:3
#define KeGetPreviousMode()
Definition: ketypes.h:1107
LONG NTSTATUS
Definition: precomp.h:26
_IRQL_requires_same_ _In_ PLSA_STRING _In_ SECURITY_LOGON_TYPE _In_ ULONG _In_ ULONG _In_opt_ PTOKEN_GROUPS _In_ PTOKEN_SOURCE _Out_ PVOID _Out_ PULONG _Inout_ PLUID _Out_ PHANDLE Token
static HANDLE DirectoryHandle
Definition: ObType.c:48
_Out_ PBOOLEAN CopyOnOpen
Definition: psfuncs.h:154
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:722
PDEVICE_MAP NTAPI ObpReferenceDeviceMap(VOID)
Definition: devicemap.c:325
#define FASTCALL
Definition: nt_native.h:50
ULONG NTAPI ObIsLUIDDeviceMapsEnabled(VOID)
Definition: devicemap.c:661
#define OB_FLAG_PERMANENT
Definition: obtypes.h:101
_SEH2_TRY
Definition: create.c:4250
#define STATUS_END_OF_FILE
Definition: shellext.h:62
PVOID DeviceMap
Definition: pstypes.h:1244
#define OBJECT_TO_OBJECT_HEADER(o)
Definition: obtypes.h:111
ULONG DriveMap
Definition: obtypes.h:528
NTSTATUS NTAPI SeQueryAuthenticationIdToken(IN PACCESS_TOKEN Token, OUT PLUID LogonId)
Definition: token.c:1752
VOID NTAPI ObDereferenceDeviceMap(IN PEPROCESS Process)
Definition: devicemap.c:456
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
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
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 RtlEqualLuid(Luid1, Luid2)
Definition: rtlfuncs.h:301
enum _SECURITY_IMPERSONATION_LEVEL SECURITY_IMPERSONATION_LEVEL
NTSTATUS NTAPI SeGetLogonIdDeviceMap(IN PLUID LogonId, OUT PDEVICE_MAP *DeviceMap)
Definition: srm.c:966
#define DOSDEVICE_DRIVE_CALCULATE
Definition: obtypes.h:164
#define PsGetCurrentProcess
Definition: psfuncs.h:17
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
UCHAR Flags
Definition: obtypes.h:497
VOID FASTCALL ObfDereferenceDeviceMap(IN PDEVICE_MAP DeviceMap)
Definition: devicemap.c:477
POBJECT_DIRECTORY GlobalDosDevicesDirectory
Definition: obtypes.h:526
#define DIRECTORY_TRAVERSE
Definition: nt_native.h:1255
#define ObpDirectoryObjectType
Definition: ObTypes.c:123
ULONG CurrentProcess
Definition: shell.c:125
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
FORCEINLINE POBJECT_HEADER_NAME_INFO ObpReferenceNameInfo(IN POBJECT_HEADER ObjectHeader)
Definition: ob_x.h:102
_Out_ PBOOLEAN _Out_ PBOOLEAN _Out_ PSECURITY_IMPERSONATION_LEVEL ImpersonationLevel
Definition: psfuncs.h:154
FORCEINLINE VOID ObpEnterObjectTypeMutex(IN POBJECT_TYPE ObjectType)
Definition: ob_x.h:272
static const UCHAR Index[8]
Definition: usbohci.c:18
#define STATUS_NO_TOKEN
Definition: ntstatus.h:346
UCHAR DriveType[32]
Definition: obtypes.h:529
ULONG ActiveImpersonationInfo
Definition: pstypes.h:1112
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NTSTATUS NTAPI ObSetDirectoryDeviceMap(OUT PDEVICE_MAP *DeviceMap, IN HANDLE DirectoryHandle)
Definition: devicemap.c:149
NTSTATUS NTAPI ObQueryDeviceMapInformation(IN PEPROCESS Process, IN PPROCESS_DEVICEMAP_INFORMATION DeviceMapInfo, IN ULONG Flags)
Definition: devicemap.c:539
FORCEINLINE VOID ObpLeaveObjectTypeMutex(IN POBJECT_TYPE ObjectType)
Definition: ob_x.h:284
#define PROCESS_LUID_DOSDEVICES_ONLY
Definition: pstypes.h:228
struct _PROCESS_DEVICEMAP_INFORMATION::@3785::@3787 Query
NTSTATUS NTAPI ObSetDeviceMap(IN PEPROCESS Process, IN HANDLE DirectoryHandle)
Definition: devicemap.c:24
PACCESS_TOKEN NTAPI PsReferencePrimaryToken(PEPROCESS Process)
Definition: security.c:440
PDEVICE_MAP ObSystemDeviceMap
Definition: obinit.c:46
#define SYSTEM_LUID
Definition: setypes.h:672
Status
Definition: gdiplustypes.h:24
PACCESS_TOKEN NTAPI PsReferenceImpersonationToken(IN PETHREAD Thread, OUT PBOOLEAN CopyOnOpen, OUT PBOOLEAN EffectiveOnly, OUT PSECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
Definition: security.c:782
struct _DEVICE_MAP * DeviceMap
Definition: obtypes.h:418
_SEH2_END
Definition: create.c:4424
ULONG ReferenceCount
Definition: obtypes.h:527
#define STATUS_OBJECT_PATH_INVALID
Definition: ntstatus.h:279
_IRQL_requires_same_ _In_ PLSA_STRING _In_ SECURITY_LOGON_TYPE _In_ ULONG _In_ ULONG _In_opt_ PTOKEN_GROUPS _In_ PTOKEN_SOURCE _Out_ PVOID _Out_ PULONG _Inout_ PLUID LogonId
VOID FASTCALL KeReleaseGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:53
NTSTATUS NTAPI ObpSetCurrentProcessDeviceMap(VOID)
Definition: devicemap.c:248
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
#define OUT
Definition: typedefs.h:39
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
POBJECT_DIRECTORY DosDevicesDirectory
Definition: obtypes.h:525
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
POBJECT_TYPE Type
Definition: obtypes.h:493
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_ BOOLEAN EffectiveOnly
Definition: sefuncs.h:417
KGUARDED_MUTEX ObpDeviceMapLock
Definition: oblife.c:24
return STATUS_SUCCESS
Definition: btrfs.c:2966
FORCEINLINE VOID ObpDereferenceNameInfo(IN POBJECT_HEADER_NAME_INFO HeaderNameInfo)
Definition: ob_x.h:143
VOID NTAPI ObInheritDeviceMap(IN PEPROCESS Parent, IN PEPROCESS Process)
Definition: devicemap.c:511
VOID NTAPI ObMakeTemporaryObject(IN PVOID ObjectBody)
Definition: oblife.c:1361