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
From: Lois Gomez csberto@gmail.com
--- dlls/kernelbase/file.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c index 249f476eb7e..aab96b7b22b 100644 --- a/dlls/kernelbase/file.c +++ b/dlls/kernelbase/file.c @@ -2876,6 +2876,14 @@ BOOL WINAPI DECLSPEC_HOTPATCH SetCurrentDirectoryA( LPCSTR dir ) BOOL WINAPI DECLSPEC_HOTPATCH SetCurrentDirectoryW( LPCWSTR dir ) { UNICODE_STRING dirW; + size_t len = wcslen(dir); + + if (len > 0 && dir[len - 1] == '.') + { + WCHAR *p = (WCHAR *)dir + len - 1; + *p = '\0'; + FIXME("%s . fixed\n", debugstr_w(dir)); + }
RtlInitUnicodeString( &dirW, dir ); return set_ntstatus( RtlSetCurrentDirectory_U( &dirW ));
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=150396
Your paranoid android.
=== debian11b (64 bit WoW report) ===
ucrtbase: file.c:368: Test failed: _wrmdir returned -1, errno 2
This could definitely use a few Wine tests (also Wine is currently in a code freeze so this MR might not be accepted yet)
On Sun Dec 15 11:13:50 2024 +0000, Aida Jonikienė wrote:
This could definitely use a few Wine tests (also Wine is currently in a code freeze so this MR might not be accepted yet)
Thanks, I will figure out how to add some tests for it