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
ea6e0a83
Commit
ea6e0a83
authored
Apr 16, 2012
by
Daniel Lehman
Committed by
Alexandre Julliard
Oct 12, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Use HandleToULong inline function to convert handle to index instead of casting.
parent
8418115e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
2 deletions
+46
-2
gdiobj.c
dlls/gdi32/gdiobj.c
+2
-2
gdiobj.c
dlls/gdi32/tests/gdiobj.c
+44
-0
No files found.
dlls/gdi32/gdiobj.c
View file @
ea6e0a83
...
...
@@ -699,7 +699,7 @@ void *free_gdi_handle( HGDIOBJ handle )
GDIOBJHDR
*
object
=
NULL
;
int
i
;
i
=
(
(
ULONG_PTR
)
handle
>>
2
)
-
FIRST_LARGE_HANDLE
;
i
=
(
HandleToULong
(
handle
)
>>
2
)
-
FIRST_LARGE_HANDLE
;
if
(
i
>=
0
&&
i
<
MAX_LARGE_HANDLES
)
{
EnterCriticalSection
(
&
gdi_section
);
...
...
@@ -732,7 +732,7 @@ void *GDI_GetObjPtr( HGDIOBJ handle, WORD type )
EnterCriticalSection
(
&
gdi_section
);
i
=
(
(
UINT_PTR
)
handle
>>
2
)
-
FIRST_LARGE_HANDLE
;
i
=
(
HandleToULong
(
handle
)
>>
2
)
-
FIRST_LARGE_HANDLE
;
if
(
i
>=
0
&&
i
<
MAX_LARGE_HANDLES
)
{
ptr
=
large_handles
[
i
];
...
...
dlls/gdi32/tests/gdiobj.c
View file @
ea6e0a83
...
...
@@ -319,10 +319,54 @@ static void test_region(void)
DeleteObject
(
hrgn
);
}
static
void
test_handles_on_win64
(
void
)
{
int
i
;
BOOL
ret
;
DWORD
type
;
HRGN
hrgn
,
hrgn_test
;
static
const
struct
{
ULONG
high
;
ULONG
low
;
BOOL
ret
;
}
cases
[]
=
{
{
0x00000000
,
0x00000000
,
TRUE
},
{
0x00000000
,
0x0000ffe0
,
FALSE
},
/* just over MAX_LARGE_HANDLES */
{
0x00000000
,
0x0000ffb0
,
FALSE
},
/* just under MAX_LARGE_HANDLES */
{
0xffffffff
,
0xffff0000
,
FALSE
},
{
0xffffffff
,
0x00000000
,
TRUE
},
{
0xdeadbeef
,
0x00000000
,
TRUE
},
{
0xcccccccc
,
0xcccccccc
,
FALSE
}
};
if
(
sizeof
(
void
*
)
!=
8
)
return
;
for
(
i
=
0
;
i
<
sizeof
(
cases
)
/
sizeof
(
cases
[
0
]);
i
++
)
{
hrgn
=
CreateRectRgn
(
10
,
10
,
20
,
20
);
hrgn_test
=
(
HRGN
)(
ULONG_PTR
)((
ULONG_PTR
)
hrgn
|
((
ULONGLONG
)
cases
[
i
].
high
<<
32
)
|
cases
[
i
].
low
);
type
=
GetObjectType
(
hrgn_test
);
if
(
cases
[
i
].
ret
)
ok
(
type
==
OBJ_REGION
,
"wrong type %u
\n
"
,
type
);
else
ok
(
type
==
0
,
"wrong type %u
\n
"
,
type
);
ret
=
DeleteObject
(
hrgn_test
);
ok
(
cases
[
i
].
ret
==
ret
,
"DeleteObject should return %s (%p)
\n
"
,
cases
[
i
].
ret
?
"TRUE"
:
"FALSE"
,
hrgn_test
);
/* actually free it if above is expected to fail */
if
(
!
ret
)
DeleteObject
(
hrgn
);
}
}
START_TEST
(
gdiobj
)
{
test_gdi_objects
();
test_thread_objects
();
test_GetCurrentObject
();
test_region
();
test_handles_on_win64
();
}
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