Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
1d23e7fe
Commit
1d23e7fe
authored
Feb 08, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Check for existing modref for the main exe before creating it
in LdrInitializeThunk.
parent
2b0033d5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
loader.c
dlls/ntdll/loader.c
+11
-8
No files found.
dlls/ntdll/loader.c
View file @
1d23e7fe
...
...
@@ -2023,18 +2023,20 @@ void WINAPI LdrInitializeThunk( HANDLE main_file, ULONG unknown2, ULONG unknown3
WINE_MODREF
*
wm
;
LPCWSTR
load_path
;
PEB
*
peb
=
NtCurrentTeb
()
->
Peb
;
UNICODE_STRING
*
main_exe_name
=
&
peb
->
ProcessParameters
->
ImagePathName
;
IMAGE_NT_HEADERS
*
nt
=
RtlImageNtHeader
(
peb
->
ImageBaseAddress
);
version_init
(
main_exe_name
->
Buffer
);
/* allocate the modref for the main exe */
if
(
!
(
wm
=
alloc_module
(
peb
->
ImageBaseAddress
,
main_exe_name
->
Buffer
)))
/* allocate the modref for the main exe (if not already done) */
if
(
!
(
wm
=
get_modref
(
peb
->
ImageBaseAddress
))
&&
!
(
wm
=
alloc_module
(
peb
->
ImageBaseAddress
,
peb
->
ProcessParameters
->
ImagePathName
.
Buffer
)))
{
status
=
STATUS_NO_MEMORY
;
goto
error
;
}
wm
->
ldr
.
LoadCount
=
-
1
;
/* can't unload main exe */
wm
->
ldr
.
Flags
&=
~
LDR_DONT_RESOLVE_REFS
;
peb
->
ProcessParameters
->
ImagePathName
=
wm
->
ldr
.
FullDllName
;
version_init
(
wm
->
ldr
.
FullDllName
.
Buffer
);
/* the main exe needs to be the first in the load order list */
RemoveEntryList
(
&
wm
->
ldr
.
InLoadOrderModuleList
);
...
...
@@ -2055,10 +2057,10 @@ void WINAPI LdrInitializeThunk( HANDLE main_file, ULONG unknown2, ULONG unknown3
req
->
module_size
=
wm
->
ldr
.
SizeOfImage
;
req
->
entry
=
(
char
*
)
peb
->
ImageBaseAddress
+
nt
->
OptionalHeader
.
AddressOfEntryPoint
;
/* API requires a double indirection */
req
->
name
=
&
main_exe_name
->
Buffer
;
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
,
main_exe_name
->
Buffer
,
main_exe_name
->
Length
);
wine_server_add_data
(
req
,
wm
->
ldr
.
FullDllName
.
Buffer
,
wm
->
ldr
.
FullDllName
.
Length
);
wine_server_call
(
req
);
}
SERVER_END_REQ
;
...
...
@@ -2085,7 +2087,8 @@ void WINAPI LdrInitializeThunk( HANDLE main_file, ULONG unknown2, ULONG unknown3
return
;
error:
ERR
(
"Main exe initialization for %s failed, status %lx
\n
"
,
debugstr_w
(
main_exe_name
->
Buffer
),
status
);
ERR
(
"Main exe initialization for %s failed, status %lx
\n
"
,
debugstr_w
(
peb
->
ProcessParameters
->
ImagePathName
.
Buffer
),
status
);
exit
(
1
);
}
...
...
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