Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
dca6bdf5
Commit
dca6bdf5
authored
Nov 03, 2004
by
Hans Leidekker
Committed by
Alexandre Julliard
Nov 03, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve {Uninstall,Install}ColorProfile{A,W}.
Better tests for these functions.
parent
53e57999
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
143 additions
and
18 deletions
+143
-18
profile.c
dlls/mscms/profile.c
+44
-9
profile.c
dlls/mscms/tests/profile.c
+99
-9
No files found.
dlls/mscms/profile.c
View file @
dca6bdf5
...
...
@@ -34,6 +34,16 @@
#include "lcms_api.h"
#undef LCMS_API_FUNCTION
#define IS_SEPARATOR(ch) ((ch) == '\\' || (ch) == '/')
static
void
MSCMS_basename
(
LPCWSTR
path
,
LPWSTR
name
)
{
INT
i
=
lstrlenW
(
path
);
while
(
i
>
0
&&
!
IS_SEPARATOR
(
path
[
i
-
1
]))
i
--
;
lstrcpyW
(
name
,
&
path
[
i
]
);
}
WINE_DEFAULT_DEBUG_CHANNEL
(
mscms
);
BOOL
WINAPI
GetColorDirectoryA
(
PCSTR
machine
,
PSTR
buffer
,
PDWORD
size
)
...
...
@@ -62,7 +72,6 @@ BOOL WINAPI GetColorDirectoryA( PCSTR machine, PSTR buffer, PDWORD size )
HeapFree
(
GetProcessHeap
(),
0
,
bufferW
);
}
return
ret
;
}
...
...
@@ -83,7 +92,7 @@ BOOL WINAPI GetColorDirectoryW( PCWSTR machine, PWSTR buffer, PDWORD size )
if
(
len
<=
*
size
)
{
lstrc
at
W
(
buffer
,
colordir
);
lstrc
py
W
(
buffer
,
colordir
);
return
TRUE
;
}
...
...
@@ -111,27 +120,54 @@ BOOL WINAPI InstallColorProfileA( PCSTR machine, PCSTR profile )
ret
=
InstallColorProfileW
(
NULL
,
profileW
);
HeapFree
(
GetProcessHeap
(),
0
,
profileW
);
}
return
ret
;
}
BOOL
WINAPI
InstallColorProfileW
(
PCWSTR
machine
,
PCWSTR
profile
)
{
FIXME
(
"( %s ) stub
\n
"
,
debugstr_w
(
profile
)
);
WCHAR
dest
[
MAX_PATH
],
base
[
MAX_PATH
];
DWORD
size
=
sizeof
(
dest
);
static
const
WCHAR
slash
[]
=
{
'\\'
,
0
};
TRACE
(
"( %s )
\n
"
,
debugstr_w
(
profile
)
);
if
(
machine
||
!
profile
)
return
FALSE
;
return
FALSE
;
if
(
!
GetColorDirectoryW
(
machine
,
dest
,
&
size
))
return
FALSE
;
MSCMS_basename
(
profile
,
base
);
lstrcatW
(
dest
,
slash
);
lstrcatW
(
dest
,
base
);
/* Is source equal to destination? */
if
(
!
lstrcmpW
(
profile
,
dest
))
return
TRUE
;
return
CopyFileW
(
profile
,
dest
,
TRUE
);
}
BOOL
WINAPI
UninstallColorProfileA
(
PCSTR
machine
,
PCSTR
profile
,
BOOL
delete
)
{
UINT
len
;
LPWSTR
profileW
;
BOOL
ret
=
FALSE
;
TRACE
(
"( %s )
\n
"
,
debugstr_a
(
profile
)
);
if
(
machine
||
!
profile
)
return
FALSE
;
if
(
delete
)
return
DeleteFileA
(
profile
);
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
profile
,
-
1
,
NULL
,
0
);
profileW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
return
TRUE
;
if
(
profileW
)
{
MultiByteToWideChar
(
CP_ACP
,
0
,
profile
,
-
1
,
profileW
,
len
);
ret
=
UninstallColorProfileW
(
NULL
,
profileW
,
delete
);
HeapFree
(
GetProcessHeap
(),
0
,
profileW
);
}
return
ret
;
}
BOOL
WINAPI
UninstallColorProfileW
(
PCWSTR
machine
,
PCWSTR
profile
,
BOOL
delete
)
...
...
@@ -175,7 +211,6 @@ HPROFILE WINAPI OpenColorProfileA( PPROFILE profile, DWORD access, DWORD sharing
HeapFree
(
GetProcessHeap
(),
0
,
profileW
.
pProfileData
);
}
}
return
handle
;
}
...
...
dlls/mscms/tests/profile.c
View file @
dca6bdf5
...
...
@@ -48,11 +48,29 @@ static const WCHAR profile2W[] =
'\\'
,
'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
LPSTR
standardprofile
=
NULL
;
static
LPWSTR
standardprofileW
=
NULL
;
static
LPSTR
standardprofile
;
static
LPWSTR
standardprofileW
;
static
LPSTR
testprofile
=
NULL
;
static
LPWSTR
testprofileW
=
NULL
;
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
]
);
}
static
void
test_GetColorDirectoryA
()
{
...
...
@@ -139,7 +157,7 @@ static void test_InstallColorProfileA()
ok
(
!
ret
,
"InstallColorProfileA() succeeded (%ld)
\n
"
,
GetLastError
()
);
ret
=
InstallColorProfileA
(
NULL
,
machine
);
ok
(
!
ret
,
"InstallColorProfileA()
fail
ed (%ld)
\n
"
,
GetLastError
()
);
ok
(
!
ret
,
"InstallColorProfileA()
succeed
ed (%ld)
\n
"
,
GetLastError
()
);
if
(
standardprofile
)
{
...
...
@@ -151,10 +169,28 @@ static void test_InstallColorProfileA()
if
(
testprofile
)
{
CHAR
dest
[
MAX_PATH
],
base
[
MAX_PATH
];
DWORD
size
=
sizeof
(
dest
);
CHAR
slash
[]
=
"
\\
"
;
HANDLE
handle
;
ret
=
InstallColorProfileA
(
NULL
,
testprofile
);
ok
(
ret
,
"InstallColorProfileA() failed (%ld)
\n
"
,
GetLastError
()
);
ret
=
UninstallColorProfileA
(
NULL
,
testprofile
,
TRUE
);
ret
=
GetColorDirectoryA
(
NULL
,
dest
,
&
size
);
ok
(
ret
,
"GetColorDirectoryA() failed (%ld)
\n
"
,
GetLastError
()
);
MSCMS_basenameA
(
testprofile
,
base
);
strcat
(
dest
,
slash
);
strcat
(
dest
,
base
);
/* 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
);
ret
=
UninstallColorProfileA
(
NULL
,
dest
,
TRUE
);
ok
(
ret
,
"UninstallColorProfileA() failed (%ld)
\n
"
,
GetLastError
()
);
}
}
...
...
@@ -184,10 +220,28 @@ static void test_InstallColorProfileW()
if
(
testprofileW
)
{
WCHAR
dest
[
MAX_PATH
],
base
[
MAX_PATH
];
DWORD
size
=
sizeof
(
dest
);
WCHAR
slash
[]
=
{
'\\'
,
0
};
HANDLE
handle
;
ret
=
InstallColorProfileW
(
NULL
,
testprofileW
);
ok
(
ret
,
"InstallColorProfileW() failed (%ld)
\n
"
,
GetLastError
()
);
ret
=
UninstallColorProfileW
(
NULL
,
testprofileW
,
TRUE
);
ret
=
GetColorDirectoryW
(
NULL
,
dest
,
&
size
);
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
);
ret
=
UninstallColorProfileW
(
NULL
,
dest
,
TRUE
);
ok
(
ret
,
"UninstallColorProfileW() failed (%ld)
\n
"
,
GetLastError
()
);
}
}
...
...
@@ -304,11 +358,29 @@ static void test_UninstallColorProfileA()
if
(
testprofile
)
{
CHAR
dest
[
MAX_PATH
],
base
[
MAX_PATH
];
DWORD
size
=
sizeof
(
dest
);
CHAR
slash
[]
=
"
\\
"
;
HANDLE
handle
;
ret
=
InstallColorProfileA
(
NULL
,
testprofile
);
ok
(
ret
,
"InstallColorProfileA() failed (%ld)
\n
"
,
GetLastError
()
);
ret
=
UninstallColorProfileA
(
NULL
,
testprofile
,
TRUE
);
ret
=
GetColorDirectoryA
(
NULL
,
dest
,
&
size
);
ok
(
ret
,
"GetColorDirectoryA() failed (%ld)
\n
"
,
GetLastError
()
);
MSCMS_basenameA
(
testprofile
,
base
);
strcat
(
dest
,
slash
);
strcat
(
dest
,
base
);
ret
=
UninstallColorProfileA
(
NULL
,
dest
,
TRUE
);
ok
(
ret
,
"UninstallColorProfileA() failed (%ld)
\n
"
,
GetLastError
()
);
/* 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
);
}
}
...
...
@@ -328,11 +400,29 @@ static void test_UninstallColorProfileW()
if
(
testprofileW
)
{
WCHAR
dest
[
MAX_PATH
],
base
[
MAX_PATH
];
DWORD
size
=
sizeof
(
dest
);
WCHAR
slash
[]
=
{
'\\'
,
0
};
HANDLE
handle
;
ret
=
InstallColorProfileW
(
NULL
,
testprofileW
);
ok
(
ret
,
"InstallColorProfileW() failed (%ld)
\n
"
,
GetLastError
()
);
ret
=
UninstallColorProfileW
(
NULL
,
testprofileW
,
TRUE
);
ret
=
GetColorDirectoryW
(
NULL
,
dest
,
&
size
);
ok
(
ret
,
"GetColorDirectoryW() failed (%ld)
\n
"
,
GetLastError
()
);
MSCMS_basenameW
(
testprofileW
,
base
);
lstrcatW
(
dest
,
slash
);
lstrcatW
(
dest
,
base
);
ret
=
UninstallColorProfileW
(
NULL
,
dest
,
TRUE
);
ok
(
ret
,
"UninstallColorProfileW() failed (%ld)
\n
"
,
GetLastError
()
);
/* Check if the profile is really gone */
handle
=
CreateFileW
(
dest
,
0
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
ok
(
handle
==
INVALID_HANDLE_VALUE
,
"Found the profile (%ld)
\n
"
,
GetLastError
()
);
CloseHandle
(
handle
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment