RasEnumEntries (Windows CE 5.0)

Send Feedback

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

DWORDRasEnumEntries(LPWSTRReserved, LPWSTRlpszPhoneBookPath, LPRASENTRYNAMElprasentryname, LPDWORDlpcb, LPDWORDlpcEntries );

Parameters

  • Reserved
    Reserved; set to NULL.
  • lpszPhoneBookPath
    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(LPTR, sizeof(RASENTRYNAME));
lprasentryname->dwSize = sizeof(RASENTRYNAME);
if ((nRet = RasEnumEntries(NULL, NULL, lprasentryname, &cb, &cEntries)) 
    == ERROR_BUFFER_TOO_SMALL)
{
    lprasentryname = (LPRASENTRYNAME)LocalAlloc(LPTR, 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

OS Versions: Windows CE 1.0 and later.
Header: Ras.h.
Link Library: Coredll.lib.

See Also

RasEnumConnections | RASENTRYNAME

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.