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
5e32cad3
Commit
5e32cad3
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: Use RtlGetUserInfoHeap in GlobalHandle.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
parent
bffeff38
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
heap.c
dlls/kernel32/heap.c
+8
-2
heap.c
dlls/kernel32/tests/heap.c
+8
-0
No files found.
dlls/kernel32/heap.c
View file @
5e32cad3
...
...
@@ -47,6 +47,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(globalmem);
static
HANDLE
systemHeap
;
/* globally shared heap */
BOOLEAN
WINAPI
RtlGetUserInfoHeap
(
HANDLE
handle
,
ULONG
flags
,
void
*
ptr
,
void
**
user_value
,
ULONG
*
user_flags
);
/***********************************************************************
* HEAP_CreateSystemHeap
...
...
@@ -171,7 +172,6 @@ C_ASSERT(sizeof(struct mem_entry) == 2 * sizeof(void *));
struct
kernelbase_global_data
*
kernelbase_global_data
;
#define POINTER_TO_HANDLE( p ) (*(((const HGLOBAL *)( p )) - 2))
/* align the storage needed for the HLOCAL on an 8-byte boundary thus
* LocalAlloc/LocalReAlloc'ing with LMEM_MOVEABLE of memory with
* size = 8*k, where k=1,2,3,... allocs exactly the given size.
...
...
@@ -255,6 +255,7 @@ HGLOBAL WINAPI GlobalHandle( const void *ptr )
struct
mem_entry
*
mem
;
HGLOBAL
handle
;
LPCVOID
test
;
ULONG
flags
;
TRACE_
(
globalmem
)(
"ptr %p
\n
"
,
ptr
);
...
...
@@ -279,7 +280,12 @@ HGLOBAL WINAPI GlobalHandle( const void *ptr )
handle
=
(
HGLOBAL
)
ptr
;
/* valid fixed block */
break
;
}
handle
=
POINTER_TO_HANDLE
(
ptr
);
if
(
!
RtlGetUserInfoHeap
(
GetProcessHeap
(),
HEAP_NO_SERIALIZE
,
(
char
*
)
ptr
-
HLOCAL_STORAGE
,
&
handle
,
&
flags
))
{
SetLastError
(
ERROR_INVALID_HANDLE
);
handle
=
0
;
}
break
;
}
else
handle
=
(
HGLOBAL
)
ptr
;
...
...
dlls/kernel32/tests/heap.c
View file @
5e32cad3
...
...
@@ -1494,6 +1494,8 @@ static void test_GlobalAlloc(void)
ptr
=
GlobalLock
(
mem
);
ok
(
!!
ptr
,
"GlobalLock failed, error %lu
\n
"
,
GetLastError
()
);
ok
(
ptr
!=
mem
,
"got unexpected ptr %p
\n
"
,
ptr
);
tmp_mem
=
GlobalHandle
(
ptr
);
ok
(
tmp_mem
==
mem
,
"GlobalHandle returned unexpected handle
\n
"
);
flags
=
GlobalFlags
(
mem
);
ok
(
flags
==
1
,
"GlobalFlags returned %#x, error %lu
\n
"
,
flags
,
GetLastError
()
);
tmp_ptr
=
GlobalLock
(
mem
);
...
...
@@ -1698,6 +1700,8 @@ static void test_GlobalAlloc(void)
ok
(
!!
mem
,
"GlobalAlloc failed, error %lu
\n
"
,
GetLastError
()
);
ret
=
GlobalUnlock
(
mem
);
ok
(
ret
,
"GlobalUnlock failed, error %lu
\n
"
,
GetLastError
()
);
tmp_mem
=
GlobalHandle
(
mem
);
ok
(
tmp_mem
==
mem
,
"GlobalHandle returned unexpected handle
\n
"
);
mem
=
GlobalFree
(
mem
);
ok
(
!
mem
,
"GlobalFree failed, error %lu
\n
"
,
GetLastError
()
);
...
...
@@ -1867,6 +1871,8 @@ static void test_LocalAlloc(void)
ptr
=
LocalLock
(
mem
);
ok
(
!!
ptr
,
"LocalLock failed, error %lu
\n
"
,
GetLastError
()
);
ok
(
ptr
!=
mem
,
"got unexpected ptr %p
\n
"
,
ptr
);
tmp_mem
=
LocalHandle
(
ptr
);
ok
(
tmp_mem
==
mem
,
"LocalHandle returned unexpected handle
\n
"
);
flags
=
LocalFlags
(
mem
);
ok
(
flags
==
1
,
"LocalFlags returned %#x, error %lu
\n
"
,
flags
,
GetLastError
()
);
tmp_ptr
=
LocalLock
(
mem
);
...
...
@@ -2030,6 +2036,8 @@ static void test_LocalAlloc(void)
ret
=
LocalUnlock
(
mem
);
ok
(
!
ret
,
"LocalUnlock succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_NOT_LOCKED
,
"got error %lu
\n
"
,
GetLastError
()
);
tmp_mem
=
LocalHandle
(
mem
);
ok
(
tmp_mem
==
mem
,
"LocalHandle returned unexpected handle
\n
"
);
mem
=
LocalFree
(
mem
);
ok
(
!
mem
,
"LocalFree failed, error %lu
\n
"
,
GetLastError
()
);
...
...
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