/[cvs]/joko/ToolBox/Windows/VpnDial/src/RasEntry.bas
ViewVC logotype

Diff of /joko/ToolBox/Windows/VpnDial/src/RasEntry.bas

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by joko, Wed Sep 28 20:36:46 2005 UTC revision 1.3 by joko, Tue Nov 22 22:27:27 2005 UTC
# Line 36  Private Type RASENTRYNAME95 Line 36  Private Type RASENTRYNAME95
36  End Type  End Type
37    
38    
39  Private Declare Function RasDial Lib "RasApi32.DLL" Alias "RasDialA" _  Private Declare Function RasDial Lib "rasapi32.dll" Alias "RasDialA" _
40      (ByVal lprasdialextensions As Long, ByVal lpcstr As String, _      (ByVal lprasdialextensions As Long, ByVal lpcstr As String, _
41      ByRef lprasdialparamsa As RASDIALPARAMS, ByVal dword As Long, _      ByRef lprasdialparamsa As RASDIALPARAMS, ByVal dword As Long, _
42      lpvoid As Any, ByRef lphrasconn As Long) As Long      lpvoid As Any, ByRef lphrasconn As Long) As Long
43    
44  Private Declare Function RasEnumEntries Lib "RasApi32.DLL" Alias "RasEnumEntriesA" _  Private Declare Function RasEnumEntries Lib "rasapi32.dll" Alias "RasEnumEntriesA" _
45      (ByVal reserved As String, ByVal lpszPhonebook As String, lprasentryname As Any, _      (ByVal reserved As String, ByVal lpszPhonebook As String, lprasentryname As Any, _
46      lpcb As Long, lpcEntries As Long) As Long      lpcb As Long, lpcEntries As Long) As Long
47            
48  Private Declare Function RasGetEntryDialParams Lib "RasApi32.DLL" Alias "RasGetEntryDialParamsA" _  Private Declare Function RasGetEntryDialParams Lib "rasapi32.dll" Alias "RasGetEntryDialParamsA" _
49      (ByVal lpcstr As String, ByRef lprasdialparamsa As RASDIALPARAMS, ByRef lpbool As Long) As Long      (ByVal lpcstr As String, ByRef lprasdialparamsa As RASDIALPARAMS, ByRef lpbool As Long) As Long
50    
51    Private Declare Function RasSetEntryDialParams _
52          Lib "rasapi32.dll" Alias "RasSetEntryDialParamsA" _
53            (ByVal lpszPhonebook As String, _
54            lpRasDialParams As RASDIALPARAMS, _
55            ByVal blnRemovePassword As Long) As Long
56            
57  Private Function Dial(ByVal Connection As String, ByVal phoneBook As String, ByVal username As String, ByVal password As String) As Integer  Private Function Dial(ByVal Connection As String, ByVal phoneBook As String, ByVal username As String, ByVal password As String) As Integer
58            
59      Dim rp As RASDIALPARAMS, h As Long, resp As Long      Dim rp As RASDIALPARAMS, h As Long, resp As Long
# Line 112  Public Function RasConnect(conName As St Line 117  Public Function RasConnect(conName As St
117      errorCode = Dial(conName, phoneBook, username, password)      errorCode = Dial(conName, phoneBook, username, password)
118    
119      If (errorCode <> 0) Then      If (errorCode <> 0) Then
120          MsgBox "Error-Code: " & errorCode & vbCrLf & "http://www.admins-tipps.net/glossar/ras_errorcode.htm"          If errorCode = 691 Then
121                MsgBox "Fehler 691: Der Zugriff wurde verweigert, weil Benutzername und/oder Kennwort ungültig ist/sind."
122            Else
123                MsgBox "Fehler-Code: " & errorCode & vbCrLf & "http://www.admins-tipps.net/glossar/ras_errorcode.htm"
124            End If
125      End If      End If
126            
127      RasConnect = (errorCode = 0)      RasConnect = (errorCode = 0)
128    
129  End Function  End Function
130    
131    ' VpnDial.exe --setup {connection} --user {username} --pass {password}
132    Public Function SetupRasEntry(conName As String, phoneBook As String, username As String, password As String)
133        
134        Dim rdp As RASDIALPARAMS
135        Dim result As Long
136        
137        rdp.dwSize = Len(rdp) + 6
138        ChangeBytes conName, rdp.szEntryName
139        
140        ChangeBytes username, rdp.szUserName
141        ChangeBytes password, rdp.szPassword
142        
143        ' Set User name and password for the connection
144        RasSetEntryDialParams phoneBook, rdp, 0
145        
146    End Function

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed