[ros-diffs] 01/01: [MSGINA] Clear the password on logoff

2018-05-22 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=39281f0f7061f425c13209b382830837d31dadfc

commit 39281f0f7061f425c13209b382830837d31dadfc
Author: Eric Kohl 
AuthorDate: Wed May 23 00:27:11 2018 +0200
Commit: Eric Kohl 
CommitDate: Wed May 23 00:27:11 2018 +0200

[MSGINA] Clear the password on logoff
---
 dll/win32/msgina/msgina.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/dll/win32/msgina/msgina.c b/dll/win32/msgina/msgina.c
index e22413c613..08cd148fa5 100644
--- a/dll/win32/msgina/msgina.c
+++ b/dll/win32/msgina/msgina.c
@@ -1024,6 +1024,9 @@ WlxLogoff(
 
 TRACE("WlxLogoff(%p)\n", pWlxContext);
 
+/* Delete the password */
+ZeroMemory(pgContext->Password, sizeof(pgContext->Password));
+
 /* Close the user token */
 CloseHandle(pgContext->UserToken);
 pgContext->UserToken = NULL;



[ros-diffs] 01/01: [MSGIINA] Make sure we do not leak bitmaps

2018-05-22 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=88285670868e84b1459342f735ff7772e7d1bd4f

commit 88285670868e84b1459342f735ff7772e7d1bd4f
Author: Eric Kohl 
AuthorDate: Wed May 23 00:24:01 2018 +0200
Commit: Eric Kohl 
CommitDate: Wed May 23 00:24:53 2018 +0200

[MSGIINA] Make sure we do not leak bitmaps
---
 dll/win32/msgina/gui.c  | 143 +++-
 dll/win32/msgina/msgina.h   |   3 -
 dll/win32/msgina/shutdown.c |   9 +--
 3 files changed, 92 insertions(+), 63 deletions(-)

diff --git a/dll/win32/msgina/gui.c b/dll/win32/msgina/gui.c
index 906998743d..83547425db 100644
--- a/dll/win32/msgina/gui.c
+++ b/dll/win32/msgina/gui.c
@@ -27,6 +27,11 @@ typedef struct _LEGALNOTICEDATA
 LPWSTR pszText;
 } LEGALNOTICEDATA, *PLEGALNOTICEDATA;
 
