[PARTMGR] Minor code formatting.

This commit is contained in:
Hermès Bélusca-Maïto 2024-12-27 17:17:53 +01:00
parent 0929e96728
commit e1b835bdbf
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 11 additions and 22 deletions

View file

@ -27,7 +27,7 @@ PartitionCreateDevice(
UNICODE_STRING deviceName;
UINT32 volumeNum;
// create the device object
// Create the partition/volume device object
volumeNum = HarddiskVolumeNextId++;
swprintf(nameBuf, L"\\Device\\HarddiskVolume%lu", volumeNum);
@ -41,7 +41,6 @@ PartitionCreateDevice(
FILE_DEVICE_SECURE_OPEN,
FALSE,
&partitionDevice);
if (!NT_SUCCESS(status))
{
ERR("Unable to create device object %wZ\n", &deviceName);
@ -81,10 +80,10 @@ PartitionCreateDevice(
partExt->DeviceObject = partitionDevice;
partExt->LowerDevice = FDObject;
// The device is initialized
partitionDevice->Flags &= ~DO_DEVICE_INITIALIZING;
*PDO = partitionDevice;
return status;
}
@ -136,11 +135,9 @@ PartitionHandleStartDevice(
return status;
}
INFO("Partition interface %wZ\n", &interfaceName);
PartExt->PartitionInterfaceName = interfaceName;
status = IoSetDeviceInterfaceState(&interfaceName, TRUE);
INFO("Partition interface %wZ\n", &interfaceName);
if (!NT_SUCCESS(status))
{
RtlFreeUnicodeString(&interfaceName);
@ -157,11 +154,9 @@ PartitionHandleStartDevice(
return status;
}
INFO("Volume interface %wZ\n", &interfaceName);
PartExt->VolumeInterfaceName = interfaceName;
status = IoSetDeviceInterfaceState(&interfaceName, TRUE);
INFO("Volume interface %wZ\n", &interfaceName);
if (!NT_SUCCESS(status))
{
RtlFreeUnicodeString(&interfaceName);

View file

@ -340,7 +340,6 @@ PartMgrUpdatePartitionDevices(
pdoNumber,
NewLayout->PartitionStyle,
&partitionDevice);
if (!NT_SUCCESS(status))
{
partEntry->PartitionNumber = 0;
@ -948,8 +947,8 @@ FdoHandleStartDevice(
_In_ PFDO_EXTENSION FdoExtension,
_In_ PIRP Irp)
{
// obtain the disk device number
// this is not expected to change thus not in PartMgrRefreshDiskData
// Obtain the disk device number.
// It is not expected to change, thus not in PartMgrRefreshDiskData().
STORAGE_DEVICE_NUMBER deviceNumber;
NTSTATUS status = IssueSyncIoControlRequest(IOCTL_STORAGE_GET_DEVICE_NUMBER,
FdoExtension->LowerDevice,
@ -965,25 +964,22 @@ FdoHandleStartDevice(
FdoExtension->DiskData.DeviceNumber = deviceNumber.DeviceNumber;
// register the disk interface
// partmgr.sys from Windows 8.1 also registers a mysterious GUID_DEVINTERFACE_HIDDEN_DISK here
// Register the disk interface.
// partmgr.sys from Windows 8.1 also registers a mysterious GUID_DEVINTERFACE_HIDDEN_DISK here.
UNICODE_STRING interfaceName;
status = IoRegisterDeviceInterface(FdoExtension->PhysicalDiskDO,
&GUID_DEVINTERFACE_DISK,
NULL,
&interfaceName);
if(!NT_SUCCESS(status))
{
ERR("Failed to register GUID_DEVINTERFACE_DISK, status %x\n", status);
return status;
}
INFO("Disk interface %wZ\n", &interfaceName);
FdoExtension->DiskInterfaceName = interfaceName;
status = IoSetDeviceInterfaceState(&interfaceName, TRUE);
INFO("Disk interface %wZ\n", &interfaceName);
if (!NT_SUCCESS(status))
{
RtlFreeUnicodeString(&interfaceName);
@ -1188,12 +1184,11 @@ PartMgrAddDevice(
NTSTATUS status = IoCreateDevice(DriverObject,
sizeof(FDO_EXTENSION),
0,
NULL,
FILE_DEVICE_BUS_EXTENDER,
FILE_AUTOGENERATED_DEVICE_NAME | FILE_DEVICE_SECURE_OPEN,
FALSE,
&deviceObject);
if (!NT_SUCCESS(status))
{
ERR("Failed to create FDO 0x%x\n", status);
@ -1218,9 +1213,8 @@ PartMgrAddDevice(
}
deviceObject->Flags |= DO_DIRECT_IO | DO_POWER_PAGABLE;
// device is initialized
// The device is initialized
deviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
return STATUS_SUCCESS;
}