Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
f19c9e7c
Commit
f19c9e7c
authored
Feb 07, 2004
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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.
parent
6064b41d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
6 deletions
+12
-6
process.c
dlls/kernel/process.c
+1
-1
loader.c
dlls/ntdll/loader.c
+10
-4
winternl.h
include/winternl.h
+1
-1
No files found.
dlls/kernel/process.c
View file @
f19c9e7c
...
@@ -740,7 +740,7 @@ static void start_process( void *arg )
...
@@ -740,7 +740,7 @@ static void start_process( void *arg )
IMAGE_NT_HEADERS
*
nt
;
IMAGE_NT_HEADERS
*
nt
;
LPTHREAD_START_ROUTINE
entry
;
LPTHREAD_START_ROUTINE
entry
;
LdrInitializeThunk
(
main_exe_file
,
CreateFileW
,
0
,
0
);
LdrInitializeThunk
(
main_exe_file
,
0
,
0
,
0
);
nt
=
RtlImageNtHeader
(
peb
->
ImageBaseAddress
);
nt
=
RtlImageNtHeader
(
peb
->
ImageBaseAddress
);
entry
=
(
LPTHREAD_START_ROUTINE
)((
char
*
)
peb
->
ImageBaseAddress
+
entry
=
(
LPTHREAD_START_ROUTINE
)((
char
*
)
peb
->
ImageBaseAddress
+
...
...
dlls/ntdll/loader.c
View file @
f19c9e7c
...
@@ -1430,7 +1430,7 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
...
@@ -1430,7 +1430,7 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
}
}
main_exe
=
get_modref
(
NtCurrentTeb
()
->
Peb
->
ImageBaseAddress
);
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
;
nts
=
STATUS_DLL_NOT_FOUND
;
for
(
i
=
0
;
i
<
LOADORDER_NTYPES
;
i
++
)
for
(
i
=
0
;
i
<
LOADORDER_NTYPES
;
i
++
)
...
@@ -1799,9 +1799,9 @@ static inline void init_system_dir(void)
...
@@ -1799,9 +1799,9 @@ static inline void init_system_dir(void)
/******************************************************************
/******************************************************************
* LdrInitializeThunk (NTDLL.@)
* 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
;
NTSTATUS
status
;
WINE_MODREF
*
wm
;
WINE_MODREF
*
wm
;
...
@@ -1810,7 +1810,6 @@ void WINAPI LdrInitializeThunk( HANDLE main_file, void *CreateFileW_ptr, ULONG u
...
@@ -1810,7 +1810,6 @@ void WINAPI LdrInitializeThunk( HANDLE main_file, void *CreateFileW_ptr, ULONG u
UNICODE_STRING
*
main_exe_name
=
&
peb
->
ProcessParameters
->
ImagePathName
;
UNICODE_STRING
*
main_exe_name
=
&
peb
->
ProcessParameters
->
ImagePathName
;
IMAGE_NT_HEADERS
*
nt
=
RtlImageNtHeader
(
peb
->
ImageBaseAddress
);
IMAGE_NT_HEADERS
*
nt
=
RtlImageNtHeader
(
peb
->
ImageBaseAddress
);
pCreateFileW
=
CreateFileW_ptr
;
init_system_dir
();
init_system_dir
();
/* allocate the modref for the main exe */
/* allocate the modref for the main exe */
...
@@ -1976,5 +1975,12 @@ void __wine_process_init( int argc, char *argv[] )
...
@@ -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
);
MESSAGE
(
"wine: could not find __wine_kernel_init in kernel32.dll, status %lx
\n
"
,
status
);
exit
(
1
);
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
();
init_func
();
}
}
include/winternl.h
View file @
f19c9e7c
...
@@ -958,7 +958,7 @@ NTSTATUS WINAPI LdrFindResourceDirectory_U(HMODULE,const LDR_RESOURCE_INFO*,ULO
...
@@ -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
LdrFindResource_U
(
HMODULE
,
const
LDR_RESOURCE_INFO
*
,
ULONG
,
const
IMAGE_RESOURCE_DATA_ENTRY
**
);
NTSTATUS
WINAPI
LdrGetDllHandle
(
ULONG
,
ULONG
,
const
UNICODE_STRING
*
,
HMODULE
*
);
NTSTATUS
WINAPI
LdrGetDllHandle
(
ULONG
,
ULONG
,
const
UNICODE_STRING
*
,
HMODULE
*
);
NTSTATUS
WINAPI
LdrGetProcedureAddress
(
HMODULE
,
const
ANSI_STRING
*
,
ULONG
,
void
**
);
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
*
);
NTSTATUS
WINAPI
LdrLoadDll
(
LPCWSTR
,
DWORD
,
const
UNICODE_STRING
*
,
HMODULE
*
);
void
WINAPI
LdrShutdownProcess
(
void
);
void
WINAPI
LdrShutdownProcess
(
void
);
void
WINAPI
LdrShutdownThread
(
void
);
void
WINAPI
LdrShutdownThread
(
void
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment