[FASTFAT][FLTMGR][NTOS] Do not explicitly call ObfDereferenceObject() (#1636)

"Most code should not directly call the platform-specific ObfDereferenceObject() function but use the ObDereferenceObject() macro instead."

CORE-16081
This commit is contained in:
Bișoc George 2019-06-22 16:20:58 +02:00 committed by Hermès BÉLUSCA - MAÏTO
parent be820b9ca3
commit 42ce8519b6
9 changed files with 17 additions and 17 deletions

View file

@ -582,7 +582,7 @@ VfatCheckForDismount(
ExDeleteResourceLite(&DeviceExt->FatResource);
/* Dismount our device if possible */
ObfDereferenceObject(DeviceExt->StorageDevice);
ObDereferenceObject(DeviceExt->StorageDevice);
IoDeleteDevice(DeviceExt->VolumeDevice);
}

View 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 */

View 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)

View 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;

View 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));

View 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');
}

View 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');

View file

@ -836,7 +836,7 @@ NtSetInformationJobObject (
}
KeLeaveGuardedRegionThread(CurrentThread);
ObfDereferenceObject(Job);
ObDereferenceObject(Job);
return Status;
}

View file

@ -247,7 +247,7 @@ WmipOpenGuidObject(
if (!NT_SUCCESS(Status))
{
DPRINT1("ObOpenObjectByPointer failed: 0x%lx\n", Status);
ObfDereferenceObject(GuidObject);
ObDereferenceObject(GuidObject);
GuidObject = NULL;
}