Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zsolt Vadász
wine
Commits
dca6bdf5
Commit
dca6bdf5
authored
20 years ago
by
Hans Leidekker
Committed by
Alexandre Julliard
20 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Improve {Uninstall,Install}ColorProfile{A,W}.
Better tests for these functions.
parent
53e57999
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/mscms/profile.c
+44
-9
44 additions, 9 deletions
dlls/mscms/profile.c
dlls/mscms/tests/profile.c
+99
-9
99 additions, 9 deletions
dlls/mscms/tests/profile.c
with
143 additions
and
18 deletions
dlls/mscms/profile.c
+
44
−
9
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
;
}
...
...
This diff is collapsed.
Click to expand it.
dlls/mscms/tests/profile.c
+
99
−
9
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
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment