https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6417b2323d7ef74dc4c7b…
commit 6417b2323d7ef74dc4c7b8319d48e8932c50d588
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sun Oct 24 05:29:39 2021 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sat Oct 23 22:29:39 2021 +0200
[NTUSER][USER32] Workaround tracking menu on CORE-17338 (#4048)
This prevents the tracking menu from erroneously closing itself right after it was opened in some cases.
Fixes CORE-17338 which got unhidden by 0.4.15-dev-1126-g 58b0558f94abee52ce1c261063d4f4b884e96310
And fixes CORE-15760 which got unhidden by SVN r74972 == git 19dd22d42218da03ab748879aa3c3e288f41697e
Since both symptoms look very similar but the unhiding revisions did differ,
that could mean we do have some kind of race condition here.
I guess this fix is more like a workaround. I do intend to port it back nevertheless.
---
win32ss/user/ntuser/menu.c | 2 +-
win32ss/user/user32/windows/defwnd.c | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/win32ss/user/ntuser/menu.c b/win32ss/user/ntuser/menu.c
index 71a52b94b40..3c006fcd5a6 100644
--- a/win32ss/user/ntuser/menu.c
+++ b/win32ss/user/ntuser/menu.c
@@ -4118,7 +4118,7 @@ static INT FASTCALL MENU_TrackMenu(PMENU pmenu, UINT wFlags, INT x, INT y,
/* ReactOS Checks */
if (!VerifyWnd(mt.OwnerWnd) ||
!ValidateHwndNoErr(mt.CurrentMenu->hWnd) ||
- pti->MessageQueue->QF_flags & QF_ACTIVATIONCHANGE ||
+ //pti->MessageQueue->QF_flags & QF_ACTIVATIONCHANGE || // See CORE-17338
capture_win != IntGetCapture() ) // Should not happen, but this is ReactOS...
{
ErrorExit = TRUE; // Do not wait on dead windows, now win test_capture_4 works.
diff --git a/win32ss/user/user32/windows/defwnd.c b/win32ss/user/user32/windows/defwnd.c
index 9a2272d3c89..b7a624061e3 100644
--- a/win32ss/user/user32/windows/defwnd.c
+++ b/win32ss/user/user32/windows/defwnd.c
@@ -338,8 +338,11 @@ User32DefWindowProc(HWND hWnd,
HMENU menu = GetSystemMenu(hWnd, FALSE);
ERR("WM_POPUPSYSTEMMENU\n");
if (menu)
+ {
+ SetForegroundWindow(hWnd);
TrackPopupMenu(menu, TPM_LEFTBUTTON|TPM_RIGHTBUTTON|TPM_SYSTEM_MENU,
LOWORD(lParam), HIWORD(lParam), 0, hWnd, NULL);
+ }
return 0;
}
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fe0415a4ba76bd59ba9ff…
commit fe0415a4ba76bd59ba9ff1b0b4cd7e15ee100623
Author: George Bișoc <george.bisoc(a)reactos.org>
AuthorDate: Sat Oct 23 09:58:50 2021 +0200
Commit: George Bișoc <george.bisoc(a)reactos.org>
CommitDate: Sat Oct 23 09:58:50 2021 +0200
[NTDLL_APITEST] Free the allocated memory block when we're done
This fixes a memory leak where we allocate a buffer for token statistics with RtlAllocateHeap routine but we never free it afterwards.
---
modules/rostests/apitests/ntdll/NtDuplicateToken.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/modules/rostests/apitests/ntdll/NtDuplicateToken.c b/modules/rostests/apitests/ntdll/NtDuplicateToken.c
index fa03d3b8a80..fb357f58bb4 100644
--- a/modules/rostests/apitests/ntdll/NtDuplicateToken.c
+++ b/modules/rostests/apitests/ntdll/NtDuplicateToken.c
@@ -153,7 +153,11 @@ DuplicateTokenAsEffective(VOID)
trace("Number of privileges of effective only token -- %lu\n", TokenStats->PrivilegeCount);
trace("Number of groups of effective only token -- %lu\n", TokenStats->GroupCount);
- /* We finished our tests, close the handles now */
+ /*
+ * We finished our tests, free the memory
+ * block and close the handles now.
+ */
+ RtlFreeHeap(RtlGetProcessHeap(), 0, TokenStats);
CloseHandle(TokenHandle),
CloseHandle(DuplicatedTokenHandle);
}