Func _WinAPI_RasEnumEntries()
Local $Result[1]
Local $tBuffer = DllStructCreate($tagRASENTRYNAME)
Local $iBufferSize = DllStructGetSize($tBuffer)
Local $mem = __MemGlobalAlloc(256 * $iBufferSize, 0x0040)
Local $aRasEntryName[256]
For $i = 0 To 255
$aRasEntryName[$i] = DllStructCreate($tagRASENTRYNAME, $mem + ($i * $iBufferSize))
Next
DllStructSetData($aRasEntryName[0], 1, $iBufferSize)
Local $Res = DllCall("rasapi32.dll", "int", "RasEnumEntries", "ptr", 0, "ptr", 0, "ptr", DllStructGetPtr($aRasEntryName[0]), "int*", 256 * $iBufferSize, "int*", 0)
If $Res[0] = 0 Then
For $i = 0 To $Res[5] - 1
$Result[$i] = DllStructGetData($aRasEntryName[$i], "szEntryName")
ReDim $Result[UBound($Result) + 1]
Next
ReDim $Result[UBound($Result) - 1]
Return $Result
Else
Return SetError(0, _WinAPI_GetLastError(), $Res[0])
EndIf
EndFunc ;==>_WinAPI_RasEnumEntries
|