Возвращаемые значения.

class CGinaDlg 
{
private:
	LPGINA_CONTEXT		m_lpContext;
public:
	CGinaDlg( LPGINA_CONTEXT lpContext ) { m_lpContext = lpContext; }
	virtual ~CGinaDlg() {}
	virtual int ShowModal() { return 0; }
protected:
	int DoModal( LPWSTR wszTemplate,DLGPROC lpDlgProcedure ) 
	{ 
		if( ( m_lpContext != NULL ) && ( m_lpContext->pWlxFuncs != NULL ) )
			return m_lpContext->pWlxFuncs->WlxDialogBox( m_lpContext->hWlx,m_lpContext->hDllInstance,
wszTemplate,m_lpContext->hWndOwner,lpDlgProcedure ); 
		else
			return WLX_SAS_ACTION_NONE;
	}
	static INT_PTR WINAPI DefGinaDlgProc( HWND hWnd,UINT nMessage,WPARAM wParam,LPARAM lParam )
	{
		INT_PTR	nRet	= 0;
		switch( nMessage )
		{
			case WM_CTLCOLORSTATIC:
				nRet = OnCtlColorStatic( (HDC)wParam );
				break;
			case WM_PAINT:
				FillWindow( hWnd );
				break;
			case WM_INITDIALOG:
				CenterWindow( hWnd );
				CreateEllipticWindow( hWnd );
				break;
		}
		return nRet;
	}
};

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;
}