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
On Sat Dec 14 13:05:29 2024 +0000, Jinoh Kang wrote:
> > The problem is that there might be no threads that initiate any wait.
> You're probably talking about GetQueuedCompletionStatus(). Sure, no
> threads might be waiting on IOCP. By "initiate the wait" I mean the wait
> on the (arbitrary) target object handle, not the IOCP.
> 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.
Note that this issue is currently masked by another omission in this MR: WaitCompletionPacket doesn't call obj->ops->satisfied().
Waiting on mutexes, semaphores, and auto-reset events have the side effect of acquiring or resetting their state. Your MR, in its current state, does _not_ let this side effect take place, rendering them useless.
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.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6911#note_90537
> The problem is that there might be no threads that initiate any wait.
You're probably thinking about synchronous wait. By "initiate the wait" I mean the thread that called NtAssociateWaitCompletionPacket().
Not all waits are synchronous (like WaitForSingleObject). NtAssociateWaitCompletionPacket() initiates an *asynchronous* wait. When the wait is done (the object is signaled), it queues a completion to the associated I/O completion port.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6911#note_90531