mirror of
https://github.com/reactos/wine.git
synced 2025-01-22 03:49:02 +00:00
Get pointer to CreateFileW earlier on during startup.
Make sure we don't crash when loading a dll before the modref for the main exe has been created.
This commit is contained in:
parent
6064b41dff
commit
f19c9e7cdd
@ -740,7 +740,7 @@ static void start_process( void *arg )
|
||||
IMAGE_NT_HEADERS *nt;
|
||||
LPTHREAD_START_ROUTINE entry;
|
||||
|
||||
LdrInitializeThunk( main_exe_file, CreateFileW, 0, 0 );
|
||||
LdrInitializeThunk( main_exe_file, 0, 0, 0 );
|
||||
|
||||
nt = RtlImageNtHeader( peb->ImageBaseAddress );
|
||||
entry = (LPTHREAD_START_ROUTINE)((char *)peb->ImageBaseAddress +
|
||||
|
@ -1430,7 +1430,7 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
|
||||
}
|
||||
|
||||
main_exe = get_modref( NtCurrentTeb()->Peb->ImageBaseAddress );
|
||||
MODULE_GetLoadOrderW( loadorder, main_exe->ldr.BaseDllName.Buffer, filename );
|
||||
MODULE_GetLoadOrderW( loadorder, main_exe ? main_exe->ldr.BaseDllName.Buffer : NULL, filename );
|
||||
|
||||
nts = STATUS_DLL_NOT_FOUND;
|
||||
for (i = 0; i < LOADORDER_NTYPES; i++)
|
||||
@ -1799,9 +1799,9 @@ static inline void init_system_dir(void)
|
||||
/******************************************************************
|
||||
* LdrInitializeThunk (NTDLL.@)
|
||||
*
|
||||
* FIXME: the arguments are not correct, main_file and CreateFileW_ptr are Wine inventions.
|
||||
* FIXME: the arguments are not correct, main_file is a Wine invention.
|
||||
*/
|
||||
void WINAPI LdrInitializeThunk( HANDLE main_file, void *CreateFileW_ptr, ULONG unknown3, ULONG unknown4 )
|
||||
void WINAPI LdrInitializeThunk( HANDLE main_file, ULONG unknown2, ULONG unknown3, ULONG unknown4 )
|
||||
{
|
||||
NTSTATUS status;
|
||||
WINE_MODREF *wm;
|
||||
@ -1810,7 +1810,6 @@ void WINAPI LdrInitializeThunk( HANDLE main_file, void *CreateFileW_ptr, ULONG u
|
||||
UNICODE_STRING *main_exe_name = &peb->ProcessParameters->ImagePathName;
|
||||
IMAGE_NT_HEADERS *nt = RtlImageNtHeader( peb->ImageBaseAddress );
|
||||
|
||||
pCreateFileW = CreateFileW_ptr;
|
||||
init_system_dir();
|
||||
|
||||
/* allocate the modref for the main exe */
|
||||
@ -1976,5 +1975,12 @@ void __wine_process_init( int argc, char *argv[] )
|
||||
MESSAGE( "wine: could not find __wine_kernel_init in kernel32.dll, status %lx\n", status );
|
||||
exit(1);
|
||||
}
|
||||
RtlInitAnsiString( &func_name, "CreateFileW" );
|
||||
if ((status = LdrGetProcedureAddress( wm->ldr.BaseAddress, &func_name,
|
||||
0, (void **)&pCreateFileW )) != STATUS_SUCCESS)
|
||||
{
|
||||
MESSAGE( "wine: could not find CreateFileW in kernel32.dll, status %lx\n", status );
|
||||
exit(1);
|
||||
}
|
||||
init_func();
|
||||
}
|
||||
|
@ -958,7 +958,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,LPVOID,ULONG,ULONG);
|
||||
void WINAPI LdrInitializeThunk(HANDLE,ULONG,ULONG,ULONG);
|
||||
NTSTATUS WINAPI LdrLoadDll(LPCWSTR, DWORD, const UNICODE_STRING*, HMODULE*);
|
||||
void WINAPI LdrShutdownProcess(void);
|
||||
void WINAPI LdrShutdownThread(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user