Jump to content

_WinAPI_GetDriveNumber example


Deye
 Share

Recommended Posts

Taken form the example of _WinAPI_GetDriveNumber
when i run it, its missing Drive0

if you can further help
finally, i want to get a 1 line statics starting from drive 0 in the loop and on-wards to include:

$drive number , $Drive letter ,$Drive size=(WinAPI_GetDriveGeometryEx(drive number,data[5]) )

I'm including the example from the help file, that didn't fully work out for me ..

 help and advice are welcome

Thanks

#include <WinAPIFiles.au3>

Local $aData, $aDrive = DriveGetDrive('FIXED')
Local $aList[10]

For $i = 0 To UBound($aDrive) - 1
    $aList[$i] = ''
Next
If IsArray($aDrive) Then
    For $i = 1 To $aDrive[0]
        $aData = _WinAPI_GetDriveNumber($aDrive[$i])
        If IsArray($aData) Then
            $aList[$aData[1]] &= StringUpper($aDrive[$i]) & ' '
        EndIf
    Next
EndIf
For $i = 0 To UBound($aDrive) - 1
    If $aList[$i] Then
        ConsoleWrite('Drive' & $i & ' => ' & $aList[$i] & @CRLF)
    EndIf
Next

 

Edited by Deye
Link to comment
Share on other sites

Getting partitions for Drive=0 is till unworkable

Now how do I get the device ID  brand name into this ?

 

#include <array.au3>
#include <WinAPIFiles.au3>

Local $aDrive = DriveGetDrive('FIXED')
Local $Geom, $size, $part

If IsArray($aDrive) Then
  For $x = 0 To 10
    For $i = 1 To UBound($aDrive) - 1
      Local $num = _WinAPI_GetDriveNumber($aDrive[$i])
      If IsArray($num) And $num[1] = $x Or _WinAPI_GetDriveNumber($aDrive[$i]) = $x Then
        $Drive = StringUpper($aDrive[$i])
        $Geom = _WinAPI_GetDriveGeometryEx($x)
        If IsArray($Geom) Then $size = (StringFormat('%.2f', $Geom[5] / (1024 ^ 3)) & ' GB')
        If IsArray($num) Then $part = ($num[2])
        MsgBox(0, "", "Drive =" & $Drive & @CRLF & "Disk=" & $x & @CRLF & "partions= " & $part & @CRLF & "size=" & $size)
      EndIf
    Next
  Next
EndIf

 

Edited by Deye
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...