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
866d7d0c
Commit
866d7d0c
authored
May 30, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Jun 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Cleanup and simplify (Global|Local)Size.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
parent
66033232
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
61 deletions
+27
-61
heap.c
dlls/kernel32/heap.c
+27
-61
No files found.
dlls/kernel32/heap.c
View file @
866d7d0c
...
...
@@ -313,56 +313,10 @@ HGLOBAL WINAPI GlobalReAlloc( HGLOBAL handle, SIZE_T size, UINT flags )
/***********************************************************************
* GlobalSize (KERNEL32.@)
*
* Get the size of a global memory object.
*
* PARAMS
* handle [I] Handle of the global memory object
*
* RETURNS
* 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
handle
)
{
struct
mem_entry
*
mem
;
SIZE_T
retval
;
void
*
ptr
;
TRACE_
(
globalmem
)(
"handle %p
\n
"
,
handle
);
if
(
!
((
ULONG_PTR
)
handle
>>
16
))
{
SetLastError
(
ERROR_INVALID_HANDLE
);
return
0
;
}
if
((
ptr
=
unsafe_ptr_from_HLOCAL
(
handle
)))
retval
=
HeapSize
(
GetProcessHeap
(),
0
,
ptr
);
else
{
RtlLockHeap
(
GetProcessHeap
()
);
if
((
mem
=
unsafe_mem_from_HLOCAL
(
handle
)))
{
if
(
!
mem
->
ptr
)
/* handle case of GlobalAlloc( ??,0) */
retval
=
0
;
else
retval
=
HeapSize
(
GetProcessHeap
(),
0
,
mem
->
ptr
);
}
else
{
WARN_
(
globalmem
)(
"invalid handle %p
\n
"
,
handle
);
SetLastError
(
ERROR_INVALID_HANDLE
);
retval
=
0
;
}
RtlUnlockHeap
(
GetProcessHeap
()
);
}
if
(
retval
==
~
(
SIZE_T
)
0
)
retval
=
0
;
return
retval
;
return
LocalSize
(
handle
);
}
...
...
@@ -513,21 +467,33 @@ SIZE_T WINAPI LocalShrink( HGLOBAL handle, UINT newsize )
/***********************************************************************
* LocalSize (KERNEL32.@)
*
* Get the size of a local memory object.
*
* RETURNS
* Size: Success
* 0: Failure
*
* NOTES
* Windows memory management does not provide a separate local heap
* and global heap.
*/
SIZE_T
WINAPI
LocalSize
(
HLOCAL
handle
/* [in] Handle of memory object */
)
{
return
GlobalSize
(
handle
);
SIZE_T
WINAPI
LocalSize
(
HLOCAL
handle
)
{
HANDLE
heap
=
GetProcessHeap
();
struct
mem_entry
*
mem
;
SIZE_T
ret
=
0
;
void
*
ptr
;
TRACE_
(
globalmem
)(
"handle %p
\n
"
,
handle
);
RtlLockHeap
(
heap
);
if
((
ptr
=
unsafe_ptr_from_HLOCAL
(
handle
)))
ret
=
HeapSize
(
heap
,
HEAP_NO_SERIALIZE
,
ptr
);
else
if
((
mem
=
unsafe_mem_from_HLOCAL
(
handle
)))
{
if
(
!
mem
->
ptr
)
ret
=
0
;
else
ret
=
HeapSize
(
heap
,
HEAP_NO_SERIALIZE
,
mem
->
ptr
);
}
else
{
WARN_
(
globalmem
)(
"invalid handle %p
\n
"
,
handle
);
SetLastError
(
ERROR_INVALID_HANDLE
);
}
RtlUnlockHeap
(
heap
);
if
(
ret
==
~
(
SIZE_T
)
0
)
return
0
;
return
ret
;
}
...
...
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