Commit graph

847 commits

Author SHA1 Message Date
Timo Kreuzer db419efbf2 [WIN32K] Fix protection of USER heap
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.
2024-09-24 13:32:28 +03:00
Timo Kreuzer dbb72f4923 [NTUSER] Fix unaligned access in co_IntSetWindowLongPtr 2024-09-15 12:09:09 +03:00
Timo Kreuzer 201f00ab6f [USER32][NTUSER] Implement (NtUser)SetClassLongPtr(A/W) 2024-09-15 12:09:09 +03:00
Timo Kreuzer b385fc5985 [NTUSER] Fix a 64 bit bug in timer code
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.
2024-09-08 01:52:50 +03:00
Timo Kreuzer 6ca6088f2c [NTUSER] Increase desktop heap size
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.
2024-09-07 18:47:49 +03:00
Doug Lyons 07abea90d9
[NTUSER] Optimize BroadcastSystemMessage a bit. Follow-up of #6884 (#7215)
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
2024-09-01 13:24:22 -05:00
Marek Benc 633d2e6d0c
[NTUSER] Address memory leak in co_WinPosSetWindowPos(). (#7284)
CORE-19723
2024-08-31 15:07:33 -05:00
Timo Kreuzer 34586814ab [GDI32][NTUSER] Demote noisy debug prints 2024-08-30 16:06:41 +03:00
Doug Lyons 9c0eee0333
[NTUSER] Fix window not updating when scrollbars created and removed. (#7245)
* Revise conditions for window complete redraw.

CORE-19669

Co-authored-by: Oleg Dubinskiy <oleg.dubinskij30@gmail.com>
Co-authored-by: Vitaly Orekhov <7opex0@mail.ru>
2024-08-28 02:56:28 -05:00
Tomáš Veselý fd327db20f
[NTUSER] IntSetTimer: Update HintIndex on each call (#7087)
* 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>
2024-08-27 01:14:51 -05:00
Serge Gautherie 44662eaf62 [CMAKE] Use COMPILE_OPTIONS instead of superseded COMPILE_FLAGS
for set_source_files_properties().
2024-08-21 11:34:48 +03:00
Gabriele Lo Re fbcbbd8768
[TRANSLATION] Improve Italian (it-IT) translation part 2 (#7248) 2024-08-21 01:29:34 +02:00
Whindmar Saksit 82a45262bf
[NTUSER] Correctly store original unsnap position (#7244)
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
2024-08-15 12:33:17 +02:00
Serge Gautherie 6756c2ad03 [*_VISTA] Add/Improve version resources 2024-08-13 12:39:42 +02:00
Whindmar Saksit f3d03760e9
[NTUSER] Rewrite Window Snap handling (#5705)
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
2024-08-11 20:21:58 +02:00
Doug Lyons 9ee30c57fd
[NTUSER] Fix popup menu placement when part way off right edge of screen (#7220)
* Move the popup menu to the right edge of the screen when it is past the screen edge on the right.

CORE-19706
2024-08-10 16:00:44 -05:00
Doug Lyons 90de2b660b
[NTUSER] Implement BroadcastSystemMessage with 'Environment' parameter (#6884)
* [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.
2024-08-04 02:53:04 -05:00
Katayama Hirofumi MZ 7e8de0466d
[NTUSER] Use co_UserActivateKeyboardLayout in loading (#7200)
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.
2024-08-02 04:35:05 +09:00
Katayama Hirofumi MZ 063e5e2514
[USER32] Simplify CliSaveImeHotKey (#7199)
Code diet. RegCreateKeyExW will
create sub-keys recursively, so
this code is okay.
JIRA issue: CORE-19268
Simplify registry key creation code.
2024-07-31 03:50:29 +09:00
Katayama Hirofumi MZ dcf0788f59
[IMM32][SDK][USER32] Fix ImmFreeLayout parameter (#7195)
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.
2024-07-30 11:45:23 +09:00
Katayama Hirofumi MZ 7dd081e945
[SDK][NTUSER] s/KLF_UNLOAD/KL_UNLOAD/ (#7196)
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.
2024-07-29 19:30:49 +09:00
Katayama Hirofumi MZ ec24b54731
[IMM32][NTUSER] Use HandleToUlong, UlongToHandle etc. macros (#7180)
Respect coding standard.
JIRA issue: N/A
- Use HandleToUlong, UlongToHandle,
  UlongToPtr etc. macros for type
  casting.
- Remove redundant casts.
2024-07-29 07:15:44 +09:00
Tomáš Veselý 466a19817f
[COMCTL32][USER32] STATIC: Fix grayed drawing (#7024)
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().
2024-07-18 22:03:36 +02:00
Serge Gautherie c6298321a3
[NTUSER] Fix IntDefWindowProc()'s WM_MOUSEACTIVATE case (#7038)
CORE-17545

Clang 13.0.1 was warning about broken 'Ret' handling.
Also remove an unrelated redundant 'else ...'.

Addendum to commit 6dfa71c487 (r68904).
2024-07-18 20:35:04 +02:00
Serge Gautherie 5385f32794
[NTUSER] defwnd.c: Trivial formatting fixes (#7038)
And (re)move 2 'break;'.
2024-07-18 20:33:11 +02:00
Doug Lyons fb87f0f88c
[NTUSER] Fix popup menu position when menu item is half off the left side of the screen (#7108)
[CORE-16729](https://jira.reactos.org/browse/CORE-16729)
2024-07-16 14:36:45 -05:00
George Bișoc 4093d0e164
[NTUSER] Estabilish power callouts and invoke the cleanup procedure when unloading Win32k 2024-07-13 11:30:19 +02:00
George Bișoc 181b666fc4
[NTUSER] Stubplement the Win32 power manager
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
2024-07-13 11:30:19 +02:00
George Bișoc 560428e250
[WIN32K] Add debug switch for the Win32 power manager 2024-07-13 11:30:07 +02:00
Hermès Bélusca-Maïto c02289a08a
[UXTHEME][NTUSER] Check class style for CS_NOCLOSE instead of window style (#7130)
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).
2024-07-10 19:49:09 +02:00
Doug Lyons 71bed0f5f8
[NTUSER] Check class style for CS_NOCLOSE instead of window style (#7123)
Change 'pWnd->style' to 'pWnd->pcls->style' to check for CS_NOCLOSE.
Incorrect struct field was used for checking previously.

Fixes a bug with Ad Muncher that did not close when clicking on the window
title "X" button while being used with a Classic window style theme.
Patch by I_Kill_Bugs. CORE-11569
2024-07-10 13:30:53 +03:00
Katayama Hirofumi MZ ef3e27e2c9
[NTUSER] Improve NtUserSetWindowPlacement (#7096)
Splitted from #7082. Correct behavior of
NtUserSetWindowPlacement function.
JIRA issue: N/A
- Check gptiCurrent->dwExpWinVer in
  NtUserSetWindowPlacement function.
- Fix the last error.
2024-07-09 07:42:56 +09:00
Katayama Hirofumi MZ 6c74e69d12
[NTUSER][USER32] Populate dwExpWinVer (#7095)
This value is needed for
SetWindowPlacement and IMM.
JIRA issue: CORE-19675
JIRA issue: CORE-19268
- Add RtlGetExpWinVer function
  into win32ss/user/rtl/image.c.
- Add RtlGetExpWinVer prototype
  into win32ss/include/ntuser.h.
- Delete RtlGetExpWinVer
  definition in
  win32ss/user/user32/windows/window.c.
- Populate THREADINFO.dwExpWinVer
  and CLIENTINFO.dwExpWinVer
  by using RtlGetExpWinVer in
  InitThreadCallback function.
2024-07-09 04:22:14 +09:00
Katayama Hirofumi MZ efe42074cc
[USER32][USER32_APITEST] CopyImage: Check flags (#7075)
JIRA issue: N/A
- Check CopyImage flags.
- If there is any invalid flag, then set ERROR_INVALID_PARAMETER
  and return NULL.
- Add CopyImage testcase.
2024-07-08 19:24:15 +09:00
Katayama Hirofumi MZ 0cfd7bde9b
[USER32] TileWindows: Adjust timeout of QuerySizeFix (#7081)
Since my machine performance
became lower, we have to adjust
timeout to get correct pattern of
user32!TileWindows function.
JIRA issue: CORE-19674
Adjust timeout value in QuerySizeFix
function.
2024-07-07 06:48:36 +09:00
Katayama Hirofumi MZ 80c170d7bc
[IMM32][NTUSER] Reduce a little IMM spams (#7077)
Reduce log spams that @julenuri reported.
JIRA issue: CORE-19268
- Use Imm32IsCrossThreadAccess
  instead of IS_CROSS_THREAD_HIMC in
  ImmSetCompositionWindow function.
- Reduce ERR logging in
  NtUserQueryInputContext function.
2024-07-05 05:07:49 +09:00
Oleg Dubinskiy 1a1025011f
[REACTOS] Fix LoadCursorW() incorrect usage cases (#7053)
Fix wrong MAKEINTRESOURCEW() macro usage cases in LoadCursorW() system-wide.
MSDN documentation for this function states we need to use MAKEINTRESOURCEW() macro only for internal application-defined cursors (loaded from the app instance specified by hInstance parameter), but not for system-defined cursors (those begin with IDC_* prefix), in case when hInstance is NULL.
So get rid from MAKEINTRESOURCEW() macro usage for all cases when hInstance parameter is NULL. And on the contrary, when hInstance is valid and points to the application instance, then use it for the resource identifier.
2024-07-01 18:05:46 +02:00
Doug Lyons cd88a97115
[NTUSER] Fix popup menu positioning for Miranda IM (#6981)
CORE-17838
2024-06-19 18:55:12 -05:00
Gabriele Lo Re ae27ffcddc
[TRANSLATION] Improve Italian (it-IT) translation (#6820)
I have edited some traslation files for the italian language, as the text
looked robotic in the way senteces were written, or in some cases it used
not-really-fitting synonymous or incorrect spelling. The edited strings
are from varius areas of ReactOS. I hope this contribution makes italian
language less strange to native speakers.

- [ACCESS] Improve Italian (it-IT) translation
- [DESK] Improve Italian (it-IT) translation
- [JOY] Improve Italian (it-IT) translation
- [MAIN] Improve Italian (it-IT) translation
- [SYSDM] Improve Italian (it-IT) translation
- [TIMEDATE] Improve Italian (it-IT) translation
- [ACPPAGE] Improve Italian (it-IT) translation
- [DESKADP] Improve Italian (it-IT) translation
- [DEVCPUX] Add Italian (it-IT) translation
- [FONTEXT] Improve Italian (it-IT) translation
- [ZIPFLDR] Improve Italian (it-IT) translation
- [BROWSEUI] Improve Italian (it-IT) translation
- [USER32] Improve Italian (it-IT) translation
- [CONSRV] Improve Italian (it-IT) translation
- [USERSRV] Improve Italian (it-IT) translation

Reviewed-by: Joachim Henze <joachim.henze@reactos.org>
Reviewed-by: Simone Mario Lombardo <me@simonelombardo.com>
2024-06-10 13:45:00 +03:00
Carl J. Bialorucki ad73e17418
[USER32] Introduce user32_vista and stubplement GetDpiForWindow() (#6208)
Add user32_vista.dll to introduce new NT6+ User32 features without changing the existing User32.dll when compiled as NT5.x. Also implements a stub for GetDpiForWindow(). The GetDpiForWindow() function will be required to Wine-sync common controls to modern Wine versions.

Changes:
Expose GetDpiForWindow() function and USER_DEFAULT_SCREEN_DPI to appropriate versions in winuser.h
Introduce a basic user32_vista library that can be expanded as needed.
2024-06-04 10:19:32 -06:00
Katayama Hirofumi MZ a541a468ba
[NTGDI][FREETYPE] Unload font engine on system shut-down (#6955)
Check system integrity by explicitly
releasing the font engine.
JIRA issue: CORE-9616
- Use RTL_STATIC_LIST_HEAD against
  g_FontListHead and
  g_FontCacheListHead variables and
  omit initialization of them.
- Implement FreeFontSupport function.
- Call FreeFontSupport in win32k!
  DriverUnload function.
- Fix some usages of
  CONTAINING_RECORD macro.
2024-05-29 09:41:39 +09:00
Katayama Hirofumi MZ 817f89466d
[BOOTDATA][IMM32][NTUSER] Follow-up to #6961 (#6962)
JIRA issue: CORE-19320
- Delete "(brain-dead)".
- Fix "despite of" as "despite".
- Use "%S" instead of debugstr_w.
2024-05-29 01:14:52 +09:00
Katayama Hirofumi MZ c8a3c919e5 [BOOTDATA][IMM32][NTUSER] Set "LoadIMM" to zero
We set "LoadIMM" to zero in order to disable Cicero.
The name of "LoadIMM" is a brain-dead name. This name
means Cicero despite of its name (brain-dead).
They use a human-confusing name intentionally.

JIRA issue: CORE-19320

- Set HKLM\SOFTWARE\Microsoft\Windows NT\
  CurrentVersion\IMM:LoadIMM to 0.
- Add warning comments to the brain-dead name "LoadIMM".
2024-05-28 23:17:22 +09:00
Katayama Hirofumi MZ 4225717dc9 [IMM32][NTUSER] Fix NtUserGetThreadState call of Imm32InquireIme
There was a mistake of parameter value for NtUserGetThreadState
call in Imm32InquireIme function. This affected the logon process.

JIRA issue: CORE-19320

- Replace THREADSTATE_ISWINLOGON2 with THREADSTATE_ISWINLOGON in
  NtUserGetThreadState call in Imm32InquireIme function.
- Rename THREADSTATE_ISWINLOGON2 as THREADSTATE_UNKNOWN_0x10.
- Adapt NtUserGetThreadState to this change.
2024-05-28 23:17:22 +09:00
Doug Lyons 6338913f26
[NTUSER] menu.c position fix to not obscure 'Close' (#6923)
CORE-19579

When IS_SYSTEM_MENU was redefined in https://github.com/reactos/reactos/commit/3ae0ccdcc,
this broke the logic here. So now we restore the correctly working logic.
2024-05-24 19:15:07 -05:00
Andrei Miloiu 3b99e294f5
[USER32] Update Romanian (ro-RO) translation (#6704) 2024-05-10 21:34:05 +02:00
Doug Lyons cf9f7548d5
[NTUSER] Fix double click on title bar icon not closing window (#6697)
Patch by @I_Kill_Bugs

* [NTUSER] Fix double click on title bar icon not closing window

Improve MENU_TrackMenu handling.

Guilty commit:0.4.15-dev-7750-gc17a654 c17a6542ac

CORE-19492
2024-05-07 09:52:57 -05:00
Doug Lyons 0c0062ac9a
[NTUSER] Fix Skype and other programs installer windows not able to be moved with mouse by clicking on title bar (#6819)
Patch by @I_Kill_Bugs

Add condition into msgqueue along with filter testing to reject messages that are "NotForUs".
Also, do not set AcceptMessage to FALSE, but just keep msgDblClk and idSysPeek values and continue.

CORE-19487
CORE-19538
2024-05-07 09:10:11 -05:00
Timo Kreuzer e8e770fd14 [WIN32K:NTUSER] Fix NULL pointer dereference in MENU_HideSubPopups
Fixes CORE-19367.
2024-05-06 15:47:30 +02:00
Doug Lyons 29235147e2
[NTUSER] Remove some extra repaints/redraws (#6827)
Reposition logic and add Flags testing for RgnType == NULLREGION.
This was suggested by @HBelusca and approved by @I_Kill_Bugs
2024-05-04 07:35:53 -05:00