ObjectBody->Permanent setting cleaned.
authorEmanuele Aliberti <ea@iol.it>
Sun, 23 Jan 2005 22:42:31 +0000 (22:42 +0000)
committerEmanuele Aliberti <ea@iol.it>
Sun, 23 Jan 2005 22:42:31 +0000 (22:42 +0000)
svn path=/trunk/; revision=13234

reactos/ntoskrnl/include/internal/ob.h
reactos/ntoskrnl/ob/ntobj.c

index 1d25c8a..59255ba 100644 (file)
@@ -297,6 +297,10 @@ VOID
 STDCALL
 ObQueryDeviceMapInformation(PEPROCESS Process, PPROCESS_DEVICEMAP_INFORMATION DeviceMapInfo);
 
+VOID FASTCALL
+ObpSetPermanentObject (IN PVOID ObjectBody, IN BOOLEAN Permanent);
+
+
 /* Security descriptor cache functions */
 
 NTSTATUS
index 40ff676..6889156 100644 (file)
@@ -206,9 +206,26 @@ NtQueryObject (IN HANDLE ObjectHandle,
 }
 
 
+/**********************************************************************
+ * NAME                                                        PRIVATE
+ *     ObpSetPermanentObject/2
+ *
+ * DESCRIPTION
+ *     Fast general purpose routine to set an object's permanent
+ *     attribute, given a  pointer to the object's body.
+ */
+VOID FASTCALL
+ObpSetPermanentObject (IN PVOID ObjectBody, IN BOOLEAN Permanent)
+{
+  POBJECT_HEADER ObjectHeader;
+
+  ObjectHeader = BODY_TO_HEADER(ObjectBody);
+  ObjectHeader->Permanent = Permanent;
+}
+
 /**********************************************************************
  * NAME                                                        EXPORTED
- *     ObMakeTemporaryObject
+ *     ObMakeTemporaryObject/1
  *
  * DESCRIPTION
  *
@@ -223,10 +240,7 @@ NtQueryObject (IN HANDLE ObjectHandle,
 VOID STDCALL
 ObMakeTemporaryObject(IN PVOID ObjectBody)
 {
-  POBJECT_HEADER ObjectHeader;
-
-  ObjectHeader = BODY_TO_HEADER(ObjectBody);
-  ObjectHeader->Permanent = FALSE;
+  ObpSetPermanentObject (ObjectBody, FALSE);
 }
 
 
@@ -245,25 +259,23 @@ ObMakeTemporaryObject(IN PVOID ObjectBody)
 NTSTATUS STDCALL
 NtMakeTemporaryObject(IN HANDLE ObjectHandle)
 {
-  POBJECT_HEADER ObjectHeader;
-  PVOID Object;
+  PVOID ObjectBody;
   NTSTATUS Status;
 
   Status = ObReferenceObjectByHandle(ObjectHandle,
                                     0,
                                     NULL,
                                     (KPROCESSOR_MODE)KeGetPreviousMode(),
-                                    &Object,
+                                    &ObjectBody,
                                     NULL);
   if (Status != STATUS_SUCCESS)
     {
       return Status;
     }
 
-  ObjectHeader = BODY_TO_HEADER(Object);
-  ObjectHeader->Permanent = FALSE;
+  ObpSetPermanentObject (ObjectBody, FALSE);
 
-  ObDereferenceObject(Object);
+  ObDereferenceObject(ObjectBody);
 
   return STATUS_SUCCESS;
 }
@@ -271,7 +283,7 @@ NtMakeTemporaryObject(IN HANDLE ObjectHandle)
 
 /**********************************************************************
  * NAME                                                        EXPORTED
- *     NtMakePermanentObject
+ *     NtMakePermanentObject/1
  *
  * DESCRIPTION
  *
@@ -286,25 +298,23 @@ NtMakeTemporaryObject(IN HANDLE ObjectHandle)
 NTSTATUS STDCALL
 NtMakePermanentObject(IN HANDLE ObjectHandle)
 {
-  POBJECT_HEADER ObjectHeader;
-  PVOID Object;
+  PVOID ObjectBody;
   NTSTATUS Status;
 
   Status = ObReferenceObjectByHandle(ObjectHandle,
                                     0,
                                     NULL,
                                     (KPROCESSOR_MODE)KeGetPreviousMode(),
-                                    &Object,
+                                    &ObjectBody,
                                     NULL);
   if (Status != STATUS_SUCCESS)
     {
       return Status;
     }
 
-  ObjectHeader = BODY_TO_HEADER(Object);
-  ObjectHeader->Permanent = TRUE;
+  ObpSetPermanentObject (ObjectBody, TRUE);
 
-  ObDereferenceObject(Object);
+  ObDereferenceObject(ObjectBody);
 
   return STATUS_SUCCESS;
 }