Signed-off-by: Zebediah Figura z.figura12@gmail.com --- configure | 2 ++ configure.ac | 1 + dlls/wow64cpu/Makefile.in | 7 +++++++ dlls/wow64cpu/wow64cpu.spec | 25 +++++++++++++++++++++++++ dlls/wow64cpu/wow64cpu_main.c | 27 +++++++++++++++++++++++++++ 5 files changed, 62 insertions(+) create mode 100644 dlls/wow64cpu/Makefile.in create mode 100644 dlls/wow64cpu/wow64cpu.spec create mode 100644 dlls/wow64cpu/wow64cpu_main.c
diff --git a/configure b/configure index ac6a7985cc7..8bff0297bef 100755 --- a/configure +++ b/configure @@ -1692,6 +1692,7 @@ enable_wmp enable_wmphoto enable_wmvcore enable_wnaspi32 +enable_wow64cpu enable_wpc enable_wpcap enable_ws2_32 @@ -21142,6 +21143,7 @@ wine_fn_config_makefile dlls/wmvcore enable_wmvcore wine_fn_config_makefile dlls/wmvcore/tests enable_tests wine_fn_config_makefile dlls/wnaspi32 enable_wnaspi32 wine_fn_config_makefile dlls/wow32 enable_win16 +wine_fn_config_makefile dlls/wow64cpu enable_wow64cpu wine_fn_config_makefile dlls/wpc enable_wpc wine_fn_config_makefile dlls/wpc/tests enable_tests wine_fn_config_makefile dlls/wpcap enable_wpcap diff --git a/configure.ac b/configure.ac index 2f81fd22610..7b7abeb11ed 100644 --- a/configure.ac +++ b/configure.ac @@ -3885,6 +3885,7 @@ WINE_CONFIG_MAKEFILE(dlls/wmvcore) WINE_CONFIG_MAKEFILE(dlls/wmvcore/tests) WINE_CONFIG_MAKEFILE(dlls/wnaspi32) WINE_CONFIG_MAKEFILE(dlls/wow32,enable_win16) +WINE_CONFIG_MAKEFILE(dlls/wow64cpu) WINE_CONFIG_MAKEFILE(dlls/wpc) WINE_CONFIG_MAKEFILE(dlls/wpc/tests) WINE_CONFIG_MAKEFILE(dlls/wpcap) diff --git a/dlls/wow64cpu/Makefile.in b/dlls/wow64cpu/Makefile.in new file mode 100644 index 00000000000..2ab1ca62c4a --- /dev/null +++ b/dlls/wow64cpu/Makefile.in @@ -0,0 +1,7 @@ +MODULE = wow64cpu.dll +IMPORTS = winecrt0 ntdll + +EXTRADLLFLAGS = -nodefaultlibs -mno-cygwin + +C_SRCS = \ + wow64cpu_main.c diff --git a/dlls/wow64cpu/wow64cpu.spec b/dlls/wow64cpu/wow64cpu.spec new file mode 100644 index 00000000000..0ea2b4defc6 --- /dev/null +++ b/dlls/wow64cpu/wow64cpu.spec @@ -0,0 +1,25 @@ +# @ stub CpuFlushInstructionCache +# @ stub CpuGetContext +# @ stub CpuGetStackPointer +# @ stub CpuInitializeStartupContext +# @ stub CpuNotifyAffinityChange +# @ stub CpuNotifyAfterFork +# @ stub CpuNotifyBeforeFork +# @ stub CpuNotifyDllLoad +# @ stub CpuNotifyDllUnload +# @ stub CpuPrepareForDebuggerAttach +# @ stub CpuProcessDebugEvent +# @ stub CpuProcessInit +# @ stub CpuProcessTerm +# @ stub CpuResetFloatingPoint +# @ stub CpuResetToConsistentState +# @ stub CpuSetContext +# @ stub CpuSetInstructionPointer +# @ stub CpuSetStackPointer +# @ stub CpuSimulate +# @ stub CpuSuspendLocalThread +# @ stub CpuSuspendThread +# @ stub CpuThreadInit +# @ stub CpuThreadTerm +# @ stub TurboDispatchJumpAddressEnd +# @ stub TurboDispatchJumpAddressStart diff --git a/dlls/wow64cpu/wow64cpu_main.c b/dlls/wow64cpu/wow64cpu_main.c new file mode 100644 index 00000000000..4da9695230b --- /dev/null +++ b/dlls/wow64cpu/wow64cpu_main.c @@ -0,0 +1,27 @@ +/* + * Copyright 2018 Zebediah Figura + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdarg.h> +#include "windef.h" +#include "winternl.h" + +BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, void *reserved ) +{ + if (reason == DLL_PROCESS_ATTACH) LdrDisableThreadCalloutsForDll( inst ); + return TRUE; +}
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45567 Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntdll/loader.c | 11 +++++++++++ dlls/ntdll/ntdll.spec | 1 + 2 files changed, 12 insertions(+)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index a7015deeec4..11f9575b46f 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -3975,6 +3975,9 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) return TRUE; }
+#ifndef _WIN64 +void *Wow64Transition; +#endif
/*********************************************************************** * restart_winevdm @@ -4061,6 +4064,14 @@ static NTSTATUS process_init(void) status = build_builtin_module( params->DllPath.Buffer, &nt_name, meminfo.AllocationBase, 0, &wm ); assert( !status );
+#ifndef _WIN64 + if ((status = load_dll( params->DllPath.Buffer, L"C:\windows\system32\wow64cpu.dll", + NULL, 0, &wm )) == STATUS_SUCCESS) + Wow64Transition = wm->ldr.DllBase; + else + WARN( "could not load wow64cpu.dll, status %#x\n", status ); +#endif + if ((status = load_dll( params->DllPath.Buffer, kernel32W, NULL, 0, &wm )) != STATUS_SUCCESS) { MESSAGE( "wine: could not load kernel32.dll, status %x\n", status ); diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 36746d989c6..3f852639fe7 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1131,6 +1131,7 @@ @ stdcall WinSqmIsOptedIn() @ stdcall WinSqmSetDWORD(ptr long long) @ stdcall WinSqmStartSession(ptr long long) +@ extern -arch=win32 Wow64Transition @ stdcall -private -syscall ZwAcceptConnectPort(ptr long ptr long ptr ptr) NtAcceptConnectPort @ stdcall -private -syscall ZwAccessCheck(ptr long long ptr ptr ptr ptr ptr) NtAccessCheck @ stdcall -private -syscall ZwAccessCheckAndAuditAlarm(ptr long ptr ptr ptr long ptr long ptr ptr ptr) NtAccessCheckAndAuditAlarm
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/kernel32/tests/loader.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index 67fd62ef6aa..1dc86dc6980 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -3992,6 +3992,30 @@ static void test_LoadPackagedLibrary(void) h, GetLastError()); }
+static void test_Wow64Transition(void) +{ + char buffer[400]; + MEMORY_SECTION_NAME *name = (MEMORY_SECTION_NAME *)buffer; + const WCHAR *filepart; + void **pWow64Transition; + NTSTATUS status; + + if (!(pWow64Transition = (void *)GetProcAddress(GetModuleHandleA("ntdll"), "Wow64Transition"))) + { + skip("Wow64Transition is not present\n"); + return; + } + + status = NtQueryVirtualMemory(GetCurrentProcess(), *pWow64Transition, + MemorySectionName, name, sizeof(buffer), NULL); + todo_wine ok(!status, "got %#x\n", status); + if (status) return; + filepart = name->SectionFileName.Buffer + name->SectionFileName.Length / sizeof(WCHAR); + while (*filepart != '\') --filepart; + ok(!wcsnicmp(filepart, L"\wow64cpu.dll", wcslen(L"\wow64cpu.dll")), "got file name %s\n", + debugstr_wn(name->SectionFileName.Buffer, name->SectionFileName.Length / sizeof(WCHAR))); +} + START_TEST(loader) { int argc; @@ -4070,4 +4094,5 @@ START_TEST(loader) test_dll_file( "user32.dll" ); /* loader test must be last, it can corrupt the internal loader state on Windows */ test_Loader(); + test_Wow64Transition(); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=81090
Your paranoid android.
=== w10pro64_2scr (32 bit report) ===
kernel32: loader.c:2798: Test failed: attached thread count should be 2
=== w10pro64_zh_CN (32 bit report) ===
kernel32: loader.c:708: Test failed: 1179: wrong status c000011b/c0000131 loader.c:708: Test failed: 1179: wrong status c000011b/c0000130 loader.c:708: Test failed: 1196: wrong status c000011b/c0000130 loader.c:708: Test failed: 1201: wrong status c000011b/c0000130 loader.c:708: Test failed: 1206: wrong status c000011b/c000007b loader.c:708: Test failed: 1211: wrong status c000011b/c000007b loader.c:708: Test failed: 1216: wrong status c000011b/c000007b loader.c:708: Test failed: 1221: wrong status c000011b/c000007b loader.c:708: Test failed: 1226: wrong status c000011b/c000007b loader.c:708: Test failed: 1242: wrong status c000011b/0 loader.c:708: Test failed: 1246: wrong status c000011b/0
=== w1064v1809 (64 bit report) ===
kernel32: loader.c:704: Test failed: 1426: got test dll but expected fallback loader.c:704: Test failed: 1432: got test dll but expected fallback loader.c:704: Test failed: 1438: got test dll but expected fallback loader.c:704: Test failed: 1445: got test dll but expected fallback loader.c:704: Test failed: 1472: got test dll but expected fallback
=== debiant (32 bit report) ===
kernel32: loader.c:3964: Test failed: ntdll.dll:0: wrong OptionalHeader.AddressOfEntryPoint 5f7a0 / 5f730 loader.c:3968: Test failed: ntdll.dll:0: wrong OptionalHeader.DataDirectory[i].VirtualAddress 75000 / 74000 loader.c:3969: Test failed: ntdll.dll:0: wrong OptionalHeader.DataDirectory[i].Size 13930 / 138fa loader.c:3968: Test failed: ntdll.dll:1: wrong OptionalHeader.DataDirectory[i].VirtualAddress 89000 / 88000 loader.c:3968: Test failed: ntdll.dll:2: wrong OptionalHeader.DataDirectory[i].VirtualAddress 8a000 / 89000 loader.c:3968: Test failed: ntdll.dll:5: wrong OptionalHeader.DataDirectory[i].VirtualAddress 8b000 / 8a000 loader.c:3969: Test failed: ntdll.dll:5: wrong OptionalHeader.DataDirectory[i].Size 3b1c / 3b10 loader.c:3974: Test failed: ntdll.dll: wrong section 0 loader.c:3974: Test failed: ntdll.dll: wrong section 2 loader.c:3974: Test failed: ntdll.dll: wrong section 3 loader.c:3974: Test failed: ntdll.dll: wrong section 4 loader.c:3974: Test failed: ntdll.dll: wrong section 5 loader.c:3974: Test failed: ntdll.dll: wrong section 6 loader.c:3974: Test failed: ntdll.dll: wrong section 7 loader.c:3974: Test failed: ntdll.dll: wrong section 8 loader.c:3974: Test failed: ntdll.dll: wrong section 9 loader.c:3974: Test failed: ntdll.dll: wrong section 10 loader.c:3974: Test failed: ntdll.dll: wrong section 11 loader.c:3974: Test failed: ntdll.dll: wrong section 12 loader.c:3974: Test failed: ntdll.dll: wrong section 13 loader.c:3974: Test failed: ntdll.dll: wrong section 14 loader.c:3974: Test failed: ntdll.dll: wrong section 15
=== debiant (32 bit French report) ===
kernel32: loader.c:3964: Test failed: ntdll.dll:0: wrong OptionalHeader.AddressOfEntryPoint 5f7a0 / 5f730 loader.c:3968: Test failed: ntdll.dll:0: wrong OptionalHeader.DataDirectory[i].VirtualAddress 75000 / 74000 loader.c:3969: Test failed: ntdll.dll:0: wrong OptionalHeader.DataDirectory[i].Size 13930 / 138fa loader.c:3968: Test failed: ntdll.dll:1: wrong OptionalHeader.DataDirectory[i].VirtualAddress 89000 / 88000 loader.c:3968: Test failed: ntdll.dll:2: wrong OptionalHeader.DataDirectory[i].VirtualAddress 8a000 / 89000 loader.c:3968: Test failed: ntdll.dll:5: wrong OptionalHeader.DataDirectory[i].VirtualAddress 8b000 / 8a000 loader.c:3969: Test failed: ntdll.dll:5: wrong OptionalHeader.DataDirectory[i].Size 3b1c / 3b10 loader.c:3974: Test failed: ntdll.dll: wrong section 0 loader.c:3974: Test failed: ntdll.dll: wrong section 2 loader.c:3974: Test failed: ntdll.dll: wrong section 3 loader.c:3974: Test failed: ntdll.dll: wrong section 4 loader.c:3974: Test failed: ntdll.dll: wrong section 5 loader.c:3974: Test failed: ntdll.dll: wrong section 6 loader.c:3974: Test failed: ntdll.dll: wrong section 7 loader.c:3974: Test failed: ntdll.dll: wrong section 8 loader.c:3974: Test failed: ntdll.dll: wrong section 9 loader.c:3974: Test failed: ntdll.dll: wrong section 10 loader.c:3974: Test failed: ntdll.dll: wrong section 11 loader.c:3974: Test failed: ntdll.dll: wrong section 12 loader.c:3974: Test failed: ntdll.dll: wrong section 13 loader.c:3974: Test failed: ntdll.dll: wrong section 14 loader.c:3974: Test failed: ntdll.dll: wrong section 15
=== debiant (32 bit Japanese:Japan report) ===
kernel32: loader.c:3964: Test failed: ntdll.dll:0: wrong OptionalHeader.AddressOfEntryPoint 5f7a0 / 5f730 loader.c:3968: Test failed: ntdll.dll:0: wrong OptionalHeader.DataDirectory[i].VirtualAddress 75000 / 74000 loader.c:3969: Test failed: ntdll.dll:0: wrong OptionalHeader.DataDirectory[i].Size 13930 / 138fa loader.c:3968: Test failed: ntdll.dll:1: wrong OptionalHeader.DataDirectory[i].VirtualAddress 89000 / 88000 loader.c:3968: Test failed: ntdll.dll:2: wrong OptionalHeader.DataDirectory[i].VirtualAddress 8a000 / 89000 loader.c:3968: Test failed: ntdll.dll:5: wrong OptionalHeader.DataDirectory[i].VirtualAddress 8b000 / 8a000 loader.c:3969: Test failed: ntdll.dll:5: wrong OptionalHeader.DataDirectory[i].Size 3b1c / 3b10 loader.c:3974: Test failed: ntdll.dll: wrong section 0 loader.c:3974: Test failed: ntdll.dll: wrong section 2 loader.c:3974: Test failed: ntdll.dll: wrong section 3 loader.c:3974: Test failed: ntdll.dll: wrong section 4 loader.c:3974: Test failed: ntdll.dll: wrong section 5 loader.c:3974: Test failed: ntdll.dll: wrong section 6 loader.c:3974: Test failed: ntdll.dll: wrong section 7 loader.c:3974: Test failed: ntdll.dll: wrong section 8 loader.c:3974: Test failed: ntdll.dll: wrong section 9 loader.c:3974: Test failed: ntdll.dll: wrong section 10 loader.c:3974: Test failed: ntdll.dll: wrong section 11 loader.c:3974: Test failed: ntdll.dll: wrong section 12 loader.c:3974: Test failed: ntdll.dll: wrong section 13 loader.c:3974: Test failed: ntdll.dll: wrong section 14 loader.c:3974: Test failed: ntdll.dll: wrong section 15
=== debiant (32 bit Chinese:China report) ===
kernel32: loader.c:3964: Test failed: ntdll.dll:0: wrong OptionalHeader.AddressOfEntryPoint 5f7a0 / 5f730 loader.c:3968: Test failed: ntdll.dll:0: wrong OptionalHeader.DataDirectory[i].VirtualAddress 75000 / 74000 loader.c:3969: Test failed: ntdll.dll:0: wrong OptionalHeader.DataDirectory[i].Size 13930 / 138fa loader.c:3968: Test failed: ntdll.dll:1: wrong OptionalHeader.DataDirectory[i].VirtualAddress 89000 / 88000 loader.c:3968: Test failed: ntdll.dll:2: wrong OptionalHeader.DataDirectory[i].VirtualAddress 8a000 / 89000 loader.c:3968: Test failed: ntdll.dll:5: wrong OptionalHeader.DataDirectory[i].VirtualAddress 8b000 / 8a000 loader.c:3969: Test failed: ntdll.dll:5: wrong OptionalHeader.DataDirectory[i].Size 3b1c / 3b10 loader.c:3974: Test failed: ntdll.dll: wrong section 0 loader.c:3974: Test failed: ntdll.dll: wrong section 2 loader.c:3974: Test failed: ntdll.dll: wrong section 3 loader.c:3974: Test failed: ntdll.dll: wrong section 4 loader.c:3974: Test failed: ntdll.dll: wrong section 5 loader.c:3974: Test failed: ntdll.dll: wrong section 6 loader.c:3974: Test failed: ntdll.dll: wrong section 7 loader.c:3974: Test failed: ntdll.dll: wrong section 8 loader.c:3974: Test failed: ntdll.dll: wrong section 9 loader.c:3974: Test failed: ntdll.dll: wrong section 10 loader.c:3974: Test failed: ntdll.dll: wrong section 11 loader.c:3974: Test failed: ntdll.dll: wrong section 12 loader.c:3974: Test failed: ntdll.dll: wrong section 13 loader.c:3974: Test failed: ntdll.dll: wrong section 14 loader.c:3974: Test failed: ntdll.dll: wrong section 15
=== debiant (32 bit WoW report) ===
kernel32: loader.c:3964: Test failed: ntdll.dll:0: wrong OptionalHeader.AddressOfEntryPoint 5f7a0 / 5f730 loader.c:3968: Test failed: ntdll.dll:0: wrong OptionalHeader.DataDirectory[i].VirtualAddress 75000 / 74000 loader.c:3969: Test failed: ntdll.dll:0: wrong OptionalHeader.DataDirectory[i].Size 13930 / 138fa loader.c:3968: Test failed: ntdll.dll:1: wrong OptionalHeader.DataDirectory[i].VirtualAddress 89000 / 88000 loader.c:3968: Test failed: ntdll.dll:2: wrong OptionalHeader.DataDirectory[i].VirtualAddress 8a000 / 89000 loader.c:3968: Test failed: ntdll.dll:5: wrong OptionalHeader.DataDirectory[i].VirtualAddress 8b000 / 8a000 loader.c:3969: Test failed: ntdll.dll:5: wrong OptionalHeader.DataDirectory[i].Size 3b1c / 3b10 loader.c:3974: Test failed: ntdll.dll: wrong section 0 loader.c:3974: Test failed: ntdll.dll: wrong section 2 loader.c:3974: Test failed: ntdll.dll: wrong section 3 loader.c:3974: Test failed: ntdll.dll: wrong section 4 loader.c:3974: Test failed: ntdll.dll: wrong section 5 loader.c:3974: Test failed: ntdll.dll: wrong section 6 loader.c:3974: Test failed: ntdll.dll: wrong section 7 loader.c:3974: Test failed: ntdll.dll: wrong section 8 loader.c:3974: Test failed: ntdll.dll: wrong section 9 loader.c:3974: Test failed: ntdll.dll: wrong section 10 loader.c:3974: Test failed: ntdll.dll: wrong section 11 loader.c:3974: Test failed: ntdll.dll: wrong section 12 loader.c:3974: Test failed: ntdll.dll: wrong section 13 loader.c:3974: Test failed: ntdll.dll: wrong section 14 loader.c:3974: Test failed: ntdll.dll: wrong section 15
=== debiant (64 bit WoW report) ===
kernel32: loader.c:3964: Test failed: ntdll.dll:0: wrong OptionalHeader.AddressOfEntryPoint 5f7a0 / 5f730 loader.c:3968: Test failed: ntdll.dll:0: wrong OptionalHeader.DataDirectory[i].VirtualAddress 75000 / 74000 loader.c:3969: Test failed: ntdll.dll:0: wrong OptionalHeader.DataDirectory[i].Size 13930 / 138fa loader.c:3968: Test failed: ntdll.dll:1: wrong OptionalHeader.DataDirectory[i].VirtualAddress 89000 / 88000 loader.c:3968: Test failed: ntdll.dll:2: wrong OptionalHeader.DataDirectory[i].VirtualAddress 8a000 / 89000 loader.c:3968: Test failed: ntdll.dll:5: wrong OptionalHeader.DataDirectory[i].VirtualAddress 8b000 / 8a000 loader.c:3969: Test failed: ntdll.dll:5: wrong OptionalHeader.DataDirectory[i].Size 3b1c / 3b10 loader.c:3974: Test failed: ntdll.dll: wrong section 0 loader.c:3974: Test failed: ntdll.dll: wrong section 2 loader.c:3974: Test failed: ntdll.dll: wrong section 3 loader.c:3974: Test failed: ntdll.dll: wrong section 4 loader.c:3974: Test failed: ntdll.dll: wrong section 5 loader.c:3974: Test failed: ntdll.dll: wrong section 6 loader.c:3974: Test failed: ntdll.dll: wrong section 7 loader.c:3974: Test failed: ntdll.dll: wrong section 8 loader.c:3974: Test failed: ntdll.dll: wrong section 9 loader.c:3974: Test failed: ntdll.dll: wrong section 10 loader.c:3974: Test failed: ntdll.dll: wrong section 11 loader.c:3974: Test failed: ntdll.dll: wrong section 12 loader.c:3974: Test failed: ntdll.dll: wrong section 13 loader.c:3974: Test failed: ntdll.dll: wrong section 14 loader.c:3974: Test failed: ntdll.dll: wrong section 15