2 * Tests for color profile functions
4 * Copyright 2004, 2005 Hans Leidekker
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 #include "wine/test.h"
34 static BOOL (WINAPI
*pCloseColorProfile
)(HPROFILE
);
35 static BOOL (WINAPI
*pGetColorDirectoryA
)(PCHAR
,PCHAR
,PDWORD
);
36 static BOOL (WINAPI
*pGetColorDirectoryW
)(PWCHAR
,PWCHAR
,PDWORD
);
37 static BOOL (WINAPI
*pGetColorProfileElement
)(HPROFILE
,TAGTYPE
,DWORD
,PDWORD
,PVOID
,PBOOL
);
38 static BOOL (WINAPI
*pGetColorProfileElementTag
)(HPROFILE
,DWORD
,PTAGTYPE
);
39 static BOOL (WINAPI
*pGetColorProfileFromHandle
)(HPROFILE
,PBYTE
,PDWORD
);
40 static BOOL (WINAPI
*pGetColorProfileHeader
)(HPROFILE
,PPROFILEHEADER
);
41 static BOOL (WINAPI
*pGetCountColorProfileElements
)(HPROFILE
,PDWORD
);
42 static BOOL (WINAPI
*pGetStandardColorSpaceProfileA
)(PCSTR
,DWORD
,PSTR
,PDWORD
);
43 static BOOL (WINAPI
*pGetStandardColorSpaceProfileW
)(PCWSTR
,DWORD
,PWSTR
,PDWORD
);
44 static BOOL (WINAPI
*pInstallColorProfileA
)(PCSTR
,PCSTR
);
45 static BOOL (WINAPI
*pInstallColorProfileW
)(PCWSTR
,PCWSTR
);
46 static BOOL (WINAPI
*pIsColorProfileTagPresent
)(HPROFILE
,TAGTYPE
,PBOOL
);
47 static HPROFILE (WINAPI
*pOpenColorProfileA
)(PPROFILE
,DWORD
,DWORD
,DWORD
);
48 static HPROFILE (WINAPI
*pOpenColorProfileW
)(PPROFILE
,DWORD
,DWORD
,DWORD
);
49 static BOOL (WINAPI
*pSetColorProfileElement
)(HPROFILE
,TAGTYPE
,DWORD
,PDWORD
,PVOID
);
50 static BOOL (WINAPI
*pSetColorProfileHeader
)(HPROFILE
,PPROFILEHEADER
);
51 static BOOL (WINAPI
*pSetStandardColorSpaceProfileA
)(PCSTR
,DWORD
,PSTR
);
52 static BOOL (WINAPI
*pSetStandardColorSpaceProfileW
)(PCWSTR
,DWORD
,PWSTR
);
53 static BOOL (WINAPI
*pUninstallColorProfileA
)(PCSTR
,PCSTR
,BOOL
);
54 static BOOL (WINAPI
*pUninstallColorProfileW
)(PCWSTR
,PCWSTR
,BOOL
);
56 #define GETFUNCPTR(func) p##func = (void *)GetProcAddress( hmscms, #func ); \
57 if (!p##func) return FALSE;
59 static BOOL
init_function_ptrs( void )
61 GETFUNCPTR( CloseColorProfile
)
62 GETFUNCPTR( GetColorDirectoryA
)
63 GETFUNCPTR( GetColorDirectoryW
)
64 GETFUNCPTR( GetColorProfileElement
)
65 GETFUNCPTR( GetColorProfileElementTag
)
66 GETFUNCPTR( GetColorProfileFromHandle
)
67 GETFUNCPTR( GetColorProfileHeader
)
68 GETFUNCPTR( GetCountColorProfileElements
)
69 GETFUNCPTR( GetStandardColorSpaceProfileA
)
70 GETFUNCPTR( GetStandardColorSpaceProfileW
)
71 GETFUNCPTR( InstallColorProfileA
)
72 GETFUNCPTR( InstallColorProfileW
)
73 GETFUNCPTR( IsColorProfileTagPresent
)
74 GETFUNCPTR( OpenColorProfileA
)
75 GETFUNCPTR( OpenColorProfileW
)
76 GETFUNCPTR( SetColorProfileElement
)
77 GETFUNCPTR( SetColorProfileHeader
)
78 GETFUNCPTR( SetStandardColorSpaceProfileA
)
79 GETFUNCPTR( SetStandardColorSpaceProfileW
)
80 GETFUNCPTR( UninstallColorProfileA
)
81 GETFUNCPTR( UninstallColorProfileW
)
86 static const char machine
[] = "dummy";
87 static const WCHAR machineW
[] = { 'd','u','m','m','y',0 };
89 /* To do any real functionality testing with this suite you need a copy of
90 * the freely distributable standard RGB color space profile. It comes
91 * standard with Windows, but on Wine you probably need to install it yourself
92 * in one of the locations mentioned below. Here's a link to the profile in
93 * a self extracting zip file:
95 * http://download.microsoft.com/download/whistler/hwdev1/1.0/wxp/en-us/ColorProfile.exe
98 /* Two common places to find the standard color space profile, relative
99 * to the system directory.
101 static const char profile1
[] =
102 "\\color\\srgb color space profile.icm";
103 static const char profile2
[] =
104 "\\spool\\drivers\\color\\srgb color space profile.icm";
106 static const WCHAR profile1W
[] =
107 { '\\','c','o','l','o','r','\\','s','r','g','b',' ','c','o','l','o','r',' ',
108 's','p','a','c','e',' ','p','r','o','f','i','l','e','.','i','c','m',0 };
109 static const WCHAR profile2W
[] =
110 { '\\','s','p','o','o','l','\\','d','r','i','v','e','r','s','\\',
111 'c','o','l','o','r','\\','s','r','g','b',' ','c','o','l','o','r',' ',
112 's','p','a','c','e',' ','p','r','o','f','i','l','e','.','i','c','m',0 };
114 static const unsigned char rgbheader
[] =
115 { 0x48, 0x0c, 0x00, 0x00, 0x6f, 0x6e, 0x69, 0x4c, 0x00, 0x00, 0x10, 0x02,
116 0x72, 0x74, 0x6e, 0x6d, 0x20, 0x42, 0x47, 0x52, 0x20, 0x5a, 0x59, 0x58,
117 0x02, 0x00, 0xce, 0x07, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x31, 0x00,
118 0x70, 0x73, 0x63, 0x61, 0x54, 0x46, 0x53, 0x4d, 0x00, 0x00, 0x00, 0x00,
119 0x20, 0x43, 0x45, 0x49, 0x42, 0x47, 0x52, 0x73, 0x00, 0x00, 0x00, 0x00,
120 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd6, 0xf6, 0x00, 0x00,
121 0x00, 0x00, 0x01, 0x00, 0x2d, 0xd3, 0x00, 0x00, 0x20, 0x20, 0x50, 0x48 };
123 static LPSTR standardprofile
;
124 static LPWSTR standardprofileW
;
126 static LPSTR testprofile
;
127 static LPWSTR testprofileW
;
129 #define IS_SEPARATOR(ch) ((ch) == '\\' || (ch) == '/')
131 static void MSCMS_basenameA( LPCSTR path
, LPSTR name
)
133 INT i
= strlen( path
);
135 while (i
> 0 && !IS_SEPARATOR(path
[i
- 1])) i
--;
136 strcpy( name
, &path
[i
] );
139 static void MSCMS_basenameW( LPCWSTR path
, LPWSTR name
)
141 INT i
= lstrlenW( path
);
143 while (i
> 0 && !IS_SEPARATOR(path
[i
- 1])) i
--;
144 lstrcpyW( name
, &path
[i
] );
147 static void test_GetColorDirectoryA(void)
151 char buffer
[MAX_PATH
];
153 /* Parameter checks */
155 ret
= pGetColorDirectoryA( NULL
, NULL
, NULL
);
156 ok( !ret
, "GetColorDirectoryA() succeeded (%ld)\n", GetLastError() );
160 ret
= pGetColorDirectoryA( NULL
, NULL
, &size
);
161 ok( !ret
&& size
> 0, "GetColorDirectoryA() succeeded (%ld)\n", GetLastError() );
165 ret
= pGetColorDirectoryA( NULL
, buffer
, &size
);
166 ok( !ret
&& size
> 0, "GetColorDirectoryA() succeeded (%ld)\n", GetLastError() );
170 ret
= pGetColorDirectoryA( NULL
, buffer
, &size
);
171 ok( !ret
&& size
> 0, "GetColorDirectoryA() succeeded (%ld)\n", GetLastError() );
173 /* Functional checks */
175 size
= sizeof(buffer
);
177 ret
= pGetColorDirectoryA( NULL
, buffer
, &size
);
178 ok( ret
&& size
> 0, "GetColorDirectoryA() failed (%ld)\n", GetLastError() );
181 static void test_GetColorDirectoryW(void)
185 WCHAR buffer
[MAX_PATH
];
187 /* Parameter checks */
189 /* This one crashes win2k
191 ret = pGetColorDirectoryW( NULL, NULL, NULL );
192 ok( !ret, "GetColorDirectoryW() succeeded (%ld)\n", GetLastError() );
198 ret
= pGetColorDirectoryW( NULL
, NULL
, &size
);
199 ok( !ret
&& size
> 0, "GetColorDirectoryW() succeeded (%ld)\n", GetLastError() );
203 ret
= pGetColorDirectoryW( NULL
, buffer
, &size
);
204 ok( !ret
&& size
> 0, "GetColorDirectoryW() succeeded (%ld)\n", GetLastError() );
208 ret
= pGetColorDirectoryW( NULL
, buffer
, &size
);
209 ok( !ret
&& size
> 0, "GetColorDirectoryW() succeeded (%ld)\n", GetLastError() );
211 /* Functional checks */
213 size
= sizeof(buffer
);
215 ret
= pGetColorDirectoryW( NULL
, buffer
, &size
);
216 ok( ret
&& size
> 0, "GetColorDirectoryW() failed (%ld)\n", GetLastError() );
219 static void test_GetColorProfileElement(void)
227 TAGTYPE tag
= 0x63707274; /* 'cprt' */
228 static char buffer
[51];
229 static const char expect
[] =
230 { 0x74, 0x65, 0x78, 0x74, 0x00, 0x00, 0x00, 0x00, 0x43, 0x6f, 0x70,
231 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20,
232 0x31, 0x39, 0x39, 0x38, 0x20, 0x48, 0x65, 0x77, 0x6c, 0x65, 0x74,
233 0x74, 0x2d, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x72, 0x64, 0x20, 0x43,
234 0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x00 };
236 profile
.dwType
= PROFILE_FILENAME
;
237 profile
.pProfileData
= standardprofile
;
238 profile
.cbDataSize
= strlen(standardprofile
);
240 handle
= pOpenColorProfileA( &profile
, PROFILE_READ
, 0, OPEN_EXISTING
);
241 ok( handle
!= NULL
, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
243 /* Parameter checks */
245 ret
= pGetColorProfileElement( handle
, tag
, 0, NULL
, NULL
, &ref
);
246 ok( !ret
, "GetColorProfileElement() succeeded (%ld)\n", GetLastError() );
248 ret
= pGetColorProfileElement( handle
, tag
, 0, &size
, NULL
, NULL
);
249 ok( !ret
, "GetColorProfileElement() succeeded (%ld)\n", GetLastError() );
253 ret
= pGetColorProfileElement( handle
, tag
, 0, &size
, NULL
, &ref
);
254 ok( !ret
&& size
> 0, "GetColorProfileElement() succeeded (%ld)\n", GetLastError() );
256 size
= sizeof(buffer
);
258 /* Functional checks */
260 ret
= pGetColorProfileElement( handle
, tag
, 0, &size
, buffer
, &ref
);
261 ok( ret
&& size
> 0, "GetColorProfileElement() failed (%ld)\n", GetLastError() );
263 ok( !memcmp( buffer
, expect
, sizeof(expect
) ), "Unexpected tag data\n" );
265 pCloseColorProfile( handle
);
269 static void test_GetColorProfileElementTag(void)
277 TAGTYPE tag
, expect
= 0x63707274; /* 'cprt' */
279 profile
.dwType
= PROFILE_FILENAME
;
280 profile
.pProfileData
= standardprofile
;
281 profile
.cbDataSize
= strlen(standardprofile
);
283 handle
= pOpenColorProfileA( &profile
, PROFILE_READ
, 0, OPEN_EXISTING
);
284 ok( handle
!= NULL
, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
286 /* Parameter checks */
288 ret
= pGetColorProfileElementTag( NULL
, index
, &tag
);
289 ok( !ret
, "GetColorProfileElementTag() succeeded (%ld)\n", GetLastError() );
291 ret
= pGetColorProfileElementTag( handle
, 0, &tag
);
292 ok( !ret
, "GetColorProfileElementTag() succeeded (%ld)\n", GetLastError() );
294 ret
= pGetColorProfileElementTag( handle
, index
, NULL
);
295 ok( !ret
, "GetColorProfileElementTag() succeeded (%ld)\n", GetLastError() );
297 ret
= pGetColorProfileElementTag( handle
, 18, NULL
);
298 ok( !ret
, "GetColorProfileElementTag() succeeded (%ld)\n", GetLastError() );
300 /* Functional checks */
302 ret
= pGetColorProfileElementTag( handle
, index
, &tag
);
303 ok( ret
&& tag
== expect
, "GetColorProfileElementTag() failed (%ld)\n",
306 pCloseColorProfile( handle
);
310 static void test_GetColorProfileFromHandle(void)
318 static const unsigned char expect
[] =
319 { 0x00, 0x00, 0x0c, 0x48, 0x4c, 0x69, 0x6e, 0x6f, 0x02, 0x10, 0x00,
320 0x00, 0x6d, 0x6e, 0x74, 0x72, 0x52, 0x47, 0x42, 0x20, 0x58, 0x59,
321 0x5a, 0x20, 0x07, 0xce, 0x00, 0x02, 0x00, 0x09, 0x00, 0x06, 0x00,
322 0x31, 0x00, 0x00, 0x61, 0x63, 0x73, 0x70, 0x4d, 0x53, 0x46, 0x54,
323 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x43, 0x20, 0x73, 0x52, 0x47,
324 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
325 0x00, 0x00, 0x00, 0x00, 0xf6, 0xd6, 0x00, 0x01, 0x00, 0x00, 0x00,
326 0x00, 0xd3, 0x2d, 0x48, 0x50, 0x20, 0x20 };
328 unsigned char *buffer
;
330 profile
.dwType
= PROFILE_FILENAME
;
331 profile
.pProfileData
= testprofile
;
332 profile
.cbDataSize
= strlen(testprofile
);
334 handle
= pOpenColorProfileA( &profile
, PROFILE_READ
, 0, OPEN_EXISTING
);
335 ok( handle
!= NULL
, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
337 /* Parameter checks */
341 ret
= pGetColorProfileFromHandle( handle
, NULL
, &size
);
342 ok( !ret
&& size
> 0, "GetColorProfileFromHandle() failed (%ld)\n", GetLastError() );
344 buffer
= HeapAlloc( GetProcessHeap(), 0, size
);
348 ret
= pGetColorProfileFromHandle( NULL
, buffer
, &size
);
349 ok( !ret
, "GetColorProfileFromHandle() succeeded (%ld)\n", GetLastError() );
351 ret
= pGetColorProfileFromHandle( handle
, buffer
, NULL
);
352 ok( !ret
, "GetColorProfileFromHandle() succeeded (%ld)\n", GetLastError() );
354 /* Functional checks */
356 ret
= pGetColorProfileFromHandle( handle
, buffer
, &size
);
357 ok( ret
&& size
> 0, "GetColorProfileFromHandle() failed (%ld)\n", GetLastError() );
359 ok( !memcmp( buffer
, expect
, sizeof(expect
) ), "Unexpected header data\n" );
361 HeapFree( GetProcessHeap(), 0, buffer
);
364 pCloseColorProfile( handle
);
368 static void test_GetColorProfileHeader(void)
375 PROFILEHEADER header
;
377 profile
.dwType
= PROFILE_FILENAME
;
378 profile
.pProfileData
= testprofile
;
379 profile
.cbDataSize
= strlen(testprofile
);
381 handle
= pOpenColorProfileA( &profile
, PROFILE_READ
, 0, OPEN_EXISTING
);
382 ok( handle
!= NULL
, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
384 /* Parameter checks */
386 ret
= pGetColorProfileHeader( NULL
, NULL
);
387 ok( !ret
, "GetColorProfileHeader() succeeded (%ld)\n", GetLastError() );
389 ret
= pGetColorProfileHeader( NULL
, &header
);
390 ok( !ret
, "GetColorProfileHeader() succeeded (%ld)\n", GetLastError() );
392 ret
= pGetColorProfileHeader( handle
, NULL
);
393 ok( !ret
, "GetColorProfileHeader() succeeded (%ld)\n", GetLastError() );
395 /* Functional checks */
397 ret
= pGetColorProfileHeader( handle
, &header
);
398 ok( ret
, "GetColorProfileHeader() failed (%ld)\n", GetLastError() );
400 ok( !memcmp( &header
, rgbheader
, sizeof(rgbheader
) ), "Unexpected header data\n" );
402 pCloseColorProfile( handle
);
406 static void test_GetCountColorProfileElements(void)
413 DWORD count
, expect
= 17;
415 profile
.dwType
= PROFILE_FILENAME
;
416 profile
.pProfileData
= standardprofile
;
417 profile
.cbDataSize
= strlen(standardprofile
);
419 handle
= pOpenColorProfileA( &profile
, PROFILE_READ
, 0, OPEN_EXISTING
);
420 ok( handle
!= NULL
, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
422 /* Parameter checks */
424 ret
= pGetCountColorProfileElements( NULL
, &count
);
425 ok( !ret
, "GetCountColorProfileElements() succeeded (%ld)\n",
428 ret
= pGetCountColorProfileElements( handle
, NULL
);
429 ok( !ret
, "GetCountColorProfileElements() succeeded (%ld)\n",
432 /* Functional checks */
434 ret
= pGetCountColorProfileElements( handle
, &count
);
435 ok( ret
&& count
== expect
,
436 "GetCountColorProfileElements() failed (%ld)\n", GetLastError() );
438 pCloseColorProfile( handle
);
442 typedef struct colorspace_description_struct
{
447 #define describe_colorspace(id) {id, #id}
449 colorspace_descr known_colorspaces
[] = {
450 describe_colorspace(SPACE_XYZ
),
451 describe_colorspace(SPACE_Lab
),
452 describe_colorspace(SPACE_Luv
),
453 describe_colorspace(SPACE_YCbCr
),
454 describe_colorspace(SPACE_Yxy
),
455 describe_colorspace(SPACE_RGB
),
456 describe_colorspace(SPACE_GRAY
),
457 describe_colorspace(SPACE_HSV
),
458 describe_colorspace(SPACE_HLS
),
459 describe_colorspace(SPACE_CMYK
),
460 describe_colorspace(SPACE_CMY
),
461 describe_colorspace(SPACE_2_CHANNEL
),
462 describe_colorspace(SPACE_3_CHANNEL
),
463 describe_colorspace(SPACE_4_CHANNEL
),
464 describe_colorspace(SPACE_5_CHANNEL
),
465 describe_colorspace(SPACE_6_CHANNEL
),
466 describe_colorspace(SPACE_7_CHANNEL
),
467 describe_colorspace(SPACE_8_CHANNEL
)
470 static void enum_registered_color_profiles(void)
473 DWORD size
, count
, i
, present
;
474 CHAR profile
[MAX_PATH
];
476 size
= sizeof(profile
);
477 count
= sizeof(known_colorspaces
)/sizeof(known_colorspaces
[0]);
481 trace("Searching for registered standard colorspace profiles:\n");
482 for (i
=0; i
<count
; i
++)
484 ret
= pGetStandardColorSpaceProfileA(NULL
, known_colorspaces
[i
].dwID
, profile
, &size
);
488 trace(" found %s, pointing to '%s' (%d chars)\n", known_colorspaces
[i
].szName
, profile
, strlen(profile
));
491 trace("Total profiles found: %ld.\n", present
);
495 #define fail_GSCSPA(pMachName, dwProfID, pProfName, pdwSz, dwSz, GLE_OK) \
498 SetLastError(0xfaceabad); \
499 ret = pGetStandardColorSpaceProfileA(pMachName, dwProfID, pProfName, pdwSz);\
500 GLE = GetLastError(); \
501 ok( !ret && GLE_OK, \
502 "GetStandardColorSpaceProfileA() returns %d (GLE=%ld)\n", ret, GLE ); \
505 #define test_GSCSPA(pMachName, dwProfID, pProfName, pdwSz, dwSz, GLE_OK) \
508 SetLastError(0xfaceabad); \
509 ret = pGetStandardColorSpaceProfileA(pMachName, dwProfID, pProfName, pdwSz);\
510 GLE = GetLastError(); \
511 ok( (!ret && GLE_OK) || \
512 (ret && !lstrcmpiA( pProfName, "" ) && GLE == 0xfaceabad), \
513 "GetStandardColorSpaceProfileA() returns %d (GLE=%ld)\n", ret, GLE ); \
516 static void test_GetStandardColorSpaceProfileA(void)
519 DWORD size
, sizeP
, GLE
;
520 CHAR oldprofile
[MAX_PATH
];
521 CHAR newprofile
[MAX_PATH
];
523 sizeP
= sizeof(newprofile
);
525 /* Parameter checks */
527 /* Single invalid parameter checks */
528 fail_GSCSPA(machine
, SPACE_RGB
, newprofile
, &size
, sizeP
, (GLE
== ERROR_NOT_SUPPORTED
));
530 fail_GSCSPA(NULL
, (DWORD
)-1, newprofile
, &size
, sizeP
, (GLE
== ERROR_FILE_NOT_FOUND
));
532 fail_GSCSPA(NULL
, SPACE_RGB
, NULL
, &size
, sizeP
, (GLE
== ERROR_INSUFFICIENT_BUFFER
));
534 fail_GSCSPA(NULL
, SPACE_RGB
, newprofile
, NULL
, sizeP
, (GLE
== ERROR_INVALID_PARAMETER
));
536 fail_GSCSPA(NULL
, SPACE_RGB
, newprofile
, &size
, 0, (GLE
== ERROR_MORE_DATA
|| GLE
== ERROR_INSUFFICIENT_BUFFER
));
538 /* Several invalid parameter checks */
539 fail_GSCSPA(machine
, 0, newprofile
, &size
, 0, (GLE
== ERROR_INVALID_PARAMETER
|| GLE
== ERROR_NOT_SUPPORTED
));
541 fail_GSCSPA(NULL
, 0, newprofile
, NULL
, 0, (GLE
== ERROR_INVALID_PARAMETER
));
543 fail_GSCSPA(NULL
, 0, NULL
, &size
, 0, (GLE
== ERROR_INSUFFICIENT_BUFFER
|| GLE
== ERROR_FILE_NOT_FOUND
));
545 test_GSCSPA(NULL
, 0, newprofile
, &size
, sizeP
, (GLE
== ERROR_FILE_NOT_FOUND
));
547 /* Functional checks */
551 size
= sizeof(oldprofile
);
553 ret
= pGetStandardColorSpaceProfileA( NULL
, SPACE_RGB
, oldprofile
, &size
);
554 ok( ret
, "GetStandardColorSpaceProfileA() failed (%ld)\n", GetLastError() );
556 ret
= pSetStandardColorSpaceProfileA( NULL
, SPACE_RGB
, standardprofile
);
557 ok( ret
, "SetStandardColorSpaceProfileA() failed (%ld)\n", GetLastError() );
559 size
= sizeof(newprofile
);
561 ret
= pGetStandardColorSpaceProfileA( NULL
, SPACE_RGB
, newprofile
, &size
);
562 ok( ret
, "GetStandardColorSpaceProfileA() failed (%ld)\n", GetLastError() );
564 ok( !lstrcmpiA( (LPSTR
)&newprofile
, standardprofile
), "Unexpected profile\n" );
566 ret
= pSetStandardColorSpaceProfileA( NULL
, SPACE_RGB
, oldprofile
);
567 ok( ret
, "SetStandardColorSpaceProfileA() failed (%ld)\n", GetLastError() );
571 #define fail_GSCSPW(pMachName, dwProfID, pProfName, pdwSz, dwSz, GLE_OK) \
574 SetLastError(0xfaceabad); \
575 ret = pGetStandardColorSpaceProfileW(pMachName, dwProfID, pProfName, pdwSz);\
576 GLE = GetLastError(); \
577 ok( !ret && GLE_OK, \
578 "GetStandardColorSpaceProfileW() returns %d (GLE=%ld)\n", ret, GLE ); \
581 #define test_GSCSPW(pMachName, dwProfID, pProfName, pdwSz, dwSz, GLE_OK) \
584 SetLastError(0xfaceabad); \
585 ret = pGetStandardColorSpaceProfileW(pMachName, dwProfID, pProfName, pdwSz);\
586 GLE = GetLastError(); \
587 ok( (!ret && GLE_OK) || \
588 (ret && !lstrcmpiW( pProfName, emptyW ) && GLE == 0xfaceabad), \
589 "GetStandardColorSpaceProfileA() returns %d (GLE=%ld)\n", ret, GLE ); \
592 static void test_GetStandardColorSpaceProfileW(void)
595 DWORD size
, sizeP
, GLE
;
596 WCHAR oldprofile
[MAX_PATH
];
597 WCHAR newprofile
[MAX_PATH
];
598 WCHAR emptyW
[] = {0};
600 sizeP
= sizeof(newprofile
);
602 /* Parameter checks */
604 /* Single invalid parameter checks */
605 fail_GSCSPW(machineW
, SPACE_RGB
, newprofile
, &size
, sizeP
, (GLE
== ERROR_NOT_SUPPORTED
));
607 fail_GSCSPW(NULL
, (DWORD
)-1, newprofile
, &size
, sizeP
, (GLE
== ERROR_FILE_NOT_FOUND
));
609 fail_GSCSPW(NULL
, SPACE_RGB
, NULL
, &size
, sizeP
, (GLE
== ERROR_INSUFFICIENT_BUFFER
));
611 fail_GSCSPW(NULL
, SPACE_RGB
, newprofile
, NULL
, sizeP
, (GLE
== ERROR_INVALID_PARAMETER
));
613 fail_GSCSPW(NULL
, SPACE_RGB
, newprofile
, &size
, 0, (GLE
== ERROR_MORE_DATA
|| GLE
== ERROR_INSUFFICIENT_BUFFER
));
615 /* Several invalid parameter checks */
616 fail_GSCSPW(machineW
, 0, newprofile
, &size
, 0, (GLE
== ERROR_INVALID_PARAMETER
|| GLE
== ERROR_NOT_SUPPORTED
));
618 fail_GSCSPW(NULL
, 0, newprofile
, NULL
, 0, (GLE
== ERROR_INVALID_PARAMETER
));
620 fail_GSCSPW(NULL
, 0, NULL
, &size
, 0, (GLE
== ERROR_INSUFFICIENT_BUFFER
|| GLE
== ERROR_FILE_NOT_FOUND
));
622 test_GSCSPW(NULL
, 0, newprofile
, &size
, sizeP
, (GLE
== ERROR_FILE_NOT_FOUND
));
624 /* Functional checks */
626 if (standardprofileW
)
628 size
= sizeof(oldprofile
);
630 ret
= pGetStandardColorSpaceProfileW( NULL
, SPACE_RGB
, oldprofile
, &size
);
631 ok( ret
, "GetStandardColorSpaceProfileW() failed (%ld)\n", GetLastError() );
633 ret
= pSetStandardColorSpaceProfileW( NULL
, SPACE_RGB
, standardprofileW
);
634 ok( ret
, "SetStandardColorSpaceProfileW() failed (%ld)\n", GetLastError() );
636 size
= sizeof(newprofile
);
638 ret
= pGetStandardColorSpaceProfileW( NULL
, SPACE_RGB
, newprofile
, &size
);
639 ok( ret
, "GetStandardColorSpaceProfileW() failed (%ld)\n", GetLastError() );
641 ok( !lstrcmpiW( (LPWSTR
)&newprofile
, standardprofileW
), "Unexpected profile\n" );
643 ret
= pSetStandardColorSpaceProfileW( NULL
, SPACE_RGB
, oldprofile
);
644 ok( ret
, "SetStandardColorSpaceProfileW() failed (%ld)\n", GetLastError() );
648 static void test_InstallColorProfileA(void)
652 /* Parameter checks */
654 ret
= pInstallColorProfileA( NULL
, NULL
);
655 ok( !ret
, "InstallColorProfileA() succeeded (%ld)\n", GetLastError() );
657 ret
= pInstallColorProfileA( machine
, NULL
);
658 ok( !ret
, "InstallColorProfileA() succeeded (%ld)\n", GetLastError() );
660 ret
= pInstallColorProfileA( NULL
, machine
);
661 ok( !ret
, "InstallColorProfileA() succeeded (%ld)\n", GetLastError() );
665 ret
= pInstallColorProfileA( NULL
, standardprofile
);
666 ok( ret
, "InstallColorProfileA() failed (%ld)\n", GetLastError() );
669 /* Functional checks */
673 CHAR dest
[MAX_PATH
], base
[MAX_PATH
];
674 DWORD size
= sizeof(dest
);
678 ret
= pInstallColorProfileA( NULL
, testprofile
);
679 ok( ret
, "InstallColorProfileA() failed (%ld)\n", GetLastError() );
681 ret
= pGetColorDirectoryA( NULL
, dest
, &size
);
682 ok( ret
, "GetColorDirectoryA() failed (%ld)\n", GetLastError() );
684 MSCMS_basenameA( testprofile
, base
);
686 lstrcatA( dest
, slash
);
687 lstrcatA( dest
, base
);
689 /* Check if the profile is really there */
690 handle
= CreateFileA( dest
, 0 , 0, NULL
, OPEN_EXISTING
, 0, NULL
);
691 ok( handle
!= INVALID_HANDLE_VALUE
, "Couldn't find the profile (%ld)\n", GetLastError() );
692 CloseHandle( handle
);
694 ret
= pUninstallColorProfileA( NULL
, dest
, TRUE
);
695 ok( ret
, "UninstallColorProfileA() failed (%ld)\n", GetLastError() );
699 static void test_InstallColorProfileW(void)
703 /* Parameter checks */
705 ret
= pInstallColorProfileW( NULL
, NULL
);
706 ok( !ret
, "InstallColorProfileW() succeeded (%ld)\n", GetLastError() );
708 ret
= pInstallColorProfileW( machineW
, NULL
);
709 ok( !ret
, "InstallColorProfileW() succeeded (%ld)\n", GetLastError() );
711 ret
= pInstallColorProfileW( NULL
, machineW
);
712 ok( !ret
, "InstallColorProfileW() failed (%ld)\n", GetLastError() );
714 if (standardprofileW
)
716 ret
= pInstallColorProfileW( NULL
, standardprofileW
);
717 ok( ret
, "InstallColorProfileW() failed (%ld)\n", GetLastError() );
720 /* Functional checks */
724 WCHAR dest
[MAX_PATH
], base
[MAX_PATH
];
725 DWORD size
= sizeof(dest
);
726 WCHAR slash
[] = { '\\', 0 };
729 ret
= pInstallColorProfileW( NULL
, testprofileW
);
730 ok( ret
, "InstallColorProfileW() failed (%ld)\n", GetLastError() );
732 ret
= pGetColorDirectoryW( NULL
, dest
, &size
);
733 ok( ret
, "GetColorDirectoryW() failed (%ld)\n", GetLastError() );
735 MSCMS_basenameW( testprofileW
, base
);
737 lstrcatW( dest
, slash
);
738 lstrcatW( dest
, base
);
740 /* Check if the profile is really there */
741 handle
= CreateFileW( dest
, 0 , 0, NULL
, OPEN_EXISTING
, 0, NULL
);
742 ok( handle
!= INVALID_HANDLE_VALUE
, "Couldn't find the profile (%ld)\n", GetLastError() );
743 CloseHandle( handle
);
745 ret
= pUninstallColorProfileW( NULL
, dest
, TRUE
);
746 ok( ret
, "UninstallColorProfileW() failed (%ld)\n", GetLastError() );
750 static void test_IsColorProfileTagPresent(void)
759 profile
.dwType
= PROFILE_FILENAME
;
760 profile
.pProfileData
= standardprofile
;
761 profile
.cbDataSize
= strlen(standardprofile
);
763 handle
= pOpenColorProfileA( &profile
, PROFILE_READ
, 0, OPEN_EXISTING
);
764 ok( handle
!= NULL
, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
766 /* Parameter checks */
770 ret
= pIsColorProfileTagPresent( handle
, tag
, &present
);
771 ok( !(ret
&& present
), "IsColorProfileTagPresent() succeeded (%ld)\n", GetLastError() );
773 tag
= 0x63707274; /* 'cprt' */
775 ret
= pIsColorProfileTagPresent( NULL
, tag
, &present
);
776 ok( !ret
, "IsColorProfileTagPresent() succeeded (%ld)\n", GetLastError() );
778 ret
= pIsColorProfileTagPresent( handle
, tag
, NULL
);
779 ok( !ret
, "IsColorProfileTagPresent() succeeded (%ld)\n", GetLastError() );
781 /* Functional checks */
783 ret
= pIsColorProfileTagPresent( handle
, tag
, &present
);
784 ok( ret
&& present
, "IsColorProfileTagPresent() failed (%ld)\n", GetLastError() );
786 pCloseColorProfile( handle
);
790 static void test_OpenColorProfileA(void)
796 profile
.dwType
= PROFILE_FILENAME
;
797 profile
.pProfileData
= NULL
;
798 profile
.cbDataSize
= 0;
800 /* Parameter checks */
802 handle
= pOpenColorProfileA( NULL
, 0, 0, 0 );
803 ok( handle
== NULL
, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
805 handle
= pOpenColorProfileA( &profile
, 0, 0, 0 );
806 ok( handle
== NULL
, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
808 handle
= pOpenColorProfileA( &profile
, PROFILE_READ
, 0, 0 );
809 ok( handle
== NULL
, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
811 handle
= pOpenColorProfileA( &profile
, PROFILE_READWRITE
, 0, 0 );
812 ok( handle
== NULL
, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
814 ok ( !pCloseColorProfile( NULL
), "CloseColorProfile() succeeded\n" );
818 profile
.pProfileData
= standardprofile
;
819 profile
.cbDataSize
= strlen(standardprofile
);
821 handle
= pOpenColorProfileA( &profile
, 0, 0, 0 );
822 ok( handle
== NULL
, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
824 handle
= pOpenColorProfileA( &profile
, PROFILE_READ
, 0, 0 );
825 ok( handle
== NULL
, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
827 handle
= pOpenColorProfileA( &profile
, PROFILE_READ
|PROFILE_READWRITE
, 0, 0 );
828 ok( handle
== NULL
, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
830 /* Functional checks */
832 handle
= pOpenColorProfileA( &profile
, PROFILE_READ
, 0, OPEN_EXISTING
);
833 ok( handle
!= NULL
, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
835 ret
= pCloseColorProfile( handle
);
836 ok( ret
, "CloseColorProfile() failed (%ld)\n", GetLastError() );
840 static void test_OpenColorProfileW(void)
846 profile
.dwType
= PROFILE_FILENAME
;
847 profile
.pProfileData
= NULL
;
848 profile
.cbDataSize
= 0;
850 /* Parameter checks */
852 handle
= pOpenColorProfileW( NULL
, 0, 0, 0 );
853 ok( handle
== NULL
, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
855 handle
= pOpenColorProfileW( &profile
, 0, 0, 0 );
856 ok( handle
== NULL
, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
858 handle
= pOpenColorProfileW( &profile
, PROFILE_READ
, 0, 0 );
859 ok( handle
== NULL
, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
861 handle
= pOpenColorProfileW( &profile
, PROFILE_READWRITE
, 0, 0 );
862 ok( handle
== NULL
, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
864 ok ( !pCloseColorProfile( NULL
), "CloseColorProfile() succeeded\n" );
866 if (standardprofileW
)
868 profile
.pProfileData
= standardprofileW
;
869 profile
.cbDataSize
= lstrlenW(standardprofileW
) * sizeof(WCHAR
);
871 handle
= pOpenColorProfileW( &profile
, 0, 0, 0 );
872 ok( handle
== NULL
, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
874 handle
= pOpenColorProfileW( &profile
, PROFILE_READ
, 0, 0 );
875 ok( handle
== NULL
, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
877 handle
= pOpenColorProfileW( &profile
, PROFILE_READ
|PROFILE_READWRITE
, 0, 0 );
878 ok( handle
== NULL
, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
880 /* Functional checks */
882 handle
= pOpenColorProfileW( &profile
, PROFILE_READ
, 0, OPEN_EXISTING
);
883 ok( handle
!= NULL
, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
885 ret
= pCloseColorProfile( handle
);
886 ok( ret
, "CloseColorProfile() failed (%ld)\n", GetLastError() );
890 static void test_SetColorProfileElement(void)
899 TAGTYPE tag
= 0x63707274; /* 'cprt' */
900 static char data
[] = "(c) The Wine Project";
901 static char buffer
[51];
903 profile
.dwType
= PROFILE_FILENAME
;
904 profile
.pProfileData
= testprofile
;
905 profile
.cbDataSize
= strlen(testprofile
);
907 /* Parameter checks */
909 handle
= pOpenColorProfileA( &profile
, PROFILE_READ
, 0, OPEN_EXISTING
);
910 ok( handle
!= NULL
, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
912 ret
= pSetColorProfileElement( handle
, tag
, 0, &size
, data
);
913 ok( !ret
, "SetColorProfileElement() succeeded (%ld)\n", GetLastError() );
915 pCloseColorProfile( handle
);
917 handle
= pOpenColorProfileA( &profile
, PROFILE_READWRITE
, 0, OPEN_EXISTING
);
918 ok( handle
!= NULL
, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
920 ret
= pSetColorProfileElement( NULL
, 0, 0, NULL
, NULL
);
921 ok( !ret
, "SetColorProfileElement() succeeded (%ld)\n", GetLastError() );
923 ret
= pSetColorProfileElement( handle
, 0, 0, NULL
, NULL
);
924 ok( !ret
, "SetColorProfileElement() succeeded (%ld)\n", GetLastError() );
926 ret
= pSetColorProfileElement( handle
, tag
, 0, NULL
, NULL
);
927 ok( !ret
, "SetColorProfileElement() succeeded (%ld)\n", GetLastError() );
929 ret
= pSetColorProfileElement( handle
, tag
, 0, &size
, NULL
);
930 ok( !ret
, "SetColorProfileElement() succeeded (%ld)\n", GetLastError() );
932 /* Functional checks */
936 ret
= pSetColorProfileElement( handle
, tag
, 0, &size
, data
);
937 ok( ret
, "SetColorProfileElement() failed (%ld)\n", GetLastError() );
939 size
= sizeof(buffer
);
941 ret
= pGetColorProfileElement( handle
, tag
, 0, &size
, buffer
, &ref
);
942 ok( ret
&& size
> 0, "GetColorProfileElement() failed (%ld)\n", GetLastError() );
944 ok( !memcmp( data
, buffer
, sizeof(data
) ),
945 "Unexpected tag data, expected %s, got %s (%ld)\n",
946 data
, buffer
, GetLastError() );
948 pCloseColorProfile( handle
);
952 static void test_SetColorProfileHeader(void)
959 PROFILEHEADER header
;
961 profile
.dwType
= PROFILE_FILENAME
;
962 profile
.pProfileData
= testprofile
;
963 profile
.cbDataSize
= strlen(testprofile
);
965 header
.phSize
= 0x00000c48;
966 header
.phCMMType
= 0x4c696e6f;
967 header
.phVersion
= 0x02100000;
968 header
.phClass
= 0x6d6e7472;
969 header
.phDataColorSpace
= 0x52474220;
970 header
.phConnectionSpace
= 0x58595a20;
971 header
.phDateTime
[0] = 0x07ce0002;
972 header
.phDateTime
[1] = 0x00090006;
973 header
.phDateTime
[2] = 0x00310000;
974 header
.phSignature
= 0x61637370;
975 header
.phPlatform
= 0x4d534654;
976 header
.phProfileFlags
= 0x00000000;
977 header
.phManufacturer
= 0x49454320;
978 header
.phModel
= 0x73524742;
979 header
.phAttributes
[0] = 0x00000000;
980 header
.phAttributes
[1] = 0x00000000;
981 header
.phRenderingIntent
= 0x00000000;
982 header
.phIlluminant
.ciexyzX
= 0x0000f6d6;
983 header
.phIlluminant
.ciexyzY
= 0x00010000;
984 header
.phIlluminant
.ciexyzZ
= 0x0000d32d;
985 header
.phCreator
= 0x48502020;
987 /* Parameter checks */
989 handle
= pOpenColorProfileA( &profile
, PROFILE_READ
, 0, OPEN_EXISTING
);
990 ok( handle
!= NULL
, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
992 ret
= pSetColorProfileHeader( handle
, &header
);
993 ok( !ret
, "SetColorProfileHeader() succeeded (%ld)\n", GetLastError() );
995 pCloseColorProfile( handle
);
997 handle
= pOpenColorProfileA( &profile
, PROFILE_READWRITE
, 0, OPEN_EXISTING
);
998 ok( handle
!= NULL
, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
1000 ret
= pSetColorProfileHeader( NULL
, NULL
);
1001 ok( !ret
, "SetColorProfileHeader() succeeded (%ld)\n", GetLastError() );
1003 ret
= pSetColorProfileHeader( handle
, NULL
);
1004 ok( !ret
, "SetColorProfileHeader() succeeded (%ld)\n", GetLastError() );
1006 ret
= pSetColorProfileHeader( NULL
, &header
);
1007 ok( !ret
, "SetColorProfileHeader() succeeded (%ld)\n", GetLastError() );
1009 /* Functional checks */
1011 ret
= pSetColorProfileHeader( handle
, &header
);
1012 ok( ret
, "SetColorProfileHeader() failed (%ld)\n", GetLastError() );
1014 ret
= pGetColorProfileHeader( handle
, &header
);
1015 ok( ret
, "GetColorProfileHeader() failed (%ld)\n", GetLastError() );
1017 ok( !memcmp( &header
, rgbheader
, sizeof(rgbheader
) ), "Unexpected header data\n" );
1019 pCloseColorProfile( handle
);
1023 static void test_UninstallColorProfileA(void)
1027 /* Parameter checks */
1029 ret
= pUninstallColorProfileA( NULL
, NULL
, FALSE
);
1030 ok( !ret
, "UninstallColorProfileA() succeeded (%ld)\n", GetLastError() );
1032 ret
= pUninstallColorProfileA( machine
, NULL
, FALSE
);
1033 ok( !ret
, "UninstallColorProfileA() succeeded (%ld)\n", GetLastError() );
1035 /* Functional checks */
1039 CHAR dest
[MAX_PATH
], base
[MAX_PATH
];
1040 DWORD size
= sizeof(dest
);
1041 CHAR slash
[] = "\\";
1044 ret
= pInstallColorProfileA( NULL
, testprofile
);
1045 ok( ret
, "InstallColorProfileA() failed (%ld)\n", GetLastError() );
1047 ret
= pGetColorDirectoryA( NULL
, dest
, &size
);
1048 ok( ret
, "GetColorDirectoryA() failed (%ld)\n", GetLastError() );
1050 MSCMS_basenameA( testprofile
, base
);
1052 lstrcatA( dest
, slash
);
1053 lstrcatA( dest
, base
);
1055 ret
= pUninstallColorProfileA( NULL
, dest
, TRUE
);
1056 ok( ret
, "UninstallColorProfileA() failed (%ld)\n", GetLastError() );
1058 /* Check if the profile is really gone */
1059 handle
= CreateFileA( dest
, 0 , 0, NULL
, OPEN_EXISTING
, 0, NULL
);
1060 ok( handle
== INVALID_HANDLE_VALUE
, "Found the profile (%ld)\n", GetLastError() );
1061 CloseHandle( handle
);
1065 static void test_UninstallColorProfileW(void)
1069 /* Parameter checks */
1071 ret
= pUninstallColorProfileW( NULL
, NULL
, FALSE
);
1072 ok( !ret
, "UninstallColorProfileW() succeeded (%ld)\n", GetLastError() );
1074 ret
= pUninstallColorProfileW( machineW
, NULL
, FALSE
);
1075 ok( !ret
, "UninstallColorProfileW() succeeded (%ld)\n", GetLastError() );
1077 /* Functional checks */
1081 WCHAR dest
[MAX_PATH
], base
[MAX_PATH
];
1082 char destA
[MAX_PATH
];
1083 DWORD size
= sizeof(dest
);
1084 WCHAR slash
[] = { '\\', 0 };
1088 ret
= pInstallColorProfileW( NULL
, testprofileW
);
1089 ok( ret
, "InstallColorProfileW() failed (%ld)\n", GetLastError() );
1091 ret
= pGetColorDirectoryW( NULL
, dest
, &size
);
1092 ok( ret
, "GetColorDirectoryW() failed (%ld)\n", GetLastError() );
1094 MSCMS_basenameW( testprofileW
, base
);
1096 lstrcatW( dest
, slash
);
1097 lstrcatW( dest
, base
);
1099 ret
= pUninstallColorProfileW( NULL
, dest
, TRUE
);
1100 ok( ret
, "UninstallColorProfileW() failed (%ld)\n", GetLastError() );
1102 bytes_copied
= WideCharToMultiByte(CP_ACP
, 0, dest
, -1, destA
, MAX_PATH
, NULL
, NULL
);
1103 ok( bytes_copied
> 0 , "WideCharToMultiByte() returns %d\n", bytes_copied
);
1104 /* Check if the profile is really gone */
1105 handle
= CreateFileA( destA
, 0 , 0, NULL
, OPEN_EXISTING
, 0, NULL
);
1106 ok( handle
== INVALID_HANDLE_VALUE
, "Found the profile (%ld)\n", GetLastError() );
1107 CloseHandle( handle
);
1115 char path
[MAX_PATH
], file
[MAX_PATH
];
1116 char profilefile1
[MAX_PATH
], profilefile2
[MAX_PATH
];
1117 WCHAR profilefile1W
[MAX_PATH
], profilefile2W
[MAX_PATH
];
1118 WCHAR fileW
[MAX_PATH
];
1121 hmscms
= LoadLibraryA( "mscms.dll" );
1122 if (!hmscms
) return;
1124 if (!init_function_ptrs())
1126 FreeLibrary( hmscms
);
1130 /* See if we can find the standard color profile */
1131 ret
= GetSystemDirectoryA( profilefile1
, sizeof(profilefile1
) );
1132 ok( ret
> 0, "GetSystemDirectoryA() returns %d, LastError = %ld\n", ret
, GetLastError());
1133 ok( lstrlenA(profilefile1
) > 0 && lstrlenA(profilefile1
) < MAX_PATH
,
1134 "GetSystemDirectoryA() returns %d, LastError = %ld\n", ret
, GetLastError());
1135 MultiByteToWideChar(CP_ACP
, 0, profilefile1
, -1, profilefile1W
, MAX_PATH
);
1136 ok( lstrlenW(profilefile1W
) > 0 && lstrlenW(profilefile1W
) < MAX_PATH
,
1137 "GetSystemDirectoryA() returns %d, LastError = %ld\n", ret
, GetLastError());
1138 lstrcpyA(profilefile2
, profilefile1
);
1139 lstrcpyW(profilefile2W
, profilefile1W
);
1141 lstrcatA( profilefile1
, profile1
);
1142 lstrcatW( profilefile1W
, profile1W
);
1143 handle
= CreateFileA( profilefile1
, 0 , 0, NULL
, OPEN_EXISTING
, 0, NULL
);
1145 if (handle
!= INVALID_HANDLE_VALUE
)
1147 standardprofile
= profilefile1
;
1148 standardprofileW
= profilefile1W
;
1149 CloseHandle( handle
);
1152 lstrcatA( profilefile2
, profile2
);
1153 lstrcatW( profilefile2W
, profile2W
);
1154 handle
= CreateFileA( profilefile2
, 0 , 0, NULL
, OPEN_EXISTING
, 0, NULL
);
1156 if (handle
!= INVALID_HANDLE_VALUE
)
1158 standardprofile
= profilefile2
;
1159 standardprofileW
= profilefile2W
;
1160 CloseHandle( handle
);
1163 /* If found, create a temporary copy for testing purposes */
1164 if (standardprofile
&& GetTempPath( sizeof(path
), path
))
1166 if (GetTempFileName( path
, "rgb", 0, file
))
1168 if (CopyFileA( standardprofile
, file
, FALSE
))
1170 testprofile
= (LPSTR
)&file
;
1172 len
= MultiByteToWideChar( CP_ACP
, 0, testprofile
, -1, NULL
, 0 );
1173 MultiByteToWideChar( CP_ACP
, 0, testprofile
, -1, fileW
, len
);
1175 testprofileW
= (LPWSTR
)&fileW
;
1180 test_GetColorDirectoryA();
1181 test_GetColorDirectoryW();
1183 test_GetColorProfileElement();
1184 test_GetColorProfileElementTag();
1186 test_GetColorProfileFromHandle();
1187 test_GetColorProfileHeader();
1189 test_GetCountColorProfileElements();
1191 enum_registered_color_profiles();
1193 test_GetStandardColorSpaceProfileA();
1194 test_GetStandardColorSpaceProfileW();
1196 test_InstallColorProfileA();
1197 test_InstallColorProfileW();
1199 test_IsColorProfileTagPresent();
1201 test_OpenColorProfileA();
1202 test_OpenColorProfileW();
1204 test_SetColorProfileElement();
1205 test_SetColorProfileHeader();
1207 test_UninstallColorProfileA();
1208 test_UninstallColorProfileW();
1212 DeleteFileA( testprofile
);
1214 FreeLibrary( hmscms
);