RasGetEntryDevConfig

The RasGetEntryDevConfig function retrieves the device information saved by the last successful call to the RasSetEntryDevConfig function.

Syntax

DWORD RasGetEntryDevConfig(LPCTSTR lpszPhoneBook, LPCTSTR szEntry, LPDWORD pdwDeviceID, LPDWORD pdwSize, LPVARSTRING pDeviceConfig);

At a Glance

Header file: Afdfunc.h
Module: Ras
Platforms: H/PC
Windows CE versions: 1.0 and later

Parameters

lpszPhoneBook
This parameter is ignored and should be set to NULL. Dial-up networking stores phone-book entries in the registry rather than in a phone-book file.
szEntry
Pointer to a null-terminated string containing an existing entry name.
pdwDeviceID
Returns the saved device identifier.
pdwSize
Pointer to the size of the structure pointed to by pDeviceConfig. This should be filled with the size required.
pDeviceConfig
Pointer to the memory location of the type VARSTRING where the device configuration structure is returned. If NULL then only the correct size is returned.

Return Values

If the function succeeds, the return value is zero. If the function fails, the return value will be set to an error value:

ERROR_CANNOT_OPEN_PHONEBOOK
Invalid phone book.
ERROR_CANNOT_FIND_PHONEBOOK_ENTRY
Invalid szEntry.
ERROR_INVALID_PARAMETER
Invalid szEntry, pdwDeviceID or pdwSize parameter.
ERROR_BUFFER_TOO_SMALL
Specified buffer was too small.

Remarks

In Windows CE version 2.0 the RasGetEntryProperty function supports the same functionality as the RasGetEntryDevConfig function. An application should use the RasGetEntryProperties function to retrieve device information.

An example of how to use the RasGetEntryDevConfig function follows:

DWORD   dwDeviceID;
LPVARSTRING pDeviceConfig;
DWORD   dwSize;
TCHAR szBuf[50];

dwSize = 0;
if (RasGetEntryDevConfig (NULL, EntryName, &dwDeviceID,
                &dwSize, NULL)) {
    OutputDebugString(TEXT("\r\nError getting device info size\r\n"));
    return;
}
pDeviceConfig = LocalAlloc (LPTR, dwSize);
if (RasGetEntryDevConfig (NULL, EntryName, &dwDeviceID,
    &dwSize, pDeviceConfig)) {
    OutputDebugString(TEXT("\r\nError getting device info size\r\n"));
    return;
} else {
    wsprintf(szBuf, TEXT("dwDeviceID=%d\r\n"), dwDeviceID);    
    OutputDebugString(szBuf);
    if (pDeviceConfig) {
        wsprintf(szBuf, TEXT("Have a device config at: 0x%X\r\n"),
            pDeviceConfig));
        OutputDebugString(szBuf);
        LocalFree(pDeviceConfig);
    }
}