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
bb980042
Commit
bb980042
authored
Oct 31, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Merge HEAP_InitSubHeap and HEAP_CreateSubHeap.
parent
6e1b7333
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
50 deletions
+24
-50
heap.c
dlls/ntdll/heap.c
+24
-50
No files found.
dlls/ntdll/heap.c
View file @
bb980042
...
...
@@ -755,24 +755,37 @@ static BOOL validate_large_arena( HEAP *heap, const ARENA_LARGE *arena, BOOL qui
/***********************************************************************
* HEAP_
Init
SubHeap
* HEAP_
Create
SubHeap
*/
static
SUBHEAP
*
HEAP_
Init
SubHeap
(
HEAP
*
heap
,
LPVOID
address
,
DWORD
flags
,
SIZE_T
commitSize
,
SIZE_T
totalSize
)
static
SUBHEAP
*
HEAP_
Create
SubHeap
(
HEAP
*
heap
,
LPVOID
address
,
DWORD
flags
,
SIZE_T
commitSize
,
SIZE_T
totalSize
)
{
SUBHEAP
*
subheap
;
FREE_LIST_ENTRY
*
pEntry
;
unsigned
int
i
;
/* Commit memory */
if
(
flags
&
HEAP_SHARED
)
commitSize
=
totalSize
;
/* always commit everything in a shared heap */
if
(
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
&
address
,
0
,
&
commitSize
,
MEM_COMMIT
,
get_protection_type
(
flags
)
))
if
(
!
address
)
{
WARN
(
"Could not commit %08lx bytes for sub-heap %p
\n
"
,
commitSize
,
address
);
return
NULL
;
/* round-up sizes on a 64K boundary */
totalSize
=
(
totalSize
+
0xffff
)
&
0xffff0000
;
commitSize
=
(
commitSize
+
0xffff
)
&
0xffff0000
;
if
(
!
commitSize
)
commitSize
=
0x10000
;
if
(
totalSize
<
commitSize
)
totalSize
=
commitSize
;
if
(
flags
&
HEAP_SHARED
)
commitSize
=
totalSize
;
/* always commit everything in a shared heap */
/* allocate the memory block */
if
(
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
&
address
,
0
,
&
totalSize
,
MEM_RESERVE
,
get_protection_type
(
flags
)
))
{
WARN
(
"Could not allocate %08lx bytes
\n
"
,
totalSize
);
return
NULL
;
}
if
(
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
&
address
,
0
,
&
commitSize
,
MEM_COMMIT
,
get_protection_type
(
flags
)
))
{
WARN
(
"Could not commit %08lx bytes for sub-heap %p
\n
"
,
commitSize
,
address
);
return
NULL
;
}
}
if
(
heap
)
...
...
@@ -857,45 +870,6 @@ static SUBHEAP *HEAP_InitSubHeap( HEAP *heap, LPVOID address, DWORD flags,
return
subheap
;
}
/***********************************************************************
* HEAP_CreateSubHeap
*
* Create a sub-heap of the given size.
* If heap == NULL, creates a main heap.
*/
static
SUBHEAP
*
HEAP_CreateSubHeap
(
HEAP
*
heap
,
void
*
base
,
DWORD
flags
,
SIZE_T
commitSize
,
SIZE_T
totalSize
)
{
LPVOID
address
=
base
;
SUBHEAP
*
ret
;
/* round-up sizes on a 64K boundary */
totalSize
=
(
totalSize
+
0xffff
)
&
0xffff0000
;
commitSize
=
(
commitSize
+
0xffff
)
&
0xffff0000
;
if
(
!
commitSize
)
commitSize
=
0x10000
;
if
(
totalSize
<
commitSize
)
totalSize
=
commitSize
;
if
(
!
address
)
{
/* allocate the memory block */
if
(
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
&
address
,
0
,
&
totalSize
,
MEM_RESERVE
,
get_protection_type
(
flags
)
))
{
WARN
(
"Could not allocate %08lx bytes
\n
"
,
totalSize
);
return
NULL
;
}
}
/* Initialize subheap */
if
(
!
(
ret
=
HEAP_InitSubHeap
(
heap
,
address
,
flags
,
commitSize
,
totalSize
)))
{
SIZE_T
size
=
0
;
if
(
!
base
)
NtFreeVirtualMemory
(
NtCurrentProcess
(),
&
address
,
&
size
,
MEM_RELEASE
);
}
return
ret
;
}
/***********************************************************************
* HEAP_FindFreeBlock
...
...
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