[FASTFAT][FLTMGR][NTOS] Do not explicitly call ObfDereferenceObject() (#1636)
authorBișoc George <fraizeraust99@gmail.com>
Sat, 22 Jun 2019 14:20:58 +0000 (16:20 +0200)
committerHermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
Sat, 22 Jun 2019 14:20:58 +0000 (16:20 +0200)
"Most code should not directly call the platform-specific ObfDereferenceObject() function but use the ObDereferenceObject() macro instead."

CORE-16081

drivers/filesystems/fastfat/misc.c
drivers/filters/fltmgr/Interface.c
drivers/filters/fltmgr/Messaging.c
ntoskrnl/fsrtl/oplock.c
ntoskrnl/io/iomgr/rawfs.c
ntoskrnl/ob/devicemap.c
ntoskrnl/po/poshtdwn.c
ntoskrnl/ps/job.c
ntoskrnl/wmi/guidobj.c

index f305463..4f7bf5b 100644 (file)
@@ -582,7 +582,7 @@ VfatCheckForDismount(
         ExDeleteResourceLite(&DeviceExt->FatResource);
 
         /* Dismount our device if possible */
-        ObfDereferenceObject(DeviceExt->StorageDevice);
+        ObDereferenceObject(DeviceExt->StorageDevice);
         IoDeleteDevice(DeviceExt->VolumeDevice);
     }
 
index 1ed7e79..b412ade 100644 (file)
@@ -2005,7 +2005,7 @@ FltpDetachFromFileSystemDevice(_In_ PDEVICE_OBJECT DeviceObject)
         NextDevice = IoGetLowerDeviceObject(AttachedDevice);
 
         /* Remove the reference we added */
-        Count = ObfDereferenceObject(AttachedDevice);
+        Count = ObDereferenceObject(AttachedDevice);
 
         /* Bail if this is the last one */
         if (NextDevice == NULL) return Count;
@@ -2028,7 +2028,7 @@ FltpDetachFromFileSystemDevice(_In_ PDEVICE_OBJECT DeviceObject)
     IoDeleteDevice(AttachedDevice);
 
     /* Remove the reference we added so the delete can complete */
-    return ObfDereferenceObject(AttachedDevice);
+    return ObDereferenceObject(AttachedDevice);
 }
 
 DRIVER_FS_NOTIFICATION FltpFsNotification;
