hle(kernel, files), loader(native): Win32 module paths/exports, DisableThreadLibraryCalls & DLL_THREAD_DETACH order, caller backtraces, and MiniDumpWriteDump #570
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS#570
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Sheffy007 on GitHub · 2026-11-28 05:19 UTC · original
Refs #460, #525
Problem
Several Win32 module, path, thread-notification, and diagnostic APIs on the native macOS path diverge from the Windows loader and HLE contracts:
GetModuleFileNameW/GetModuleFileNameAreturn raw macOS POSIX paths (/Users/.../Game.exe) instead of mounted Win32 drive paths (G:\Game.exe), and leaveLastErrorunset on invalid handles:native_run.rsmounts the package folder asG:and setsGetCommandLineW()toG:\<exe>, butkernel::title_pathreturns the host POSIX path with/and no drive letter, breaking Win32 callers that split on\(wcsrchr,_wsplitpath_s,GetFullPathNameW, CRT_get_wpgmptr,XLaunchNewGame).0without settingERROR_MOD_NOT_FOUND(126).GetProcAddresson the main executable (NULLorGetModuleHandle(NULL)) ignores PE exports and leavesLastErrorunset, anddbghelp.dll!MiniDumpWriteDumplogs an unimplemented warning on every run (#521):host::get_proc_addressonly checksTitleDlls andfake_dll, missing exports on the mainNativeImage(D3D12SDKVersion,NvOptimusEnablement,AmdPowerXpressRequestHighPerformance, or title exports) and returningNULLwithLastError == 0.dbghelp.dll!MiniDumpWriteDumpat startup (GetProcAddress: not implemented dll="dbghelp.dll" symbol=MiniDumpWriteDumpin#521).DisableThreadLibraryCallsandDLL_THREAD_DETACHviolate the Windows loader contract:DisableThreadLibraryCalls(hinstDLL)insideDllMain(DLL_PROCESS_ATTACH), which runs beforeregister_dll_thread_notices(&dll.image)is called, so the call is silently lost andDllMaincontinues receiving thread notices.DisableThreadLibraryCallson native macOS unconditionally returns1(TRUE) even for DLLs with static TLS (where Windows fails withFALSE) and for invalid handles.notify_threads(DLL_THREAD_DETACH)notifies modules in forward load order and runs TLS callbacks beforeDllMain, instead of reverse load order withDllMainbefore TLS callbacks as Windows does.kernel::host::callers()always returns"":exit,abort,terminate,_invalid_parameter_noinfo_noreturn,TerminateProcess, and refused-DLL logs printfrom=""instead of unwinding title callers (dll+0xrva < image+0xrva).host_posix::fileshelpers (DeleteFileA,CreateDirectoryA,RemoveDirectoryA,GetDiskFreeSpaceW,GetFullPathNameW/A) are missing.Proposed Fix
GetModuleFileNameW/Apaths through mountedhost_posix::filesdrives (G:\..., longest-prefix match, round-tripping cleanly throughfiles::translate) and setERROR_MOD_NOT_FOUNDon unknown handles; addDeleteFileA,CreateDirectoryA,RemoveDirectoryA,GetDiskFreeSpaceW, andGetFullPathNameW/Ainhost_posix::files.NativeImagemetadata/exports soGetProcAddressresolves exports on the main executable and setsERROR_PROC_NOT_FOUND/ERROR_MOD_NOT_FOUNDaccurately; provide a cleanERROR_NOT_SUPPORTEDstub fordbghelp.dll!MiniDumpWriteDumpon non-Windows hosts.native::disable_thread_calls(honouring calls made duringDllMain(DLL_PROCESS_ATTACH), rejecting images with static TLS, and returningNonefor non-images) and reverse module + callback order onDLL_THREAD_DETACH.native::dump::caller_locations()and wirekernel::host::callers()on native macOS.@Sheffy007 on GitHub · 2026-11-28 05:19 UTC · original
/claim
@github-actions[bot] on GitHub · 2026-11-28 05:19 UTC · original
Claimed by @Sheffy007. Open a draft pull request with
Refs #566in its description within 24 hours, or the claim expires.