RASCREDENTIALS structure

The RASCREDENTIALS structure is used with the RasGetCredentials and RasSetCredentials functions to specify the user credentials associated with a RAS phone-book entry.

Syntax

typedef struct {
  DWORD dwSize;
  DWORD dwMask;
  TCHAR szUserName[UNLEN + 1];
  TCHAR szPassword[PWLEN + 1];
  TCHAR szDomain[DNLEN + 1];
} RASCREDENTIALS, *LPRASCREDENTIALS;

Members

  • dwSize
    Specifies the size, in bytes, of the RASCREDENTIALS structure.

  • dwMask
    Specifies a set of bit flags. These flags indicate the members of this structure that are valid. On input, set the flags to indicate the members of interest. On output, the function sets the flags to indicate the members that contain valid data. This member can be a combination of the following values.

    Value Meaning
    RASCM_UserName

    The szUserName member is valid.

    RASCM_Password

    The szPassword member is valid.

    RASCM_Domain

    The szDomain member is valid.

    RASCM_DefaultCreds

    Indicates that the credentials are default credentials for an all-user connection.

    Windows 2000/NT:  This flag is unsupported.

    RASCM_PreSharedKey

    Specify this flag to either set or retrieve a pre-shared key. This flag cannot be used in combination with any other flag.

    Windows 2000/NT:  This flag is unsupported.

    RASCM_ServerPreSharedKey

    Used to set the pre-shared key for the RAS server.

    Windows 2000/NT:  This flag is unsupported.

    RASCM_DDMPreSharedKey

    Used to set the pre-shared key for a demand-dial interface.

    Windows 2000/NT:  This flag is unsupported.

     

     

    Use the RASCM_DefaultCreds flag with RasSetCredentials in order to set the default credentials for an all-user connection. If RasGetCredentials returns a RASCREDENTIALS structure with the RASCM_DefaultCreds flag set, the credentials returned are the default credentials for the connection.

Windows 2000: When retrieving credentials using the RasGetCredentials function, the dwMask member contains the RASCM_Password flag if the system has saved a password for the specified entry. If the system has no password saved for this entry, dwMask does not contain RASCM_Password.

  • szUserName
    Specifies a null-terminated string that contains a user name.

  • szPassword
    Specifies a null-terminated string that contains a password.

    When retrieving credentials using the RasGetCredentials function, the szPassword member does not receive the actual password. Instead, szPassword receives a handle to the saved password. Substitute this handle for the saved password in calls to RasSetCredentials and RasDial. When presented with this handle, RasDial retrieves and uses the saved password. The value of this handle may change in future versions of the operating system; do not develop code that depends on the contents or format of this value.

    If the dwMask member specifies that a pre-shared key should be used for the credentials, the szPassword member contains the pre-shared key. If the RASCREDENTIALS structure is used with RasGetCredentials, the value returned is a handle to the pre-shared key as described in the preceding paragraph.

  • szDomain
    A null-terminated string that contains a domain name.

Remarks

Pre-shared keys are useful in remote access scenarios in which L2TP/IPSec is deployed without a Public Key Infrastructure (PKI).

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Ras.h

Unicode and ANSI names

RASCREDENTIALSW (Unicode) and RASCREDENTIALSA (ANSI)

See also

Remote Access Service (RAS) Overview

Remote Access Service Structures

RASENTRY

RasGetCredentials

RasSetCredentials