+typedef struct _DLG_DATA
+{
+PGINA_CONTEXT pgContext;
+HBITMAP hBitmap;
+} DLG_DATA, *PDLG_DATA;
 
 static BOOL
 GUIInitialize(
@@ -193,41 +198,48 @@ GUIRemoveStatusMessage(
 }
 
 static INT_PTR CALLBACK
-EmptyWindowProc(
+NoticeWindowProc(
 IN HWND hwndDlg,
 IN UINT uMsg,
 IN WPARAM wParam,
 IN LPARAM lParam)
 {
-PGINA_CONTEXT pgContext;
-
-pgContext = (PGINA_CONTEXT)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
+PDLG_DATA pDlgData;
+
+pDlgData = (PDLG_DATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
 
 switch (uMsg)
 {
 case WM_INITDIALOG:
 {
-pgContext = (PGINA_CONTEXT)lParam;
-SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pgContext);
+pDlgData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 
sizeof(DLG_DATA));
+if (pDlgData == NULL)
+return FALSE;
 
-/* Draw the logo bitmap */
-pgContext->hBitmap = LoadImageW(pgContext->hDllInstance, 
MAKEINTRESOURCEW(IDI_ROSLOGO), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
+SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pDlgData);
+
+pDlgData->pgContext = (PGINA_CONTEXT)lParam;
+
+/* Load the logo bitmap */
+pDlgData->hBitmap = LoadImageW(pDlgData->pgContext->hDllInstance, 
MAKEINTRESOURCEW(IDI_ROSLOGO), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
 return TRUE;
 }
+
 case WM_PAINT:
 {
 PAINTSTRUCT ps;
-if (pgContext->hBitmap)
+if (pDlgData->hBitmap)
 {
 BeginPaint(hwndDlg, );
-DrawStateW(ps.hdc, NULL, NULL, (LPARAM)pgContext->hBitmap, 
(WPARAM)0, 0, 0, 0, 0, DST_BITMAP);
+DrawStateW(ps.hdc, NULL, NULL, (LPARAM)pDlgData->hBitmap, 
(WPARAM)0, 0, 0, 0, 0, DST_BITMAP);
 EndPaint(hwndDlg, );
 }
 return TRUE;
 }
 case WM_DESTROY:
 {
-DeleteObject(pgContext->hBitmap);
+DeleteObject(pDlgData->hBitmap);
+HeapFree(GetProcessHeap(), 0, pDlgData);
 return TRUE;
 }
 }
@@ -245,7 +257,7 @@ GUIDisplaySASNotice(
 pgContext->hDllInstance,
 MAKEINTRESOURCEW(IDD_NOTICE_DLG),
 GetDesktopWindow(),
-EmptyWindowProc,
+NoticeWindowProc,
 (LPARAM)pgContext);
 }
 
@@ -943,39 +955,44 @@ LoggedOutWindowProc(
 IN WPARAM wParam,
 IN LPARAM lParam)
 {
-PGINA_CONTEXT pgContext;
+PDLG_DATA pDlgData;
 
-pgContext = (PGINA_CONTEXT)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
+pDlgData = (PDLG_DATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
 
 switch (uMsg)
 {
 case WM_INITDIALOG:
 {
+pDlgData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 
sizeof(DLG_DATA));
+if (pDlgData == NULL)
+return FALSE;
+
+SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pDlgData);
+
 /* FIXME: take care of NoDomainUI */
-pgContext = (PGINA_CONTEXT)lParam;
-SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pgContext);
+pDlgData->pgContext = (PGINA_CONTEXT)lParam;
 
-if (pgContext->bAutoAdminLogon ||
-!pgContext->bDontDisplayLastUserName)
-SetDlgItemTextW(hwndDlg, IDC_USERNAME, pgContext->UserName);
+if (pDlgData->pgContext->bAutoAdminLogon ||
+!pDlgData->pgContext->bDontDisplayLastUserName)
+SetDlgItemTextW(hwndDlg, IDC_USERNAME, 
pDlgData->pgContext->UserName);
 
-if (pgContext->bAutoAdminLogon)
-SetDlgItemTextW(hwndDlg, IDC_PASSWORD, pgContext->Password);
+if (pDlgData->pgContext->bAutoAdminLogon)
+SetDlgItemTextW(hwndDlg, IDC_PASSWORD, 
pDlgData->pgContext->Password);
 
-

[ros-diffs] 01/01: [FASTFAT] Properly handle IRPs that can wait and these that cannot.

2018-05-22 Thread Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b4363068d10d05e39581874a5aa10fe0183b4948

commit b4363068d10d05e39581874a5aa10fe0183b4948
Author: Pierre Schweitzer 
AuthorDate: Tue May 22 21:29:10 2018 +0200
Commit: Pierre Schweitzer 
CommitDate: Tue May 22 21:30:08 2018 +0200

[FASTFAT] Properly handle IRPs that can wait and these that cannot.

CORE-14634
---
 drivers/filesystems/fastfat/cleanup.c | 26 +++---
 drivers/filesystems/fastfat/create.c  |  5 -
 drivers/filesystems/fastfat/misc.c| 35 ---
 3 files changed, 31 insertions(+), 35 deletions(-)

diff --git a/drivers/filesystems/fastfat/cleanup.c 
b/drivers/filesystems/fastfat/cleanup.c
index f611a69def..d19fa94703 100644
--- a/drivers/filesystems/fastfat/cleanup.c
+++ b/drivers/filesystems/fastfat/cleanup.c
@@ -50,17 +50,8 @@ VfatCleanupFile(
 }
 else
 {
-if(!ExAcquireResourceExclusiveLite(>MainResource,
-   BooleanFlagOn(IrpContext->Flags, 
IRPCONTEXT_CANWAIT)))
-{
-return STATUS_PENDING;
-}
-if(!ExAcquireResourceExclusiveLite(>PagingIoResource,
-   BooleanFlagOn(IrpContext->Flags, 
IRPCONTEXT_CANWAIT)))
-{
-ExReleaseResourceLite(>MainResource);
-return STATUS_PENDING;
-}
+ExAcquireResourceExclusiveLite(>MainResource, TRUE);
+ExAcquireResourceExclusiveLite(>PagingIoResource, TRUE);
 
 pCcb = FileObject->FsContext2;
 if (BooleanFlagOn(pCcb->Flags, CCB_DELETE_ON_CLOSE))
@@ -173,21 +164,10 @@ VfatCleanup(
 return STATUS_SUCCESS;
 }
 
-if (!ExAcquireResourceExclusiveLite(>DeviceExt->DirResource,
-BooleanFlagOn(IrpContext->Flags, 
IRPCONTEXT_CANWAIT)))
-{
-return VfatMarkIrpContextForQueue(IrpContext);
-}
-
+ExAcquireResourceExclusiveLite(>DeviceExt->DirResource, TRUE);
 Status = VfatCleanupFile(IrpContext);
-
 ExReleaseResourceLite(>DeviceExt->DirResource);
 
-if (Status == STATUS_PENDING)
-{
-return VfatMarkIrpContextForQueue(IrpContext);
-}
-
 IrpContext->Irp->IoStatus.Information = 0;
 return Status;
 }
diff --git a/drivers/filesystems/fastfat/create.c 
b/drivers/filesystems/fastfat/create.c
index 84751c2595..e2fbccaf9c 100644
--- a/drivers/filesystems/fastfat/create.c
+++ b/drivers/filesystems/fastfat/create.c
@@ -1059,11 +1059,6 @@ VfatCreate(
 return STATUS_SUCCESS;
 }
 
-if (!BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_CANWAIT))
-{
-return VfatMarkIrpContextForQueue(IrpContext);
-}
-
 IrpContext->Irp->IoStatus.Information = 0;
 ExAcquireResourceExclusiveLite(>DeviceExt->DirResource, TRUE);
 Status = VfatCreateFile(IrpContext->DeviceObject, IrpContext->Irp);
diff --git a/drivers/filesystems/fastfat/misc.c 
b/drivers/filesystems/fastfat/misc.c
index 0d291776b5..ad5f4bcec3 100644
--- a/drivers/filesystems/fastfat/misc.c
+++ b/drivers/filesystems/fastfat/misc.c
@@ -287,18 +287,39 @@ VfatAllocateIrpContext(
 IrpContext->MinorFunction = IrpContext->Stack->MinorFunction;
 IrpContext->FileObject = IrpContext->Stack->FileObject;
 IrpContext->Flags = IRPCONTEXT_COMPLETE;
-if (MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL ||
-MajorFunction == IRP_MJ_DEVICE_CONTROL ||
-MajorFunction == IRP_MJ_SHUTDOWN)
+
+/* Easy cases that can wait */
+if (MajorFunction == IRP_MJ_CLEANUP ||
+MajorFunction == IRP_MJ_CREATE ||
+MajorFunction == IRP_MJ_SHUTDOWN ||
+MajorFunction == IRP_MJ_CLOSE /* likely to be fixed */)
 {
-IrpContext->Flags |= IRPCONTEXT_CANWAIT;
+SetFlag(IrpContext->Flags, IRPCONTEXT_CANWAIT);
 }
-else if (MajorFunction != IRP_MJ_CLEANUP &&
- MajorFunction != IRP_MJ_CLOSE &&
+/* Cases that can wait if synchronous IRP */
+else if ((MajorFunction == IRP_MJ_DEVICE_CONTROL ||
+  MajorFunction == IRP_MJ_QUERY_INFORMATION ||
+  MajorFunction == IRP_MJ_SET_INFORMATION ||
+  MajorFunction == IRP_MJ_FLUSH_BUFFERS ||
+  MajorFunction == IRP_MJ_LOCK_CONTROL ||
+  MajorFunction == IRP_MJ_QUERY_VOLUME_INFORMATION ||
+  MajorFunction == IRP_MJ_SET_VOLUME_INFORMATION ||
+  MajorFunction == IRP_MJ_DIRECTORY_CONTROL ||
+  MajorFunction == IRP_MJ_WRITE ||
+  MajorFunction == IRP_MJ_READ) &&
  IoIsOperationSynchronous(Irp))
 {
-IrpContext->Flags |= IRPCONTEXT_CANWAIT;
+SetFlag(IrpContext->Flags, IRPCONTEXT_CANWAIT);
+}
+/* Cases that can wait if synchronous or if no FO */
+else if ((MajorFunction == 

[ros-diffs] 01/01: [MSGINA] Always stop the automatic login after the first try

2018-05-22 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8c5cf73018ca93a256c391c5e8400cb8dd319ee4

commit 8c5cf73018ca93a256c391c5e8400cb8dd319ee4
Author: Eric Kohl 
AuthorDate: Tue May 22 21:19:58 2018 +0200
Commit: Eric Kohl 
CommitDate: Tue May 22 21:19:58 2018 +0200

[MSGINA] Always stop the automatic login after the first try

Fixes CORE-14643
---
 dll/win32/msgina/gui.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dll/win32/msgina/gui.c b/dll/win32/msgina/gui.c
index 1e1069eb27..906998743d 100644
--- a/dll/win32/msgina/gui.c
+++ b/dll/win32/msgina/gui.c
@@ -400,7 +400,7 @@ DoChangePassword(
   RequestBuffer->NewPassword.MaximumLength);
 
 /* Connect to the LSA server */
-if (!ConnectToLsa(pgContext))
+if (ConnectToLsa(pgContext) != ERROR_SUCCESS)
 {
 ERR("ConnectToLsa() failed\n");
 goto done;
@@ -882,11 +882,11 @@ DoLogon(
 ZeroMemory(pgContext->Password, sizeof(pgContext->Password));
 wcscpy(pgContext->Password, Password);
 
-pgContext->bAutoAdminLogon = FALSE;
-
 result = TRUE;
 
 done:
+pgContext->bAutoAdminLogon = FALSE;
+
 if (UserName != NULL)
 HeapFree(GetProcessHeap(), 0, UserName);
 



[ros-diffs] 01/01: [WINLOGON] Ignore the CTRL+SHIFT+ESC hotkey when the session is not in the logged-on state

2018-05-22 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=46dcab7ab1aa8c30892f27af390964758ce08df2

commit 46dcab7ab1aa8c30892f27af390964758ce08df2
Author: Eric Kohl 
AuthorDate: Tue May 22 18:14:42 2018 +0200
Commit: Eric Kohl 
CommitDate: Tue May 22 18:14:42 2018 +0200

[WINLOGON] Ignore the CTRL+SHIFT+ESC hotkey when the session is not in the 
logged-on state

Should fix CORE-13478
---
 base/system/winlogon/sas.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/base/system/winlogon/sas.c b/base/system/winlogon/sas.c
index fe558c452c..1a57a4ad6e 100644
--- a/base/system/winlogon/sas.c
+++ b/base/system/winlogon/sas.c
@@ -1328,7 +1328,8 @@ SASWindowProc(
 case MAKELONG(MOD_CONTROL | MOD_SHIFT, VK_ESCAPE):
 {
 TRACE("SAS: CONTROL+SHIFT+ESCAPE\n");
-DoGenericAction(Session, WLX_SAS_ACTION_TASKLIST);
+if (Session->LogonState == STATE_LOGGED_ON)
+DoGenericAction(Session, WLX_SAS_ACTION_TASKLIST);
 return TRUE;
 }
 }



[ros-diffs] 01/01: [MSGINA] Do not try to impersonate the user on shutdown when we are already logged off

2018-05-22 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=47567abf279faefd48ad1bec8dc48ffc06eaab61

commit 47567abf279faefd48ad1bec8dc48ffc06eaab61
Author: Eric Kohl 
AuthorDate: Tue May 22 17:35:33 2018 +0200
Commit: Eric Kohl 
CommitDate: Tue May 22 17:35:33 2018 +0200

[MSGINA] Do not try to impersonate the user on shutdown when we are already 
logged off
---
 dll/win32/msgina/gui.c  | 39 ---
 dll/win32/msgina/msgina.h   |  6 ++
 dll/win32/msgina/shutdown.c | 18 ++
 3 files changed, 48 insertions(+), 15 deletions(-)

diff --git a/dll/win32/msgina/gui.c b/dll/win32/msgina/gui.c
index c520f07b31..1e1069eb27 100644
--- a/dll/win32/msgina/gui.c
+++ b/dll/win32/msgina/gui.c
@@ -624,26 +624,17 @@ OnShutDown(
 INT ret;
 DWORD ShutdownOptions;
 
-if (ImpersonateLoggedOnUser(pgContext->UserToken))
-{
-pgContext->nShutdownAction = LoadShutdownSelState();
-ShutdownOptions = GetAllowedShutdownOptions();
-RevertToSelf();
-}
-else
-{
-ERR("WL: ImpersonateLoggedOnUser() failed with error %lu\n", 
GetLastError());
-pgContext->nShutdownAction = 0;
-ShutdownOptions = 0;
-}
+TRACE("OnShutDown(%p %p)\n", hwndDlg, pgContext);
 
-ret = ShutdownDialog(hwndDlg, ShutdownOptions, pgContext);
+pgContext->nShutdownAction = GetDefaultShutdownSelState();
+ShutdownOptions = GetDefaultShutdownOptions();
 
-if (ret == IDOK)
+if (pgContext->UserToken != NULL)
 {
 if (ImpersonateLoggedOnUser(pgContext->UserToken))
 {
-SaveShutdownSelState(pgContext->nShutdownAction);
+pgContext->nShutdownAction = LoadShutdownSelState();
+ShutdownOptions = GetAllowedShutdownOptions();
 RevertToSelf();
 }
 else
@@ -652,6 +643,24 @@ OnShutDown(
 }
 }
 
+ret = ShutdownDialog(hwndDlg, ShutdownOptions, pgContext);
+
+if (ret == IDOK)
+{
+if (pgContext->UserToken != NULL)
+{
+if (ImpersonateLoggedOnUser(pgContext->UserToken))
+{
+SaveShutdownSelState(pgContext->nShutdownAction);
+RevertToSelf();
+}
+else
+{
+ERR("WL: ImpersonateLoggedOnUser() failed with error %lu\n", 
GetLastError());
+}
+}
+}
+
 return ret;
 }
 
diff --git a/dll/win32/msgina/msgina.h b/dll/win32/msgina/msgina.h
index 19eabf9eb3..e2b6b5bfb4 100644
--- a/dll/win32/msgina/msgina.h
+++ b/dll/win32/msgina/msgina.h
@@ -132,12 +132,18 @@ CreateProfile(
 
 /* shutdown.c */
 
+DWORD
+GetDefaultShutdownSelState(VOID);
+
 DWORD
 LoadShutdownSelState(VOID);
 
 VOID
 SaveShutdownSelState(DWORD ShutdownCode);
 
+DWORD
+GetDefaultShutdownOptions(VOID);
+
 DWORD
 GetAllowedShutdownOptions(VOID);
 
diff --git a/dll/win32/msgina/shutdown.c b/dll/win32/msgina/shutdown.c
index ca2528a7bb..1351eabc14 100644
--- a/dll/win32/msgina/shutdown.c
+++ b/dll/win32/msgina/shutdown.c
@@ -90,6 +90,11 @@ GetShutdownReasonUI(VOID)
 //return (VersionInfo.wProductType == VER_NT_WORKSTATION) ? FALSE : TRUE;
 }
 
+DWORD
+GetDefaultShutdownSelState(VOID)
+{
+return WLX_SAS_ACTION_SHUTDOWN_POWER_OFF;
+}
 
 DWORD
 LoadShutdownSelState(VOID)
@@ -211,6 +216,12 @@ SaveShutdownSelState(
 RegCloseKey(hKey);
 }
 
+DWORD
+GetDefaultShutdownOptions(VOID)
+{
+return WLX_SHUTDOWN_STATE_POWER_OFF | WLX_SHUTDOWN_STATE_REBOOT;
+}
+
 DWORD
 GetAllowedShutdownOptions(VOID)
 {
@@ -271,6 +282,13 @@ UpdateShutdownDesc(
 
 LoadStringW(pContext->pgContext->hDllInstance, DescId, szBuffer, 
_countof(szBuffer));
 SetDlgItemTextW(hDlg, IDC_SHUTDOWN_DESCRIPTION, szBuffer);
+
+if (pContext->bReasonUI)
+{
+EnableWindow(GetDlgItem(hDlg, IDC_REASON_PLANNED), (ShutdownCode != 
WLX_SAS_ACTION_LOGOFF));
+EnableWindow(GetDlgItem(hDlg, IDC_REASON_LIST), (ShutdownCode != 
WLX_SAS_ACTION_LOGOFF));
+EnableWindow(GetDlgItem(hDlg, IDC_REASON_COMMENT), (ShutdownCode != 
WLX_SAS_ACTION_LOGOFF));
+}
 }
 
 static VOID



[ros-diffs] 01/01: [MSGINA] Close the LSA handle on shutdown

2018-05-22 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4c4c6e88b3192a2e045a863cfd9964a4b142faec

commit 4c4c6e88b3192a2e045a863cfd9964a4b142faec
Author: Eric Kohl 
AuthorDate: Tue May 22 17:31:20 2018 +0200
Commit: Eric Kohl 
CommitDate: Tue May 22 17:31:20 2018 +0200

[MSGINA] Close the LSA handle on shutdown
---
 dll/win32/msgina/msgina.c | 23 +++
 dll/win32/msgina/stubs.c  | 15 ---
 2 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/dll/win32/msgina/msgina.c b/dll/win32/msgina/msgina.c
index c01c75451b..e22413c613 100644
--- a/dll/win32/msgina/msgina.c
+++ b/dll/win32/msgina/msgina.c
@@ -1030,6 +1030,29 @@ WlxLogoff(
 }
 
 
+/*
+ * @implemented
+ */
+VOID WINAPI
+WlxShutdown(
+PVOID pWlxContext,
+DWORD ShutdownType)
+{
+PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
+NTSTATUS Status;
+
+TRACE("WlxShutdown(%p %lx)\n", pWlxContext, ShutdownType);
+
+/* Close the LSA handle */
+pgContext->AuthenticationPackage = 0;
+Status = LsaDeregisterLogonProcess(pgContext->LsaHandle);
+if (!NT_SUCCESS(Status))
+{
+ERR("LsaDeregisterLogonProcess failed (Status 0x%08lx)\n", Status);
+}
+}
+
+
 BOOL WINAPI
 DllMain(
 IN HINSTANCE hinstDLL,
diff --git a/dll/win32/msgina/stubs.c b/dll/win32/msgina/stubs.c
index 9b7c0afe16..f5e20c4183 100644
--- a/dll/win32/msgina/stubs.c
+++ b/dll/win32/msgina/stubs.c
@@ -25,21 +25,6 @@ WlxIsLockOk(
 }
 
 
-/*
- * @unimplemented
- */
-VOID WINAPI
-WlxShutdown(
-PVOID pWlxContext,
-DWORD ShutdownType)
-{
-UNREFERENCED_PARAMETER(pWlxContext);
-UNREFERENCED_PARAMETER(ShutdownType);
-
-UNIMPLEMENTED;
-}
-
-
 /*
  * @unimplemented
  */



[ros-diffs] 01/01: [MSGINA] Close the user token in WlxLogoff

2018-05-22 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bab4d87ac824b5317d1a520da63643103a620c85

commit bab4d87ac824b5317d1a520da63643103a620c85
Author: Eric Kohl 
AuthorDate: Tue May 22 16:32:10 2018 +0200
Commit: Eric Kohl 
CommitDate: Tue May 22 16:32:10 2018 +0200

[MSGINA] Close the user token in WlxLogoff
---
 dll/win32/msgina/msgina.c | 18 ++
 dll/win32/msgina/stubs.c  | 13 -
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/dll/win32/msgina/msgina.c b/dll/win32/msgina/msgina.c
index 8f6c3a905a..c01c75451b 100644
--- a/dll/win32/msgina/msgina.c
+++ b/dll/win32/msgina/msgina.c
@@ -1012,6 +1012,24 @@ WlxIsLogoffOk(
 return TRUE;
 }
 
+
+/*
+ * @implemented
+ */
+VOID WINAPI
+WlxLogoff(
+PVOID pWlxContext)
+{
+PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
+
+TRACE("WlxLogoff(%p)\n", pWlxContext);
+
+/* Close the user token */
+CloseHandle(pgContext->UserToken);
+pgContext->UserToken = NULL;
+}
+
+
 BOOL WINAPI
 DllMain(
 IN HINSTANCE hinstDLL,
diff --git a/dll/win32/msgina/stubs.c b/dll/win32/msgina/stubs.c
index 69921cff92..9b7c0afe16 100644
--- a/dll/win32/msgina/stubs.c
+++ b/dll/win32/msgina/stubs.c
@@ -25,19 +25,6 @@ WlxIsLockOk(
 }
 
 
-/*
- * @unimplemented
- */
-VOID WINAPI
-WlxLogoff(
-PVOID pWlxContext)
-{
-UNREFERENCED_PARAMETER(pWlxContext);
-
-UNIMPLEMENTED;
-}
-
-
 /*
  * @unimplemented
  */



[ros-diffs] 01/02: [WINLOGON] Prevent shell restart when the user is logged off

2018-05-22 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1f0fe38634419df2748e88cb8aead8d5549764d0

commit 1f0fe38634419df2748e88cb8aead8d5549764d0
Author: Eric Kohl 
AuthorDate: Tue May 22 14:36:55 2018 +0200
Commit: Eric Kohl 
CommitDate: Tue May 22 14:36:55 2018 +0200

[WINLOGON] Prevent shell restart when the user is logged off
---
 base/system/winlogon/sas.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/base/system/winlogon/sas.c b/base/system/winlogon/sas.c
index e9861de796..fe558c452c 100644
--- a/base/system/winlogon/sas.c
+++ b/base/system/winlogon/sas.c
@@ -1372,7 +1372,9 @@ SASWindowProc(
 case LN_SHELL_EXITED:
 {
 /* lParam is the exit code */
-if(lParam != 1)
+if (lParam != 1 &&
+Session->LogonState != STATE_LOGGED_OFF &&
+Session->LogonState != STATE_LOGGED_OFF_SAS)
 {
 SetTimer(hwndDlg, 1, 1000, NULL);
 }



[ros-diffs] 02/02: [MSGINA] Rename context variable: Domain -> DomainName

2018-05-22 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c98b8dc98ca7ed78a6c1be860d0b73326461620a

commit c98b8dc98ca7ed78a6c1be860d0b73326461620a
Author: Eric Kohl 
AuthorDate: Tue May 22 14:39:38 2018 +0200
Commit: Eric Kohl 
CommitDate: Tue May 22 14:39:38 2018 +0200

[MSGINA] Rename context variable: Domain -> DomainName
---
 dll/win32/msgina/gui.c| 18 +-
 dll/win32/msgina/msgina.c | 14 +++---
 dll/win32/msgina/msgina.h |  2 +-
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/dll/win32/msgina/gui.c b/dll/win32/msgina/gui.c
index 46110df992..c520f07b31 100644
--- a/dll/win32/msgina/gui.c
+++ b/dll/win32/msgina/gui.c
@@ -435,7 +435,7 @@ DoChangePassword(
IDS_PASSWORDCHANGED);
 
 if ((wcscmp(UserName, pgContext->UserName) == 0) &&
-(wcscmp(Domain, pgContext->Domain) == 0) &&
+(wcscmp(Domain, pgContext->DomainName) == 0) &&
 (wcscmp(OldPassword, pgContext->Password) == 0))
 {
 ZeroMemory(pgContext->Password, sizeof(pgContext->Password));
@@ -472,7 +472,7 @@ ChangePasswordDialogProc(
 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pgContext);
 
 SetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_USERNAME, 
pgContext->UserName);
-SendDlgItemMessageW(hwndDlg, IDC_CHANGEPWD_DOMAIN, CB_ADDSTRING, 
0, (LPARAM)pgContext->Domain);
+SendDlgItemMessageW(hwndDlg, IDC_CHANGEPWD_DOMAIN, CB_ADDSTRING, 
0, (LPARAM)pgContext->DomainName);
 SendDlgItemMessageW(hwndDlg, IDC_CHANGEPWD_DOMAIN, CB_SETCURSEL, 
0, 0);
 SetFocus(GetDlgItem(hwndDlg, IDC_CHANGEPWD_OLDPWD));
 return TRUE;
@@ -520,7 +520,7 @@ OnInitSecurityDlg(HWND hwnd,
 
 LoadStringW(pgContext->hDllInstance, IDS_LOGONMSG, Buffer1, 
_countof(Buffer1));
 
-wsprintfW(Buffer2, L"%s\\%s", pgContext->Domain, pgContext->UserName);
+wsprintfW(Buffer2, L"%s\\%s", pgContext->DomainName, pgContext->UserName);
 wsprintfW(Buffer4, Buffer1, Buffer2);
 
 SetDlgItemTextW(hwnd, IDC_LOGONMSG, Buffer4);
@@ -836,7 +836,7 @@ DoLogon(
 
 Status = DoLoginTasks(pgContext,
   pgContext->UserName,
-  pgContext->Domain,
+  pgContext->DomainName,
   pgContext->Password,
   );
 if (!NT_SUCCESS(Status))
@@ -910,12 +910,12 @@ SetDomainComboBox(
 lIndex = SendMessageW(hwndDomainComboBox, CB_ADDSTRING, 0, 
(LPARAM)szComputerName);
 }
 
-if (wcslen(pgContext->Domain) != 0)
+if (wcslen(pgContext->DomainName) != 0)
 {
-lFindIndex = SendMessageW(hwndDomainComboBox, CB_FINDSTRINGEXACT, 
(WPARAM)-1, (LPARAM)pgContext->Domain);
+lFindIndex = SendMessageW(hwndDomainComboBox, CB_FINDSTRINGEXACT, 
(WPARAM)-1, (LPARAM)pgContext->DomainName);
 if (lFindIndex == CB_ERR)
 {
-lIndex = SendMessageW(hwndDomainComboBox, CB_ADDSTRING, 0, 
(LPARAM)pgContext->Domain);
+lIndex = SendMessageW(hwndDomainComboBox, CB_ADDSTRING, 0, 
(LPARAM)pgContext->DomainName);
 }
 else
 {
@@ -1125,7 +1125,7 @@ SetLockMessage(HWND hwnd,
 
 LoadStringW(pgContext->hDllInstance, IDS_LOCKMSG, Buffer1, 
_countof(Buffer1));
 
-wsprintfW(Buffer2, L"%s\\%s", pgContext->Domain, pgContext->UserName);
+wsprintfW(Buffer2, L"%s\\%s", pgContext->DomainName, pgContext->UserName);
 wsprintfW(Buffer3, Buffer1, Buffer2);
 
 SetDlgItemTextW(hwnd, nDlgItem, Buffer3);
@@ -1179,7 +1179,7 @@ DoUnlock(
 else
 {
 LoadStringW(pgContext->hDllInstance, IDS_LOCKEDWRONGUSER, 
Buffer1, _countof(Buffer1));
-wsprintfW(Buffer2, Buffer1, pgContext->Domain, 
pgContext->UserName);
+wsprintfW(Buffer2, Buffer1, pgContext->DomainName, 
pgContext->UserName);
 LoadStringW(pgContext->hDllInstance, IDS_COMPUTERLOCKED, 
Buffer1, _countof(Buffer1));
 MessageBoxW(hwndDlg, Buffer2, Buffer1, MB_OK | MB_ICONERROR);
 }
diff --git a/dll/win32/msgina/msgina.c b/dll/win32/msgina/msgina.c
index 90e59250d2..8f6c3a905a 100644
--- a/dll/win32/msgina/msgina.c
+++ b/dll/win32/msgina/msgina.c
@@ -244,12 +244,12 @@ GetRegistrySettings(PGINA_CONTEXT pgContext)
   (LPBYTE)>UserName,
   );
 
-dwSize = sizeof(pgContext->Domain);
+dwSize = sizeof(pgContext->DomainName);
 rc = RegQueryValueExW(hKey,
   L"DefaultDomainName",
   NULL,
   NULL,
-  (LPBYTE)>Domain,
+  (LPBYTE)>DomainName,
   );
 
 dwSize = sizeof(pgContext->Password);
@@ -803,12 +803,12 @@ CreateProfile(
 wcscpy(pgContext->UserName, UserName);
 if (Domain 

[ros-diffs] 01/01: [BOOTDATA][MSGINA][SYSSETUP] Rename the DefaultDomain registry value to DefaultDomainName

2018-05-22 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b784c7bfba3fc2d46b46c606ea423c83904992a2

commit b784c7bfba3fc2d46b46c606ea423c83904992a2
Author: Eric Kohl 
AuthorDate: Tue May 22 11:30:27 2018 +0200
Commit: Eric Kohl 
CommitDate: Tue May 22 11:30:27 2018 +0200

[BOOTDATA][MSGINA][SYSSETUP] Rename the DefaultDomain registry value to 
DefaultDomainName
---
 boot/bootdata/hivesft.inf | 2 +-
 dll/win32/msgina/msgina.c | 2 +-
 dll/win32/syssetup/security.c | 2 +-
 dll/win32/syssetup/wizard.c   | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/boot/bootdata/hivesft.inf b/boot/bootdata/hivesft.inf
index b5c7926de3..4e4e81653d 100644
--- a/boot/bootdata/hivesft.inf
+++ b/boot/bootdata/hivesft.inf
@@ -1373,7 +1373,7 @@ HKLM,"SOFTWARE\Microsoft\Windows 
NT\CurrentVersion\Winlogon","ConsoleShell",0x00
 HKLM,"SOFTWARE\Microsoft\Windows 
NT\CurrentVersion\Winlogon","Shell",0x0002,"%SystemRoot%\explorer.exe"
 HKLM,"SOFTWARE\Microsoft\Windows 
NT\CurrentVersion\Winlogon","Userinit",0x0002,"%SystemRoot%\system32\userinit.exe"
 HKLM,"SOFTWARE\Microsoft\Windows 
NT\CurrentVersion\Winlogon","AutoAdminLogon",0x,"1"
-HKLM,"SOFTWARE\Microsoft\Windows 
NT\CurrentVersion\Winlogon","DefaultDomain",0x,""
+HKLM,"SOFTWARE\Microsoft\Windows 
NT\CurrentVersion\Winlogon","DefaultDomainName",0x,""
 HKLM,"SOFTWARE\Microsoft\Windows 
NT\CurrentVersion\Winlogon","DefaultUserName",0x,""
 HKLM,"SOFTWARE\Microsoft\Windows 
NT\CurrentVersion\Winlogon","DefaultPassword",0x,""
 HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Notify",,0x0012
diff --git a/dll/win32/msgina/msgina.c b/dll/win32/msgina/msgina.c
index 6cb3bc5324..90e59250d2 100644
--- a/dll/win32/msgina/msgina.c
+++ b/dll/win32/msgina/msgina.c
@@ -246,7 +246,7 @@ GetRegistrySettings(PGINA_CONTEXT pgContext)
 
 dwSize = sizeof(pgContext->Domain);
 rc = RegQueryValueExW(hKey,
-  L"DefaultDomain",
+  L"DefaultDomainName",
   NULL,
   NULL,
   (LPBYTE)>Domain,
diff --git a/dll/win32/syssetup/security.c b/dll/win32/syssetup/security.c
index cc35f9a8a3..221d0152af 100644
--- a/dll/win32/syssetup/security.c
+++ b/dll/win32/syssetup/security.c
@@ -580,7 +580,7 @@ SetAutoAdminLogon(VOID)
 if (wcscmp(szAutoAdminLogon, L"1") == 0)
 {
 RegSetValueExW(hKey,
-   L"DefaultDomain",
+   L"DefaultDomainName",
0,
REG_SZ,
(LPBYTE)AdminInfo.Domain,
diff --git a/dll/win32/syssetup/wizard.c b/dll/win32/syssetup/wizard.c
index 9c57f6b2da..b896adf193 100644
--- a/dll/win32/syssetup/wizard.c
+++ b/dll/win32/syssetup/wizard.c
@@ -594,14 +594,14 @@ WriteDefaultLogonData(LPWSTR Domain)
 return FALSE;
 
 lError = RegSetValueEx(hKey,
-   L"DefaultDomain",
+   L"DefaultDomainName",
0,
REG_SZ,
(LPBYTE)Domain,
(wcslen(Domain)+ 1) * sizeof(WCHAR));
 if (lError != ERROR_SUCCESS)
 {
-DPRINT1("RegSetValueEx(\"DefaultDomain\") failed!\n");
+DPRINT1("RegSetValueEx(\"DefaultDomainName\") failed!\n");
 }
 
 lError = RegSetValueEx(hKey,



[ros-diffs] 01/01: [MSGINA] Add the IgnoreShiftOverride feature again

2018-05-22 Thread Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=665926d38bbf7e188111b3a9b2f8abe9b735002f

commit 665926d38bbf7e188111b3a9b2f8abe9b735002f
Author: Eric Kohl 
AuthorDate: Tue May 22 11:06:38 2018 +0200
Commit: Eric Kohl 
CommitDate: Tue May 22 11:06:38 2018 +0200

[MSGINA] Add the IgnoreShiftOverride feature again
---
 dll/win32/msgina/msgina.c | 25 ++---
 dll/win32/msgina/msgina.h |  5 +
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/dll/win32/msgina/msgina.c b/dll/win32/msgina/msgina.c
index 8772df7dc1..6cb3bc5324 100644
--- a/dll/win32/msgina/msgina.c
+++ b/dll/win32/msgina/msgina.c
@@ -170,6 +170,7 @@ GetRegistrySettings(PGINA_CONTEXT pgContext)
 LPWSTR lpAutoAdminLogon = NULL;
 LPWSTR lpDontDisplayLastUserName = NULL;
 LPWSTR lpShutdownWithoutLogon = NULL;
+LPWSTR lpIgnoreShiftOverride = NULL;
 DWORD dwDisableCAD = 0;
 DWORD dwSize;
 LONG rc;
@@ -226,6 +227,15 @@ GetRegistrySettings(PGINA_CONTEXT pgContext)
 pgContext->bDontDisplayLastUserName = TRUE;
 }
 
+rc = ReadRegSzValue(hKey,
+L"IgnoreShiftOverride",
+);
+if (rc == ERROR_SUCCESS)
+{
+if (wcscmp(lpIgnoreShiftOverride, L"1") == 0)
+pgContext->bIgnoreShiftOverride = TRUE;
+}
+
 dwSize = sizeof(pgContext->UserName);
 rc = RegQueryValueExW(hKey,
   L"DefaultUserName",
@@ -250,6 +260,9 @@ GetRegistrySettings(PGINA_CONTEXT pgContext)
   (LPBYTE)>Password,
   );
 
+if (lpIgnoreShiftOverride != NULL)
+HeapFree(GetProcessHeap(), 0, lpIgnoreShiftOverride);
+
 if (lpShutdownWithoutLogon != NULL)
 HeapFree(GetProcessHeap(), 0, lpShutdownWithoutLogon);
 
@@ -893,9 +906,15 @@ WlxDisplaySASNotice(
 
 if (pgContext->bAutoAdminLogon)
 {
-/* Don't display the window, we want to do an automatic logon */
-pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, 
WLX_SAS_TYPE_CTRL_ALT_DEL);
-return;
+if (pgContext->bIgnoreShiftOverride ||
+(GetKeyState(VK_SHIFT) >= 0))
+{
+/* Don't display the window, we want to do an automatic logon */
+pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, 
WLX_SAS_TYPE_CTRL_ALT_DEL);
+return;
+}
+
+pgContext->bAutoAdminLogon = FALSE;
 }
 
 if (pgContext->bDisableCAD)
diff --git a/dll/win32/msgina/msgina.h b/dll/win32/msgina/msgina.h
index 38c975eb89..2243cb8222 100644
--- a/dll/win32/msgina/msgina.h
+++ b/dll/win32/msgina/msgina.h
@@ -28,10 +28,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msgina);
 
 #include "resource.h"
 
-/* Values for GINA_CONTEXT.AutoLogonState */
-#define AUTOLOGON_CHECK_REGISTRY 1
-#define AUTOLOGON_ONCE   2
-#define AUTOLOGON_DISABLED   3
 
 typedef struct
 {
@@ -46,6 +42,7 @@ typedef struct
 BOOL bAutoAdminLogon;
 BOOL bDontDisplayLastUserName;
 BOOL bShutdownWithoutLogon;
+BOOL bIgnoreShiftOverride;
 
 ULONG nShutdownAction;