开发者

RASDIAL API not connecting on windows vista and windows 7 in release builds

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???


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