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
cd03a51e
Commit
cd03a51e
authored
Apr 04, 2013
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Set the address space limit before running application code.
parent
4e25cd46
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
10 deletions
+27
-10
loader.c
dlls/ntdll/loader.c
+2
-2
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+2
-1
virtual.c
dlls/ntdll/virtual.c
+23
-7
No files found.
dlls/ntdll/loader.c
View file @
cd03a51e
...
...
@@ -2703,7 +2703,6 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
WINE_MODREF
*
wm
;
LPCWSTR
load_path
;
PEB
*
peb
=
NtCurrentTeb
()
->
Peb
;
IMAGE_NT_HEADERS
*
nt
=
RtlImageNtHeader
(
peb
->
ImageBaseAddress
);
if
(
main_exe_file
)
NtClose
(
main_exe_file
);
/* at this point the main module is created */
...
...
@@ -2721,6 +2720,7 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
if
(
!
peb
->
ProcessParameters
->
WindowTitle
.
Buffer
)
peb
->
ProcessParameters
->
WindowTitle
=
wm
->
ldr
.
FullDllName
;
version_init
(
wm
->
ldr
.
FullDllName
.
Buffer
);
virtual_set_large_address_space
();
LdrQueryImageFileExecutionOptions
(
&
peb
->
ProcessParameters
->
ImagePathName
,
globalflagW
,
REG_DWORD
,
&
peb
->
NtGlobalFlag
,
sizeof
(
peb
->
NtGlobalFlag
),
NULL
);
...
...
@@ -2742,7 +2742,7 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
status
=
wine_call_on_stack
(
attach_process_dlls
,
wm
,
NtCurrentTeb
()
->
Tib
.
StackBase
);
if
(
status
!=
STATUS_SUCCESS
)
goto
error
;
virtual_release_address_space
(
nt
->
FileHeader
.
Characteristics
&
IMAGE_FILE_LARGE_ADDRESS_AWARE
);
virtual_release_address_space
();
virtual_clear_thread_stack
();
wine_switch_to_stack
(
start_process
,
kernel_start
,
NtCurrentTeb
()
->
Tib
.
StackBase
);
...
...
dlls/ntdll/ntdll_misc.h
View file @
cd03a51e
...
...
@@ -171,7 +171,8 @@ extern NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err ) DECLSPEC_HIDDEN;
extern
BOOL
virtual_check_buffer_for_read
(
const
void
*
ptr
,
SIZE_T
size
)
DECLSPEC_HIDDEN
;
extern
BOOL
virtual_check_buffer_for_write
(
void
*
ptr
,
SIZE_T
size
)
DECLSPEC_HIDDEN
;
extern
void
VIRTUAL_SetForceExec
(
BOOL
enable
)
DECLSPEC_HIDDEN
;
extern
void
virtual_release_address_space
(
BOOL
free_high_mem
)
DECLSPEC_HIDDEN
;
extern
void
virtual_release_address_space
(
void
)
DECLSPEC_HIDDEN
;
extern
void
virtual_set_large_address_space
(
void
)
DECLSPEC_HIDDEN
;
extern
struct
_KUSER_SHARED_DATA
*
user_shared_data
DECLSPEC_HIDDEN
;
/* completion */
...
...
dlls/ntdll/virtual.c
View file @
cd03a51e
...
...
@@ -1815,22 +1815,21 @@ static int free_reserved_memory( void *base, size_t size, void *arg )
*
* Release some address space once we have loaded and initialized the app.
*/
void
virtual_release_address_space
(
BOOL
free_high_mem
)
void
virtual_release_address_space
(
void
)
{
struct
free_range
range
;
sigset_t
sigset
;
if
(
user_space_limit
==
address_space_limit
)
return
;
/* no need to free anything */
if
(
is_win64
)
return
;
server_enter_uninterrupted_section
(
&
csVirtual
,
&
sigset
);
/* no large address space on win9x */
if
(
free_high_mem
&&
NtCurrentTeb
()
->
Peb
->
OSPlatformId
==
VER_PLATFORM_WIN32_NT
)
range
.
base
=
(
char
*
)
0x82000000
;
range
.
limit
=
user_space_limit
;
if
(
range
.
limit
>
range
.
base
)
{
range
.
base
=
(
char
*
)
0x82000000
;
range
.
limit
=
address_space_limit
;
while
(
wine_mmap_enum_reserved_areas
(
free_reserved_memory
,
&
range
,
1
))
/* nothing */
;
user_space_limit
=
working_set_limit
=
address_space_limit
;
}
else
{
...
...
@@ -1846,6 +1845,23 @@ void virtual_release_address_space( BOOL free_high_mem )
/***********************************************************************
* virtual_set_large_address_space
*
* Enable use of a large address space when allowed by the application.
*/
void
virtual_set_large_address_space
(
void
)
{
IMAGE_NT_HEADERS
*
nt
=
RtlImageNtHeader
(
NtCurrentTeb
()
->
Peb
->
ImageBaseAddress
);
if
(
!
(
nt
->
FileHeader
.
Characteristics
&
IMAGE_FILE_LARGE_ADDRESS_AWARE
))
return
;
/* no large address space on win9x */
if
(
NtCurrentTeb
()
->
Peb
->
OSPlatformId
!=
VER_PLATFORM_WIN32_NT
)
return
;
user_space_limit
=
working_set_limit
=
address_space_limit
;
}
/***********************************************************************
* NtAllocateVirtualMemory (NTDLL.@)
* ZwAllocateVirtualMemory (NTDLL.@)
*/
...
...
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