barryjones
barryjones

Reputation: 2309

RASDIAL API not connecting on 64bit systems [ Works awesome on 32bit systems / VPN]

I am basically trying to connect to a VPN connection using the windows api. It works like a charm on any windows 32bit systems. It always connects. But when I try to connect it on a 64 bit system. It always fails. Please could you suggest, if I am doing anything wrong.

This is my code:

    LPRASDIALPARAMS      rdParams; 
    DWORD               cb = sizeof(RASDIALPARAMS);
    rdParams = (LPRASDIALPARAMS)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb); 
    rdParams->dwSize = sizeof(RASDIALPARAMS);
    dwError |= StringCbCopyW( rdParams->szEntryName,
        sizeof(rdParams->szEntryName), yourProfile.c_str() );
    dwError |= StringCbCopyW( rdParams->szPhoneNumber,
        sizeof(rdParams->szPhoneNumber), yourUrl.c_str() );
    dwError |= StringCbCopyW( rdParams->szUserName,
        sizeof(rdParams->szUserName), yourUser.c_str());
    dwError |= StringCbCopyW( rdParams->szPassword,
        sizeof(rdParams->szPassword), yourPassword.c_str() );
    dwError |= StringCbCopyW( rdParams->szDomain,
        sizeof(rdParams->szDomain), yourGroupName.c_str());
    dwError |= StringCbCopyW( rdParams->szDomain,
        sizeof(rdParams->szDomain), L"\0");

    HRASCONN hRasConn = NULL;
    DWORD dwRet = RasDial( NULL, pbkPath.c_str(),
        rdParams, 0, 0L, &hRasConn );

Is there anything that I need to set specific to 64bit systems.

Upvotes: 1

Views: 684

Answers (1)

barryjones
barryjones

Reputation: 2309

Basically you would need to access the dll or lib from a 64bit application instead of 32bit. make sure your application is a 64bit app.

Upvotes: 1

Related Questions