Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yoann Laissus
wine
Commits
9788815b
Commit
9788815b
authored
23 years ago
by
Uwe Bonnes
Committed by
Alexandre Julliard
23 years ago
Browse files
Options
Downloads
Patches
Plain Diff
GlobalReAlloc16: If heap has GlobalPageLock set, try only with
HEAP_REALLOC_IN_PLACE_ONLY flag set.
parent
1bd9474e
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
memory/global.c
+19
-9
19 additions, 9 deletions
memory/global.c
with
19 additions
and
9 deletions
memory/global.c
+
19
−
9
View file @
9788815b
...
...
@@ -266,7 +266,7 @@ HGLOBAL16 WINAPI GlobalReAlloc16(
)
{
WORD
selcount
;
DWORD
oldsize
;
void
*
ptr
;
void
*
ptr
,
*
newptr
;
GLOBALARENA
*
pArena
,
*
pNewArena
;
WORD
sel
=
GlobalHandleToSel16
(
handle
);
...
...
@@ -318,19 +318,28 @@ HGLOBAL16 WINAPI GlobalReAlloc16(
ptr
=
(
void
*
)
pArena
->
base
;
oldsize
=
pArena
->
size
;
TRACE
(
"oldsize %08lx
\n
"
,
old
size
);
TRACE
(
"old
base %p oldsize %08lx new
size %08lx
\n
"
,
ptr
,
oldsize
,
size
);
if
(
ptr
&&
(
size
==
oldsize
))
return
handle
;
/* Nothing to do */
if
(
pArena
->
flags
&
GA_DOSMEM
)
ptr
=
DOSMEM_ResizeBlock
(
ptr
,
size
,
NULL
);
new
ptr
=
DOSMEM_ResizeBlock
(
ptr
,
size
,
NULL
);
else
ptr
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
ptr
,
size
);
if
(
!
ptr
)
/* if more then one reader (e.g. some pointer has been given out by GetVDMPointer32W16),
only try to realloc in place */
newptr
=
HeapReAlloc
(
GetProcessHeap
(),
(
pArena
->
pageLockCount
>
0
)
?
HEAP_REALLOC_IN_PLACE_ONLY
:
0
,
ptr
,
size
);
if
(
!
newptr
)
{
SELECTOR_FreeBlock
(
sel
);
memset
(
pArena
,
0
,
sizeof
(
GLOBALARENA
)
);
FIXME
(
"Realloc failed lock %d
\n
"
,
pArena
->
pageLockCount
);
if
(
pArena
->
pageLockCount
<
1
)
{
HeapFree
(
GetProcessHeap
(),
0
,
ptr
);
SELECTOR_FreeBlock
(
sel
);
memset
(
pArena
,
0
,
sizeof
(
GLOBALARENA
)
);
}
return
0
;
}
ptr
=
newptr
;
/* Reallocate the selector(s) */
...
...
@@ -350,9 +359,10 @@ HGLOBAL16 WINAPI GlobalReAlloc16(
return
0
;
}
/* Fill the new arena block */
/* Fill the new arena block
As we may have used HEAP_REALLOC_IN_PLACE_ONLY, areas may overlap*/
if
(
pNewArena
!=
pArena
)
mem
cpy
(
pNewArena
,
pArena
,
sizeof
(
GLOBALARENA
)
);
if
(
pNewArena
!=
pArena
)
mem
move
(
pNewArena
,
pArena
,
sizeof
(
GLOBALARENA
)
);
pNewArena
->
base
=
(
DWORD
)
ptr
;
pNewArena
->
size
=
GetSelectorLimit16
(
sel
)
+
1
;
pNewArena
->
selCount
=
selcount
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment