Export (0) Print
Expand All
Expand Minimize

GetAuthDataForUser function

The GetAuthDataForUser function retrieves authentication information for a user from the Security Accounts Manager (SAM) database and puts it into a format suitable for the ConvertAuthDataToToken function.

Syntax


NTSTATUS GetAuthDataForUser(
  _In_   PSECURITY_STRING Name,
  _In_   SECPKG_NAME_TYPE NameType,
  _In_   PSECURITY_STRING Prefix,
  _Out_  PUCHAR *UserAuthData,
  _Out_  PULONG UserAuthDataSize,
  _Out_  PUNICODE_STRING UserFlatName
);

Parameters

Name [in]

Pointer to a UNICODE_STRING structure that specifies the name of the SAM account.

NameType [in]

A SECPKG_NAME_TYPE enumeration value that specifies the type of account name in Name. This parameter can be one of the following values.

ValueMeaning
SecNameSamCompatible

Name is compatible with the SAM. An example of a name in SAM-compatible format is "ExampleDomain\Username".

SecNameAlternateId

Name is in the AltSecId property of the SAM account. You must specify a value for the Prefix parameter when using this value.

SecNameFlat

Name is a flat user principal name (UPN) style account name.

SecNameDN

Name is the distinguished name of the object. For more information, see Remarks.

 

Prefix [in]

Pointer to a UNICODE_STRING structure that contains the prefix to use for names specified with the SecNameAlternateId NameType.

UserAuthData [out]

Pointer that receives the address of the retrieved data.

UserAuthDataSize [out]

Pointer to a ULONG that receives the size of the retrieved data.

UserFlatName [out]

Pointer to a UNICODE_STRING structure that receives the UPN, if applicable.

Return value

If the function succeeds, the return value is STATUS_SUCCESS.

If the function fails, the return value is an NTSTATUS code that indicates the reason it failed.

Remarks

The GetAuthDataForUser function combines the OpenSamUser, GetUserAuthData, and CloseSamUser functions into one call.

Pointers to these functions are available in the LSA_SECPKG_FUNCTION_TABLE structure received by the SpInitialize function.

Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Ntsecpkg.h

See also

CloseSamUser
GetUserAuthData
OpenSamUser
LSA_SECPKG_FUNCTION_TABLE
SpInitialize

 

 

Community Additions

ADD
Show:
© 2014 Microsoft