Zebediah Figura : ntdll: Stub Wow64Transition.
Module: wine Branch: master Commit: 0421ea397571650c5c6217b95e39cbd098b6c5b0 URL: https://source.winehq.org/git/wine.git/?a=commit;h=0421ea397571650c5c6217b95... Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Thu Feb 25 21:38:31 2021 -0600 ntdll: Stub Wow64Transition. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45567 Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/loader.c | 37 +++++++++++++++++++++++++++++++++++++ dlls/ntdll/ntdll.spec | 1 + 2 files changed, 38 insertions(+) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 2a6b8467812..6c86e6b2e6c 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -3928,6 +3928,38 @@ static void restart_winevdm( RTL_USER_PROCESS_PARAMETERS *params ) RtlInitUnicodeString( ¶ms->CommandLine, cmdline ); } +#ifndef _WIN64 +void *Wow64Transition = NULL; + +static void map_wow64cpu(void) +{ + SIZE_T size = 0; + OBJECT_ATTRIBUTES attr; + UNICODE_STRING string; + HANDLE file, section; + IO_STATUS_BLOCK io; + NTSTATUS status; + + RtlInitUnicodeString( &string, L"\\??\\C:\\windows\\sysnative\\wow64cpu.dll" ); + InitializeObjectAttributes( &attr, &string, 0, NULL, NULL ); + if ((status = NtOpenFile( &file, GENERIC_READ | SYNCHRONIZE, &attr, &io, FILE_SHARE_READ, + FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE ))) + { + WARN("failed to open wow64cpu, status %#x\n", status); + return; + } + if (!NtCreateSection( §ion, STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | + SECTION_MAP_READ | SECTION_MAP_EXECUTE, + NULL, NULL, PAGE_EXECUTE_READ, SEC_COMMIT, file )) + { + NtMapViewOfSection( section, NtCurrentProcess(), &Wow64Transition, 0, + 0, NULL, &size, ViewShare, 0, PAGE_EXECUTE_READ ); + NtClose( section ); + } + NtClose( file ); +} +#endif + /*********************************************************************** * process_init @@ -4037,6 +4069,11 @@ static NTSTATUS process_init(void) build_ntdll_module(); +#ifndef _WIN64 + if (is_wow64) + map_wow64cpu(); +#endif + if ((status = load_dll( params->DllPath.Buffer, L"C:\\windows\\system32\\kernel32.dll", NULL, 0, &wm )) != STATUS_SUCCESS) { diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 78f06881832..ac7365a84b6 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1129,6 +1129,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
participants (1)
-
Alexandre Julliard