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
d32bc81e
Commit
d32bc81e
authored
Mar 28, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Mar 28, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Add some HGLOBAL/HLOCAL limits tests.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
1f472e90
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
0 deletions
+64
-0
heap.c
dlls/kernel32/tests/heap.c
+64
-0
No files found.
dlls/kernel32/tests/heap.c
View file @
d32bc81e
...
...
@@ -257,6 +257,7 @@ static void test_GlobalAlloc(void)
static
const
SIZE_T
buffer_size
=
ARRAY_SIZE
(
zero_buffer
);
const
HGLOBAL
invalid_mem
=
LongToHandle
(
0xdeadbee0
+
sizeof
(
void
*
)
);
void
*
const
invalid_ptr
=
LongToHandle
(
0xdeadbee0
);
HGLOBAL
globals
[
0x10000
];
HGLOBAL
mem
,
tmp_mem
;
BYTE
*
ptr
,
*
tmp_ptr
;
UINT
i
,
flags
;
...
...
@@ -268,6 +269,37 @@ static void test_GlobalAlloc(void)
mem
=
GlobalReAlloc
(
0
,
10
,
GMEM_MOVEABLE
);
ok
(
!
mem
,
"GlobalReAlloc succeeded
\n
"
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
globals
);
++
i
)
{
mem
=
GlobalAlloc
(
GMEM_MOVEABLE
|
GMEM_DISCARDABLE
,
0
);
ok
(
!!
mem
,
"GlobalAlloc failed, error %lu
\n
"
,
GetLastError
()
);
globals
[
i
]
=
mem
;
}
SetLastError
(
0xdeadbeef
);
mem
=
GlobalAlloc
(
GMEM_MOVEABLE
|
GMEM_DISCARDABLE
,
0
);
todo_wine
ok
(
!
mem
,
"GlobalAlloc succeeded
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_NOT_ENOUGH_MEMORY
,
"got error %lu
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
mem
=
LocalAlloc
(
LMEM_MOVEABLE
|
LMEM_DISCARDABLE
,
0
);
todo_wine
ok
(
!
mem
,
"LocalAlloc succeeded
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_NOT_ENOUGH_MEMORY
,
"got error %lu
\n
"
,
GetLastError
()
);
mem
=
GlobalAlloc
(
GMEM_DISCARDABLE
,
0
);
ok
(
!!
mem
,
"GlobalAlloc failed, error %lu
\n
"
,
GetLastError
()
);
mem
=
GlobalFree
(
mem
);
ok
(
!
mem
,
"GlobalFree failed, error %lu
\n
"
,
GetLastError
()
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
globals
);
++
i
)
{
mem
=
GlobalFree
(
globals
[
i
]
);
ok
(
!
mem
,
"GlobalFree failed, error %lu
\n
"
,
GetLastError
()
);
}
mem
=
GlobalAlloc
(
GMEM_MOVEABLE
,
0
);
ok
(
!!
mem
,
"GlobalAlloc failed, error %lu
\n
"
,
GetLastError
()
);
mem
=
GlobalReAlloc
(
mem
,
10
,
GMEM_MOVEABLE
);
...
...
@@ -593,6 +625,7 @@ static void test_LocalAlloc(void)
static
const
SIZE_T
buffer_size
=
ARRAY_SIZE
(
zero_buffer
);
const
HLOCAL
invalid_mem
=
LongToHandle
(
0xdeadbee0
+
sizeof
(
void
*
)
);
void
*
const
invalid_ptr
=
LongToHandle
(
0xdeadbee0
);
HLOCAL
locals
[
0x10000
];
HLOCAL
mem
,
tmp_mem
;
BYTE
*
ptr
,
*
tmp_ptr
;
UINT
i
,
flags
;
...
...
@@ -604,6 +637,37 @@ static void test_LocalAlloc(void)
mem
=
LocalReAlloc
(
0
,
10
,
LMEM_MOVEABLE
);
ok
(
!
mem
,
"LocalReAlloc succeeded
\n
"
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
locals
);
++
i
)
{
mem
=
LocalAlloc
(
LMEM_MOVEABLE
|
LMEM_DISCARDABLE
,
0
);
ok
(
!!
mem
,
"LocalAlloc failed, error %lu
\n
"
,
GetLastError
()
);
locals
[
i
]
=
mem
;
}
SetLastError
(
0xdeadbeef
);
mem
=
LocalAlloc
(
LMEM_MOVEABLE
|
LMEM_DISCARDABLE
,
0
);
todo_wine
ok
(
!
mem
,
"LocalAlloc succeeded
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_NOT_ENOUGH_MEMORY
,
"got error %lu
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
mem
=
GlobalAlloc
(
GMEM_MOVEABLE
|
GMEM_DISCARDABLE
,
0
);
todo_wine
ok
(
!
mem
,
"GlobalAlloc succeeded
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_NOT_ENOUGH_MEMORY
,
"got error %lu
\n
"
,
GetLastError
()
);
mem
=
LocalAlloc
(
LMEM_DISCARDABLE
,
0
);
ok
(
!!
mem
,
"LocalAlloc failed, error %lu
\n
"
,
GetLastError
()
);
mem
=
LocalFree
(
mem
);
ok
(
!
mem
,
"LocalFree failed, error %lu
\n
"
,
GetLastError
()
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
locals
);
++
i
)
{
mem
=
LocalFree
(
locals
[
i
]
);
ok
(
!
mem
,
"LocalFree failed, error %lu
\n
"
,
GetLastError
()
);
}
mem
=
LocalAlloc
(
LMEM_MOVEABLE
,
0
);
ok
(
!!
mem
,
"LocalAlloc failed, error %lu
\n
"
,
GetLastError
()
);
mem
=
LocalReAlloc
(
mem
,
10
,
LMEM_MOVEABLE
);
...
...
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