Jump to content
Sign in to follow this  

How to get an extended partition hard drive

Recommended Posts


have a fuction:


Local $hDevice = "\\.\PhysicalDrive" & $iDrive

Local $hFile, $Ret

$hFile = DllCall("kernel32.dll", "hwnd", "CreateFile", _

"str", $hDevice, _; 要处理的驱动器

"dword", 0, _

"dword", 0, _

"ptr", 0, _

"dword", 3, _; OPEN_EXISTING

"dword", 128, _; FILE_ATTRIBUTE_NORMAL

"ptr", 0)

$hDevice = $hFile[0]

If $hFile = 0 Then

Return SetError(1, 0, -1)


Local $tagVOLUME_DISK_EXTENTS = 'dword NumberOfDiskExtents;dword DiskNumber;int64 StartingOffset;int64 ExtentLength;'


$Ret = DllCall("kernel32.dll", "int", "DeviceIoControl", _

"hwnd", $hDevice, _


"ptr", 0, _

"dword", 0, _

"ptr", DllStructGetPtr($tVOLUME_DISK_EXTENTS), _

"dword", DllStructGetSize($tVOLUME_DISK_EXTENTS), _

"dword*", 0, _

"ptr", 0)

If (@error) Or ($Ret[0] = 0) Then

$Ret = 0


DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile)

; _WinAPI_FreeHandle($hFile)

If Not IsArray($Ret) Then

Return SetError(2, 0, 0)


Return SetError(0, 0, $tVOLUME_DISK_EXTENTS)


Why is not working??????????????????????

Share this post

Link to post
Share on other sites

I don't understand the basic operation. You want volume information from a physical disk device? Shouldn't you be passing a handle to the Volume?

There are minor quibbles like closing the handle with the $hFile array instead of the $hDevice handle, but it's still the wrong operation, I think.


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.