在.NET CF中使用RasGetEntryProperties [英] Using RasGetEntryProperties in .NET CF
本文介绍了在.NET CF中使用RasGetEntryProperties的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
看来我做不到这一点...我正在使用以下签名:
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);
但是,每当调用此方法时,我的设备上都会弹出一个错误消息,告诉我有一个本机异常,没有太多细节.
我已经声明了RASENTRY结构,如下所示:
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;
}
任何帮助将不胜感激,谢谢!
-Brandon
Any help would be appreciated, thanks!
-Brandon
推荐答案
有人吗? :(
我已经更新了签名,如上所示.但是,该函数现在返回ERROR_NOINTERFACE.函数定义是否仍然错误?
Anyone? :(
I''ve updated the signature as displayed above. However, the function now returns ERROR_NOINTERFACE. Is the function definition still wrong?
这篇关于在.NET CF中使用RasGetEntryProperties的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文