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
04ef02f6
Commit
04ef02f6
authored
May 10, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Pass limit instead of zero bits to internal memory mapping functions.
parent
9aac2d95
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
59 deletions
+55
-59
loader.c
dlls/ntdll/unix/loader.c
+10
-10
thread.c
dlls/ntdll/unix/thread.c
+4
-4
unix_private.h
dlls/ntdll/unix/unix_private.h
+27
-4
virtual.c
dlls/ntdll/unix/virtual.c
+14
-41
No files found.
dlls/ntdll/unix/loader.c
View file @
04ef02f6
...
...
@@ -1439,7 +1439,7 @@ static NTSTATUS open_dll_file( const char *name, OBJECT_ATTRIBUTES *attr, HANDLE
*/
static
NTSTATUS
open_builtin_pe_file
(
const
char
*
name
,
OBJECT_ATTRIBUTES
*
attr
,
void
**
module
,
SIZE_T
*
size
,
SECTION_IMAGE_INFORMATION
*
image_info
,
ULONG_PTR
zero_bits
,
WORD
machine
,
BOOL
prefer_native
)
ULONG_PTR
limit
,
WORD
machine
,
BOOL
prefer_native
)
{
NTSTATUS
status
;
HANDLE
mapping
;
...
...
@@ -1448,7 +1448,7 @@ static NTSTATUS open_builtin_pe_file( const char *name, OBJECT_ATTRIBUTES *attr,
status
=
open_dll_file
(
name
,
attr
,
&
mapping
);
if
(
!
status
)
{
status
=
virtual_map_builtin_module
(
mapping
,
module
,
size
,
image_info
,
zero_bits
,
machine
,
prefer_native
);
status
=
virtual_map_builtin_module
(
mapping
,
module
,
size
,
image_info
,
limit
,
machine
,
prefer_native
);
NtClose
(
mapping
);
}
return
status
;
...
...
@@ -1493,7 +1493,7 @@ static NTSTATUS open_builtin_so_file( const char *name, OBJECT_ATTRIBUTES *attr,
*/
static
NTSTATUS
find_builtin_dll
(
UNICODE_STRING
*
nt_name
,
void
**
module
,
SIZE_T
*
size_ptr
,
SECTION_IMAGE_INFORMATION
*
image_info
,
ULONG_PTR
zero_bits
,
WORD
machine
,
BOOL
prefer_native
)
ULONG_PTR
limit
,
WORD
machine
,
BOOL
prefer_native
)
{
unsigned
int
i
,
pos
,
namepos
,
maxlen
=
0
;
unsigned
int
len
=
nt_name
->
Length
/
sizeof
(
WCHAR
);
...
...
@@ -1530,7 +1530,7 @@ static NTSTATUS find_builtin_dll( UNICODE_STRING *nt_name, void **module, SIZE_T
/* try as a dll */
file
[
pos
+
len
+
1
]
=
0
;
ptr
=
prepend_build_dir_path
(
file
+
pos
,
".dll"
,
pe_dir
,
"/dlls"
);
status
=
open_builtin_pe_file
(
ptr
,
&
attr
,
module
,
size_ptr
,
image_info
,
zero_bits
,
machine
,
prefer_native
);
status
=
open_builtin_pe_file
(
ptr
,
&
attr
,
module
,
size_ptr
,
image_info
,
limit
,
machine
,
prefer_native
);
ptr
=
prepend_build_dir_path
(
file
+
pos
,
".dll"
,
""
,
"/dlls"
);
if
(
status
!=
STATUS_DLL_NOT_FOUND
)
goto
done
;
strcpy
(
file
+
pos
+
len
+
1
,
".so"
);
...
...
@@ -1540,7 +1540,7 @@ static NTSTATUS find_builtin_dll( UNICODE_STRING *nt_name, void **module, SIZE_T
/* now as a program */
file
[
pos
+
len
+
1
]
=
0
;
ptr
=
prepend_build_dir_path
(
file
+
pos
,
".exe"
,
pe_dir
,
"/programs"
);
status
=
open_builtin_pe_file
(
ptr
,
&
attr
,
module
,
size_ptr
,
image_info
,
zero_bits
,
machine
,
prefer_native
);
status
=
open_builtin_pe_file
(
ptr
,
&
attr
,
module
,
size_ptr
,
image_info
,
limit
,
machine
,
prefer_native
);
ptr
=
prepend_build_dir_path
(
file
+
pos
,
".exe"
,
""
,
"/programs"
);
if
(
status
!=
STATUS_DLL_NOT_FOUND
)
goto
done
;
strcpy
(
file
+
pos
+
len
+
1
,
".so"
);
...
...
@@ -1554,7 +1554,7 @@ static NTSTATUS find_builtin_dll( UNICODE_STRING *nt_name, void **module, SIZE_T
file
[
pos
+
len
+
1
]
=
0
;
ptr
=
prepend
(
ptr
,
pe_dir
,
strlen
(
pe_dir
)
);
ptr
=
prepend
(
ptr
,
dll_paths
[
i
],
strlen
(
dll_paths
[
i
])
);
status
=
open_builtin_pe_file
(
ptr
,
&
attr
,
module
,
size_ptr
,
image_info
,
zero_bits
,
machine
,
prefer_native
);
status
=
open_builtin_pe_file
(
ptr
,
&
attr
,
module
,
size_ptr
,
image_info
,
limit
,
machine
,
prefer_native
);
/* use so dir for unix lib */
ptr
=
file
+
pos
;
ptr
=
prepend
(
ptr
,
so_dir
,
strlen
(
so_dir
)
);
...
...
@@ -1565,7 +1565,7 @@ static NTSTATUS find_builtin_dll( UNICODE_STRING *nt_name, void **module, SIZE_T
if
(
status
!=
STATUS_DLL_NOT_FOUND
)
goto
done
;
file
[
pos
+
len
+
1
]
=
0
;
ptr
=
prepend
(
file
+
pos
,
dll_paths
[
i
],
strlen
(
dll_paths
[
i
])
);
status
=
open_builtin_pe_file
(
ptr
,
&
attr
,
module
,
size_ptr
,
image_info
,
zero_bits
,
machine
,
prefer_native
);
status
=
open_builtin_pe_file
(
ptr
,
&
attr
,
module
,
size_ptr
,
image_info
,
limit
,
machine
,
prefer_native
);
if
(
status
==
STATUS_IMAGE_MACHINE_TYPE_MISMATCH
)
{
found_image
=
TRUE
;
...
...
@@ -1598,7 +1598,7 @@ done:
* Return STATUS_IMAGE_ALREADY_LOADED if we should keep the native one that we have found.
*/
NTSTATUS
load_builtin
(
const
pe_image_info_t
*
image_info
,
WCHAR
*
filename
,
void
**
module
,
SIZE_T
*
size
,
ULONG_PTR
zero_bits
)
void
**
module
,
SIZE_T
*
size
,
ULONG_PTR
limit
)
{
WORD
machine
=
image_info
->
machine
;
/* request same machine as the native one */
NTSTATUS
status
;
...
...
@@ -1629,9 +1629,9 @@ NTSTATUS load_builtin( const pe_image_info_t *image_info, WCHAR *filename,
case
LO_NATIVE_BUILTIN
:
return
STATUS_IMAGE_ALREADY_LOADED
;
case
LO_BUILTIN
:
return
find_builtin_dll
(
&
nt_name
,
module
,
size
,
&
info
,
zero_bits
,
machine
,
FALSE
);
return
find_builtin_dll
(
&
nt_name
,
module
,
size
,
&
info
,
limit
,
machine
,
FALSE
);
default:
status
=
find_builtin_dll
(
&
nt_name
,
module
,
size
,
&
info
,
zero_bits
,
machine
,
(
loadorder
==
LO_DEFAULT
)
);
status
=
find_builtin_dll
(
&
nt_name
,
module
,
size
,
&
info
,
limit
,
machine
,
(
loadorder
==
LO_DEFAULT
)
);
if
(
status
==
STATUS_DLL_NOT_FOUND
||
status
==
STATUS_IMAGE_MACHINE_TYPE_MISMATCH
)
return
STATUS_IMAGE_ALREADY_LOADED
;
return
status
;
...
...
dlls/ntdll/unix/thread.c
View file @
04ef02f6
...
...
@@ -1174,7 +1174,7 @@ void set_thread_id( TEB *teb, DWORD pid, DWORD tid )
/***********************************************************************
* init_thread_stack
*/
NTSTATUS
init_thread_stack
(
TEB
*
teb
,
ULONG_PTR
zero_bits
,
SIZE_T
reserve_size
,
SIZE_T
commit_size
)
NTSTATUS
init_thread_stack
(
TEB
*
teb
,
ULONG_PTR
limit
,
SIZE_T
reserve_size
,
SIZE_T
commit_size
)
{
struct
ntdll_thread_data
*
thread_data
=
(
struct
ntdll_thread_data
*
)
&
teb
->
GdiTebBatch
;
WOW_TEB
*
wow_teb
=
get_wow_teb
(
teb
);
...
...
@@ -1203,7 +1203,7 @@ NTSTATUS init_thread_stack( TEB *teb, ULONG_PTR zero_bits, SIZE_T reserve_size,
teb
->
DeallocationStack
=
stack
.
DeallocationStack
;
/* 32-bit stack */
if
((
status
=
virtual_alloc_thread_stack
(
&
stack
,
zero_bits
?
zero_bits
:
0x7fffffff
,
if
((
status
=
virtual_alloc_thread_stack
(
&
stack
,
limit
?
limit
:
0x7fffffff
,
reserve_size
,
commit_size
,
TRUE
)))
return
status
;
wow_teb
->
Tib
.
StackBase
=
PtrToUlong
(
stack
.
StackBase
);
...
...
@@ -1218,7 +1218,7 @@ NTSTATUS init_thread_stack( TEB *teb, ULONG_PTR zero_bits, SIZE_T reserve_size,
}
/* native stack */
if
((
status
=
virtual_alloc_thread_stack
(
&
stack
,
zero_bits
,
reserve_size
,
commit_size
,
TRUE
)))
if
((
status
=
virtual_alloc_thread_stack
(
&
stack
,
limit
,
reserve_size
,
commit_size
,
TRUE
)))
return
status
;
teb
->
Tib
.
StackBase
=
stack
.
StackBase
;
teb
->
Tib
.
StackLimit
=
stack
.
StackLimit
;
...
...
@@ -1360,7 +1360,7 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle, ACCESS_MASK access, OBJECT_ATT
if
((
status
=
virtual_alloc_teb
(
&
teb
)))
goto
done
;
if
((
status
=
init_thread_stack
(
teb
,
zero_bits
,
stack_reserve
,
stack_commit
)))
if
((
status
=
init_thread_stack
(
teb
,
get_zero_bits_limit
(
zero_bits
)
,
stack_reserve
,
stack_commit
)))
{
virtual_free_teb
(
teb
);
goto
done
;
...
...
dlls/ntdll/unix/unix_private.h
View file @
04ef02f6
...
...
@@ -178,7 +178,7 @@ extern char **build_envp( const WCHAR *envW ) DECLSPEC_HIDDEN;
extern
char
*
get_alternate_wineloader
(
WORD
machine
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
exec_wineloader
(
char
**
argv
,
int
socketfd
,
const
pe_image_info_t
*
pe_info
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
load_builtin
(
const
pe_image_info_t
*
image_info
,
WCHAR
*
filename
,
void
**
addr_ptr
,
SIZE_T
*
size_ptr
,
ULONG_PTR
zero_bits
)
DECLSPEC_HIDDEN
;
void
**
addr_ptr
,
SIZE_T
*
size_ptr
,
ULONG_PTR
limit
)
DECLSPEC_HIDDEN
;
extern
BOOL
is_builtin_path
(
const
UNICODE_STRING
*
path
,
WORD
*
machine
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
load_main_exe
(
const
WCHAR
*
name
,
const
char
*
unix_name
,
const
WCHAR
*
curdir
,
WCHAR
**
image
,
void
**
module
)
DECLSPEC_HIDDEN
;
...
...
@@ -207,7 +207,7 @@ extern void fpux_to_fpu( I386_FLOATING_SAVE_AREA *fpu, const XSAVE_FORMAT *fpux
extern
void
fpu_to_fpux
(
XSAVE_FORMAT
*
fpux
,
const
I386_FLOATING_SAVE_AREA
*
fpu
)
DECLSPEC_HIDDEN
;
extern
void
*
get_cpu_area
(
USHORT
machine
)
DECLSPEC_HIDDEN
;
extern
void
set_thread_id
(
TEB
*
teb
,
DWORD
pid
,
DWORD
tid
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
init_thread_stack
(
TEB
*
teb
,
ULONG_PTR
zero_bits
,
SIZE_T
reserve_size
,
SIZE_T
commit_size
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
init_thread_stack
(
TEB
*
teb
,
ULONG_PTR
limit
,
SIZE_T
reserve_size
,
SIZE_T
commit_size
)
DECLSPEC_HIDDEN
;
extern
void
DECLSPEC_NORETURN
abort_thread
(
int
status
)
DECLSPEC_HIDDEN
;
extern
void
DECLSPEC_NORETURN
abort_process
(
int
status
)
DECLSPEC_HIDDEN
;
extern
void
DECLSPEC_NORETURN
exit_process
(
int
status
)
DECLSPEC_HIDDEN
;
...
...
@@ -225,14 +225,14 @@ extern void virtual_init(void) DECLSPEC_HIDDEN;
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
zero_bits
,
WORD
machine
,
BOOL
prefer_native
)
DECLSPEC_HIDDEN
;
ULONG_PTR
limit
,
WORD
machine
,
BOOL
prefer_native
)
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
;
extern
NTSTATUS
virtual_alloc_teb
(
TEB
**
ret_teb
)
DECLSPEC_HIDDEN
;
extern
void
virtual_free_teb
(
TEB
*
teb
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
virtual_clear_tls_index
(
ULONG
index
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
virtual_alloc_thread_stack
(
INITIAL_TEB
*
stack
,
ULONG_PTR
zero_bits
,
SIZE_T
reserve_size
,
extern
NTSTATUS
virtual_alloc_thread_stack
(
INITIAL_TEB
*
stack
,
ULONG_PTR
limit
,
SIZE_T
reserve_size
,
SIZE_T
commit_size
,
BOOL
guard_page
)
DECLSPEC_HIDDEN
;
extern
void
*
virtual_alloc_arm64ec_map
(
void
)
DECLSPEC_HIDDEN
;
extern
void
virtual_map_user_shared_data
(
void
)
DECLSPEC_HIDDEN
;
...
...
@@ -453,6 +453,29 @@ static inline client_ptr_t iosb_client_ptr( IO_STATUS_BLOCK *io )
return
wine_server_client_ptr
(
io
);
}
static
inline
ULONG_PTR
get_zero_bits_limit
(
ULONG_PTR
zero_bits
)
{
unsigned
int
shift
;
if
(
zero_bits
==
0
)
return
0
;
if
(
zero_bits
<
32
)
shift
=
32
+
zero_bits
;
else
{
shift
=
63
;
#ifdef _WIN64
if
(
zero_bits
>>
32
)
{
shift
-=
32
;
zero_bits
>>=
32
;
}
#endif
if
(
zero_bits
>>
16
)
{
shift
-=
16
;
zero_bits
>>=
16
;
}
if
(
zero_bits
>>
8
)
{
shift
-=
8
;
zero_bits
>>=
8
;
}
if
(
zero_bits
>>
4
)
{
shift
-=
4
;
zero_bits
>>=
4
;
}
if
(
zero_bits
>>
2
)
{
shift
-=
2
;
zero_bits
>>=
2
;
}
if
(
zero_bits
>>
1
)
{
shift
-=
1
;
}
}
return
(
~
(
UINT64
)
0
)
>>
shift
;
}
enum
loadorder
{
LO_INVALID
,
...
...
dlls/ntdll/unix/virtual.c
View file @
04ef02f6
...
...
@@ -1186,32 +1186,6 @@ static struct file_view *find_view( const void *addr, size_t size )
/***********************************************************************
* get_zero_bits_mask
*/
static
inline
UINT_PTR
get_zero_bits_mask
(
ULONG_PTR
zero_bits
)
{
unsigned
int
shift
;
if
(
zero_bits
==
0
)
return
0
;
if
(
zero_bits
<
32
)
shift
=
32
+
zero_bits
;
else
{
shift
=
63
;
#ifdef _WIN64
if
(
zero_bits
>>
32
)
{
shift
-=
32
;
zero_bits
>>=
32
;
}
#endif
if
(
zero_bits
>>
16
)
{
shift
-=
16
;
zero_bits
>>=
16
;
}
if
(
zero_bits
>>
8
)
{
shift
-=
8
;
zero_bits
>>=
8
;
}
if
(
zero_bits
>>
4
)
{
shift
-=
4
;
zero_bits
>>=
4
;
}
if
(
zero_bits
>>
2
)
{
shift
-=
2
;
zero_bits
>>=
2
;
}
if
(
zero_bits
>>
1
)
{
shift
-=
1
;
}
}
return
(
UINT_PTR
)((
~
(
UINT64
)
0
)
>>
shift
);
}
/***********************************************************************
* is_write_watch_range
*/
static
inline
BOOL
is_write_watch_range
(
const
void
*
addr
,
size_t
size
)
...
...
@@ -2604,7 +2578,7 @@ static unsigned int get_mapping_info( HANDLE handle, ACCESS_MASK access, unsigne
* Map a PE image section into memory.
*/
static
NTSTATUS
virtual_map_image
(
HANDLE
mapping
,
ACCESS_MASK
access
,
void
**
addr_ptr
,
SIZE_T
*
size_ptr
,
ULONG_PTR
zero_bits
,
HANDLE
shared_file
,
ULONG
alloc_type
,
ULONG_PTR
limit
,
HANDLE
shared_file
,
ULONG
alloc_type
,
pe_image_info_t
*
image_info
,
WCHAR
*
filename
,
BOOL
is_builtin
)
{
unsigned
int
vprot
=
SEC_IMAGE
|
SEC_FILE
|
VPROT_COMMITTED
|
VPROT_READ
|
VPROT_EXEC
|
VPROT_WRITECOPY
;
...
...
@@ -2633,9 +2607,9 @@ static NTSTATUS virtual_map_image( HANDLE mapping, ACCESS_MASK access, void **ad
if
((
ULONG_PTR
)
base
!=
image_info
->
base
)
base
=
NULL
;
if
((
char
*
)
base
>=
(
char
*
)
address_space_start
)
/* make sure the DOS area remains free */
status
=
map_view
(
&
view
,
base
,
size
,
alloc_type
&
MEM_TOP_DOWN
,
vprot
,
get_zero_bits_mask
(
zero_bits
)
,
0
);
status
=
map_view
(
&
view
,
base
,
size
,
alloc_type
&
MEM_TOP_DOWN
,
vprot
,
limit
,
0
);
if
(
status
)
status
=
map_view
(
&
view
,
NULL
,
size
,
alloc_type
&
MEM_TOP_DOWN
,
vprot
,
get_zero_bits_mask
(
zero_bits
)
,
0
);
if
(
status
)
status
=
map_view
(
&
view
,
NULL
,
size
,
alloc_type
&
MEM_TOP_DOWN
,
vprot
,
limit
,
0
);
if
(
status
)
goto
done
;
status
=
map_image_into_view
(
view
,
filename
,
unix_fd
,
base
,
image_info
->
header_size
,
...
...
@@ -2674,7 +2648,7 @@ done:
*
* Map a file section into memory.
*/
static
unsigned
int
virtual_map_section
(
HANDLE
handle
,
PVOID
*
addr_ptr
,
ULONG_PTR
zero_bits
,
static
unsigned
int
virtual_map_section
(
HANDLE
handle
,
PVOID
*
addr_ptr
,
ULONG_PTR
limit
,
SIZE_T
commit_size
,
const
LARGE_INTEGER
*
offset_ptr
,
SIZE_T
*
size_ptr
,
ULONG
alloc_type
,
ULONG
protect
)
{
...
...
@@ -2721,9 +2695,9 @@ static unsigned int virtual_map_section( HANDLE handle, PVOID *addr_ptr, ULONG_P
{
filename
=
(
WCHAR
*
)(
image_info
+
1
);
/* check if we can replace that mapping with the builtin */
res
=
load_builtin
(
image_info
,
filename
,
addr_ptr
,
size_ptr
,
zero_bits
);
res
=
load_builtin
(
image_info
,
filename
,
addr_ptr
,
size_ptr
,
limit
);
if
(
res
==
STATUS_IMAGE_ALREADY_LOADED
)
res
=
virtual_map_image
(
handle
,
access
,
addr_ptr
,
size_ptr
,
zero_bits
,
shared_file
,
res
=
virtual_map_image
(
handle
,
access
,
addr_ptr
,
size_ptr
,
limit
,
shared_file
,
alloc_type
,
image_info
,
filename
,
FALSE
);
if
(
shared_file
)
NtClose
(
shared_file
);
free
(
image_info
);
...
...
@@ -2758,7 +2732,7 @@ static unsigned int virtual_map_section( HANDLE handle, PVOID *addr_ptr, ULONG_P
server_enter_uninterrupted_section
(
&
virtual_mutex
,
&
sigset
);
res
=
map_view
(
&
view
,
base
,
size
,
alloc_type
&
MEM_TOP_DOWN
,
vprot
,
get_zero_bits_mask
(
zero_bits
)
,
0
);
res
=
map_view
(
&
view
,
base
,
size
,
alloc_type
&
MEM_TOP_DOWN
,
vprot
,
limit
,
0
);
if
(
res
)
goto
done
;
TRACE
(
"handle=%p size=%lx offset=%s
\n
"
,
handle
,
size
,
wine_dbgstr_longlong
(
offset
.
QuadPart
)
);
...
...
@@ -2939,7 +2913,7 @@ void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info, BOOL wow64 )
* virtual_map_builtin_module
*/
NTSTATUS
virtual_map_builtin_module
(
HANDLE
mapping
,
void
**
module
,
SIZE_T
*
size
,
SECTION_IMAGE_INFORMATION
*
info
,
ULONG_PTR
zero_bits
,
WORD
machine
,
BOOL
prefer_native
)
ULONG_PTR
limit
,
WORD
machine
,
BOOL
prefer_native
)
{
mem_size_t
full_size
;
unsigned
int
sec_flags
;
...
...
@@ -2976,7 +2950,7 @@ NTSTATUS virtual_map_builtin_module( HANDLE mapping, void **module, SIZE_T *size
else
{
status
=
virtual_map_image
(
mapping
,
SECTION_MAP_READ
|
SECTION_MAP_EXECUTE
,
module
,
size
,
zero_bits
,
shared_file
,
0
,
image_info
,
filename
,
TRUE
);
module
,
size
,
limit
,
shared_file
,
0
,
image_info
,
filename
,
TRUE
);
virtual_fill_image_information
(
image_info
,
info
);
}
...
...
@@ -3281,7 +3255,7 @@ NTSTATUS virtual_clear_tls_index( ULONG index )
/***********************************************************************
* virtual_alloc_thread_stack
*/
NTSTATUS
virtual_alloc_thread_stack
(
INITIAL_TEB
*
stack
,
ULONG_PTR
zero_bits
,
SIZE_T
reserve_size
,
NTSTATUS
virtual_alloc_thread_stack
(
INITIAL_TEB
*
stack
,
ULONG_PTR
limit
,
SIZE_T
reserve_size
,
SIZE_T
commit_size
,
BOOL
guard_page
)
{
struct
file_view
*
view
;
...
...
@@ -3298,9 +3272,8 @@ NTSTATUS virtual_alloc_thread_stack( INITIAL_TEB *stack, ULONG_PTR zero_bits, SI
server_enter_uninterrupted_section
(
&
virtual_mutex
,
&
sigset
);
if
((
status
=
map_view
(
&
view
,
NULL
,
size
,
FALSE
,
VPROT_READ
|
VPROT_WRITE
|
VPROT_COMMITTED
,
get_zero_bits_mask
(
zero_bits
),
0
))
!=
STATUS_SUCCESS
)
goto
done
;
status
=
map_view
(
&
view
,
NULL
,
size
,
FALSE
,
VPROT_READ
|
VPROT_WRITE
|
VPROT_COMMITTED
,
limit
,
0
);
if
(
status
!=
STATUS_SUCCESS
)
goto
done
;
#ifdef VALGRIND_STACK_REGISTER
VALGRIND_STACK_REGISTER
(
view
->
base
,
(
char
*
)
view
->
base
+
view
->
size
);
...
...
@@ -4060,7 +4033,7 @@ NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, ULONG_PTR z
}
if
(
!*
ret
)
limit
=
get_zero_bits_
mask
(
zero_bits
);
limit
=
get_zero_bits_
limit
(
zero_bits
);
else
limit
=
0
;
...
...
@@ -4875,7 +4848,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
return
result
.
map_view
.
status
;
}
return
virtual_map_section
(
handle
,
addr_ptr
,
zero_bits
,
commit_size
,
return
virtual_map_section
(
handle
,
addr_ptr
,
get_zero_bits_limit
(
zero_bits
)
,
commit_size
,
offset_ptr
,
size_ptr
,
alloc_type
,
protect
);
}
...
...
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