ReactOS  0.4.14-dev-57-g333b8f1
ob_x.h File Reference
#include "ex.h"
Include dependency graph for ob_x.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define OBP_LOCK_STATE_PRE_ACQUISITION_EXCLUSIVE   0xAAAA1234
 
#define OBP_LOCK_STATE_PRE_ACQUISITION_SHARED   0xBBBB1234
 
#define OBP_LOCK_STATE_POST_ACQUISITION_EXCLUSIVE   0xCCCC1234
 
#define OBP_LOCK_STATE_POST_ACQUISITION_SHARED   0xDDDD1234
 
#define OBP_LOCK_STATE_RELEASED   0xEEEE1234
 
#define OBP_LOCK_STATE_INITIALIZED   0xFFFF1234
 
#define OBP_NAME_LOOKASIDE_MAX_SIZE   248
 

Functions

FORCEINLINE ULONG ObpValidateAttributes (IN ULONG Attributes, IN KPROCESSOR_MODE PreviousMode)
 
FORCEINLINE ULONG ObpSelectObjectLockSlot (IN POBJECT_HEADER ObjectHeader)
 
FORCEINLINE VOID ObpAcquireObjectLock (IN POBJECT_HEADER ObjectHeader)
 
FORCEINLINE VOID ObpAcquireObjectLockShared (IN POBJECT_HEADER ObjectHeader)
 
FORCEINLINE VOID ObpReleaseObjectLock (IN POBJECT_HEADER ObjectHeader)
 
FORCEINLINE POBJECT_HEADER_NAME_INFO ObpReferenceNameInfo (IN POBJECT_HEADER ObjectHeader)
 
FORCEINLINE VOID ObpDereferenceNameInfo (IN POBJECT_HEADER_NAME_INFO HeaderNameInfo)
 
FORCEINLINE VOID ObpAcquireDirectoryLockShared (IN POBJECT_DIRECTORY Directory, IN POBP_LOOKUP_CONTEXT Context)
 
FORCEINLINE VOID ObpAcquireDirectoryLockExclusive (IN POBJECT_DIRECTORY Directory, IN POBP_LOOKUP_CONTEXT Context)
 
FORCEINLINE VOID ObpReleaseDirectoryLock (IN POBJECT_DIRECTORY Directory, IN POBP_LOOKUP_CONTEXT Context)
 
FORCEINLINE VOID ObpInitializeLookupContext (IN POBP_LOOKUP_CONTEXT Context)
 
FORCEINLINE VOID ObpReleaseLookupContextObject (IN POBP_LOOKUP_CONTEXT Context)
 
FORCEINLINE VOID ObpReleaseLookupContext (IN POBP_LOOKUP_CONTEXT Context)
 
FORCEINLINE VOID ObpEnterObjectTypeMutex (IN POBJECT_TYPE ObjectType)
 
FORCEINLINE VOID ObpLeaveObjectTypeMutex (IN POBJECT_TYPE ObjectType)
 
FORCEINLINE VOID ObpReleaseObjectCreateInformation (IN POBJECT_CREATE_INFORMATION ObjectCreateInfo)
 
FORCEINLINE PVOID ObpAllocateObjectCreateInfoBuffer (IN PP_NPAGED_LOOKASIDE_NUMBER Type)
 
FORCEINLINE VOID ObpFreeCapturedAttributes (IN PVOID Buffer, IN PP_NPAGED_LOOKASIDE_NUMBER Type)
 
FORCEINLINE VOID ObpFreeObjectCreateInformation (IN POBJECT_CREATE_INFORMATION ObjectCreateInfo)
 
FORCEINLINE VOID ObpCalloutStart (IN PKIRQL CalloutIrql)
 
FORCEINLINE VOID ObpCalloutEnd (IN KIRQL CalloutIrql, IN PCHAR Procedure, IN POBJECT_TYPE ObjectType, IN PVOID Object)
 

Macro Definition Documentation

◆ OBP_LOCK_STATE_INITIALIZED

#define OBP_LOCK_STATE_INITIALIZED   0xFFFF1234

Definition at line 16 of file ob_x.h.

◆ OBP_LOCK_STATE_POST_ACQUISITION_EXCLUSIVE

#define OBP_LOCK_STATE_POST_ACQUISITION_EXCLUSIVE   0xCCCC1234

Definition at line 13 of file ob_x.h.

