$aResult = _NetUseEnum()
For $o = 0 to @Extended - 1
_NetUseDel($aResult[$o][0])
_NetUseDel($aResult[$o][1])
Next
Func _NetUseDel($sUseName, $sServer = "")
Local $iResult
$iResult = DllCall("netapi32.dll", "int", "NetUseDel", _
"wstr", $sServer, _
"wstr", $sUseName, _
"dword", 2)
Return SetError($iResult[0], 0, $iResult[0] = 0)
EndFunc ;==>_NetUseDel()
Func _NetUseEnum($sServer = "")
Local $iResult, $iCount, $pUse, $tUse, $tLocal, $tRemote, $aResult[1][2]
$iResult = DllCall("netapi32.dll", "int", "NetUseEnum", _
"wstr", "", _
"dword", 0, _
"dword*", 0, _
"dword", -1, _
"dword*", 0, _
"dword*", 0, _
"dword*", 0)
$iCount = $iResult[6]
$pUse = $iResult[3]
If $iCount = 0 Then Return SetError($iResult[0], 0, False)
Redim $aResult[$iCount][2]
For $o = 1 to $iCount
$tUse = DllStructCreate("ptr;ptr", $pUse)
$tLocal = DllStructCreate("wchar[256]", DllStructGetData($tUse, 1))
$tRemote = DllStructCreate("wchar[256]", DllStructGetData($tUse,2))
$aResult[$o - 1][0] = DllStructGetData($tLocal, 1)
$aResult[$o - 1][1] = DllStructGetData($tRemote, 1)
$tLocal = 0
$tRemote = 0
$pUse += DllStructGetSize($tUse)
Next
$tUse = 0
Return SetError($iResult[0], $iCount, $aResult)
EndFunc ;==>_NetUseEnum()
|