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
2be9b0ff
Commit
2be9b0ff
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
kernelbase: Don't try in-place HeapReAlloc in LocalReAlloc.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=53474
parent
f051444f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
14 deletions
+10
-14
heap.c
dlls/kernel32/tests/heap.c
+8
-12
memory.c
dlls/kernelbase/memory.c
+2
-2
No files found.
dlls/kernel32/tests/heap.c
View file @
2be9b0ff
...
...
@@ -1675,10 +1675,8 @@ static void test_GlobalAlloc(void)
ok
(
size
==
10
,
"GlobalSize returned %Iu
\n
"
,
size
);
SetLastError
(
0xdeadbeef
);
tmp_mem
=
GlobalReAlloc
(
mem
,
10
,
0
);
todo_wine
ok
(
!
tmp_mem
||
broken
(
tmp_mem
==
mem
)
/* w1064v1507 / w1064v1607 */
,
"GlobalReAlloc succeeded
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_NOT_ENOUGH_MEMORY
||
broken
(
GetLastError
()
==
0xdeadbeef
)
/* w1064v1507 / w1064v1607 */
,
"got error %lu
\n
"
,
GetLastError
()
);
if
(
tmp_mem
)
mem
=
tmp_mem
;
...
...
@@ -1759,7 +1757,7 @@ static void test_GlobalAlloc(void)
{
ok
(
!
is_mem_entry
(
tmp_mem
),
"unexpected moveable %p
\n
"
,
tmp_mem
);
if
(
flags
==
GMEM_MODIFY
)
ok
(
tmp_mem
==
mem
,
"GlobalReAlloc returned %p
\n
"
,
tmp_mem
);
else
if
(
flags
!=
GMEM_MOVEABLE
)
todo_wine
ok
(
!
tmp_mem
||
broken
(
tmp_mem
==
mem
)
/* w8 */
,
"GlobalReAlloc succeeded
\n
"
);
else
if
(
flags
!=
GMEM_MOVEABLE
)
todo_wine
_if
(
flags
)
ok
(
!
tmp_mem
||
broken
(
tmp_mem
==
mem
)
/* w8 */
,
"GlobalReAlloc succeeded
\n
"
);
else
todo_wine
ok
(
tmp_mem
!=
mem
,
"GlobalReAlloc returned %p
\n
"
,
tmp_mem
);
}
else
...
...
@@ -1779,7 +1777,7 @@ static void test_GlobalAlloc(void)
todo_wine_if
((
flags
&
GMEM_MOVEABLE
)
&&
!
(
flags
&
GMEM_MODIFY
))
ok
(
size
==
12
,
"GlobalSize returned %Iu
\n
"
,
size
);
}
else
todo_wine
ok
(
size
==
12
||
broken
(
size
==
10
)
/* w8 */
,
"GlobalSize returned %Iu
\n
"
,
size
);
else
ok
(
size
==
12
||
broken
(
size
==
10
)
/* w8 */
,
"GlobalSize returned %Iu
\n
"
,
size
);
mem
=
GlobalFree
(
mem
);
ok
(
!
mem
,
"GlobalFree failed, error %lu
\n
"
,
GetLastError
()
);
...
...
@@ -1794,7 +1792,7 @@ static void test_GlobalAlloc(void)
{
ok
(
!
is_mem_entry
(
tmp_mem
),
"unexpected moveable %p
\n
"
,
tmp_mem
);
if
(
flags
==
GMEM_MODIFY
)
ok
(
tmp_mem
==
mem
,
"GlobalReAlloc returned %p
\n
"
,
tmp_mem
);
else
if
(
flags
!=
GMEM_MOVEABLE
)
todo_wine
ok
(
!
tmp_mem
||
broken
(
tmp_mem
==
mem
)
/* w8 */
,
"GlobalReAlloc succeeded
\n
"
);
else
if
(
flags
!=
GMEM_MOVEABLE
)
todo_wine
_if
(
flags
)
ok
(
!
tmp_mem
||
broken
(
tmp_mem
==
mem
)
/* w8 */
,
"GlobalReAlloc succeeded
\n
"
);
else
todo_wine
ok
(
tmp_mem
!=
mem
,
"GlobalReAlloc returned %p
\n
"
,
tmp_mem
);
}
else
...
...
@@ -1814,7 +1812,7 @@ static void test_GlobalAlloc(void)
todo_wine_if
((
flags
&
GMEM_MOVEABLE
)
&&
!
(
flags
&
GMEM_MODIFY
))
ok
(
size
==
12
,
"GlobalSize returned %Iu
\n
"
,
size
);
}
else
todo_wine
ok
(
size
==
12
||
broken
(
size
==
0
)
/* w8 */
,
"GlobalSize returned %Iu
\n
"
,
size
);
else
ok
(
size
==
12
||
broken
(
size
==
0
)
/* w8 */
,
"GlobalSize returned %Iu
\n
"
,
size
);
mem
=
GlobalFree
(
mem
);
ok
(
!
mem
,
"GlobalFree failed, error %lu
\n
"
,
GetLastError
()
);
...
...
@@ -2369,10 +2367,8 @@ static void test_LocalAlloc(void)
ok
(
size
==
10
,
"LocalSize returned %Iu
\n
"
,
size
);
SetLastError
(
0xdeadbeef
);
tmp_mem
=
LocalReAlloc
(
mem
,
10
,
0
);
todo_wine
ok
(
!
tmp_mem
||
broken
(
tmp_mem
==
mem
)
/* w1064v1507 / w1064v1607 */
,
"LocalReAlloc succeeded
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_NOT_ENOUGH_MEMORY
||
broken
(
GetLastError
()
==
0xdeadbeef
)
/* w1064v1507 / w1064v1607 */
,
"got error %lu
\n
"
,
GetLastError
()
);
if
(
tmp_mem
)
mem
=
tmp_mem
;
...
...
@@ -2434,14 +2430,14 @@ static void test_LocalAlloc(void)
tmp_mem
=
LocalReAlloc
(
mem
,
10
,
flags
);
ok
(
!
is_mem_entry
(
tmp_mem
),
"unexpected moveable %p
\n
"
,
tmp_mem
);
if
(
flags
&
LMEM_MODIFY
)
ok
(
tmp_mem
==
mem
,
"LocalReAlloc returned %p
\n
"
,
tmp_mem
);
else
if
(
flags
!=
LMEM_MOVEABLE
)
todo_wine
ok
(
!
tmp_mem
,
"LocalReAlloc succeeded
\n
"
);
else
if
(
flags
!=
LMEM_MOVEABLE
)
todo_wine
_if
(
flags
)
ok
(
!
tmp_mem
,
"LocalReAlloc succeeded
\n
"
);
else
todo_wine
ok
(
tmp_mem
!=
mem
,
"LocalReAlloc returned %p
\n
"
,
tmp_mem
);
if
(
tmp_mem
)
mem
=
tmp_mem
;
size
=
LocalSize
(
mem
);
if
(
flags
==
LMEM_MOVEABLE
)
ok
(
size
==
10
,
"LocalSize returned %Iu
\n
"
,
size
);
else
if
(
flags
)
todo_wine_if
(
!
(
flags
&
LMEM_MODIFY
))
ok
(
size
==
12
,
"LocalSize returned %Iu
\n
"
,
size
);
else
todo_wine
ok
(
size
==
12
,
"LocalSize returned %Iu
\n
"
,
size
);
else
ok
(
size
==
12
,
"LocalSize returned %Iu
\n
"
,
size
);
mem
=
LocalFree
(
mem
);
ok
(
!
mem
,
"LocalFree failed, error %lu
\n
"
,
GetLastError
()
);
...
...
@@ -2454,14 +2450,14 @@ static void test_LocalAlloc(void)
tmp_mem
=
LocalReAlloc
(
mem
,
0
,
flags
);
ok
(
!
is_mem_entry
(
tmp_mem
),
"unexpected moveable %p
\n
"
,
tmp_mem
);
if
(
flags
&
LMEM_MODIFY
)
ok
(
tmp_mem
==
mem
,
"LocalReAlloc returned %p
\n
"
,
tmp_mem
);
else
if
(
flags
!=
LMEM_MOVEABLE
)
todo_wine
ok
(
!
tmp_mem
,
"LocalReAlloc succeeded
\n
"
);
else
if
(
flags
!=
LMEM_MOVEABLE
)
todo_wine
_if
(
flags
)
ok
(
!
tmp_mem
,
"LocalReAlloc succeeded
\n
"
);
else
todo_wine
ok
(
tmp_mem
!=
mem
,
"LocalReAlloc returned %p
\n
"
,
tmp_mem
);
if
(
tmp_mem
)
mem
=
tmp_mem
;
size
=
LocalSize
(
mem
);
if
(
flags
==
LMEM_MOVEABLE
)
ok
(
size
==
0
||
broken
(
size
==
1
)
/* w7 */
,
"LocalSize returned %Iu
\n
"
,
size
);
else
if
(
flags
)
todo_wine_if
(
!
(
flags
&
LMEM_MODIFY
))
ok
(
size
==
12
,
"LocalSize returned %Iu
\n
"
,
size
);
else
todo_wine
ok
(
size
==
12
,
"LocalSize returned %Iu
\n
"
,
size
);
else
ok
(
size
==
12
,
"LocalSize returned %Iu
\n
"
,
size
);
mem
=
LocalFree
(
mem
);
ok
(
!
mem
,
"LocalFree failed, error %lu
\n
"
,
GetLastError
()
);
...
...
dlls/kernelbase/memory.c
View file @
2be9b0ff
...
...
@@ -990,13 +990,13 @@ HLOCAL WINAPI DECLSPEC_HOTPATCH LocalReAlloc( HLOCAL handle, SIZE_T size, UINT f
HeapValidate
(
heap
,
HEAP_NO_SERIALIZE
,
ptr
))
{
if
(
flags
&
LMEM_MODIFY
)
ret
=
handle
;
else
else
if
(
flags
&
LMEM_MOVEABLE
)
{
if
(
!
(
flags
&
LMEM_MOVEABLE
))
heap_flags
|=
HEAP_REALLOC_IN_PLACE_ONLY
;
ret
=
HeapReAlloc
(
heap
,
heap_flags
,
ptr
,
size
);
if
(
ret
)
RtlSetUserValueHeap
(
heap
,
heap_flags
,
ret
,
ret
);
else
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
}
else
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
}
else
if
((
mem
=
unsafe_mem_from_HLOCAL
(
handle
)))
{
...
...
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