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
08775c64
Commit
08775c64
authored
Aug 27, 2008
by
Jim Cameron
Committed by
Alexandre Julliard
Aug 28, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Fixed bug in loading .cur files.
parent
deccfeec
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
32 deletions
+46
-32
cursoricon.c
dlls/user32/cursoricon.c
+46
-29
cursoricon.c
dlls/user32/tests/cursoricon.c
+0
-3
No files found.
dlls/user32/cursoricon.c
View file @
08775c64
...
...
@@ -660,48 +660,26 @@ static CURSORICONFILEDIRENTRY *CURSORICON_FindBestIconFile( CURSORICONFILEDIR *d
return
&
dir
->
idEntries
[
n
];
}
/**********************************************************************
* CreateIconFromResourceEx (USER32.@)
*
* FIXME: Convert to mono when cFlag is LR_MONOCHROME. Do something
* with cbSize parameter as well.
*/
HICON
WINAPI
CreateIconFromResourceEx
(
LPBYTE
bits
,
UINT
cbSize
,
BOOL
bIcon
,
DWORD
dwVersion
,
INT
width
,
INT
height
,
UINT
cFlag
)
static
HICON
CURSORICON_CreateIconFromBMI
(
BITMAPINFO
*
bmi
,
POINT16
hotspot
,
BOOL
bIcon
,
DWORD
dwVersion
,
INT
width
,
INT
height
,
UINT
cFlag
)
{
HGLOBAL16
hObj
;
static
HDC
hdcMem
;
int
sizeAnd
,
sizeXor
;
HBITMAP
hAndBits
=
0
,
hXorBits
=
0
;
/* error condition for later */
BITMAP
bmpXor
,
bmpAnd
;
POINT16
hotspot
;
BITMAPINFO
*
bmi
;
BOOL
DoStretch
;
INT
size
;
hotspot
.
x
=
ICON_HOTSPOT
;
hotspot
.
y
=
ICON_HOTSPOT
;
TRACE_
(
cursor
)(
"%p (%u bytes), ver %08x, %ix%i %s %s
\n
"
,
bits
,
cbSize
,
dwVersion
,
width
,
height
,
bIcon
?
"icon"
:
"cursor"
,
(
cFlag
&
LR_MONOCHROME
)
?
"mono"
:
""
);
if
(
dwVersion
==
0x00020000
)
{
FIXME_
(
cursor
)(
"
\t
2.xx resources are not supported
\n
"
);
return
0
;
}
if
(
bIcon
)
bmi
=
(
BITMAPINFO
*
)
bits
;
else
/* get the hotspot */
{
POINT16
*
pt
=
(
POINT16
*
)
bits
;
hotspot
=
*
pt
;
bmi
=
(
BITMAPINFO
*
)(
pt
+
1
);
}
/* Check bitmap header */
if
(
(
bmi
->
bmiHeader
.
biSize
!=
sizeof
(
BITMAPCOREHEADER
))
&&
...
...
@@ -873,6 +851,41 @@ HICON WINAPI CreateIconFromResourceEx( LPBYTE bits, UINT cbSize,
/**********************************************************************
* CreateIconFromResourceEx (USER32.@)
*
* FIXME: Convert to mono when cFlag is LR_MONOCHROME. Do something
* with cbSize parameter as well.
*/
HICON
WINAPI
CreateIconFromResourceEx
(
LPBYTE
bits
,
UINT
cbSize
,
BOOL
bIcon
,
DWORD
dwVersion
,
INT
width
,
INT
height
,
UINT
cFlag
)
{
POINT16
hotspot
;
BITMAPINFO
*
bmi
;
hotspot
.
x
=
ICON_HOTSPOT
;
hotspot
.
y
=
ICON_HOTSPOT
;
TRACE_
(
cursor
)(
"%p (%u bytes), ver %08x, %ix%i %s %s
\n
"
,
bits
,
cbSize
,
dwVersion
,
width
,
height
,
bIcon
?
"icon"
:
"cursor"
,
(
cFlag
&
LR_MONOCHROME
)
?
"mono"
:
""
);
if
(
bIcon
)
bmi
=
(
BITMAPINFO
*
)
bits
;
else
/* get the hotspot */
{
POINT16
*
pt
=
(
POINT16
*
)
bits
;
hotspot
=
*
pt
;
bmi
=
(
BITMAPINFO
*
)(
pt
+
1
);
}
return
CURSORICON_CreateIconFromBMI
(
bmi
,
hotspot
,
bIcon
,
dwVersion
,
width
,
height
,
cFlag
);
}
/**********************************************************************
* CreateIconFromResource (USER32.@)
*/
HICON
WINAPI
CreateIconFromResource
(
LPBYTE
bits
,
UINT
cbSize
,
...
...
@@ -891,6 +904,7 @@ static HICON CURSORICON_LoadFromFile( LPCWSTR filename,
DWORD
filesize
=
0
;
HICON
hIcon
=
0
;
LPBYTE
bits
;
POINT16
hotspot
;
TRACE
(
"loading %s
\n
"
,
debugstr_w
(
filename
));
...
...
@@ -926,8 +940,11 @@ static HICON CURSORICON_LoadFromFile( LPCWSTR filename,
if
(
entry
->
dwDIBOffset
+
entry
->
dwDIBSize
>
filesize
)
goto
end
;
hIcon
=
CreateIconFromResourceEx
(
&
bits
[
entry
->
dwDIBOffset
],
entry
->
dwDIBSize
,
!
fCursor
,
0x00030000
,
width
,
height
,
loadflags
);
hotspot
.
x
=
entry
->
xHotspot
;
hotspot
.
y
=
entry
->
yHotspot
;
hIcon
=
CURSORICON_CreateIconFromBMI
(
(
BITMAPINFO
*
)
&
bits
[
entry
->
dwDIBOffset
],
hotspot
,
!
fCursor
,
0x00030000
,
width
,
height
,
loadflags
);
end:
TRACE
(
"loaded %s -> %p
\n
"
,
debugstr_w
(
filename
),
hIcon
);
UnmapViewOfFile
(
bits
);
...
...
dlls/user32/tests/cursoricon.c
View file @
08775c64
...
...
@@ -814,7 +814,6 @@ static void test_LoadImage(void)
/* Test loading an icon as a cursor. */
SetLastError
(
0xdeadbeef
);
handle
=
LoadImageA
(
NULL
,
"icon.ico"
,
IMAGE_CURSOR
,
0
,
0
,
LR_LOADFROMFILE
);
todo_wine
ok
(
handle
!=
NULL
,
"LoadImage() failed.
\n
"
);
error
=
GetLastError
();
ok
(
error
==
0
,
"Last error: %u
\n
"
,
error
);
...
...
@@ -822,7 +821,6 @@ static void test_LoadImage(void)
/* Test the icon information. */
SetLastError
(
0xdeadbeef
);
ret
=
GetIconInfo
(
handle
,
&
icon_info
);
todo_wine
ok
(
ret
,
"GetIconInfo() failed.
\n
"
);
error
=
GetLastError
();
ok
(
error
==
0xdeadbeef
,
"Last error: %u
\n
"
,
error
);
...
...
@@ -839,7 +837,6 @@ static void test_LoadImage(void)
/* Clean up. */
SetLastError
(
0xdeadbeef
);
ret
=
DestroyCursor
(
handle
);
todo_wine
ok
(
ret
,
"DestroyCursor() failed.
\n
"
);
error
=
GetLastError
();
ok
(
error
==
0xdeadbeef
,
"Last error: %u
\n
"
,
error
);
...
...
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