2004-10-07 21:12:41 +02:00
|
|
|
/*
|
|
|
|
* Tests for color profile functions
|
|
|
|
*
|
2005-02-14 21:53:59 +01:00
|
|
|
* Copyright 2004, 2005 Hans Leidekker
|
2004-10-07 21:12:41 +02:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2006-01-19 12:44:02 +01:00
|
|
|
#include "winreg.h"
|
2004-10-07 21:12:41 +02:00
|
|
|
#include "winnls.h"
|
|
|
|
#include "wingdi.h"
|
2004-10-22 21:56:51 +02:00
|
|
|
#include "winuser.h"
|
2004-10-07 21:12:41 +02:00
|
|
|
#include "icm.h"
|
|
|
|
|
|
|
|
#include "wine/test.h"
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
HMODULE hmscms;
|
|
|
|
|
|
|
|
static BOOL (WINAPI *pCloseColorProfile)(HPROFILE);
|
|
|
|
static BOOL (WINAPI *pGetColorDirectoryA)(PCHAR,PCHAR,PDWORD);
|
|
|
|
static BOOL (WINAPI *pGetColorDirectoryW)(PWCHAR,PWCHAR,PDWORD);
|
|
|
|
static BOOL (WINAPI *pGetColorProfileElement)(HPROFILE,TAGTYPE,DWORD,PDWORD,PVOID,PBOOL);
|
|
|
|
static BOOL (WINAPI *pGetColorProfileElementTag)(HPROFILE,DWORD,PTAGTYPE);
|
|
|
|
static BOOL (WINAPI *pGetColorProfileFromHandle)(HPROFILE,PBYTE,PDWORD);
|
|
|
|
static BOOL (WINAPI *pGetColorProfileHeader)(HPROFILE,PPROFILEHEADER);
|
|
|
|
static BOOL (WINAPI *pGetCountColorProfileElements)(HPROFILE,PDWORD);
|
|
|
|
static BOOL (WINAPI *pGetStandardColorSpaceProfileA)(PCSTR,DWORD,PSTR,PDWORD);
|
|
|
|
static BOOL (WINAPI *pGetStandardColorSpaceProfileW)(PCWSTR,DWORD,PWSTR,PDWORD);
|
|
|
|
static BOOL (WINAPI *pInstallColorProfileA)(PCSTR,PCSTR);
|
|
|
|
static BOOL (WINAPI *pInstallColorProfileW)(PCWSTR,PCWSTR);
|
|
|
|
static BOOL (WINAPI *pIsColorProfileTagPresent)(HPROFILE,TAGTYPE,PBOOL);
|
|
|
|
static HPROFILE (WINAPI *pOpenColorProfileA)(PPROFILE,DWORD,DWORD,DWORD);
|
|
|
|
static HPROFILE (WINAPI *pOpenColorProfileW)(PPROFILE,DWORD,DWORD,DWORD);
|
|
|
|
static BOOL (WINAPI *pSetColorProfileElement)(HPROFILE,TAGTYPE,DWORD,PDWORD,PVOID);
|
|
|
|
static BOOL (WINAPI *pSetColorProfileHeader)(HPROFILE,PPROFILEHEADER);
|
|
|
|
static BOOL (WINAPI *pSetStandardColorSpaceProfileA)(PCSTR,DWORD,PSTR);
|
|
|
|
static BOOL (WINAPI *pSetStandardColorSpaceProfileW)(PCWSTR,DWORD,PWSTR);
|
|
|
|
static BOOL (WINAPI *pUninstallColorProfileA)(PCSTR,PCSTR,BOOL);
|
|
|
|
static BOOL (WINAPI *pUninstallColorProfileW)(PCWSTR,PCWSTR,BOOL);
|
|
|
|
|
|
|
|
#define GETFUNCPTR(func) p##func = (void *)GetProcAddress( hmscms, #func ); \
|
|
|
|
if (!p##func) return FALSE;
|
|
|
|
|
|
|
|
static BOOL init_function_ptrs( void )
|
|
|
|
{
|
|
|
|
GETFUNCPTR( CloseColorProfile )
|
|
|
|
GETFUNCPTR( GetColorDirectoryA )
|
|
|
|
GETFUNCPTR( GetColorDirectoryW )
|
|
|
|
GETFUNCPTR( GetColorProfileElement )
|
|
|
|
GETFUNCPTR( GetColorProfileElementTag )
|
|
|
|
GETFUNCPTR( GetColorProfileFromHandle )
|
|
|
|
GETFUNCPTR( GetColorProfileHeader )
|
|
|
|
GETFUNCPTR( GetCountColorProfileElements )
|
|
|
|
GETFUNCPTR( GetStandardColorSpaceProfileA )
|
|
|
|
GETFUNCPTR( GetStandardColorSpaceProfileW )
|
|
|
|
GETFUNCPTR( InstallColorProfileA )
|
|
|
|
GETFUNCPTR( InstallColorProfileW )
|
|
|
|
GETFUNCPTR( IsColorProfileTagPresent )
|
|
|
|
GETFUNCPTR( OpenColorProfileA )
|
|
|
|
GETFUNCPTR( OpenColorProfileW )
|
|
|
|
GETFUNCPTR( SetColorProfileElement )
|
|
|
|
GETFUNCPTR( SetColorProfileHeader )
|
|
|
|
GETFUNCPTR( SetStandardColorSpaceProfileA )
|
|
|
|
GETFUNCPTR( SetStandardColorSpaceProfileW )
|
|
|
|
GETFUNCPTR( UninstallColorProfileA )
|
|
|
|
GETFUNCPTR( UninstallColorProfileW )
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-10-07 21:12:41 +02:00
|
|
|
static const char machine[] = "dummy";
|
|
|
|
static const WCHAR machineW[] = { 'd','u','m','m','y',0 };
|
|
|
|
|
2004-12-07 15:42:47 +01:00
|
|
|
/* To do any real functionality testing with this suite you need a copy of
|
2004-12-20 18:04:11 +01:00
|
|
|
* the freely distributable standard RGB color space profile. It comes
|
2004-12-07 15:42:47 +01:00
|
|
|
* standard with Windows, but on Wine you probably need to install it yourself
|
|
|
|
* in one of the locations mentioned below. Here's a link to the profile in
|
|
|
|
* a self extracting zip file:
|
|
|
|
*
|
|
|
|
* http://download.microsoft.com/download/whistler/hwdev1/1.0/wxp/en-us/ColorProfile.exe
|
|
|
|
*/
|
|
|
|
|
2005-07-05 12:56:52 +02:00
|
|
|
/* Two common places to find the standard color space profile, relative
|
|
|
|
* to the system directory.
|
|
|
|
*/
|
|
|
|
static const char profile1[] =
|
2005-04-11 20:49:40 +02:00
|
|
|
"\\color\\srgb color space profile.icm";
|
2005-07-05 12:56:52 +02:00
|
|
|
static const char profile2[] =
|
|
|
|
"\\spool\\drivers\\color\\srgb color space profile.icm";
|
2005-04-11 20:49:40 +02:00
|
|
|
|
2005-07-05 12:56:52 +02:00
|
|
|
static const WCHAR profile1W[] =
|
2005-04-11 20:49:40 +02:00
|
|
|
{ '\\','c','o','l','o','r','\\','s','r','g','b',' ','c','o','l','o','r',' ',
|
2004-10-07 21:12:41 +02:00
|
|
|
's','p','a','c','e',' ','p','r','o','f','i','l','e','.','i','c','m',0 };
|
2005-07-05 12:56:52 +02:00
|
|
|
static const WCHAR profile2W[] =
|
|
|
|
{ '\\','s','p','o','o','l','\\','d','r','i','v','e','r','s','\\',
|
|
|
|
'c','o','l','o','r','\\','s','r','g','b',' ','c','o','l','o','r',' ',
|
|
|
|
's','p','a','c','e',' ','p','r','o','f','i','l','e','.','i','c','m',0 };
|
2004-10-07 21:12:41 +02:00
|
|
|
|
2004-12-13 14:23:17 +01:00
|
|
|
static const unsigned char rgbheader[] =
|
2004-12-07 15:42:47 +01:00
|
|
|
{ 0x48, 0x0c, 0x00, 0x00, 0x6f, 0x6e, 0x69, 0x4c, 0x00, 0x00, 0x10, 0x02,
|
|
|
|
0x72, 0x74, 0x6e, 0x6d, 0x20, 0x42, 0x47, 0x52, 0x20, 0x5a, 0x59, 0x58,
|
|
|
|
0x02, 0x00, 0xce, 0x07, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x31, 0x00,
|
|
|
|
0x70, 0x73, 0x63, 0x61, 0x54, 0x46, 0x53, 0x4d, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x20, 0x43, 0x45, 0x49, 0x42, 0x47, 0x52, 0x73, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd6, 0xf6, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x01, 0x00, 0x2d, 0xd3, 0x00, 0x00, 0x20, 0x20, 0x50, 0x48 };
|
|
|
|
|
2004-11-03 23:14:25 +01:00
|
|
|
static LPSTR standardprofile;
|
|
|
|
static LPWSTR standardprofileW;
|
2004-10-07 21:12:41 +02:00
|
|
|
|
2004-11-03 23:14:25 +01:00
|
|
|
static LPSTR testprofile;
|
|
|
|
static LPWSTR testprofileW;
|
|
|
|
|
|
|
|
#define IS_SEPARATOR(ch) ((ch) == '\\' || (ch) == '/')
|
|
|
|
|
|
|
|
static void MSCMS_basenameA( LPCSTR path, LPSTR name )
|
|
|
|
{
|
|
|
|
INT i = strlen( path );
|
|
|
|
|
|
|
|
while (i > 0 && !IS_SEPARATOR(path[i - 1])) i--;
|
|
|
|
strcpy( name, &path[i] );
|
|
|
|
}
|
|
|
|
|
|
|
|
static void MSCMS_basenameW( LPCWSTR path, LPWSTR name )
|
|
|
|
{
|
|
|
|
INT i = lstrlenW( path );
|
|
|
|
|
|
|
|
while (i > 0 && !IS_SEPARATOR(path[i - 1])) i--;
|
|
|
|
lstrcpyW( name, &path[i] );
|
|
|
|
}
|
2004-10-07 21:12:41 +02:00
|
|
|
|
2005-06-20 16:18:03 +02:00
|
|
|
static void test_GetColorDirectoryA(void)
|
2004-10-07 21:12:41 +02:00
|
|
|
{
|
|
|
|
BOOL ret;
|
|
|
|
DWORD size;
|
|
|
|
char buffer[MAX_PATH];
|
|
|
|
|
|
|
|
/* Parameter checks */
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorDirectoryA( NULL, NULL, NULL );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret, "GetColorDirectoryA() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2004-10-07 21:12:41 +02:00
|
|
|
size = 0;
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorDirectoryA( NULL, NULL, &size );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret && size > 0, "GetColorDirectoryA() succeeded (%ld)\n", GetLastError() );
|
2004-10-07 21:12:41 +02:00
|
|
|
|
|
|
|
size = 0;
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorDirectoryA( NULL, buffer, &size );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret && size > 0, "GetColorDirectoryA() succeeded (%ld)\n", GetLastError() );
|
2004-10-07 21:12:41 +02:00
|
|
|
|
|
|
|
size = 1;
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorDirectoryA( NULL, buffer, &size );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret && size > 0, "GetColorDirectoryA() succeeded (%ld)\n", GetLastError() );
|
2004-10-07 21:12:41 +02:00
|
|
|
|
|
|
|
/* Functional checks */
|
|
|
|
|
|
|
|
size = sizeof(buffer);
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorDirectoryA( NULL, buffer, &size );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( ret && size > 0, "GetColorDirectoryA() failed (%ld)\n", GetLastError() );
|
2004-10-07 21:12:41 +02:00
|
|
|
}
|
|
|
|
|
2005-06-20 16:18:03 +02:00
|
|
|
static void test_GetColorDirectoryW(void)
|
2004-10-07 21:12:41 +02:00
|
|
|
{
|
|
|
|
BOOL ret;
|
|
|
|
DWORD size;
|
|
|
|
WCHAR buffer[MAX_PATH];
|
|
|
|
|
|
|
|
/* Parameter checks */
|
|
|
|
|
2004-12-07 15:42:47 +01:00
|
|
|
/* This one crashes win2k
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorDirectoryW( NULL, NULL, NULL );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret, "GetColorDirectoryW() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2004-10-07 21:12:41 +02:00
|
|
|
size = 0;
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorDirectoryW( NULL, NULL, &size );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret && size > 0, "GetColorDirectoryW() succeeded (%ld)\n", GetLastError() );
|
2004-10-07 21:12:41 +02:00
|
|
|
|
|
|
|
size = 0;
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorDirectoryW( NULL, buffer, &size );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret && size > 0, "GetColorDirectoryW() succeeded (%ld)\n", GetLastError() );
|
2004-10-07 21:12:41 +02:00
|
|
|
|
|
|
|
size = 1;
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorDirectoryW( NULL, buffer, &size );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret && size > 0, "GetColorDirectoryW() succeeded (%ld)\n", GetLastError() );
|
2004-10-07 21:12:41 +02:00
|
|
|
|
|
|
|
/* Functional checks */
|
|
|
|
|
|
|
|
size = sizeof(buffer);
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorDirectoryW( NULL, buffer, &size );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( ret && size > 0, "GetColorDirectoryW() failed (%ld)\n", GetLastError() );
|
2004-10-07 21:12:41 +02:00
|
|
|
}
|
|
|
|
|
2005-06-20 16:18:03 +02:00
|
|
|
static void test_GetColorProfileElement(void)
|
2004-11-30 22:06:14 +01:00
|
|
|
{
|
|
|
|
if (standardprofile)
|
|
|
|
{
|
|
|
|
PROFILE profile;
|
|
|
|
HPROFILE handle;
|
|
|
|
BOOL ret, ref;
|
|
|
|
DWORD size;
|
|
|
|
TAGTYPE tag = 0x63707274; /* 'cprt' */
|
|
|
|
static char buffer[51];
|
2004-12-13 14:23:17 +01:00
|
|
|
static const char expect[] =
|
2004-11-30 22:06:14 +01:00
|
|
|
{ 0x74, 0x65, 0x78, 0x74, 0x00, 0x00, 0x00, 0x00, 0x43, 0x6f, 0x70,
|
|
|
|
0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20,
|
|
|
|
0x31, 0x39, 0x39, 0x38, 0x20, 0x48, 0x65, 0x77, 0x6c, 0x65, 0x74,
|
|
|
|
0x74, 0x2d, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x72, 0x64, 0x20, 0x43,
|
|
|
|
0x6f, 0x6d, 0x70, 0x61, 0x6e, 0x79, 0x00 };
|
|
|
|
|
|
|
|
profile.dwType = PROFILE_FILENAME;
|
|
|
|
profile.pProfileData = standardprofile;
|
|
|
|
profile.cbDataSize = strlen(standardprofile);
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING );
|
2004-11-30 22:06:14 +01:00
|
|
|
ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2004-12-07 15:42:47 +01:00
|
|
|
/* Parameter checks */
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorProfileElement( handle, tag, 0, NULL, NULL, &ref );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret, "GetColorProfileElement() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorProfileElement( handle, tag, 0, &size, NULL, NULL );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret, "GetColorProfileElement() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2004-11-30 22:06:14 +01:00
|
|
|
size = 0;
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorProfileElement( handle, tag, 0, &size, NULL, &ref );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret && size > 0, "GetColorProfileElement() succeeded (%ld)\n", GetLastError() );
|
2004-11-30 22:06:14 +01:00
|
|
|
|
|
|
|
size = sizeof(buffer);
|
|
|
|
|
2004-12-07 15:42:47 +01:00
|
|
|
/* Functional checks */
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorProfileElement( handle, tag, 0, &size, buffer, &ref );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( ret && size > 0, "GetColorProfileElement() failed (%ld)\n", GetLastError() );
|
2004-11-30 22:06:14 +01:00
|
|
|
|
|
|
|
ok( !memcmp( buffer, expect, sizeof(expect) ), "Unexpected tag data\n" );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
pCloseColorProfile( handle );
|
2004-11-30 22:06:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-20 16:18:03 +02:00
|
|
|
static void test_GetColorProfileElementTag(void)
|
2004-11-21 16:48:18 +01:00
|
|
|
{
|
|
|
|
if (standardprofile)
|
|
|
|
{
|
|
|
|
PROFILE profile;
|
|
|
|
HPROFILE handle;
|
|
|
|
BOOL ret;
|
|
|
|
DWORD index = 1;
|
|
|
|
TAGTYPE tag, expect = 0x63707274; /* 'cprt' */
|
|
|
|
|
|
|
|
profile.dwType = PROFILE_FILENAME;
|
|
|
|
profile.pProfileData = standardprofile;
|
|
|
|
profile.cbDataSize = strlen(standardprofile);
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING );
|
2004-11-21 16:48:18 +01:00
|
|
|
ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2004-12-07 15:42:47 +01:00
|
|
|
/* Parameter checks */
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorProfileElementTag( NULL, index, &tag );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret, "GetColorProfileElementTag() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorProfileElementTag( handle, 0, &tag );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret, "GetColorProfileElementTag() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorProfileElementTag( handle, index, NULL );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret, "GetColorProfileElementTag() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorProfileElementTag( handle, 18, NULL );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret, "GetColorProfileElementTag() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
|
|
|
/* Functional checks */
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorProfileElementTag( handle, index, &tag );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( ret && tag == expect, "GetColorProfileElementTag() failed (%ld)\n",
|
|
|
|
GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
pCloseColorProfile( handle );
|
2004-12-07 15:42:47 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-20 16:18:03 +02:00
|
|
|
static void test_GetColorProfileFromHandle(void)
|
2004-12-07 15:42:47 +01:00
|
|
|
{
|
|
|
|
if (testprofile)
|
|
|
|
{
|
|
|
|
PROFILE profile;
|
|
|
|
HPROFILE handle;
|
|
|
|
DWORD size;
|
|
|
|
BOOL ret;
|
2004-12-13 14:23:17 +01:00
|
|
|
static const unsigned char expect[] =
|
2004-12-07 15:42:47 +01:00
|
|
|
{ 0x00, 0x00, 0x0c, 0x48, 0x4c, 0x69, 0x6e, 0x6f, 0x02, 0x10, 0x00,
|
|
|
|
0x00, 0x6d, 0x6e, 0x74, 0x72, 0x52, 0x47, 0x42, 0x20, 0x58, 0x59,
|
|
|
|
0x5a, 0x20, 0x07, 0xce, 0x00, 0x02, 0x00, 0x09, 0x00, 0x06, 0x00,
|
|
|
|
0x31, 0x00, 0x00, 0x61, 0x63, 0x73, 0x70, 0x4d, 0x53, 0x46, 0x54,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x43, 0x20, 0x73, 0x52, 0x47,
|
|
|
|
0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0xf6, 0xd6, 0x00, 0x01, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0xd3, 0x2d, 0x48, 0x50, 0x20, 0x20 };
|
|
|
|
|
|
|
|
unsigned char *buffer;
|
|
|
|
|
|
|
|
profile.dwType = PROFILE_FILENAME;
|
|
|
|
profile.pProfileData = testprofile;
|
|
|
|
profile.cbDataSize = strlen(testprofile);
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2004-12-13 14:23:17 +01:00
|
|
|
/* Parameter checks */
|
|
|
|
|
|
|
|
size = 0;
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorProfileFromHandle( handle, NULL, &size );
|
2004-12-13 14:23:17 +01:00
|
|
|
ok( !ret && size > 0, "GetColorProfileFromHandle() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2004-12-07 15:42:47 +01:00
|
|
|
buffer = HeapAlloc( GetProcessHeap(), 0, size );
|
|
|
|
|
|
|
|
if (buffer)
|
|
|
|
{
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorProfileFromHandle( NULL, buffer, &size );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret, "GetColorProfileFromHandle() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorProfileFromHandle( handle, buffer, NULL );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret, "GetColorProfileFromHandle() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
|
|
|
/* Functional checks */
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorProfileFromHandle( handle, buffer, &size );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( ret && size > 0, "GetColorProfileFromHandle() failed (%ld)\n", GetLastError() );
|
|
|
|
|
|
|
|
ok( !memcmp( buffer, expect, sizeof(expect) ), "Unexpected header data\n" );
|
|
|
|
|
|
|
|
HeapFree( GetProcessHeap(), 0, buffer );
|
|
|
|
}
|
2004-11-30 22:06:14 +01:00
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
pCloseColorProfile( handle );
|
2004-11-30 22:06:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-20 16:18:03 +02:00
|
|
|
static void test_GetColorProfileHeader(void)
|
2004-11-30 22:06:14 +01:00
|
|
|
{
|
|
|
|
if (testprofile)
|
|
|
|
{
|
|
|
|
PROFILE profile;
|
|
|
|
HPROFILE handle;
|
|
|
|
BOOL ret;
|
2004-12-07 15:42:47 +01:00
|
|
|
PROFILEHEADER header;
|
2004-11-30 22:06:14 +01:00
|
|
|
|
|
|
|
profile.dwType = PROFILE_FILENAME;
|
|
|
|
profile.pProfileData = testprofile;
|
|
|
|
profile.cbDataSize = strlen(testprofile);
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING );
|
2004-11-30 22:06:14 +01:00
|
|
|
ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2004-12-07 15:42:47 +01:00
|
|
|
/* Parameter checks */
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorProfileHeader( NULL, NULL );
|
2004-12-13 14:23:17 +01:00
|
|
|
ok( !ret, "GetColorProfileHeader() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorProfileHeader( NULL, &header );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret, "GetColorProfileHeader() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorProfileHeader( handle, NULL );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret, "GetColorProfileHeader() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
|
|
|
/* Functional checks */
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorProfileHeader( handle, &header );
|
2004-11-30 22:06:14 +01:00
|
|
|
ok( ret, "GetColorProfileHeader() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !memcmp( &header, rgbheader, sizeof(rgbheader) ), "Unexpected header data\n" );
|
2004-11-21 16:48:18 +01:00
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
pCloseColorProfile( handle );
|
2004-11-21 16:48:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-20 16:18:03 +02:00
|
|
|
static void test_GetCountColorProfileElements(void)
|
2004-11-21 16:48:18 +01:00
|
|
|
{
|
|
|
|
if (standardprofile)
|
|
|
|
{
|
|
|
|
PROFILE profile;
|
|
|
|
HPROFILE handle;
|
|
|
|
BOOL ret;
|
|
|
|
DWORD count, expect = 17;
|
|
|
|
|
|
|
|
profile.dwType = PROFILE_FILENAME;
|
|
|
|
profile.pProfileData = standardprofile;
|
|
|
|
profile.cbDataSize = strlen(standardprofile);
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING );
|
2004-11-21 16:48:18 +01:00
|
|
|
ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2004-12-07 15:42:47 +01:00
|
|
|
/* Parameter checks */
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetCountColorProfileElements( NULL, &count );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret, "GetCountColorProfileElements() succeeded (%ld)\n",
|
|
|
|
GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetCountColorProfileElements( handle, NULL );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret, "GetCountColorProfileElements() succeeded (%ld)\n",
|
|
|
|
GetLastError() );
|
|
|
|
|
|
|
|
/* Functional checks */
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetCountColorProfileElements( handle, &count );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( ret && count == expect,
|
|
|
|
"GetCountColorProfileElements() failed (%ld)\n", GetLastError() );
|
2004-11-21 16:48:18 +01:00
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
pCloseColorProfile( handle );
|
2004-11-21 16:48:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-10 19:59:02 +01:00
|
|
|
typedef struct colorspace_description_struct {
|
|
|
|
DWORD dwID;
|
|
|
|
char *szName;
|
2006-01-16 20:42:24 +01:00
|
|
|
BOOL registered;
|
|
|
|
char filename[MAX_PATH];
|
2006-01-10 19:59:02 +01:00
|
|
|
} colorspace_descr;
|
|
|
|
|
2006-01-16 20:42:24 +01:00
|
|
|
#define describe_colorspace(id) {id, #id, FALSE, ""}
|
2006-01-10 19:59:02 +01:00
|
|
|
|
|
|
|
colorspace_descr known_colorspaces[] = {
|
|
|
|
describe_colorspace(SPACE_XYZ),
|
|
|
|
describe_colorspace(SPACE_Lab),
|
|
|
|
describe_colorspace(SPACE_Luv),
|
|
|
|
describe_colorspace(SPACE_YCbCr),
|
|
|
|
describe_colorspace(SPACE_Yxy),
|
|
|
|
describe_colorspace(SPACE_RGB),
|
|
|
|
describe_colorspace(SPACE_GRAY),
|
|
|
|
describe_colorspace(SPACE_HSV),
|
|
|
|
describe_colorspace(SPACE_HLS),
|
|
|
|
describe_colorspace(SPACE_CMYK),
|
|
|
|
describe_colorspace(SPACE_CMY),
|
|
|
|
describe_colorspace(SPACE_2_CHANNEL),
|
|
|
|
describe_colorspace(SPACE_3_CHANNEL),
|
|
|
|
describe_colorspace(SPACE_4_CHANNEL),
|
|
|
|
describe_colorspace(SPACE_5_CHANNEL),
|
|
|
|
describe_colorspace(SPACE_6_CHANNEL),
|
|
|
|
describe_colorspace(SPACE_7_CHANNEL),
|
|
|
|
describe_colorspace(SPACE_8_CHANNEL)
|
|
|
|
};
|
|
|
|
|
|
|
|
static void enum_registered_color_profiles(void)
|
|
|
|
{
|
|
|
|
BOOL ret;
|
|
|
|
DWORD size, count, i, present;
|
|
|
|
CHAR profile[MAX_PATH];
|
|
|
|
|
|
|
|
size = sizeof(profile);
|
|
|
|
count = sizeof(known_colorspaces)/sizeof(known_colorspaces[0]);
|
|
|
|
|
|
|
|
present = 0;
|
|
|
|
trace("\n");
|
2006-01-16 20:42:24 +01:00
|
|
|
trace("Querying registered standard colorspace profiles via GetStandardColorSpaceProfileA():\n");
|
2006-01-10 19:59:02 +01:00
|
|
|
for (i=0; i<count; i++)
|
|
|
|
{
|
|
|
|
ret = pGetStandardColorSpaceProfileA(NULL, known_colorspaces[i].dwID, profile, &size);
|
|
|
|
if (ret)
|
|
|
|
{
|
2006-01-16 20:42:24 +01:00
|
|
|
lstrcpynA(known_colorspaces[i].filename, profile, MAX_PATH);
|
|
|
|
known_colorspaces[i].registered = TRUE;
|
2006-01-10 19:59:02 +01:00
|
|
|
present++;
|
2006-01-13 13:52:21 +01:00
|
|
|
trace(" found %s, pointing to '%s' (%d chars)\n", known_colorspaces[i].szName, profile, strlen(profile));
|
2006-01-10 19:59:02 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
trace("Total profiles found: %ld.\n", present);
|
|
|
|
trace("\n");
|
|
|
|
}
|
|
|
|
|
2006-02-16 19:32:58 +01:00
|
|
|
static colorspace_descr *query_colorspace(DWORD dwID)
|
|
|
|
{
|
|
|
|
DWORD count, i;
|
|
|
|
|
|
|
|
count = sizeof(known_colorspaces)/sizeof(known_colorspaces[0]);
|
|
|
|
|
|
|
|
for (i=0; i<count; i++)
|
|
|
|
if (known_colorspaces[i].dwID == dwID)
|
|
|
|
{
|
|
|
|
if (!known_colorspaces[i].registered) break;
|
|
|
|
return &known_colorspaces[i];
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-01-19 12:44:02 +01:00
|
|
|
static HKEY reg_open_mscms_key(void)
|
|
|
|
{
|
|
|
|
char win9x[] = "SOFTWARE\\Microsoft\\Windows";
|
|
|
|
char winNT[] = "SOFTWARE\\Microsoft\\Windows NT";
|
|
|
|
char ICM[] = "CurrentVersion\\ICM\\RegisteredProfiles";
|
|
|
|
HKEY win9x_key, winNT_key, ICM_key;
|
|
|
|
|
|
|
|
RegOpenKeyExA( HKEY_LOCAL_MACHINE, win9x, 0, KEY_READ, &win9x_key );
|
|
|
|
RegOpenKeyExA( HKEY_LOCAL_MACHINE, winNT, 0, KEY_READ, &winNT_key );
|
|
|
|
|
|
|
|
if (RegOpenKeyExA( winNT_key, ICM, 0, KEY_READ, &ICM_key ))
|
|
|
|
RegOpenKeyExA( win9x_key, ICM, 0, KEY_READ, &ICM_key );
|
|
|
|
RegCloseKey( win9x_key );
|
|
|
|
RegCloseKey( winNT_key );
|
|
|
|
|
|
|
|
return ICM_key;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void check_registry(void)
|
|
|
|
{
|
|
|
|
HKEY hkIcmKey;
|
|
|
|
LONG res;
|
|
|
|
DWORD i, dwValCount;
|
|
|
|
char szName[16383];
|
|
|
|
char szData[MAX_PATH+1];
|
|
|
|
DWORD dwNameLen, dwDataLen, dwType;
|
|
|
|
|
|
|
|
hkIcmKey = reg_open_mscms_key();
|
|
|
|
if (!hkIcmKey)
|
|
|
|
{
|
|
|
|
trace("Key 'HKLM\\SOFTWARE\\Microsoft\\Windows*\\CurrentVersion\\ICM\\RegisteredProfiles' not found\n" );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
res = RegQueryInfoKeyA(hkIcmKey, NULL, NULL, NULL, NULL, NULL, NULL, &dwValCount, NULL, NULL, NULL, NULL);
|
2006-02-20 11:12:53 +01:00
|
|
|
if (!res)
|
|
|
|
{
|
|
|
|
trace("RegQueryInfoKeyA() failed\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-01-19 12:44:02 +01:00
|
|
|
trace("Count of profile entries found directly in the registry: %ld\n", dwValCount);
|
|
|
|
|
|
|
|
for (i = 0; i<dwValCount; i++)
|
|
|
|
{
|
|
|
|
dwNameLen = sizeof(szName);
|
|
|
|
dwDataLen = sizeof(szData);
|
|
|
|
res = RegEnumValueA( hkIcmKey, i, szName, &dwNameLen, NULL, &dwType, (LPBYTE)szData, &dwDataLen );
|
2006-02-20 11:12:53 +01:00
|
|
|
if (res != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
trace("RegEnumValueA() failed (%ld), cannot enumerate profiles\n", res);
|
|
|
|
break;
|
|
|
|
}
|
2006-01-19 12:44:02 +01:00
|
|
|
ok( dwType == REG_SZ, "RegEnumValueA() returned unexpected value type (%ld)\n", dwType );
|
|
|
|
if (dwType != REG_SZ) break;
|
|
|
|
trace(" found '%s' value containing '%s' (%d chars)\n", szName, szData, strlen(szData));
|
|
|
|
}
|
|
|
|
|
|
|
|
RegCloseKey( hkIcmKey );
|
|
|
|
}
|
|
|
|
|
2006-02-14 17:12:32 +01:00
|
|
|
#define fail_GSCSP(AW, pMachName, dwProfID, pProfName, pdwSz, dwSz, bCanSucceed, GLE_MATCHES)\
|
|
|
|
do { \
|
|
|
|
size = dwSz; \
|
|
|
|
SetLastError(0xfaceabad); \
|
|
|
|
ret = pGetStandardColorSpaceProfile##AW(pMachName, dwProfID, pProfName, pdwSz); \
|
|
|
|
GLE = GetLastError(); \
|
|
|
|
ok( (!ret && GLE_MATCHES) || \
|
|
|
|
(bCanSucceed && ret && !lstrcmpi##AW( pProfName, empty##AW ) && GLE == 0xfaceabad), \
|
|
|
|
"GetStandardColorSpaceProfile%s() returns %d (GLE=%ld)\n", #AW, ret, GLE ); \
|
2006-01-12 11:53:12 +01:00
|
|
|
} while (0)
|
|
|
|
|
2005-06-20 16:18:03 +02:00
|
|
|
static void test_GetStandardColorSpaceProfileA(void)
|
2004-12-07 15:42:47 +01:00
|
|
|
{
|
|
|
|
BOOL ret;
|
2005-12-13 18:12:34 +01:00
|
|
|
DWORD size, sizeP, GLE;
|
2004-12-13 14:23:17 +01:00
|
|
|
CHAR oldprofile[MAX_PATH];
|
|
|
|
CHAR newprofile[MAX_PATH];
|
2006-02-14 17:12:32 +01:00
|
|
|
CHAR emptyA[] = "";
|
2004-12-07 15:42:47 +01:00
|
|
|
|
2005-12-13 18:12:34 +01:00
|
|
|
sizeP = sizeof(newprofile);
|
2004-12-07 15:42:47 +01:00
|
|
|
|
2005-12-13 18:12:34 +01:00
|
|
|
/* Parameter checks */
|
2004-12-07 15:42:47 +01:00
|
|
|
|
2006-02-14 17:12:32 +01:00
|
|
|
#define A
|
2005-12-21 20:07:42 +01:00
|
|
|
/* Single invalid parameter checks */
|
2006-02-14 17:12:32 +01:00
|
|
|
fail_GSCSP(A, machine, SPACE_RGB, newprofile, &size, sizeP, FALSE, (GLE == ERROR_NOT_SUPPORTED));
|
2005-12-21 20:07:42 +01:00
|
|
|
todo_wine
|
2006-02-14 17:12:32 +01:00
|
|
|
fail_GSCSP(A, NULL, (DWORD)-1, newprofile, &size, sizeP, FALSE, (GLE == ERROR_FILE_NOT_FOUND));
|
|
|
|
fail_GSCSP(A, NULL, SPACE_RGB, newprofile, NULL, sizeP, FALSE, (GLE == ERROR_INVALID_PARAMETER));
|
2006-02-16 19:32:58 +01:00
|
|
|
|
|
|
|
if (query_colorspace(SPACE_RGB))
|
|
|
|
{
|
|
|
|
fail_GSCSP(A, NULL, SPACE_RGB, NULL, &size, sizeP, FALSE, (GLE == ERROR_INSUFFICIENT_BUFFER));
|
|
|
|
todo_wine
|
|
|
|
fail_GSCSP(A, NULL, SPACE_RGB, newprofile, &size, 0, FALSE, (GLE == ERROR_MORE_DATA || GLE == ERROR_INSUFFICIENT_BUFFER));
|
|
|
|
} else {
|
|
|
|
todo_wine
|
|
|
|
fail_GSCSP(A, NULL, SPACE_RGB, NULL, &size, sizeP, FALSE, (GLE == ERROR_FILE_NOT_FOUND));
|
|
|
|
todo_wine
|
|
|
|
fail_GSCSP(A, NULL, SPACE_RGB, newprofile, &size, 0, FALSE, (GLE == ERROR_FILE_NOT_FOUND));
|
|
|
|
}
|
2005-12-21 20:07:42 +01:00
|
|
|
|
|
|
|
/* Several invalid parameter checks */
|
2006-02-14 17:12:32 +01:00
|
|
|
fail_GSCSP(A, machine, 0, newprofile, &size, 0, FALSE, (GLE == ERROR_INVALID_PARAMETER || GLE == ERROR_NOT_SUPPORTED));
|
|
|
|
fail_GSCSP(A, NULL, 0, newprofile, NULL, 0, FALSE, (GLE == ERROR_INVALID_PARAMETER));
|
|
|
|
fail_GSCSP(A, NULL, 0, NULL, &size, 0, FALSE, (GLE == ERROR_INSUFFICIENT_BUFFER || GLE == ERROR_FILE_NOT_FOUND));
|
2005-12-13 18:12:34 +01:00
|
|
|
todo_wine
|
2006-02-14 17:12:32 +01:00
|
|
|
fail_GSCSP(A, NULL, 0, newprofile, &size, sizeP, TRUE, (GLE == ERROR_FILE_NOT_FOUND));
|
|
|
|
#undef A
|
2004-12-07 15:42:47 +01:00
|
|
|
|
|
|
|
/* Functional checks */
|
|
|
|
|
|
|
|
if (standardprofile)
|
|
|
|
{
|
2004-12-13 14:23:17 +01:00
|
|
|
size = sizeof(oldprofile);
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetStandardColorSpaceProfileA( NULL, SPACE_RGB, oldprofile, &size );
|
2004-12-13 14:23:17 +01:00
|
|
|
ok( ret, "GetStandardColorSpaceProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pSetStandardColorSpaceProfileA( NULL, SPACE_RGB, standardprofile );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( ret, "SetStandardColorSpaceProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2004-12-13 14:23:17 +01:00
|
|
|
size = sizeof(newprofile);
|
2004-12-07 15:42:47 +01:00
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetStandardColorSpaceProfileA( NULL, SPACE_RGB, newprofile, &size );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( ret, "GetStandardColorSpaceProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2004-12-13 14:23:17 +01:00
|
|
|
ok( !lstrcmpiA( (LPSTR)&newprofile, standardprofile ), "Unexpected profile\n" );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pSetStandardColorSpaceProfileA( NULL, SPACE_RGB, oldprofile );
|
2004-12-13 14:23:17 +01:00
|
|
|
ok( ret, "SetStandardColorSpaceProfileA() failed (%ld)\n", GetLastError() );
|
2004-12-07 15:42:47 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-20 16:18:03 +02:00
|
|
|
static void test_GetStandardColorSpaceProfileW(void)
|
2004-12-07 15:42:47 +01:00
|
|
|
{
|
|
|
|
BOOL ret;
|
2005-12-13 18:12:34 +01:00
|
|
|
DWORD size, sizeP, GLE;
|
2004-12-13 14:23:17 +01:00
|
|
|
WCHAR oldprofile[MAX_PATH];
|
|
|
|
WCHAR newprofile[MAX_PATH];
|
2006-01-12 11:53:12 +01:00
|
|
|
WCHAR emptyW[] = {0};
|
2004-12-07 15:42:47 +01:00
|
|
|
|
2005-12-13 18:12:34 +01:00
|
|
|
sizeP = sizeof(newprofile);
|
2004-12-07 15:42:47 +01:00
|
|
|
|
2005-12-13 18:12:34 +01:00
|
|
|
/* Parameter checks */
|
2004-12-07 15:42:47 +01:00
|
|
|
|
2006-02-14 17:12:32 +01:00
|
|
|
#define W
|
2005-12-21 20:07:42 +01:00
|
|
|
/* Single invalid parameter checks */
|
2006-02-14 17:12:32 +01:00
|
|
|
fail_GSCSP(W, machineW, SPACE_RGB, newprofile, &size, sizeP, FALSE, (GLE == ERROR_NOT_SUPPORTED));
|
2005-12-21 20:07:42 +01:00
|
|
|
todo_wine
|
2006-02-14 17:12:32 +01:00
|
|
|
fail_GSCSP(W, NULL, (DWORD)-1, newprofile, &size, sizeP, FALSE, (GLE == ERROR_FILE_NOT_FOUND));
|
|
|
|
fail_GSCSP(W, NULL, SPACE_RGB, NULL, &size, sizeP, FALSE, (GLE == ERROR_INSUFFICIENT_BUFFER));
|
|
|
|
fail_GSCSP(W, NULL, SPACE_RGB, newprofile, NULL, sizeP, FALSE, (GLE == ERROR_INVALID_PARAMETER));
|
2005-12-21 20:07:42 +01:00
|
|
|
todo_wine
|
2006-02-14 17:12:32 +01:00
|
|
|
fail_GSCSP(W, NULL, SPACE_RGB, newprofile, &size, 0, FALSE, (GLE == ERROR_MORE_DATA || GLE == ERROR_INSUFFICIENT_BUFFER));
|
2005-12-21 20:07:42 +01:00
|
|
|
|
|
|
|
/* Several invalid parameter checks */
|
2006-02-14 17:12:32 +01:00
|
|
|
fail_GSCSP(W, machineW, 0, newprofile, &size, 0, FALSE, (GLE == ERROR_INVALID_PARAMETER || GLE == ERROR_NOT_SUPPORTED));
|
|
|
|
fail_GSCSP(W, NULL, 0, newprofile, NULL, 0, FALSE, (GLE == ERROR_INVALID_PARAMETER));
|
|
|
|
fail_GSCSP(W, NULL, 0, NULL, &size, 0, FALSE, (GLE == ERROR_INSUFFICIENT_BUFFER || GLE == ERROR_FILE_NOT_FOUND));
|
2005-12-13 18:12:34 +01:00
|
|
|
todo_wine
|
2006-02-14 17:12:32 +01:00
|
|
|
fail_GSCSP(W, NULL, 0, newprofile, &size, sizeP, TRUE, (GLE == ERROR_FILE_NOT_FOUND));
|
|
|
|
#undef W
|
2004-12-07 15:42:47 +01:00
|
|
|
|
|
|
|
/* Functional checks */
|
|
|
|
|
|
|
|
if (standardprofileW)
|
|
|
|
{
|
2004-12-13 14:23:17 +01:00
|
|
|
size = sizeof(oldprofile);
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetStandardColorSpaceProfileW( NULL, SPACE_RGB, oldprofile, &size );
|
2004-12-13 14:23:17 +01:00
|
|
|
ok( ret, "GetStandardColorSpaceProfileW() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pSetStandardColorSpaceProfileW( NULL, SPACE_RGB, standardprofileW );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( ret, "SetStandardColorSpaceProfileW() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2004-12-13 14:23:17 +01:00
|
|
|
size = sizeof(newprofile);
|
2004-12-07 15:42:47 +01:00
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetStandardColorSpaceProfileW( NULL, SPACE_RGB, newprofile, &size );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( ret, "GetStandardColorSpaceProfileW() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2004-12-13 14:23:17 +01:00
|
|
|
ok( !lstrcmpiW( (LPWSTR)&newprofile, standardprofileW ), "Unexpected profile\n" );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pSetStandardColorSpaceProfileW( NULL, SPACE_RGB, oldprofile );
|
2004-12-13 14:23:17 +01:00
|
|
|
ok( ret, "SetStandardColorSpaceProfileW() failed (%ld)\n", GetLastError() );
|
2004-12-07 15:42:47 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-20 16:18:03 +02:00
|
|
|
static void test_InstallColorProfileA(void)
|
2004-10-07 21:12:41 +02:00
|
|
|
{
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
/* Parameter checks */
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pInstallColorProfileA( NULL, NULL );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( !ret, "InstallColorProfileA() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pInstallColorProfileA( machine, NULL );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( !ret, "InstallColorProfileA() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pInstallColorProfileA( NULL, machine );
|
2004-11-03 23:14:25 +01:00
|
|
|
ok( !ret, "InstallColorProfileA() succeeded (%ld)\n", GetLastError() );
|
2004-10-07 21:12:41 +02:00
|
|
|
|
|
|
|
if (standardprofile)
|
|
|
|
{
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pInstallColorProfileA( NULL, standardprofile );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( ret, "InstallColorProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Functional checks */
|
|
|
|
|
|
|
|
if (testprofile)
|
|
|
|
{
|
2004-11-03 23:14:25 +01:00
|
|
|
CHAR dest[MAX_PATH], base[MAX_PATH];
|
|
|
|
DWORD size = sizeof(dest);
|
|
|
|
CHAR slash[] = "\\";
|
|
|
|
HANDLE handle;
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pInstallColorProfileA( NULL, testprofile );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( ret, "InstallColorProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorDirectoryA( NULL, dest, &size );
|
2004-11-03 23:14:25 +01:00
|
|
|
ok( ret, "GetColorDirectoryA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
|
|
|
MSCMS_basenameA( testprofile, base );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
lstrcatA( dest, slash );
|
|
|
|
lstrcatA( dest, base );
|
2004-11-03 23:14:25 +01:00
|
|
|
|
|
|
|
/* Check if the profile is really there */
|
|
|
|
handle = CreateFileA( dest, 0 , 0, NULL, OPEN_EXISTING, 0, NULL );
|
|
|
|
ok( handle != INVALID_HANDLE_VALUE, "Couldn't find the profile (%ld)\n", GetLastError() );
|
|
|
|
CloseHandle( handle );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pUninstallColorProfileA( NULL, dest, TRUE );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( ret, "UninstallColorProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-20 16:18:03 +02:00
|
|
|
static void test_InstallColorProfileW(void)
|
2004-10-07 21:12:41 +02:00
|
|
|
{
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
/* Parameter checks */
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pInstallColorProfileW( NULL, NULL );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( !ret, "InstallColorProfileW() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pInstallColorProfileW( machineW, NULL );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( !ret, "InstallColorProfileW() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pInstallColorProfileW( NULL, machineW );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( !ret, "InstallColorProfileW() failed (%ld)\n", GetLastError() );
|
|
|
|
|
|
|
|
if (standardprofileW)
|
|
|
|
{
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pInstallColorProfileW( NULL, standardprofileW );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( ret, "InstallColorProfileW() failed (%ld)\n", GetLastError() );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Functional checks */
|
|
|
|
|
|
|
|
if (testprofileW)
|
|
|
|
{
|
2004-11-03 23:14:25 +01:00
|
|
|
WCHAR dest[MAX_PATH], base[MAX_PATH];
|
|
|
|
DWORD size = sizeof(dest);
|
|
|
|
WCHAR slash[] = { '\\', 0 };
|
|
|
|
HANDLE handle;
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pInstallColorProfileW( NULL, testprofileW );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( ret, "InstallColorProfileW() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorDirectoryW( NULL, dest, &size );
|
2004-11-03 23:14:25 +01:00
|
|
|
ok( ret, "GetColorDirectoryW() failed (%ld)\n", GetLastError() );
|
|
|
|
|
|
|
|
MSCMS_basenameW( testprofileW, base );
|
|
|
|
|
|
|
|
lstrcatW( dest, slash );
|
|
|
|
lstrcatW( dest, base );
|
|
|
|
|
|
|
|
/* Check if the profile is really there */
|
|
|
|
handle = CreateFileW( dest, 0 , 0, NULL, OPEN_EXISTING, 0, NULL );
|
|
|
|
ok( handle != INVALID_HANDLE_VALUE, "Couldn't find the profile (%ld)\n", GetLastError() );
|
|
|
|
CloseHandle( handle );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pUninstallColorProfileW( NULL, dest, TRUE );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( ret, "UninstallColorProfileW() failed (%ld)\n", GetLastError() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-20 16:18:03 +02:00
|
|
|
static void test_IsColorProfileTagPresent(void)
|
2004-11-21 16:48:18 +01:00
|
|
|
{
|
|
|
|
if (standardprofile)
|
|
|
|
{
|
|
|
|
PROFILE profile;
|
|
|
|
HPROFILE handle;
|
|
|
|
BOOL ret, present;
|
|
|
|
TAGTYPE tag;
|
|
|
|
|
|
|
|
profile.dwType = PROFILE_FILENAME;
|
|
|
|
profile.pProfileData = standardprofile;
|
|
|
|
profile.cbDataSize = strlen(standardprofile);
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING );
|
2004-11-21 16:48:18 +01:00
|
|
|
ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2004-12-07 15:42:47 +01:00
|
|
|
/* Parameter checks */
|
|
|
|
|
2004-11-21 16:48:18 +01:00
|
|
|
tag = 0;
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pIsColorProfileTagPresent( handle, tag, &present );
|
2004-11-21 16:48:18 +01:00
|
|
|
ok( !(ret && present), "IsColorProfileTagPresent() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
|
|
|
tag = 0x63707274; /* 'cprt' */
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pIsColorProfileTagPresent( NULL, tag, &present );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret, "IsColorProfileTagPresent() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pIsColorProfileTagPresent( handle, tag, NULL );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret, "IsColorProfileTagPresent() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
|
|
|
/* Functional checks */
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pIsColorProfileTagPresent( handle, tag, &present );
|
2004-11-21 16:48:18 +01:00
|
|
|
ok( ret && present, "IsColorProfileTagPresent() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
pCloseColorProfile( handle );
|
2004-11-21 16:48:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-20 16:18:03 +02:00
|
|
|
static void test_OpenColorProfileA(void)
|
2004-10-07 21:12:41 +02:00
|
|
|
{
|
|
|
|
PROFILE profile;
|
|
|
|
HPROFILE handle;
|
2004-12-27 18:26:37 +01:00
|
|
|
BOOL ret;
|
2004-10-07 21:12:41 +02:00
|
|
|
|
|
|
|
profile.dwType = PROFILE_FILENAME;
|
|
|
|
profile.pProfileData = NULL;
|
|
|
|
profile.cbDataSize = 0;
|
|
|
|
|
|
|
|
/* Parameter checks */
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileA( NULL, 0, 0, 0 );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( handle == NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileA( &profile, 0, 0, 0 );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( handle == NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileA( &profile, PROFILE_READ, 0, 0 );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( handle == NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileA( &profile, PROFILE_READWRITE, 0, 0 );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( handle == NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ok ( !pCloseColorProfile( NULL ), "CloseColorProfile() succeeded\n" );
|
2004-10-07 21:12:41 +02:00
|
|
|
|
|
|
|
if (standardprofile)
|
|
|
|
{
|
|
|
|
profile.pProfileData = standardprofile;
|
|
|
|
profile.cbDataSize = strlen(standardprofile);
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileA( &profile, 0, 0, 0 );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( handle == NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileA( &profile, PROFILE_READ, 0, 0 );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( handle == NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileA( &profile, PROFILE_READ|PROFILE_READWRITE, 0, 0 );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( handle == NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
|
|
|
/* Functional checks */
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pCloseColorProfile( handle );
|
2004-12-27 18:26:37 +01:00
|
|
|
ok( ret, "CloseColorProfile() failed (%ld)\n", GetLastError() );
|
2004-10-07 21:12:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-20 16:18:03 +02:00
|
|
|
static void test_OpenColorProfileW(void)
|
2004-10-07 21:12:41 +02:00
|
|
|
{
|
|
|
|
PROFILE profile;
|
|
|
|
HPROFILE handle;
|
2004-12-27 18:26:37 +01:00
|
|
|
BOOL ret;
|
2004-10-07 21:12:41 +02:00
|
|
|
|
|
|
|
profile.dwType = PROFILE_FILENAME;
|
|
|
|
profile.pProfileData = NULL;
|
|
|
|
profile.cbDataSize = 0;
|
|
|
|
|
|
|
|
/* Parameter checks */
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileW( NULL, 0, 0, 0 );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( handle == NULL, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileW( &profile, 0, 0, 0 );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( handle == NULL, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileW( &profile, PROFILE_READ, 0, 0 );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( handle == NULL, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileW( &profile, PROFILE_READWRITE, 0, 0 );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( handle == NULL, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ok ( !pCloseColorProfile( NULL ), "CloseColorProfile() succeeded\n" );
|
2004-10-07 21:12:41 +02:00
|
|
|
|
|
|
|
if (standardprofileW)
|
|
|
|
{
|
|
|
|
profile.pProfileData = standardprofileW;
|
|
|
|
profile.cbDataSize = lstrlenW(standardprofileW) * sizeof(WCHAR);
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileW( &profile, 0, 0, 0 );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( handle == NULL, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileW( &profile, PROFILE_READ, 0, 0 );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( handle == NULL, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileW( &profile, PROFILE_READ|PROFILE_READWRITE, 0, 0 );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( handle == NULL, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
|
|
|
|
|
|
|
|
/* Functional checks */
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileW( &profile, PROFILE_READ, 0, OPEN_EXISTING );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( handle != NULL, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pCloseColorProfile( handle );
|
2004-12-27 18:26:37 +01:00
|
|
|
ok( ret, "CloseColorProfile() failed (%ld)\n", GetLastError() );
|
2004-10-07 21:12:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-20 16:18:03 +02:00
|
|
|
static void test_SetColorProfileElement(void)
|
2004-12-13 14:23:17 +01:00
|
|
|
{
|
|
|
|
if (testprofile)
|
|
|
|
{
|
|
|
|
PROFILE profile;
|
|
|
|
HPROFILE handle;
|
|
|
|
DWORD size;
|
|
|
|
BOOL ret, ref;
|
|
|
|
|
|
|
|
TAGTYPE tag = 0x63707274; /* 'cprt' */
|
|
|
|
static char data[] = "(c) The Wine Project";
|
|
|
|
static char buffer[51];
|
|
|
|
|
|
|
|
profile.dwType = PROFILE_FILENAME;
|
|
|
|
profile.pProfileData = testprofile;
|
|
|
|
profile.cbDataSize = strlen(testprofile);
|
|
|
|
|
2005-02-14 21:53:59 +01:00
|
|
|
/* Parameter checks */
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING );
|
2004-12-13 14:23:17 +01:00
|
|
|
ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pSetColorProfileElement( handle, tag, 0, &size, data );
|
2004-12-13 14:23:17 +01:00
|
|
|
ok( !ret, "SetColorProfileElement() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
pCloseColorProfile( handle );
|
2004-12-13 14:23:17 +01:00
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileA( &profile, PROFILE_READWRITE, 0, OPEN_EXISTING );
|
2004-12-13 14:23:17 +01:00
|
|
|
ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pSetColorProfileElement( NULL, 0, 0, NULL, NULL );
|
2004-12-13 14:23:17 +01:00
|
|
|
ok( !ret, "SetColorProfileElement() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pSetColorProfileElement( handle, 0, 0, NULL, NULL );
|
2004-12-13 14:23:17 +01:00
|
|
|
ok( !ret, "SetColorProfileElement() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pSetColorProfileElement( handle, tag, 0, NULL, NULL );
|
2004-12-13 14:23:17 +01:00
|
|
|
ok( !ret, "SetColorProfileElement() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pSetColorProfileElement( handle, tag, 0, &size, NULL );
|
2004-12-13 14:23:17 +01:00
|
|
|
ok( !ret, "SetColorProfileElement() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
|
|
|
/* Functional checks */
|
|
|
|
|
2005-07-18 11:08:43 +02:00
|
|
|
size = sizeof(data);
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pSetColorProfileElement( handle, tag, 0, &size, data );
|
2004-12-13 14:23:17 +01:00
|
|
|
ok( ret, "SetColorProfileElement() failed (%ld)\n", GetLastError() );
|
|
|
|
|
|
|
|
size = sizeof(buffer);
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorProfileElement( handle, tag, 0, &size, buffer, &ref );
|
2004-12-13 14:23:17 +01:00
|
|
|
ok( ret && size > 0, "GetColorProfileElement() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ok( !memcmp( data, buffer, sizeof(data) ),
|
|
|
|
"Unexpected tag data, expected %s, got %s (%ld)\n",
|
|
|
|
data, buffer, GetLastError() );
|
2004-12-13 14:23:17 +01:00
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
pCloseColorProfile( handle );
|
2004-12-13 14:23:17 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-20 16:18:03 +02:00
|
|
|
static void test_SetColorProfileHeader(void)
|
2004-12-07 15:42:47 +01:00
|
|
|
{
|
|
|
|
if (testprofile)
|
|
|
|
{
|
|
|
|
PROFILE profile;
|
|
|
|
HPROFILE handle;
|
|
|
|
BOOL ret;
|
|
|
|
PROFILEHEADER header;
|
|
|
|
|
|
|
|
profile.dwType = PROFILE_FILENAME;
|
|
|
|
profile.pProfileData = testprofile;
|
|
|
|
profile.cbDataSize = strlen(testprofile);
|
|
|
|
|
|
|
|
header.phSize = 0x00000c48;
|
|
|
|
header.phCMMType = 0x4c696e6f;
|
|
|
|
header.phVersion = 0x02100000;
|
|
|
|
header.phClass = 0x6d6e7472;
|
|
|
|
header.phDataColorSpace = 0x52474220;
|
|
|
|
header.phConnectionSpace = 0x58595a20;
|
|
|
|
header.phDateTime[0] = 0x07ce0002;
|
|
|
|
header.phDateTime[1] = 0x00090006;
|
|
|
|
header.phDateTime[2] = 0x00310000;
|
|
|
|
header.phSignature = 0x61637370;
|
|
|
|
header.phPlatform = 0x4d534654;
|
|
|
|
header.phProfileFlags = 0x00000000;
|
|
|
|
header.phManufacturer = 0x49454320;
|
|
|
|
header.phModel = 0x73524742;
|
|
|
|
header.phAttributes[0] = 0x00000000;
|
|
|
|
header.phAttributes[1] = 0x00000000;
|
|
|
|
header.phRenderingIntent = 0x00000000;
|
|
|
|
header.phIlluminant.ciexyzX = 0x0000f6d6;
|
|
|
|
header.phIlluminant.ciexyzY = 0x00010000;
|
|
|
|
header.phIlluminant.ciexyzZ = 0x0000d32d;
|
|
|
|
header.phCreator = 0x48502020;
|
|
|
|
|
|
|
|
/* Parameter checks */
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pSetColorProfileHeader( handle, &header );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( !ret, "SetColorProfileHeader() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
pCloseColorProfile( handle );
|
2004-12-07 15:42:47 +01:00
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
handle = pOpenColorProfileA( &profile, PROFILE_READWRITE, 0, OPEN_EXISTING );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pSetColorProfileHeader( NULL, NULL );
|
2004-12-13 14:23:17 +01:00
|
|
|
ok( !ret, "SetColorProfileHeader() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pSetColorProfileHeader( handle, NULL );
|
2004-12-13 14:23:17 +01:00
|
|
|
ok( !ret, "SetColorProfileHeader() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pSetColorProfileHeader( NULL, &header );
|
2004-12-13 14:23:17 +01:00
|
|
|
ok( !ret, "SetColorProfileHeader() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2004-12-07 15:42:47 +01:00
|
|
|
/* Functional checks */
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pSetColorProfileHeader( handle, &header );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( ret, "SetColorProfileHeader() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorProfileHeader( handle, &header );
|
2004-12-07 15:42:47 +01:00
|
|
|
ok( ret, "GetColorProfileHeader() failed (%ld)\n", GetLastError() );
|
|
|
|
|
|
|
|
ok( !memcmp( &header, rgbheader, sizeof(rgbheader) ), "Unexpected header data\n" );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
pCloseColorProfile( handle );
|
2004-12-07 15:42:47 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-20 16:18:03 +02:00
|
|
|
static void test_UninstallColorProfileA(void)
|
2004-10-07 21:12:41 +02:00
|
|
|
{
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
/* Parameter checks */
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pUninstallColorProfileA( NULL, NULL, FALSE );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( !ret, "UninstallColorProfileA() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pUninstallColorProfileA( machine, NULL, FALSE );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( !ret, "UninstallColorProfileA() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
|
|
|
/* Functional checks */
|
|
|
|
|
|
|
|
if (testprofile)
|
|
|
|
{
|
2004-11-03 23:14:25 +01:00
|
|
|
CHAR dest[MAX_PATH], base[MAX_PATH];
|
|
|
|
DWORD size = sizeof(dest);
|
|
|
|
CHAR slash[] = "\\";
|
|
|
|
HANDLE handle;
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pInstallColorProfileA( NULL, testprofile );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( ret, "InstallColorProfileA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorDirectoryA( NULL, dest, &size );
|
2004-11-03 23:14:25 +01:00
|
|
|
ok( ret, "GetColorDirectoryA() failed (%ld)\n", GetLastError() );
|
|
|
|
|
|
|
|
MSCMS_basenameA( testprofile, base );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
lstrcatA( dest, slash );
|
|
|
|
lstrcatA( dest, base );
|
2004-11-03 23:14:25 +01:00
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pUninstallColorProfileA( NULL, dest, TRUE );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( ret, "UninstallColorProfileA() failed (%ld)\n", GetLastError() );
|
2004-11-03 23:14:25 +01:00
|
|
|
|
|
|
|
/* Check if the profile is really gone */
|
|
|
|
handle = CreateFileA( dest, 0 , 0, NULL, OPEN_EXISTING, 0, NULL );
|
|
|
|
ok( handle == INVALID_HANDLE_VALUE, "Found the profile (%ld)\n", GetLastError() );
|
|
|
|
CloseHandle( handle );
|
2004-10-07 21:12:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-20 16:18:03 +02:00
|
|
|
static void test_UninstallColorProfileW(void)
|
2004-10-07 21:12:41 +02:00
|
|
|
{
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
/* Parameter checks */
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pUninstallColorProfileW( NULL, NULL, FALSE );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( !ret, "UninstallColorProfileW() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pUninstallColorProfileW( machineW, NULL, FALSE );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( !ret, "UninstallColorProfileW() succeeded (%ld)\n", GetLastError() );
|
|
|
|
|
|
|
|
/* Functional checks */
|
|
|
|
|
|
|
|
if (testprofileW)
|
|
|
|
{
|
2004-11-03 23:14:25 +01:00
|
|
|
WCHAR dest[MAX_PATH], base[MAX_PATH];
|
2005-11-18 17:51:30 +01:00
|
|
|
char destA[MAX_PATH];
|
2004-11-03 23:14:25 +01:00
|
|
|
DWORD size = sizeof(dest);
|
|
|
|
WCHAR slash[] = { '\\', 0 };
|
|
|
|
HANDLE handle;
|
2005-11-18 17:51:30 +01:00
|
|
|
int bytes_copied;
|
2004-11-03 23:14:25 +01:00
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pInstallColorProfileW( NULL, testprofileW );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( ret, "InstallColorProfileW() failed (%ld)\n", GetLastError() );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pGetColorDirectoryW( NULL, dest, &size );
|
2004-11-03 23:14:25 +01:00
|
|
|
ok( ret, "GetColorDirectoryW() failed (%ld)\n", GetLastError() );
|
|
|
|
|
|
|
|
MSCMS_basenameW( testprofileW, base );
|
|
|
|
|
|
|
|
lstrcatW( dest, slash );
|
|
|
|
lstrcatW( dest, base );
|
|
|
|
|
2005-07-07 19:22:47 +02:00
|
|
|
ret = pUninstallColorProfileW( NULL, dest, TRUE );
|
2004-10-07 21:12:41 +02:00
|
|
|
ok( ret, "UninstallColorProfileW() failed (%ld)\n", GetLastError() );
|
2004-11-03 23:14:25 +01:00
|
|
|
|
2005-11-18 17:51:30 +01:00
|
|
|
bytes_copied = WideCharToMultiByte(CP_ACP, 0, dest, -1, destA, MAX_PATH, NULL, NULL);
|
|
|
|
ok( bytes_copied > 0 , "WideCharToMultiByte() returns %d\n", bytes_copied);
|
2004-11-03 23:14:25 +01:00
|
|
|
/* Check if the profile is really gone */
|
2005-11-18 17:51:30 +01:00
|
|
|
handle = CreateFileA( destA, 0 , 0, NULL, OPEN_EXISTING, 0, NULL );
|
2004-11-03 23:14:25 +01:00
|
|
|
ok( handle == INVALID_HANDLE_VALUE, "Found the profile (%ld)\n", GetLastError() );
|
|
|
|
CloseHandle( handle );
|
2004-10-07 21:12:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
START_TEST(profile)
|
|
|
|
{
|
|
|
|
UINT len;
|
|
|
|
HANDLE handle;
|
|
|
|
char path[MAX_PATH], file[MAX_PATH];
|
2005-07-05 12:56:52 +02:00
|
|
|
char profilefile1[MAX_PATH], profilefile2[MAX_PATH];
|
|
|
|
WCHAR profilefile1W[MAX_PATH], profilefile2W[MAX_PATH];
|
2004-10-07 21:12:41 +02:00
|
|
|
WCHAR fileW[MAX_PATH];
|
2005-11-18 17:51:30 +01:00
|
|
|
UINT ret;
|
2004-10-07 21:12:41 +02:00
|
|
|
|
2005-07-15 12:09:43 +02:00
|
|
|
hmscms = LoadLibraryA( "mscms.dll" );
|
2005-07-07 19:22:47 +02:00
|
|
|
if (!hmscms) return;
|
|
|
|
|
|
|
|
if (!init_function_ptrs())
|
|
|
|
{
|
|
|
|
FreeLibrary( hmscms );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-10-07 21:12:41 +02:00
|
|
|
/* See if we can find the standard color profile */
|
2005-11-18 17:51:30 +01:00
|
|
|
ret = GetSystemDirectoryA( profilefile1, sizeof(profilefile1) );
|
|
|
|
ok( ret > 0, "GetSystemDirectoryA() returns %d, LastError = %ld\n", ret, GetLastError());
|
|
|
|
ok( lstrlenA(profilefile1) > 0 && lstrlenA(profilefile1) < MAX_PATH,
|
|
|
|
"GetSystemDirectoryA() returns %d, LastError = %ld\n", ret, GetLastError());
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, profilefile1, -1, profilefile1W, MAX_PATH);
|
|
|
|
ok( lstrlenW(profilefile1W) > 0 && lstrlenW(profilefile1W) < MAX_PATH,
|
|
|
|
"GetSystemDirectoryA() returns %d, LastError = %ld\n", ret, GetLastError());
|
|
|
|
lstrcpyA(profilefile2, profilefile1);
|
|
|
|
lstrcpyW(profilefile2W, profilefile1W);
|
|
|
|
|
2005-07-05 12:56:52 +02:00
|
|
|
lstrcatA( profilefile1, profile1 );
|
|
|
|
lstrcatW( profilefile1W, profile1W );
|
|
|
|
handle = CreateFileA( profilefile1, 0 , 0, NULL, OPEN_EXISTING, 0, NULL );
|
2004-10-07 21:12:41 +02:00
|
|
|
|
|
|
|
if (handle != INVALID_HANDLE_VALUE)
|
|
|
|
{
|
2005-07-05 12:56:52 +02:00
|
|
|
standardprofile = profilefile1;
|
|
|
|
standardprofileW = profilefile1W;
|
2004-10-07 21:12:41 +02:00
|
|
|
CloseHandle( handle );
|
|
|
|
}
|
|
|
|
|
2005-07-05 12:56:52 +02:00
|
|
|
lstrcatA( profilefile2, profile2 );
|
|
|
|
lstrcatW( profilefile2W, profile2W );
|
|
|
|
handle = CreateFileA( profilefile2, 0 , 0, NULL, OPEN_EXISTING, 0, NULL );
|
2004-10-07 21:12:41 +02:00
|
|
|
|
|
|
|
if (handle != INVALID_HANDLE_VALUE)
|
|
|
|
{
|
2005-07-05 12:56:52 +02:00
|
|
|
standardprofile = profilefile2;
|
|
|
|
standardprofileW = profilefile2W;
|
2004-10-07 21:12:41 +02:00
|
|
|
CloseHandle( handle );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If found, create a temporary copy for testing purposes */
|
|
|
|
if (standardprofile && GetTempPath( sizeof(path), path ))
|
|
|
|
{
|
|
|
|
if (GetTempFileName( path, "rgb", 0, file ))
|
|
|
|
{
|
|
|
|
if (CopyFileA( standardprofile, file, FALSE ))
|
|
|
|
{
|
|
|
|
testprofile = (LPSTR)&file;
|
|
|
|
|
|
|
|
len = MultiByteToWideChar( CP_ACP, 0, testprofile, -1, NULL, 0 );
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, testprofile, -1, fileW, len );
|
|
|
|
|
|
|
|
testprofileW = (LPWSTR)&fileW;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test_GetColorDirectoryA();
|
|
|
|
test_GetColorDirectoryW();
|
|
|
|
|
2004-11-30 22:06:14 +01:00
|
|
|
test_GetColorProfileElement();
|
2004-11-21 16:48:18 +01:00
|
|
|
test_GetColorProfileElementTag();
|
2004-11-30 22:06:14 +01:00
|
|
|
|
2004-12-07 15:42:47 +01:00
|
|
|
test_GetColorProfileFromHandle();
|
2004-11-30 22:06:14 +01:00
|
|
|
test_GetColorProfileHeader();
|
2004-12-07 15:42:47 +01:00
|
|
|
|
2004-11-21 16:48:18 +01:00
|
|
|
test_GetCountColorProfileElements();
|
|
|
|
|
2006-01-10 19:59:02 +01:00
|
|
|
enum_registered_color_profiles();
|
2006-01-19 12:44:02 +01:00
|
|
|
check_registry();
|
2006-01-10 19:59:02 +01:00
|
|
|
|
2004-12-07 15:42:47 +01:00
|
|
|
test_GetStandardColorSpaceProfileA();
|
|
|
|
test_GetStandardColorSpaceProfileW();
|
|
|
|
|
2004-10-07 21:12:41 +02:00
|
|
|
test_InstallColorProfileA();
|
|
|
|
test_InstallColorProfileW();
|
|
|
|
|
2004-11-21 16:48:18 +01:00
|
|
|
test_IsColorProfileTagPresent();
|
|
|
|
|
2004-10-07 21:12:41 +02:00
|
|
|
test_OpenColorProfileA();
|
|
|
|
test_OpenColorProfileW();
|
|
|
|
|
2004-12-13 14:23:17 +01:00
|
|
|
test_SetColorProfileElement();
|
2004-12-07 15:42:47 +01:00
|
|
|
test_SetColorProfileHeader();
|
|
|
|
|
2004-10-07 21:12:41 +02:00
|
|
|
test_UninstallColorProfileA();
|
|
|
|
test_UninstallColorProfileW();
|
|
|
|
|
|
|
|
/* Clean up */
|
|
|
|
if (testprofile)
|
|
|
|
DeleteFileA( testprofile );
|
2005-07-07 19:22:47 +02:00
|
|
|
|
|
|
|
FreeLibrary( hmscms );
|
2004-10-07 21:12:41 +02:00
|
|
|
}
|