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
0433db1e
Commit
0433db1e
authored
May 23, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Add a helper function to map the main exe module.
parent
ebc1b099
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
11 deletions
+43
-11
loader.c
dlls/ntdll/unix/loader.c
+5
-11
unix_private.h
dlls/ntdll/unix/unix_private.h
+2
-0
virtual.c
dlls/ntdll/unix/virtual.c
+36
-0
No files found.
dlls/ntdll/unix/loader.c
View file @
0433db1e
...
...
@@ -1663,7 +1663,7 @@ BOOL is_builtin_path( const UNICODE_STRING *path, WORD *machine )
* open_main_image
*/
static
NTSTATUS
open_main_image
(
WCHAR
*
image
,
void
**
module
,
SECTION_IMAGE_INFORMATION
*
info
,
enum
loadorder
loadorder
)
enum
loadorder
loadorder
,
USHORT
machine
)
{
static
const
WCHAR
soW
[]
=
{
'.'
,
's'
,
'o'
,
0
};
UNICODE_STRING
nt_name
;
...
...
@@ -1684,14 +1684,8 @@ static NTSTATUS open_main_image( WCHAR *image, void **module, SECTION_IMAGE_INFO
status
=
open_dll_file
(
unix_name
,
&
attr
,
&
mapping
);
if
(
!
status
)
{
*
module
=
NULL
;
status
=
NtMapViewOfSection
(
mapping
,
NtCurrentProcess
(),
module
,
0
,
0
,
NULL
,
&
size
,
ViewShare
,
0
,
PAGE_EXECUTE_READ
);
if
(
!
status
)
{
NtQuerySection
(
mapping
,
SectionImageInformation
,
info
,
sizeof
(
*
info
),
NULL
);
if
(
info
->
u
.
s
.
ComPlusNativeReady
)
info
->
Machine
=
native_machine
;
}
status
=
virtual_map_module
(
mapping
,
module
,
&
size
,
info
,
0
,
machine
);
if
(
!
status
&&
info
->
u
.
s
.
ComPlusNativeReady
)
info
->
Machine
=
native_machine
;
NtClose
(
mapping
);
}
else
if
(
status
==
STATUS_INVALID_IMAGE_NOT_MZ
&&
loadorder
!=
LO_NATIVE
)
...
...
@@ -1732,7 +1726,7 @@ NTSTATUS load_main_exe( const WCHAR *dos_name, const char *unix_name, const WCHA
if
((
status
=
unix_to_nt_file_name
(
unix_name
,
image
)))
goto
failed
;
init_unicode_string
(
&
nt_name
,
*
image
);
loadorder
=
get_load_order
(
&
nt_name
);
status
=
open_main_image
(
*
image
,
module
,
&
main_image_info
,
loadorder
);
status
=
open_main_image
(
*
image
,
module
,
&
main_image_info
,
loadorder
,
0
);
if
(
status
!=
STATUS_DLL_NOT_FOUND
)
return
status
;
free
(
*
image
);
}
...
...
@@ -1752,7 +1746,7 @@ NTSTATUS load_main_exe( const WCHAR *dos_name, const char *unix_name, const WCHA
init_unicode_string
(
&
nt_name
,
*
image
);
if
(
loadorder
==
LO_INVALID
)
loadorder
=
get_load_order
(
&
nt_name
);
status
=
open_main_image
(
*
image
,
module
,
&
main_image_info
,
loadorder
);
status
=
open_main_image
(
*
image
,
module
,
&
main_image_info
,
loadorder
,
0
);
if
(
status
!=
STATUS_DLL_NOT_FOUND
)
return
status
;
/* if path is in system dir, we can load the builtin even if the file itself doesn't exist */
...
...
dlls/ntdll/unix/unix_private.h
View file @
0433db1e
...
...
@@ -223,6 +223,8 @@ extern ULONG_PTR get_system_affinity_mask(void) DECLSPEC_HIDDEN;
extern
void
virtual_get_system_info
(
SYSTEM_BASIC_INFORMATION
*
info
,
BOOL
wow64
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
virtual_map_builtin_module
(
HANDLE
mapping
,
void
**
module
,
SIZE_T
*
size
,
SECTION_IMAGE_INFORMATION
*
info
,
ULONG_PTR
limit
,
WORD
machine
,
BOOL
prefer_native
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
virtual_map_module
(
HANDLE
mapping
,
void
**
module
,
SIZE_T
*
size
,
SECTION_IMAGE_INFORMATION
*
info
,
ULONG_PTR
limit
,
USHORT
machine
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
virtual_create_builtin_view
(
void
*
module
,
const
UNICODE_STRING
*
nt_name
,
pe_image_info_t
*
info
,
void
*
so_handle
)
DECLSPEC_HIDDEN
;
extern
TEB
*
virtual_alloc_first_teb
(
void
)
DECLSPEC_HIDDEN
;
...
...
dlls/ntdll/unix/virtual.c
View file @
0433db1e
...
...
@@ -3074,6 +3074,42 @@ NTSTATUS virtual_map_builtin_module( HANDLE mapping, void **module, SIZE_T *size
/***********************************************************************
* virtual_map_module
*/
NTSTATUS
virtual_map_module
(
HANDLE
mapping
,
void
**
module
,
SIZE_T
*
size
,
SECTION_IMAGE_INFORMATION
*
info
,
ULONG_PTR
limit
,
USHORT
machine
)
{
unsigned
int
status
;
mem_size_t
full_size
;
unsigned
int
sec_flags
;
HANDLE
shared_file
;
pe_image_info_t
*
image_info
=
NULL
;
ACCESS_MASK
access
=
SECTION_MAP_READ
|
SECTION_MAP_EXECUTE
;
WCHAR
*
filename
;
if
((
status
=
get_mapping_info
(
mapping
,
access
,
&
sec_flags
,
&
full_size
,
&
shared_file
,
&
image_info
)))
return
status
;
if
(
!
image_info
)
return
STATUS_INVALID_PARAMETER
;
*
module
=
NULL
;
*
size
=
0
;
filename
=
(
WCHAR
*
)(
image_info
+
1
);
/* check if we can replace that mapping with the builtin */
status
=
load_builtin
(
image_info
,
filename
,
machine
,
module
,
size
,
limit
);
if
(
status
==
STATUS_IMAGE_ALREADY_LOADED
)
status
=
virtual_map_image
(
mapping
,
access
,
module
,
size
,
shared_file
,
limit
,
0
,
machine
,
image_info
,
filename
,
FALSE
);
virtual_fill_image_information
(
image_info
,
info
);
if
(
shared_file
)
NtClose
(
shared_file
);
free
(
image_info
);
return
status
;
}
/***********************************************************************
* virtual_create_builtin_view
*/
NTSTATUS
virtual_create_builtin_view
(
void
*
module
,
const
UNICODE_STRING
*
nt_name
,
...
...
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