Commit eea31097 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

Fix color directory handling.

parent e1d2852d
...@@ -44,11 +44,6 @@ static void MSCMS_basename( LPCWSTR path, LPWSTR name ) ...@@ -44,11 +44,6 @@ static void MSCMS_basename( LPCWSTR path, LPWSTR name )
lstrcpyW( name, &path[i] ); lstrcpyW( name, &path[i] );
} }
/* FIXME: Get this directory from the registry? */
static const WCHAR colorsubdir[] = { '\\','s','y','s','t','e','m','3','2',
'\\','s','p','o','o','l','\\','d','r','i','v','e','r','s',
'\\','c','o','l','o','r',0 };
WINE_DEFAULT_DEBUG_CHANNEL(mscms); WINE_DEFAULT_DEBUG_CHANNEL(mscms);
/****************************************************************************** /******************************************************************************
...@@ -109,13 +104,14 @@ BOOL WINAPI GetColorDirectoryA( PCSTR machine, PSTR buffer, PDWORD size ) ...@@ -109,13 +104,14 @@ BOOL WINAPI GetColorDirectoryA( PCSTR machine, PSTR buffer, PDWORD size )
BOOL WINAPI GetColorDirectoryW( PCWSTR machine, PWSTR buffer, PDWORD size ) BOOL WINAPI GetColorDirectoryW( PCWSTR machine, PWSTR buffer, PDWORD size )
{ {
WCHAR colordir[MAX_PATH]; WCHAR colordir[MAX_PATH];
static const WCHAR colorsubdir[] = { '\\','c','o','l','o','r',0 };
DWORD len; DWORD len;
TRACE( "( %p, %p )\n", buffer, size ); TRACE( "( %p, %p )\n", buffer, size );
if (machine || !size) return FALSE; if (machine || !size) return FALSE;
GetWindowsDirectoryW( colordir, sizeof(colordir) / sizeof(WCHAR) ); GetSystemDirectoryW( colordir, sizeof(colordir) / sizeof(WCHAR) );
lstrcatW( colordir, colorsubdir ); lstrcatW( colordir, colorsubdir );
len = lstrlenW( colordir ) * sizeof(WCHAR); len = lstrlenW( colordir ) * sizeof(WCHAR);
...@@ -399,23 +395,22 @@ BOOL WINAPI GetStandardColorSpaceProfileA( PCSTR machine, DWORD id, PSTR profile ...@@ -399,23 +395,22 @@ BOOL WINAPI GetStandardColorSpaceProfileA( PCSTR machine, DWORD id, PSTR profile
*/ */
BOOL WINAPI GetStandardColorSpaceProfileW( PCWSTR machine, DWORD id, PWSTR profile, PDWORD size ) BOOL WINAPI GetStandardColorSpaceProfileW( PCWSTR machine, DWORD id, PWSTR profile, PDWORD size )
{ {
static const WCHAR rgbprofilefile[] = { '\\','s','r','g','b',' ','c','o','l','o','r',' ', static const WCHAR rgbprofilefile[] =
's','p','a','c','e',' ','p','r','o','f','i','l','e','.','i','c','m',0 }; { '\\','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 };
WCHAR rgbprofile[MAX_PATH]; WCHAR rgbprofile[MAX_PATH];
DWORD len; DWORD len = sizeof(rgbprofile);
TRACE( "( 0x%08lx, %p, %p )\n", id, profile, size ); TRACE( "( 0x%08lx, %p, %p )\n", id, profile, size );
if (machine || !size) return FALSE; if (machine || !size) return FALSE;
GetColorDirectoryW( machine, rgbprofile, &len );
switch (id) switch (id)
{ {
case 0x52474220: /* 'RGB ' */ case 0x52474220: /* 'RGB ' */
GetWindowsDirectoryW( rgbprofile, sizeof( rgbprofile ) / sizeof( WCHAR ) );
lstrcatW( rgbprofile, colorsubdir );
lstrcatW( rgbprofile, rgbprofilefile ); lstrcatW( rgbprofile, rgbprofilefile );
len = lstrlenW( rgbprofile ) * sizeof(WCHAR);
len = lstrlenW( rgbprofile ) * sizeof( WCHAR );
if (*size < len || !profile) if (*size < len || !profile)
{ {
...@@ -429,7 +424,6 @@ BOOL WINAPI GetStandardColorSpaceProfileW( PCWSTR machine, DWORD id, PWSTR profi ...@@ -429,7 +424,6 @@ BOOL WINAPI GetStandardColorSpaceProfileW( PCWSTR machine, DWORD id, PWSTR profi
default: default:
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
......
...@@ -41,18 +41,21 @@ static const WCHAR machineW[] = { 'd','u','m','m','y',0 }; ...@@ -41,18 +41,21 @@ static const WCHAR machineW[] = { 'd','u','m','m','y',0 };
* http://download.microsoft.com/download/whistler/hwdev1/1.0/wxp/en-us/ColorProfile.exe * http://download.microsoft.com/download/whistler/hwdev1/1.0/wxp/en-us/ColorProfile.exe
*/ */
/* Two common places to find the standard color space profile */ /* Two common places to find the standard color space profile, relative
static const char profilefile[] = * to the system directory.
*/
static const char profile1[] =
"\\color\\srgb color space profile.icm"; "\\color\\srgb color space profile.icm";
static const char profilesubdir[] = static const char profile2[] =
"\\system32\\spool\\drivers"; "\\spool\\drivers\\color\\srgb color space profile.icm";
static const WCHAR profilefileW[] = static const WCHAR profile1W[] =
{ '\\','c','o','l','o','r','\\','s','r','g','b',' ','c','o','l','o','r',' ', { '\\','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 }; 's','p','a','c','e',' ','p','r','o','f','i','l','e','.','i','c','m',0 };
static const WCHAR profilesubdirW[] = static const WCHAR profile2W[] =
{ '\\', 's','y','s','t','e','m','3','2','\\','s','p','o','o','l', { '\\','s','p','o','o','l','\\','d','r','i','v','e','r','s','\\',
'\\','d','r','i','v','e','r','s',0 }; '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 };
static const unsigned char rgbheader[] = static const unsigned char rgbheader[] =
{ 0x48, 0x0c, 0x00, 0x00, 0x6f, 0x6e, 0x69, 0x4c, 0x00, 0x00, 0x10, 0x02, { 0x48, 0x0c, 0x00, 0x00, 0x6f, 0x6e, 0x69, 0x4c, 0x00, 0x00, 0x10, 0x02,
...@@ -940,36 +943,34 @@ START_TEST(profile) ...@@ -940,36 +943,34 @@ START_TEST(profile)
UINT len; UINT len;
HANDLE handle; HANDLE handle;
char path[MAX_PATH], file[MAX_PATH]; char path[MAX_PATH], file[MAX_PATH];
char profile1[MAX_PATH], profile2[MAX_PATH]; char profilefile1[MAX_PATH], profilefile2[MAX_PATH];
WCHAR profile1W[MAX_PATH], profile2W[MAX_PATH]; WCHAR profilefile1W[MAX_PATH], profilefile2W[MAX_PATH];
WCHAR fileW[MAX_PATH]; WCHAR fileW[MAX_PATH];
/* See if we can find the standard color profile */ /* See if we can find the standard color profile */
GetSystemDirectoryA( profile1, sizeof(profile1) ); GetSystemDirectoryA( profilefile1, sizeof(profilefile1) );
GetSystemDirectoryW( profile1W, sizeof(profile1W) / sizeof(WCHAR) ); GetSystemDirectoryW( profilefile1W, sizeof(profilefile1W) / sizeof(WCHAR) );
strcat( profile1, profilefile ); lstrcatA( profilefile1, profile1 );
lstrcatW( profile1W, profilefileW ); lstrcatW( profilefile1W, profile1W );
handle = CreateFileA( profile1, 0 , 0, NULL, OPEN_EXISTING, 0, NULL ); handle = CreateFileA( profilefile1, 0 , 0, NULL, OPEN_EXISTING, 0, NULL );
if (handle != INVALID_HANDLE_VALUE) if (handle != INVALID_HANDLE_VALUE)
{ {
standardprofile = profile1; standardprofile = profilefile1;
standardprofileW = profile1W; standardprofileW = profilefile1W;
CloseHandle( handle ); CloseHandle( handle );
} }
GetWindowsDirectoryA( profile2, sizeof(profile2) ); GetSystemDirectoryA( profilefile2, sizeof(profilefile2) );
GetWindowsDirectoryW( profile2W, sizeof(profile2W) / sizeof(WCHAR) ); GetSystemDirectoryW( profilefile2W, sizeof(profilefile2W) / sizeof(WCHAR) );
strcat( profile2, profilesubdir ); lstrcatA( profilefile2, profile2 );
lstrcatW( profile2W, profilesubdirW ); lstrcatW( profilefile2W, profile2W );
strcat( profile2, profilefile ); handle = CreateFileA( profilefile2, 0 , 0, NULL, OPEN_EXISTING, 0, NULL );
lstrcatW( profile2W, profilefileW );
handle = CreateFileA( profile2, 0 , 0, NULL, OPEN_EXISTING, 0, NULL );
if (handle != INVALID_HANDLE_VALUE) if (handle != INVALID_HANDLE_VALUE)
{ {
standardprofile = profile2; standardprofile = profilefile2;
standardprofileW = profile2W; standardprofileW = profilefile2W;
CloseHandle( handle ); CloseHandle( handle );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment