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
dac05029
Commit
dac05029
authored
May 05, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
May 05, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Add more block layout tests with alloc flags.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
00c64fcb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
heap.c
dlls/kernel32/tests/heap.c
+17
-10
No files found.
dlls/kernel32/tests/heap.c
View file @
dac05029
...
...
@@ -1957,7 +1957,7 @@ static void test_LocalAlloc(void)
}
}
static
void
test_block_layout
(
HANDLE
heap
,
DWORD
global_flags
,
DWORD
heap_flags
)
static
void
test_block_layout
(
HANDLE
heap
,
DWORD
global_flags
,
DWORD
heap_flags
,
DWORD
alloc_flags
)
{
DWORD
padd_flags
=
HEAP_VALIDATE
|
HEAP_VALIDATE_ALL
|
HEAP_VALIDATE_PARAMS
;
SIZE_T
expect_size
,
diff
,
alloc_size
,
extra_size
,
tail_size
=
0
;
...
...
@@ -1975,7 +1975,7 @@ static void test_block_layout( HANDLE heap, DWORD global_flags, DWORD heap_flags
return
;
}
if
(
!
global_flags
)
extra_size
=
8
;
if
(
!
global_flags
&&
!
alloc_flags
)
extra_size
=
8
;
else
extra_size
=
2
*
sizeof
(
void
*
);
if
(
heap_flags
&
HEAP_TAIL_CHECKING_ENABLED
)
extra_size
+=
2
*
sizeof
(
void
*
);
if
(
heap_flags
&
padd_flags
)
extra_size
+=
2
*
sizeof
(
void
*
);
...
...
@@ -1988,11 +1988,11 @@ static void test_block_layout( HANDLE heap, DWORD global_flags, DWORD heap_flags
{
winetest_push_context
(
"size %#Ix"
,
alloc_size
);
ptr0
=
pHeapAlloc
(
heap
,
HEAP_ZERO_MEMORY
,
alloc_size
);
ptr0
=
pHeapAlloc
(
heap
,
alloc_flags
|
HEAP_ZERO_MEMORY
,
alloc_size
);
ok
(
!!
ptr0
,
"HeapAlloc failed, error %lu
\n
"
,
GetLastError
()
);
ptr1
=
pHeapAlloc
(
heap
,
HEAP_ZERO_MEMORY
,
alloc_size
);
ptr1
=
pHeapAlloc
(
heap
,
alloc_flags
|
HEAP_ZERO_MEMORY
,
alloc_size
);
ok
(
!!
ptr1
,
"HeapAlloc failed, error %lu
\n
"
,
GetLastError
()
);
ptr2
=
pHeapAlloc
(
heap
,
HEAP_ZERO_MEMORY
,
alloc_size
);
ptr2
=
pHeapAlloc
(
heap
,
alloc_flags
|
HEAP_ZERO_MEMORY
,
alloc_size
);
ok
(
!!
ptr2
,
"HeapAlloc failed, error %lu
\n
"
,
GetLastError
()
);
align
=
(
UINT_PTR
)
ptr0
|
(
UINT_PTR
)
ptr1
|
(
UINT_PTR
)
ptr2
;
...
...
@@ -2034,7 +2034,7 @@ static void test_block_layout( HANDLE heap, DWORD global_flags, DWORD heap_flags
alloc_size
=
0x20000
*
sizeof
(
void
*
)
-
0x2000
;
winetest_push_context
(
"size %#Ix"
,
alloc_size
);
ptr0
=
pHeapAlloc
(
heap
,
HEAP_ZERO_MEMORY
,
alloc_size
);
ptr0
=
pHeapAlloc
(
heap
,
alloc_flags
|
HEAP_ZERO_MEMORY
,
alloc_size
);
ok
(
!!
ptr0
,
"HeapAlloc failed, error %lu
\n
"
,
GetLastError
()
);
ok
(
!
((
UINT_PTR
)
ptr0
&
(
2
*
sizeof
(
void
*
)
-
1
)),
"got unexpected ptr align
\n
"
);
...
...
@@ -2050,11 +2050,11 @@ static void test_block_layout( HANDLE heap, DWORD global_flags, DWORD heap_flags
{
winetest_push_context
(
"size %#Ix"
,
alloc_size
);
ptr0
=
pHeapAlloc
(
heap
,
HEAP_ZERO_MEMORY
,
alloc_size
);
ptr0
=
pHeapAlloc
(
heap
,
alloc_flags
|
HEAP_ZERO_MEMORY
,
alloc_size
);
ok
(
!!
ptr0
,
"HeapAlloc failed, error %lu
\n
"
,
GetLastError
()
);
ptr1
=
pHeapAlloc
(
heap
,
0
,
alloc_size
);
ptr1
=
pHeapAlloc
(
heap
,
alloc_flags
,
alloc_size
);
ok
(
!!
ptr1
,
"HeapAlloc failed, error %lu
\n
"
,
GetLastError
()
);
ptr2
=
pHeapAlloc
(
heap
,
0
,
alloc_size
);
ptr2
=
pHeapAlloc
(
heap
,
alloc_flags
,
alloc_size
);
ok
(
!!
ptr2
,
"HeapAlloc failed, error %lu
\n
"
,
GetLastError
()
);
align
=
(
UINT_PTR
)
ptr0
|
(
UINT_PTR
)
ptr1
|
(
UINT_PTR
)
ptr2
;
...
...
@@ -2504,7 +2504,7 @@ static void test_child_heap( const char *arg )
heap
=
HeapCreate
(
HEAP_NO_SERIALIZE
,
0
,
0
);
ok
(
heap
!=
GetProcessHeap
(),
"got unexpected heap
\n
"
);
test_heap_layout
(
heap
,
global_flags
,
heap_flags
|
HEAP_NO_SERIALIZE
|
HEAP_GROWABLE
|
HEAP_PRIVATE
);
test_block_layout
(
heap
,
global_flags
,
heap_flags
|
HEAP_NO_SERIALIZE
|
HEAP_GROWABLE
|
HEAP_PRIVATE
);
test_block_layout
(
heap
,
global_flags
,
heap_flags
|
HEAP_NO_SERIALIZE
|
HEAP_GROWABLE
|
HEAP_PRIVATE
,
0
);
ret
=
HeapDestroy
(
heap
);
ok
(
ret
,
"HeapDestroy failed, error %lu
\n
"
,
GetLastError
()
);
...
...
@@ -2514,6 +2514,13 @@ static void test_child_heap( const char *arg )
ret
=
HeapDestroy
(
heap
);
ok
(
ret
,
"HeapDestroy failed, error %lu
\n
"
,
GetLastError
()
);
heap
=
HeapCreate
(
HEAP_NO_SERIALIZE
,
0
,
0
);
ok
(
heap
!=
GetProcessHeap
(),
"got unexpected heap
\n
"
);
test_block_layout
(
heap
,
global_flags
,
heap_flags
|
HEAP_NO_SERIALIZE
|
HEAP_GROWABLE
|
HEAP_PRIVATE
,
HEAP_TAIL_CHECKING_ENABLED
|
HEAP_FREE_CHECKING_ENABLED
);
ret
=
HeapDestroy
(
heap
);
ok
(
ret
,
"HeapDestroy failed, error %lu
\n
"
,
GetLastError
()
);
heap
=
HeapCreate
(
0
,
0x1000
,
0x10000
);
ok
(
heap
!=
GetProcessHeap
(),
"got unexpected heap
\n
"
);
test_heap_layout
(
heap
,
global_flags
,
heap_flags
|
HEAP_PRIVATE
);
...
...
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