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
0597e659
Commit
0597e659
authored
May 09, 2010
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 10, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Fix return code from LocalUnlock for pointer passed to it.
parent
9494cdc5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
5 deletions
+32
-5
heap.c
dlls/kernel32/heap.c
+8
-1
heap.c
dlls/kernel32/tests/heap.c
+24
-4
No files found.
dlls/kernel32/heap.c
View file @
0597e659
...
...
@@ -1116,7 +1116,14 @@ SIZE_T WINAPI LocalSize(
*/
BOOL
WINAPI
LocalUnlock
(
HLOCAL
handle
/* [in] Handle of memory object */
)
{
)
{
if
(
ISPOINTER
(
handle
))
{
SetLastError
(
ERROR_NOT_LOCKED
);
return
FALSE
;
}
return
GlobalUnlock
(
handle
);
}
...
...
dlls/kernel32/tests/heap.c
View file @
0597e659
...
...
@@ -249,14 +249,27 @@ static void test_heap(void)
res
=
GlobalUnlock
(
gbl
);
ok
(
res
==
1
||
res
==
0
,
/* win9x */
broken
(
res
==
0
)
,
/* win9x */
"Expected 1 or 0, got %d
\n
"
,
res
);
res
=
GlobalUnlock
(
gbl
);
ok
(
res
==
1
||
res
==
0
,
/* win9x */
broken
(
res
==
0
)
,
/* win9x */
"Expected 1 or 0, got %d
\n
"
,
res
);
GlobalFree
(
gbl
);
gbl
=
GlobalAlloc
(
GMEM_FIXED
,
100
);
SetLastError
(
0xdeadbeef
);
res
=
GlobalUnlock
(
gbl
);
ok
(
res
==
1
||
broken
(
res
==
0
),
/* win9x */
"Expected 1 or 0, got %d
\n
"
,
res
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"got %d
\n
"
,
GetLastError
());
GlobalFree
(
gbl
);
/* GlobalSize on an invalid handle */
if
(
sizeof
(
void
*
)
!=
8
)
/* crashes on 64-bit Vista */
{
...
...
@@ -268,8 +281,6 @@ static void test_heap(void)
"Expected ERROR_INVALID_HANDLE or ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
}
GlobalFree
(
gbl
);
/* ####################################### */
/* Local*() functions */
gbl
=
LocalAlloc
(
LMEM_MOVEABLE
,
0
);
...
...
@@ -371,6 +382,15 @@ static void test_heap(void)
"returned %d with %d (expected '0' with ERROR_INVALID_HANDLE)
\n
"
,
res
,
GetLastError
());
/* trying to unlock pointer from LocalAlloc */
gbl
=
LocalAlloc
(
LMEM_FIXED
,
100
);
SetLastError
(
0xdeadbeef
);
res
=
LocalUnlock
(
gbl
);
ok
(
res
==
0
,
"Expected 0, got %d
\n
"
,
res
);
ok
(
GetLastError
()
==
ERROR_NOT_LOCKED
||
broken
(
GetLastError
()
==
0xdeadbeef
)
/* win9x */
,
"got %d
\n
"
,
GetLastError
());
LocalFree
(
gbl
);
/* trying to lock empty memory should give an error */
gbl
=
GlobalAlloc
(
GMEM_MOVEABLE
|
GMEM_ZEROINIT
,
0
);
ok
(
gbl
!=
NULL
,
"returned NULL
\n
"
);
...
...
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