RasValidateEntryName function

The RasValidateEntryName function validates the format of a connection entry name. The name must contain at least one non-white-space alphanumeric character.

Syntax


DWORD RasValidateEntryName(
  _In_ LPCTSTR lpszPhonebook,
  _In_ LPCTSTR lpszEntry
);

Parameters

lpszPhonebook [in]

A pointer to a null-terminated string that specifies the full path and file name of a phone-book (PBK) file. If this parameter is NULL, the function uses the current default phone-book file.

Windows Me/98/95:  This parameter should always be NULL. Dial-up networking stores phone-book entries in the registry rather than in a phone-book file.

lpszEntry [in]

Pointer to a null-terminated string that specifies an entry name.

The following characters are not allowed in an entry name.

CharacterMeaning
|

vertical bar

>

greater than symbol

<

less than symbol

?

question mark

*

asterisk

\

backward slash

/

forward slash

:

colon

 

Windows 2000 or later:  The entry name cannot begin with a period (".").

Return value

If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails, the return value is one of the following error codes or a value from Routing and Remote Access Error Codes or Winerror.h.

ValueMeaning
ERROR_ALREADY_EXISTS

The entry name already exists in the specified phonebook.

ERROR_CANNOT_FIND_PHONEBOOK

The specified phonebook doesn't exist.

ERROR_INVALID_NAME

The format of the specified entry name is invalid.

 

Remarks

The following sample code validates the phone-book entry specified by the variable lpszEntry.


#include <windows.h>
#include <stdio.h>
#include "ras.h"
#include <tchar.h>

DWORD __cdecl wmain(){

    LPTSTR lpszEntry = L"EntryName\0";

    DWORD nRet = RasValidateEntryName(NULL, lpszEntry);

    switch (nRet)
    {
        case ERROR_SUCCESS:
            printf("Entry name: %s is valid but doesn't exist in the default phone book\n", lpszEntry);
            break;
        case ERROR_INVALID_NAME:
            printf("Entry name: %s is invalid\n", lpszEntry);
            break;
        case ERROR_ALREADY_EXISTS:
            printf("Entry name: %s already exists in the default phone book\n", lpszEntry);
            break;
        default:
            printf("RasValidateEntryName failed: Error = %d\n", nRet);
            break;
    }
}


Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Ras.h

Library

Rasapi32.lib

DLL

Rasapi32.dll

Unicode and ANSI names

RasValidateEntryNameW (Unicode) and RasValidateEntryNameA (ANSI)

See also

Remote Access Service (RAS) Overview
Remote Access Service Functions
RasCreatePhonebookEntry
RasGetEntryProperties

 

 

Show: