#NoTrayIcon #include <Array.au3> Local $pTest Global $bStatus = True $hDLL = DllOpen(@ScriptDir & "\drvInterface.dll") If @error <> 0 Then $bStatus = False EndIf _checkStatus() ;~ VINT vr_init (void); $sTest = DllCall($hDLL, "int:cdecl", "?vr_init@@YAHXZ") If @error <> 0 Then $bStatus = False EndIf _checkStatus() ;~ VINT vr_get_controller_num (VINT *pnumber); $sTest = DllCall($hDLL, "int:cdecl", "?vr_get_controller_num@@YAHPAH@Z", "int*", $pTest) If @error <> 0 Then $bStatus = False EndIf _checkStatus() If IsArray($sTest) and UBound($sTest) >= 2 Then $iControllerNumber = $sTest[1] Else $bStatus = False EndIf _checkStatus() ;~ VINT vr_get_array_num (VINT only_raid, VINT *pnumber); $sTest = DllCall($hDLL, "int:cdecl", "?vr_get_array_num@@YAHHPAH@Z", "int", 0, "int*", $pTest) If @error <> 0 Then $bStatus = False EndIf _checkStatus() If IsArray($sTest) and UBound($sTest) >= 3 Then $iArrayNumber = $sTest[2] Else $bStatus = False EndIf _checkStatus() If Not $iArrayNumber >=1 Then $bStatus = False EndIf _checkStatus() ;~ VINT vr_get_device_num (VINT *pnumber); $sTest = DllCall($hDLL, "int:cdecl", "?vr_get_device_num@@YAHPAH@Z", "int*", $pTest) If @error <> 0 Then $bStatus = False EndIf _checkStatus() If IsArray($sTest) and UBound($sTest) >= 2 Then $iDeviceNumber = $sTest[1] Else $bStatus = False EndIf _checkStatus() If Not $iDeviceNumber >=1 Then $bStatus = False EndIf _checkStatus() ;~ ConsoleWrite("$iDeviceNumber = " & $iDeviceNumber & @CRLF) For $i = 0 To $iArrayNumber-1 $vr_array_info = DllStructCreate("ushort status;ubyte raidType;ubyte diskNum;ulong capacityLow;ulong capacityHigh;ulong realCapacityLow;ulong realCapacityHigh;ulong stripeSize;ulong blockSize;int bNeedMigration;int bNeedInit;int bOptimized;ubyte systemDisk;ushort raid_index;int index") If @error <> 0 Then $bStatus = False EndIf _checkStatus() $sTest = DllCall($hDLL, "int:cdecl", "?vr_get_array_info@@YAHHPAU_vr_array_info@@@Z", "int", $i, "struct*", DllStructGetPtr($vr_array_info)) If @error <> 0 Then $bStatus = False EndIf _checkStatus() $iArrayStatus = DllStructGetData($vr_array_info, "status") If @error <> 0 Then $bStatus = False EndIf _checkStatus() If $iArrayStatus == 0 And $bStatus Then $bStatus = True Else $bStatus = False EndIf _checkStatus() Next For $i = 0 To $iDeviceNumber-1 $vr_device_info = DllStructCreate("char serialNumber[32];char firmwareRevison[16];char modelName[64];char minorRevisonNumber[64];ulong cylinderNumber;ulong headNumber;ulong sectorNumberPerTrack;ulong capacityLow;ulong capacityHigh;ubyte supportPIOTransferMode;ubyte supportMultiDMAMode;ubyte supportUltraDMAMode;ubyte currentTransferMode;ubyte deviceType;ushort status;ubyte ctrler_index;ubyte chan_index;int master;int index;ubyte systemDisk;int bDevInRaid;ushort array_position;int array_index;ulong realCapacityLow;ulong realCapacityHigh") If @error <> 0 Then $bStatus = False EndIf _checkStatus() $sTest = DllCall($hDLL, "int:cdecl", "?vr_get_device_info@@YAHHPAU_vr_device_info@@@Z", "int", $i, "struct*", DllStructGetPtr($vr_device_info)) If @error <> 0 Then $bStatus = False EndIf _checkStatus() $iDeviceStatus = DllStructGetData($vr_device_info, "status") If @error <> 0 Then $bStatus = False EndIf _checkStatus() If $iDeviceStatus == 0 And $bStatus Then $bStatus = True Else $bStatus = False EndIf _checkStatus() Next ;~ void vr_exit (void); $sTest = DllCall($hDLL, "none", "?vr_exit@@YAXXZ") DllClose($hDLL) If $bStatus Then ConsoleWrite("1") Else ConsoleWrite("0") EndIf Exit Func _checkStatus() If Not $bStatus Then ConsoleWrite("0") Exit EndIf EndFunc |