On Sun Dec 1 21:39:49 2024 +0000, Robbert van der Helm wrote:
> Thanks for the detailed write up! I only ran into this commit after
> bisecting the changes between Wine 9.21 and 9.22, so I'm almost
> certainly missing some context!
> The problem I'm facing seems to be that as soon as `SWP_STATECHANGED` is
> set and `window_set_wm_state()` gets called, `data->wm_state_serial`
> gets stuck on a nonzero value since it's set to the X11 connection's
> next sequence number and is then never cleared again. That causes
> `window_update_client_config()` to always bail before it does anything,
> which in turn causes the `NtUserPostMessage( hwnd,
> WM_WINE_WINDOW_STATE_CHANGED, 0, 0 )` called from
> `X11DRV_ConfigureNotify()` to not do anything anymore.
> This doesn't seem to cause any problems under normal use cases, since
> normally once a window is mapped, its coordinates relative to the root
> window will never suddenly change (not sure if there's a spicy
> interaction with multiple monitors though). But in yabridge I have to
> reparent a Wine window to another window, and to make that work I've
> always had to send these `ConfigureNotify` events to inform Wine about
> the window's actual position on screen. Otherwise it thinks it's located
> in the top left corner of the screen, and all mouse events will be at an offset.
> I can open a regression bug report on bugs.winehq.org, but since what
> yabridge is doing is almost certainly not the ended way to interact with
> Wine, I thought I'd check here first.
`wm_state_serial` should be cleared when the window state actually changes and the `WM_STATE` PropertyNotify event is received, calling `window_wm_state_notify` which clears it.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6569#note_89396
This PR updates the behaviour of `NtQueryDirectoryFile`, bringing it in line with current Windows behaviour. The need for this update was discovered when attempting to build the Unreal Engine with MSVC under Wine. In certain cases conditional include statements do not behave as expected, due to MSVC depending on undocumented behaviour of `NtQueryDirectoryFile`.
We ran tests on multiple versions of Windows, and discovered that the behaviour has changed since the original Wine implementation, but the documentation has not. The source code for our test tool, and a set of results can be found [here](https://github.com/TensorWorks/NtQueryDirectoryFile-Test). As of Windows 8, calling `NtQueryDirectoryFile` with a re-used handle, a new mask, and setting the `RestartScan` flag to True, causes the cached results to be erased and a new scan to be performed with the updated mask. Currently, Wine performs as did earlier versions of Windows, where the changed mask is ignored, and the cache is reused. This can cause `NtQueryDirectoryFile` under Wine to falsely report that files exist, when they do not.
This PR corrects this behaviour, invalidating the cache when required. Implementing this exposed further undocumented behaviour of `NtQueryDirectoryFile`, where a search for a non-existent file will return either `STATUS_NO_MORE_FILES` or `STATUS_NO_SUCH_FILE`, depending on whether or not the handle had been previously used regardless of the value of `RestartScan`. This was reflected in a `winetest` which allowed for the response to be either `STATUS_SUCCESS` or `STATUS_NO_MORE_FILES`. This test has been updated to only allow current Windows behaviour, and `NtQueryDirectoryFile` will return either `STATUS_NO_MORE_FILES` or `STATUS_NO_SUCH_FILE` as appropriate.
This patch also adds unit tests for the new behaviour of `NtQueryDirectoryFile`. These tests pass when running `winetest` under Windows, and under Wine with these changes in place, but they will fail under older versions of Wine.
--
v3: ntdll: Test updated NtQueryDirectoryFile behaviour if scan is reset with a new mask
https://gitlab.winehq.org/wine/wine/-/merge_requests/6904
On Sun Dec 1 21:51:09 2024 +0000, Jinoh Kang wrote:
> This looks wrong. Unless I've mistaken, this should be the thread that
> *initiated* the wait (like, the one that created or associated the wait
> completion packet), not `current`.
I'd advise you to test WaitCompletionPacket againat waitable objects that use `get_wait_queue_thread()`, including keyed events, mutexes, and message queue objects (not exposed via Win32 API, only at win32k level).
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6911#note_89385
Jinoh Kang (@iamahuman) commented about server/thread.c:
> return 0;
> }
>
> +int is_obj_signaled( struct object *obj )
> +{
> + struct wait_queue_entry wait_entry;
> + struct thread_wait wait = {0};
> +
> + if (!obj->ops->signaled)
> + return 0;
> +
> + wait.thread = current;
This looks wrong. Unless I've mistaken, this should be the thread that *initiated* the wait (like, the one that created or associated the wait completion packet), not `current`.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6911#note_89384
On Sun Dec 1 20:18:56 2024 +0000, Rémi Bernon wrote:
> Hi, I don't think this checks does what you describe.
> This specific `if` is there for *unmanaged* windows, which are X
> override-redirect windows which are fully under Wine control, and which
> won't receive WM_STATE property changes. We clear the `wm_state_serial`
> for them, in order to allow sending more window state changes without
> waiting, as well as window configure requests. That if doesn't set
> wm_state_serial, it clears it, and it shouldn't prevent the
> `ConfigureNotify` to be processed, rather the other way around.
> For *managed* windows, when Wine requests a window state change, the
> Window Manager is supposed to change the `WM_STATE` property accordingly
> once it is done, and we should then receive the corresponding
> `PropertyNotify` event. We still process `ConfigureNotify` events, but
> we don't apply them to the Win32 state until all the requested changes
> have been processed.
> If the `WM_STATE` property isn't modified or isn't present, then yes the
> Win32 state will appear to be stuck forever. This is however a bug in
> the window manager, according to the ICCCM, and we can really only
> support ICCCM-compatible window manager (or just uncheck "allow the
> window manager to manage the windows" in `winecfg`).
> In any case, `ConfigureNotify` events are always processed, and applied
> to the Win32 state when there's no reason to wait. XEMBED support may be
> what makes a difference here, as we used only for systray embedded
> windows. I don't think any other use case was very intended before or
> well supported, and there's assumptions being made that embedded windows
> are always systray windows
> It's probably possible to support it better, and maybe even easier to do
> so now that we track X parent and embedder windows without leaking them
> into the Win32 space anymore. If there's a regression, please open a bug
> on bugs.winehq.org, describe your use case with reproducible steps, and
> we will try to fix it.
Thanks for the detailed write up! I only ran into this commit after bisecting the changes between Wine 9.21 and 9.22, so I'm almost certainly missing some context!
The problem I'm facing seems to be that as soon as `SWP_STATECHANGED` is set and `window_set_wm_state()` gets called, `data->wm_state_serial` gets stuck on a nonzero value since it's set to the X11 connection's next sequence number and is then never cleared again. That causes `window_update_client_config()` to always bail before it does anything, which in turn causes the `NtUserPostMessage( hwnd, WM_WINE_WINDOW_STATE_CHANGED, 0, 0 )` called from `X11DRV_ConfigureNotify()` to not do anything anymore.
This doesn't seem to cause any problems under normal use cases, since normally once a window is mapped, its coordinates relative to the root window will never suddenly change (not sure if there's a spicy interaction with multiple monitors though). But in yabridge I have to reparent a Wine window to another window, and to make that work I've always had to send these `ConfigureNotify` events to inform Wine about the window's actual position on screen. Otherwise it thinks it's located in the top left corner of the screen, and all mouse events will be at an offset.
I can open a regression bug report on bugs.winehq.org, but since what yabridge is doing is almost certainly not the ended way to interact with Wine, I thought I'd check here first.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6569#note_89383
On Sun Dec 1 18:46:02 2024 +0000, Robbert van der Helm wrote:
> Hi!
> This specific check causes `ConfigureNotify` events to no longer be
> processed by top level windows (i.e. managed) windows. as
> `wm_state_serial` will be set but never cleared again. For the last
> couple years I've been sending `ConfigureNotify` events to a reparented
> window to embed Wine windows into other X11 windows, but this specific
> check breaks that for Wine 9.22. Wine's XEmbed support (which never
> worked quite as well as the reparent+`ConfigureNotify` approach) also
> does not seem to work anymore with recent Wine releases.
> My question is: is this check necessary to prevent other undesirable
> interactions and if so, what's the current best way to send X11 window
> configuration events to Wine windows?
> More context: https://github.com/robbert-vdh/yabridge/issues/382#issuecomment-2510155844
Hi, I don't think this checks does what you describe.
This specific `if` is there for *unmanaged* windows, which are X override-redirect windows which are fully under Wine control, and which won't receive WM_STATE property changes. We clear the `wm_state_serial` for them, in order to allow sending more window state changes without waiting, as well as window configure requests. That if doesn't set wm_state_serial, it clears it, and it shouldn't prevent the `ConfigureNotify` to be processed, rather the other way around.
For *managed* windows, when Wine requests a window state change, the Window Manager is supposed to change the `WM_STATE` property accordingly once it is done, and we should then receive the corresponding `PropertyNotify` event. We still process `ConfigureNotify` events, but we don't apply them to the Win32 state until all the requested changes have been processed.
If the `WM_STATE` property isn't modified or isn't present, then yes the Win32 state will appear to be stuck forever. This is however a bug in the window manager, according to the ICCCM, and we can really only support ICCCM-compatible window manager (or just uncheck "allow the window manager to manage the windows" in `winecfg`).
In any case, `ConfigureNotify` events are always processed, and applied to the Win32 state when there's no reason to wait. XEMBED support may be what makes a difference here, as we used only for systray embedded windows. I don't think any other use case was very intended before or well supported, and there's assumptions being made that embedded windows are always systray windows
It's probably possible to support it better, and maybe even easier to do so now that we track X parent and embedder windows without leaking them into the Win32 space anymore. If there's a regression, please open a bug on bugs.winehq.org, describe your use case with reproducible steps, and we will try to fix it.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6569#note_89382
Robbert van der Helm (@robbert-vdh) commented about dlls/winex11.drv/window.c:
> if (!data->embedded) XIconifyWindow( data->display, data->whole_window, data->vis.screen );
> break;
> }
> +
> + /* override redirect windows won't receive WM_STATE property changes */
> + if (!data->managed) data->wm_state_serial = 0;
Hi!
This specific check causes `ConfigureNotify` events to no longer be processed by top level windows (i.e. managed) windows. as `wm_state_serial` will be set but never cleared again. For the last couple years I've been sending `ConfigureNotify` events to a reparented window to embed Wine windows into other X11 windows, but this specific check breaks that for Wine 9.22. Wine's XEmbed support (which never worked quite as well as the reparent+`ConfigureNotify` approach) also does not seem to work anymore with recent Wine releases.
My question is: is this check necessary to prevent other undesirable interactions and if so, what's the current best way to send X11 window configuration events to Wine windows?
More context: https://github.com/robbert-vdh/yabridge/issues/382#issuecomment-2510155844
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6569#note_89380
The idea is to use common helper to convert between CP_ACP and WCHAR strings first. Later all functions will be switched to support UTF-8 at the same time.
--
v2: msvcrt: Call _wfullpath in _fullpath function.
msvcrt: Call _wgetdcwd in _getdcwd function.
msvcrt: Call _wgetcwd in _getcwd function.
msvcrt: Call _wchdir in _chdir function.
msvcrt: Call _wrmdir in _rmdir function.
msvcrt: Call _wmkdir in _mkdir function.
https://gitlab.winehq.org/wine/wine/-/merge_requests/6937
The idea is to use common helper to convert between CP_ACP and WCHAR strings first. Later all functions will be switched to support UTF-8 at the same time.
--
v3: msvcrt: Call _wfullpath in _fullpath function.
msvcrt: Call _wgetdcwd in _getdcwd function.
msvcrt: Call _wgetcwd in _getcwd function.
https://gitlab.winehq.org/wine/wine/-/merge_requests/6937
Recent changes allowed the Wayland driver to properly deal with numpad keys depending on numlock status. This MR ensures that numlock and other lock state is properly synced, and concludes the fix for https://bugs.winehq.org/show_bug.cgi?id=56397.
This MR also syncs the key press state when a window gains keyboard focus, including any modifier press state. Note that we currently ignore the modifier press information from the `modifier` event, since: 1. it doesn't differentiate between left-right keys, 2. mod press state changes will be normally preceded by a matching key event, so we are able to sync properly. However, if we find that we need to handle mod press state changes without corresponding key events, we will need to implement some sensible way to sync these, too.
Although I would like for the driver work exclusively in terms of scancodes, I still needed to use vkeys in this case, since this is how wineserver expresses keyboard state at the moment. This means that I had to introduce/duplicate some extra scan->vkey logic in the driver (e.g., numpad keys based on numlock state) to get things right.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5712
This MR adds support for getting a Bluetooth adapter's properties from its corresponding `org.bluez.Adapter1` object, and making them available to userspace via device properties and the `IOCTL_BTH_GET_LOCAL_INFO` ioctl, updating these properties whenever a `PropertiesChanged` signal is received for the adapter.
It also adds code for creating and removing radio PDOs on receiving `InterafacesAdded` and `InterfacesRemoved` signals from BlueZ, respectively.
--
v2: winebth.sys: Implement IOCTL_BTH_GET_LOCAL_INFO.
winebth.sys: Update radio PDO properties on receiving PropertiesChanged for an org.bluez.Adapter1 object.
winebth.sys: Remove the corresponding radio PDO on receiving InterfacesRemoved for a org.bluez.Adapter1 object.
winebth.sys: Create new radio PDOs on receiving InterfacesAdded for objects that implement org.bluez.Adapter1.
winebth.sys: Set radio PDO properties from the device's corresponding org.bluez.Adapter1 object properties.
https://gitlab.winehq.org/wine/wine/-/merge_requests/6936
This MR adds support for getting a Bluetooth adapter's properties from its corresponding `org.bluez.Adapter1` object, and making them available to userspace via device properties and the `IOCTL_BTH_GET_LOCAL_INFO` ioctl, updating these properties whenever a `PropertiesChanged` signal is received for the adapter.
It also adds code for removing the radio PDO if BlueZ notifies us that the adapter's interface is no longer available.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6936
--
v2: d2d1: Implement nodes connection for ID2D1TransformGraph.
d2d1: Implement nodes adding and removal for ID2D1TransformGraph.
d2d1/tests: Add more tests for ID2D1TransformGraph.
https://gitlab.winehq.org/wine/wine/-/merge_requests/698
This serie is a first attempt to provide a solution to bug 57308 [1](https://bugs.winehq.org/show_bug.cgi?id=57308).
Basically, Arch distro is looking for Wine support in distributing debug information for Wine PE modules separated from image.
A quick overview of distro (Debian, Fedora, Arch) situation i (I may have missed a couple of items), but:
- no distro ship separate debug information for PE modules (they do it for ELF ones though)
- at best, they ship unstripped PE modules.
IMO, we need to help them pave the way to what should be the best expected situation (in Wine and wrt distros) to support separate debug information for PE images.
First, I believe we need to use a (solid) key to bind the stripped image and the file holding the debug information. In ELF format, this is typically done by inserting a .note.gnu.build-id section (in both stripped image and debug information file) which contains the key. This key is used to either search in fixed location (eg /usr/lib/.debug), or as key to download the debug information from a remote server (debuginfod). The key is generally made of a hash of (some sections of) the image file. This allows (esp. in the case of downloading the debug information from a debugger) to discriminate between several versions of the same module.
I think we should target this kind of solution instead of storing the debug information alongside the module (usually done as ntdll.dll.debug). This wouldn't let debuggers download the expected debug info upon request.
Fortunately, gcc and clang provide a build-id option (when generating PE images) which stores this key in the PE image.
What this serie does:
- fixes & improves dbghelp in the support of the build-id information from gcc/mingw & clang,
- improves Wine's configure script so that clang can be used to generate dwarf debug information and build-id information in PE builds,
- adds a couple of additional search locations for debug information files,
It takes the following assumptions for the storage:
- debug information files for PE images are stored in same hierarchy as debug information files for ELF images (eg /usr/lib/.debug)
- naming of such files is done as ELF, ie by using the hex string generated from the binary blob of the key. This is _NOT_ the usual way how the GUID will be printed (because the first 3 integers of the GUID are stored in little-endian format). (Note: I had to make a choice here. I don't have strong arguments one way or the other, but we need to agree on the convention here).
What distro should do to support separate debug info:
- configure Wine with --enable-build-id
- adapt at least the packaging tool to extract the key out of unstripped image \[2\],
- if binutils isn't compiled with PE support (this is apparently the Arch case), adapt the scripts to use x86_64-objcopy instead of objcopy (and friends).
I marked this MR as draft for now, as:
- I still need to polish some items (like the default location for looking up debug information files),
- wait for feedback on this proposal (it does make a couple of assumptions that need sharing IMO),
Further steps:
- the steps above are mainly targetted to have a solution for packaged download of debug information files,
- this should be integrated in debuginfod (server side: ingestion of PE files and client side: ensure gdb, lldb are compatible; implement debuginfod in winedbg).
Feed back welcomed!
\[2\]:
The least invasive readelf replacement (assuming binutils is compiled with PE support). (otherwise, use x86_64-objdump)
```
BUILDID=`objdump -p "$INPUT" | sed -n "/RSDS signature / {s/.*signature //; s/ age.*//p; q;}"`
BUILDID=${BUILDID:6:2}${BUILDID:4:2}${BUILDID:2:2}${BUILDID:0:2}${BUILDID:10:2}${BUILDID:8:2}${BUILDID:14:2}${BUILDID:12:2}${BUILDID:16}
```
Additional note: gcc/mingw puts the desired debug entry inside a dedicated section (.buildid), while clangs keeps it in .rdata (as msvc does). So, this invalidates any attempt to get information from the .buildid section (as stated in bug report).
--
v3: configure.ac: Ensure dwarf debug sections are kept with clang with build-id enabled.
dbghelp: Search debug info with buildid for RSDS debug entry w/o filenames.
dbghelp: Extend search for buildid in system directories.
https://gitlab.winehq.org/wine/wine/-/merge_requests/6715
Needed by Just Cause 4.
--
v3: windows.networking.connectivity: Implement IConnectionProfile::GetNetworkConnectivityLevel().
windows.networking.connectivity/tests: Add INetworkInformationStatics::GetInternetConnectionProfile() tests.
https://gitlab.winehq.org/wine/wine/-/merge_requests/6917
6d1df55bf3b6051ad61e9c7cb7d63f13c1b9771f changed `NtQuerySystemInformation(SystemFirmwareTableInformation, ...)` to return 0 on error, which left `get_firmware_table` returning -16
This would be interpreted as a very large number by applications, breaking them.
--
v2: kernelbase: Add test for EnumSystemFirmwareTables on missing provider.
https://gitlab.winehq.org/wine/wine/-/merge_requests/6929
6d1df55bf3b6051ad61e9c7cb7d63f13c1b9771f changed `NtQuerySystemInformation(SystemFirmwareTableInformation, ...)` to return 0 on error, which left `get_firmware_table` returning -16
This would be interpreted as a very large number by applications, breaking them.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6929
--
v5: mshtml: Don't expose some props from document prototype depending on mode.
mshtml: Expose the right props from document fragments.
mshtml: Use DocumentPrototype as the document's prototype for modes prior
mshtml: Move HTMLDocument prototype props to the Document prototype.
https://gitlab.winehq.org/wine/wine/-/merge_requests/6927
On Fri Nov 29 17:14:34 2024 +0000, Gabriel Ivăncescu wrote:
> This seems to give me test failures about not finding "title" element,
> only on wine. I assume we lack something to automatically put a title if
> missing. What should I do?
Ah, that's one of those parser differences with Gecko. Let's leave it as you did for now then.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6927#note_89251
On Fri Nov 29 17:00:58 2024 +0000, Jacek Caban wrote:
> Let's try to avoid adding more strings here. You could change
> `test_docfrag` to use `set_body_html` and then use the existing `doc_blank`/`doc_blank_ie9`.
This seems to give me test failures about not finding "title" element, only on wine. I assume we lack something to automatically put a title if missing. What should I do?
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6927#note_89250
Jacek Caban (@jacek) commented about dlls/mshtml/tests/dom.c:
> static const char emptydiv_str[] =
> "<html><head><title>emptydiv test</title></head>"
> "<body><div id=\"divid\"></div></body></html>";
> +static const char emptydiv_ie9_str[] =
> + "<html><head><meta http-equiv=\"x-ua-compatible\" content=\"IE=9\"/><title>emptydiv test</title></head>"
> + "<body><div id=\"divid\"></div></body></html>";
Let's try to avoid adding more strings here. You could change `test_docfrag` to use `set_body_html` and then use the existing `doc_blank`/`doc_blank_ie9`.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6927#note_89249
Jacek Caban (@jacek) commented about dlls/mshtml/mshtml_private.h:
>
> /* Used by objects that want to delay their compat mode initialization until actually needed */
> HTMLInnerWindow *(*get_script_global)(DispatchEx*);
> + dispex_static_data_t *(*get_dispex_data)(DispatchEx*);
Could we just extend `get_script_global` instead? Other than document objects, it's used only for windows anyways.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6927#note_89248
--
v3: mshtml: Don't expose some props from document prototype depending on mode.
mshtml: Expose the right props from document fragments.
mshtml: Use DocumentPrototype as the document's prototype for modes prior
mshtml: Move HTMLDocument prototype props to the Document prototype.
https://gitlab.winehq.org/wine/wine/-/merge_requests/6927
--
v2: mshtml: Don't expose some props from document prototype depending on mode.
mshtml: Expose the right props from document fragments.
mshtml: Use DocumentPrototype as the document's prototype for modes prior
mshtml: Move HTMLDocument prototype props to the Document prototype.
https://gitlab.winehq.org/wine/wine/-/merge_requests/6927
--
v3: winevulkan: Use a vulkan_object header for other wrappers.
winevulkan: Introduce a new vulkan_swapchain base structure.
winevulkan: Introduce a new vulkan_surface base structure.
winevulkan: Introduce a new vulkan_queue base structure.
winevulkan: Restore some wine_*_from_handle helpers.
winevulkan: Introduce a new vulkan_device base structure.
winevulkan: Name wine_device parameters and variables more consistently.
https://gitlab.winehq.org/wine/wine/-/merge_requests/6916
This removes the window rect checks that were there to unmap visible windows when they are outside of the virtual screen. Since the recent changes to window config update, and the removal of WindowPosChanged re-entry guards, we now more accurately match the states between win32, winex11 and X server and it caused some windows to now be unmapped spuriously. This happens when the window manager positions the outside of what we believe is the virtual screen, for instance with embedded or FVWM virtual desktops.
I am not sure what unmapping offscreen windows is for exactly, I suspect it is to allow some windows to be moved offscreen even though the WM would probably not allow it with visible windows. I think that if windows are managed by the host WM, we should allow it to control and constraint the windows to be on-screen if it decides so. Alternatively we could perhaps decide to minimize them instead (as a winex11 internal state, without notifying the Win32 side of minimization), as unmapping the windows will also make them disappear from the window selector, and makes it impossible to focus them back.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57472
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57474
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6926
I wish there was a nicer way to do this, but SystemSupportedProcessorArchitectures is incomplete on ARM64EC even on Windows so there isn't really a cleaner way I can find.
--
v3: msi: Dynamically determine supported package architectures.
msi: Assume PLATFORM_INTEL if the template property is missing.
https://gitlab.winehq.org/wine/wine/-/merge_requests/6838
These changes are the documented way to implement IMFMediaEventGenerator for a media source. On top of !6783 it seems to greatly reduce the chance of hanging while switching characters in Killsquad if tracing is not enabled.
--
v4: winegstreamer: Send media source shutdown notification via IMFMediaShutdownNotify.
mf: Introduce IMFMediaShutdownNotify for notification of media source shutdown.
mf: Handle media source Start() failure due to source shutdown.
mf: Handle media source event subscription failure due to source shutdown.
mf: Handle media source BeginGetEvent() failure due to shutdown.
mf: Handle media source EndGetEvent() failure due to shutdown.
mf/tests: Add tests for shutting down a media source used in a session.
winegstreamer: Return the result code from media_source_Pause().
https://gitlab.winehq.org/wine/wine/-/merge_requests/6800
This PR updates the behaviour of `NtQueryDirectoryFile`, bringing it in line with current Windows behaviour. The need for this update was discovered when attempting to build the Unreal Engine with MSVC under Wine. In certain cases conditional include statements do not behave as expected, due to MSVC depending on undocumented behaviour of `NtQueryDirectoryFile`.
We ran tests on multiple versions of Windows, and discovered that the behaviour has changed since the original Wine implementation, but the documentation has not. The source code for our test tool, and a set of results can be found [here](https://github.com/TensorWorks/NtQueryDirectoryFile-Test). As of Windows 8, calling `NtQueryDirectoryFile` with a re-used handle, a new mask, and setting the `RestartScan` flag to True, causes the cached results to be erased and a new scan to be performed with the updated mask. Currently, Wine performs as did earlier versions of Windows, where the changed mask is ignored, and the cache is reused. This can cause `NtQueryDirectoryFile` under Wine to falsely report that files exist, when they do not.
This PR corrects this behaviour, invalidating the cache when required. Implementing this exposed further undocumented behaviour of `NtQueryDirectoryFile`, where a search for a non-existent file will return either `STATUS_NO_MORE_FILES` or `STATUS_NO_SUCH_FILE`, depending on whether or not the handle had been previously used regardless of the value of `RestartScan`. This was reflected in a `winetest` which allowed for the response to be either `STATUS_SUCCESS` or `STATUS_NO_MORE_FILES`. This test has been updated to only allow current Windows behaviour, and `NtQueryDirectoryFile` will return either `STATUS_NO_MORE_FILES` or `STATUS_NO_SUCH_FILE` as appropriate.
This patch also adds unit tests for the new behaviour of `NtQueryDirectoryFile`. These tests pass when running `winetest` under Windows, and under Wine with these changes in place, but they will fail under older versions of Wine.
--
v2: ntdll: Test updated NtQueryDirectoryFile behaviour if scan is reset with a new mask
ntdll: Update NtQueryDirectoryFile to purge cache if scan is reset with a new mask
https://gitlab.winehq.org/wine/wine/-/merge_requests/6904
I've dropped the change that adds support for utf-8 during conversion for now. It needs more work - it should be supported in some files/directories/process/environment related functions. It would be good to switch all of the functions in one patch. There's quite a big change that this changes will introduce some regressions.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6680#note_89123