Author: hpoussin Date: Thu Aug 10 22:41:23 2006 New Revision: 23541
URL: http://svn.reactos.org/svn/reactos?rev=23541&view=rev Log: "Unicodify" msgina Add stubs for locking/unlocking
Modified: trunk/reactos/dll/win32/msgina/En.rc trunk/reactos/dll/win32/msgina/gui.c trunk/reactos/dll/win32/msgina/msgina.c trunk/reactos/dll/win32/msgina/msgina.h trunk/reactos/dll/win32/msgina/msgina.rbuild trunk/reactos/dll/win32/msgina/resource.h trunk/reactos/dll/win32/msgina/stubs.c trunk/reactos/dll/win32/msgina/tui.c
Modified: trunk/reactos/dll/win32/msgina/En.rc URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/En.rc?rev=... ============================================================================== --- trunk/reactos/dll/win32/msgina/En.rc (original) +++ trunk/reactos/dll/win32/msgina/En.rc Thu Aug 10 22:41:23 2006 @@ -47,7 +47,10 @@
STRINGTABLE BEGIN - IDS_PRESSCTRLALTDELETE "Press CONTROL+ALT+DELETE key combination\n" - IDS_ASKFORUSER "User name: " - IDS_ASKFORPASSWORD "Password: " + IDS_LOGGEDOUTSAS "Welcome!" + IDS_LOCKEDSAS "The computer is currently locked" + IDS_PRESSCTRLALTDELETE "Press CONTROL+ALT+DELETE key combination" + IDS_ASKFORUSER "User name: " + IDS_ASKFORPASSWORD "Password: " + IDS_FORCELOGOFF "This will close the the session of the current user, and loose all his unsaved work. Continue?" END
Modified: trunk/reactos/dll/win32/msgina/gui.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/gui.c?rev=... ============================================================================== --- trunk/reactos/dll/win32/msgina/gui.c (original) +++ trunk/reactos/dll/win32/msgina/gui.c Thu Aug 10 22:41:23 2006 @@ -7,7 +7,7 @@
#include "msgina.h"
-#define YDEBUG +//#define YDEBUG #include <wine/debug.h>
typedef struct _DISPLAYSTATUSMSG @@ -46,17 +46,17 @@ msg->Context->hStatusWindow = hwndDlg;
if (msg->pTitle) - SetWindowText(hwndDlg, msg->pTitle); - SetDlgItemText(hwndDlg, IDC_STATUSLABEL, msg->pMessage); + SetWindowTextW(hwndDlg, msg->pTitle); + SetDlgItemTextW(hwndDlg, IDC_STATUSLABEL, msg->pMessage); if (!msg->Context->SignaledStatusWindowCreated) { msg->Context->SignaledStatusWindowCreated = TRUE; SetEvent(msg->StartupEvent); } - break; - } - } - return DefWindowProc(hwndDlg, uMsg, wParam, lParam); + return TRUE; + } + } + return FALSE; }
static DWORD WINAPI @@ -141,9 +141,9 @@ }
if(pTitle) - SetWindowText(pgContext->hStatusWindow, pTitle); - - SetDlgItemText(pgContext->hStatusWindow, IDC_STATUSLABEL, pMessage); + SetWindowTextW(pgContext->hStatusWindow, pTitle); + + SetDlgItemTextW(pgContext->hStatusWindow, IDC_STATUSLABEL, pMessage);
return TRUE; } @@ -159,16 +159,6 @@ }
return TRUE; -} - -static INT_PTR CALLBACK -DisplaySASNoticeWindowProc( - IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam) -{ - return DefWindowProc(hwndDlg, uMsg, wParam, lParam); }
static VOID @@ -184,7 +174,7 @@ pgContext->hDllInstance, MAKEINTRESOURCE(IDD_NOTICE_DLG), NULL, - DisplaySASNoticeWindowProc, + NULL, (LPARAM)NULL); if (result == -1) { @@ -209,13 +199,90 @@ Text = HeapAlloc(GetProcessHeap(), 0, (Count + 1) * sizeof(WCHAR)); if (!Text) return FALSE; - if (Count != GetWindowText(GetDlgItem(hwndDlg, TextboxId), Text, Count + 1)) + if (Count != GetWindowTextW(GetDlgItem(hwndDlg, TextboxId), Text, Count + 1)) { HeapFree(GetProcessHeap(), 0, Text); return FALSE; } *pText = Text; return TRUE; +} + +static INT_PTR CALLBACK +LoggedOnWindowProc( + IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam) +{ + switch (uMsg) + { + case WM_COMMAND: + { + switch (LOWORD(wParam)) + { + case IDC_LOCK: + EndDialog(hwndDlg, WLX_SAS_ACTION_LOCK_WKSTA); + return TRUE; + case IDC_LOGOFF: + EndDialog(hwndDlg, WLX_SAS_ACTION_LOGOFF); + return TRUE; + case IDC_SHUTDOWN: + EndDialog(hwndDlg, WLX_SAS_ACTION_SHUTDOWN_POWER_OFF); + return TRUE; + case IDC_TASKMGR: + EndDialog(hwndDlg, WLX_SAS_ACTION_TASKLIST); + return TRUE; + case IDCANCEL: + EndDialog(hwndDlg, WLX_SAS_ACTION_NONE); + return TRUE; + } + break; + } + case WM_INITDIALOG: + { + SetFocus(GetDlgItem(hwndDlg, IDNO)); + return TRUE; + } + case WM_CLOSE: + { + EndDialog(hwndDlg, IDNO); + return TRUE; + } + } + + return FALSE; +} + +static INT +GUILoggedOnSAS( + IN OUT PGINA_CONTEXT pgContext, + IN DWORD dwSasType) +{ + INT result; + + TRACE("GUILoggedOnSAS()\n"); + + if (dwSasType != WLX_SAS_TYPE_CTRL_ALT_DEL) + { + /* Nothing to do for WLX_SAS_TYPE_TIMEOUT ; the dialog will + * close itself thanks to the use of WlxDialogBoxParam */ + return WLX_SAS_ACTION_NONE; + } + + result = pgContext->pWlxFuncs->WlxDialogBoxParam( + pgContext->hWlx, + pgContext->hDllInstance, + MAKEINTRESOURCEW(IDD_LOGGEDON_DLG), + NULL, + LoggedOnWindowProc, + (LPARAM)pgContext); + if (result >= WLX_SAS_ACTION_LOGON && + result <= WLX_SAS_ACTION_SWITCH_CONSOLE) + { + return result; + } + return WLX_SAS_ACTION_NONE; }
static INT_PTR CALLBACK @@ -297,95 +364,18 @@ return FALSE; }
-static INT_PTR CALLBACK -LoggedOnWindowProc( - IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam) -{ - switch (uMsg) - { - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDC_LOCK: - EndDialog(hwndDlg, WLX_SAS_ACTION_LOCK_WKSTA); - return TRUE; - case IDC_LOGOFF: - EndDialog(hwndDlg, WLX_SAS_ACTION_LOGOFF); - return TRUE; - case IDC_SHUTDOWN: - EndDialog(hwndDlg, WLX_SAS_ACTION_SHUTDOWN_POWER_OFF); - return TRUE; - case IDC_TASKMGR: - EndDialog(hwndDlg, WLX_SAS_ACTION_TASKLIST); - return TRUE; - case IDCANCEL: - EndDialog(hwndDlg, WLX_SAS_ACTION_NONE); - return TRUE; - } - break; - } - case WM_INITDIALOG: - { - SetFocus(GetDlgItem(hwndDlg, IDNO)); - return TRUE; - } - case WM_CLOSE: - { - EndDialog(hwndDlg, IDNO); - return TRUE; - } - } - - return FALSE; -} - static INT -GUILoggedOnSAS( - IN OUT PGINA_CONTEXT pgContext, - IN DWORD dwSasType) -{ - INT result; - - TRACE("GUILoggedOnSAS()\n"); - - if (dwSasType != WLX_SAS_TYPE_CTRL_ALT_DEL) - { - /* Nothing to do for WLX_SAS_TYPE_TIMEOUT ; the dialog will - * close itself thanks to the use of WlxDialogBoxParam */ - return WLX_SAS_ACTION_NONE; - } +GUILoggedOutSAS( + IN OUT PGINA_CONTEXT pgContext) +{ + int result; + + TRACE("GUILoggedOutSAS()\n");
result = pgContext->pWlxFuncs->WlxDialogBoxParam( pgContext->hWlx, pgContext->hDllInstance, - MAKEINTRESOURCE(IDD_LOGGEDON_DLG), - NULL, - LoggedOnWindowProc, - (LPARAM)pgContext); - if (result >= WLX_SAS_ACTION_LOGON && - result <= WLX_SAS_ACTION_SWITCH_CONSOLE) - { - return result; - } - return WLX_SAS_ACTION_NONE; -} - -static INT -GUILoggedOutSAS( - IN OUT PGINA_CONTEXT pgContext) -{ - int result; - - TRACE("GUILoggedOutSAS()\n"); - - result = pgContext->pWlxFuncs->WlxDialogBoxParam( - pgContext->hWlx, - pgContext->hDllInstance, - MAKEINTRESOURCE(IDD_LOGGEDOUT_DLG), + MAKEINTRESOURCEW(IDD_LOGGEDOUT_DLG), NULL, LoggedOutWindowProc, (LPARAM)pgContext); @@ -398,6 +388,16 @@
WARN("WlxDialogBoxParam() failed (0x%x)\n", result); return WLX_SAS_ACTION_NONE; +} + +static INT +GUILockedSAS( + IN OUT PGINA_CONTEXT pgContext) +{ + TRACE("GUILockedSAS()\n"); + + UNIMPLEMENTED; + return WLX_SAS_ACTION_UNLOCK_WKSTA; }
GINA_UI GinaGraphicalUI = { @@ -407,4 +407,5 @@ GUIDisplaySASNotice, GUILoggedOnSAS, GUILoggedOutSAS, + GUILockedSAS, };
Modified: trunk/reactos/dll/win32/msgina/msgina.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/msgina.c?r... ============================================================================== --- trunk/reactos/dll/win32/msgina/msgina.c (original) +++ trunk/reactos/dll/win32/msgina/msgina.c Thu Aug 10 22:41:23 2006 @@ -94,7 +94,7 @@ BOOL ConsoleBoot = FALSE; LONG rc;
- rc = RegOpenKeyEx( + rc = RegOpenKeyExW( HKEY_LOCAL_MACHINE, L"SYSTEM\CurrentControlSet\Control", 0, @@ -178,7 +178,6 @@ return pGinaUI->Initialize(pgContext); }
- /* * @implemented */ @@ -190,12 +189,12 @@ PWSTR pszCmdLine) { PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext; - STARTUPINFO StartupInfo; + STARTUPINFOW StartupInfo; PROCESS_INFORMATION ProcessInformation; WCHAR CurrentDirectory[MAX_PATH]; BOOL Ret;
- StartupInfo.cb = sizeof(STARTUPINFO); + StartupInfo.cb = sizeof(STARTUPINFOW); StartupInfo.lpReserved = NULL; StartupInfo.lpTitle = pszCmdLine; StartupInfo.dwX = StartupInfo.dwY = StartupInfo.dwXSize = StartupInfo.dwYSize = 0L; @@ -206,9 +205,9 @@ StartupInfo.lpDesktop = pszDesktopName;
GetWindowsDirectoryW (CurrentDirectory, MAX_PATH); - Ret = CreateProcessAsUser(pgContext->UserToken, + Ret = CreateProcessAsUserW(pgContext->UserToken, + pszCmdLine, NULL, - pszCmdLine, NULL, NULL, FALSE, @@ -237,7 +236,7 @@ DWORD BufSize, ValueType; WCHAR pszUserInitApp[MAX_PATH]; WCHAR pszExpUserInitApp[MAX_PATH]; - + TRACE("WlxActivateUserShell()\n"); /* get the path of userinit */ if(RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\ReactOS\Windows NT\CurrentVersion\Winlogon", @@ -247,7 +246,7 @@ return FALSE; } BufSize = MAX_PATH * sizeof(WCHAR); - if((RegQueryValueEx(hKey, L"Userinit", NULL, &ValueType, (LPBYTE)pszUserInitApp, + if((RegQueryValueExW(hKey, L"Userinit", NULL, &ValueType, (LPBYTE)pszUserInitApp, &BufSize) != ERROR_SUCCESS) || !((ValueType == REG_SZ) || (ValueType == REG_EXPAND_SZ))) {ERR("GINA: Failed: 2\n"); @@ -256,7 +255,7 @@ return FALSE; } RegCloseKey(hKey); - ExpandEnvironmentStrings(pszUserInitApp, pszExpUserInitApp, MAX_PATH); + ExpandEnvironmentStringsW(pszUserInitApp, pszExpUserInitApp, MAX_PATH);
/* Start userinit */ /* FIXME - allow to start more applications that are comma-separated */ @@ -363,27 +362,25 @@ TOKEN_STATISTICS Stats; DWORD cbStats;
- if(!LogonUserW(UserName, Domain, Password, + if (!LogonUserW(UserName, Domain, Password, LOGON32_LOGON_INTERACTIVE, /* FIXME - use LOGON32_LOGON_UNLOCK instead! */ LOGON32_PROVIDER_DEFAULT, - pgContext->phToken)) + &pgContext->UserToken)) { WARN("LogonUserW() failed\n"); return FALSE; }
- if(!*pgContext->phToken) - { - WARN("*phToken == NULL!\n"); + if (!pgContext->UserToken) + { + WARN("UserToken == NULL!\n"); return FALSE; }
- pgContext->UserToken =*pgContext->phToken; - *pgContext->pdwOptions = 0; - *pgContext->pProfile =NULL; - - if(!GetTokenInformation(*pgContext->phToken, + *pgContext->pProfile = NULL; + + if (!GetTokenInformation(pgContext->UserToken, TokenStatistics, (PVOID)&Stats, sizeof(TOKEN_STATISTICS), @@ -420,7 +417,7 @@ if (pgContext->AutoLogonState == AUTOLOGON_DISABLED) return FALSE;
- rc = RegOpenKeyEx( + rc = RegOpenKeyExW( HKEY_LOCAL_MACHINE, L"SOFTWARE\ReactOS\Windows NT\CurrentVersion\WinLogon", 0, @@ -540,12 +537,12 @@ OUT PVOID *pProfile) { PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext; + INT res;
TRACE("WlxLoggedOutSAS()\n");
pgContext->pAuthenticationId = pAuthenticationId; pgContext->pdwOptions = pdwOptions; - pgContext->phToken = phToken; pgContext->pNprNotifyInfo = pNprNotifyInfo; pgContext->pProfile = pProfile;
@@ -554,10 +551,28 @@ { /* User is local and registry contains information * to log on him automatically */ + *phToken = pgContext->UserToken; return WLX_SAS_ACTION_LOGON; }
- return pGinaUI->LoggedOutSAS(pgContext); + res = pGinaUI->LoggedOutSAS(pgContext); + *phToken = pgContext->UserToken; + return res; +} + +/* + * @implemented + */ +int WINAPI +WlxWkstaLockedSAS( + PVOID pWlxContext, + DWORD dwSasType) +{ + PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext; + + TRACE("WlxWkstaLockedSAS()\n"); + + return pGinaUI->LockedSAS(pgContext); }
BOOL WINAPI
Modified: trunk/reactos/dll/win32/msgina/msgina.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/msgina.h?r... ============================================================================== --- trunk/reactos/dll/win32/msgina/msgina.h (original) +++ trunk/reactos/dll/win32/msgina/msgina.h Thu Aug 10 22:41:23 2006 @@ -16,15 +16,14 @@ LPWSTR station; PWLX_DISPATCH_VERSION_1_3 pWlxFuncs; HANDLE hDllInstance; - HANDLE UserToken; HWND hStatusWindow; BOOL SignaledStatusWindowCreated; DWORD AutoLogonState;
/* Informations to be filled during logon */ + HANDLE UserToken; PLUID pAuthenticationId; PDWORD pdwOptions; - PHANDLE phToken; PWLX_MPR_NOTIFY_INFO pNprNotifyInfo; PVOID *pProfile;
@@ -40,6 +39,7 @@ typedef VOID (*PFGINA_DISPLAYSASNOTICE)(PGINA_CONTEXT); typedef INT (*PFGINA_LOGGEDONSAS)(PGINA_CONTEXT, DWORD); typedef INT (*PFGINA_LOGGEDOUTSAS)(PGINA_CONTEXT); +typedef INT (*PFGINA_LOCKEDSAS)(PGINA_CONTEXT); typedef struct _GINA_UI { PFGINA_INITIALIZE Initialize; @@ -48,6 +48,7 @@ PFGINA_DISPLAYSASNOTICE DisplaySASNotice; PFGINA_LOGGEDONSAS LoggedOnSAS; PFGINA_LOGGEDOUTSAS LoggedOutSAS; + PFGINA_LOCKEDSAS LockedSAS; } GINA_UI, *PGINA_UI;
/* msgina.c */
Modified: trunk/reactos/dll/win32/msgina/msgina.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/msgina.rbu... ============================================================================== --- trunk/reactos/dll/win32/msgina/msgina.rbuild (original) +++ trunk/reactos/dll/win32/msgina/msgina.rbuild Thu Aug 10 22:41:23 2006 @@ -2,8 +2,6 @@ <importlibrary definition="msgina.def" /> <include base="msgina">.</include> <include base="msgina">include</include> - <define name="UNICODE" /> - <define name="_UNICODE" /> <define name="__REACTOS__" /> <define name="__USE_W32API" /> <library>ntdll</library>
Modified: trunk/reactos/dll/win32/msgina/resource.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/resource.h... ============================================================================== --- trunk/reactos/dll/win32/msgina/resource.h (original) +++ trunk/reactos/dll/win32/msgina/resource.h Thu Aug 10 22:41:23 2006 @@ -6,6 +6,8 @@ #define IDD_NOTICE_DLG 101 #define IDD_LOGGEDON_DLG 102 #define IDD_LOGGEDOUT_DLG 103 +#define IDD_LOCKED_DLG 104 + #define IDC_LOGOFF 1001 #define IDC_USERNAME 1002 #define IDC_PASSWORD 1003 @@ -13,12 +15,16 @@ #define IDC_STATUSLABEL 1005 #define IDC_LOCK 1006 #define IDC_ROSLOGO 1007 -#define IDI_ROSLOGO 1008 -#define IDS_ASKFORUSER 40000 -#define IDS_PRESSCTRLALTDELETE 40001 -#define IDC_TASKMGR 40002 -#define IDS_ASKFORPASSWORD 40002 +#define IDC_TASKMGR 1008
+#define IDI_ROSLOGO 20000 + +#define IDS_LOGGEDOUTSAS 40000 +#define IDS_LOCKEDSAS 40001 +#define IDS_PRESSCTRLALTDELETE 40002 +#define IDS_ASKFORUSER 40003 +#define IDS_ASKFORPASSWORD 40004 +#define IDS_FORCELOGOFF 40005
#endif /* __MSGINA_RESOURCE_H */
Modified: trunk/reactos/dll/win32/msgina/stubs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/stubs.c?re... ============================================================================== --- trunk/reactos/dll/win32/msgina/stubs.c (original) +++ trunk/reactos/dll/win32/msgina/stubs.c Thu Aug 10 22:41:23 2006 @@ -100,26 +100,14 @@ /* * @unimplemented */ -int WINAPI -WlxWkstaLockedSAS( - PVOID pWlxContext, - DWORD dwSasType) -{ - UNIMPLEMENTED; - return WLX_SAS_ACTION_UNLOCK_WKSTA; -} - - -/* - * @unimplemented - */ BOOL WINAPI WlxScreenSaverNotify( PVOID pWlxContext, BOOL *pSecure) { + //HKLM\Software\Policies\Microsoft\Windows\Control Panel\Desktop : ScreenSaverIsSecure UNIMPLEMENTED; - return FALSE; + return TRUE; }
Modified: trunk/reactos/dll/win32/msgina/tui.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/tui.c?rev=... ============================================================================== --- trunk/reactos/dll/win32/msgina/tui.c (original) +++ trunk/reactos/dll/win32/msgina/tui.c Thu Aug 10 22:41:23 2006 @@ -55,24 +55,45 @@ return TRUE; }
+static BOOL +DisplayResourceText( + IN UINT uIdResourceText, + IN BOOL AddNewLine) +{ + WCHAR Prompt[256]; + static LPCWSTR newLine = L"\n"; + DWORD count; + + if (!LoadStringW(hDllInstance, uIdResourceText, Prompt, 256)) + return FALSE; + if (!WriteConsole( + GetStdHandle(STD_OUTPUT_HANDLE), + Prompt, wcslen(Prompt), + &count, NULL)) + { + return FALSE; + } + if (AddNewLine) + { + if (!WriteConsoleW( + GetStdHandle(STD_OUTPUT_HANDLE), + newLine, wcslen(newLine), + &count, NULL)) + { + return FALSE; + } + } + return TRUE; +} + static VOID TUIDisplaySASNotice( IN OUT PGINA_CONTEXT pgContext) { - WCHAR CtrlAltDelPrompt[256]; - DWORD count; - TRACE("TUIDisplaySASNotice()\n");
- if (LoadString(hDllInstance, IDS_PRESSCTRLALTDELETE, CtrlAltDelPrompt, 256)) - { - WriteConsole( - GetStdHandle(STD_OUTPUT_HANDLE), - CtrlAltDelPrompt, - wcslen(CtrlAltDelPrompt), - &count, - NULL); - } + DisplayResourceText(IDS_LOGGEDOUTSAS, TRUE); + DisplayResourceText(IDS_PRESSCTRLALTDELETE, TRUE); }
static INT @@ -100,7 +121,6 @@ IN DWORD BufferLength, IN BOOL ShowString) { - WCHAR Prompt[256]; DWORD count, i;
if (!SetConsoleMode( @@ -110,10 +130,7 @@ return FALSE; }
- if (!LoadString(hDllInstance, uIdResourcePrompt, Prompt, 256)) - return FALSE; - - if (!WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), Prompt, wcslen(Prompt), &count, NULL)) + if (!DisplayResourceText(uIdResourcePrompt, FALSE)) return FALSE;
i = 0; @@ -150,6 +167,28 @@ return WLX_SAS_ACTION_NONE; }
+static INT +TUILockedSAS( + IN OUT PGINA_CONTEXT pgContext) +{ + WCHAR UserName[256]; + WCHAR Password[256]; + + TRACE("TUILockedSAS()\n"); + + if (!DisplayResourceText(IDS_LOGGEDOUTSAS, TRUE)) + return WLX_SAS_ACTION_UNLOCK_WKSTA; + + /* Ask the user for credentials */ + if (!ReadString(pgContext, IDS_ASKFORUSER, UserName, 256, TRUE)) + return WLX_SAS_ACTION_NONE; + if (!ReadString(pgContext, IDS_ASKFORPASSWORD, Password, 256, FALSE)) + return WLX_SAS_ACTION_NONE; + + FIXME("FIXME: Check user/password\n"); + return WLX_SAS_ACTION_UNLOCK_WKSTA; +} + GINA_UI GinaTextUI = { TUIInitialize, TUIDisplayStatusMessage, @@ -157,4 +196,5 @@ TUIDisplaySASNotice, TUILoggedOnSAS, TUILoggedOutSAS, + TUILockedSAS, };