diff --git a/src/dll/fsctl.c b/src/dll/fsctl.c index 036d29e3..4dffb187 100644 --- a/src/dll/fsctl.c +++ b/src/dll/fsctl.c @@ -33,22 +33,20 @@ FSP_API NTSTATUS FspFsctlCreateVolume(PWSTR DevicePath, GlobalDevicePath(DevicePathBuf, sizeof DevicePathBuf, DevicePath); SecurityDescriptorSize = 0; - if (!MakeSelfRelativeSD(SecurityDescriptor, 0, &SecurityDescriptorSize)) + MakeSelfRelativeSD(SecurityDescriptor, 0, &SecurityDescriptorSize); + ParamsBuf = malloc(sizeof *ParamsBuf + SecurityDescriptorSize); + if (0 == ParamsBuf) { - ParamsBuf = malloc(sizeof *ParamsBuf + SecurityDescriptorSize); - if (0 == ParamsBuf) - { - Result = STATUS_INSUFFICIENT_RESOURCES; - goto exit; - } - SecurityDescriptorBuf = (PVOID)(ParamsBuf + 1); - if (!MakeSelfRelativeSD(SecurityDescriptor, SecurityDescriptorBuf, &SecurityDescriptorSize)) - { - Result = FspNtStatusFromWin32(GetLastError()); - goto exit; - } - *ParamsBuf = *Params; + Result = STATUS_INSUFFICIENT_RESOURCES; + goto exit; } + SecurityDescriptorBuf = (PVOID)(ParamsBuf + 1); + if (!MakeSelfRelativeSD(SecurityDescriptor, SecurityDescriptorBuf, &SecurityDescriptorSize)) + { + Result = FspNtStatusFromWin32(GetLastError()); + goto exit; + } + *ParamsBuf = *Params; DeviceHandle = CreateFileW(DevicePathBuf, 0, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 0, OPEN_EXISTING, 0, 0); diff --git a/src/sys/driver.h b/src/sys/driver.h index 28e35b4e..469703e6 100644 --- a/src/sys/driver.h +++ b/src/sys/driver.h @@ -295,7 +295,7 @@ NTSTATUS FspCreateDeviceObjectList( PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT **PDeviceObjects, PULONG PDeviceObjectCount); VOID FspDeleteDeviceObjectList( PDEVICE_OBJECT *DeviceObjects, ULONG DeviceObjectCount); -NTSTATUS FspHasDeviceObject( +NTSTATUS FspLookupDeviceObject( PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT DeviceObject); /* debug */ diff --git a/src/sys/fsctl.c b/src/sys/fsctl.c index 11696f40..ea4adbcd 100644 --- a/src/sys/fsctl.c +++ b/src/sys/fsctl.c @@ -108,10 +108,10 @@ static NTSTATUS FspFsctlMountVolume( PAGED_CODE(); NTSTATUS Result; - PDEVICE_OBJECT RealDevice = IrpSp->Parameters.MountVolume.DeviceObject; + PDEVICE_OBJECT RealDevice = IrpSp->Parameters.MountVolume.Vpb->RealDevice; /* check the passed in volume object; it must be one of our own */ - Result = FspHasDeviceObject(DeviceObject->DriverObject, RealDevice); + Result = FspLookupDeviceObject(DeviceObject->DriverObject, RealDevice); if (!NT_SUCCESS(Result)) { if (STATUS_NO_SUCH_DEVICE == Result) diff --git a/src/sys/misc.c b/src/sys/misc.c index 16e9ed38..d025f742 100644 --- a/src/sys/misc.c +++ b/src/sys/misc.c @@ -83,7 +83,7 @@ VOID FspDeleteDeviceObjectList( ExFreePoolWithTag(DeviceObjects, FSP_TAG); } -NTSTATUS FspHasDeviceObject( +NTSTATUS FspLookupDeviceObject( PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT DeviceObject) { NTSTATUS Result = STATUS_NO_SUCH_DEVICE;