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
20505913
Commit
20505913
authored
Oct 11, 2004
by
Robert Shearman
Committed by
Alexandre Julliard
Oct 11, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix NtAllocateVirtualMemory declaration and fix users of the
function.
parent
ace5f3c6
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
40 additions
and
28 deletions
+40
-28
process.c
dlls/kernel/process.c
+5
-2
virtual.c
dlls/kernel/virtual.c
+2
-2
env.c
dlls/ntdll/env.c
+5
-4
heap.c
dlls/ntdll/heap.c
+6
-6
loader.c
dlls/ntdll/loader.c
+2
-1
relay.c
dlls/ntdll/relay.c
+4
-3
thread.c
dlls/ntdll/thread.c
+6
-3
virtual.c
dlls/ntdll/virtual.c
+9
-6
winternl.h
include/winternl.h
+1
-1
No files found.
dlls/kernel/process.c
View file @
20505913
...
...
@@ -379,6 +379,7 @@ static BOOL build_initial_environment( char **environ )
size
*=
sizeof
(
WCHAR
);
/* Now allocate the environment */
ptr
=
NULL
;
if
(
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
&
ptr
,
0
,
&
size
,
MEM_RESERVE
|
MEM_COMMIT
,
PAGE_READWRITE
)
!=
STATUS_SUCCESS
)
return
FALSE
;
...
...
@@ -719,7 +720,8 @@ static RTL_USER_PROCESS_PARAMETERS *init_user_process_params( size_t info_size )
RTL_USER_PROCESS_PARAMETERS
*
params
;
size
=
info_size
;
if
(
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
&
ptr
,
NULL
,
&
size
,
ptr
=
NULL
;
if
(
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
&
ptr
,
0
,
&
size
,
MEM_COMMIT
,
PAGE_READWRITE
)
!=
STATUS_SUCCESS
)
return
NULL
;
...
...
@@ -748,7 +750,8 @@ static RTL_USER_PROCESS_PARAMETERS *init_user_process_params( size_t info_size )
/* environment needs to be a separate memory block */
env_size
=
info_size
-
params
->
Size
;
if
(
!
env_size
)
env_size
=
1
;
if
(
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
&
ptr
,
NULL
,
&
env_size
,
ptr
=
NULL
;
if
(
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
&
ptr
,
0
,
&
env_size
,
MEM_COMMIT
,
PAGE_READWRITE
)
!=
STATUS_SUCCESS
)
return
NULL
;
memcpy
(
ptr
,
(
char
*
)
params
+
params
->
Size
,
info_size
-
params
->
Size
);
...
...
dlls/kernel/virtual.c
View file @
20505913
...
...
@@ -86,10 +86,10 @@ LPVOID WINAPI VirtualAllocEx(
DWORD
type
,
/* [in] Type of allocation */
DWORD
protect
)
/* [in] Type of access protection */
{
LPVOID
ret
;
LPVOID
ret
=
addr
;
NTSTATUS
status
;
if
((
status
=
NtAllocateVirtualMemory
(
hProcess
,
&
ret
,
addr
,
&
size
,
type
,
protect
)))
if
((
status
=
NtAllocateVirtualMemory
(
hProcess
,
&
ret
,
0
,
&
size
,
type
,
protect
)))
{
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
ret
=
NULL
;
...
...
dlls/ntdll/env.c
View file @
20505913
...
...
@@ -65,10 +65,10 @@ NTSTATUS WINAPI RtlCreateEnvironment(BOOLEAN inherit, PWSTR* env)
else
{
ULONG
size
=
1
;
nts
=
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
(
void
**
)
env
,
0
,
&
size
,
PVOID
addr
=
NULL
;
nts
=
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
&
addr
,
0
,
&
size
,
MEM_RESERVE
|
MEM_COMMIT
,
PAGE_READWRITE
);
if
(
nts
==
STATUS_SUCCESS
)
memset
(
*
env
,
0
,
size
);
if
(
nts
==
STATUS_SUCCESS
)
*
env
=
addr
;
}
return
nts
;
...
...
@@ -446,7 +446,8 @@ NTSTATUS WINAPI RtlCreateProcessParameters( RTL_USER_PROCESS_PARAMETERS **result
+
RuntimeInfo
->
MaximumLength
);
total_size
=
size
;
if
((
status
=
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
&
ptr
,
NULL
,
&
total_size
,
ptr
=
NULL
;
if
((
status
=
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
&
ptr
,
0
,
&
total_size
,
MEM_COMMIT
,
PAGE_READWRITE
))
==
STATUS_SUCCESS
)
{
RTL_USER_PROCESS_PARAMETERS
*
params
=
ptr
;
...
...
dlls/ntdll/heap.c
View file @
20505913
...
...
@@ -343,12 +343,12 @@ static inline BOOL HEAP_Commit( SUBHEAP *subheap, void *ptr )
if
(
size
>
subheap
->
size
)
size
=
subheap
->
size
;
if
(
size
<=
subheap
->
commitSize
)
return
TRUE
;
size
-=
subheap
->
commitSize
;
if
(
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
ptr
,
(
char
*
)
subheap
+
subheap
->
commitSize
,
ptr
=
(
char
*
)
subheap
+
subheap
->
commitSize
;
if
(
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
ptr
,
0
,
&
size
,
MEM_COMMIT
,
PAGE_EXECUTE_READWRITE
))
{
WARN
(
"Could not commit %08lx bytes at %08lx for heap %08lx
\n
"
,
size
,
(
DWORD
)((
char
*
)
subheap
+
subheap
->
commitSize
),
(
DWORD
)
subheap
->
heap
);
WARN
(
"Could not commit %08lx bytes at %p for heap %p
\n
"
,
size
,
ptr
,
subheap
->
heap
);
return
FALSE
;
}
subheap
->
commitSize
+=
size
;
...
...
@@ -530,7 +530,7 @@ static BOOL HEAP_InitSubHeap( HEAP *heap, LPVOID address, DWORD flags,
if
(
flags
&
HEAP_SHARED
)
commitSize
=
totalSize
;
/* always commit everything in a shared heap */
if
(
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
address
,
address
,
if
(
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
address
,
0
,
&
commitSize
,
MEM_COMMIT
,
PAGE_EXECUTE_READWRITE
))
{
WARN
(
"Could not commit %08lx bytes for sub-heap %p
\n
"
,
commitSize
,
address
);
...
...
@@ -619,7 +619,7 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, void *base, DWORD flags,
if
(
!
address
)
{
/* allocate the memory block */
if
(
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
address
,
NULL
,
&
totalSize
,
if
(
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
address
,
0
,
&
totalSize
,
MEM_RESERVE
,
PAGE_EXECUTE_READWRITE
))
{
WARN
(
"Could not allocate %08lx bytes
\n
"
,
totalSize
);
...
...
dlls/ntdll/loader.c
View file @
20505913
...
...
@@ -1139,7 +1139,8 @@ static void load_builtin_callback( void *module, const char *filename )
return
;
}
wm
->
ldr
.
Flags
|=
LDR_WINE_INTERNAL
;
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
addr
,
module
,
&
nt
->
OptionalHeader
.
SizeOfImage
,
addr
=
module
;
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
addr
,
0
,
&
nt
->
OptionalHeader
.
SizeOfImage
,
MEM_SYSTEM
|
MEM_IMAGE
,
PAGE_EXECUTE_WRITECOPY
);
/* fixup imports */
...
...
dlls/ntdll/relay.c
View file @
20505913
...
...
@@ -841,7 +841,8 @@ void SNOOP_SetupDLL(HMODULE hmod)
if
(
p
>
(
*
dll
)
->
name
&&
!
strcasecmp
(
p
,
".dll"
))
*
p
=
0
;
size
=
exports
->
NumberOfFunctions
*
sizeof
(
SNOOP_FUN
);
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
addr
,
NULL
,
&
size
,
addr
=
NULL
;
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
addr
,
0
,
&
size
,
MEM_COMMIT
|
MEM_RESERVE
,
PAGE_EXECUTE_READWRITE
);
if
(
!
addr
)
{
RtlFreeHeap
(
GetProcessHeap
(),
0
,
*
dll
);
...
...
@@ -1006,9 +1007,9 @@ void WINAPI SNOOP_DoEntry( CONTEXT86 *context )
}
if
(
!*
rets
)
{
SIZE_T
size
=
4096
;
VOID
*
addr
;
VOID
*
addr
=
NULL
;
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
addr
,
NULL
,
&
size
,
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
addr
,
0
,
&
size
,
MEM_COMMIT
|
MEM_RESERVE
,
PAGE_EXECUTE_READWRITE
);
if
(
!
addr
)
return
;
...
...
dlls/ntdll/thread.c
View file @
20505913
...
...
@@ -142,7 +142,8 @@ void thread_init(void)
server_init_thread
(
thread_info
.
pid
,
thread_info
.
tid
,
NULL
);
/* create a memory view for the TEB */
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
addr
,
teb
,
&
size
,
addr
=
teb
;
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
addr
,
0
,
&
size
,
MEM_SYSTEM
,
PAGE_EXECUTE_READWRITE
);
/* create the process heap */
...
...
@@ -179,7 +180,8 @@ static void start_thread( struct wine_pthread_thread_info *info )
/* allocate a memory view for the stack */
size
=
info
->
stack_size
;
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
teb
->
DeallocationStack
,
info
->
stack_base
,
teb
->
DeallocationStack
=
info
->
stack_base
;
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
teb
->
DeallocationStack
,
0
,
&
size
,
MEM_SYSTEM
,
PAGE_EXECUTE_READWRITE
);
/* limit is lower than base since the stack grows down */
teb
->
Tib
.
StackBase
=
(
char
*
)
info
->
stack_base
+
info
->
stack_size
;
...
...
@@ -263,7 +265,8 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
teb
->
wait_fd
[
1
]
=
-
1
;
teb
->
htask16
=
NtCurrentTeb
()
->
htask16
;
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
info
->
pthread_info
.
teb_base
,
teb
,
&
size
,
info
->
pthread_info
.
teb_base
=
teb
;
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
info
->
pthread_info
.
teb_base
,
0
,
&
size
,
MEM_SYSTEM
,
PAGE_EXECUTE_READWRITE
);
info
->
pthread_info
.
teb_size
=
size
;
info
->
pthread_info
.
teb_sel
=
teb
->
teb_sel
;
...
...
dlls/ntdll/virtual.c
View file @
20505913
...
...
@@ -1153,7 +1153,7 @@ void VIRTUAL_UseLargeAddressSpace(void)
* NtAllocateVirtualMemory (NTDLL.@)
* ZwAllocateVirtualMemory (NTDLL.@)
*/
NTSTATUS
WINAPI
NtAllocateVirtualMemory
(
HANDLE
process
,
PVOID
*
ret
,
PVOID
addr
,
NTSTATUS
WINAPI
NtAllocateVirtualMemory
(
HANDLE
process
,
PVOID
*
ret
,
ULONG
zero_bits
,
ULONG
*
size_ptr
,
ULONG
type
,
ULONG
protect
)
{
void
*
base
;
...
...
@@ -1162,7 +1162,7 @@ NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, PVOID addr,
NTSTATUS
status
=
STATUS_SUCCESS
;
struct
file_view
*
view
;
TRACE
(
"%p %p %08lx %lx %08lx
\n
"
,
process
,
addr
,
size
,
type
,
protect
);
TRACE
(
"%p %p %08lx %lx %08lx
\n
"
,
process
,
*
ret
,
size
,
type
,
protect
);
if
(
!
size
)
return
STATUS_INVALID_PARAMETER
;
...
...
@@ -1176,13 +1176,13 @@ NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, PVOID addr,
if
(
size
>
0x7fc00000
)
return
STATUS_WORKING_SET_LIMIT_RANGE
;
/* 2Gb - 4Mb */
if
(
addr
)
if
(
*
ret
)
{
if
(
type
&
MEM_RESERVE
)
/* Round down to 64k boundary */
base
=
ROUND_ADDR
(
addr
,
granularity_mask
);
base
=
ROUND_ADDR
(
*
ret
,
granularity_mask
);
else
base
=
ROUND_ADDR
(
addr
,
page_mask
);
size
=
(((
UINT_PTR
)
addr
+
size
+
page_mask
)
&
~
page_mask
)
-
(
UINT_PTR
)
base
;
base
=
ROUND_ADDR
(
*
ret
,
page_mask
);
size
=
(((
UINT_PTR
)
*
ret
+
size
+
page_mask
)
&
~
page_mask
)
-
(
UINT_PTR
)
base
;
/* disallow low 64k, wrap-around and kernel space */
if
(((
char
*
)
base
<=
(
char
*
)
granularity_mask
)
||
...
...
@@ -1202,6 +1202,9 @@ NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, PVOID addr,
type
&=
~
MEM_TOP_DOWN
;
}
if
(
zero_bits
)
WARN
(
"zero_bits %lu ignored
\n
"
,
zero_bits
);
/* Compute the alloc type flags */
if
(
!
(
type
&
MEM_SYSTEM
))
...
...
include/winternl.h
View file @
20505913
...
...
@@ -1268,7 +1268,7 @@ NTSTATUS WINAPI NtAccessCheck(PSECURITY_DESCRIPTOR,HANDLE,ACCESS_MASK,PGENERIC_
NTSTATUS
WINAPI
NtAdjustGroupsToken
(
HANDLE
,
BOOLEAN
,
PTOKEN_GROUPS
,
ULONG
,
PTOKEN_GROUPS
,
PULONG
);
NTSTATUS
WINAPI
NtAdjustPrivilegesToken
(
HANDLE
,
BOOLEAN
,
PTOKEN_PRIVILEGES
,
DWORD
,
PTOKEN_PRIVILEGES
,
PDWORD
);
NTSTATUS
WINAPI
NtAlertThread
(
HANDLE
ThreadHandle
);
NTSTATUS
WINAPI
NtAllocateVirtualMemory
(
HANDLE
,
PVOID
*
,
PVOID
,
ULONG
*
,
ULONG
,
ULONG
);
NTSTATUS
WINAPI
NtAllocateVirtualMemory
(
HANDLE
,
PVOID
*
,
ULONG
,
ULONG
*
,
ULONG
,
ULONG
);
NTSTATUS
WINAPI
NtCancelIoFile
(
HANDLE
,
PIO_STATUS_BLOCK
);
NTSTATUS
WINAPI
NtCancelTimer
(
HANDLE
,
BOOLEAN
*
);
NTSTATUS
WINAPI
NtClearEvent
(
HANDLE
);
...
...
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