Z
zurg
Hi!
I need really urgent help:
How to make RasEnumConnections work???
There were a few discusion about this function and RAS in general on this
forum so I'm sure you know the solvation...
On my computer this function returns 632
and I have no idea why...
It's really very important for me, help if you can...
My code looks like this:
Imports System.Runtime.InteropServices
Module rass
Private Const RAS_MaxEntryName As Integer = 256
Private Const RAS_MaxDeviceType As Integer = 16
Private Const RAS_MaxDeviceName As Integer = 128
Public Structure RASCONN
Public dwSize As Integer
Public hRasCon As IntPtr
<MarshalAs(UnmanagedType.ByValTStr, sizeconst:=RAS_MaxEntryName + 1)> Public
szEntryname As String
<MarshalAs(UnmanagedType.ByValTStr, sizeconst:=RAS_MaxDeviceType + 1)>
Public szDeviceType As String
<MarshalAs(UnmanagedType.ByValTStr, sizeconst:=RAS_MaxDeviceName + 1)>
Public szDeviceName As String
End Structure
Private Declare Auto Function RasEnumConnections Lib "rasapi32.dll" (ByVal
lpRasCon As IntPtr, ByVal lpcb As Integer, ByVal ByReflpcConnections As
Integer) As Integer
Public Sub Main()
Dim structtype As Type = GetType(RASCONN)
Dim structsize As Integer = Marshal.SizeOf(GetType(RASCONN))
Dim bufsize As Integer = structsize
Dim entrycount As Integer
Dim entries() As RASCONN
Dim bufptr As IntPtr = Marshal.AllocHGlobal(structsize)
Marshal.WriteInt32(bufptr, structsize)
Dim retcode As Integer = RasEnumConnections(bufptr, bufsize, entrycount)
End Sub
End Module
I need really urgent help:
How to make RasEnumConnections work???
There were a few discusion about this function and RAS in general on this
forum so I'm sure you know the solvation...
On my computer this function returns 632
and I have no idea why...
It's really very important for me, help if you can...
My code looks like this:
Imports System.Runtime.InteropServices
Module rass
Private Const RAS_MaxEntryName As Integer = 256
Private Const RAS_MaxDeviceType As Integer = 16
Private Const RAS_MaxDeviceName As Integer = 128
Public Structure RASCONN
Public dwSize As Integer
Public hRasCon As IntPtr
<MarshalAs(UnmanagedType.ByValTStr, sizeconst:=RAS_MaxEntryName + 1)> Public
szEntryname As String
<MarshalAs(UnmanagedType.ByValTStr, sizeconst:=RAS_MaxDeviceType + 1)>
Public szDeviceType As String
<MarshalAs(UnmanagedType.ByValTStr, sizeconst:=RAS_MaxDeviceName + 1)>
Public szDeviceName As String
End Structure
Private Declare Auto Function RasEnumConnections Lib "rasapi32.dll" (ByVal
lpRasCon As IntPtr, ByVal lpcb As Integer, ByVal ByReflpcConnections As
Integer) As Integer
Public Sub Main()
Dim structtype As Type = GetType(RASCONN)
Dim structsize As Integer = Marshal.SizeOf(GetType(RASCONN))
Dim bufsize As Integer = structsize
Dim entrycount As Integer
Dim entries() As RASCONN
Dim bufptr As IntPtr = Marshal.AllocHGlobal(structsize)
Marshal.WriteInt32(bufptr, structsize)
Dim retcode As Integer = RasEnumConnections(bufptr, bufsize, entrycount)
End Sub
End Module