Alexandre Julliard : kernel32: Make export directory writable to set FT_Thunk to 0.
Alexandre Julliard
julliard at winehq.org
Fri Sep 25 14:52:54 CDT 2020
Module: wine
Branch: master
Commit: 8db14f4e18a3770b4ac3cfe6e1ddbe17dec342d7
URL: https://source.winehq.org/git/wine.git/?a=commit;h=8db14f4e18a3770b4ac3cfe6e1ddbe17dec342d7
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Sep 25 13:45:04 2020 +0200
kernel32: Make export directory writable to set FT_Thunk to 0.
But don't bother on non-i386 platforms.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernel32/kernel_main.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/kernel_main.c b/dlls/kernel32/kernel_main.c
index 2207b6eb22..6f60768cbd 100644
--- a/dlls/kernel32/kernel_main.c
+++ b/dlls/kernel32/kernel_main.c
@@ -44,6 +44,7 @@ static STARTUPINFOA startup_infoA;
/***********************************************************************
* set_entry_point
*/
+#ifdef __i386__
static void set_entry_point( HMODULE module, const char *name, DWORD rva )
{
IMAGE_EXPORT_DIRECTORY *exports;
@@ -64,9 +65,12 @@ static void set_entry_point( HMODULE module, const char *name, DWORD rva )
if (!(res = strcmp( ename, name )))
{
WORD ordinal = ordinals[pos];
- assert( ordinal < exports->NumberOfFunctions );
+ DWORD oldprot;
+
TRACE( "setting %s at %p to %08x\n", name, &functions[ordinal], rva );
+ VirtualProtect( functions + ordinal, sizeof(*functions), PAGE_READWRITE, &oldprot );
functions[ordinal] = rva;
+ VirtualProtect( functions + ordinal, sizeof(*functions), oldprot, NULL );
return;
}
if (res > 0) max = pos - 1;
@@ -74,6 +78,7 @@ static void set_entry_point( HMODULE module, const char *name, DWORD rva )
}
}
}
+#endif
/***********************************************************************
@@ -134,6 +139,7 @@ static BOOL process_attach( HMODULE module )
copy_startup_info();
+#ifdef __i386__
if (!(GetVersion() & 0x80000000))
{
/* Securom checks for this one when version is NT */
@@ -146,7 +152,7 @@ static BOOL process_attach( HMODULE module )
if (LdrFindEntryForAddress( GetModuleHandleW( 0 ), &ldr ) || !(ldr->Flags & LDR_WINE_INTERNAL))
LoadLibraryA( "krnl386.exe16" );
}
-
+#endif
return TRUE;
}
More information about the wine-cvs
mailing list