WMSyncReader starts a background read thread that reads from the IStream
passed to IWMSyncReader::OpenStream. This means it could use the IStream in the
background even when no IWMSyncReader methods are being called.
For well-behaved applications, this is probably OK. However, AQUARIUM
(Steam 2515070) frees the IStream it passes to WMSyncReader _before_
it calls IWMSyncReader::Close, which stops the read thread. This causes
the read thread to access freed memory. This is improper, but not
unreasonable, as IWMSyncReader is supposed to be a synchronous
interface, so one might assume when they weren't calling into
IWMSyncReader methods, the IStream won't be used.
This commit adds a `wg_parser_dont_read` function, which can be used to
stop wg_parser from issuing read requests. This is used by IWMSyncReader
to make sure read requests are only issued when IWMSyncReader methods
are being called.
--
v3: winegstreamer: Make sure WMSyncReader never reads in the background.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7676
This fixes a misbehaving proton game that sets MF_XVP_PLAYBACK_MODE.
MF_XVP_PLAYBACK_MODE isn't mentioned in microsoft docs, but it's explained and used in the MIT-licensed [Windows-classic-samples](https://github.com/microsoft/Windows-classic-sampl…
Not sure if mfplat is the right place to add the tests for this since the code is in winegstreamer, but it's very similar to the existing mfplat tests and the test does not interface with winegstreamer directly.
It should be noted that on windows, ProcessOutput errors out if we provide a pSample with MF_XVP_PLAYBACK_MODE unset, wine simply ignores it.
--
v5: winegstreamer: Allow caller to allocate samples in MF_XVP_PLAYBACK_MODE.
mfplat/tests: Add test for MF_XVP_PLAYBACK_MODE.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7796
This fixes a misbehaving proton game that sets MF_XVP_PLAYBACK_MODE.
MF_XVP_PLAYBACK_MODE isn't mentioned in microsoft docs, but it's explained and used in the MIT-licensed [Windows-classic-samples](https://github.com/microsoft/Windows-classic-sampl…
Not sure if mfplat is the right place to add the tests for this since the code is in winegstreamer, but it's very similar to the existing mfplat tests and the test does not interface with winegstreamer directly.
It should be noted that on windows, ProcessOutput errors out if we provide a pSample with MF_XVP_PLAYBACK_MODE unset, wine simply ignores it.
--
v4: winegstreamer: Allow caller to allocate samples in MF_XVP_PLAYBACK_MODE.
mfplat/tests: Add test for MF_XVP_PLAYBACK_MODE.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7796
This fixes a misbehaving proton game that sets MF_XVP_PLAYBACK_MODE.
MF_XVP_PLAYBACK_MODE isn't mentioned in microsoft docs, but it's explained and used in the MIT-licensed [Windows-classic-samples](https://github.com/microsoft/Windows-classic-sampl…
Not sure if mfplat is the right place to add the tests for this since the code is in winegstreamer, but it's very similar to the existing mfplat tests and the test does not interface with winegstreamer directly.
It should be noted that on windows, ProcessOutput errors out if we provide a pSample with MF_XVP_PLAYBACK_MODE unset, wine simply ignores it.
--
v3: winegstreamer: Allow caller to allocate samples in MF_XVP_PLAYBACK_MODE.
mfplat/tests: Add test for MF_XVP_PLAYBACK_MODE.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7796
Not checking nice_limit here can result in some calls to setpriority()
succeeding while others fail, which can result in relative priorities
being incorrect. For example, buffer underflows can occur in
winepulse.drv because the priority is too low in pulse_timer_loop().
--
v2: server: Do not call setpriority() if it cannot be used safely.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7809
This is similar to 1529ab0ac7a3591cad301d7b3cbb0a7d85377f3e.
DOOM (379720) doesn't change back to the original resolution when entering windowed mode from
non-native fullscreen mode on the secondary monitor. So after that, the raw and effective monitor
DPI differs when emulate_modeset is on, and Wine needs to scale the game window according to DPI.
Wine's built-in title bar is drawn using NtGdiGradientFill() in draw_caption_bar(). On Linux,
NtGdiGradientFill() eventually calls xrenderdrv_GradientFill(). However, the lp_to_dp() in
winex11.drv doesn't map coordinates to raw monitor DPI. So the title bar drawn in this case is too
small and looks corrupted.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7814
Not checking nice_limit here can result in some calls to setpriority()
succeeding while others fail, which can result in relative priorities
being incorrect. For example, buffer underflows can occur in
winepulse.drv because the priority is too low in pulse_timer_loop().
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7809
If CompStrAttr and CompStrClause are properly configured, Japanese input
will be more comfortable.
Inspired by cursor_begin and cursor_end from Wayland zwp_text_input_v3
preedit_string, I extended the cursor_pos concept as follows:
cursor_pos = MAKELONG( cursor_begin, cursor_end );
ime_to_tascii_ex() uses this to construct CompStrAttr, CompStrClause.
MS Windows native CompStrAttr, CompStrClause is a bit more complicated
than this, but the concept is useful enough.
It requires additional implementation in the Wine ime_ui_window proc and
richedit control. However, it is useful for applications that inline ime
composition string.
This can be tested with MS Office Word, Excel. LANG=ja_JP.UTF-8 wine EXCEL.EXE
Test key sequences:
- “n-i-h-o-n-g-o-n-o-m-o-j-i-d-e-s-u-.-SPACE”.
- And, RIGHT, LEFT, Shift+LEFT, Shift+RIGHT, SPACE, UP, DOWN, ESC, etc.
--
v2: winex11: Update only when caret pos changed in xic_preedit_caret.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7812
If CompStrAttr and CompStrClause are properly configured, Japanese input
will be more comfortable.
Inspired by cursor_begin and cursor_end from Wayland zwp_text_input_v3
preedit_string, I extended the cursor_pos concept as follows:
cursor_pos = MAKELONG( cursor_begin, cursor_end );
ime_to_tascii_ex() uses this to construct CompStrAttr, CompStrClause.
MS Windows native CompStrAttr, CompStrClause is a bit more complicated
than this, but the concept is useful enough.
It requires additional implementation in the Wine ime_ui_window proc and
richedit control. However, it is useful for applications that inline ime
composition string.
This can be tested with MS Office Word, Excel. LANG=ja_JP.UTF-8 wine EXCEL.EXE
Test key sequences:
- “n-i-h-o-n-g-o-n-o-m-o-j-i-d-e-s-u-.-SPACE”.
- And, RIGHT, LEFT, Shift+LEFT, Shift+RIGHT, SPACE, UP, DOWN, ESC, etc.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7812
SchedulerPolicy_SetPolicyValue(ContextPriority, THREAD_PRIORITY_BELOW_NORMAL)
would erroneously throw an exception because THREAD_PRIORITY_BELOW_NORMAL == -1
and -1 > 6 when compared as unsigned.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7804
This serie starts moving type handling into PDB backend.
In order to handle both the existing symt_{*} structures for
every debug info objects and their potential counterpart
inside a debug info backend, we introduce an opaque symref_t
which can either hold a pointer or a value dedicated to a
debug backend.
This allows:
- to have generic code handling transparently a debug info
object (whether it's managed as a symt_{*} object, or
as a reference in backend)
- during the migration phase from old to new PDB backend,
to select, by type of object, whether it's handled by
old or new backend, hence allowing a migration scheme
by type of object.
This series mainly introduces the symref_t instead of
the existing pointer to symt_{*}.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7811
Calling MFScheduleWorkItemEx() schedules the operation in the timer
queue, but unless GetParameters() returns the timer queue, callback
invocation will occur in the standard queue.
--
v2: mf: Specify a user queue for sample grabber timer callbacks.
mf: Specify a user queue for presentation clock callbacks.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7696
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
--
v2: windowscodecs/metadata: Implement bKGD chunk reader.
windowscodecs/metadata: Add default item for the GifComment handler.
windowscodecs/tests: Add more tests for initial reader contents.
windowscodecs/metadata: Create default items for the tIME handler.
windowscodecs/metadata: Create default item for the hIST handler.
windowscodecs/metadata: Create default items for the cHRM handler.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7795
Using enum { buf_len, buf_count } also looks strange, leave it for now.
--
v2: sane.ds: Use sizeof() instead of hard-coded values, avoid zero initializing local variables when not necessary.
sane.ds: Clarify how SANE mode names map to ICAP_PIXELTYPE values.
sane.ds: Change return type of sane_categorize_value() to void.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7793
--
v2: mshtml: Move Option constructor to the window rather than the prototype.
mshtml: Move Image constructor to the window rather than the prototype.
mshtml: Validate builtin host functions in IE9+ using prototype_id rather
https://gitlab.winehq.org/wine/wine/-/merge_requests/7779
Broadcast `GUID_BLUETOOTH_RADIO_IN_RANGE` and `GUID_BLUETOOTH_RADIO_OUT_OF_RANGE` events (documented [here](https://learn.microsoft.com/en-us/windows/win32/bluetooth/bluetooth-a…) when remote devices are discovered and lost, respectively. For new devices, `RADIO_IN_RANGE` is only broadcasted if the device was not an initial entry enumerated during driver initialization.
--
v2: winebth.sys: Broadcast GUID_BLUETOOTH_RADIO_IN_RANGE events for newly discovered remote devices as well.
winebth.sys: Broadcast PnP event when remote devices are removed/lost.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7787
This fixes a misbehaving proton game that sets MF_XVP_PLAYBACK_MODE.
MF_XVP_PLAYBACK_MODE isn't mentioned in microsoft docs, but it's explained and used in the MIT-licensed [Windows-classic-samples](https://github.com/microsoft/Windows-classic-sampl…
Not sure if mfplat is the right place to add the tests for this since the code is in winegstreamer, but it's very similar to the existing mfplat tests and the test does not interface with winegstreamer directly.
It should be noted that on windows, ProcessOutput errors out if we provide a pSample with MF_XVP_PLAYBACK_MODE unset, wine simply ignores it.
--
v2: winegstreamer: Allow caller to allocate samples in MF_XVP_PLAYBACK_MODE.
mfplat/tests: Add test for MF_XVP_PLAYBACK_MODE.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7796
This fixes a misbehaving proton game that sets MF_XVP_PLAYBACK_MODE.
MF_XVP_PLAYBACK_MODE isn't mentioned in microsoft docs, but it's explained and used in the MIT-licensed [Windows-classic-samples](https://github.com/microsoft/Windows-classic-sampl…
Not sure if mfplat is the right place to add the tests for this since the code is in winegstreamer, but it's very similar to the existing mfplat tests and the test does not interface with winegstreamer directly.
It should be noted that on windows, ProcessOutput errors out if we provide a pSample with MF_XVP_PLAYBACK_MODE unset, wine simply ignores it.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7796
This MR uses the cursor-shapes-v1 protocol to tell the compositor which system
cursor shape to use. If a shape match is not found (or cursor-shapes-v1
is not available) we fall back to setting the cursor buffer from the
Windows cursor data as before.
The second commit implements support for a "UseSystemCursors" driver option, similar
to what winex11 has. Since this is the first winewayland driver option we also introduce
all the related registry reading code.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57648
--
Side note: The registry code is a copy from winex11, and is the third copy in the
codebase (x11, mac, wayland). Perhaps it's worth introducing a common
ntuser function to perform the option reading for the drivers, something like
`NtUserGetDriverOption("X11 Driver", buffer, buffer_size, TRUE /* whether to read app specific option if present */)`.
With such a function there is the concern about each call reopening the registry, but we can see if that's actually a problem and how a different API (or some sort of caching) may help.
--
v3: winewayland: Support "UseSystemCursors" driver option.
winewayland: Use system cursor shapes when possible.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7678
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
--
v2: windowscodecs/metadata: Create default item for the gAMA reader.
windowscodecs/metadata: Make it possible to populate default items at creation time.
windowscodecs/metadata: Pass handler pointer to the loader implementation.
windowscodecs/metadatahandler: Remove unused internal vtable entries.
windowscodecs/tests: Add some tests for GetMetadataHandlerInfo().
windowscodecs/tests: Add some more tests for creating metadata readers.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7776
This makes some of the wine build tools handle LTO properly (when passed via CFLAGS/LDFLAGS in some way). Of course more work is needed for a successful build with LTO, but not that far fetched honestly (asm functions are the biggest issue, also because they can call "seemingly unused" C functions which have to be marked with the `used` attribute). But that's for other MRs not related to wine tools.
--
v2: tools/winegcc: Pass relevant LTO options also to the linker.
tools/winebuild: Try gcc-* prefixed utils first.
https://gitlab.winehq.org/wine/wine/-/merge_requests/4908
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51357
Now that we're tracking window position changes as they arrive, they should always be consistent with the received mouse input events.
Absolute rawinput is useful for tablets, touchpad or touchscreen when they are exposed as absolute mouse devices.
--
v3: winex11: Use window-relative coordinates for mouse input.
winex11: Add support for absolute position in RawMotion events.
winex11: Clear the MOUSEEVENTF_MOVE flag when accumulating motion.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7429
--
v4: amstream: Implement dynamic formats in ddraw stream.
amstream/tests: Test for dynamic formats in ddraw stream.
amstream: Implement custom allocator for ddraw stream.
amstream/tests: Test for custom allocator in ddraw stream.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7715
This introduces a faster implementation of signal and wait operations on NT
events, semaphores, and mutexes, which improves performance to native levels for
a wide variety of games and other applications.
The goal here is similar to the long-standing out-of-tree "esync" and "fsync"
patch sets, but without the flaws that make those patch sets not upstreamable.
The Linux "ntsync" driver is not currently released. It has been accepted into
the trunk Linux tree for 6.14, so barring any extraordinary circumstances, the
API is frozen and it will be released in its current form in about 2 months.
Since it has passed all relevant reviewers on the kernel side, and the API is
all but released, it seems there is no reason any more not to submit the Wine
side to match.
Some important notes:
* This patch set does *not* include any way to disable ntsync support, since
that kind of configuration often seems to be dispreferred where not necessary.
In essence, ntsync should just work everywhere.
Probably the easiest way to effectively disable ntsync, for the purposes of
testing, is to chmod the /dev/ntsync device to prevent its being opened.
Regardless, a Wine switch to disable ntsync can be added simply enough. Note
that it should probably not take the form of a registry key, however, since it
needs to be easily accessible from the server itself.
* It is, generally speaking, not possible for only some objects, or some
processes, to have backing ntsync objects, while others use the old server
path. The esync/fsync patch sets explicitly protected against this by making
sure every process had a consistent view of whether esync was enabled. This is
not provided here, since no switch is provided to toggle ntsync, and it should
not be possible to get into such an inconsistent state without gross
misconfiguration.
* Similarly, no diagnostic messages are provided to note that ntsync is in use,
or not in use. These messages are part of esync/fsync, as well as part of
ntsync "testing" trees unofficially distributed. However, if ntsync is working
correctly, no message should be necessary.
The basic structure is:
* Each type of server object which can be waited on by the client (including
events, semaphores, mutexes, but also other types such as processes, files)
must store an "inproc_sync" object.
This "inproc_sync" object is a full server object (note that this differs from
esync/fsync). A vector and server request is introduced to retrieve an NT
handle to this object from an arbitrary NT handle.
Since the actual ntsync objects are simply distinct file descriptions, we then
call get_handle_fd from the client to retrieve an fd to the object, and then
perform ioctls on it.
* Objects signaled by the server (processes, files, etc) perform ntsync ioctls
on that object. The backing object in all such cases is simply an event.
* Signal and wait operations on the client side attempt to defer to an
"inproc_\*" function, falling back to the server implementation if it returns
STATUS_NOT_IMPLEMENTED. This mirrors how in-process synchronization objects
(critical sections, SRW locks, etc) used to be implemented—attempting to use
an architecture-specific "fast_\*" function and falling back if it returned
STATUS_NOT_IMPLEMENTED.
* The inproc_sync handles, once retrieved, are cached per-process. This caching
takes a similar form to the fd cache. It does not reuse the same
infrastructure, however.
The primary reason for this is that the fd cache is designed to fit within a
64-bit value and uses 64-bit atomic operations to ensure consistency. However,
we need to store more than 64 bits of information. [We also need to modify
them after caching, in order to correctly implement handle closing—see below.]
The secondary reason is that retrieving the ntsync fd from the inproc_sync
handle itself uses the fd cache.
* In order to keep the Linux driver simple, it does not implement access flags
(EVENT_MODIFY_STATE etc.) Instead, the flags are cached locally and validated
there. This too mirrors the fd cache. Note that this means that a malicious
process can now modify objects it should not be able modify—which is less true
than it is with wineserver—but this is no different from the way other objects
(notably fds) are handled, and would require manual syscalls.
* In order to achieve correct behaviour related to closing objects while they
are used, this patch set essentially relies on refcounting. This is broadly
true of the server as well, but because we need to avoid server calls when
performing object operations, significantly more care must be taken.
In particular, because waits need to be interruptable by signals and then be
restarted, we need the backing ntsync object to remain valid until all users
are done with it. On a process level, this is achieved by letting multiple
processes own handles to the underlying inproc_sync server object.
On a thread level, multiple simultaneous calls need to refcount the process's
local handle. This refcount is stored in the sync object cache. When it
reaches zero, the cache is cleared.
Punting this behaviour to the Linux driver would have introduced a great deal
more complexity, which is best kept in userspace and out of the kernel.
* The cache is, as such, treated as a cache. The penultimate commit, which
introduces client support but does not yet cache the objects, effectively
illustrates this by never actually caching anything, and retrieving a new NT
handle and fd every time.
* Certain waits, on internal handles (such as async, startup_info, completion),
are delegated to the server even when ntsync is used. Those server objects do
not create an underlying ntsync object.
--
v5: ntdll: Cache in-process synchronization objects.
ntdll: Use server_wait_for_object() when waiting on only the queue object.
ntdll: Use in-process synchronization objects.
ntdll: Introduce a helper to wait on an internal server handle.
server: Allow creating an event object for client-side user APC signaling.
server: Introduce select_inproc_queue and unselect_inproc_queue requests.
server: Add a request to retrieve the in-process synchronization object from a handle.
server: Create in-process synchronization objects for fd-based objects.
server: Create in-process synchronization objects for timers.
server: Create in-process synchronization objects for threads.
server: Create in-process synchronization objects for message queues.
server: Create in-process synchronization objects for jobs.
server: Create in-process synchronization objects for processes.
server: Create in-process synchronization objects for keyed events.
server: Create in-process synchronization objects for device managers.
server: Create in-process synchronization objects for debug objects.
server: Create in-process synchronization objects for console outputs.
server: Create in-process synchronization objects for console inputs.
server: Create in-process synchronization objects for screen buffers.
server: Create in-process synchronization objects for console servers.
server: Create in-process synchronization objects for consoles.
server: Create in-process synchronization objects for completion ports.
server: Create in-process synchronization objects for mutexes.
server: Create in-process synchronization objects for semaphores.
server: Create in-process synchronization objects for events.
server: Add an object operation to retrieve an in-process synchronization object.
ntdll: Retrieve and cache an ntsync device in wait calls.
ntdll: Add stub functions for in-process synchronization.
ntdll: Add some traces to synchronization methods.
This merge request has too many patches to be relayed via email.
Please visit the URL below to see the contents of the merge request.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7226
WMSyncReader starts a background read thread that reads from the IStream
passed to IWMSyncReader::OpenStream. This means it could use the IStream in the
background even when no IWMSyncReader methods are being called.
For well-behaved applications, this is probably OK. However, AQUARIUM
(Steam 2515070) frees the IStream it passes to WMSyncReader _before_
it calls IWMSyncReader::Close, which stops the read thread. This causes
the read thread to access freed memory. This is improper, but not
unreasonable, as IWMSyncReader is supposed to be a synchronous
interface, so one might assume when they weren't calling into
IWMSyncReader methods, the IStream won't be used.
This commit adds a `wg_parser_dont_read` function, which can be used to
stop wg_parser from issuing read requests. This is used by IWMSyncReader
to make sure read requests are only issued when IWMSyncReader methods
are being called.
--
v2: winegstreamer: Make sure WMSyncReader never reads in the background.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7676