Based on the Doug Lyons' test in #7087, I found that my previous fix stopped working partially. Or rather, it would only work until the 32767 indexes were exhausted. It seems to me that the behavior of the bitfield has changed, because when I published the previous patch, it passed my tests.
- Bit array generates free ID cyclically, in the previous code after 32767 indexes expired the same index was returned, because of this the previous fix would stop working after expiration, so change the logic of calculating the next index.
- Change the index range to 256-32767 to match Windows, indexes 0-255 can theoretically be used as reserved for system purposes.
Addendum to fd327db20f. CORE-9141
Create the section with PAGE_READWRITE, not PAGE_EXECUTE_READWRITE and map in user mode with PAGE_READONLY, not PAGE_EXECUTE_READ.
Original commit was ea5261f in 2006. The comments suggest that back then the heap code had issues with it, which is not the case anymore.
It is now a wrapper around GdiPolyDraw, which implements the main body of the function, while the Nt function only probes and captures the user mode data into safe kernel mode buffers.
Previously some people thought it was a great idea to just wrap the entire implementation in SEH, so when something throws an exception somewhere for whatever reason, we can just catch it here... and LEAK ALL RESOURCES IN THE PROCESS!
TODO: Rewrite all of this. It's broken everywhere.
The return value of RtlFindClearBitsAndSet is an ULONG, assigning it to an ULONG_PTR will not sign extend it. The error value will stay 0xFFFFFFFF. Comparing it to (UINT_PTR)-1 will sign extend and thus compare it to 0xFFFFFFFFFFFFFFFF on x64.
Also use NUM_WINDOW_LESS_TIMERS to initialize the bitmap, rather than the calculated size. This does not make a difference with the current value (32768), but if it was not the case, the bitmap would be larger than this, resulting in invalid bitmap indices being returned, which would cause bugs later on. Finally remove an ASSERT that can be triggered by tests.
Distinguish between the following 3 scenarios:
1. Interactive Winsta0, "Winlogon" desktop: use 128 KB
2. Interactive Winsta0, "Default" & other desktop: use 3 MB (x86) / 20 MB (x64)
3. Non-interactive winsta: use 128 KB
This is what Windows 2003 uses for the interactive desktops on x86 and what Windows 7 uses for x64. Fixes desktop heap exhaustion during testing. The previous value was 512 KB for all desktops.
It doesn't handle the even smaller "Disconnected" desktop, which is only meaningful for RDP sessions and we don't use it anyway.
See comments in the file for references.
Optimize BroadcastSystemMessage with Environment parameter.
Minimize processing when UserModeMsg->lParam is NULL and KernelModeMsg->message != WM_WININICHANGE
Make sure that we have a UNICODE_NULL within lParamMsg based on comment from @whindsaks
@I_Kill_Bugs fix
CORE-11787, CORE-17721 and CORE-19721
For function IntExtTextOutW with space character, the x-dimension should be taken into account.
Fixes HexEdit 1.2.1 right side of display window not being cleared.
Account for x-dimension if TA_UPDATECP flag set and 'String' is not NULL.
Clarify 'etx' is ASCII End of Text
* fix CORE-9141 - adding a change to IDEvent after each pass
If the first index is 0 the first returned ID will be 0x8000, which is fine.
Co-authored-by: Joachim Henze <joachim.henze@reactos.org>
A small change before PR #5705 was merged caused a severe downgrade in the snap/unsnap handling. Win key handling should work correctly now.
CORE-19165 CORE-19166
Fixes many Window Snap related bugs and uses the WS_EX2_VERTICALLYMAXIMIZED* styles to remember which edge it is snapped to.
The most significant change is that GetWindowPlacement lies about the normal position when it is snapped, just like Windows.
CORE-19160 CORE-19165 CORE-19166
* [NTUSER] Implement BroadcastSystemMessage with 'Environment' parameter
CORE-19372
CORE-19583
* Changes based on reviewer comments.
* Make sure that lParamMsg has a UNICODE_NULL in it.
* Skip extra handling of 1 word messsages.
Refactoring on keyboard layout.
JIRA issue: CORE-19268
- Delete co_UserActivateKbl function.
Use co_UserActivateKeyboardLayout
function instead of
co_UserActivateKbl in
co_IntLoadKeyboardLayoutEx
function.
- Improve
co_UserActivateKeyboardLayout.
JIRA issue: CORE-19268
- Define ImmFreeLayout parameter special
values (HKL_SWITCH_TO_NON_IME and
HKL_RELEASE_IME) at <imm32_undoc.h>.
- Make ImmFreeLayout parameter an HKL.
JIRA issue: CORE-19268
- Rename KLF_UNLOAD as KL_UNLOAD.
- Move it from win32ss/user/ntuser/input.h
to sdk/include/reactos/undocuser.h.
- Add UKL_NOACTIVATENEXT constant
and use it.
CORE-15298
Use DrawTextW() to correctly render disabled grayed text.
Applies to both dll\win32\comctl32\static.c and win32ss\user\user32\controls\static.c
A similar solution is already used by button.c!BUTTON_DrawLabel().
CORE-17545
Clang 13.0.1 was warning about broken 'Ret' handling.
Also remove an unrelated redundant 'else ...'.
Addendum to commit 6dfa71c487 (r68904).
In order for the NT power manager to interact with the Win32 subsystem (thus the whole rest of the system), the Win32 kernel-mode subsystem provides a mechanism that communicates with the kernel power manager via power callouts (aka power requests as per Windows' PDB symbols).
Such mechanism enters in action as soon as Win32 callout routines are estabilished with the PsEstablishWin32Callouts() function.
The NT power manager, the power policy manager respectively, invokes a power callout to denote an exceptional phenomena as a result of power policies or capabilities changes, turning ON/OFF the display, a system time change has occurred, etc.
Such scenarios are described as power events of which the NT power manager sends a WIN32_POWEREVENT_PARAMETERS packet to Win32k via the estabilished "PowerEventCallout" pointer function callout.
For other callouts that inform the Win32 subsystem of impeding power state changes across the system or devices, these are sent as WIN32_POWERSTATE_PARAMETERS packets with its own separate callout.
The purpose of such mechanism is to give Win32k the opportunity to do power related tasks and alert every application of such power events in accordance with what it gets notified by the NT power manager.
Currently this patch stubplements this mechanism in ROS, it is only just the barebones for now. The development of the Win32 power manager will go in parallel with the kernel power manager development (expand, improve, fix the code of issues that whatever may arise).
So far only the PsW32SystemTime power event is implemented for the moment being. This work was decoupled from PR #5719 to avoid clobbering it too much.
=== TODO ===
- Implement power states management communication with the kernel power manager
- Implement the rest of the power events in IntHandlePowerEventWorker
- Implement power event handling in CSRSS (or WinSrv?) which handles any of the events that could not be handled by Win32k otherwise
- Estabilish the power state callout in PsEstablishWin32Callouts() (currently there is no a pointer function that gets assigned to such callout)
CORE-18969
Don't free the linked font name if it's already NULL. Since it is allocated only once (when loading the font name from Registry), it should be freed only once too. All subsequent freeing attempts will result in invalid pool freeing.
This fixes the 0xC2 BAD_POOL_CALLER bugcheck when trying to resize window (and draw more text) from soundcloud.com in K-Meleon 76.5.4 Goanna engine and when switching between channels (during redrawing the text) in DiscordMessenger v1.06 Beta.
Addendum to 0f9e889736.
CORE-19681
CORE-11569, CORE-19684
Addendum to commit 71bed0f5f8 (PR #7123).
The problem in uxtheme was introduced in commit 685084b63c (as part
of a fix for CORE-17203), because it was a copy-paste and adaptation
of the corresponding code in `ntuser/nonclient.c!NC_DoButton()`.
The bugs in `win32ss/user/ntuser/defwnd.c` (and `nonclient.c` as fixed by
the previous commit) were in turn introduced from the migration of menu
and related code from user32 to win32k, see commit 6dfa71c487 (r68904).