#include <Array.au3>
Func _RasEnumEntries($sPhonebook)
Local $iResult, $aResult[1][3], $tBuffer, $pBuffer, $iSizeofBuffer, $tagBuffer, $iIndex
$tBuffer = DllStructCreate("dword;char[257];dword;char[261]")
$pBuffer = DllStructGetPtr($tBuffer)
$iSizeofBuffer = DllStructGetSize($tBuffer)
DllStructSetData($tBuffer, 1, $iSizeofBuffer)
$iResult = DllCall("rasapi32.dll", "dword", "RasEnumEntries", _
"ptr", 0, "str", $sPhonebook, _
"ptr", $pBuffer, "int*", $iSizeofBuffer, "int*", 0)
$tBuffer = 0
$aResult[0][0] = $iResult[5]
Redim $aResult[$iResult[5] + 1][3]
If $iResult[5] = 0 Then Return SetError($iResult[0], 0, $aResult)
For $i = 1 to $iResult[5]
$tagBuffer &= "dword;char[257];dword;char[261];"
Next
$tBuffer = DllStructCreate($tagBuffer)
$pBuffer = DllStructGetPtr($tBuffer)
DllStructSetData($tBuffer, 1, $iSizeofBuffer)
$iResult = DllCall("rasapi32.dll", "dword", "RasEnumEntries", _
"ptr", 0, "str", $sPhonebook, _
"ptr", $pBuffer, "int*", $iResult[4], "int*", 0)
For $i = 2 to $iResult[5] * 4 Step 4
$iIndex += 1
$aResult[$iIndex][0] = DllStructGetData($tBuffer, $i)
$aResult[$iIndex][1] = DllStructGetData($tBuffer, $i + 2)
$aResult[$iIndex][2] = DllStructGetData($tBuffer, $i + 1)
Next
$tBuffer = 0
Return SetError($iResult[0], $iResult[5], $aResult)
EndFunc ;==>_RasEnumEntries()
$sPnebk = @AppDataCommonDir & "\Microsoft\Network\Connections\Pbk\rasphone.pbk"
$aEntry = _RasEnumEntries($sPnebk)
_ArrayDisplay($aEntry)