@@ -2143,7 +2143,7 @@ DriverEntry(_In_ PDRIVER_OBJECT DriverObject,
     if (NT_SUCCESS(Status))
     {
         FltpFsNotification(RawDeviceObject, TRUE);
-        ObfDereferenceObject(RawFileObject);
+        ObDereferenceObject(RawFileObject);
     }
 
     RtlInitUnicodeString(&ObjectName, L"\\Device\\RawCdRom");
@@ -2154,7 +2154,7 @@ DriverEntry(_In_ PDRIVER_OBJECT DriverObject,
     if (NT_SUCCESS(Status))
     {
         FltpFsNotification(RawDeviceObject, TRUE);
-        ObfDereferenceObject(RawFileObject);
+        ObDereferenceObject(RawFileObject);
     }
 
     /* We're done, clear the initializing flag */
index d30292a..f4ed276 100644 (file)
@@ -369,7 +369,7 @@ NTAPI
 FltpClientPortDelete(PVOID Object)
 {
     PFLT_PORT_OBJECT PortObject = (PFLT_PORT_OBJECT)Object;
-    ObfDereferenceObject(PortObject->ServerPort);
+    ObDereferenceObject(PortObject->ServerPort);
 }
 
 
@@ -447,14 +447,14 @@ Quit:
         if (ClientPortObjectType)
         {
             ObMakeTemporaryObject(ClientPortObjectType);
-            ObfDereferenceObject(ClientPortObjectType);
+            ObDereferenceObject(ClientPortObjectType);
             ClientPortObjectType = NULL;
         }
 
         if (ServerPortObjectType)
         {
             ObMakeTemporaryObject(ServerPortObjectType);
-            ObfDereferenceObject(ServerPortObjectType);
+            ObDereferenceObject(ServerPortObjectType);
             ServerPortObjectType = NULL;
         }
     }
@@ -737,7 +737,7 @@ Quit:
     {
         if (ClientPortObject)
         {
-            ObfDereferenceObject(ClientPortObject);
+            ObDereferenceObject(ClientPortObject);
         }
 
         if (PortHandle)
@@ -747,7 +747,7 @@ Quit:
         else if (ServerPortObject)
         {
             InterlockedDecrement(&ServerPortObject->NumberOfConnections);
-            ObfDereferenceObject(ServerPortObject);
+            ObDereferenceObject(ServerPortObject);
         }
 
         if (PortCCB)
index f89adc4..f4c38d3 100644 (file)
@@ -454,7 +454,7 @@ FsRtlAcknowledgeOplockBreak(IN PINTERNAL_OPLOCK Oplock,
     /* If we dropped oplock, remove our extra ref */
     if (Deref)
     {
-        ObfDereferenceObject(Oplock->FileObject);
+        ObDereferenceObject(Oplock->FileObject);
     }
     /* And unset FO: no oplock left or shared */
     Oplock->FileObject = NULL;
index de3a90f..e653131 100644 (file)
@@ -148,7 +148,7 @@ RawCheckForDismount(IN PVCB Vcb,
         }
 
         /* Dismount our device if possible */
-        ObfDereferenceObject(Vcb->TargetDeviceObject);
+        ObDereferenceObject(Vcb->TargetDeviceObject);
         IoDeleteDevice((PDEVICE_OBJECT)CONTAINING_RECORD(Vcb,
                                                          VOLUME_DEVICE_OBJECT,
                                                          Vcb));
index 5d583e9..0c54f69 100644 (file)
@@ -130,7 +130,7 @@ ObSetDeviceMap(IN PEPROCESS Process,
     /* Release useless device map if required */
     if (NewDeviceMap != NULL)
     {
-        ObfDereferenceObject(DirectoryObject);
+        ObDereferenceObject(DirectoryObject);
         ExFreePoolWithTag(NewDeviceMap, 'mDbO');
     }
 
@@ -235,7 +235,7 @@ ObSetDirectoryDeviceMap(OUT PDEVICE_MAP * DeviceMap,
     /* Release useless device map if required */
     if (NewDeviceMap != NULL)
     {
-        ObfDereferenceObject(DirectoryObject);
+        ObDereferenceObject(DirectoryObject);
         ExFreePoolWithTag(NewDeviceMap, 'mDbO');
     }
 
index 8a33157..dd9bcc2 100644 (file)
@@ -135,7 +135,7 @@ PopProcessShutDownLists(VOID)
 
         /* Wait for the thread to finish and dereference it */
         KeWaitForSingleObject(ShutDownWaitEntry->Thread, 0, 0, 0, 0);
-        ObfDereferenceObject(ShutDownWaitEntry->Thread);
+        ObDereferenceObject(ShutDownWaitEntry->Thread);
 
         /* Finally free the entry */
         ExFreePoolWithTag(ShutDownWaitEntry, 'LSoP');
index f37de8b..cb7de51 100644 (file)
@@ -836,7 +836,7 @@ NtSetInformationJobObject (
     }
     KeLeaveGuardedRegionThread(CurrentThread);
 
-    ObfDereferenceObject(Job);
+    ObDereferenceObject(Job);
 
     return Status;
 }
index 06f350a..1a13d36 100644 (file)
@@ -247,7 +247,7 @@ WmipOpenGuidObject(
     if (!NT_SUCCESS(Status))
     {
         DPRINT1("ObOpenObjectByPointer failed: 0x%lx\n", Status);
-        ObfDereferenceObject(GuidObject);
+        ObDereferenceObject(GuidObject);
         GuidObject = NULL;
     }