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
c77642ec
Commit
c77642ec
authored
Jul 21, 2023
by
Paul Gofman
Committed by
Alexandre Julliard
Jul 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Match Windows used block filling.
Test rewritten by Rémi Bernon.
parent
0c9e8e65
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
2 deletions
+33
-2
heap.c
dlls/kernel32/tests/heap.c
+29
-0
heap.c
dlls/ntdll/heap.c
+4
-2
No files found.
dlls/kernel32/tests/heap.c
View file @
c77642ec
...
...
@@ -3270,6 +3270,35 @@ static void test_heap_checks( DWORD flags )
ret
=
HeapFree
(
GetProcessHeap
(),
0
,
p
);
ok
(
ret
,
"HeapFree failed
\n
"
);
if
(
flags
&
HEAP_FREE_CHECKING_ENABLED
)
{
UINT
*
p32
,
tmp
=
0
;
size
=
4
+
3
;
p
=
pHeapAlloc
(
GetProcessHeap
(),
0
,
size
);
ok
(
!!
p
,
"HeapAlloc failed
\n
"
);
p32
=
(
UINT
*
)
p
;
ok
(
p32
[
0
]
==
0xbaadf00d
,
"got %#x
\n
"
,
p32
[
0
]
);
memcpy
(
&
tmp
,
p
+
size
-
3
,
3
);
ok
(
tmp
!=
0xadf00d
,
"got %#x
\n
"
,
tmp
);
memset
(
p
,
0xcc
,
size
);
size
+=
2
*
4
;
p
=
pHeapReAlloc
(
GetProcessHeap
(),
0
,
p
,
size
);
ok
(
!!
p
,
"HeapReAlloc failed
\n
"
);
p32
=
(
UINT
*
)
p
;
ok
(
p32
[
0
]
==
0xcccccccc
,
"got %#x
\n
"
,
p32
[
0
]
);
ok
(
p32
[
1
]
<<
8
==
0xcccccc00
,
"got %#x
\n
"
,
p32
[
1
]
);
ok
(
p32
[
2
]
==
0xbaadf00d
,
"got %#x
\n
"
,
p32
[
2
]
);
memcpy
(
&
tmp
,
p
+
size
-
3
,
3
);
ok
(
tmp
!=
0xadf00d
,
"got %#x
\n
"
,
tmp
);
ret
=
pHeapFree
(
GetProcessHeap
(),
0
,
p
);
ok
(
ret
,
"failed.
\n
"
);
}
p
=
HeapAlloc
(
GetProcessHeap
(),
0
,
37
);
ok
(
p
!=
NULL
,
"HeapAlloc failed
\n
"
);
memset
(
p
,
0xcc
,
37
);
...
...
dlls/ntdll/heap.c
View file @
c77642ec
...
...
@@ -139,7 +139,7 @@ C_ASSERT( sizeof(ARENA_LARGE) == 4 * BLOCK_ALIGN );
#define BLOCK_TYPE_FREE 'F'
#define BLOCK_TYPE_LARGE 'L'
#define BLOCK_FILL_USED 0x
55
#define BLOCK_FILL_USED 0x
baadf00d
#define BLOCK_FILL_TAIL 0xab
#define BLOCK_FILL_FREE 0xfeeefeee
...
...
@@ -513,6 +513,7 @@ static inline void mark_block_tail( struct block *block, DWORD flags )
static
inline
void
initialize_block
(
struct
block
*
block
,
SIZE_T
old_size
,
SIZE_T
size
,
DWORD
flags
)
{
char
*
data
=
(
char
*
)(
block
+
1
);
SIZE_T
i
;
if
(
size
<=
old_size
)
return
;
...
...
@@ -524,7 +525,8 @@ static inline void initialize_block( struct block *block, SIZE_T old_size, SIZE_
else
if
(
flags
&
HEAP_FREE_CHECKING_ENABLED
)
{
valgrind_make_writable
(
data
+
old_size
,
size
-
old_size
);
memset
(
data
+
old_size
,
BLOCK_FILL_USED
,
size
-
old_size
);
i
=
ROUND_SIZE
(
old_size
,
sizeof
(
DWORD
)
-
1
)
/
sizeof
(
DWORD
);
for
(;
i
<
size
/
sizeof
(
DWORD
);
++
i
)
((
DWORD
*
)
data
)[
i
]
=
BLOCK_FILL_USED
;
}
}
...
...
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