Commit 9669ff8d authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Get rid of the main_file argument in LdrInitializeThunk.

parent e65b8d92
......@@ -951,7 +951,7 @@ static void start_process( void *arg )
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 @@ void __wine_kernel_init(void)
{
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 @@ void __wine_kernel_init(void)
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 @@ void __wine_kernel_init(void)
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 @@ void __wine_kernel_init(void)
}
found:
CloseHandle( main_exe_file );
/* build command line */
set_library_wargv( __wine_main_argv );
if (!build_command_line( __wine_main_wargv )) goto error;
......
......@@ -2015,9 +2015,8 @@ PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE hModule)
/******************************************************************
* 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 @@ void WINAPI LdrInitializeThunk( HANDLE main_file, ULONG unknown2, ULONG unknown3
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;
......
......@@ -1700,7 +1700,7 @@ NTSTATUS WINAPI LdrFindResourceDirectory_U(HMODULE,const LDR_RESOURCE_INFO*,ULO
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);
......
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