Don't reference c:\windows directly.

This commit is contained in:
Vincent Béron 2005-04-11 18:49:40 +00:00 committed by Alexandre Julliard
parent 2771218783
commit 81bda71e9a
2 changed files with 41 additions and 28 deletions

View File

@ -44,11 +44,10 @@ static void MSCMS_basename( LPCWSTR path, LPWSTR name )
lstrcpyW( name, &path[i] ); lstrcpyW( name, &path[i] );
} }
static const WCHAR rgbprofile[] = /* FIXME: Get this directory from the registry? */
{ 'c',':','\\','w','i','n','d','o','w','s','\\', 's','y','s','t','e','m','3','2', static const WCHAR colorsubdir[] = { '\\','s','y','s','t','e','m','3','2',
'\\','s','p','o','o','l','\\','d','r','i','v','e','r','s', '\\','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',' ', '\\','c','o','l','o','r',0 };
's','p','a','c','e',' ','p','r','o','f','i','l','e','.','i','c','m',0 };
WINE_DEFAULT_DEBUG_CHANNEL(mscms); WINE_DEFAULT_DEBUG_CHANNEL(mscms);
@ -109,17 +108,16 @@ 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 )
{ {
/* FIXME: Get this directory from the registry? */ WCHAR colordir[MAX_PATH];
static const WCHAR colordir[] =
{ 'c',':','\\','w','i','n','d','o','w','s','\\', '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 };
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) );
lstrcatW( colordir, colorsubdir );
len = lstrlenW( colordir ) * sizeof(WCHAR); len = lstrlenW( colordir ) * sizeof(WCHAR);
if (len <= *size && buffer) if (len <= *size && buffer)
@ -401,6 +399,9 @@ 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',' ',
's','p','a','c','e',' ','p','r','o','f','i','l','e','.','i','c','m',0 };
WCHAR rgbprofile[MAX_PATH];
DWORD len; DWORD len;
TRACE( "( 0x%08lx, %p, %p )\n", id, profile, size ); TRACE( "( 0x%08lx, %p, %p )\n", id, profile, size );
@ -410,7 +411,11 @@ BOOL WINAPI GetStandardColorSpaceProfileW( PCWSTR machine, DWORD id, PWSTR profi
switch (id) switch (id)
{ {
case 0x52474220: /* 'RGB ' */ case 0x52474220: /* 'RGB ' */
len = sizeof( rgbprofile ); GetWindowsDirectoryW( rgbprofile, sizeof( rgbprofile ) / sizeof( WCHAR ) );
lstrcatW( rgbprofile, colorsubdir );
lstrcatW( rgbprofile, rgbprofilefile );
len = lstrlenW( rgbprofile ) * sizeof( WCHAR );
if (*size < len || !profile) if (*size < len || !profile)
{ {

View File

@ -42,20 +42,17 @@ static const WCHAR machineW[] = { 'd','u','m','m','y',0 };
*/ */
/* Two common places to find the standard color space profile */ /* Two common places to find the standard color space profile */
static const char profile1[] = static const char profilefile[] =
"c:\\windows\\system\\color\\srgb color space profile.icm"; "\\color\\srgb color space profile.icm";
static const char profile2[] = static const char profilesubdir[] =
"c:\\windows\\system32\\spool\\drivers\\color\\srgb color space profile.icm"; "\\system32\\spool\\drivers";
static const WCHAR profile1W[] = static const WCHAR profilefileW[] =
{ 'c',':','\\','w','i','n','d','o','w','s','\\', 's','y','s','t','e','m', { '\\','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 };
static const WCHAR profile2W[] =
{ 'c',':','\\','w','i','n','d','o','w','s','\\', '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','\\','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[] =
{ '\\', 's','y','s','t','e','m','3','2','\\','s','p','o','o','l',
'\\','d','r','i','v','e','r','s',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,
@ -160,7 +157,6 @@ static void test_GetColorDirectoryW()
ret = GetColorDirectoryW( NULL, buffer, &size ); ret = GetColorDirectoryW( NULL, buffer, &size );
ok( ret && size > 0, "GetColorDirectoryW() failed (%ld)\n", GetLastError() ); ok( ret && size > 0, "GetColorDirectoryW() failed (%ld)\n", GetLastError() );
ret = GetColorDirectoryW( NULL, buffer, &size );
} }
static void test_GetColorProfileElement() static void test_GetColorProfileElement()
@ -944,24 +940,36 @@ 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];
WCHAR profile1W[MAX_PATH], profile2W[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) );
GetSystemDirectoryW( profile1W, sizeof(profile1W) / sizeof(WCHAR) );
strcat( profile1, profilefile );
lstrcatW( profile1W, profilefileW );
handle = CreateFileA( profile1, 0 , 0, NULL, OPEN_EXISTING, 0, NULL ); handle = CreateFileA( profile1, 0 , 0, NULL, OPEN_EXISTING, 0, NULL );
if (handle != INVALID_HANDLE_VALUE) if (handle != INVALID_HANDLE_VALUE)
{ {
standardprofile = (LPSTR)&profile1; standardprofile = profile1;
standardprofileW = (LPWSTR)&profile1W; standardprofileW = profile1W;
CloseHandle( handle ); CloseHandle( handle );
} }
GetWindowsDirectoryA( profile2, sizeof(profile2) );
GetWindowsDirectoryW( profile2W, sizeof(profile2W) / sizeof(WCHAR) );
strcat( profile2, profilesubdir );
lstrcatW( profile2W, profilesubdirW );
strcat( profile2, profilefile );
lstrcatW( profile2W, profilefileW );
handle = CreateFileA( profile2, 0 , 0, NULL, OPEN_EXISTING, 0, NULL ); handle = CreateFileA( profile2, 0 , 0, NULL, OPEN_EXISTING, 0, NULL );
if (handle != INVALID_HANDLE_VALUE) if (handle != INVALID_HANDLE_VALUE)
{ {
standardprofile = (LPSTR)&profile2; standardprofile = profile2;
standardprofileW = (LPWSTR)&profile2W; standardprofileW = profile2W;
CloseHandle( handle ); CloseHandle( handle );
} }