◆ OBP_LOCK_STATE_POST_ACQUISITION_SHARED

#define OBP_LOCK_STATE_POST_ACQUISITION_SHARED   0xDDDD1234

Definition at line 14 of file ob_x.h.

◆ OBP_LOCK_STATE_PRE_ACQUISITION_EXCLUSIVE

#define OBP_LOCK_STATE_PRE_ACQUISITION_EXCLUSIVE   0xAAAA1234

Definition at line 11 of file ob_x.h.

◆ OBP_LOCK_STATE_PRE_ACQUISITION_SHARED

#define OBP_LOCK_STATE_PRE_ACQUISITION_SHARED   0xBBBB1234

Definition at line 12 of file ob_x.h.

◆ OBP_LOCK_STATE_RELEASED

#define OBP_LOCK_STATE_RELEASED   0xEEEE1234

Definition at line 15 of file ob_x.h.

◆ OBP_NAME_LOOKASIDE_MAX_SIZE

#define OBP_NAME_LOOKASIDE_MAX_SIZE   248

Definition at line 18 of file ob_x.h.

Function Documentation

◆ ObpAcquireDirectoryLockExclusive()

FORCEINLINE VOID ObpAcquireDirectoryLockExclusive ( IN POBJECT_DIRECTORY  Directory,
IN POBP_LOOKUP_CONTEXT  Context 
)

Definition at line 190 of file ob_x.h.

192 {
193  /* Update lock flag */
195 
196  /* Acquire an exclusive directory lock */
199 
200  /* Set the directory */
201  Context->Directory = Directory;
202 
203  /* Update lock settings */
205  Context->DirectoryLocked = TRUE;
206 }
FORCEINLINE VOID ExAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1022
#define TRUE
Definition: types.h:120
#define KeEnterCriticalRegion()
Definition: ke_x.h:83
#define OBP_LOCK_STATE_POST_ACQUISITION_EXCLUSIVE
Definition: ob_x.h:13
base for all directory entries
Definition: entries.h:138
_In_ BOOLEAN _In_ USHORT Directory
Definition: rtlfuncs.h:3734
#define OBP_LOCK_STATE_PRE_ACQUISITION_EXCLUSIVE
Definition: ob_x.h:11

Referenced by ObCreateObjectType(), ObInitSystem(), ObpDeleteNameCheck(), and ObpLookupObjectName().

◆ ObpAcquireDirectoryLockShared()

FORCEINLINE VOID ObpAcquireDirectoryLockShared ( IN POBJECT_DIRECTORY  Directory,
IN POBP_LOOKUP_CONTEXT  Context 
)

Definition at line 174 of file ob_x.h.

176 {
177  /* It's not, set lock flag */
178  Context->LockStateSignature = OBP_LOCK_STATE_PRE_ACQUISITION_SHARED;
179 
180  /* Lock it */
183 
184  /* Update lock flag */
185  Context->LockStateSignature = OBP_LOCK_STATE_POST_ACQUISITION_SHARED;
186 }
#define OBP_LOCK_STATE_POST_ACQUISITION_SHARED
Definition: ob_x.h:14
#define KeEnterCriticalRegion()
Definition: ke_x.h:83
FORCEINLINE VOID ExAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1091
#define OBP_LOCK_STATE_PRE_ACQUISITION_SHARED
Definition: ob_x.h:12
base for all directory entries
Definition: entries.h:138

Referenced by NtQueryDirectoryObject(), and ObpLookupEntryDirectory().

◆ ObpAcquireObjectLock()

FORCEINLINE VOID ObpAcquireObjectLock ( IN POBJECT_HEADER  ObjectHeader)

Definition at line 48 of file ob_x.h.

