The RasRenameEntry function renames a phone-book entry in the registry, while the RasDeleteEntry function deletes an entry. To verify if the string is in the correct format, the application can use the RasValidateEntryName function.
The following code example shows how to change an existing phone-book entry.
BOOL RenameRasEntry (LPTSTR lpszOldName, LPTSTR lpszNewName)
{
DWORD dwError; // Return code from functions
TCHAR szError[120]; // Buffer for error message
if (dwError = RasValidateEntryName (NULL, lpszNewName))
{
wsprintf (szError, TEXT("Entry name validation failed: %ld"),
dwError);
return FALSE;
}
if (dwError = RasRenameEntry (NULL, lpszOldName, lpszNewName))
{
wsprintf (szError, TEXT("Unable to rename entry: %ld"), dwError);
return FALSE;
}
return TRUE;
}