Share via


RasEnumEntries

This function lists all entry names in a remote access phone book.

DWORD RasEnumEntries(
LPWSTR Reserved, 
LPWSTR lpszPhoneBookPath, 
LPRASENTRYNAME lprasentryname, 
LPDWORD lpcb, 
LPDWORD lpcEntries );

Parameters

  • Reserved
    Reserved; set to NULL.
  • lpszPhoneBookPath
    Windows CE: This parameter is ignored. Dial-up networking stores phone-book entries in the registry rather than in a phone-book file.
  • lprasentryname
    Pointer to a buffer that receives an array of RASENTRYNAME structures, one for each phone-book entry. Before calling the function, an application must set the dwSize member of the first RASENTRYNAME structure in the buffer to sizeof(RASENTRYNAME) in order to identify the version of the structure being passed.
  • lpcb
    Pointer to a variable that that contains the size, in bytes, of the buffer specified by lprasentryname. On return, the function sets this variable to the number of bytes required to successfully complete the call.
  • lpcEntries
    Pointer to a variable that the function, if successful, sets to the number of phone-book entries written to the buffer specified by lprasentryname.

Return Values

Zero indicates success. A nonzero error value listed in the RAS header file, ERROR_BUFFER_TOO_SMALL, or ERROR_NOT_ENOUGH_MEMORY indicates failure.

Include Raserror.h for definitions of the RAS error codes.

Remarks

The following sample code enumerates the RAS phonebook entries on the current machine. The code initially calls RasEnumEntries to obtain the size of the buffer to pass in. The code then calls RasEnumEntries again, to enumerate the entries. Note that for both calls, the code sets the dwSize member of the first RASENTRY structure in the buffer to sizeof(RASENTRY) to specify the structure version.

lprasentryname = (LPRASENTRYNAME)LocalAlloc(GPTR,, sizeof(RASENTRYNAME));
cb = lpRasEntryName->dwSize = sizeof(RASENTRYNAME); 
if ((nRet = RasEnumEntries(NULL, NULL, lprasentryname, &cb, &cEntries)) 
    == ERROR_BUFFER_TOO_SMALL)
{
    lprasentryname = (LPRASENTRYNAME)GlobalAlloc(GPTR, cb);
    lprasentryname->dwSize = sizeof(RASENTRYNAME);
}

// Calling RasEnumEntries to enumerate the phonebook entries   
nRet = RasEnumEntries(NULL, NULL, lprasentryname, &cb, &cEntries);

if (nRet != ERROR_SUCCESS)
{
    printf("RasEnumEntries failed: Error %d\n", nRet);
}
else
{
    printf("Phone book entries in the default phonebook:\n\n");
    for(i=0;i < cEntries;i++)
    {
        printf("%s\n",lprasentryname->szEntryName);
        lprasentryname++;
    }
}

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 1.0 and later Ras.h, Afdfunc.h   Ppp.lib

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

RASENTRYNAME, RasEnumConnections

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.