49 {
50  ULONG Slot;
51  POBJECT_TYPE ObjectType = ObjectHeader->Type;
52 
53  /* Sanity check */
55 
56  /* Pick a slot */
57  Slot = ObpSelectObjectLockSlot(ObjectHeader);
58 
59  /* Enter a critical region and acquire the resource */
61  ExAcquireResourceExclusiveLite(&ObjectType->ObjectLocks[Slot], TRUE);
62 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
ObjectType
Definition: metafile.c:80
#define TRUE
Definition: types.h:120
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
FORCEINLINE ULONG ObpSelectObjectLockSlot(IN POBJECT_HEADER ObjectHeader)
Definition: ob_x.h:40
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define KeEnterCriticalRegion()
Definition: ke_x.h:83
unsigned int ULONG
Definition: retypes.h:1
#define APC_LEVEL
Definition: env_spec_w32.h:695

Referenced by NtQuerySymbolicLinkObject(), ObInsertObject(), ObpDecrementHandleCount(), ObpDeleteNameCheck(), ObpIncrementHandleCount(), ObpIncrementUnnamedHandleCount(), ObpSetPermanentObject(), and ObSetSecurityDescriptorInfo().

◆ ObpAcquireObjectLockShared()

FORCEINLINE VOID ObpAcquireObjectLockShared ( IN POBJECT_HEADER  ObjectHeader)

Definition at line 66 of file ob_x.h.

67 {
68  ULONG Slot;
69  POBJECT_TYPE ObjectType = ObjectHeader->Type;
70 
71  /* Sanity check */
73 
74  /* Pick a slot */
75  Slot = ObpSelectObjectLockSlot(ObjectHeader);
76 
77  /* Enter a critical region and acquire the resource */
79  ExAcquireResourceSharedLite(&ObjectType->ObjectLocks[Slot], TRUE);
80 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
ObjectType
Definition: metafile.c:80
#define TRUE
Definition: types.h:120
FORCEINLINE ULONG ObpSelectObjectLockSlot(IN POBJECT_HEADER ObjectHeader)
Definition: ob_x.h:40
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define KeEnterCriticalRegion()
Definition: ke_x.h:83
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
unsigned int ULONG
Definition: retypes.h:1
#define APC_LEVEL
Definition: env_spec_w32.h:695

Referenced by ObpReferenceSecurityDescriptor().

◆ ObpAllocateObjectCreateInfoBuffer()

FORCEINLINE PVOID ObpAllocateObjectCreateInfoBuffer ( IN PP_NPAGED_LOOKASIDE_NUMBER  Type)

Definition at line 311 of file ob_x.h.

312 {
313  PVOID Buffer;
315  PKPRCB Prcb = KeGetCurrentPrcb();
316 
317  /* Get the P list first */
319 
320  /* Attempt allocation */
321  List->L.TotalAllocates++;
322  Buffer = (PVOID)InterlockedPopEntrySList(&List->L.ListHead);
323  if (!Buffer)
324  {
325  /* Let the balancer know that the P list failed */
326  List->L.AllocateMisses++;
327 
328  /* Try the L List */
330  List->L.TotalAllocates++;
331  Buffer = (PVOID)InterlockedPopEntrySList(&List->L.ListHead);
332  if (!Buffer)
333  {
334  /* Let the balancer know the L list failed too */
335  List->L.AllocateMisses++;
336 
337  /* Allocate it */
338  Buffer = List->L.Allocate(List->L.Type, List->L.Size, List->L.Tag);
339  }
340  }
341 
342  /* Return buffer */
343  return Buffer;
344 }
Type
Definition: Type.h:6
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1062
PSLIST_ENTRY WINAPI InterlockedPopEntrySList(PSLIST_HEADER ListHead)
Definition: interlocked.c:55
struct LOOKASIDE_ALIGN _NPAGED_LOOKASIDE_LIST * PNPAGED_LOOKASIDE_LIST
PP_LOOKASIDE_LIST PPLookasideList[16]
Definition: ketypes.h:624
Definition: bufpool.h:45
LIST_ENTRY List
Definition: psmgr.c:57
struct _GENERAL_LOOKASIDE * L
Definition: ketypes.h:760
struct _GENERAL_LOOKASIDE * P
Definition: ketypes.h:759
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

Referenced by ObCreateObject(), and ObpAllocateObjectNameBuffer().

◆ ObpCalloutEnd()

FORCEINLINE VOID ObpCalloutEnd ( IN KIRQL  CalloutIrql,
IN PCHAR  Procedure,
IN POBJECT_TYPE  ObjectType,
IN PVOID  Object 
)

◆ ObpCalloutStart()

FORCEINLINE VOID ObpCalloutStart ( IN PKIRQL  CalloutIrql)

◆ ObpDereferenceNameInfo()

FORCEINLINE VOID ObpDereferenceNameInfo ( IN POBJECT_HEADER_NAME_INFO  HeaderNameInfo)

Definition at line 143 of file ob_x.h.

144 {
146 
147  /* Bail out if there's no info at all */
148  if (!HeaderNameInfo) return;
149 
150  /* Remove a query reference and check if it was the last one */
151  if (!InterlockedDecrement((PLONG)&HeaderNameInfo->QueryReferences))
152  {
153  /* Check if we have a name */
154  if (HeaderNameInfo->Name.Buffer)
155  {
156  /* We can get rid of the object name now */
157  ExFreePoolWithTag(HeaderNameInfo->Name.Buffer, OB_NAME_TAG);
158  RtlInitEmptyUnicodeString(&HeaderNameInfo->Name, NULL, 0);
159  }
160 
161  /* Check if the object has a directory associated to it */
162  Directory = HeaderNameInfo->Directory;
163  if (Directory)
164  {
165  /* Delete the directory */
166  HeaderNameInfo->Directory = NULL;
168  }
169  }
170 }
VOID NTAPI ObDereferenceObjectDeferDelete(IN PVOID Object)
Definition: obref.c:360
smooth NULL
Definition: ftsmooth.c:416
Directory()
Definition: entries.h:140
#define OB_NAME_TAG
Definition: tag.h:151
#define InterlockedDecrement
Definition: armddk.h:52
base for all directory entries
Definition: entries.h:138
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
_In_ BOOLEAN _In_ USHORT Directory
Definition: rtlfuncs.h:3734
signed int * PLONG
Definition: retypes.h:5

Referenced by ObInsertObject(), ObpCreateSymbolicLinkName(), ObpDeleteNameCheck(), ObpLookupEntryDirectory(), ObpProcessDosDeviceSymbolicLink(), ObpReleaseLookupContextObject(), ObSetDeviceMap(), and ObSetDirectoryDeviceMap().

◆ ObpEnterObjectTypeMutex()

FORCEINLINE VOID ObpEnterObjectTypeMutex ( IN POBJECT_TYPE  ObjectType)

Definition at line 272 of file ob_x.h.

273 {
274  /* Sanity check */
276 
277  /* Enter a critical region and acquire the resource */
280 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
ObjectType
Definition: metafile.c:80
#define TRUE
Definition: types.h:120
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define KeEnterCriticalRegion()
Definition: ke_x.h:83
#define APC_LEVEL
Definition: env_spec_w32.h:695

Referenced by ObCreateObjectType(), ObpDeleteObject(), ObpIncrementHandleCount(), ObpIncrementUnnamedHandleCount(), ObSetDeviceMap(), and ObSetDirectoryDeviceMap().

◆ ObpFreeCapturedAttributes()

FORCEINLINE VOID ObpFreeCapturedAttributes ( IN PVOID  Buffer,
IN PP_NPAGED_LOOKASIDE_NUMBER  Type 
)

Definition at line 348 of file ob_x.h.

350 {
352  PKPRCB Prcb = KeGetCurrentPrcb();
353 
354  /* Use the P List */
356  List->L.TotalFrees++;
357 
358  /* Check if the Free was within the Depth or not */
359  if (ExQueryDepthSList(&List->L.ListHead) >= List->L.Depth)
360  {
361  /* Let the balancer know */
362  List->L.FreeMisses++;
363 
364  /* Use the L List */
366  List->L.TotalFrees++;
367 
368  /* Check if the Free was within the Depth or not */
369  if (ExQueryDepthSList(&List->L.ListHead) >= List->L.Depth)
370  {
371  /* All lists failed, use the pool */
372  List->L.FreeMisses++;
373  List->L.Free(Buffer);
374  }
375  else
376  {
377  /* The free was within the Depth */
378  InterlockedPushEntrySList(&List->L.ListHead,
380  }
381  }
382  else
383  {
384  /* The free was within the Depth */
385  InterlockedPushEntrySList(&List->L.ListHead,
387  }
388 }
Type
Definition: Type.h:6
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1062
struct LOOKASIDE_ALIGN _NPAGED_LOOKASIDE_LIST * PNPAGED_LOOKASIDE_LIST
PP_LOOKASIDE_LIST PPLookasideList[16]
Definition: ketypes.h:624
Definition: bufpool.h:45
LIST_ENTRY List
Definition: psmgr.c:57
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define PSLIST_ENTRY
Definition: rtltypes.h:130
FORCEINLINE USHORT ExQueryDepthSList(_In_ PSLIST_HEADER SListHead)
Definition: exfuncs.h:153
struct _GENERAL_LOOKASIDE * L
Definition: ketypes.h:760
NTKERNELAPI PSLIST_ENTRY FASTCALL InterlockedPushEntrySList(IN PSLIST_HEADER ListHead, IN PSLIST_ENTRY ListEntry)
Definition: interlocked.c:82
struct _GENERAL_LOOKASIDE * P
Definition: ketypes.h:759

Referenced by ObCreateObject(), ObFreeObjectCreateInfoBuffer(), ObpFreeObjectCreateInformation(), and ObpFreeObjectNameBuffer().

◆ ObpFreeObjectCreateInformation()

FORCEINLINE VOID ObpFreeObjectCreateInformation ( IN POBJECT_CREATE_INFORMATION  ObjectCreateInfo)

Definition at line 392 of file ob_x.h.

393 {
394  /* First release the attributes, then free them from the lookaside list */
395  ObpReleaseObjectCreateInformation(ObjectCreateInfo);
397 }
FORCEINLINE VOID ObpFreeCapturedAttributes(IN PVOID Buffer, IN PP_NPAGED_LOOKASIDE_NUMBER Type)
Definition: ob_x.h:348
FORCEINLINE VOID ObpReleaseObjectCreateInformation(IN POBJECT_CREATE_INFORMATION ObjectCreateInfo)
Definition: ob_x.h:296

Referenced by ObCreateObject(), ObDeleteCapturedInsertInfo(), ObInsertObject(), ObOpenObjectByName(), and ObpDeallocateObject().

◆ ObpInitializeLookupContext()

FORCEINLINE VOID ObpInitializeLookupContext ( IN POBP_LOOKUP_CONTEXT  Context)

Definition at line 221 of file ob_x.h.

222 {
223  /* Initialize a null context */
224  Context->Object = NULL;
225  Context->Directory = NULL;
226  Context->DirectoryLocked = FALSE;
227  Context->LockStateSignature = OBP_LOCK_STATE_INITIALIZED;
228 }
#define OBP_LOCK_STATE_INITIALIZED
Definition: ob_x.h:16
smooth NULL
Definition: ftsmooth.c:416

Referenced by NtQueryDirectoryObject(), ObCreateObjectType(), ObInitSystem(), ObInsertObject(), ObpDeleteNameCheck(), ObpLookupObjectName(), and ObpProcessDosDeviceSymbolicLink().

◆ ObpLeaveObjectTypeMutex()

FORCEINLINE VOID ObpLeaveObjectTypeMutex ( IN POBJECT_TYPE  ObjectType)

Definition at line 284 of file ob_x.h.

285 {
286  /* Enter a critical region and acquire the resource */
289 
290  /* Sanity check */
292 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
ObjectType
Definition: metafile.c:80
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define KeLeaveCriticalRegion()
Definition: ke_x.h:114
#define APC_LEVEL
Definition: env_spec_w32.h:695

Referenced by ObCreateObjectType(), ObpDeleteObject(), ObpIncrementHandleCount(), ObpIncrementUnnamedHandleCount(), ObSetDeviceMap(), and ObSetDirectoryDeviceMap().

◆ ObpReferenceNameInfo()

FORCEINLINE POBJECT_HEADER_NAME_INFO ObpReferenceNameInfo ( IN POBJECT_HEADER  ObjectHeader)

Definition at line 102 of file ob_x.h.

103 {
104  POBJECT_HEADER_NAME_INFO ObjectNameInfo;
105  ULONG NewValue, References;
106 
107  /* Make sure we have name information at all */
108  ObjectNameInfo = OBJECT_HEADER_TO_NAME_INFO(ObjectHeader);
109  if (!ObjectNameInfo) return NULL;
110 
111  /* Get the number of references */
112  References = ObjectNameInfo->QueryReferences;
113  for (;;)
114  {
115  /* Check if the count is 0 and fail if so */
116  if (!References) return NULL;
117 
118  /* Increment the number of references */
119  NewValue = InterlockedCompareExchange((PLONG)&ObjectNameInfo->
120  QueryReferences,
121  References + 1,
122  References);
123  if (NewValue == References) break;
124 
125  /* We failed, try again */
126  References = NewValue;
127  }
128 
129  /* Check for magic flag */
130  if (ObjectNameInfo->QueryReferences & 0x80000000)
131  {
132  /* FIXME: Unhandled*/
133  DbgPrint("OB: Unhandled path\n");
134  ASSERT(FALSE);
135  }
136 
137  /* Return the name information */
138  return ObjectNameInfo;
139 }
#define DbgPrint
Definition: loader.c:25
#define InterlockedCompareExchange
Definition: interlocked.h:104
#define OBJECT_HEADER_TO_NAME_INFO(h)
Definition: obtypes.h:114
smooth NULL
Definition: ftsmooth.c:416
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
unsigned int ULONG
Definition: retypes.h:1
signed int * PLONG
Definition: retypes.h:5

Referenced by ObInsertObject(), ObpCreateSymbolicLinkName(), ObpDeleteNameCheck(), ObpLookupEntryDirectory(), ObpProcessDosDeviceSymbolicLink(), ObSetDeviceMap(), and ObSetDirectoryDeviceMap().

◆ ObpReleaseDirectoryLock()

FORCEINLINE VOID ObpReleaseDirectoryLock ( IN POBJECT_DIRECTORY  Directory,
IN POBP_LOOKUP_CONTEXT  Context 
)

Definition at line 210 of file ob_x.h.

212 {
213  /* Release the lock */
215  Context->LockStateSignature = OBP_LOCK_STATE_RELEASED;
217 }
#define OBP_LOCK_STATE_RELEASED
Definition: ob_x.h:15
FORCEINLINE VOID ExReleasePushLock(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1282
#define KeLeaveCriticalRegion()
Definition: ke_x.h:114
base for all directory entries
Definition: entries.h:138

Referenced by NtQueryDirectoryObject(), ObpLookupEntryDirectory(), and ObpReleaseLookupContext().

◆ ObpReleaseLookupContext()

FORCEINLINE VOID ObpReleaseLookupContext ( IN POBP_LOOKUP_CONTEXT  Context)

Definition at line 255 of file ob_x.h.

256 {
257  /* Check if we came back with the directory locked */
258  if (Context->DirectoryLocked)
259  {
260  /* Release the lock */
262  Context->Directory = NULL;
263  Context->DirectoryLocked = FALSE;
264  }
265 
266  /* Clear the context */
268 }
FORCEINLINE VOID ObpReleaseDirectoryLock(IN POBJECT_DIRECTORY Directory, IN POBP_LOOKUP_CONTEXT Context)
Definition: ob_x.h:210
smooth NULL
Definition: ftsmooth.c:416
FORCEINLINE VOID ObpReleaseLookupContextObject(IN POBP_LOOKUP_CONTEXT Context)
Definition: ob_x.h:232

Referenced by ObCreateObjectType(), ObInitSystem(), ObInsertObject(), ObOpenObjectByName(), ObpCreateHandle(), ObpDeleteNameCheck(), ObpLookupObjectName(), ObpProcessDosDeviceSymbolicLink(), and ObReferenceObjectByName().

◆ ObpReleaseLookupContextObject()

FORCEINLINE VOID ObpReleaseLookupContextObject ( IN POBP_LOOKUP_CONTEXT  Context)

Definition at line 232 of file ob_x.h.

233 {
234  POBJECT_HEADER ObjectHeader;
235  POBJECT_HEADER_NAME_INFO HeaderNameInfo;
236 
237  /* Check if we had found an object */
238  if (Context->Object)
239  {
240  /* Get the object name information */
241  ObjectHeader = OBJECT_TO_OBJECT_HEADER(Context->Object);
242  HeaderNameInfo = OBJECT_HEADER_TO_NAME_INFO(ObjectHeader);
243 
244  /* release the name information */
245  ObpDereferenceNameInfo(HeaderNameInfo);
246 
247  /* Dereference the object */
248  ObDereferenceObject(Context->Object);
249  Context->Object = NULL;
250  }
251 }
#define OBJECT_HEADER_TO_NAME_INFO(h)
Definition: obtypes.h:114
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
#define OBJECT_TO_OBJECT_HEADER(o)
Definition: obtypes.h:111
smooth NULL
Definition: ftsmooth.c:416
FORCEINLINE VOID ObpDereferenceNameInfo(IN POBJECT_HEADER_NAME_INFO HeaderNameInfo)
Definition: ob_x.h:143

Referenced by ObpReleaseLookupContext().

◆ ObpReleaseObjectCreateInformation()

FORCEINLINE VOID ObpReleaseObjectCreateInformation ( IN POBJECT_CREATE_INFORMATION  ObjectCreateInfo)

Definition at line 296 of file ob_x.h.

297 {
298  /* Check if we have a security descriptor */
299  if (ObjectCreateInfo->SecurityDescriptor)
300  {
301  /* Release it */
302  SeReleaseSecurityDescriptor(ObjectCreateInfo->SecurityDescriptor,
303  ObjectCreateInfo->ProbeMode,
304  TRUE);
305  ObjectCreateInfo->SecurityDescriptor = NULL;
306  }
307 }
#define TRUE
Definition: types.h:120
NTSTATUS NTAPI SeReleaseSecurityDescriptor(IN PSECURITY_DESCRIPTOR CapturedSecurityDescriptor, IN KPROCESSOR_MODE CurrentMode, IN BOOLEAN CaptureIfKernelMode)
Definition: sd.c:766
smooth NULL
Definition: ftsmooth.c:416

Referenced by ObOpenObjectByName(), ObpCaptureObjectCreateInformation(), and ObpFreeObjectCreateInformation().

◆ ObpReleaseObjectLock()

FORCEINLINE VOID ObpReleaseObjectLock ( IN POBJECT_HEADER  ObjectHeader)

Definition at line 84 of file ob_x.h.

85 {
86  ULONG Slot;
87  POBJECT_TYPE ObjectType = ObjectHeader->Type;
88 
89  /* Pick a slot */
90  Slot = ObpSelectObjectLockSlot(ObjectHeader);
91 
92  /* Release the resource and leave a critical region */
93  ExReleaseResourceLite(&ObjectType->ObjectLocks[Slot]);
95 
96  /* Sanity check */
98 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
ObjectType
Definition: metafile.c:80
FORCEINLINE ULONG ObpSelectObjectLockSlot(IN POBJECT_HEADER ObjectHeader)
Definition: ob_x.h:40
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define KeLeaveCriticalRegion()
Definition: ke_x.h:114
unsigned int ULONG
Definition: retypes.h:1
#define APC_LEVEL
Definition: env_spec_w32.h:695

Referenced by NtQuerySymbolicLinkObject(), ObInsertObject(), ObpDecrementHandleCount(), ObpDeleteNameCheck(), ObpIncrementHandleCount(), ObpIncrementUnnamedHandleCount(), ObpReferenceSecurityDescriptor(), ObpSetPermanentObject(), and ObSetSecurityDescriptorInfo().

◆ ObpSelectObjectLockSlot()

FORCEINLINE ULONG ObpSelectObjectLockSlot ( IN POBJECT_HEADER  ObjectHeader)

Definition at line 40 of file ob_x.h.

41 {
42  /* We have 4 locks total, this will return a 0-index slot */
43  return (((ULONG_PTR)ObjectHeader) >> 8) & 3;
44 }
uint32_t ULONG_PTR
Definition: typedefs.h:63

Referenced by ObpAcquireObjectLock(), ObpAcquireObjectLockShared(), and ObpReleaseObjectLock().

◆ ObpValidateAttributes()

FORCEINLINE ULONG ObpValidateAttributes ( IN ULONG  Attributes,
IN KPROCESSOR_MODE  PreviousMode 
)

Definition at line 22 of file ob_x.h.

24 {
25  if (PreviousMode == KernelMode)
26  {
27  /* For kernel, allow any valid attributes */
29  }
30  else
31  {
32  /* For user, mask out kernel-only attributes */
33  return (Attributes & OBJ_VALID_ATTRIBUTES) &
35  }
36 }
#define OBJ_VALID_KERNEL_ATTRIBUTES
Definition: obtypes.h:92
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
_Must_inspect_result_ _In_ USHORT _In_ PHIDP_PREPARSED_DATA _Out_writes_to_ LengthAttributes PHIDP_EXTENDED_ATTRIBUTES Attributes
Definition: hidpi.h:348
#define OBJ_VALID_ATTRIBUTES
Definition: winternl.h:233
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231

Referenced by NtOpenProcess(), NtOpenProcessTokenEx(), NtOpenThread(), NtOpenThreadTokenEx(), and ProbeAndCaptureObjectAttributes().