From fa00201ce1197a3e6ba065d7bc09a5c7f044650e Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Sun, 28 Mar 2004 12:19:07 +0000 Subject: [PATCH] basic implementation of WlxLoggedOutSAS() svn path=/trunk/; revision=8900 --- reactos/lib/msgina/msgina.c | 80 ++++++++++++++++++++++++++++++++++++- reactos/lib/msgina/stubs.c | 21 +--------- 2 files changed, 80 insertions(+), 21 deletions(-) diff --git a/reactos/lib/msgina/msgina.c b/reactos/lib/msgina/msgina.c index 61fdab00692..d6d81915402 100644 --- a/reactos/lib/msgina/msgina.c +++ b/reactos/lib/msgina/msgina.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: msgina.c,v 1.8 2004/03/27 23:24:51 weiden Exp $ +/* $Id: msgina.c,v 1.9 2004/03/28 12:19:07 weiden Exp $ * * PROJECT: ReactOS msgina.dll * FILE: lib/msgina/msgina.c @@ -459,6 +459,84 @@ WlxDisplaySASNotice( } +static PWSTR +DuplicationString(PWSTR Str) +{ + DWORD cb; + PWSTR NewStr; + + cb = (wcslen(Str) + 1) * sizeof(WCHAR); + if((NewStr = LocalAlloc(LMEM_FIXED, cb))) + { + memcpy(NewStr, Str, cb); + } + return NewStr; +} + + +/* + * @unimplemented + */ +int WINAPI +WlxLoggedOutSAS( + PVOID pWlxContext, + DWORD dwSasType, + PLUID pAuthenticationId, + PSID pLogonSid, + PDWORD pdwOptions, + PHANDLE phToken, + PWLX_MPR_NOTIFY_INFO pNprNotifyInfo, + PVOID *pProfile) +{ + PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext; + TOKEN_STATISTICS Stats; + DWORD cbStats; + + if(!phToken) + { + DbgPrint("msgina: phToken == NULL!\n"); + return WLX_SAS_ACTION_NONE; + } + + if(!LogonUser(L"Administrator", NULL, L"Secrect", + LOGON32_LOGON_INTERACTIVE, /* FIXME - use LOGON32_LOGON_UNLOCK instead! */ + LOGON32_PROVIDER_DEFAULT, + phToken)) + { + DbgPrint("msgina: Logonuser() failed\n"); + return WLX_SAS_ACTION_NONE; + } + + if(!(*phToken)) + { + DbgPrint("msgina: *phToken == NULL!\n"); + return WLX_SAS_ACTION_NONE; + } + + pgContext->UserToken =*phToken; + + *pdwOptions = 0; + *pProfile =NULL; + + if(!GetTokenInformation(*phToken, + TokenStatistics, + (PVOID)&Stats, + sizeof(TOKEN_STATISTICS), + &cbStats)) + { + DbgPrint("msgina: Couldn't get Autentication id from user token!\n"); + return WLX_SAS_ACTION_NONE; + } + *pAuthenticationId = Stats.AuthenticationId; + pNprNotifyInfo->pszUserName = DuplicationString(L"Administrator"); + pNprNotifyInfo->pszDomain = NULL; + pNprNotifyInfo->pszPassword = DuplicationString(L"Secret"); + pNprNotifyInfo->pszOldPassword = NULL; + + return WLX_SAS_ACTION_LOGON; +} + + BOOL STDCALL DllMain( HINSTANCE hinstDLL, diff --git a/reactos/lib/msgina/stubs.c b/reactos/lib/msgina/stubs.c index e14df0d1161..8a2106837c8 100644 --- a/reactos/lib/msgina/stubs.c +++ b/reactos/lib/msgina/stubs.c @@ -1,4 +1,4 @@ -/* $Id: stubs.c,v 1.6 2004/03/27 23:24:51 weiden Exp $ +/* $Id: stubs.c,v 1.7 2004/03/28 12:19:07 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS msgina.dll @@ -74,25 +74,6 @@ WlxIsLogoffOk( } -/* - * @unimplemented - */ -int WINAPI -WlxLoggedOutSAS( - PVOID pWlxContext, - DWORD dwSasType, - PLUID pAuthenticationId, - PSID pLogonSid, - PDWORD pdwOptions, - PHANDLE phToken, - PWLX_MPR_NOTIFY_INFO pNprNotifyInfo, - PVOID *pProfile) -{ - UNIMPLEMENTED; - return 0; -} - - /* * @unimplemented */