**Context:**
Vanguard Saga of Heroes is an MMORPG that was closed years ago by SOE.
However the game is still alive in the emulator scene at https://vgoemulator.net/
The game seems to have relied on an old behaviour of the function SetCurrentDirectoryW( LPCWSTR dir )
which currently crashes the game.
This patch was a solution discovered by the community at https://vgoemulator.net/phpBB3/viewtopic.php?t=5563
It was previously reported to wine bugzilla in this bug report.
https://bugs.winehq.org/show_bug.cgi?id=34285
**Summary of changes:**
Updates the function SetCurrentDirectoryW( LPCWSTR dir ) to remove any trailing "."
Previously the game will set the current directory as "bin\\." and subsequently crash when accessing "bin\\.Caches". It will now access "bin\Caches" and run successfully
**Notes:**
This is my first contribution to the project so I might be making a lot of incorrect assumptions on how this might affect other binaries. Please do let me know if there is a better way to implement a change like this in the codebase.
Thanks for your help
--
v3: kernelbase: Workaound for SetCurrentDirectoryW misuse
https://gitlab.winehq.org/wine/wine/-/merge_requests/7023
**Context:**
Vanguard Saga of Heroes is an MMORPG that was closed years ago by SOE.
However the game is still alive in the emulator scene at https://vgoemulator.net/
The game seems to have relied on an old behaviour of the function SetCurrentDirectoryW( LPCWSTR dir )
which currently crashes the game.
This patch was a solution discovered by the community at https://vgoemulator.net/phpBB3/viewtopic.php?t=5563
It was previously reported to wine bugzilla in this bug report.
https://bugs.winehq.org/show_bug.cgi?id=34285
**Summary of changes:**
Updates the function SetCurrentDirectoryW( LPCWSTR dir ) to remove any trailing "."
Previously the game will set the current directory as "bin\\." and subsequently crash when accessing "bin\\.Caches". It will now access "bin\Caches" and run successfully
**Notes:**
This is my first contribution to the project so I might be making a lot of incorrect assumptions on how this might affect other binaries. Please do let me know if there is a better way to implement a change like this in the codebase.
Thanks for your help
--
v4: kernelbase: Workaound for SetCurrentDirectoryW misuse
https://gitlab.winehq.org/wine/wine/-/merge_requests/7023
> NtAssociateWaitCompletionPacket() initiates an asynchronous wait on the object handle. When the wait is done (the object is signaled), it queues a completion to the associated I/O completion port.
Make sense. I will revisit this MR after the code freeze.
> Maybe, in the particular case of React Native, it only uses WaitCompletionPacket on manual reset events or other objects with no-op satisfied()? FWIW I couldn't find any reference to NtAssociateWaitCompletionPacket in https://github.com/facebook/react-native.
I am testing a React Native sample application. If I remember correctly, the NtAssociateWaitCompletionPacket() is from some Microsoft DLL, coremessagingxp.dll. I didn't look into the type of object it waits on.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6911#note_90563
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.
--
v6: ntdll: Simplify check that unexpected files were not found
https://gitlab.winehq.org/wine/wine/-/merge_requests/6904
Context:
Vanguard Saga of Heroes is an MMORPG that was closed years ago by SOE.
However the game is still alive in the emulator scene at https://vgoemulator.net/
The game seems to have relied on an old behaviour of the function SetCurrentDirectoryW( LPCWSTR dir )
which currently crashes the game.
This patch was a solution discovered by the community at https://vgoemulator.net/phpBB3/viewtopic.php?t=5563
It was previously reported to wine bugzilla in this bug report.
https://bugs.winehq.org/show_bug.cgi?id=34285
Summary of changes:
Updates the function SetCurrentDirectoryW( LPCWSTR dir ) to remove any trailing "."
Previously the game will set the current directory as "bin\." and subsequently crash when accessing "bin\.Caches". It will now access "bin\Caches" and run successfully
Notes:
This is my first contribution to the project so I might be making a lot of incorrect assumptions on how this might affect other binaries. Please do let me know if there is a better way to implement a change like this in the codebase.
Thanks for your help
--
v2: kernelbase: Workaound for SetCurrentDirectoryW misuse
https://gitlab.winehq.org/wine/wine/-/merge_requests/7023