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
29fe1435
Commit
29fe1435
authored
Apr 08, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Apr 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Add some HeapWalk tests for the LFH frontend.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
98066b5a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
127 additions
and
0 deletions
+127
-0
heap.c
dlls/kernel32/tests/heap.c
+127
-0
No files found.
dlls/kernel32/tests/heap.c
View file @
29fe1435
...
...
@@ -740,6 +740,133 @@ static void test_HeapCreate(void)
ret
=
HeapDestroy
(
heap
);
ok
(
ret
,
"HeapDestroy failed, error %lu
\n
"
,
GetLastError
()
);
/* LFH actually doesn't enable immediately, the pattern is required */
heap
=
HeapCreate
(
0
,
0
,
0
);
ok
(
!!
heap
,
"HeapCreate failed, error %lu
\n
"
,
GetLastError
()
);
ok
(
!
((
ULONG_PTR
)
heap
&
0xffff
),
"wrong heap alignment
\n
"
);
compat_info
=
2
;
ret
=
pHeapSetInformation
(
heap
,
HeapCompatibilityInformation
,
&
compat_info
,
sizeof
(
compat_info
)
);
ok
(
ret
,
"HeapSetInformation failed, error %lu
\n
"
,
GetLastError
()
);
ret
=
pHeapQueryInformation
(
heap
,
HeapCompatibilityInformation
,
&
compat_info
,
sizeof
(
compat_info
),
&
size
);
ok
(
ret
,
"HeapQueryInformation failed, error %lu
\n
"
,
GetLastError
()
);
todo_wine
ok
(
compat_info
==
2
,
"got HeapCompatibilityInformation %lu
\n
"
,
compat_info
);
for
(
i
=
0
;
i
<
0x11
;
i
++
)
ptrs
[
i
]
=
pHeapAlloc
(
heap
,
0
,
24
+
2
*
sizeof
(
void
*
)
);
for
(
i
=
0
;
i
<
0x11
;
i
++
)
HeapFree
(
heap
,
0
,
ptrs
[
i
]
);
count
=
0
;
memset
(
&
entries
,
0xcd
,
sizeof
(
entries
)
);
memset
(
&
entry
,
0xcd
,
sizeof
(
entry
)
);
entry
.
lpData
=
NULL
;
SetLastError
(
0xdeadbeef
);
while
((
ret
=
HeapWalk
(
heap
,
&
entry
)))
entries
[
count
++
]
=
entry
;
ok
(
GetLastError
()
==
ERROR_NO_MORE_ITEMS
,
"got error %lu
\n
"
,
GetLastError
()
);
todo_wine
ok
(
count
==
3
,
"got count %lu
\n
"
,
count
);
todo_wine
ok
(
entries
[
0
].
wFlags
==
PROCESS_HEAP_REGION
,
"got wFlags %#x
\n
"
,
entries
[
0
].
wFlags
);
todo_wine
ok
(
entries
[
0
].
lpData
==
heap
,
"got lpData %p
\n
"
,
entries
[
0
].
lpData
);
todo_wine
ok
(
entries
[
0
].
cbData
<=
0x1000
/* sizeof(*heap) */
,
"got cbData %#lx
\n
"
,
entries
[
0
].
cbData
);
todo_wine
ok
(
entries
[
0
].
cbOverhead
==
0
,
"got cbOverhead %#x
\n
"
,
entries
[
0
].
cbOverhead
);
ok
(
entries
[
0
].
iRegionIndex
==
0
,
"got iRegionIndex %d
\n
"
,
entries
[
0
].
iRegionIndex
);
todo_wine
ok
(
entries
[
1
].
wFlags
==
0
,
"got wFlags %#x
\n
"
,
entries
[
1
].
wFlags
);
todo_wine
ok
(
entries
[
2
].
wFlags
==
PROCESS_HEAP_UNCOMMITTED_RANGE
,
"got wFlags %#x
\n
"
,
entries
[
2
].
wFlags
);
for
(
i
=
0
;
i
<
0x12
;
i
++
)
ptrs
[
i
]
=
pHeapAlloc
(
heap
,
0
,
24
+
2
*
sizeof
(
void
*
)
);
for
(
i
=
0
;
i
<
0x12
;
i
++
)
HeapFree
(
heap
,
0
,
ptrs
[
i
]
);
count
=
0
;
memset
(
&
entries
,
0xcd
,
sizeof
(
entries
)
);
memset
(
&
entry
,
0xcd
,
sizeof
(
entry
)
);
entry
.
lpData
=
NULL
;
SetLastError
(
0xdeadbeef
);
while
((
ret
=
HeapWalk
(
heap
,
&
entry
)))
entries
[
count
++
]
=
entry
;
ok
(
GetLastError
()
==
ERROR_NO_MORE_ITEMS
,
"got error %lu
\n
"
,
GetLastError
()
);
todo_wine
ok
(
count
>
24
,
"got count %lu
\n
"
,
count
);
if
(
count
<
2
)
count
=
2
;
todo_wine
ok
(
entries
[
0
].
wFlags
==
PROCESS_HEAP_REGION
,
"got wFlags %#x
\n
"
,
entries
[
0
].
wFlags
);
todo_wine
ok
(
entries
[
0
].
lpData
==
heap
,
"got lpData %p
\n
"
,
entries
[
0
].
lpData
);
todo_wine
ok
(
entries
[
0
].
cbData
<=
0x1000
/* sizeof(*heap) */
,
"got cbData %#lx
\n
"
,
entries
[
0
].
cbData
);
todo_wine
ok
(
entries
[
0
].
cbOverhead
==
0
,
"got cbOverhead %#x
\n
"
,
entries
[
0
].
cbOverhead
);
ok
(
entries
[
0
].
iRegionIndex
==
0
,
"got iRegionIndex %d
\n
"
,
entries
[
0
].
iRegionIndex
);
todo_wine
ok
(
entries
[
1
].
wFlags
==
0
,
"got wFlags %#x
\n
"
,
entries
[
1
].
wFlags
);
for
(
i
=
0
;
i
<
0x12
;
i
++
)
{
todo_wine
ok
(
entries
[
4
+
i
].
wFlags
==
0
,
"got wFlags %#x
\n
"
,
entries
[
4
+
i
].
wFlags
);
todo_wine
ok
(
entries
[
4
+
i
].
cbData
==
0x20
,
"got cbData %#lx
\n
"
,
entries
[
4
+
i
].
cbData
);
todo_wine
ok
(
entries
[
4
+
i
].
cbOverhead
==
2
*
sizeof
(
void
*
),
"got cbOverhead %#x
\n
"
,
entries
[
4
+
i
].
cbOverhead
);
}
if
(
entries
[
count
-
1
].
wFlags
==
PROCESS_HEAP_REGION
)
/* > win7 */
ok
(
entries
[
count
-
2
].
wFlags
==
PROCESS_HEAP_UNCOMMITTED_RANGE
,
"got wFlags %#x
\n
"
,
entries
[
count
-
2
].
wFlags
);
else
{
todo_wine
ok
(
entries
[
count
-
1
].
wFlags
==
PROCESS_HEAP_UNCOMMITTED_RANGE
,
"got wFlags %#x
\n
"
,
entries
[
count
-
2
].
wFlags
);
}
for
(
i
=
0
;
i
<
0x12
;
i
++
)
ptrs
[
i
]
=
pHeapAlloc
(
heap
,
0
,
24
+
2
*
sizeof
(
void
*
)
);
count
=
0
;
memset
(
&
entries
,
0xcd
,
sizeof
(
entries
)
);
memset
(
&
entry
,
0xcd
,
sizeof
(
entry
)
);
entry
.
lpData
=
NULL
;
SetLastError
(
0xdeadbeef
);
while
((
ret
=
HeapWalk
(
heap
,
&
entry
)))
entries
[
count
++
]
=
entry
;
ok
(
GetLastError
()
==
ERROR_NO_MORE_ITEMS
,
"got error %lu
\n
"
,
GetLastError
()
);
todo_wine
ok
(
count
>
24
,
"got count %lu
\n
"
,
count
);
if
(
count
<
2
)
count
=
2
;
todo_wine
ok
(
entries
[
0
].
wFlags
==
PROCESS_HEAP_REGION
,
"got wFlags %#x
\n
"
,
entries
[
0
].
wFlags
);
todo_wine
ok
(
entries
[
0
].
lpData
==
heap
,
"got lpData %p
\n
"
,
entries
[
0
].
lpData
);
ok
(
entries
[
0
].
cbData
<=
0x1000
/* sizeof(*heap) */
,
"got cbData %#lx
\n
"
,
entries
[
0
].
cbData
);
todo_wine
ok
(
entries
[
0
].
cbOverhead
==
0
,
"got cbOverhead %#x
\n
"
,
entries
[
0
].
cbOverhead
);
ok
(
entries
[
0
].
iRegionIndex
==
0
,
"got iRegionIndex %d
\n
"
,
entries
[
0
].
iRegionIndex
);
ok
(
entries
[
1
].
wFlags
==
0
||
entries
[
1
].
wFlags
==
PROCESS_HEAP_ENTRY_BUSY
/* win7 */
,
"got wFlags %#x
\n
"
,
entries
[
1
].
wFlags
);
for
(
i
=
1
;
i
<
count
-
2
;
i
++
)
{
if
(
entries
[
i
].
wFlags
!=
PROCESS_HEAP_ENTRY_BUSY
)
continue
;
todo_wine_if
(
sizeof
(
void
*
)
==
8
)
ok
(
entries
[
i
].
cbData
==
0x18
+
2
*
sizeof
(
void
*
),
"got cbData %#lx
\n
"
,
entries
[
i
].
cbData
);
ok
(
entries
[
i
].
cbOverhead
==
0x8
,
"got cbOverhead %#x
\n
"
,
entries
[
i
].
cbOverhead
);
}
if
(
entries
[
count
-
1
].
wFlags
==
PROCESS_HEAP_REGION
)
/* > win7 */
ok
(
entries
[
count
-
2
].
wFlags
==
PROCESS_HEAP_UNCOMMITTED_RANGE
,
"got wFlags %#x
\n
"
,
entries
[
count
-
2
].
wFlags
);
else
ok
(
entries
[
count
-
1
].
wFlags
==
PROCESS_HEAP_UNCOMMITTED_RANGE
,
"got wFlags %#x
\n
"
,
entries
[
count
-
2
].
wFlags
);
for
(
i
=
0
;
i
<
0x12
;
i
++
)
HeapFree
(
heap
,
0
,
ptrs
[
i
]
);
ret
=
HeapDestroy
(
heap
);
ok
(
ret
,
"HeapDestroy failed, error %lu
\n
"
,
GetLastError
()
);
}
...
...
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