Share via


PPTP Code Sample

The following code example shows how to establish a PPTP connection.

PTCHAR szEntryName = TEXT("My VPN Connection");
RASENTRY rasEntry;
DWORD rasEntrySize;

rasEntrySize = sizeof(rasEntry);
memset(&rasEntry, 0, sizeof(rasEntry));
rasEntry.dwSize = sizeof(rasEntry);
rasEntry.dwfOptions = RASEO_RequireMsEncryptedPw | RASEO_RequireDataEncryption;
_tcscpy(rasEntry.szLocalPhoneNumber, TEXT("MyPPTPServerName"));
_tcscpy(rasEntry.szDeviceType, RASDT_Vpn);
_tcscpy(rasEntry.szDeviceName, TEXT("RAS VPN Line 0"));

dwResult = RasSetEntryProperties(NULL, szEntryName, &rasEntry, sizeof(rasEntry), NULL, 0);
if (dwResult != 0)
{
   NKDbgPrintfW(L"RasSetEntryProperties %s failed error=%d\n", szEntryName, dwResult);
}

See Also

Establishing a PPTP Connection

 Last updated on Friday, April 09, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.