Jump to content

Search the Community

Showing results for tags 'count physical disk'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. ;Count PHYSICAL Disk ;Physical disks, not drive letters Local $Cnt = 0, $iDrvNo = 0, $sPdisk = '\\.\PHYSICALDRIVE0' While 1     Local $sPdisk = '\\.\PHYSICALDRIVE' & $Cnt     Local $iDrvNo = __WinAPI_GetDriveNumber($sPdisk)     If $iDrvNo < $Cnt Then ExitLoop     ConsoleWrite('Disk No: ' & $iDrvNo & @CRLF)     $Cnt = $Cnt + 1 WEnd ConsoleWrite('PHYSICAL Disk Total: ' & $Cnt & @CRLF) Func __WinAPI_GetDriveNumber($sDrive)     Local $hFile = ___CreateFile_OPEN_EXISTING($sDrive)     If @error Then Return SetError(@error + 20, @extended, $hFile)     Local $tSDN = DllStructCreate('dword;ulong;ulong')     Local $aRet = DllCall('kernel32.dll', 'bool', 'DeviceIoControl', 'handle', $hFile, 'dword', 0x002D1080, 'ptr', 0, _             'dword', 0, 'struct*', $tSDN, 'dword', DllStructGetSize($tSDN), 'dword*', 0, 'ptr', 0)     If __CheckErrorCloseHandle($aRet, $hFile) Then Return SetError(@error, @extended, 0)     Local $sResult = DllStructGetData($tSDN, 2)     Return $sResult EndFunc   ;==>__WinAPI_GetDriveNumber Func ___CreateFile_OPEN_EXISTING($sDrive) Local $hFile = DllCall("kernel32.dll", "handle", "CreateFileW", "wstr", $sDrive, "dword", 0, "dword", 0, "ptr", 0, _ "dword", 3, _ ; OPEN_EXISTING "dword", 0, "ptr", 0) If @error Or $hFile[0] = Ptr(-1) Then Return SetError(@error, @extended, 0) ; INVALID_HANDLE_VALUE Return $hFile[0] EndFunc Func __CheckErrorCloseHandle($aCall, $hFile, $bLastError = False, $iCurErr = @error, $iCurExt = @extended) If Not $iCurErr And Not $aCall[0] Then $iCurErr = 10 Local $aLastError = DllCall("kernel32.dll", "dword", "GetLastError") ; _WinAPI_GetLastError() DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hFile) If $iCurErr Then DllCall("kernel32.dll", "none", "SetLastError", "dword", $aLastError[0]) ; _WinAPI_SetLastError($iLastError) If $bLastError Then $iCurExt = $aLastError[0] Return SetError($iCurErr, $iCurExt, $iCurErr) EndFunc ;==>__CheckErrorCloseHandle Counts physical disks. Without letter and WMI
×
×
  • Create New...