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
185e168a
Commit
185e168a
authored
May 10, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Add a helper function to process MEM_EXTENDED_PARAMETER parameters.
parent
04ef02f6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
23 deletions
+35
-23
virtual.c
dlls/ntdll/unix/virtual.c
+35
-23
No files found.
dlls/ntdll/unix/virtual.c
View file @
185e168a
...
@@ -4041,22 +4041,11 @@ NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, ULONG_PTR z
...
@@ -4041,22 +4041,11 @@ NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, ULONG_PTR z
}
}
/***********************************************************************
static
NTSTATUS
get_extended_params
(
const
MEM_EXTENDED_PARAMETER
*
parameters
,
ULONG
count
,
* NtAllocateVirtualMemoryEx (NTDLL.@)
ULONG_PTR
*
limit
,
ULONG_PTR
*
align
,
ULONG
*
attributes
)
* ZwAllocateVirtualMemoryEx (NTDLL.@)
*/
NTSTATUS
WINAPI
NtAllocateVirtualMemoryEx
(
HANDLE
process
,
PVOID
*
ret
,
SIZE_T
*
size_ptr
,
ULONG
type
,
ULONG
protect
,
MEM_EXTENDED_PARAMETER
*
parameters
,
ULONG
count
)
{
{
ULONG_PTR
limit
=
0
;
ULONG_PTR
align
=
0
;
ULONG
attributes
=
0
;
MEM_ADDRESS_REQUIREMENTS
*
r
=
NULL
;
MEM_ADDRESS_REQUIREMENTS
*
r
=
NULL
;
unsigned
int
i
;
ULONG
i
;
TRACE
(
"%p %p %08lx %x %08x %p %u
\n
"
,
process
,
*
ret
,
*
size_ptr
,
(
int
)
type
,
(
int
)
protect
,
parameters
,
(
int
)
count
);
if
(
count
&&
!
parameters
)
return
STATUS_INVALID_PARAMETER
;
if
(
count
&&
!
parameters
)
return
STATUS_INVALID_PARAMETER
;
...
@@ -4074,25 +4063,26 @@ NTSTATUS WINAPI NtAllocateVirtualMemoryEx( HANDLE process, PVOID *ret, SIZE_T *s
...
@@ -4074,25 +4063,26 @@ NTSTATUS WINAPI NtAllocateVirtualMemoryEx( HANDLE process, PVOID *ret, SIZE_T *s
if
(
r
->
Alignment
)
if
(
r
->
Alignment
)
{
{
if
(
*
ret
||
(
r
->
Alignment
&
(
r
->
Alignment
-
1
))
||
r
->
Alignment
-
1
<
granularity_mask
)
if
((
r
->
Alignment
&
(
r
->
Alignment
-
1
))
||
r
->
Alignment
-
1
<
granularity_mask
)
{
{
WARN
(
"Invalid alignment %lu.
\n
"
,
r
->
Alignment
);
WARN
(
"Invalid alignment %lu.
\n
"
,
r
->
Alignment
);
return
STATUS_INVALID_PARAMETER
;
return
STATUS_INVALID_PARAMETER
;
}
}
align
=
r
->
Alignment
;
*
align
=
r
->
Alignment
;
}
}
if
(
r
->
HighestEndingAddress
)
limit
=
(
ULONG_PTR
)
r
->
HighestEndingAddress
;
{
if
(
limit
&&
(
*
ret
||
limit
>
(
ULONG_PTR
)
user_space_limit
||
((
limit
+
1
)
&
(
page_mask
-
1
))))
*
limit
=
(
ULONG_PTR
)
r
->
HighestEndingAddress
;
if
(
*
limit
>
(
ULONG_PTR
)
user_space_limit
||
((
*
limit
+
1
)
&
(
page_mask
-
1
)))
{
{
WARN
(
"Invalid limit %p.
\n
"
,
r
->
HighestEndingAddress
);
WARN
(
"Invalid limit %p.
\n
"
,
r
->
HighestEndingAddress
);
return
STATUS_INVALID_PARAMETER
;
return
STATUS_INVALID_PARAMETER
;
}
}
TRACE
(
"limit %p, align %p.
\n
"
,
(
void
*
)
limit
,
(
void
*
)
align
);
}
break
;
break
;
case
MemExtendedParameterAttributeFlags
:
case
MemExtendedParameterAttributeFlags
:
attributes
=
parameters
[
i
].
ULong
;
*
attributes
=
parameters
[
i
].
ULong
;
break
;
break
;
case
MemExtendedParameterNumaNode
:
case
MemExtendedParameterNumaNode
:
...
@@ -4107,14 +4097,36 @@ NTSTATUS WINAPI NtAllocateVirtualMemoryEx( HANDLE process, PVOID *ret, SIZE_T *s
...
@@ -4107,14 +4097,36 @@ NTSTATUS WINAPI NtAllocateVirtualMemoryEx( HANDLE process, PVOID *ret, SIZE_T *s
return
STATUS_INVALID_PARAMETER
;
return
STATUS_INVALID_PARAMETER
;
}
}
}
}
return
STATUS_SUCCESS
;
}
/***********************************************************************
* NtAllocateVirtualMemoryEx (NTDLL.@)
* ZwAllocateVirtualMemoryEx (NTDLL.@)
*/
NTSTATUS
WINAPI
NtAllocateVirtualMemoryEx
(
HANDLE
process
,
PVOID
*
ret
,
SIZE_T
*
size_ptr
,
ULONG
type
,
ULONG
protect
,
MEM_EXTENDED_PARAMETER
*
parameters
,
ULONG
count
)
{
ULONG_PTR
limit
=
0
;
ULONG_PTR
align
=
0
;
ULONG
attributes
=
0
;
unsigned
int
status
;
TRACE
(
"%p %p %08lx %x %08x %p %u
\n
"
,
process
,
*
ret
,
*
size_ptr
,
(
int
)
type
,
(
int
)
protect
,
parameters
,
(
int
)
count
);
status
=
get_extended_params
(
parameters
,
count
,
&
limit
,
&
align
,
&
attributes
);
if
(
status
)
return
status
;
if
(
*
ret
&&
(
align
||
limit
))
return
STATUS_INVALID_PARAMETER
;
if
(
!*
size_ptr
)
return
STATUS_INVALID_PARAMETER
;
if
(
!*
size_ptr
)
return
STATUS_INVALID_PARAMETER
;
if
(
process
!=
NtCurrentProcess
())
if
(
process
!=
NtCurrentProcess
())
{
{
apc_call_t
call
;
apc_call_t
call
;
apc_result_t
result
;
apc_result_t
result
;
unsigned
int
status
;
memset
(
&
call
,
0
,
sizeof
(
call
)
);
memset
(
&
call
,
0
,
sizeof
(
call
)
);
...
...
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