https://bugs.winehq.org/show_bug.cgi?id=38513
--- Comment #6 from Anastasius Focht focht@gmx.net --- Hello Mark,
--- quote --- As I mentioned in the initial bug report though, this specific WinUAE executable *does work* on native Windows XP.
Perhaps there is some bug/interaction with the way the Visual Studio 2015 startup code detects whether it's running under XP? --- quote ---
Ok, I missed that part that it works on Windows XP.
The trace log shows this:
--- snip --- 0009:Starting process L"Z:\home\focht\Downloads\winuae.exe" (entryproc=0xb9684a) 0009:Call KERNEL32.GetSystemTimeAsFileTime(0565fe20) ret=00b96ccc 0009:Ret KERNEL32.GetSystemTimeAsFileTime() retval=0565fe20 ret=00b96ccc 0009:Call KERNEL32.QueryPerformanceCounter(0565fe18) ret=00b96cf1 0009:Ret KERNEL32.QueryPerformanceCounter() retval=00000001 ret=00b96cf1 0009:Call KERNEL32.IsProcessorFeaturePresent(0000000a) ret=00b96883 0009:Ret KERNEL32.IsProcessorFeaturePresent() retval=00000001 ret=00b96883 0009:Call KERNEL32.LoadLibraryExW(00cb16e4 L"api-ms-win-core-synch-l1-2-0",00000000,00000800) ret=00b9a68a 0009:fixme:module:load_library unsupported flag(s) used (flags: 0x00000800) 0009:Call PE DLL (proc=0xf75ad8b4,module=0xf75a0000 L"api-ms-win-core-synch-l1-2-0.dl",reason=PROCESS_ATTACH,res=(nil)) 0009:Call KERNEL32.DisableThreadLibraryCalls(f75a0000) ret=f75ad967 0009:Ret KERNEL32.DisableThreadLibraryCalls() retval=00000001 ret=f75ad967 0009:Ret PE DLL (proc=0xf75ad8b4,module=0xf75a0000 L"api-ms-win-core-synch-l1-2-0.dl",reason=PROCESS_ATTACH,res=(nil)) retval=1 0009:Ret KERNEL32.LoadLibraryExW() retval=f75a0000 ret=00b9a68a 0009:Call KERNEL32.GetProcAddress(f75a0000,00cb17cc "InitializeCriticalSectionEx") ret=00b9a616 0009:Ret KERNEL32.GetProcAddress() retval=7b82f4a4 ret=00b9a616 0009:Call KERNEL32.InitializeCriticalSectionEx(0524b428,00000fa0,00000000) ret=00b9a8f3 0009:Ret KERNEL32.InitializeCriticalSectionEx() retval=00000001 ret=00b9a8f3 --- snip ---
'InitializeCriticalSectionEx' is a good example since it's also not present on Windows XP (Vista+ API).
The app tries to late-bind this API through 'api-ms-win-core-synch-l1-2-0' Windows API Set. Since Wine provides this Windows API Set with recent versions, the corresponding dll gets loaded and the import is successfully resolved (forwarder).
If the API Set dll doesn't exist ('LoadLibraryExW' failure), next try is 'kernel32.dll'.
If it can't resolve 'InitializeCriticalSectionEx' with 'kernel32.dll', the app assumes this must be Windows XP and uses another code path to switch over to an alternate implementation of the runtime feature which makes use of 'InitializeCriticalSectionAndSpinCount' which is available for Windows XP.
The same mechanism applies for the 'GetSystemTimePreciseAsFileTime' import this bug is about. The app late-binds 'GetSystemTimePreciseAsFileTime' via Windows API set dll which succeeds since it doesn't know about Wine's special auto-generated stubs. It's happy as long as 'GetProcAddress' returns something non-zero.
--- snip --- ... 0009:Call PE DLL (proc=0xf703b804,module=0xf7030000 L"api-ms-win-core-sysinfo-l1-2-1.",reason=PROCESS_ATTACH,res=(nil)) 0009:Call KERNEL32.DisableThreadLibraryCalls(f7030000) ret=f703b8b7 0009:Ret KERNEL32.DisableThreadLibraryCalls() retval=00000001 ret=f703b8b7 0009:Ret PE DLL (proc=0xf703b804,module=0xf7030000 L"api-ms-win-core-sysinfo-l1-2-1.",reason=PROCESS_ATTACH,res=(nil)) retval=1 0009:Ret KERNEL32.LoadLibraryExW() retval=f7030000 ret=00bc20b3 0009:Call KERNEL32.GetProcAddress(f7030000,00cb41e8 "GetSystemTimePreciseAsFileTime") ret=00bc2045 0009:Ret KERNEL32.GetProcAddress() retval=7b82ec34 ret=00bc2045 0009:Call KERNEL32.GetSystemTimePreciseAsFileTime(0565ed68) ret=00bc24a9 0009:Ret KERNEL32.GetSystemTimePreciseAsFileTime() retval=0565ed68 ret=00bc24a9 --- snip ---
If you fake dll load failure, the app would simply fall back to 'GetSystemTimeAsFile' which is available on Windows XP.
Regards