wine-staging/patches/wow64cpu-Wow64Transition/0002-ntdll-Add-a-stub-implementation-of-Wow64Transition.patch
2020-09-03 08:40:02 +10:00

61 lines
2.5 KiB
Diff

From 85c9586902b2f1d197e0d6dcbde53a36b7803092 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Wed, 8 Aug 2018 20:00:15 -0500
Subject: [PATCH] ntdll: Add a stub implementation of Wow64Transition.
---
dlls/ntdll/loader.c | 10 +++++++++-
dlls/ntdll/ntdll.spec | 1 +
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 0eac7fdb939..36c1a467562 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -4181,6 +4181,7 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
return TRUE;
}
+void *Wow64Transition;
/***********************************************************************
* restart_winevdm
@@ -4217,7 +4218,7 @@ static NTSTATUS process_init(void)
's','y','s','t','e','m','3','2','\\',
'k','e','r','n','e','l','3','2','.','d','l','l',0};
RTL_USER_PROCESS_PARAMETERS *params;
- WINE_MODREF *wm;
+ WINE_MODREF *wm, *wow64cpu_wm;
NTSTATUS status;
ANSI_STRING func_name;
UNICODE_STRING nt_name;
@@ -4282,6 +4283,13 @@ static NTSTATUS process_init(void)
MESSAGE( "wine: could not load kernel32.dll, status %x\n", status );
NtTerminateProcess( GetCurrentProcess(), status );
}
+
+ RtlInitUnicodeString( &nt_name, L"\\??\\C:\\windows\\system32\\wow64cpu.dll" );
+ if ((status = load_builtin_dll( NULL, &nt_name, 0, 0, &wow64cpu_wm )) == STATUS_SUCCESS)
+ Wow64Transition = wow64cpu_wm->ldr.DllBase;
+ else
+ WARN( "could not load wow64cpu.dll, status %#x\n", status );
+
RtlInitAnsiString( &func_name, "BaseThreadInitThunk" );
if ((status = LdrGetProcedureAddress( wm->ldr.DllBase, &func_name,
0, (void **)&pBaseThreadInitThunk )) != STATUS_SUCCESS)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index c0e9c681e1d..e343e66f4af 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1124,6 +1124,7 @@
@ stdcall WinSqmIsOptedIn()
@ stdcall WinSqmSetDWORD(ptr long long)
@ stdcall WinSqmStartSession(ptr long long)
+@ extern 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
--
2.28.0