QueryInterface should set *out to NULL on failure, as it seems to do in many different places.
This seems to be a regression from !888.
One old game started to crash on startup with this merge request.
I bisected it and it pointed to the commit 131ada052a2dbec66df695ce536ca048a2bd9174.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/2130
On Wed Feb 8 01:17:39 2023 +0000, Torge Matthies wrote:
> I can remove the second commit if desired, the first commit is enough to
> make performance acceptable again.
Also note that there are some more details about the commits in the commit message bodies.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/2114#note_23391
The practical issue I am trying to solve is the following scenario (encountered with a game using some Uplay plugin) which has regressed with apisets implementation in Wine. The game imports ucrtbase.dll. Then, a plugin calls GetModuleHandle("api-ms-win-crt-runtime-l1-1-0.dll") and expects GetProcAddress("\_crt_atexit") to succeed on the returned handle. The problem is that the game has ucrtbase.dll in its .exe directory. That one currently gets loaded. Then, find_dll_file() resolves api-ms-win-crt-runtime-l1-1-0.dll to the ucrtbase with a full path in system32 and tries to find that one (this part matches Windows behaviour as far as tests show). Since we have ucrtbase loaded with another path this results in NULL module handle.
Windows maintains the list of "Known DLLs" (probably aimed for speeding up processes startup by using pre-mapped dll images for commonly used system dlls). On Windows, known dlls have specifics in load path resolution when dll name doesn't contain path (relative or full):
- they are loaded from system directory even if there is another dll with the same name in priority search path;
- they are found even if library search paths do not contain system directory;
Those "Known DLLs" are basically listed in HKLM\\System\\CurrentControlSet\\Control\\Session Manager\KnownDLLs registry key. But the actual list of "known dlls" is bigger (probably includes all dependencies of those listed under registry key). The full actual list of "known dlls" is in '\\KnownDlls\' directory object which contains image sections under dll names. Most notably, ucrtbase.dll (which is of the concern in the regression) is not listed in registry but is present in \\KnownDlls. Technically nothing prevents us from implementing these mechanics and creating directory object with mapped load dlls, also resolving the explicitly listed dlls' dependencies. But it is not apparent to me if that is going to improve load times noticably in Wine, and also that is worth the inherent complications until anything actually depends on that \\KnownDlls sections. So instead of implementing all of that throughout the loader I added a few missing dlls to registry. The current list in this pat
chset corresponds to the contents of \\KnownDlls directory on an up to date Windows 10.
--
v2: ntdll: Load known dlls from system directory.
https://gitlab.winehq.org/wine/wine/-/merge_requests/2127
The practical issue I am trying to solve is the following scenario (encountered with a game using some Uplay plugin) which has regressed with apisets implementation in Wine. The game imports ucrtbase.dll. Then, a plugin calls GetModuleHandle("api-ms-win-crt-runtime-l1-1-0.dll") and expects GetProcAddress("\_crt_atexit") to succeed on the returned handle. The problem is that the game has ucrtbase.dll in its .exe directory. That one currently gets loaded. Then, find_dll_file() resolves api-ms-win-crt-runtime-l1-1-0.dll to the ucrtbase with a full path in system32 and tries to find that one (this part matches Windows behaviour as far as tests show). Since we have ucrtbase loaded with another path this results in NULL module handle.
Windows maintains the list of "Known DLLs" (probably aimed for speeding up processes startup by using pre-mapped dll images for commonly used system dlls). On Windows, known dlls have specifics in load path resolution when dll name doesn't contain path (relative or full):
- they are loaded from system directory even if there is another dll with the same name in priority search path;
- they are found even if library search paths do not contain system directory;
Those "Known DLLs" are basically listed in HKLM\\System\\CurrentControlSet\\Control\\Session Manager\KnownDLLs registry key. But the actual list of "known dlls" is bigger (probably includes all dependencies of those listed under registry key). The full actual list of "known dlls" is in '\\KnownDlls\' directory object which contains image sections under dll names. Most notably, ucrtbase.dll (which is of the concern in the regression) is not listed in registry but is present in \\KnownDlls. Technically nothing prevents us from implementing these mechanics and creating directory object with mapped load dlls, also resolving the explicitly listed dlls' dependencies. But it is not apparent to me if that is going to improve load times noticably in Wine, and also that is worth the inherent complications until anything actually depends on that \\KnownDlls sections. So instead of implementing all of that throughout the loader I added a few missing dlls to registry. The current list in this pat
chset corresponds to the contents of \\KnownDlls directory on an up to date Windows 10.
--
v3: ntdll: Load known dlls from system directory.
https://gitlab.winehq.org/wine/wine/-/merge_requests/2127
On Ventura (and likely also on Monterey), `dyld`/`libc` seems to store the `environ` pointer from when the preloader launches, ignores any change to `environ` done in the preloader, and then uses that original `environ` in the launched wine process.
The preloader has to move the start of the environment down by one, and this was causing the first variable to be lost on Monterey/Ventura. Instead of moving the entire environment, add a dummy variable at the beginning so nothing important is lost.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/2129
--
v4: wpcap/tests: Initial tests.
wpcap: Try to enable 32-bit mmap() support in libpcap.
wpcap: Add wow64 thunks.
wpcap: Enable UTF-8 encoding in libpcap.
wpcap: Reimplement pcap_loop() on top of pcap_next_ex().
wpcap: Implement pcap_init().
wpcap: Implement pcap_dump_close().
wpcap: Implement pcap_bufsize().
wpcap: Fix an off-by-one error in convert_length_to_ipv6_mask().
wpcap: Make Unix call parameters wow64 compatible.
wpcap: Sync spec file with latest version of libpcap.
configure: Check for pcap_init() instead of pcap_create().
https://gitlab.winehq.org/wine/wine/-/merge_requests/2123