Fix incorrect status code returned by VBESetPowerState()
in the VBE miniport driver.
- VBESetPowerState() returned `VBE_SUCCESS` (`0x4F`, raw VESA BIOS AL
success code) instead of `NO_ERROR` on success, so callers checking for
`NO_ERROR` would treat every successful DPMS power-state change
as a failure. Change it to `NO_ERROR`.
- Change annotations to SAL2 in the source and header.
CORE-19946
Adapted from PR #7577
Implement the undocumented `IsServerSideWindow()` function in user32.
It checks whether a window has a window procedure that resides in kernel
mode, and returns a boolean condition based on the appropriate internal
window state flag (`WNDS_SERVERSIDEWINDOWPROC`).
This function is not officially documented by Microsoft, but there exists
unofficial documentation[^1] for it.
It is required and used internally by uxtheme.dll from Windows XP/2003/Vista/7/etc.
The log spams with it a lot, when using uxtheme.dll from Windows in ReactOS.
[^1]: https://undoc.airesoft.co.uk/user32.dll/IsServerSideWindow.php
If no bitmap buffer size is provided (e.g. allocation path from EngCreateBitmap), do not validate that the size calculation is valid. Should fix some display drivers, like Radeon IGP 320M.
See CORE-13036, CORE-11676
CORE-20231
Tests show this is allowed on Windows and even Wine. Also, official MS
Windows SDK headers indicate that the `CreateHalftonePalette()` `hDC`
parameter is optional, and so can be NULL.
Not allowing a NULL `hDC` caused compatibility issues, breaking applications
like Internet Explorer 8.0 and Microsoft Encarta.
Make `NtGdiCreateHalftonePalette()` accept a NULL `hDC`, fixing its crash
in this case, and only locking it when it's not NULL. Simplify also the
function execution path.
Co-authored-by: Simone Mario Lombardo <[email protected]>
Dragging the first-boot install/status window could make setup stall,
and the shell never started after that.
The problem is that the move/size modal loop can remove a posted `WM_QUIT`
while setup is tearing the thread down. That quit message then does not
reach the outer `GetMessage()` loop, so the setup thread keeps waiting
instead of exiting.
This fix keeps the `WM_QUIT` message alive by re-posting it and leaving
the move/size loop.
See also: https://devblogs.microsoft.com/oldnewthing/20050222-00/?p=36393
## How to test
Boot to first-boot setup, drag the install/status window while it is finishing,
and check that setup continues and Explorer starts instead of hanging.
`co_IntGetScrollBarInfo()` computed the `rgstate` bits into the output buffer
and then immediately overwrote them with the cached copy, so callers always
got stale state.
Fix this by copying the cached info before computing `rgstate`.
This also exposed an inverted `WS_DISABLED` test (per wine, disabled `SB_CTL`
should report `UNAVAILABLE`, not enabled ones), which is now fixed as well.
Remove the excessive repainting of the non-client window area (title caption/buttons and borders) whenever other windows are being dragged over.
CORE-5877, CORE-16672
The mask bounds check in `DIB_XXBPP_StretchBlt` allowed `sx == cx` (and similar for `sy`),
reading one pixel past the end of the mask bitmap.
On the contrary, the source-surface check a few lines below already does it right.
- Use shared locks for the display device and PDEV lookup paths.
These functions only walk existing lists and take references, while list updates
and mode-switch paths still use exclusive locking.
This avoids serializing read-only display queries unnecessarily.
- Use shared locks for other read-only NtUser calls.
Some win32k syscalls were still taking the exclusive user lock even though they only read existing state.
This switches a few simple query paths to the shared user lock instead: foreground window lookup, IME hotkey/context queries, layered window attributes, and title bar info.
The goal is to avoid taking the writer lock for read-only work while keeping the same behavior.
Fix the bug, where `NtUserMenuItemFromPoint()` returned `cItems` instead of `NO_SELECTED_ITEM`
when no item is under the point (`mi` is never NULL on a miss), so `MenuItemFromPoint()` callers
could have indexed one past the menu array.
As soon as `ObCreateObject()` is successfully invoked, zero-out the winsta
and desktop object buffers and assign them the current process session ID
(into their first `dwSessionId` member). Only then, continue with regular
initialization.
It's done in this systematic way in order to ensure that, in case the
regular initialization of these objects fails and `ObDereferenceObject()`
is invoked, the `nt!ExpWin32SessionCallout()` routine (in `ntoskrnl/ex/win32k.c`)
that is executed as part of the Win32 "delete" object callback registered
by win32k.sys with the Object Manager, correctly finds a valid initialized
`SessionId` value in the "common header" of either the window station
or the desktop object being deleted.
As a side-result, other parts of win32k can directly refer to
`pdesk->dwSessionId` instead of `pdesk->rpwinstaParent->dwSessionId`
for a given desktop.
- Don't use `NtCurrentPeb()` to retrieve the current process session ID,
but `PsGetCurrentProcessSessionId()` instead that doesn't require a PEB.
- Turn the purposely-leaking local `hWinstaDir` variable into a global
`ghWinStaDir` variable, so that when win32k.sys unloading support will
be implemented, one could close `ghWinStaDir` so as to delete the per-
session window-station object directory.
(It isn't created as an `OBJ_PERMANENT` object for this reason.
See comment https://github.com/reactos/reactos/pull/621#discussion_r196303521
in PR #621.)
This hack was introduced in commit 89d0892531 (r6908) to automatically
assign, on kernel-side, the created window as the "current" desktop window,
when it was the first one to be created for the given desktop.
This was necessary back when Win32 desktop windows were managed on
CSRSS side (via the ReactOS-specific `win32csr/desktopbg.c` module).
Since the introduction of the `winsrv` module, and the move of desktop
windows management into Win32k in commit 765f09416d (r57632), see also
CORE-6723, this hack isn't needed anymore because the same sequence
of actions is done by `IntCreateDesktop()`, just after creating the
desktop window.
The call to `IntDefWindowProc()` in the desktop window procedure
`default` case, was disabled in commit ff31610bfb (r68908), because
of a supposed "painting message regression", probably related at
that time to a previous commit 6dfa71c487 (r68904) and CORE-7797.
This isn't relevant anymore.
This fixes the mismatch, where the flush checks wrongly tested `mi.dwFlags` (`MOUSEEVENTF_XDOWN/XUP`) against the raw `MOUSE_BUTTON_4/5` bits, so the combined button-4+5 events were flushed in the wrong block or were dropped.
JIRA issue: N/A
- Erase "pT1 = pT1;" self-assignment.
- Add SOFTKBDDATAEX structure as
an extension of SOFTKBDDATA.
- Fix array-bounds warning, by using
SOFTKBDDATAEX.
Use pdc->ptlFillOrigin (which is adjusted by the Window origin already) instead of pdc->pdcattr->ptlBrushOrigin.
Fixes several gdiplus_winetest:brush tests
Improve simplicity for future.
JIRA issue: CORE-8466
- Remove the 1st parameter (PDC) of
TextIntUpdateSize function.
- Remove the 1st parameter (PDC) of
IntRequestFontSize function.
CORE-19305
Change how WM_VSCROLL is handled to allow higher line counts to be passed to EDIT_WM_VScroll.
Use the GetScrollInfo() function to determine vertical scroll position and pass this to EDIT_WM_VScroll.
---------
Co-authored-by: Jose Carlos Jesus <[email protected]>
CORE-20553
Fix PolylineTo and PolyBezierTo based on Wine 10.0.
Include starting point in the "POINTS" variable being passed to PolylineTo and PolyBezierTo.
Handle the starting point as the origin for drawing the lines.
Follow-up of #8846. Now <jpnvkeys.h>
is useless. Minor refactoring and
standardation.
JIRA issue: CORE-19268
- Replace <jpnvkeys.h> usage with
<wine/ime.h> and fix
VK_DBE_ENTERIMECONFIGMODE
naming.
- Remove duplicated
WM_IME_REPORT/IR_* and
UNDETERMINESTRUCT definitions
now provided by wine/ime.h.
- Introduce win3send.c half-
implementing
ImmSendIMEMessageExA/W.
- Add CMake option
IMM_WIN3_SUPPORT (default: ON).