ntdll: Get rid of the main_file argument in LdrInitializeThunk.
diff --git a/dlls/kernel/process.c b/dlls/kernel/process.c
index 1a890c3..417e658 100644
--- a/dlls/kernel/process.c
+++ b/dlls/kernel/process.c
@@ -951,7 +951,7 @@
IMAGE_NT_HEADERS *nt;
LPTHREAD_START_ROUTINE entry;
- LdrInitializeThunk( main_exe_file, 0, 0, 0 );
+ LdrInitializeThunk( 0, 0, 0, 0 );
nt = RtlImageNtHeader( peb->ImageBaseAddress );
entry = (LPTHREAD_START_ROUTINE)((char *)peb->ImageBaseAddress +
@@ -1039,10 +1039,8 @@
{
case BINARY_PE_EXE:
TRACE( "starting Win32 binary %s\n", debugstr_w(main_exe_name) );
- peb->ImageBaseAddress = LoadLibraryExW( main_exe_name, 0, DONT_RESOLVE_DLL_REFERENCES );
- CloseHandle( main_exe_file );
- main_exe_file = 0;
- if (peb->ImageBaseAddress) goto found;
+ if ((peb->ImageBaseAddress = LoadLibraryExW( main_exe_name, 0, DONT_RESOLVE_DLL_REFERENCES )))
+ goto found;
MESSAGE( "wine: could not load %s as Win32 binary\n", debugstr_w(main_exe_name) );
ExitProcess(1);
case BINARY_PE_DLL:
@@ -1061,8 +1059,6 @@
case BINARY_WIN16:
case BINARY_DOS:
TRACE( "starting Win16/DOS binary %s\n", debugstr_w(main_exe_name) );
- CloseHandle( main_exe_file );
- main_exe_file = 0;
__wine_main_argv--;
__wine_main_argc++;
__wine_main_argv[0] = "winevdm.exe";
@@ -1079,8 +1075,6 @@
char *unix_name;
TRACE( "starting Winelib app %s\n", debugstr_w(main_exe_name) );
- CloseHandle( main_exe_file );
- main_exe_file = 0;
if ((unix_name = wine_get_unix_file_name( main_exe_name )) &&
wine_dlopen( unix_name, RTLD_NOW, error, sizeof(error) ))
{
@@ -1100,6 +1094,8 @@
}
found:
+ CloseHandle( main_exe_file );
+
/* build command line */
set_library_wargv( __wine_main_argv );
if (!build_command_line( __wine_main_wargv )) goto error;
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 72022ba..d4e946a 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -2015,9 +2015,8 @@
/******************************************************************
* LdrInitializeThunk (NTDLL.@)
*
- * FIXME: the arguments are not correct, main_file is a Wine invention.
*/
-void WINAPI LdrInitializeThunk( HANDLE main_file, ULONG unknown2, ULONG unknown3, ULONG unknown4 )
+void WINAPI LdrInitializeThunk( ULONG unknown1, ULONG unknown2, ULONG unknown3, ULONG unknown4 )
{
NTSTATUS status;
WINE_MODREF *wm;
@@ -2058,15 +2057,12 @@
req->entry = (char *)peb->ImageBaseAddress + nt->OptionalHeader.AddressOfEntryPoint;
/* API requires a double indirection */
req->name = &wm->ldr.FullDllName.Buffer;
- req->exe_file = main_file;
req->gui = (nt->OptionalHeader.Subsystem != IMAGE_SUBSYSTEM_WINDOWS_CUI);
wine_server_add_data( req, wm->ldr.FullDllName.Buffer, wm->ldr.FullDllName.Length );
wine_server_call( req );
}
SERVER_END_REQ;
- if (main_file) NtClose( main_file ); /* we no longer need it */
-
RtlEnterCriticalSection( &loader_section );
load_path = NtCurrentTeb()->Peb->ProcessParameters->DllPath.Buffer;
diff --git a/include/winternl.h b/include/winternl.h
index abe1745..6666294 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -1700,7 +1700,7 @@
NTSTATUS WINAPI LdrFindResource_U(HMODULE,const LDR_RESOURCE_INFO*,ULONG,const IMAGE_RESOURCE_DATA_ENTRY**);
NTSTATUS WINAPI LdrGetDllHandle(ULONG, ULONG, const UNICODE_STRING*, HMODULE*);
NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE, const ANSI_STRING*, ULONG, void**);
-void WINAPI LdrInitializeThunk(HANDLE,ULONG,ULONG,ULONG);
+void WINAPI LdrInitializeThunk(ULONG,ULONG,ULONG,ULONG);
NTSTATUS WINAPI LdrLoadDll(LPCWSTR, DWORD, const UNICODE_STRING*, HMODULE*);
void WINAPI LdrShutdownProcess(void);
void WINAPI LdrShutdownThread(void);