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
b32ed71f
Commit
b32ed71f
authored
Oct 26, 2010
by
Hans Leidekker
Committed by
Alexandre Julliard
Oct 26, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Fix invalid parameter handling in EnumICMProfiles and SetICMProfile.
parent
898a4cfa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
155 additions
and
4 deletions
+155
-4
icm.c
dlls/gdi32/icm.c
+30
-4
icm.c
dlls/gdi32/tests/icm.c
+125
-0
No files found.
dlls/gdi32/icm.c
View file @
b32ed71f
...
...
@@ -74,11 +74,13 @@ INT CALLBACK enum_profiles_callback( LPWSTR filename, LPARAM lparam )
*/
INT
WINAPI
EnumICMProfilesA
(
HDC
hdc
,
ICMENUMPROCA
func
,
LPARAM
lparam
)
{
DC
*
dc
;
INT
ret
=
-
1
;
DC
*
dc
=
get_dc_ptr
(
hdc
);
TRACE
(
"%p, %p, 0x%08lx
\n
"
,
hdc
,
func
,
lparam
);
if
(
dc
)
if
(
!
func
)
return
-
1
;
if
((
dc
=
get_dc_ptr
(
hdc
)))
{
if
(
dc
->
funcs
->
pEnumICMProfiles
)
{
...
...
@@ -99,11 +101,13 @@ INT WINAPI EnumICMProfilesA(HDC hdc, ICMENUMPROCA func, LPARAM lparam)
*/
INT
WINAPI
EnumICMProfilesW
(
HDC
hdc
,
ICMENUMPROCW
func
,
LPARAM
lparam
)
{
DC
*
dc
;
INT
ret
=
-
1
;
DC
*
dc
=
get_dc_ptr
(
hdc
);
TRACE
(
"%p, %p, 0x%08lx
\n
"
,
hdc
,
func
,
lparam
);
if
(
dc
)
if
(
!
func
)
return
-
1
;
if
((
dc
=
get_dc_ptr
(
hdc
)))
{
if
(
dc
->
funcs
->
pEnumICMProfiles
)
{
...
...
@@ -200,6 +204,17 @@ BOOL WINAPI GetLogColorSpaceW(HCOLORSPACE colorspace, LPLOGCOLORSPACEW buffer, D
BOOL
WINAPI
SetICMProfileA
(
HDC
hdc
,
LPSTR
filename
)
{
FIXME
(
"%p %s stub
\n
"
,
hdc
,
debugstr_a
(
filename
));
if
(
!
filename
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
if
(
!
hdc
)
{
SetLastError
(
ERROR_INVALID_HANDLE
);
return
FALSE
;
}
return
TRUE
;
}
...
...
@@ -209,6 +224,17 @@ BOOL WINAPI SetICMProfileA(HDC hdc, LPSTR filename)
BOOL
WINAPI
SetICMProfileW
(
HDC
hdc
,
LPWSTR
filename
)
{
FIXME
(
"%p %s stub
\n
"
,
hdc
,
debugstr_w
(
filename
));
if
(
!
filename
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
if
(
!
hdc
)
{
SetLastError
(
ERROR_INVALID_HANDLE
);
return
FALSE
;
}
return
TRUE
;
}
...
...
dlls/gdi32/tests/icm.c
View file @
b32ed71f
...
...
@@ -176,6 +176,127 @@ static void test_SetICMMode( HDC dc )
DeleteDC
(
dc
);
}
static
CALLBACK
INT
enum_profiles_callbackA
(
LPSTR
filename
,
LPARAM
lparam
)
{
trace
(
"%s
\n
"
,
filename
);
return
1
;
}
static
void
test_EnumICMProfilesA
(
HDC
dc
)
{
INT
ret
;
ret
=
EnumICMProfilesA
(
NULL
,
NULL
,
0
);
ok
(
ret
==
-
1
||
broken
(
ret
==
0
)
/* nt4 */
,
"expected -1, got %d
\n
"
,
ret
);
ret
=
EnumICMProfilesA
(
dc
,
NULL
,
0
);
ok
(
ret
==
-
1
||
broken
(
ret
==
0
)
/* nt4 */
,
"expected -1, got %d
\n
"
,
ret
);
ret
=
EnumICMProfilesA
(
dc
,
enum_profiles_callbackA
,
0
);
ok
(
ret
==
-
1
||
broken
(
ret
==
0
)
/* nt4 */
,
"expected -1, got %d
\n
"
,
ret
);
}
static
CALLBACK
INT
enum_profiles_callbackW
(
LPWSTR
filename
,
LPARAM
lparam
)
{
return
1
;
}
static
void
test_EnumICMProfilesW
(
HDC
dc
)
{
INT
ret
;
ret
=
EnumICMProfilesW
(
NULL
,
NULL
,
0
);
ok
(
ret
==
-
1
||
broken
(
ret
==
0
)
/* win9x, nt4 */
,
"expected -1, got %d
\n
"
,
ret
);
ret
=
EnumICMProfilesW
(
dc
,
NULL
,
0
);
ok
(
ret
==
-
1
||
broken
(
ret
==
0
)
/* win9x, nt4 */
,
"expected -1, got %d
\n
"
,
ret
);
ret
=
EnumICMProfilesW
(
dc
,
enum_profiles_callbackW
,
0
);
ok
(
ret
==
-
1
||
broken
(
ret
==
0
)
/* win9x, nt4 */
,
"expected -1, got %d
\n
"
,
ret
);
}
static
void
test_SetICMProfileA
(
HDC
dc
)
{
BOOL
ret
;
char
profile
[
MAX_PATH
];
DWORD
len
,
error
;
SetLastError
(
0xdeadbeef
);
ret
=
SetICMProfileA
(
NULL
,
NULL
);
if
(
!
ret
&&
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
)
{
win_skip
(
"SetICMProfileA is not implemented
\n
"
);
return
;
}
len
=
sizeof
(
profile
);
ret
=
GetICMProfileA
(
dc
,
&
len
,
profile
);
ok
(
ret
,
"GetICMProfileA failed %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
SetICMProfileA
(
NULL
,
NULL
);
error
=
GetLastError
();
ok
(
!
ret
,
"SetICMProfileA succeeded
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
||
broken
(
error
==
0xdeadbeef
)
/* win9x */
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
SetICMProfileA
(
NULL
,
profile
);
error
=
GetLastError
();
ok
(
!
ret
,
"SetICMProfileA succeeded
\n
"
);
ok
(
error
==
ERROR_INVALID_HANDLE
||
broken
(
error
==
0xdeadbeef
)
/* win9x */
,
"expected ERROR_INVALID_HANDLE, got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
SetICMProfileA
(
dc
,
NULL
);
error
=
GetLastError
();
ok
(
!
ret
,
"SetICMProfileA succeeded
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
error
);
ret
=
SetICMProfileA
(
dc
,
profile
);
ok
(
ret
,
"SetICMProfileA failed %u
\n
"
,
GetLastError
());
}
static
void
test_SetICMProfileW
(
HDC
dc
)
{
BOOL
ret
;
WCHAR
profile
[
MAX_PATH
];
DWORD
len
,
error
;
SetLastError
(
0xdeadbeef
);
ret
=
SetICMProfileW
(
NULL
,
NULL
);
if
(
!
ret
&&
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
)
{
win_skip
(
"SetICMProfileW is not implemented
\n
"
);
return
;
}
len
=
sizeof
(
profile
)
/
sizeof
(
profile
[
0
]);
ret
=
GetICMProfileW
(
dc
,
&
len
,
profile
);
ok
(
ret
,
"GetICMProfileW failed %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
SetICMProfileW
(
NULL
,
NULL
);
error
=
GetLastError
();
ok
(
!
ret
,
"SetICMProfileW succeeded
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
SetICMProfileW
(
NULL
,
profile
);
error
=
GetLastError
();
ok
(
!
ret
,
"SetICMProfileW succeeded
\n
"
);
ok
(
error
==
ERROR_INVALID_HANDLE
,
"expected ERROR_INVALID_HANDLE, got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
SetICMProfileW
(
dc
,
NULL
);
error
=
GetLastError
();
ok
(
!
ret
,
"SetICMProfileW succeeded
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
error
);
ret
=
SetICMProfileW
(
dc
,
profile
);
ok
(
ret
,
"SetICMProfileW failed %u
\n
"
,
GetLastError
());
}
START_TEST
(
icm
)
{
HDC
dc
=
GetDC
(
NULL
);
...
...
@@ -183,6 +304,10 @@ START_TEST(icm)
test_GetICMProfileA
(
dc
);
test_GetICMProfileW
(
dc
);
test_SetICMMode
(
dc
);
test_EnumICMProfilesA
(
dc
);
test_EnumICMProfilesW
(
dc
);
test_SetICMProfileA
(
dc
);
test_SetICMProfileW
(
dc
);
ReleaseDC
(
NULL
,
dc
);
}
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