NTSTATUS
IoSetPartitionInformation(
IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize,
IN ULONG PartitionNumber,
IN ULONG PartitionType
);
IoSetPartitionInformation sets the partition type and number in a partition table entry for a given disk represented by the device object.
Parameters
DeviceObject
Points to the device object representing the device on which the partition type is to be set.
SectorSize
Specifies the size, in bytes, of sectors on the disk.
PartitionNumber
Specifies the partition number on the device whose partition type is to be set.
PartitionType
Specifies the type for the partition. For the currently defined PartitionType values, see the Win32 SDK.
Return Value
If IoSetPartitionInformation returns STATUS_SUCCESS, the disk driver updates its notion of the partition type for this partition in its device extension.
Comments
This routine is called when a disk device driver is asked to set the partition type in a partition table entry by an IRP_MJ_DEVICE_CONTROL request. This request is generally issued by the format utility, which performs I/O control functions on the partition. The driver passes a pointer to the device object representing the physical disk and the number of the partition associated with the device object that the format utility has open.
This routine is synchronous and must be called by the disk driver’s Dispatch routine or by a driver thread. Thus, all user and file system threads must be prepared to enter a wait state when issuing the device control request to set the partition type for the device.
This routine assumes the partition number passed in by the disk driver actually exists.
This routine must be called at PASSIVE_LEVEL IRQL because it uses a kernel event object to synchronize I/O completion on the device. The event cannot be set to the Signaled state without queuing and executing the I/O system’s special kernel APC routine for I/O completion.
See Also