ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

msgina.c
Go to the documentation of this file.
00001 /*
00002  *  ReactOS GINA
00003  *  Copyright (C) 2003-2004, 2006 ReactOS Team
00004  *
00005  *  This program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2 of the License, or
00008  *  (at your option) any later version.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License along
00016  *  with this program; if not, write to the Free Software Foundation, Inc.,
00017  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00018  */
00019 /*
00020  * PROJECT:         ReactOS msgina.dll
00021  * FILE:            dll/win32/msgina/msgina.c
00022  * PURPOSE:         ReactOS Logon GINA DLL
00023  * PROGRAMMER:      Thomas Weidenmueller (w3seek@users.sourceforge.net)
00024  *                  Hervé Poussineau (hpoussin@reactos.org)
00025  */
00026 
00027 #include "msgina.h"
00028 
00029 WINE_DEFAULT_DEBUG_CHANNEL(msgina);
00030 
00031 HINSTANCE hDllInstance;
00032 
00033 extern GINA_UI GinaGraphicalUI;
00034 extern GINA_UI GinaTextUI;
00035 static PGINA_UI pGinaUI;
00036 
00037 /*
00038  * @implemented
00039  */
00040 BOOL WINAPI
00041 WlxNegotiate(
00042     IN DWORD dwWinlogonVersion,
00043     OUT PDWORD pdwDllVersion)
00044 {
00045     TRACE("WlxNegotiate(%lx, %p)\n", dwWinlogonVersion, pdwDllVersion);
00046 
00047     if(!pdwDllVersion || (dwWinlogonVersion < WLX_VERSION_1_3))
00048         return FALSE;
00049 
00050     *pdwDllVersion = WLX_VERSION_1_3;
00051 
00052     return TRUE;
00053 }
00054 
00055 static LONG
00056 ReadRegSzKey(
00057     IN HKEY hKey,
00058     IN LPCWSTR pszKey,
00059     OUT LPWSTR* pValue)
00060 {
00061     LONG rc;
00062     DWORD dwType;
00063     DWORD cbData = 0;
00064     LPWSTR Value;
00065 
00066     if (!pValue)
00067         return ERROR_INVALID_PARAMETER;
00068 
00069     *pValue = NULL;
00070     rc = RegQueryValueExW(hKey, pszKey, NULL, &dwType, NULL, &cbData);
00071     if (rc != ERROR_SUCCESS)
00072         return rc;
00073     if (dwType != REG_SZ)
00074         return ERROR_FILE_NOT_FOUND;
00075     Value = HeapAlloc(GetProcessHeap(), 0, cbData + sizeof(WCHAR));
00076     if (!Value)
00077         return ERROR_NOT_ENOUGH_MEMORY;
00078     rc = RegQueryValueExW(hKey, pszKey, NULL, NULL, (LPBYTE)Value, &cbData);
00079     if (rc != ERROR_SUCCESS)
00080     {
00081         HeapFree(GetProcessHeap(), 0, Value);
00082         return rc;
00083     }
00084     /* NULL-terminate the string */
00085     Value[cbData / sizeof(WCHAR)] = '\0';
00086 
00087     *pValue = Value;
00088     return ERROR_SUCCESS;
00089 }
00090 
00091 static VOID
00092 ChooseGinaUI(VOID)
00093 {
00094     HKEY ControlKey = NULL;
00095     LPWSTR SystemStartOptions = NULL;
00096     LPWSTR CurrentOption, NextOption; /* Pointers into SystemStartOptions */
00097     BOOL ConsoleBoot = FALSE;
00098     LONG rc;
00099 
00100     rc = RegOpenKeyExW(
00101         HKEY_LOCAL_MACHINE,
00102         L"SYSTEM\\CurrentControlSet\\Control",
00103         0,
00104         KEY_QUERY_VALUE,
00105         &ControlKey);
00106 
00107     rc = ReadRegSzKey(ControlKey, L"SystemStartOptions", &SystemStartOptions);
00108     if (rc != ERROR_SUCCESS)
00109         goto cleanup;
00110 
00111     /* Check for CMDCONS in SystemStartOptions */
00112     CurrentOption = SystemStartOptions;
00113     while (CurrentOption)
00114     {
00115         NextOption = wcschr(CurrentOption, L' ');
00116         if (NextOption)
00117             *NextOption = L'\0';
00118         if (wcsicmp(CurrentOption, L"CONSOLE") == 0)
00119         {
00120             TRACE("Found %S. Switching to console boot\n", CurrentOption);
00121             ConsoleBoot = TRUE;
00122             goto cleanup;
00123         }
00124         CurrentOption = NextOption ? NextOption + 1 : NULL;
00125     }
00126 
00127 cleanup:
00128     if (ConsoleBoot)
00129         pGinaUI = &GinaTextUI;
00130     else
00131         pGinaUI = &GinaGraphicalUI;
00132 
00133     if (ControlKey != NULL)
00134         RegCloseKey(ControlKey);
00135     HeapFree(GetProcessHeap(), 0, SystemStartOptions);
00136 }
00137 
00138 /*
00139  * @implemented
00140  */
00141 BOOL WINAPI
00142 WlxInitialize(
00143     LPWSTR lpWinsta,
00144     HANDLE hWlx,
00145     PVOID  pvReserved,
00146     PVOID  pWinlogonFunctions,
00147     PVOID  *pWlxContext)
00148 {
00149     PGINA_CONTEXT pgContext;
00150 
00151     UNREFERENCED_PARAMETER(pvReserved);
00152 
00153     pgContext = (PGINA_CONTEXT)LocalAlloc(LMEM_FIXED | LMEM_ZEROINIT, sizeof(GINA_CONTEXT));
00154     if(!pgContext)
00155     {
00156         WARN("LocalAlloc() failed\n");
00157         return FALSE;
00158     }
00159 
00160     /* Return the context to winlogon */
00161     *pWlxContext = (PVOID)pgContext;
00162     pgContext->hDllInstance = hDllInstance;
00163 
00164     /* Save pointer to dispatch table */
00165     pgContext->pWlxFuncs = (PWLX_DISPATCH_VERSION_1_3)pWinlogonFunctions;
00166 
00167     /* Save the winlogon handle used to call the dispatch functions */
00168     pgContext->hWlx = hWlx;
00169 
00170     /* Save window station */
00171     pgContext->station = lpWinsta;
00172 
00173     /* Clear status window handle */
00174     pgContext->hStatusWindow = 0;
00175 
00176     /* Notify winlogon that we will use the default SAS */
00177     pgContext->pWlxFuncs->WlxUseCtrlAltDel(hWlx);
00178 
00179     /* Locates the authentification package */
00180     //LsaRegisterLogonProcess(...);
00181 
00182     /* Check autologon settings the first time */
00183     pgContext->AutoLogonState = AUTOLOGON_CHECK_REGISTRY;
00184 
00185     ChooseGinaUI();
00186     return pGinaUI->Initialize(pgContext);
00187 }
00188 
00189 /*
00190  * @implemented
00191  */
00192 BOOL WINAPI
00193 WlxStartApplication(
00194     PVOID pWlxContext,
00195     PWSTR pszDesktopName,
00196     PVOID pEnvironment,
00197     PWSTR pszCmdLine)
00198 {
00199     PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
00200     STARTUPINFOW StartupInfo;
00201     PROCESS_INFORMATION ProcessInformation;
00202     WCHAR CurrentDirectory[MAX_PATH];
00203     HANDLE hAppToken;
00204     UINT len;
00205     BOOL ret;
00206 
00207     len = GetWindowsDirectoryW(CurrentDirectory, MAX_PATH);
00208     if (len == 0 || len > MAX_PATH)
00209     {
00210         WARN("GetWindowsDirectoryW() failed\n");
00211         return FALSE;
00212     }
00213 
00214     ret = DuplicateTokenEx(pgContext->UserToken, MAXIMUM_ALLOWED, NULL, SecurityImpersonation, TokenPrimary, &hAppToken);
00215     if (!ret)
00216     {
00217         WARN("DuplicateTokenEx() failed with error %lu\n", GetLastError());
00218         return FALSE;
00219     }
00220 
00221     ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW));
00222     ZeroMemory(&ProcessInformation, sizeof(PROCESS_INFORMATION));
00223     StartupInfo.cb = sizeof(STARTUPINFOW);
00224     StartupInfo.lpTitle = pszCmdLine;
00225     StartupInfo.dwX = StartupInfo.dwY = StartupInfo.dwXSize = StartupInfo.dwYSize = 0L;
00226     StartupInfo.dwFlags = 0;
00227     StartupInfo.wShowWindow = SW_SHOW;
00228     StartupInfo.lpDesktop = pszDesktopName;
00229 
00230     len = GetWindowsDirectoryW(CurrentDirectory, MAX_PATH);
00231     if (len == 0 || len > MAX_PATH)
00232     {
00233         WARN("GetWindowsDirectoryW() failed\n");
00234         return FALSE;
00235     }
00236     ret = CreateProcessAsUserW(
00237         hAppToken,
00238         pszCmdLine,
00239         NULL,
00240         NULL,
00241         NULL,
00242         FALSE,
00243         CREATE_UNICODE_ENVIRONMENT,
00244         pEnvironment,
00245         CurrentDirectory,
00246         &StartupInfo,
00247         &ProcessInformation);
00248     CloseHandle(ProcessInformation.hProcess);
00249     CloseHandle(ProcessInformation.hThread);
00250     CloseHandle(hAppToken);
00251     if (!ret)
00252         WARN("CreateProcessAsUserW() failed with error %lu\n", GetLastError());
00253     return ret;
00254 }
00255 
00256 /*
00257  * @implemented
00258  */
00259 BOOL WINAPI
00260 WlxActivateUserShell(
00261     PVOID pWlxContext,
00262     PWSTR pszDesktopName,
00263     PWSTR pszMprLogonScript,
00264     PVOID pEnvironment)
00265 {
00266     HKEY hKey;
00267     DWORD BufSize, ValueType;
00268     WCHAR pszUserInitApp[MAX_PATH + 1];
00269     WCHAR pszExpUserInitApp[MAX_PATH];
00270     DWORD len;
00271     LONG rc;
00272 
00273     TRACE("WlxActivateUserShell()\n");
00274 
00275     UNREFERENCED_PARAMETER(pszMprLogonScript);
00276 
00277     /* Get the path of userinit */
00278     rc = RegOpenKeyExW(
00279         HKEY_LOCAL_MACHINE, 
00280         L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
00281         0,
00282         KEY_QUERY_VALUE,
00283         &hKey);
00284     if (rc != ERROR_SUCCESS)
00285     {
00286         WARN("RegOpenKeyExW() failed with error %lu\n", rc);
00287         return FALSE;
00288     }
00289 
00290     /* Query userinit application */
00291     BufSize = sizeof(pszUserInitApp) - sizeof(UNICODE_NULL);
00292     rc = RegQueryValueExW(
00293         hKey,
00294         L"Userinit",
00295         NULL,
00296         &ValueType,
00297         (LPBYTE)pszUserInitApp,
00298         &BufSize);
00299     RegCloseKey(hKey);
00300     if (rc != ERROR_SUCCESS || (ValueType != REG_SZ && ValueType != REG_EXPAND_SZ))
00301     {
00302         WARN("RegQueryValueExW() failed with error %lu\n", rc);
00303         return FALSE;
00304     }
00305     pszUserInitApp[MAX_PATH] = UNICODE_NULL;
00306 
00307     len = ExpandEnvironmentStringsW(pszUserInitApp, pszExpUserInitApp, MAX_PATH);
00308     if (len > MAX_PATH)
00309     {
00310         WARN("ExpandEnvironmentStringsW() failed. Required size %lu\n", len);
00311         return FALSE;
00312     }
00313 
00314     /* Start userinit app */
00315     return WlxStartApplication(pWlxContext, pszDesktopName, pEnvironment, pszExpUserInitApp);
00316 }
00317 
00318 /*
00319  * @implemented
00320  */
00321 int WINAPI
00322 WlxLoggedOnSAS(
00323     PVOID pWlxContext,
00324     DWORD dwSasType,
00325     PVOID pReserved)
00326 {
00327     PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
00328     INT SasAction = WLX_SAS_ACTION_NONE;
00329 
00330     TRACE("WlxLoggedOnSAS(0x%lx)\n", dwSasType);
00331 
00332     UNREFERENCED_PARAMETER(pReserved);
00333 
00334     switch (dwSasType)
00335     {
00336         case WLX_SAS_TYPE_CTRL_ALT_DEL:
00337         case WLX_SAS_TYPE_TIMEOUT:
00338         {
00339             SasAction = pGinaUI->LoggedOnSAS(pgContext, dwSasType);
00340             break;
00341         }
00342         case WLX_SAS_TYPE_SC_INSERT:
00343         {
00344             FIXME("WlxLoggedOnSAS: SasType WLX_SAS_TYPE_SC_INSERT not supported!\n");
00345             break;
00346         }
00347         case WLX_SAS_TYPE_SC_REMOVE:
00348         {
00349             FIXME("WlxLoggedOnSAS: SasType WLX_SAS_TYPE_SC_REMOVE not supported!\n");
00350             break;
00351         }
00352         default:
00353         {
00354             WARN("WlxLoggedOnSAS: Unknown SasType: 0x%x\n", dwSasType);
00355             break;
00356         }
00357     }
00358 
00359     return SasAction;
00360 }
00361 
00362 /*
00363  * @implemented
00364  */
00365 BOOL WINAPI
00366 WlxDisplayStatusMessage(
00367     IN PVOID pWlxContext,
00368     IN HDESK hDesktop,
00369     IN DWORD dwOptions,
00370     IN PWSTR pTitle,
00371     IN PWSTR pMessage)
00372 {
00373     PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
00374 
00375     TRACE("WlxDisplayStatusMessage(\"%S\")\n", pMessage);
00376 
00377     return pGinaUI->DisplayStatusMessage(pgContext, hDesktop, dwOptions, pTitle, pMessage);
00378 }
00379 
00380 /*
00381  * @implemented
00382  */
00383 BOOL WINAPI
00384 WlxRemoveStatusMessage(
00385     IN PVOID pWlxContext)
00386 {
00387     PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
00388 
00389     TRACE("WlxRemoveStatusMessage()\n");
00390 
00391     return pGinaUI->RemoveStatusMessage(pgContext);
00392 }
00393 
00394 static PWSTR
00395 DuplicationString(PWSTR Str)
00396 {
00397     DWORD cb;
00398     PWSTR NewStr;
00399 
00400     if (Str == NULL) return NULL;
00401 
00402     cb = (wcslen(Str) + 1) * sizeof(WCHAR);
00403     if ((NewStr = LocalAlloc(LMEM_FIXED, cb)))
00404         memcpy(NewStr, Str, cb);
00405     return NewStr;
00406 }
00407 
00408 BOOL
00409 DoLoginTasks(
00410     IN OUT PGINA_CONTEXT pgContext,
00411     IN PWSTR UserName,
00412     IN PWSTR Domain,
00413     IN PWSTR Password)
00414 {
00415     LPWSTR ProfilePath = NULL;
00416     LPWSTR lpEnvironment = NULL;
00417     TOKEN_STATISTICS Stats;
00418     PWLX_PROFILE_V2_0 pProfile = NULL;
00419     DWORD cbStats, cbSize;
00420     BOOL bResult;
00421 
00422     if (!LogonUserW(UserName, Domain, Password,
00423         LOGON32_LOGON_INTERACTIVE,
00424         LOGON32_PROVIDER_DEFAULT,
00425         &pgContext->UserToken))
00426     {
00427         WARN("LogonUserW() failed\n");
00428         goto cleanup;
00429     }
00430 
00431     /* Get profile path */
00432     cbSize = 0;
00433     bResult = GetProfilesDirectoryW(NULL, &cbSize);
00434     if (!bResult && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
00435     {
00436         ProfilePath = HeapAlloc(GetProcessHeap(), 0, cbSize * sizeof(WCHAR));
00437         if (!ProfilePath)
00438         {
00439             WARN("HeapAlloc() failed\n");
00440             goto cleanup;
00441         }
00442         bResult = GetProfilesDirectoryW(ProfilePath, &cbSize);
00443     }
00444     if (!bResult)
00445     {
00446         WARN("GetUserProfileDirectoryW() failed\n");
00447         goto cleanup;
00448     }
00449 
00450     /* Allocate memory for profile */
00451     pProfile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WLX_PROFILE_V2_0));
00452     if (!pProfile)
00453     {
00454         WARN("HeapAlloc() failed\n");
00455         goto cleanup;
00456     }
00457     pProfile->dwType = WLX_PROFILE_TYPE_V2_0;
00458     pProfile->pszProfile = ProfilePath;
00459 
00460     lpEnvironment = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 32 * sizeof(WCHAR));
00461     if (!lpEnvironment)
00462     {
00463         WARN("HeapAlloc() failed\n");
00464         goto cleanup;
00465     }
00466     wcscpy(lpEnvironment, L"LOGONSERVER=\\\\Test");
00467 
00468     pProfile->pszEnvironment = lpEnvironment;
00469 
00470     if (!GetTokenInformation(pgContext->UserToken,
00471         TokenStatistics,
00472         (PVOID)&Stats,
00473         sizeof(TOKEN_STATISTICS),
00474         &cbStats))
00475     {
00476         WARN("Couldn't get Authentication id from user token!\n");
00477         goto cleanup;
00478     }
00479 
00480     *pgContext->pAuthenticationId = Stats.AuthenticationId; 
00481     pgContext->pMprNotifyInfo->pszUserName = DuplicationString(UserName);
00482     pgContext->pMprNotifyInfo->pszDomain = DuplicationString(Domain);
00483     pgContext->pMprNotifyInfo->pszPassword = DuplicationString(Password);
00484     pgContext->pMprNotifyInfo->pszOldPassword = NULL;
00485     *pgContext->pdwOptions = 0;
00486     *pgContext->pProfile = pProfile;
00487     return TRUE;
00488 
00489 cleanup:
00490     if (pProfile)
00491     {
00492         HeapFree(GetProcessHeap(), 0, pProfile->pszEnvironment);
00493     }
00494     HeapFree(GetProcessHeap(), 0, pProfile);
00495     HeapFree(GetProcessHeap(), 0, ProfilePath);
00496     return FALSE;
00497 }
00498 
00499 static BOOL
00500 DoAutoLogon(
00501     IN PGINA_CONTEXT pgContext)
00502 {
00503     HKEY WinLogonKey = NULL;
00504     LPWSTR AutoLogon = NULL;
00505     LPWSTR AutoCount = NULL;
00506     LPWSTR IgnoreShiftOverride = NULL;
00507     LPWSTR UserName = NULL;
00508     LPWSTR DomainName = NULL;
00509     LPWSTR Password = NULL;
00510     BOOL result = FALSE;
00511     LONG rc;
00512 
00513     TRACE("DoAutoLogon(): AutoLogonState = %lu\n",
00514         pgContext->AutoLogonState);
00515 
00516     if (pgContext->AutoLogonState == AUTOLOGON_DISABLED)
00517         return FALSE;
00518 
00519     rc = RegOpenKeyExW(
00520         HKEY_LOCAL_MACHINE,
00521         L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\WinLogon",
00522         0,
00523         KEY_QUERY_VALUE,
00524         &WinLogonKey);
00525     if (rc != ERROR_SUCCESS)
00526         goto cleanup;
00527 
00528     if (pgContext->AutoLogonState == AUTOLOGON_CHECK_REGISTRY)
00529     {
00530         /* Set it by default to disabled, we might reenable it again later */
00531         pgContext->AutoLogonState = AUTOLOGON_DISABLED;
00532 
00533         rc = ReadRegSzKey(WinLogonKey, L"AutoAdminLogon", &AutoLogon);
00534         if (rc != ERROR_SUCCESS)
00535             goto cleanup;
00536         if (wcscmp(AutoLogon, L"1") != 0)
00537             goto cleanup;
00538 
00539         rc = ReadRegSzKey(WinLogonKey, L"AutoLogonCount", &AutoCount);
00540         if (rc == ERROR_SUCCESS && wcscmp(AutoCount, L"0") == 0)
00541             goto cleanup;
00542         else if (rc != ERROR_FILE_NOT_FOUND)
00543             goto cleanup;
00544 
00545         rc = ReadRegSzKey(WinLogonKey, L"IgnoreShiftOverride", &UserName);
00546         if (rc == ERROR_SUCCESS)
00547         {
00548             if (wcscmp(AutoLogon, L"1") != 0 && GetKeyState(VK_SHIFT) < 0)
00549                 goto cleanup;
00550         }
00551         else if (GetKeyState(VK_SHIFT) < 0)
00552         {
00553             /* User pressed SHIFT */
00554             goto cleanup;
00555         }
00556 
00557         pgContext->AutoLogonState = AUTOLOGON_ONCE;
00558         result = TRUE;
00559     }
00560     else /* pgContext->AutoLogonState == AUTOLOGON_ONCE */
00561     {
00562         pgContext->AutoLogonState = AUTOLOGON_DISABLED;
00563 
00564         rc = ReadRegSzKey(WinLogonKey, L"DefaultUserName", &UserName);
00565         if (rc != ERROR_SUCCESS)
00566             goto cleanup;
00567         rc = ReadRegSzKey(WinLogonKey, L"DefaultDomainName", &DomainName);
00568         if (rc != ERROR_SUCCESS && rc != ERROR_FILE_NOT_FOUND)
00569             goto cleanup;
00570         rc = ReadRegSzKey(WinLogonKey, L"DefaultPassword", &Password);
00571         if (rc != ERROR_SUCCESS)
00572             goto cleanup;
00573 
00574         result = DoLoginTasks(pgContext, UserName, DomainName, Password);
00575 
00576         if (result == TRUE)
00577             NotifyBootConfigStatus(TRUE);
00578     }
00579 
00580 cleanup:
00581     if (WinLogonKey != NULL)
00582         RegCloseKey(WinLogonKey);
00583     HeapFree(GetProcessHeap(), 0, AutoLogon);
00584     HeapFree(GetProcessHeap(), 0, AutoCount);
00585     HeapFree(GetProcessHeap(), 0, IgnoreShiftOverride);
00586     HeapFree(GetProcessHeap(), 0, UserName);
00587     HeapFree(GetProcessHeap(), 0, DomainName);
00588     HeapFree(GetProcessHeap(), 0, Password);
00589     TRACE("DoAutoLogon(): AutoLogonState = %lu, returning %d\n",
00590         pgContext->AutoLogonState, result);
00591     return result;
00592 }
00593 
00594 /*
00595  * @implemented
00596  */
00597 VOID WINAPI
00598 WlxDisplaySASNotice(
00599     IN PVOID pWlxContext)
00600 {
00601     PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
00602 
00603     TRACE("WlxDisplaySASNotice(%p)\n", pWlxContext);
00604 
00605     if (GetSystemMetrics(SM_REMOTESESSION))
00606     {
00607         /* User is remotely logged on. Don't display a notice */
00608         pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, WLX_SAS_TYPE_CTRL_ALT_DEL);
00609         return;
00610     }
00611 
00612     if (DoAutoLogon(pgContext))
00613     {
00614         /* Don't display the window, we want to do an automatic logon */
00615         pgContext->AutoLogonState = AUTOLOGON_ONCE;
00616         pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, WLX_SAS_TYPE_CTRL_ALT_DEL);
00617         return;
00618     }
00619     else
00620         pgContext->AutoLogonState = AUTOLOGON_DISABLED;
00621 
00622     pGinaUI->DisplaySASNotice(pgContext);
00623 
00624     TRACE("WlxDisplaySASNotice() done\n");
00625 }
00626 
00627 /*
00628  * @implemented
00629  */
00630 INT WINAPI
00631 WlxLoggedOutSAS(
00632     IN PVOID pWlxContext,
00633     IN DWORD dwSasType,
00634     OUT PLUID pAuthenticationId,
00635     IN OUT PSID pLogonSid,
00636     OUT PDWORD pdwOptions,
00637     OUT PHANDLE phToken,
00638     OUT PWLX_MPR_NOTIFY_INFO pMprNotifyInfo,
00639     OUT PVOID *pProfile)
00640 {
00641     PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
00642     INT res;
00643 
00644     TRACE("WlxLoggedOutSAS()\n");
00645 
00646     UNREFERENCED_PARAMETER(dwSasType);
00647     UNREFERENCED_PARAMETER(pLogonSid);
00648 
00649     pgContext->pAuthenticationId = pAuthenticationId;
00650     pgContext->pdwOptions = pdwOptions;
00651     pgContext->pMprNotifyInfo = pMprNotifyInfo;
00652     pgContext->pProfile = pProfile;
00653 
00654     if (0 == GetSystemMetrics(SM_REMOTESESSION) &&
00655         DoAutoLogon(pgContext))
00656     {
00657         /* User is local and registry contains information
00658          * to log on him automatically */
00659         *phToken = pgContext->UserToken;
00660         return WLX_SAS_ACTION_LOGON;
00661     }
00662 
00663     res = pGinaUI->LoggedOutSAS(pgContext);
00664     *phToken = pgContext->UserToken;
00665     return res;
00666 }
00667 
00668 /*
00669  * @implemented
00670  */
00671 int WINAPI
00672 WlxWkstaLockedSAS(
00673     PVOID pWlxContext,
00674     DWORD dwSasType)
00675 {
00676     PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
00677 
00678     TRACE("WlxWkstaLockedSAS()\n");
00679 
00680     UNREFERENCED_PARAMETER(dwSasType);
00681 
00682     return pGinaUI->LockedSAS(pgContext);
00683 }
00684 
00685 /*
00686  * @implemented
00687  */
00688 BOOL WINAPI
00689 WlxIsLogoffOk(
00690     PVOID pWlxContext)
00691 {
00692     TRACE("WlxIsLogoffOk()\n");
00693     UNREFERENCED_PARAMETER(pWlxContext);
00694     return TRUE;
00695 }
00696 
00697 BOOL WINAPI
00698 DllMain(
00699     IN HINSTANCE hinstDLL,
00700     IN DWORD dwReason,
00701     IN LPVOID lpvReserved)
00702 {
00703     UNREFERENCED_PARAMETER(lpvReserved);
00704 
00705     if (dwReason == DLL_PROCESS_ATTACH)
00706         hDllInstance = hinstDLL;
00707 
00708     return TRUE;
00709 }

Generated on Sun May 27 2012 04:24:51 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.