#include <Array.au3>
CONST $tagMPRINTERFACE0 = "wchar Name[257];ptr Interface;int Enabled;int IfType;int State;dword UnreachabilityReasons;dword LastError"
$aInterface = _MprConfigInterfaceEnum()
_Arraydisplay($aInterface)
Func _MprConfigInterfaceEnum($sSystem = @ComputerName)
Local $hMprCfg, $aResult[1][4] = [[0]], $tMPR, $pMPR
$hMprCfg = _MprConfigServerConnect($sSystem)
If $hMprCfg = 0 Then Return SetError(@error, 0, $aResult)
$iResult = DllCall("Mprapi.dll", "long", "MprConfigInterfaceEnum", _
"long", $hMprCfg, "dword", 0, "ptr*", 0, "dword", -1, _
"dword*", 0, "dword*", 0, "dword*", 0)
$pMPR = $iResult[3]
$aResult[0][0] = $iResult[5]
Redim $aResult[$iResult[5] + 1][4]
For $i = 1 to $iResult[5]
$tMPR = DllStructCreate($tagMPRINTERFACE0, $iResult[3])
$aResult[$i][0] = DllStructGetData($tMPR, "Name")
$aResult[$i][1] = _MprConfigGetFriendlyName($hMprCfg, $aResult[$i][0])
$aResult[$i][2] = DllStructGetData($tMPR, "Enabled")
$aResult[$i][3] = DllStructGetData($tMPR, "IfType")
$iResult[3] += DllStructGetSize($tMPR)
Next
_MprConfigBufferFree($pMPR)
_MprConfigServerDisconnect($hMprCfg)
Return SetError($iResult[0], 0, $aResult)
EndFunc ;==>_MprConfigInterfaceEnum
Func _MprConfigServerConnect($sSystem = @ComputerName)
Local $hMprCfg
If $sSystem = "" Then $sSystem = @ComputerName
$hMprCfg = DllCall("Mprapi.dll", "long", "MprConfigServerConnect", _
"wstr", @ComputerName, "long*", 0)
Return SetError($hMprCfg[0], 0, $hMprCfg[2])
EndFunc ;==>_MprConfigServerConnect
Func _MprConfigBufferFree($pBuffer)
Local $iResult
$iResult = DllCall("Mprapi.dll", "long", "MprConfigBufferFree", "ptr", $pBuffer)
Return $iResult[0] = 0
EndFunc ;==>_MprConfigBufferFree
Func _MprConfigServerDisconnect($hMprCfg)
DllCall("Mprapi.dll", "none", "MprConfigServerDisconnect", "long", $hMprCfg)
EndFunc ;==>_MprConfigServerDisconnect
Func _MprConfigGetFriendlyName($hMprCfg, $sGUID)
Local $iResult
$iResult = DllCall("Mprapi.dll", "long", "MprConfigGetFriendlyName", _
"long", $hMprCfg, "wstr", $sGUID, "wstr", "", "int", 128)
Return $iResult[3]
EndFunc ;==>_MprConfigGetFriendlyName