Commit 8db14f4e authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32: Make export directory writable to set FT_Thunk to 0.

But don't bother on non-i386 platforms. Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 98d7f90d
...@@ -44,6 +44,7 @@ static STARTUPINFOA startup_infoA; ...@@ -44,6 +44,7 @@ static STARTUPINFOA startup_infoA;
/*********************************************************************** /***********************************************************************
* set_entry_point * set_entry_point
*/ */
#ifdef __i386__
static void set_entry_point( HMODULE module, const char *name, DWORD rva ) static void set_entry_point( HMODULE module, const char *name, DWORD rva )
{ {
IMAGE_EXPORT_DIRECTORY *exports; IMAGE_EXPORT_DIRECTORY *exports;
...@@ -64,9 +65,12 @@ static void set_entry_point( HMODULE module, const char *name, DWORD rva ) ...@@ -64,9 +65,12 @@ static void set_entry_point( HMODULE module, const char *name, DWORD rva )
if (!(res = strcmp( ename, name ))) if (!(res = strcmp( ename, name )))
{ {
WORD ordinal = ordinals[pos]; WORD ordinal = ordinals[pos];
assert( ordinal < exports->NumberOfFunctions ); DWORD oldprot;
TRACE( "setting %s at %p to %08x\n", name, &functions[ordinal], rva ); TRACE( "setting %s at %p to %08x\n", name, &functions[ordinal], rva );
VirtualProtect( functions + ordinal, sizeof(*functions), PAGE_READWRITE, &oldprot );
functions[ordinal] = rva; functions[ordinal] = rva;
VirtualProtect( functions + ordinal, sizeof(*functions), oldprot, NULL );
return; return;
} }
if (res > 0) max = pos - 1; if (res > 0) max = pos - 1;
...@@ -74,6 +78,7 @@ static void set_entry_point( HMODULE module, const char *name, DWORD rva ) ...@@ -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 ) ...@@ -134,6 +139,7 @@ static BOOL process_attach( HMODULE module )
copy_startup_info(); copy_startup_info();
#ifdef __i386__
if (!(GetVersion() & 0x80000000)) if (!(GetVersion() & 0x80000000))
{ {
/* Securom checks for this one when version is NT */ /* Securom checks for this one when version is NT */
...@@ -146,7 +152,7 @@ static BOOL process_attach( HMODULE module ) ...@@ -146,7 +152,7 @@ static BOOL process_attach( HMODULE module )
if (LdrFindEntryForAddress( GetModuleHandleW( 0 ), &ldr ) || !(ldr->Flags & LDR_WINE_INTERNAL)) if (LdrFindEntryForAddress( GetModuleHandleW( 0 ), &ldr ) || !(ldr->Flags & LDR_WINE_INTERNAL))
LoadLibraryA( "krnl386.exe16" ); LoadLibraryA( "krnl386.exe16" );
} }
#endif
return TRUE; return TRUE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment