RASDIAL API 在发布版本中无法在 Windows Vista 和 Windows 7 上连接
我正在尝试在 Windows Vista 和 Windows 7 上使用 RASDIAL API 进行连接。我可以在 Windows XP 系统上轻松执行此操作。
我无法仅在发布版本中连接 Windows Vista 和 Windows 7。我可以通过调试版本来做到这一点。知道为什么会发生这种情况吗?我已经写下了我为此使用的代码。
我正在使用 Aventail VPN 10.x api 来设置自定义身份验证数据。
NGCUSTOMAUTHDATA NgAuthData;
NgAuthData.dwSize = sizeof(NgAuthData);
NgAuthData.dwOptions = NGCAD_OPTION_DisableGUI;
NgAuthData.dwAuthType = 2;
DWORD returnError=StringCbCopy( NgAuthData.szRealm,sizeof(NgAuthData.szRealm), wstringGroupName.c_str());
if (returnError != ERROR_SUCCESS){
return error;
}
DWORD nError = RasSetCustomAuthData(
pbkPath.c_str(),
wstringProfile.c_str(),
(BYTE *)&NgAuthData, NgAuthData.dwSize );
// Fill RASDIALPARAMS structure
RASDIALPARAMS rasdialparams;
rasdialparams.dwSize = sizeof(RASDIALPARAMS);
returnError |= StringCbCopy( rasdialparams.szEntryName,
sizeof(rasdialparams.szEntryName), wstringProfile.c_str() );
returnError |= StringCbCopy( rasdialparams.szPhoneNumber,
sizeof(rasdialparams.szPhoneNumber), wstringUrl.c_str() );
returnError |= StringCbCopy( rasdialparams.szUserName,
sizeof(rasdialparams.szUserName), wstringUser.c_str());
returnError |= StringCbCopy( rasdialparams.szPassword,
sizeof(rasdialparams.szPassword), wstringPassword.c_str() );
returnError |= StringCbCopy( rasdialparams.szDomain,
sizeof(rasdialparams.szDomain), wstringGroupName.c_str());
returnError |= StringCbCopy( rasdialparams.szDomain,
sizeof(rasdialparams.szDomain), L"\0");
if (returnError != ERROR_SUCCESS){
return error;
}
大多数时候,我不断收到内部身份验证错误。 请问你能指出我的问题吗???
I am trying to connect using RASDIAL API on windows vista and windows 7. I am able to easily do this on windows XP systems.
I am not able to connect on windows vista and windows 7 only in release build. I am able to do this via the debug builds. Any idea why this is happening? I have written down the code i am using for this.
I am using the Aventail VPN 10.x apis to set custom auth data.
NGCUSTOMAUTHDATA NgAuthData;
NgAuthData.dwSize = sizeof(NgAuthData);
NgAuthData.dwOptions = NGCAD_OPTION_DisableGUI;
NgAuthData.dwAuthType = 2;
DWORD returnError=StringCbCopy( NgAuthData.szRealm,sizeof(NgAuthData.szRealm), wstringGroupName.c_str());
if (returnError != ERROR_SUCCESS){
return error;
}
DWORD nError = RasSetCustomAuthData(
pbkPath.c_str(),
wstringProfile.c_str(),
(BYTE *)&NgAuthData, NgAuthData.dwSize );
// Fill RASDIALPARAMS structure
RASDIALPARAMS rasdialparams;
rasdialparams.dwSize = sizeof(RASDIALPARAMS);
returnError |= StringCbCopy( rasdialparams.szEntryName,
sizeof(rasdialparams.szEntryName), wstringProfile.c_str() );
returnError |= StringCbCopy( rasdialparams.szPhoneNumber,
sizeof(rasdialparams.szPhoneNumber), wstringUrl.c_str() );
returnError |= StringCbCopy( rasdialparams.szUserName,
sizeof(rasdialparams.szUserName), wstringUser.c_str());
returnError |= StringCbCopy( rasdialparams.szPassword,
sizeof(rasdialparams.szPassword), wstringPassword.c_str() );
returnError |= StringCbCopy( rasdialparams.szDomain,
sizeof(rasdialparams.szDomain), wstringGroupName.c_str());
returnError |= StringCbCopy( rasdialparams.szDomain,
sizeof(rasdialparams.szDomain), L"\0");
if (returnError != ERROR_SUCCESS){
return error;
}
Most of the time, I keep getting internal authentication error.
Please could you point me to the issue???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是因为我没有初始化 rasdialparams 中的所有参数。此外,在使用之前,我们需要将 ngauthdata 中的掩码参数设置为其各自的值。
It was because I wasn't initializing all the parameters in rasdialparams. Also we need to set the mask param in the ngauthdata to its respective values before we use it.