It seems that I can't get this right... I'm using the following signature:
[DllImport("coredll.dll")]
private extern static uint RasGetEntryProperties(string lpszPhoneBook, string szEntry, ref RASENTRY lpbEntry,
ref int lpdwEntrySize, byte lpb, ref int lpdwSize);
Calling it with the following parameters:
RasGetEntryProperties(null, name, ref RasEntry, ref dwSize, 0, 128);
However, whenever this is called, an error pops up on my device telling me there has been a native exception, without much detail.
I've declared the RASENTRY struct as follows:
private struct RASENTRY
{
public int dwSize;
public int dwfOptions;
public int dwCountryID;
public int dwCountryCode;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxAreaCode + 1)]
public string szAreaCode;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxPhoneNumber + 1)]
public string szLocalPhoneNumber;
public int dwAlternatesOffset;
public RASIPADDR ipaddr;
public RASIPADDR ipaddrDns;
public RASIPADDR ipaddrDnsAlt;
public RASIPADDR ipaddrWins;
public RASIPADDR ipaddrWinsAlt;
public int dwFrameSize;
public int dwfNetProtocols;
public int dwFramingProtocol;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_PATH + 1)]
public string szScript;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_PATH + 1)]
public string szAutoDialDll;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_PATH + 1)]
public string szAutoDialFunc;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxDeviceType + 1)]
public string szDeviceType;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxDeviceName + 1)]
public string szDeviceName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxPadType + 1)]
public string szX25PadType;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxX25Address + 1)]
public string szX25Address;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxFacilities + 1)]
public string szX25Facilities;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxUserData + 1)]
public string szX25UserData;
public int dwChannels;
public int dwReserved1;
public int dwReserved2;
public int dwCustomAuthKey;
}
Any help would be appreciated, thanks!
-Brandon