如何在 Windows 中检查 VIA RAID 状态(不使用 GUI)?

如何在 Windows 中检查 VIA RAID 状态(不使用 GUI)?

如何在 Windows 中检查 VIA RAID 状态,而不是使用 GUI?驱动程序包中没有 CLI 工具。

答案1

VIA RAID 从未打算在服务器上使用,而只打算在客户端机器上使用。我强烈怀疑它没有(记录的)CLI,只有一个简单的 GUI。看一下位于这里并提取相关文档(CHM格式,在此处转换为 PDF),根本没有提到任何类型的 CLI。

此外,VIA 消费芯片组部门多年前就已经解散了,因此您确实应该考虑更换那台机器。

答案2

好的,在视窗驱动程序包中有一个名为 drvInterface.dll 的 DLL,因此可以使用它。有趣的是,所有函数和数据类型仅在 PDF 中以Linux驱动程序包。:) 不过,这个描述不是 100% 正确的,所以最好检查一下头文件(也只在Linux驱动程序包)。

无论如何,这里有一个 AutoIt 脚本,它使用 drvInterface.dll 来获取阵列和磁盘状态(如果一切正常则返回“1”,如果有任何错误则返回“0”)。再多花点功夫,您就可以在 VIA RAID Tool 界面中获取磁盘型号、序列号和其他数据:

#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

相关内容