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
839f00a9
Commit
839f00a9
authored
Mar 31, 2006
by
Detlef Riekenberg
Committed by
Alexandre Julliard
Mar 31, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel: Fix handling of invalid parameter in GlobalSize().
parent
714b66e9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
6 deletions
+23
-6
heap.c
dlls/kernel/heap.c
+13
-6
heap.c
dlls/kernel/tests/heap.c
+10
-0
No files found.
dlls/kernel/heap.c
View file @
839f00a9
...
...
@@ -751,13 +751,19 @@ HGLOBAL WINAPI GlobalFree(HGLOBAL hmem)
*
* Get the size of a global memory object.
*
* PARAMS
* hmem [I] Handle of the global memory object
*
* RETURNS
* Size in bytes of the global memory object
* 0: Failure
* Failure: 0
* Success: Size in Bytes of the global memory object
*
* NOTES
* When the handle is invalid, last error is set to ERROR_INVALID_HANDLE
*
*/
SIZE_T
WINAPI
GlobalSize
(
HGLOBAL
hmem
/* [in] Handle of global memory object */
)
{
SIZE_T
WINAPI
GlobalSize
(
HGLOBAL
hmem
)
{
DWORD
retval
;
PGLOBAL32_INTERN
pintern
;
...
...
@@ -785,7 +791,8 @@ SIZE_T WINAPI GlobalSize(
}
else
{
WARN
(
"invalid handle
\n
"
);
WARN
(
"invalid handle %p (Magic: 0x%04x)
\n
"
,
hmem
,
pintern
->
Magic
);
SetLastError
(
ERROR_INVALID_HANDLE
);
retval
=
0
;
}
RtlUnlockHeap
(
GetProcessHeap
());
...
...
dlls/kernel/tests/heap.c
View file @
839f00a9
...
...
@@ -92,6 +92,11 @@ START_TEST(heap)
ok
(
(
flags
==
GMEM_INVALID_HANDLE
)
&&
(
GetLastError
()
==
ERROR_INVALID_HANDLE
),
"returned 0x%04x with 0x%08lx (expected GMEM_INVALID_HANDLE with "
\
"ERROR_INVALID_HANDLE)
\n
"
,
flags
,
GetLastError
());
SetLastError
(
MAGIC_DEAD
);
size
=
GlobalSize
(
gbl
);
ok
(
(
size
==
0
)
&&
(
GetLastError
()
==
ERROR_INVALID_HANDLE
),
"returned %ld with 0x%08lx (expected '0' with ERROR_INVALID_HANDLE)
\n
"
,
size
,
GetLastError
());
/* Local*() functions */
...
...
@@ -128,6 +133,11 @@ START_TEST(heap)
ok
(
(
flags
==
LMEM_INVALID_HANDLE
)
&&
(
GetLastError
()
==
ERROR_INVALID_HANDLE
),
"returned 0x%04x with 0x%08lx (expected LMEM_INVALID_HANDLE with "
\
"ERROR_INVALID_HANDLE)
\n
"
,
flags
,
GetLastError
());
SetLastError
(
MAGIC_DEAD
);
size
=
LocalSize
(
gbl
);
ok
(
(
size
==
0
)
&&
(
GetLastError
()
==
ERROR_INVALID_HANDLE
),
"returned %ld with 0x%08lx (expected '0' with ERROR_INVALID_HANDLE)
\n
"
,
size
,
GetLastError
());
/* trying to lock empty memory should give an error */
...
...
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