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
28bc3b07
Commit
28bc3b07
authored
Nov 19, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Nov 22, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Return success from GlobalReAlloc with locked HGLOBAL pointer.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=53474
parent
f43fc512
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
12 deletions
+9
-12
heap.c
dlls/kernel32/heap.c
+4
-1
heap.c
dlls/kernel32/tests/heap.c
+5
-11
No files found.
dlls/kernel32/heap.c
View file @
28bc3b07
...
...
@@ -195,7 +195,10 @@ HGLOBAL WINAPI GlobalReAlloc( HGLOBAL handle, SIZE_T size, UINT flags )
struct
mem_entry
*
mem
;
void
*
ptr
;
if
((
mem
=
unsafe_mem_from_HLOCAL
(
handle
))
&&
mem
->
lock
)
return
0
;
if
(
!
(
flags
&
GMEM_MODIFY
)
&&
(
mem
=
unsafe_mem_from_HLOCAL
(
handle
))
&&
mem
->
lock
&&
(
!
size
||
(
flags
&
GMEM_DISCARDABLE
)))
return
0
;
if
(
!
(
handle
=
LocalReAlloc
(
handle
,
size
,
flags
)))
return
0
;
/* GlobalReAlloc allows changing GMEM_FIXED to GMEM_MOVEABLE with GMEM_MODIFY */
...
...
dlls/kernel32/tests/heap.c
View file @
28bc3b07
...
...
@@ -1817,21 +1817,17 @@ static void test_GlobalAlloc(void)
if
(
!
(
flags
&
GMEM_MODIFY
)
&&
((
flags
&
GMEM_DISCARDABLE
)
||
!
(
flags
&
GMEM_MOVEABLE
)))
ok
(
!
tmp_mem
,
"GlobalReAlloc succeeded
\n
"
);
else
{
todo_wine
ok
(
tmp_mem
==
mem
,
"GlobalReAlloc returned %p, error %lu
\n
"
,
tmp_mem
,
GetLastError
()
);
}
entry
=
*
mem_entry_from_HANDLE
(
mem
);
if
((
flags
&
GMEM_DISCARDABLE
)
&&
(
flags
&
GMEM_MODIFY
))
expect_entry
.
flags
|=
4
;
if
(
flags
==
GMEM_MOVEABLE
)
todo_wine
ok
(
entry
.
ptr
!=
expect_entry
.
ptr
,
"got unexpected ptr %p
\n
"
,
entry
.
ptr
);
ok
(
entry
.
ptr
!=
expect_entry
.
ptr
,
"got unexpected ptr %p
\n
"
,
entry
.
ptr
);
else
ok
(
entry
.
ptr
==
expect_entry
.
ptr
,
"got ptr %p
\n
"
,
entry
.
ptr
);
todo_wine_if
((
flags
&
GMEM_MODIFY
)
&&
(
flags
&
GMEM_MOVEABLE
)
&&
flags
!=
(
GMEM_MODIFY
|
GMEM_MOVEABLE
))
ok
(
entry
.
flags
==
expect_entry
.
flags
,
"got flags %#Ix was %#Ix
\n
"
,
entry
.
flags
,
expect_entry
.
flags
);
size
=
GlobalSize
(
mem
);
if
(
flags
==
GMEM_MOVEABLE
)
todo_wine
ok
(
size
==
512
,
"GlobalSize returned %Iu
\n
"
,
size
);
ok
(
size
==
512
,
"GlobalSize returned %Iu
\n
"
,
size
);
else
ok
(
size
==
10
,
"GlobalSize returned %Iu
\n
"
,
size
);
...
...
@@ -1852,17 +1848,16 @@ static void test_GlobalAlloc(void)
if
(
!
(
flags
&
GMEM_MODIFY
)
&&
(
flags
&
GMEM_DISCARDABLE
))
ok
(
!
tmp_mem
,
"GlobalReAlloc succeeded
\n
"
);
else
todo_wine
ok
(
tmp_mem
==
mem
,
"GlobalReAlloc returned %p, error %lu
\n
"
,
tmp_mem
,
GetLastError
()
);
ok
(
tmp_mem
==
mem
,
"GlobalReAlloc returned %p, error %lu
\n
"
,
tmp_mem
,
GetLastError
()
);
entry
=
*
mem_entry_from_HANDLE
(
mem
);
if
((
flags
&
GMEM_DISCARDABLE
)
&&
(
flags
&
GMEM_MODIFY
))
expect_entry
.
flags
|=
4
;
ok
(
entry
.
ptr
==
expect_entry
.
ptr
,
"got ptr %p was %p
\n
"
,
entry
.
ptr
,
expect_entry
.
ptr
);
todo_wine_if
((
flags
&
GMEM_DISCARDABLE
)
&&
(
flags
&
GMEM_MODIFY
))
ok
(
entry
.
flags
==
expect_entry
.
flags
,
"got flags %#Ix was %#Ix
\n
"
,
entry
.
flags
,
expect_entry
.
flags
);
size
=
GlobalSize
(
mem
);
if
((
flags
&
GMEM_DISCARDABLE
)
||
(
flags
&
GMEM_MODIFY
))
ok
(
size
==
12
,
"GlobalSize returned %Iu
\n
"
,
size
);
else
todo_wine_if
(
!
(
flags
&
GMEM_MODIFY
))
ok
(
size
==
10
,
"GlobalSize returned %Iu
\n
"
,
size
);
ok
(
size
==
10
,
"GlobalSize returned %Iu
\n
"
,
size
);
ret
=
GlobalUnlock
(
mem
);
ok
(
!
ret
,
"GlobalUnlock succeeded
\n
"
);
...
...
@@ -1879,13 +1874,12 @@ static void test_GlobalAlloc(void)
tmp_mem
=
GlobalReAlloc
(
mem
,
0
,
flags
);
if
(
flags
&
GMEM_MODIFY
)
todo_wine
ok
(
tmp_mem
==
mem
,
"GlobalReAlloc returned %p, error %lu
\n
"
,
tmp_mem
,
GetLastError
()
);
ok
(
tmp_mem
==
mem
,
"GlobalReAlloc returned %p, error %lu
\n
"
,
tmp_mem
,
GetLastError
()
);
else
ok
(
!
tmp_mem
,
"GlobalReAlloc succeeded
\n
"
);
entry
=
*
mem_entry_from_HANDLE
(
mem
);
if
((
flags
&
GMEM_DISCARDABLE
)
&&
(
flags
&
GMEM_MODIFY
))
expect_entry
.
flags
|=
4
;
ok
(
entry
.
ptr
==
expect_entry
.
ptr
,
"got ptr %p was %p
\n
"
,
entry
.
ptr
,
expect_entry
.
ptr
);
todo_wine_if
((
flags
&
GMEM_MODIFY
)
&&
(
flags
&
GMEM_DISCARDABLE
))
ok
(
entry
.
flags
==
expect_entry
.
flags
,
"got flags %#Ix was %#Ix
\n
"
,
entry
.
flags
,
expect_entry
.
flags
);
size
=
GlobalSize
(
mem
);
ok
(
size
==
12
,
"GlobalSize returned %Iu
\n
"
,
size
);
...
...
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