Alexandre Julliard : ntdll:
Get rid of the main_file argument in LdrInitializeThunk.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Feb 8 09:12:47 CST 2006
Module: wine
Branch: refs/heads/master
Commit: 9669ff8de4b27c0c55736ad246bb9c04f4cf09fd
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=9669ff8de4b27c0c55736ad246bb9c04f4cf09fd
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Feb 8 15:22:24 2006 +0100
ntdll: Get rid of the main_file argument in LdrInitializeThunk.
---
dlls/kernel/process.c | 14 +++++---------
dlls/ntdll/loader.c | 6 +-----
include/winternl.h | 2 +-
3 files changed, 7 insertions(+), 15 deletions(-)
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 @@ 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;
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 @@ PIMAGE_NT_HEADERS WINAPI RtlImageNtHeade
/******************************************************************
* 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 m
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 LdrFindResourceDirector
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);
More information about the wine-cvs
mailing list