RasGetConnectStatus 返回值 6 表示什么?
我正在尝试查询连接的 RasStatus。当我调用 RasGetConnectStatus 方法时,它返回 6。我在读过的任何文档中都没有找到该特定的返回值。
以下是我查看过的一些页面:
http ://www.cs.scranton.edu/~beidler/Ada/win32/win32-raserror.html
http://msdn.microsoft.com/en-us/library/aa920162.aspx
http://msdn.microsoft.com/en-us/library/bb530704(v=vs.85).aspx
我正在使用 C# 和 .net 4.0
编辑:实际调用的代码如下:
uint result;
RASCONNSTATUS rasconnstatus; // http://pinvoke.net/default.aspx/Structures/RASCONNSTATUS.html
// _handle is previously set to the hwnd of the ras connection
result = RASAPI.RasGetConnectStatus(_handle, out rasconnstatus);
return rasconnstatus;
当返回时, result == 6 和 rasconnstatus.rasconnstate == 0
我需要找出的是为什么 result == 6。
I'm trying to query the RasStatus of a connection. When I call the RasGetConnectStatus method, it returns 6. I've not found that particular return value in any of the documentation that I've read.
Here are some of the pages that I've looked at:
http://www.cs.scranton.edu/~beidler/Ada/win32/win32-raserror.html
http://msdn.microsoft.com/en-us/library/aa920162.aspx
http://msdn.microsoft.com/en-us/library/bb530704(v=vs.85).aspx
I'm using C# and .net 4.0
Edit: The code that actually calls follows:
uint result;
RASCONNSTATUS rasconnstatus; // http://pinvoke.net/default.aspx/Structures/RASCONNSTATUS.html
// _handle is previously set to the hwnd of the ras connection
result = RASAPI.RasGetConnectStatus(_handle, out rasconnstatus);
return rasconnstatus;
When this returns, result == 6 and rasconnstatus.rasconnstate == 0
What I need to find out is why result == 6.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该在这里找到答案 http://msdn.microsoft.com/en-us /library/aa920538.aspx 这是 RasGetConnectStatus 返回的 RASCONNSTATE 的枚举值。值 6 应等于 RASCS_AuthNotify,您将找到以下描述:
可能与某些阻止连接的防火墙规则有关。
更新链接来自windows mobile 6.5文档。
对于 Windows 版本,请点击此链接。
Here you should find your answer http://msdn.microsoft.com/en-us/library/aa920538.aspx this is the enum values of RASCONNSTATE returned by RasGetConnectStatus. The value 6 should equal to RASCS_AuthNotify and you will find this description:
Maybe is related with some firewall rules that block the connection.
update the link is from windows mobile 6.5 documentation.
for the windows one this link.
查找 Win32 错误代码的最简单方法是直接查看 Windows SDK 中的头文件。其中大部分位于 Windows SDK 安装位置的 include 文件夹中的 WinError.h 文件中。对于 RAS 特定错误(结果将在 600 到 900 之间),这些错误位于 RasError.h 文件中。
如果你的结果是6,则表示ERROR_INVALID_HANDLE;在 RAS 中,这意味着它不喜欢您传递给函数的连接句柄。在您的代码示例中,这将是 _handle。
顺便说一句,您可能想看看在 CodePlex 上使用 DotRas 项目,它是 RAS API 的 .NET 包装器。您感兴趣的特定方法是 RasConnection.GetConnectionStatus,它从该结构返回数据。
WinError.h 文件也可以在此处在线获取:http://msdn.microsoft。 com/en-us/library/ms819772.aspx
希望有帮助!
The easiest way to look up Win32 error codes is by looking at the header files directly in the Windows SDK. Most of them are in the WinError.h file in the include folder wherever you installed the Windows SDK. For the RAS specific errors (the result would be between 600 and 900) those are in the RasError.h file.
In the case of your result being 6, it's indicating ERROR_INVALID_HANDLE; which in RAS that means it didn't like the connection handle you passed to the function. In your code sample, that would be _handle.
By the way, you may want to look at using the DotRas project on CodePlex, it's a .NET wrapper around the RAS API. The particular method you're interested in would be RasConnection.GetConnectionStatus, it returns the data from that structure.
The WinError.h file is also available online here: http://msdn.microsoft.com/en-us/library/ms819772.aspx
Hope that helps!