Jump to content

How to get an extended partition hard drive


neity
 Share

Recommended Posts

have a fuction:

Func _WinAPI_GetVOLUMEDISKEXTENTS($iDrive)

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)

EndIf

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

Local $tVOLUME_DISK_EXTENTS = DllStructCreate($tagVOLUME_DISK_EXTENTS)

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

"hwnd", $hDevice, _

"dword", 0x560000, _; IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS

"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

EndIf

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

; _WinAPI_FreeHandle($hFile)

If Not IsArray($Ret) Then

Return SetError(2, 0, 0)

EndIf

Return SetError(0, 0, $tVOLUME_DISK_EXTENTS)

EndFunc ;==>_WinAPI_GetVOLUMEDISKEXTENTS

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

Link to comment
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.

:D

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...