RasGetConnectStatus 返回值 6 表示什么?

发布于 2024-10-25 01:32:16 字数 1010 浏览 4 评论 0原文

我正在尝试查询连接的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

那支青花 2024-11-01 01:32:17

您应该在这里找到答案 http://msdn.microsoft.com/en-us /library/aa920538.aspx 这是 RasGetConnectStatus 返回的 RASCONNSTATE 的枚举值。值 6 应等于 RASCS_AuthNotify,您将找到以下描述:

发生了身份验证事件。如果 dwError 为零,则此事件后将立即跟随更具体的身份验证状态之一。如果 dwError 不为零,则身份验证失败,错误值指示原因。

可能与某些阻止连接的防火墙规则有关。

更新链接来自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:

An authentication event has occurred. If dwError is zero, this event will be immediately followed by one of the more specific authentication states following. If dwError is nonzero, authentication has failed, and the error value indicates why.

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.

梦里的微风 2024-11-01 01:32:16

查找 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,它从该结构返回数据。

foreach (RasConnection conn in RasConnection.GetActiveConnections())
{
    RasConnectionStatus status = conn.GetConnectionStatus();
    // Do something useful.
}

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.

foreach (RasConnection conn in RasConnection.GetActiveConnections())
{
    RasConnectionStatus status = conn.GetConnectionStatus();
    // Do something useful.
}

The WinError.h file is also available online here: http://msdn.microsoft.com/en-us/library/ms819772.aspx

Hope that helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文