IoSetPartitionInformationEx function (ntddk.h)

For the disk represented by DeviceObject, the IoSetPartitionInformationEx routine initializes a partition table entry with the information specified in the SET_PARTITION_INFORMATION_EX structure.

Syntax

NTSTATUS IoSetPartitionInformationEx(
  [in] PDEVICE_OBJECT                DeviceObject,
  [in] ULONG                         PartitionNumber,
  [in] _SET_PARTITION_INFORMATION_EX *PartitionInfo
);

Parameters

[in] DeviceObject

Pointer to the device object representing the device on which the partition type is to be set.

[in] PartitionNumber

Specifies the partition number on the device whose partition type is to be set.

[in] PartitionInfo

A structure whose PartitionType member specifies the type for the partition. For the currently defined PartitionType values PARTITION_INFORMATION.

Return value

If IoSetPartitionInformationEx returns STATUS_SUCCESS, the disk driver updates its notion of the partition type for this partition in its device extension.

Remarks

IoSetPartitionInformationEx must only be used by disk drivers. Other drivers should use the IOCTL_DISK_SET_PARTITION_INFO_EX disk I/O request instead.

This routine is called when a disk device driver is requested to set partition information 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. Since the HAL routines that underlie IoSetPartitionInformationEx were developed before support for dynamic partitioning was implemented, they do not distinguish between the partitionordinal (that is the order of a partition on a disk) and the partition number (the partition number assigned to a partition in order to identify it to the system). Drivers must call IoSetPartitionInformationEx using the ordinal number of the partition and not the actual partition number.

If the partition is a Master Boot Record (MBR) type partition, IoSetPartitionInformationEx is limited to setting the partition style, and the partition style, which is represented as an unsigned character. See SET_PARTITION_INFORMATION_MBR for further information about these values.

If the partition is a GUID Partition Table (GPT) partition, IoSetPartitionInformationEx sets the following values: the partition style, the partition type, represented by a GUID instead of an integer as was the case with MBR partitions; a partition ID, also represented by a GUID; a set of attributes (see the Extensible Firmware Interface for a description of these attributes); and a Unicode name for the partition. See SET_PARTITION_INFORMATION_GPT for further information about these values.

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 operates under the assumption that the partition number passed in by the disk driver actually exists.

This routine must be called at IRQL = PASSIVE_LEVEL 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.

Requirements

Requirement Value
Target Platform Universal
Header ntddk.h (include Ntddk.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL PASSIVE_LEVEL (See Remarks section)
DDI compliance rules HwStorPortProhibitedDDIs(storport), PowerIrpDDis(wdm)

See also

IoReadPartitionTable

IoSetPartitionInformation

IoWritePartitionTable

SET_PARTITION_INFORMATION

SET_PARTITION_INFORMATION_EX