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
7d47feae
Commit
7d47feae
authored
May 27, 2009
by
Peter Hedlund
Committed by
Alexandre Julliard
May 28, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Mask out obsolete flags in GlobalAlloc.
parent
e70c80ad
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
0 deletions
+52
-0
heap.c
dlls/kernel32/heap.c
+3
-0
heap.c
dlls/kernel32/tests/heap.c
+49
-0
No files found.
dlls/kernel32/heap.c
View file @
7d47feae
...
...
@@ -375,6 +375,9 @@ HGLOBAL WINAPI GlobalAlloc(
pintern
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GLOBAL32_INTERN
));
if
(
pintern
)
{
/* Mask out obsolete flags */
flags
&=
~
(
GMEM_LOWER
|
GMEM_NOCOMPACT
|
GMEM_NOT_BANKED
|
GMEM_NOTIFY
);
pintern
->
Magic
=
MAGIC_GLOBAL_USED
;
pintern
->
Flags
=
flags
>>
8
;
pintern
->
LockCount
=
0
;
...
...
dlls/kernel32/tests/heap.c
View file @
7d47feae
...
...
@@ -362,9 +362,58 @@ static void test_heap(void)
GlobalFree
(
gbl
);
}
static
void
test_obsolete_flags
(
void
)
{
static
struct
{
UINT
flags
;
UINT
globalflags
;
}
test_global_flags
[]
=
{
{
GMEM_FIXED
|
GMEM_NOTIFY
,
0
},
{
GMEM_FIXED
|
GMEM_DISCARDABLE
,
0
},
{
GMEM_MOVEABLE
|
GMEM_NOTIFY
,
0
},
{
GMEM_MOVEABLE
|
GMEM_DDESHARE
,
GMEM_DDESHARE
},
{
GMEM_MOVEABLE
|
GMEM_NOT_BANKED
,
0
},
{
GMEM_MOVEABLE
|
GMEM_NODISCARD
,
0
},
{
GMEM_MOVEABLE
|
GMEM_DISCARDABLE
,
GMEM_DISCARDABLE
},
{
GMEM_MOVEABLE
|
GMEM_DDESHARE
|
GMEM_DISCARDABLE
|
GMEM_LOWER
|
GMEM_NOCOMPACT
|
GMEM_NODISCARD
|
GMEM_NOT_BANKED
|
GMEM_NOTIFY
,
GMEM_DDESHARE
|
GMEM_DISCARDABLE
},
};
unsigned
int
i
;
HGLOBAL
gbl
;
UINT
resultflags
;
UINT
(
WINAPI
*
pGlobalFlags
)(
HGLOBAL
);
pGlobalFlags
=
(
void
*
)
GetProcAddress
(
GetModuleHandleA
(
"kernel32"
),
"GlobalFlags"
);
if
(
!
pGlobalFlags
)
{
win_skip
(
"GlobalFlags is not available
\n
"
);
return
;
}
for
(
i
=
0
;
i
<
sizeof
(
test_global_flags
)
/
sizeof
(
test_global_flags
[
0
]);
i
++
)
{
gbl
=
GlobalAlloc
(
test_global_flags
[
i
].
flags
,
4
);
ok
(
gbl
!=
NULL
,
"GlobalAlloc failed
\n
"
);
SetLastError
(
MAGIC_DEAD
);
resultflags
=
pGlobalFlags
(
gbl
);
ok
(
resultflags
==
test_global_flags
[
i
].
globalflags
||
broken
(
resultflags
==
(
test_global_flags
[
i
].
globalflags
&
~
GMEM_DDESHARE
)),
/* win9x */
"%u: expected 0x%08x, but returned 0x%08x with %d
\n
"
,
i
,
test_global_flags
[
i
].
globalflags
,
resultflags
,
GetLastError
()
);
GlobalFree
(
gbl
);
}
}
START_TEST
(
heap
)
{
test_heap
();
test_obsolete_flags
();
/* Test both short and very long blocks */
test_sized_HeapAlloc
(
1
);
...
...
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