Процесс регистрации пользователя.

int WINAPI WlxLoggedOutSAS( PVOID pWlxContext,DWORD dwSasType,PLUID pAuthenticationId,PSID pLogonSid,
PDWORD pdwOptions,PHANDLE phToken,PWLX_MPR_NOTIFY_INFO pNprNotifyInfo,PVOID *pProfile )
{
	LPGINA_CONTEXT		lpContext	= (LPGINA_CONTEXT)pWlxContext;
	int			nRet;
	CCredDlg*		lpDialog;
	WLX_PROFILE_V1_0	wlxProfile;
	WLX_PROFILE_V1_0*	lpProfile	= NULL;
	LPWSTR			wszUserName = NULL;
	LPWSTR			wszUserPassword = NULL;
	LPWSTR			wszUserDomain = NULL;
	*pdwOptions = WLX_LOGON_OPT_NO_PROFILE;
	*pProfile = NULL;
	ZeroMemory( &wlxProfile,sizeof(WLX_PROFILE_V1_0) );
	if( !phToken )
		return WLX_SAS_ACTION_NONE;
	lpDialog = new CCredDlg( lpContext );
	nRet = lpDialog->ShowModal();
	if( nRet == WLX_DLG_SAS )
	{
		lpDialog->GetCredentials( wszUserName,wszUserDomain,wszUserPassword );
		wszUserName = DupString( wszUserName );
		wszUserPassword = DupString( wszUserPassword );
		wszUserDomain = DupString( wszUserDomain );
	}
	delete lpDialog;
	if( nRet != WLX_DLG_SAS )
		return WLX_SAS_ACTION_NONE;
	nRet = WLX_SAS_ACTION_NONE;
	if( ( DoLogon( wszUserName,wszUserDomain,wszUserPassword,phToken,&wlxProfile ) == STATUS_SUCCESS )
 && ( *phToken ) )
	{
		if( GetLogonSID( *phToken,pAuthenticationId,pLogonSid ) )
		{
			CopySid( GetLengthSid(&lpContext->sid),&lpContext->sid,pLogonSid );
			lpContext->hUserToken = *phToken;
			lpProfile = (WLX_PROFILE_V1_0*)LocalAlloc( LMEM_FIXED | LMEM_ZEROINIT,sizeof
(WLX_PROFILE_V1_0) );
			if( lpProfile != NULL )
			{
				lpProfile->dwType = wlxProfile.dwType;
				lpProfile->pszProfile = DupString( wlxProfile.pszProfile );
				*pdwOptions = 0;
			}
			pNprNotifyInfo->pszUserName = DupString( wszUserName );
			pNprNotifyInfo->pszDomain = DupString( wszUserDomain );
			pNprNotifyInfo->pszPassword = DupString( wszUserPassword );
			pNprNotifyInfo->pszOldPassword = NULL;
			nRet = WLX_SAS_ACTION_LOGON;
		}
		FreeString( wlxProfile.pszProfile );
	}

	FreeCredentials( wszUserName,wszUserDomain,wszUserPassword );
	return nRet;
}

Поделитесь материалом с коллегами и друзьями