http://msdn2.microsoft.com/en-us/library/aa365174.aspx
Code: Select all
Structure PARTITION_INFORMATION_GPT
Partitiontype.GUID
PartitionId.GUID
Attributes.q
Name.b[36]
EndStructure
Structure PARTITION_INFORMATION_MBR
PartitionType.b
BootIndicator.b
RecognizedPartition.b
HiddenSectors.l
EndStructure
Structure PARTITION_INFORMATION_EX
PartitionStyle.l
StartingOffset.LARGE_INTEGER
PartitionLength.LARGE_INTEGER
PartitionNumber.l
RewritePartition.b
StructureUnion
ppmbr.PARTITION_INFORMATION_MBR
ppgpt.PARTITION_INFORMATION_GPT
EndStructureUnion
EndStructure
Structure DRIVE_LAYOUT_INFORMATION_GPT
DiskId.GUID
StartingUsableOffset.LARGE_INTEGER
UsableLength.LARGE_INTEGER
MaxPartitionCount.l
EndStructure
Structure DRIVE_LAYOUT_INFORMATION_MBR
Signature.l
EndStructure
Structure DRIVE_LAYOUT_INFORMATION_EX
PartitionStyle.l
PartitionCount.l
StructureUnion
pdmbr.DRIVE_LAYOUT_INFORMATION_MBR
pdgpt.DRIVE_LAYOUT_INFORMATION_GPT
EndStructureUnion
PartitionEntry.PARTITION_INFORMATION_EX[255]
EndStructure
pdl.DRIVE_LAYOUT_INFORMATION_EX
#IOCTL_DISK_BASE = 7
#METHOD_BUFFERED = 0
#FILE_ANY_ACCESS = 0
Procedure.l CTL_CODE(DeviceType, Function, Method, Access)
ProcedureReturn ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method)
EndProcedure
IOCTL_DISK_GET_DRIVE_LAYOUT_EX = CTL_CODE(#IOCTL_DISK_BASE,$14,#METHOD_BUFFERED,#FILE_ANY_ACCESS)
hDrive.l = CreateFile_("\\.\PHYSICALDRIVE0", #GENERIC_READ|#GENERIC_WRITE,#FILE_SHARE_READ|#FILE_SHARE_WRITE,0,#OPEN_EXISTING,0,0)
DeviceIoControl_(hDrive,IOCTL_DISK_GET_DRIVE_LAYOUT_EX,0,0,@pdl,SizeOf(pdl),@ret.l,0)
CloseHandle_(hDrive)
Debug pdl\PartitionCount

but should be possible with pb4
