MprAdminInterfaceGetCredentials

Use the MprAdminInterfaceGetCredentials function to retrieve the domain, user name, and password for dialing out on the specified demand-dial interface.

DWORD MprAdminInterfaceGetCredentials(
  LPWSTR lpwsServer,           // string containing name
                               // of router
  LPWSTR lpwsInterfaceName,    // string containing name
                               // of interface
  LPWSTR lpwsUserName,         // string to receive user name
  LPWSTR lpwsPassword,         // string to receive password
  LPWSTR lpwsDomainName        // string to receive domain name
);

Parameters

lpwsServer
[in] Pointer to a Unicode string that specifies the name of the Windows 2000 router on which to execute this call.

This parameter is optional. If the calling application specifies NULL for this parameter, the call is executed on the local machine.

lpwsInterfaceName
[in] Pointer to a Unicode string that specifies the name of the demand-dial interface. Use MprAdminInterfaceGetInfo to obtain the interface name.
lpwsUserName
[out] Pointer to a Unicode string that receives the name of the user. This string should be UNLEN+1 long.

This parameter is optional. If the calling application specifies NULL for this parameter, the function does not return the user name.

lpwsPassword
[out] Pointer to a Unicode string that receives the password. This string should be PWLEN+1 long.

This parameter is optional. If the calling application specifies NULL for this parameter, the function does not return the password.

lpwsDomainName
[out] Pointer to a Unicode string that receives the domain name. This string should be DNLEN+1 long.

This parameter is optional. If the calling application specifies NULL for this parameter, the function does not return the domain name.

Return Values

If the function succeeds, the return value is NO_ERROR.

If the function fails, the return value is one of the following error codes.

Value Meaning
ERROR_CANNOT_FIND_PHONEBOOK_ENTRY The specified interface does not have any demand-dial parameters associated with it.
ERROR_INVALID_PARAMETER At least one of the following is true:
  • The lpwsInterfaceName parameter is NULL.
  • The lpwsUserName, lpwsPassword, and lpwsDomainName parameters are all NULL.
Other Use FormatMessage to retrieve the system error message that corresponds to the error code returned.

Remarks

The lpwsUserName, lpwsPassword, and lpwsDomainName parameters are optional. However, if the calling application specifies NULL for all three parameters, MprAdminInterfaceGetCredentials returns ERROR_INVALID_PARAMETER.

The constants UNLEN, PWLEN, and DNLEN are the maximum lengths for the user name, password, and domain name. These constants are defined in lmcons.h.

Note that the order of the parameters in MprAdminInterfaceGetCredentials is different from MprAdminInterfaceSetCredentials.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Header: Declared in Mprapi.h.
  Library: Use Mprapi.lib.

See Also

Router Management Reference, Router Administration Functions, FormatMessage, MprAdminInterfaceSetCredentials