Author: ekohl Date: Mon May 6 21:43:03 2013 New Revision: 58963
URL: http://svn.reactos.org/svn/reactos?rev=58963&view=rev Log: [MSGINA] Convert tabs to spaces. No code changes!
Modified: 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/stubs.c trunk/reactos/dll/win32/msgina/tui.c
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 [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/gui.c [iso-8859-1] Mon May 6 21:43:03 2013 @@ -11,222 +11,222 @@
typedef struct _DISPLAYSTATUSMSG { - PGINA_CONTEXT Context; - HDESK hDesktop; - DWORD dwOptions; - PWSTR pTitle; - PWSTR pMessage; - HANDLE StartupEvent; + PGINA_CONTEXT Context; + HDESK hDesktop; + DWORD dwOptions; + PWSTR pTitle; + PWSTR pMessage; + HANDLE StartupEvent; } DISPLAYSTATUSMSG, *PDISPLAYSTATUSMSG;
static BOOL GUIInitialize( - IN OUT PGINA_CONTEXT pgContext) -{ - TRACE("GUIInitialize(%p)\n", pgContext); - return TRUE; + IN OUT PGINA_CONTEXT pgContext) +{ + TRACE("GUIInitialize(%p)\n", pgContext); + return TRUE; }
static INT_PTR CALLBACK StatusMessageWindowProc( - IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam) -{ - UNREFERENCED_PARAMETER(wParam); - - switch (uMsg) - { - case WM_INITDIALOG: - { - PDISPLAYSTATUSMSG msg = (PDISPLAYSTATUSMSG)lParam; - if (!msg) - return FALSE; - - msg->Context->hStatusWindow = hwndDlg; - - if (msg->pTitle) - SetWindowTextW(hwndDlg, msg->pTitle); - SetDlgItemTextW(hwndDlg, IDC_STATUSLABEL, msg->pMessage); - SetEvent(msg->StartupEvent); - return TRUE; - } - } - return FALSE; + IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam) +{ + UNREFERENCED_PARAMETER(wParam); + + switch (uMsg) + { + case WM_INITDIALOG: + { + PDISPLAYSTATUSMSG msg = (PDISPLAYSTATUSMSG)lParam; + if (!msg) + return FALSE; + + msg->Context->hStatusWindow = hwndDlg; + + if (msg->pTitle) + SetWindowTextW(hwndDlg, msg->pTitle); + SetDlgItemTextW(hwndDlg, IDC_STATUSLABEL, msg->pMessage); + SetEvent(msg->StartupEvent); + return TRUE; + } + } + return FALSE; }
static DWORD WINAPI StartupWindowThread(LPVOID lpParam) { - HDESK hDesk; - PDISPLAYSTATUSMSG msg = (PDISPLAYSTATUSMSG)lpParam; - - /* When SetThreadDesktop is called the system closes the desktop handle when needed - so we have to create a new handle because this handle may still be in use by winlogon */ - if (!DuplicateHandle ( GetCurrentProcess(), - msg->hDesktop, - GetCurrentProcess(), - (HANDLE*)&hDesk, - 0, - FALSE, - DUPLICATE_SAME_ACCESS)) - { - HeapFree(GetProcessHeap(), 0, lpParam); - return FALSE; - } - - if(!SetThreadDesktop(hDesk)) - { - HeapFree(GetProcessHeap(), 0, lpParam); - return FALSE; - } - - DialogBoxParam( - hDllInstance, - MAKEINTRESOURCE(IDD_STATUSWINDOW_DLG), - GetDesktopWindow(), - StatusMessageWindowProc, - (LPARAM)lpParam); - - HeapFree(GetProcessHeap(), 0, lpParam); - return TRUE; + HDESK hDesk; + PDISPLAYSTATUSMSG msg = (PDISPLAYSTATUSMSG)lpParam; + + /* When SetThreadDesktop is called the system closes the desktop handle when needed + so we have to create a new handle because this handle may still be in use by winlogon */ + if (!DuplicateHandle ( GetCurrentProcess(), + msg->hDesktop, + GetCurrentProcess(), + (HANDLE*)&hDesk, + 0, + FALSE, + DUPLICATE_SAME_ACCESS)) + { + HeapFree(GetProcessHeap(), 0, lpParam); + return FALSE; + } + + if(!SetThreadDesktop(hDesk)) + { + HeapFree(GetProcessHeap(), 0, lpParam); + return FALSE; + } + + DialogBoxParam( + hDllInstance, + MAKEINTRESOURCE(IDD_STATUSWINDOW_DLG), + GetDesktopWindow(), + StatusMessageWindowProc, + (LPARAM)lpParam); + + HeapFree(GetProcessHeap(), 0, lpParam); + return TRUE; }
static BOOL GUIDisplayStatusMessage( - IN PGINA_CONTEXT pgContext, - IN HDESK hDesktop, - IN DWORD dwOptions, - IN PWSTR pTitle, - IN PWSTR pMessage) -{ - PDISPLAYSTATUSMSG msg; - HANDLE Thread; - DWORD ThreadId; - - TRACE("GUIDisplayStatusMessage(%ws)\n", pMessage); - - if (!pgContext->hStatusWindow) - { - msg = (PDISPLAYSTATUSMSG)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DISPLAYSTATUSMSG)); - if(!msg) - return FALSE; - - msg->Context = pgContext; - msg->dwOptions = dwOptions; - msg->pTitle = pTitle; - msg->pMessage = pMessage; - msg->hDesktop = hDesktop; - - msg->StartupEvent = CreateEventW( - NULL, - TRUE, - FALSE, - NULL); - - if (!msg->StartupEvent) - return FALSE; - - Thread = CreateThread( - NULL, - 0, - StartupWindowThread, - (PVOID)msg, - 0, - &ThreadId); - if (Thread) - { - CloseHandle(Thread); - WaitForSingleObject(msg->StartupEvent, INFINITE); - CloseHandle(msg->StartupEvent); - return TRUE; - } - - return FALSE; - } - - if (pTitle) - SetWindowTextW(pgContext->hStatusWindow, pTitle); - - SetDlgItemTextW(pgContext->hStatusWindow, IDC_STATUSLABEL, pMessage); - - return TRUE; + IN PGINA_CONTEXT pgContext, + IN HDESK hDesktop, + IN DWORD dwOptions, + IN PWSTR pTitle, + IN PWSTR pMessage) +{ + PDISPLAYSTATUSMSG msg; + HANDLE Thread; + DWORD ThreadId; + + TRACE("GUIDisplayStatusMessage(%ws)\n", pMessage); + + if (!pgContext->hStatusWindow) + { + msg = (PDISPLAYSTATUSMSG)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DISPLAYSTATUSMSG)); + if(!msg) + return FALSE; + + msg->Context = pgContext; + msg->dwOptions = dwOptions; + msg->pTitle = pTitle; + msg->pMessage = pMessage; + msg->hDesktop = hDesktop; + + msg->StartupEvent = CreateEventW( + NULL, + TRUE, + FALSE, + NULL); + + if (!msg->StartupEvent) + return FALSE; + + Thread = CreateThread( + NULL, + 0, + StartupWindowThread, + (PVOID)msg, + 0, + &ThreadId); + if (Thread) + { + CloseHandle(Thread); + WaitForSingleObject(msg->StartupEvent, INFINITE); + CloseHandle(msg->StartupEvent); + return TRUE; + } + + return FALSE; + } + + if (pTitle) + SetWindowTextW(pgContext->hStatusWindow, pTitle); + + SetDlgItemTextW(pgContext->hStatusWindow, IDC_STATUSLABEL, pMessage); + + return TRUE; }
static BOOL GUIRemoveStatusMessage( - IN PGINA_CONTEXT pgContext) -{ - if (pgContext->hStatusWindow) - { - EndDialog(pgContext->hStatusWindow, 0); - pgContext->hStatusWindow = NULL; - } - - return TRUE; + IN PGINA_CONTEXT pgContext) +{ + if (pgContext->hStatusWindow) + { + EndDialog(pgContext->hStatusWindow, 0); + pgContext->hStatusWindow = NULL; + } + + return TRUE; }
static INT_PTR CALLBACK EmptyWindowProc( - IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam) -{ - UNREFERENCED_PARAMETER(hwndDlg); - UNREFERENCED_PARAMETER(uMsg); - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(lParam); - - return FALSE; + IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam) +{ + UNREFERENCED_PARAMETER(hwndDlg); + UNREFERENCED_PARAMETER(uMsg); + UNREFERENCED_PARAMETER(wParam); + UNREFERENCED_PARAMETER(lParam); + + return FALSE; }
static VOID GUIDisplaySASNotice( - IN OUT PGINA_CONTEXT pgContext) -{ - INT result; - - TRACE("GUIDisplaySASNotice()\n"); - - /* Display the notice window */ - result = DialogBoxParam( - pgContext->hDllInstance, - MAKEINTRESOURCE(IDD_NOTICE_DLG), - GetDesktopWindow(), - EmptyWindowProc, - (LPARAM)NULL); - if (result == -1) - { - /* Failed to display the window. Do as if the user - * already has pressed CTRL+ALT+DELETE */ - pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, WLX_SAS_TYPE_CTRL_ALT_DEL); - } + IN OUT PGINA_CONTEXT pgContext) +{ + INT result; + + TRACE("GUIDisplaySASNotice()\n"); + + /* Display the notice window */ + result = DialogBoxParam( + pgContext->hDllInstance, + MAKEINTRESOURCE(IDD_NOTICE_DLG), + GetDesktopWindow(), + EmptyWindowProc, + (LPARAM)NULL); + if (result == -1) + { + /* Failed to display the window. Do as if the user + * already has pressed CTRL+ALT+DELETE */ + pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, WLX_SAS_TYPE_CTRL_ALT_DEL); + } }
/* Get the text contained in a textbox. Allocates memory in pText * to contain the text. Returns TRUE in case of success */ static BOOL GetTextboxText( - IN HWND hwndDlg, - IN INT TextboxId, - OUT LPWSTR *pText) -{ - LPWSTR Text; - int Count; - - Count = GetWindowTextLength(GetDlgItem(hwndDlg, TextboxId)); - Text = HeapAlloc(GetProcessHeap(), 0, (Count + 1) * sizeof(WCHAR)); - if (!Text) - return FALSE; - if (Count != GetWindowTextW(GetDlgItem(hwndDlg, TextboxId), Text, Count + 1)) - { - HeapFree(GetProcessHeap(), 0, Text); - return FALSE; - } - *pText = Text; - return TRUE; + IN HWND hwndDlg, + IN INT TextboxId, + OUT LPWSTR *pText) +{ + LPWSTR Text; + int Count; + + Count = GetWindowTextLength(GetDlgItem(hwndDlg, TextboxId)); + Text = HeapAlloc(GetProcessHeap(), 0, (Count + 1) * sizeof(WCHAR)); + if (!Text) + return FALSE; + if (Count != GetWindowTextW(GetDlgItem(hwndDlg, TextboxId), Text, Count + 1)) + { + HeapFree(GetProcessHeap(), 0, Text); + return FALSE; + } + *pText = Text; + return TRUE; }
static VOID @@ -260,209 +260,209 @@
static INT_PTR CALLBACK LoggedOnWindowProc( - IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam) -{ - switch (uMsg) - { - case WM_INITDIALOG: - { - OnInitSecurityDlg(hwndDlg, (PGINA_CONTEXT)lParam); - SetFocus(GetDlgItem(hwndDlg, IDNO)); - return TRUE; - } - - 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_CLOSE: - { - EndDialog(hwndDlg, WLX_SAS_ACTION_NONE); - return TRUE; - } - } - - return FALSE; + IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam) +{ + switch (uMsg) + { + case WM_INITDIALOG: + { + OnInitSecurityDlg(hwndDlg, (PGINA_CONTEXT)lParam); + SetFocus(GetDlgItem(hwndDlg, IDNO)); + return TRUE; + } + + 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_CLOSE: + { + EndDialog(hwndDlg, WLX_SAS_ACTION_NONE); + 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->WlxSwitchDesktopToWinlogon( - pgContext->hWlx); - - result = pgContext->pWlxFuncs->WlxDialogBoxParam( - pgContext->hWlx, - pgContext->hDllInstance, - MAKEINTRESOURCEW(IDD_LOGGEDON_DLG), - GetDesktopWindow(), - LoggedOnWindowProc, - (LPARAM)pgContext); - - if (result < WLX_SAS_ACTION_LOGON || - result > WLX_SAS_ACTION_SWITCH_CONSOLE) - { - result = WLX_SAS_ACTION_NONE; - } - - if (result == WLX_SAS_ACTION_NONE) - { - result = pgContext->pWlxFuncs->WlxSwitchDesktopToUser( - pgContext->hWlx); - } - - return result; + 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->WlxSwitchDesktopToWinlogon( + pgContext->hWlx); + + result = pgContext->pWlxFuncs->WlxDialogBoxParam( + pgContext->hWlx, + pgContext->hDllInstance, + MAKEINTRESOURCEW(IDD_LOGGEDON_DLG), + GetDesktopWindow(), + LoggedOnWindowProc, + (LPARAM)pgContext); + + if (result < WLX_SAS_ACTION_LOGON || + result > WLX_SAS_ACTION_SWITCH_CONSOLE) + { + result = WLX_SAS_ACTION_NONE; + } + + if (result == WLX_SAS_ACTION_NONE) + { + result = pgContext->pWlxFuncs->WlxSwitchDesktopToUser( + pgContext->hWlx); + } + + return result; }
static INT_PTR CALLBACK LoggedOutWindowProc( - IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam) -{ - PGINA_CONTEXT pgContext; - - pgContext = (PGINA_CONTEXT)GetWindowLongPtr(hwndDlg, GWL_USERDATA); - - switch (uMsg) - { - case WM_INITDIALOG: - { - /* FIXME: take care of DontDisplayLastUserName, NoDomainUI, ShutdownWithoutLogon */ - pgContext = (PGINA_CONTEXT)lParam; - SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)pgContext); - SetFocus(GetDlgItem(hwndDlg, IDC_USERNAME)); - - pgContext->hBitmap = LoadImage(hDllInstance, MAKEINTRESOURCE(IDI_ROSLOGO), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR); - return TRUE; - } - case WM_PAINT: - { - PAINTSTRUCT ps; - HDC hdc; - if (pgContext->hBitmap) - { - hdc = BeginPaint(hwndDlg, &ps); - DrawStateW(hdc, NULL, NULL, (LPARAM)pgContext->hBitmap, (WPARAM)0, 0, 0, 0, 0, DST_BITMAP); - EndPaint(hwndDlg, &ps); - } - return TRUE; - } - case WM_DESTROY: - { - DeleteObject(pgContext->hBitmap); - return TRUE; - } - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDOK: - { - LPWSTR UserName = NULL, Password = NULL; - INT result = WLX_SAS_ACTION_NONE; - - if (GetTextboxText(hwndDlg, IDC_USERNAME, &UserName) && *UserName == '\0') - break; - if (GetTextboxText(hwndDlg, IDC_PASSWORD, &Password) && - DoLoginTasks(pgContext, UserName, NULL, Password)) - { - result = WLX_SAS_ACTION_LOGON; - } - HeapFree(GetProcessHeap(), 0, UserName); - HeapFree(GetProcessHeap(), 0, Password); - EndDialog(hwndDlg, result); - return TRUE; - } - case IDCANCEL: - { - EndDialog(hwndDlg, WLX_SAS_ACTION_NONE); - return TRUE; - } - case IDC_SHUTDOWN: - { - EndDialog(hwndDlg, WLX_SAS_ACTION_SHUTDOWN); - return TRUE; - } - } - break; - } - } - - return FALSE; + IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam) +{ + PGINA_CONTEXT pgContext; + + pgContext = (PGINA_CONTEXT)GetWindowLongPtr(hwndDlg, GWL_USERDATA); + + switch (uMsg) + { + case WM_INITDIALOG: + { + /* FIXME: take care of DontDisplayLastUserName, NoDomainUI, ShutdownWithoutLogon */ + pgContext = (PGINA_CONTEXT)lParam; + SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)pgContext); + SetFocus(GetDlgItem(hwndDlg, IDC_USERNAME)); + + pgContext->hBitmap = LoadImage(hDllInstance, MAKEINTRESOURCE(IDI_ROSLOGO), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR); + return TRUE; + } + case WM_PAINT: + { + PAINTSTRUCT ps; + HDC hdc; + if (pgContext->hBitmap) + { + hdc = BeginPaint(hwndDlg, &ps); + DrawStateW(hdc, NULL, NULL, (LPARAM)pgContext->hBitmap, (WPARAM)0, 0, 0, 0, 0, DST_BITMAP); + EndPaint(hwndDlg, &ps); + } + return TRUE; + } + case WM_DESTROY: + { + DeleteObject(pgContext->hBitmap); + return TRUE; + } + case WM_COMMAND: + { + switch (LOWORD(wParam)) + { + case IDOK: + { + LPWSTR UserName = NULL, Password = NULL; + INT result = WLX_SAS_ACTION_NONE; + + if (GetTextboxText(hwndDlg, IDC_USERNAME, &UserName) && *UserName == '\0') + break; + if (GetTextboxText(hwndDlg, IDC_PASSWORD, &Password) && + DoLoginTasks(pgContext, UserName, NULL, Password)) + { + result = WLX_SAS_ACTION_LOGON; + } + HeapFree(GetProcessHeap(), 0, UserName); + HeapFree(GetProcessHeap(), 0, Password); + EndDialog(hwndDlg, result); + return TRUE; + } + case IDCANCEL: + { + EndDialog(hwndDlg, WLX_SAS_ACTION_NONE); + return TRUE; + } + case IDC_SHUTDOWN: + { + EndDialog(hwndDlg, WLX_SAS_ACTION_SHUTDOWN); + return TRUE; + } + } + break; + } + } + + return FALSE; }
static INT GUILoggedOutSAS( - IN OUT PGINA_CONTEXT pgContext) -{ - int result; - - TRACE("GUILoggedOutSAS()\n"); - - result = pgContext->pWlxFuncs->WlxDialogBoxParam( - pgContext->hWlx, - pgContext->hDllInstance, - MAKEINTRESOURCEW(IDD_LOGGEDOUT_DLG), - GetDesktopWindow(), - LoggedOutWindowProc, - (LPARAM)pgContext); - if (result >= WLX_SAS_ACTION_LOGON && - result <= WLX_SAS_ACTION_SWITCH_CONSOLE) - { - WARN("WlxLoggedOutSAS() returns 0x%x\n", result); - return result; - } - - WARN("WlxDialogBoxParam() failed (0x%x)\n", result); - return WLX_SAS_ACTION_NONE; + IN OUT PGINA_CONTEXT pgContext) +{ + int result; + + TRACE("GUILoggedOutSAS()\n"); + + result = pgContext->pWlxFuncs->WlxDialogBoxParam( + pgContext->hWlx, + pgContext->hDllInstance, + MAKEINTRESOURCEW(IDD_LOGGEDOUT_DLG), + GetDesktopWindow(), + LoggedOutWindowProc, + (LPARAM)pgContext); + if (result >= WLX_SAS_ACTION_LOGON && + result <= WLX_SAS_ACTION_SWITCH_CONSOLE) + { + WARN("WlxLoggedOutSAS() returns 0x%x\n", result); + return result; + } + + WARN("WlxDialogBoxParam() failed (0x%x)\n", result); + return WLX_SAS_ACTION_NONE; }
static INT GUILockedSAS( - IN OUT PGINA_CONTEXT pgContext) -{ - TRACE("GUILockedSAS()\n"); - - UNREFERENCED_PARAMETER(pgContext); - - UNIMPLEMENTED; - return WLX_SAS_ACTION_UNLOCK_WKSTA; + IN OUT PGINA_CONTEXT pgContext) +{ + TRACE("GUILockedSAS()\n"); + + UNREFERENCED_PARAMETER(pgContext); + + UNIMPLEMENTED; + return WLX_SAS_ACTION_UNLOCK_WKSTA; }
@@ -485,71 +485,71 @@
static INT_PTR CALLBACK LockedWindowProc( - IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam) -{ - PGINA_CONTEXT pgContext; - - pgContext = (PGINA_CONTEXT)GetWindowLongPtr(hwndDlg, GWL_USERDATA); - - switch (uMsg) - { - case WM_INITDIALOG: - { - pgContext = (PGINA_CONTEXT)lParam; - SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)pgContext); - - pgContext->hBitmap = LoadImage(hDllInstance, MAKEINTRESOURCE(IDI_ROSLOGO), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR); - OnInitLockedDlg(hwndDlg, pgContext); - return TRUE; - } - case WM_PAINT: - { - PAINTSTRUCT ps; - HDC hdc; - if (pgContext->hBitmap) - { - hdc = BeginPaint(hwndDlg, &ps); - DrawStateW(hdc, NULL, NULL, (LPARAM)pgContext->hBitmap, (WPARAM)0, 0, 0, 0, 0, DST_BITMAP); - EndPaint(hwndDlg, &ps); - } - return TRUE; - } - case WM_DESTROY: - { - DeleteObject(pgContext->hBitmap); - return TRUE; - } - } - - return FALSE; + IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam) +{ + PGINA_CONTEXT pgContext; + + pgContext = (PGINA_CONTEXT)GetWindowLongPtr(hwndDlg, GWL_USERDATA); + + switch (uMsg) + { + case WM_INITDIALOG: + { + pgContext = (PGINA_CONTEXT)lParam; + SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)pgContext); + + pgContext->hBitmap = LoadImage(hDllInstance, MAKEINTRESOURCE(IDI_ROSLOGO), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR); + OnInitLockedDlg(hwndDlg, pgContext); + return TRUE; + } + case WM_PAINT: + { + PAINTSTRUCT ps; + HDC hdc; + if (pgContext->hBitmap) + { + hdc = BeginPaint(hwndDlg, &ps); + DrawStateW(hdc, NULL, NULL, (LPARAM)pgContext->hBitmap, (WPARAM)0, 0, 0, 0, 0, DST_BITMAP); + EndPaint(hwndDlg, &ps); + } + return TRUE; + } + case WM_DESTROY: + { + DeleteObject(pgContext->hBitmap); + return TRUE; + } + } + + return FALSE; }
static VOID GUIDisplayLockedNotice( - IN OUT PGINA_CONTEXT pgContext) -{ - TRACE("GUIdisplayLockedNotice()\n"); - - pgContext->pWlxFuncs->WlxDialogBoxParam( - pgContext->hWlx, - pgContext->hDllInstance, - MAKEINTRESOURCEW(IDD_LOCKED_DLG), - GetDesktopWindow(), - LockedWindowProc, - (LPARAM)pgContext); + IN OUT PGINA_CONTEXT pgContext) +{ + TRACE("GUIdisplayLockedNotice()\n"); + + pgContext->pWlxFuncs->WlxDialogBoxParam( + pgContext->hWlx, + pgContext->hDllInstance, + MAKEINTRESOURCEW(IDD_LOCKED_DLG), + GetDesktopWindow(), + LockedWindowProc, + (LPARAM)pgContext); }
GINA_UI GinaGraphicalUI = { - GUIInitialize, - GUIDisplayStatusMessage, - GUIRemoveStatusMessage, - GUIDisplaySASNotice, - GUILoggedOnSAS, - GUILoggedOutSAS, - GUILockedSAS, - GUIDisplayLockedNotice, + GUIInitialize, + GUIDisplayStatusMessage, + GUIRemoveStatusMessage, + GUIDisplaySASNotice, + GUILoggedOnSAS, + GUILoggedOutSAS, + GUILockedSAS, + GUIDisplayLockedNotice, };
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 [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/msgina.c [iso-8859-1] Mon May 6 21:43:03 2013 @@ -39,100 +39,100 @@ */ BOOL WINAPI WlxNegotiate( - IN DWORD dwWinlogonVersion, - OUT PDWORD pdwDllVersion) -{ - TRACE("WlxNegotiate(%lx, %p)\n", dwWinlogonVersion, pdwDllVersion); - - if(!pdwDllVersion || (dwWinlogonVersion < WLX_VERSION_1_3)) - return FALSE; - - *pdwDllVersion = WLX_VERSION_1_3; - - return TRUE; + IN DWORD dwWinlogonVersion, + OUT PDWORD pdwDllVersion) +{ + TRACE("WlxNegotiate(%lx, %p)\n", dwWinlogonVersion, pdwDllVersion); + + if(!pdwDllVersion || (dwWinlogonVersion < WLX_VERSION_1_3)) + return FALSE; + + *pdwDllVersion = WLX_VERSION_1_3; + + return TRUE; }
static LONG ReadRegSzKey( - IN HKEY hKey, - IN LPCWSTR pszKey, - OUT LPWSTR* pValue) -{ - LONG rc; - DWORD dwType; - DWORD cbData = 0; - LPWSTR Value; - - if (!pValue) - return ERROR_INVALID_PARAMETER; - - *pValue = NULL; - rc = RegQueryValueExW(hKey, pszKey, NULL, &dwType, NULL, &cbData); - if (rc != ERROR_SUCCESS) - return rc; - if (dwType != REG_SZ) - return ERROR_FILE_NOT_FOUND; - Value = HeapAlloc(GetProcessHeap(), 0, cbData + sizeof(WCHAR)); - if (!Value) - return ERROR_NOT_ENOUGH_MEMORY; - rc = RegQueryValueExW(hKey, pszKey, NULL, NULL, (LPBYTE)Value, &cbData); - if (rc != ERROR_SUCCESS) - { - HeapFree(GetProcessHeap(), 0, Value); - return rc; - } - /* NULL-terminate the string */ - Value[cbData / sizeof(WCHAR)] = '\0'; - - *pValue = Value; - return ERROR_SUCCESS; + IN HKEY hKey, + IN LPCWSTR pszKey, + OUT LPWSTR* pValue) +{ + LONG rc; + DWORD dwType; + DWORD cbData = 0; + LPWSTR Value; + + if (!pValue) + return ERROR_INVALID_PARAMETER; + + *pValue = NULL; + rc = RegQueryValueExW(hKey, pszKey, NULL, &dwType, NULL, &cbData); + if (rc != ERROR_SUCCESS) + return rc; + if (dwType != REG_SZ) + return ERROR_FILE_NOT_FOUND; + Value = HeapAlloc(GetProcessHeap(), 0, cbData + sizeof(WCHAR)); + if (!Value) + return ERROR_NOT_ENOUGH_MEMORY; + rc = RegQueryValueExW(hKey, pszKey, NULL, NULL, (LPBYTE)Value, &cbData); + if (rc != ERROR_SUCCESS) + { + HeapFree(GetProcessHeap(), 0, Value); + return rc; + } + /* NULL-terminate the string */ + Value[cbData / sizeof(WCHAR)] = '\0'; + + *pValue = Value; + return ERROR_SUCCESS; }
static VOID ChooseGinaUI(VOID) { - HKEY ControlKey = NULL; - LPWSTR SystemStartOptions = NULL; - LPWSTR CurrentOption, NextOption; /* Pointers into SystemStartOptions */ - BOOL ConsoleBoot = FALSE; - LONG rc; - - rc = RegOpenKeyExW( - HKEY_LOCAL_MACHINE, - L"SYSTEM\CurrentControlSet\Control", - 0, - KEY_QUERY_VALUE, - &ControlKey); - - rc = ReadRegSzKey(ControlKey, L"SystemStartOptions", &SystemStartOptions); - if (rc != ERROR_SUCCESS) - goto cleanup; - - /* Check for CONSOLE switch in SystemStartOptions */ - CurrentOption = SystemStartOptions; - while (CurrentOption) - { - NextOption = wcschr(CurrentOption, L' '); - if (NextOption) - *NextOption = L'\0'; - if (wcsicmp(CurrentOption, L"CONSOLE") == 0) - { - TRACE("Found %S. Switching to console boot\n", CurrentOption); - ConsoleBoot = TRUE; - goto cleanup; - } - CurrentOption = NextOption ? NextOption + 1 : NULL; - } + HKEY ControlKey = NULL; + LPWSTR SystemStartOptions = NULL; + LPWSTR CurrentOption, NextOption; /* Pointers into SystemStartOptions */ + BOOL ConsoleBoot = FALSE; + LONG rc; + + rc = RegOpenKeyExW( + HKEY_LOCAL_MACHINE, + L"SYSTEM\CurrentControlSet\Control", + 0, + KEY_QUERY_VALUE, + &ControlKey); + + rc = ReadRegSzKey(ControlKey, L"SystemStartOptions", &SystemStartOptions); + if (rc != ERROR_SUCCESS) + goto cleanup; + + /* Check for CONSOLE switch in SystemStartOptions */ + CurrentOption = SystemStartOptions; + while (CurrentOption) + { + NextOption = wcschr(CurrentOption, L' '); + if (NextOption) + *NextOption = L'\0'; + if (wcsicmp(CurrentOption, L"CONSOLE") == 0) + { + TRACE("Found %S. Switching to console boot\n", CurrentOption); + ConsoleBoot = TRUE; + goto cleanup; + } + CurrentOption = NextOption ? NextOption + 1 : NULL; + }
cleanup: - if (ConsoleBoot) - pGinaUI = &GinaTextUI; - else - pGinaUI = &GinaGraphicalUI; - - if (ControlKey != NULL) - RegCloseKey(ControlKey); - HeapFree(GetProcessHeap(), 0, SystemStartOptions); + if (ConsoleBoot) + pGinaUI = &GinaTextUI; + else + pGinaUI = &GinaGraphicalUI; + + if (ControlKey != NULL) + RegCloseKey(ControlKey); + HeapFree(GetProcessHeap(), 0, SystemStartOptions); }
/* @@ -140,50 +140,50 @@ */ BOOL WINAPI WlxInitialize( - LPWSTR lpWinsta, - HANDLE hWlx, - PVOID pvReserved, - PVOID pWinlogonFunctions, - PVOID *pWlxContext) -{ - PGINA_CONTEXT pgContext; - - UNREFERENCED_PARAMETER(pvReserved); - - pgContext = (PGINA_CONTEXT)LocalAlloc(LMEM_FIXED | LMEM_ZEROINIT, sizeof(GINA_CONTEXT)); - if(!pgContext) - { - WARN("LocalAlloc() failed\n"); - return FALSE; - } - - /* Return the context to winlogon */ - *pWlxContext = (PVOID)pgContext; - pgContext->hDllInstance = hDllInstance; - - /* Save pointer to dispatch table */ - pgContext->pWlxFuncs = (PWLX_DISPATCH_VERSION_1_3)pWinlogonFunctions; - - /* Save the winlogon handle used to call the dispatch functions */ - pgContext->hWlx = hWlx; - - /* Save window station */ - pgContext->station = lpWinsta; - - /* Clear status window handle */ - pgContext->hStatusWindow = 0; - - /* Notify winlogon that we will use the default SAS */ - pgContext->pWlxFuncs->WlxUseCtrlAltDel(hWlx); - - /* Locates the authentification package */ - //LsaRegisterLogonProcess(...); - - /* Check autologon settings the first time */ - pgContext->AutoLogonState = AUTOLOGON_CHECK_REGISTRY; - - ChooseGinaUI(); - return pGinaUI->Initialize(pgContext); + LPWSTR lpWinsta, + HANDLE hWlx, + PVOID pvReserved, + PVOID pWinlogonFunctions, + PVOID *pWlxContext) +{ + PGINA_CONTEXT pgContext; + + UNREFERENCED_PARAMETER(pvReserved); + + pgContext = (PGINA_CONTEXT)LocalAlloc(LMEM_FIXED | LMEM_ZEROINIT, sizeof(GINA_CONTEXT)); + if(!pgContext) + { + WARN("LocalAlloc() failed\n"); + return FALSE; + } + + /* Return the context to winlogon */ + *pWlxContext = (PVOID)pgContext; + pgContext->hDllInstance = hDllInstance; + + /* Save pointer to dispatch table */ + pgContext->pWlxFuncs = (PWLX_DISPATCH_VERSION_1_3)pWinlogonFunctions; + + /* Save the winlogon handle used to call the dispatch functions */ + pgContext->hWlx = hWlx; + + /* Save window station */ + pgContext->station = lpWinsta; + + /* Clear status window handle */ + pgContext->hStatusWindow = 0; + + /* Notify winlogon that we will use the default SAS */ + pgContext->pWlxFuncs->WlxUseCtrlAltDel(hWlx); + + /* Locates the authentification package */ + //LsaRegisterLogonProcess(...); + + /* Check autologon settings the first time */ + pgContext->AutoLogonState = AUTOLOGON_CHECK_REGISTRY; + + ChooseGinaUI(); + return pGinaUI->Initialize(pgContext); }
/* @@ -252,65 +252,65 @@ */ BOOL WINAPI WlxStartApplication( - PVOID pWlxContext, - PWSTR pszDesktopName, - PVOID pEnvironment, - PWSTR pszCmdLine) -{ - PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext; - STARTUPINFOW StartupInfo; - PROCESS_INFORMATION ProcessInformation; - WCHAR CurrentDirectory[MAX_PATH]; - HANDLE hAppToken; - UINT len; - BOOL ret; - - len = GetWindowsDirectoryW(CurrentDirectory, MAX_PATH); - if (len == 0 || len > MAX_PATH) - { - ERR("GetWindowsDirectoryW() failed\n"); - return FALSE; - } - - ret = DuplicateTokenEx(pgContext->UserToken, MAXIMUM_ALLOWED, NULL, SecurityImpersonation, TokenPrimary, &hAppToken); - if (!ret) - { - ERR("DuplicateTokenEx() failed with error %lu\n", GetLastError()); - return FALSE; - } - - ZeroMemory(&StartupInfo, sizeof(StartupInfo)); - ZeroMemory(&ProcessInformation, sizeof(ProcessInformation)); - StartupInfo.cb = sizeof(StartupInfo); - StartupInfo.lpTitle = pszCmdLine; - StartupInfo.dwFlags = STARTF_USESHOWWINDOW; - StartupInfo.wShowWindow = SW_SHOW; - StartupInfo.lpDesktop = pszDesktopName; - - len = GetWindowsDirectoryW(CurrentDirectory, MAX_PATH); - if (len == 0 || len > MAX_PATH) - { - ERR("GetWindowsDirectoryW() failed\n"); - return FALSE; - } - ret = CreateProcessAsUserW( - hAppToken, - pszCmdLine, - NULL, - NULL, - NULL, - FALSE, - CREATE_UNICODE_ENVIRONMENT, - pEnvironment, - CurrentDirectory, - &StartupInfo, - &ProcessInformation); - CloseHandle(ProcessInformation.hProcess); - CloseHandle(ProcessInformation.hThread); - CloseHandle(hAppToken); - if (!ret) - ERR("CreateProcessAsUserW() failed with error %lu\n", GetLastError()); - return ret; + PVOID pWlxContext, + PWSTR pszDesktopName, + PVOID pEnvironment, + PWSTR pszCmdLine) +{ + PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext; + STARTUPINFOW StartupInfo; + PROCESS_INFORMATION ProcessInformation; + WCHAR CurrentDirectory[MAX_PATH]; + HANDLE hAppToken; + UINT len; + BOOL ret; + + len = GetWindowsDirectoryW(CurrentDirectory, MAX_PATH); + if (len == 0 || len > MAX_PATH) + { + ERR("GetWindowsDirectoryW() failed\n"); + return FALSE; + } + + ret = DuplicateTokenEx(pgContext->UserToken, MAXIMUM_ALLOWED, NULL, SecurityImpersonation, TokenPrimary, &hAppToken); + if (!ret) + { + ERR("DuplicateTokenEx() failed with error %lu\n", GetLastError()); + return FALSE; + } + + ZeroMemory(&StartupInfo, sizeof(StartupInfo)); + ZeroMemory(&ProcessInformation, sizeof(ProcessInformation)); + StartupInfo.cb = sizeof(StartupInfo); + StartupInfo.lpTitle = pszCmdLine; + StartupInfo.dwFlags = STARTF_USESHOWWINDOW; + StartupInfo.wShowWindow = SW_SHOW; + StartupInfo.lpDesktop = pszDesktopName; + + len = GetWindowsDirectoryW(CurrentDirectory, MAX_PATH); + if (len == 0 || len > MAX_PATH) + { + ERR("GetWindowsDirectoryW() failed\n"); + return FALSE; + } + ret = CreateProcessAsUserW( + hAppToken, + pszCmdLine, + NULL, + NULL, + NULL, + FALSE, + CREATE_UNICODE_ENVIRONMENT, + pEnvironment, + CurrentDirectory, + &StartupInfo, + &ProcessInformation); + CloseHandle(ProcessInformation.hProcess); + CloseHandle(ProcessInformation.hThread); + CloseHandle(hAppToken); + if (!ret) + ERR("CreateProcessAsUserW() failed with error %lu\n", GetLastError()); + return ret; }
/* @@ -318,61 +318,61 @@ */ BOOL WINAPI WlxActivateUserShell( - PVOID pWlxContext, - PWSTR pszDesktopName, - PWSTR pszMprLogonScript, - PVOID pEnvironment) -{ - HKEY hKey; - DWORD BufSize, ValueType; - WCHAR pszUserInitApp[MAX_PATH + 1]; - WCHAR pszExpUserInitApp[MAX_PATH]; - DWORD len; - LONG rc; - - TRACE("WlxActivateUserShell()\n"); - - UNREFERENCED_PARAMETER(pszMprLogonScript); - - /* Get the path of userinit */ - rc = RegOpenKeyExW( - HKEY_LOCAL_MACHINE, - L"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", - 0, - KEY_QUERY_VALUE, - &hKey); - if (rc != ERROR_SUCCESS) - { - WARN("RegOpenKeyExW() failed with error %lu\n", rc); - return FALSE; - } - - /* Query userinit application */ - BufSize = sizeof(pszUserInitApp) - sizeof(UNICODE_NULL); - rc = RegQueryValueExW( - hKey, - L"Userinit", - NULL, - &ValueType, - (LPBYTE)pszUserInitApp, - &BufSize); - RegCloseKey(hKey); - if (rc != ERROR_SUCCESS || (ValueType != REG_SZ && ValueType != REG_EXPAND_SZ)) - { - WARN("RegQueryValueExW() failed with error %lu\n", rc); - return FALSE; - } - pszUserInitApp[MAX_PATH] = UNICODE_NULL; - - len = ExpandEnvironmentStringsW(pszUserInitApp, pszExpUserInitApp, MAX_PATH); - if (len > MAX_PATH) - { - WARN("ExpandEnvironmentStringsW() failed. Required size %lu\n", len); - return FALSE; - } - - /* Start userinit app */ - return WlxStartApplication(pWlxContext, pszDesktopName, pEnvironment, pszExpUserInitApp); + PVOID pWlxContext, + PWSTR pszDesktopName, + PWSTR pszMprLogonScript, + PVOID pEnvironment) +{ + HKEY hKey; + DWORD BufSize, ValueType; + WCHAR pszUserInitApp[MAX_PATH + 1]; + WCHAR pszExpUserInitApp[MAX_PATH]; + DWORD len; + LONG rc; + + TRACE("WlxActivateUserShell()\n"); + + UNREFERENCED_PARAMETER(pszMprLogonScript); + + /* Get the path of userinit */ + rc = RegOpenKeyExW( + HKEY_LOCAL_MACHINE, + L"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", + 0, + KEY_QUERY_VALUE, + &hKey); + if (rc != ERROR_SUCCESS) + { + WARN("RegOpenKeyExW() failed with error %lu\n", rc); + return FALSE; + } + + /* Query userinit application */ + BufSize = sizeof(pszUserInitApp) - sizeof(UNICODE_NULL); + rc = RegQueryValueExW( + hKey, + L"Userinit", + NULL, + &ValueType, + (LPBYTE)pszUserInitApp, + &BufSize); + RegCloseKey(hKey); + if (rc != ERROR_SUCCESS || (ValueType != REG_SZ && ValueType != REG_EXPAND_SZ)) + { + WARN("RegQueryValueExW() failed with error %lu\n", rc); + return FALSE; + } + pszUserInitApp[MAX_PATH] = UNICODE_NULL; + + len = ExpandEnvironmentStringsW(pszUserInitApp, pszExpUserInitApp, MAX_PATH); + if (len > MAX_PATH) + { + WARN("ExpandEnvironmentStringsW() failed. Required size %lu\n", len); + return FALSE; + } + + /* Start userinit app */ + return WlxStartApplication(pWlxContext, pszDesktopName, pEnvironment, pszExpUserInitApp); }
/* @@ -380,43 +380,43 @@ */ int WINAPI WlxLoggedOnSAS( - PVOID pWlxContext, - DWORD dwSasType, - PVOID pReserved) -{ - PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext; - INT SasAction = WLX_SAS_ACTION_NONE; - - TRACE("WlxLoggedOnSAS(0x%lx)\n", dwSasType); - - UNREFERENCED_PARAMETER(pReserved); - - switch (dwSasType) - { - case WLX_SAS_TYPE_CTRL_ALT_DEL: - case WLX_SAS_TYPE_TIMEOUT: - { - SasAction = pGinaUI->LoggedOnSAS(pgContext, dwSasType); - break; - } - case WLX_SAS_TYPE_SC_INSERT: - { - FIXME("WlxLoggedOnSAS: SasType WLX_SAS_TYPE_SC_INSERT not supported!\n"); - break; - } - case WLX_SAS_TYPE_SC_REMOVE: - { - FIXME("WlxLoggedOnSAS: SasType WLX_SAS_TYPE_SC_REMOVE not supported!\n"); - break; - } - default: - { - WARN("WlxLoggedOnSAS: Unknown SasType: 0x%x\n", dwSasType); - break; - } - } - - return SasAction; + PVOID pWlxContext, + DWORD dwSasType, + PVOID pReserved) +{ + PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext; + INT SasAction = WLX_SAS_ACTION_NONE; + + TRACE("WlxLoggedOnSAS(0x%lx)\n", dwSasType); + + UNREFERENCED_PARAMETER(pReserved); + + switch (dwSasType) + { + case WLX_SAS_TYPE_CTRL_ALT_DEL: + case WLX_SAS_TYPE_TIMEOUT: + { + SasAction = pGinaUI->LoggedOnSAS(pgContext, dwSasType); + break; + } + case WLX_SAS_TYPE_SC_INSERT: + { + FIXME("WlxLoggedOnSAS: SasType WLX_SAS_TYPE_SC_INSERT not supported!\n"); + break; + } + case WLX_SAS_TYPE_SC_REMOVE: + { + FIXME("WlxLoggedOnSAS: SasType WLX_SAS_TYPE_SC_REMOVE not supported!\n"); + break; + } + default: + { + WARN("WlxLoggedOnSAS: Unknown SasType: 0x%x\n", dwSasType); + break; + } + } + + return SasAction; }
/* @@ -424,17 +424,17 @@ */ BOOL WINAPI WlxDisplayStatusMessage( - IN PVOID pWlxContext, - IN HDESK hDesktop, - IN DWORD dwOptions, - IN PWSTR pTitle, - IN PWSTR pMessage) -{ - PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext; - - TRACE("WlxDisplayStatusMessage("%S")\n", pMessage); - - return pGinaUI->DisplayStatusMessage(pgContext, hDesktop, dwOptions, pTitle, pMessage); + IN PVOID pWlxContext, + IN HDESK hDesktop, + IN DWORD dwOptions, + IN PWSTR pTitle, + IN PWSTR pMessage) +{ + PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext; + + TRACE("WlxDisplayStatusMessage("%S")\n", pMessage); + + return pGinaUI->DisplayStatusMessage(pgContext, hDesktop, dwOptions, pTitle, pMessage); }
/* @@ -442,231 +442,231 @@ */ BOOL WINAPI WlxRemoveStatusMessage( - IN PVOID pWlxContext) -{ - PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext; - - TRACE("WlxRemoveStatusMessage()\n"); - - return pGinaUI->RemoveStatusMessage(pgContext); + IN PVOID pWlxContext) +{ + PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext; + + TRACE("WlxRemoveStatusMessage()\n"); + + return pGinaUI->RemoveStatusMessage(pgContext); }
static PWSTR DuplicationString(PWSTR Str) { - DWORD cb; - PWSTR NewStr; - - if (Str == NULL) return NULL; - - cb = (wcslen(Str) + 1) * sizeof(WCHAR); - if ((NewStr = LocalAlloc(LMEM_FIXED, cb))) - memcpy(NewStr, Str, cb); - return NewStr; + DWORD cb; + PWSTR NewStr; + + if (Str == NULL) return NULL; + + cb = (wcslen(Str) + 1) * sizeof(WCHAR); + if ((NewStr = LocalAlloc(LMEM_FIXED, cb))) + memcpy(NewStr, Str, cb); + return NewStr; }
BOOL DoLoginTasks( - IN OUT PGINA_CONTEXT pgContext, - IN PWSTR UserName, - IN PWSTR Domain, - IN PWSTR Password) -{ - LPWSTR ProfilePath = NULL; - LPWSTR lpEnvironment = NULL; - TOKEN_STATISTICS Stats; - PWLX_PROFILE_V2_0 pProfile = NULL; - DWORD cbStats, cbSize; - DWORD dwLength; - BOOL bResult; - - if (!LogonUserW(UserName, Domain, Password, - LOGON32_LOGON_INTERACTIVE, - LOGON32_PROVIDER_DEFAULT, - &pgContext->UserToken)) - { - WARN("LogonUserW() failed\n"); - goto cleanup; - } - - /* Store the logon time in the context */ - GetLocalTime(&pgContext->LogonTime); - - /* Store user and domain in the context */ - wcscpy(pgContext->UserName, UserName); - if (Domain == NULL || wcslen(Domain) == 0) - { - dwLength = 256; - GetComputerNameW(pgContext->Domain, &dwLength); - } - else - { - wcscpy(pgContext->Domain, Domain); - } - - /* Get profile path */ - cbSize = 0; - bResult = GetProfilesDirectoryW(NULL, &cbSize); - if (!bResult && GetLastError() == ERROR_INSUFFICIENT_BUFFER) - { - ProfilePath = HeapAlloc(GetProcessHeap(), 0, cbSize * sizeof(WCHAR)); - if (!ProfilePath) - { - WARN("HeapAlloc() failed\n"); - goto cleanup; - } - bResult = GetProfilesDirectoryW(ProfilePath, &cbSize); - } - if (!bResult) - { - WARN("GetUserProfileDirectoryW() failed\n"); - goto cleanup; - } - - /* Allocate memory for profile */ - pProfile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WLX_PROFILE_V2_0)); - if (!pProfile) - { - WARN("HeapAlloc() failed\n"); - goto cleanup; - } - pProfile->dwType = WLX_PROFILE_TYPE_V2_0; - pProfile->pszProfile = ProfilePath; - - lpEnvironment = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - (wcslen(pgContext->Domain)+ 14 + 1) * sizeof(WCHAR)); - if (!lpEnvironment) - { - WARN("HeapAlloc() failed\n"); - goto cleanup; - } - - wsprintfW(lpEnvironment, L"LOGONSERVER=\\%s", pgContext->Domain); - - pProfile->pszEnvironment = lpEnvironment; - - if (!GetTokenInformation(pgContext->UserToken, - TokenStatistics, - (PVOID)&Stats, - sizeof(TOKEN_STATISTICS), - &cbStats)) - { - WARN("Couldn't get Authentication id from user token!\n"); - goto cleanup; - } - - *pgContext->pAuthenticationId = Stats.AuthenticationId; - pgContext->pMprNotifyInfo->pszUserName = DuplicationString(UserName); - pgContext->pMprNotifyInfo->pszDomain = DuplicationString(Domain); - pgContext->pMprNotifyInfo->pszPassword = DuplicationString(Password); - pgContext->pMprNotifyInfo->pszOldPassword = NULL; - *pgContext->pdwOptions = 0; - *pgContext->pProfile = pProfile; - return TRUE; + IN OUT PGINA_CONTEXT pgContext, + IN PWSTR UserName, + IN PWSTR Domain, + IN PWSTR Password) +{ + LPWSTR ProfilePath = NULL; + LPWSTR lpEnvironment = NULL; + TOKEN_STATISTICS Stats; + PWLX_PROFILE_V2_0 pProfile = NULL; + DWORD cbStats, cbSize; + DWORD dwLength; + BOOL bResult; + + if (!LogonUserW(UserName, Domain, Password, + LOGON32_LOGON_INTERACTIVE, + LOGON32_PROVIDER_DEFAULT, + &pgContext->UserToken)) + { + WARN("LogonUserW() failed\n"); + goto cleanup; + } + + /* Store the logon time in the context */ + GetLocalTime(&pgContext->LogonTime); + + /* Store user and domain in the context */ + wcscpy(pgContext->UserName, UserName); + if (Domain == NULL || wcslen(Domain) == 0) + { + dwLength = 256; + GetComputerNameW(pgContext->Domain, &dwLength); + } + else + { + wcscpy(pgContext->Domain, Domain); + } + + /* Get profile path */ + cbSize = 0; + bResult = GetProfilesDirectoryW(NULL, &cbSize); + if (!bResult && GetLastError() == ERROR_INSUFFICIENT_BUFFER) + { + ProfilePath = HeapAlloc(GetProcessHeap(), 0, cbSize * sizeof(WCHAR)); + if (!ProfilePath) + { + WARN("HeapAlloc() failed\n"); + goto cleanup; + } + bResult = GetProfilesDirectoryW(ProfilePath, &cbSize); + } + if (!bResult) + { + WARN("GetUserProfileDirectoryW() failed\n"); + goto cleanup; + } + + /* Allocate memory for profile */ + pProfile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WLX_PROFILE_V2_0)); + if (!pProfile) + { + WARN("HeapAlloc() failed\n"); + goto cleanup; + } + pProfile->dwType = WLX_PROFILE_TYPE_V2_0; + pProfile->pszProfile = ProfilePath; + + lpEnvironment = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + (wcslen(pgContext->Domain)+ 14 + 1) * sizeof(WCHAR)); + if (!lpEnvironment) + { + WARN("HeapAlloc() failed\n"); + goto cleanup; + } + + wsprintfW(lpEnvironment, L"LOGONSERVER=\\%s", pgContext->Domain); + + pProfile->pszEnvironment = lpEnvironment; + + if (!GetTokenInformation(pgContext->UserToken, + TokenStatistics, + (PVOID)&Stats, + sizeof(TOKEN_STATISTICS), + &cbStats)) + { + WARN("Couldn't get Authentication id from user token!\n"); + goto cleanup; + } + + *pgContext->pAuthenticationId = Stats.AuthenticationId; + pgContext->pMprNotifyInfo->pszUserName = DuplicationString(UserName); + pgContext->pMprNotifyInfo->pszDomain = DuplicationString(Domain); + pgContext->pMprNotifyInfo->pszPassword = DuplicationString(Password); + pgContext->pMprNotifyInfo->pszOldPassword = NULL; + *pgContext->pdwOptions = 0; + *pgContext->pProfile = pProfile; + return TRUE;
cleanup: - if (pProfile) - { - HeapFree(GetProcessHeap(), 0, pProfile->pszEnvironment); - } - HeapFree(GetProcessHeap(), 0, pProfile); - HeapFree(GetProcessHeap(), 0, ProfilePath); - return FALSE; + if (pProfile) + { + HeapFree(GetProcessHeap(), 0, pProfile->pszEnvironment); + } + HeapFree(GetProcessHeap(), 0, pProfile); + HeapFree(GetProcessHeap(), 0, ProfilePath); + return FALSE; }
static BOOL DoAutoLogon( - IN PGINA_CONTEXT pgContext) -{ - HKEY WinLogonKey = NULL; - LPWSTR AutoLogon = NULL; - LPWSTR AutoCount = NULL; - LPWSTR IgnoreShiftOverride = NULL; - LPWSTR UserName = NULL; - LPWSTR DomainName = NULL; - LPWSTR Password = NULL; - BOOL result = FALSE; - LONG rc; - - TRACE("DoAutoLogon(): AutoLogonState = %lu\n", - pgContext->AutoLogonState); - - if (pgContext->AutoLogonState == AUTOLOGON_DISABLED) - return FALSE; - - rc = RegOpenKeyExW( - HKEY_LOCAL_MACHINE, - L"SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon", - 0, - KEY_QUERY_VALUE, - &WinLogonKey); - if (rc != ERROR_SUCCESS) - goto cleanup; - - if (pgContext->AutoLogonState == AUTOLOGON_CHECK_REGISTRY) - { - /* Set it by default to disabled, we might reenable it again later */ - pgContext->AutoLogonState = AUTOLOGON_DISABLED; - - rc = ReadRegSzKey(WinLogonKey, L"AutoAdminLogon", &AutoLogon); - if (rc != ERROR_SUCCESS) - goto cleanup; - if (wcscmp(AutoLogon, L"1") != 0) - goto cleanup; - - rc = ReadRegSzKey(WinLogonKey, L"AutoLogonCount", &AutoCount); - if (rc == ERROR_SUCCESS && wcscmp(AutoCount, L"0") == 0) - goto cleanup; - else if (rc != ERROR_FILE_NOT_FOUND) - goto cleanup; - - rc = ReadRegSzKey(WinLogonKey, L"IgnoreShiftOverride", &UserName); - if (rc == ERROR_SUCCESS) - { - if (wcscmp(AutoLogon, L"1") != 0 && GetKeyState(VK_SHIFT) < 0) - goto cleanup; - } - else if (GetKeyState(VK_SHIFT) < 0) - { - /* User pressed SHIFT */ - goto cleanup; - } - - pgContext->AutoLogonState = AUTOLOGON_ONCE; - result = TRUE; - } - else /* pgContext->AutoLogonState == AUTOLOGON_ONCE */ - { - pgContext->AutoLogonState = AUTOLOGON_DISABLED; - - rc = ReadRegSzKey(WinLogonKey, L"DefaultUserName", &UserName); - if (rc != ERROR_SUCCESS) - goto cleanup; - rc = ReadRegSzKey(WinLogonKey, L"DefaultDomainName", &DomainName); - if (rc != ERROR_SUCCESS && rc != ERROR_FILE_NOT_FOUND) - goto cleanup; - rc = ReadRegSzKey(WinLogonKey, L"DefaultPassword", &Password); - if (rc != ERROR_SUCCESS) - goto cleanup; - - result = DoLoginTasks(pgContext, UserName, DomainName, Password); - - if (result == TRUE) - NotifyBootConfigStatus(TRUE); - } + IN PGINA_CONTEXT pgContext) +{ + HKEY WinLogonKey = NULL; + LPWSTR AutoLogon = NULL; + LPWSTR AutoCount = NULL; + LPWSTR IgnoreShiftOverride = NULL; + LPWSTR UserName = NULL; + LPWSTR DomainName = NULL; + LPWSTR Password = NULL; + BOOL result = FALSE; + LONG rc; + + TRACE("DoAutoLogon(): AutoLogonState = %lu\n", + pgContext->AutoLogonState); + + if (pgContext->AutoLogonState == AUTOLOGON_DISABLED) + return FALSE; + + rc = RegOpenKeyExW( + HKEY_LOCAL_MACHINE, + L"SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon", + 0, + KEY_QUERY_VALUE, + &WinLogonKey); + if (rc != ERROR_SUCCESS) + goto cleanup; + + if (pgContext->AutoLogonState == AUTOLOGON_CHECK_REGISTRY) + { + /* Set it by default to disabled, we might reenable it again later */ + pgContext->AutoLogonState = AUTOLOGON_DISABLED; + + rc = ReadRegSzKey(WinLogonKey, L"AutoAdminLogon", &AutoLogon); + if (rc != ERROR_SUCCESS) + goto cleanup; + if (wcscmp(AutoLogon, L"1") != 0) + goto cleanup; + + rc = ReadRegSzKey(WinLogonKey, L"AutoLogonCount", &AutoCount); + if (rc == ERROR_SUCCESS && wcscmp(AutoCount, L"0") == 0) + goto cleanup; + else if (rc != ERROR_FILE_NOT_FOUND) + goto cleanup; + + rc = ReadRegSzKey(WinLogonKey, L"IgnoreShiftOverride", &UserName); + if (rc == ERROR_SUCCESS) + { + if (wcscmp(AutoLogon, L"1") != 0 && GetKeyState(VK_SHIFT) < 0) + goto cleanup; + } + else if (GetKeyState(VK_SHIFT) < 0) + { + /* User pressed SHIFT */ + goto cleanup; + } + + pgContext->AutoLogonState = AUTOLOGON_ONCE; + result = TRUE; + } + else /* pgContext->AutoLogonState == AUTOLOGON_ONCE */ + { + pgContext->AutoLogonState = AUTOLOGON_DISABLED; + + rc = ReadRegSzKey(WinLogonKey, L"DefaultUserName", &UserName); + if (rc != ERROR_SUCCESS) + goto cleanup; + rc = ReadRegSzKey(WinLogonKey, L"DefaultDomainName", &DomainName); + if (rc != ERROR_SUCCESS && rc != ERROR_FILE_NOT_FOUND) + goto cleanup; + rc = ReadRegSzKey(WinLogonKey, L"DefaultPassword", &Password); + if (rc != ERROR_SUCCESS) + goto cleanup; + + result = DoLoginTasks(pgContext, UserName, DomainName, Password); + + if (result == TRUE) + NotifyBootConfigStatus(TRUE); + }
cleanup: - if (WinLogonKey != NULL) - RegCloseKey(WinLogonKey); - HeapFree(GetProcessHeap(), 0, AutoLogon); - HeapFree(GetProcessHeap(), 0, AutoCount); - HeapFree(GetProcessHeap(), 0, IgnoreShiftOverride); - HeapFree(GetProcessHeap(), 0, UserName); - HeapFree(GetProcessHeap(), 0, DomainName); - HeapFree(GetProcessHeap(), 0, Password); - TRACE("DoAutoLogon(): AutoLogonState = %lu, returning %d\n", - pgContext->AutoLogonState, result); - return result; + if (WinLogonKey != NULL) + RegCloseKey(WinLogonKey); + HeapFree(GetProcessHeap(), 0, AutoLogon); + HeapFree(GetProcessHeap(), 0, AutoCount); + HeapFree(GetProcessHeap(), 0, IgnoreShiftOverride); + HeapFree(GetProcessHeap(), 0, UserName); + HeapFree(GetProcessHeap(), 0, DomainName); + HeapFree(GetProcessHeap(), 0, Password); + TRACE("DoAutoLogon(): AutoLogonState = %lu, returning %d\n", + pgContext->AutoLogonState, result); + return result; }
/* @@ -674,32 +674,32 @@ */ VOID WINAPI WlxDisplaySASNotice( - IN PVOID pWlxContext) -{ - PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext; - - TRACE("WlxDisplaySASNotice(%p)\n", pWlxContext); - - if (GetSystemMetrics(SM_REMOTESESSION)) - { - /* User is remotely logged on. Don't display a notice */ - pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, WLX_SAS_TYPE_CTRL_ALT_DEL); - return; - } - - if (DoAutoLogon(pgContext)) - { - /* Don't display the window, we want to do an automatic logon */ - pgContext->AutoLogonState = AUTOLOGON_ONCE; - pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, WLX_SAS_TYPE_CTRL_ALT_DEL); - return; - } - else - pgContext->AutoLogonState = AUTOLOGON_DISABLED; - - pGinaUI->DisplaySASNotice(pgContext); - - TRACE("WlxDisplaySASNotice() done\n"); + IN PVOID pWlxContext) +{ + PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext; + + TRACE("WlxDisplaySASNotice(%p)\n", pWlxContext); + + if (GetSystemMetrics(SM_REMOTESESSION)) + { + /* User is remotely logged on. Don't display a notice */ + pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, WLX_SAS_TYPE_CTRL_ALT_DEL); + return; + } + + if (DoAutoLogon(pgContext)) + { + /* Don't display the window, we want to do an automatic logon */ + pgContext->AutoLogonState = AUTOLOGON_ONCE; + pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, WLX_SAS_TYPE_CTRL_ALT_DEL); + return; + } + else + pgContext->AutoLogonState = AUTOLOGON_DISABLED; + + pGinaUI->DisplaySASNotice(pgContext); + + TRACE("WlxDisplaySASNotice() done\n"); }
/* @@ -707,40 +707,40 @@ */ INT WINAPI WlxLoggedOutSAS( - IN PVOID pWlxContext, - IN DWORD dwSasType, - OUT PLUID pAuthenticationId, - IN OUT PSID pLogonSid, - OUT PDWORD pdwOptions, - OUT PHANDLE phToken, - OUT PWLX_MPR_NOTIFY_INFO pMprNotifyInfo, - OUT PVOID *pProfile) -{ - PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext; - INT res; - - TRACE("WlxLoggedOutSAS()\n"); - - UNREFERENCED_PARAMETER(dwSasType); - UNREFERENCED_PARAMETER(pLogonSid); - - pgContext->pAuthenticationId = pAuthenticationId; - pgContext->pdwOptions = pdwOptions; - pgContext->pMprNotifyInfo = pMprNotifyInfo; - pgContext->pProfile = pProfile; - - if (0 == GetSystemMetrics(SM_REMOTESESSION) && - DoAutoLogon(pgContext)) - { - /* User is local and registry contains information - * to log on him automatically */ - *phToken = pgContext->UserToken; - return WLX_SAS_ACTION_LOGON; - } - - res = pGinaUI->LoggedOutSAS(pgContext); - *phToken = pgContext->UserToken; - return res; + IN PVOID pWlxContext, + IN DWORD dwSasType, + OUT PLUID pAuthenticationId, + IN OUT PSID pLogonSid, + OUT PDWORD pdwOptions, + OUT PHANDLE phToken, + OUT PWLX_MPR_NOTIFY_INFO pMprNotifyInfo, + OUT PVOID *pProfile) +{ + PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext; + INT res; + + TRACE("WlxLoggedOutSAS()\n"); + + UNREFERENCED_PARAMETER(dwSasType); + UNREFERENCED_PARAMETER(pLogonSid); + + pgContext->pAuthenticationId = pAuthenticationId; + pgContext->pdwOptions = pdwOptions; + pgContext->pMprNotifyInfo = pMprNotifyInfo; + pgContext->pProfile = pProfile; + + if (0 == GetSystemMetrics(SM_REMOTESESSION) && + DoAutoLogon(pgContext)) + { + /* User is local and registry contains information + * to log on him automatically */ + *phToken = pgContext->UserToken; + return WLX_SAS_ACTION_LOGON; + } + + res = pGinaUI->LoggedOutSAS(pgContext); + *phToken = pgContext->UserToken; + return res; }
/* @@ -748,16 +748,16 @@ */ int WINAPI WlxWkstaLockedSAS( - PVOID pWlxContext, - DWORD dwSasType) -{ - PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext; - - TRACE("WlxWkstaLockedSAS()\n"); - - UNREFERENCED_PARAMETER(dwSasType); - - return pGinaUI->LockedSAS(pgContext); + PVOID pWlxContext, + DWORD dwSasType) +{ + PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext; + + TRACE("WlxWkstaLockedSAS()\n"); + + UNREFERENCED_PARAMETER(dwSasType); + + return pGinaUI->LockedSAS(pgContext); }
@@ -781,7 +781,7 @@ */ BOOL WINAPI WlxIsLogoffOk( - PVOID pWlxContext) + PVOID pWlxContext) { TRACE("WlxIsLogoffOk()\n"); UNREFERENCED_PARAMETER(pWlxContext); @@ -790,14 +790,14 @@
BOOL WINAPI DllMain( - IN HINSTANCE hinstDLL, - IN DWORD dwReason, - IN LPVOID lpvReserved) -{ - UNREFERENCED_PARAMETER(lpvReserved); - - if (dwReason == DLL_PROCESS_ATTACH) - hDllInstance = hinstDLL; - - return TRUE; -} + IN HINSTANCE hinstDLL, + IN DWORD dwReason, + IN LPVOID lpvReserved) +{ + UNREFERENCED_PARAMETER(lpvReserved); + + if (dwReason == DLL_PROCESS_ATTACH) + hDllInstance = hinstDLL; + + return TRUE; +}
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 [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/msgina.h [iso-8859-1] Mon May 6 21:43:03 2013 @@ -23,25 +23,25 @@
typedef struct { - HANDLE hWlx; - LPWSTR station; - PWLX_DISPATCH_VERSION_1_3 pWlxFuncs; - HANDLE hDllInstance; - HWND hStatusWindow; - DWORD AutoLogonState; + HANDLE hWlx; + LPWSTR station; + PWLX_DISPATCH_VERSION_1_3 pWlxFuncs; + HANDLE hDllInstance; + HWND hStatusWindow; + DWORD AutoLogonState;
- /* Informations to be filled during logon */ - WCHAR UserName[256]; - WCHAR Domain[256]; - SYSTEMTIME LogonTime; - HANDLE UserToken; - PLUID pAuthenticationId; - PDWORD pdwOptions; - PWLX_MPR_NOTIFY_INFO pMprNotifyInfo; - PVOID *pProfile; + /* Informations to be filled during logon */ + WCHAR UserName[256]; + WCHAR Domain[256]; + SYSTEMTIME LogonTime; + HANDLE UserToken; + PLUID pAuthenticationId; + PDWORD pdwOptions; + PWLX_MPR_NOTIFY_INFO pMprNotifyInfo; + PVOID *pProfile;
- /* Current logo to display */ - HBITMAP hBitmap; + /* Current logo to display */ + HBITMAP hBitmap; } GINA_CONTEXT, *PGINA_CONTEXT;
extern HINSTANCE hDllInstance; @@ -57,23 +57,23 @@
typedef struct _GINA_UI { - PFGINA_INITIALIZE Initialize; - PFGINA_DISPLAYSTATUSMESSAGE DisplayStatusMessage; - PFGINA_REMOVESTATUSMESSAGE RemoveStatusMessage; - PFGINA_DISPLAYSASNOTICE DisplaySASNotice; - PFGINA_LOGGEDONSAS LoggedOnSAS; - PFGINA_LOGGEDOUTSAS LoggedOutSAS; - PFGINA_LOCKEDSAS LockedSAS; - PFGINA_DISPLAYLOCKEDNOTICE DisplayLockedNotice; + PFGINA_INITIALIZE Initialize; + PFGINA_DISPLAYSTATUSMESSAGE DisplayStatusMessage; + PFGINA_REMOVESTATUSMESSAGE RemoveStatusMessage; + PFGINA_DISPLAYSASNOTICE DisplaySASNotice; + PFGINA_LOGGEDONSAS LoggedOnSAS; + PFGINA_LOGGEDOUTSAS LoggedOutSAS; + PFGINA_LOCKEDSAS LockedSAS; + PFGINA_DISPLAYLOCKEDNOTICE DisplayLockedNotice; } GINA_UI, *PGINA_UI;
/* msgina.c */
BOOL DoLoginTasks( - IN OUT PGINA_CONTEXT pgContext, - IN PWSTR UserName, - IN PWSTR Domain, - IN PWSTR Password); + IN OUT PGINA_CONTEXT pgContext, + IN PWSTR UserName, + IN PWSTR Domain, + IN PWSTR Password);
/* EOF */
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 [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/stubs.c [iso-8859-1] Mon May 6 21:43:03 2013 @@ -22,20 +22,20 @@ DWORD Unknown, BOOL bHideLogoff) { - UNREFERENCED_PARAMETER(hParent); - UNREFERENCED_PARAMETER(Unknown); - UNREFERENCED_PARAMETER(bHideLogoff); + UNREFERENCED_PARAMETER(hParent); + UNREFERENCED_PARAMETER(Unknown); + UNREFERENCED_PARAMETER(bHideLogoff);
- /* Return values: - * 0x00: Cancelled/Help - * 0x01: Log off user - * 0x02: Shutdown - * 0x04: Reboot - * 0x10: Standby - * 0x40: Hibernate - */ - UNIMPLEMENTED; - return FALSE; + /* Return values: + * 0x00: Cancelled/Help + * 0x01: Log off user + * 0x02: Shutdown + * 0x04: Reboot + * 0x10: Standby + * 0x40: Hibernate + */ + UNIMPLEMENTED; + return FALSE; }
@@ -44,12 +44,12 @@ */ BOOL WINAPI WlxIsLockOk( - PVOID pWlxContext) + PVOID pWlxContext) { - UNREFERENCED_PARAMETER(pWlxContext); + UNREFERENCED_PARAMETER(pWlxContext);
- UNIMPLEMENTED; - return TRUE; + UNIMPLEMENTED; + return TRUE; }
@@ -58,11 +58,11 @@ */ VOID WINAPI WlxLogoff( - PVOID pWlxContext) + PVOID pWlxContext) { - UNREFERENCED_PARAMETER(pWlxContext); + UNREFERENCED_PARAMETER(pWlxContext);
- UNIMPLEMENTED; + UNIMPLEMENTED; }
@@ -71,13 +71,13 @@ */ VOID WINAPI WlxShutdown( - PVOID pWlxContext, - DWORD ShutdownType) + PVOID pWlxContext, + DWORD ShutdownType) { - UNREFERENCED_PARAMETER(pWlxContext); - UNREFERENCED_PARAMETER(ShutdownType); + UNREFERENCED_PARAMETER(pWlxContext); + UNREFERENCED_PARAMETER(ShutdownType);
- UNIMPLEMENTED; + UNIMPLEMENTED; }
@@ -86,18 +86,18 @@ */ BOOL WINAPI WlxGetStatusMessage( - PVOID pWlxContext, - DWORD *pdwOptions, - PWSTR pMessage, - DWORD dwBufferSize) + PVOID pWlxContext, + DWORD *pdwOptions, + PWSTR pMessage, + DWORD dwBufferSize) { - UNREFERENCED_PARAMETER(pWlxContext); - UNREFERENCED_PARAMETER(pdwOptions); - UNREFERENCED_PARAMETER(pMessage); - UNREFERENCED_PARAMETER(dwBufferSize); + UNREFERENCED_PARAMETER(pWlxContext); + UNREFERENCED_PARAMETER(pdwOptions); + UNREFERENCED_PARAMETER(pMessage); + UNREFERENCED_PARAMETER(dwBufferSize);
- UNIMPLEMENTED; - return FALSE; + UNIMPLEMENTED; + return FALSE; }
@@ -106,14 +106,14 @@ */ BOOL WINAPI WlxNetworkProviderLoad( - PVOID pWlxContext, - PWLX_MPR_NOTIFY_INFO pNprNotifyInfo) + PVOID pWlxContext, + PWLX_MPR_NOTIFY_INFO pNprNotifyInfo) { - UNREFERENCED_PARAMETER(pWlxContext); - UNREFERENCED_PARAMETER(pNprNotifyInfo); + UNREFERENCED_PARAMETER(pWlxContext); + UNREFERENCED_PARAMETER(pNprNotifyInfo);
- UNIMPLEMENTED; - return FALSE; + UNIMPLEMENTED; + return FALSE; }
@@ -122,11 +122,11 @@ */ VOID WINAPI WlxDisconnectNotify( - PVOID pWlxContext) + PVOID pWlxContext) { - UNREFERENCED_PARAMETER(pWlxContext); + UNREFERENCED_PARAMETER(pWlxContext);
- UNIMPLEMENTED; + UNIMPLEMENTED; }
@@ -135,13 +135,13 @@ */ BOOL WINAPI WlxGetConsoleSwitchCredentials( - PVOID pWlxContext, - PVOID pCredInfo) + PVOID pWlxContext, + PVOID pCredInfo) { - UNREFERENCED_PARAMETER(pWlxContext); - UNREFERENCED_PARAMETER(pCredInfo); + UNREFERENCED_PARAMETER(pWlxContext); + UNREFERENCED_PARAMETER(pCredInfo);
- UNIMPLEMENTED; - return FALSE; + UNIMPLEMENTED; + return FALSE; }
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 [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/tui.c [iso-8859-1] Mon May 6 21:43:03 2013 @@ -11,255 +11,255 @@
static BOOL TUIInitialize( - IN OUT PGINA_CONTEXT pgContext) -{ - TRACE("TUIInitialize(%p)\n", pgContext); - - return AllocConsole(); + IN OUT PGINA_CONTEXT pgContext) +{ + TRACE("TUIInitialize(%p)\n", pgContext); + + return AllocConsole(); }
static BOOL TUIDisplayStatusMessage( - IN PGINA_CONTEXT pgContext, - IN HDESK hDesktop, - IN DWORD dwOptions, - IN PWSTR pTitle, - IN PWSTR pMessage) -{ - static LPCWSTR newLine = L"\n"; - DWORD result; - - TRACE("TUIDisplayStatusMessage(%ws)\n", pMessage); - - UNREFERENCED_PARAMETER(pgContext); - UNREFERENCED_PARAMETER(hDesktop); - UNREFERENCED_PARAMETER(dwOptions); - UNREFERENCED_PARAMETER(pTitle); - - return - WriteConsoleW( - GetStdHandle(STD_OUTPUT_HANDLE), - pMessage, - wcslen(pMessage), - &result, - NULL) && - WriteConsoleW( - GetStdHandle(STD_OUTPUT_HANDLE), - newLine, - wcslen(newLine), - &result, - NULL); + IN PGINA_CONTEXT pgContext, + IN HDESK hDesktop, + IN DWORD dwOptions, + IN PWSTR pTitle, + IN PWSTR pMessage) +{ + static LPCWSTR newLine = L"\n"; + DWORD result; + + TRACE("TUIDisplayStatusMessage(%ws)\n", pMessage); + + UNREFERENCED_PARAMETER(pgContext); + UNREFERENCED_PARAMETER(hDesktop); + UNREFERENCED_PARAMETER(dwOptions); + UNREFERENCED_PARAMETER(pTitle); + + return + WriteConsoleW( + GetStdHandle(STD_OUTPUT_HANDLE), + pMessage, + wcslen(pMessage), + &result, + NULL) && + WriteConsoleW( + GetStdHandle(STD_OUTPUT_HANDLE), + newLine, + wcslen(newLine), + &result, + NULL); }
static BOOL TUIRemoveStatusMessage( - IN PGINA_CONTEXT pgContext) -{ - UNREFERENCED_PARAMETER(pgContext); - - /* Nothing to do */ - return TRUE; + IN PGINA_CONTEXT pgContext) +{ + UNREFERENCED_PARAMETER(pgContext); + + /* Nothing to do */ + return TRUE; }
static BOOL DisplayResourceText( - IN UINT uIdResourceText, - IN BOOL AddNewLine) -{ - WCHAR Prompt[256]; - static LPCWSTR newLine = L"\n"; - DWORD count; - - if (0 == LoadStringW(hDllInstance, uIdResourceText, Prompt, 256)) - return FALSE; - if (!WriteConsoleW( - 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; + IN UINT uIdResourceText, + IN BOOL AddNewLine) +{ + WCHAR Prompt[256]; + static LPCWSTR newLine = L"\n"; + DWORD count; + + if (0 == LoadStringW(hDllInstance, uIdResourceText, Prompt, 256)) + return FALSE; + if (!WriteConsoleW( + 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) -{ - TRACE("TUIDisplaySASNotice()\n"); - - UNREFERENCED_PARAMETER(pgContext); - - DisplayResourceText(IDS_LOGGEDOUTSAS, TRUE); - DisplayResourceText(IDS_PRESSCTRLALTDELETE, TRUE); + IN OUT PGINA_CONTEXT pgContext) +{ + TRACE("TUIDisplaySASNotice()\n"); + + UNREFERENCED_PARAMETER(pgContext); + + DisplayResourceText(IDS_LOGGEDOUTSAS, TRUE); + DisplayResourceText(IDS_PRESSCTRLALTDELETE, TRUE); }
static INT TUILoggedOnSAS( - IN OUT PGINA_CONTEXT pgContext, - IN DWORD dwSasType) -{ - TRACE("TUILoggedOnSAS()\n"); - - UNREFERENCED_PARAMETER(pgContext); - - if (dwSasType != WLX_SAS_TYPE_CTRL_ALT_DEL) - { - /* Nothing to do for WLX_SAS_TYPE_TIMEOUT */ - return WLX_SAS_ACTION_NONE; - } - - FIXME("FIXME: TUILoggedOnSAS(): Let's suppose the user wants to log off...\n"); - return WLX_SAS_ACTION_LOGOFF; + IN OUT PGINA_CONTEXT pgContext, + IN DWORD dwSasType) +{ + TRACE("TUILoggedOnSAS()\n"); + + UNREFERENCED_PARAMETER(pgContext); + + if (dwSasType != WLX_SAS_TYPE_CTRL_ALT_DEL) + { + /* Nothing to do for WLX_SAS_TYPE_TIMEOUT */ + return WLX_SAS_ACTION_NONE; + } + + FIXME("FIXME: TUILoggedOnSAS(): Let's suppose the user wants to log off...\n"); + return WLX_SAS_ACTION_LOGOFF; }
static BOOL ReadString( - IN UINT uIdResourcePrompt, - IN OUT PWSTR Buffer, - IN DWORD BufferLength, - IN BOOL ShowString) -{ - DWORD count, i; - WCHAR charToDisplay[] = { 0, UNICODE_NULL }; - - if (!SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), 0)) - return FALSE; - - if (!FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE))) - return FALSE; - - if (!DisplayResourceText(uIdResourcePrompt, FALSE)) - return FALSE; - - i = 0; - for (;;) - { - WCHAR readChar; - if (!ReadConsoleW(GetStdHandle(STD_INPUT_HANDLE), &readChar, 1, &count, NULL)) - return FALSE; - if (readChar == '\r' || readChar == '\n') - { - /* End of string */ - charToDisplay[0] = L'\n'; - WriteConsoleW( - GetStdHandle(STD_OUTPUT_HANDLE), - charToDisplay, - wcslen(charToDisplay), - &count, - NULL); - break; - } - if (ShowString) - { - /* Display the char */ - charToDisplay[0] = readChar; - WriteConsoleW( - GetStdHandle(STD_OUTPUT_HANDLE), - charToDisplay, - wcslen(charToDisplay), - &count, - NULL); - } - Buffer[i++] = readChar; - /* FIXME: buffer overflow if the user writes too many chars! */ - UNREFERENCED_PARAMETER(BufferLength); - /* FIXME: handle backspace */ - } - Buffer[i] = UNICODE_NULL; - - if (!ShowString) - { - /* Still display the \n */ - static LPCWSTR newLine = L"\n"; - DWORD result; - WriteConsoleW( - GetStdHandle(STD_OUTPUT_HANDLE), - newLine, - wcslen(newLine), - &result, - NULL); - } - return TRUE; + IN UINT uIdResourcePrompt, + IN OUT PWSTR Buffer, + IN DWORD BufferLength, + IN BOOL ShowString) +{ + DWORD count, i; + WCHAR charToDisplay[] = { 0, UNICODE_NULL }; + + if (!SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), 0)) + return FALSE; + + if (!FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE))) + return FALSE; + + if (!DisplayResourceText(uIdResourcePrompt, FALSE)) + return FALSE; + + i = 0; + for (;;) + { + WCHAR readChar; + if (!ReadConsoleW(GetStdHandle(STD_INPUT_HANDLE), &readChar, 1, &count, NULL)) + return FALSE; + if (readChar == '\r' || readChar == '\n') + { + /* End of string */ + charToDisplay[0] = L'\n'; + WriteConsoleW( + GetStdHandle(STD_OUTPUT_HANDLE), + charToDisplay, + wcslen(charToDisplay), + &count, + NULL); + break; + } + if (ShowString) + { + /* Display the char */ + charToDisplay[0] = readChar; + WriteConsoleW( + GetStdHandle(STD_OUTPUT_HANDLE), + charToDisplay, + wcslen(charToDisplay), + &count, + NULL); + } + Buffer[i++] = readChar; + /* FIXME: buffer overflow if the user writes too many chars! */ + UNREFERENCED_PARAMETER(BufferLength); + /* FIXME: handle backspace */ + } + Buffer[i] = UNICODE_NULL; + + if (!ShowString) + { + /* Still display the \n */ + static LPCWSTR newLine = L"\n"; + DWORD result; + WriteConsoleW( + GetStdHandle(STD_OUTPUT_HANDLE), + newLine, + wcslen(newLine), + &result, + NULL); + } + return TRUE; }
static INT TUILoggedOutSAS( - IN OUT PGINA_CONTEXT pgContext) -{ - WCHAR UserName[256]; - WCHAR Password[256]; - - TRACE("TUILoggedOutSAS()\n"); - - /* Ask the user for credentials */ - if (!ReadString(IDS_ASKFORUSER, UserName, 256, TRUE)) - return WLX_SAS_ACTION_NONE; - if (!ReadString(IDS_ASKFORPASSWORD, Password, 256, FALSE)) - return WLX_SAS_ACTION_NONE; - - if (DoLoginTasks(pgContext, UserName, NULL, Password)) - return WLX_SAS_ACTION_LOGON; - else - return WLX_SAS_ACTION_NONE; + IN OUT PGINA_CONTEXT pgContext) +{ + WCHAR UserName[256]; + WCHAR Password[256]; + + TRACE("TUILoggedOutSAS()\n"); + + /* Ask the user for credentials */ + if (!ReadString(IDS_ASKFORUSER, UserName, 256, TRUE)) + return WLX_SAS_ACTION_NONE; + if (!ReadString(IDS_ASKFORPASSWORD, Password, 256, FALSE)) + return WLX_SAS_ACTION_NONE; + + if (DoLoginTasks(pgContext, UserName, NULL, Password)) + return WLX_SAS_ACTION_LOGON; + else + return WLX_SAS_ACTION_NONE; }
static INT TUILockedSAS( - IN OUT PGINA_CONTEXT pgContext) -{ - HANDLE hToken; - WCHAR UserName[256]; - WCHAR Password[256]; - - TRACE("TUILockedSAS()\n"); - - UNREFERENCED_PARAMETER(pgContext); - - if (!DisplayResourceText(IDS_LOGGEDOUTSAS, TRUE)) - return WLX_SAS_ACTION_UNLOCK_WKSTA; - - /* Ask the user for credentials */ - if (!ReadString(IDS_ASKFORUSER, UserName, 256, TRUE)) - return WLX_SAS_ACTION_NONE; - if (!ReadString(IDS_ASKFORPASSWORD, Password, 256, FALSE)) - return WLX_SAS_ACTION_NONE; - - if (!LogonUserW(UserName, NULL, Password, - LOGON32_LOGON_UNLOCK, - LOGON32_PROVIDER_DEFAULT, - &hToken)) - { - TRACE("LogonUserW() failed\n"); - return WLX_SAS_ACTION_NONE; - } - CloseHandle(hToken); - return WLX_SAS_ACTION_UNLOCK_WKSTA; + IN OUT PGINA_CONTEXT pgContext) +{ + HANDLE hToken; + WCHAR UserName[256]; + WCHAR Password[256]; + + TRACE("TUILockedSAS()\n"); + + UNREFERENCED_PARAMETER(pgContext); + + if (!DisplayResourceText(IDS_LOGGEDOUTSAS, TRUE)) + return WLX_SAS_ACTION_UNLOCK_WKSTA; + + /* Ask the user for credentials */ + if (!ReadString(IDS_ASKFORUSER, UserName, 256, TRUE)) + return WLX_SAS_ACTION_NONE; + if (!ReadString(IDS_ASKFORPASSWORD, Password, 256, FALSE)) + return WLX_SAS_ACTION_NONE; + + if (!LogonUserW(UserName, NULL, Password, + LOGON32_LOGON_UNLOCK, + LOGON32_PROVIDER_DEFAULT, + &hToken)) + { + TRACE("LogonUserW() failed\n"); + return WLX_SAS_ACTION_NONE; + } + CloseHandle(hToken); + return WLX_SAS_ACTION_UNLOCK_WKSTA; }
static VOID TUIDisplayLockedNotice( - IN OUT PGINA_CONTEXT pgContext) + IN OUT PGINA_CONTEXT pgContext) { }
GINA_UI GinaTextUI = { - TUIInitialize, - TUIDisplayStatusMessage, - TUIRemoveStatusMessage, - TUIDisplaySASNotice, - TUILoggedOnSAS, - TUILoggedOutSAS, - TUILockedSAS, - TUIDisplayLockedNotice, + TUIInitialize, + TUIDisplayStatusMessage, + TUIRemoveStatusMessage, + TUIDisplaySASNotice, + TUILoggedOnSAS, + TUILoggedOutSAS, + TUILockedSAS, + TUIDisplayLockedNotice, };