Implement color profile handles.
Implement OpenColorProfile{A,W} and CloseColorProfile.
Implement GetColorDirectory{A,W} and InstallColorProfile{A,W}.
Implement UninstallColorProfile{A,W}.
Dynamically load liblcms.
Add tests.
diff --git a/configure b/configure
index f6bbde7..8bf1dec 100755
--- a/configure
+++ b/configure
@@ -311,7 +311,7 @@
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS WIN16_FILES WIN16_INSTALL build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPPBIN ac_ct_CPPBIN TOOLSDIR CPP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LEX LEXLIB LEX_OUTPUT_ROOT XLEX BISON AS ac_ct_AS LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP WINDRES ac_ct_WINDRES LN_S LN EGREP LDCONFIG INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LINT LINTFLAGS DB2HTML DB2PDF DB2PS DB2TXT FONTFORGE LIBPTHREAD XLIB XFILES OPENGLFILES GLU32FILES OPENGL_LIBS GLUT_LIBS GLUT32FILES NASLIBS CURSESLIBS sane_devel SANELIBS SANEINCL ICULIBS ft_devel ft_devel2 FREETYPELIBS FREETYPEINCL FONTSSUBDIRS ARTSCCONFIG ARTSLIBS ARTSINCL ALSALIBS AUDIOIOLIBS LCMSLIBS CAPI4LINUXLIBS EXTRACFLAGS DLLEXT DLLFLAGS DLLIBS LDSHARED LDDLLFLAGS LIBEXT IMPLIBEXT DLLTOOL ac_ct_DLLTOOL DLLWRAP ac_ct_DLLWRAP LDEXECFLAGS LDLIBWINEFLAGS COREFOUNDATIONLIB IOKITLIB CROSSTEST CROSSCC CROSSWINDRES LDPATH CRTLIBS SOCKETLIBS WINE_BINARIES MAIN_BINARY LDD ALLOCA LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS WIN16_FILES WIN16_INSTALL build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPPBIN ac_ct_CPPBIN TOOLSDIR CPP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LEX LEXLIB LEX_OUTPUT_ROOT XLEX BISON AS ac_ct_AS LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP WINDRES ac_ct_WINDRES LN_S LN EGREP LDCONFIG INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LINT LINTFLAGS DB2HTML DB2PDF DB2PS DB2TXT FONTFORGE LIBPTHREAD XLIB XFILES OPENGLFILES GLU32FILES OPENGL_LIBS GLUT_LIBS GLUT32FILES NASLIBS CURSESLIBS sane_devel SANELIBS SANEINCL ICULIBS ft_devel ft_devel2 FREETYPELIBS FREETYPEINCL FONTSSUBDIRS ARTSCCONFIG ARTSLIBS ARTSINCL ALSALIBS AUDIOIOLIBS CAPI4LINUXLIBS EXTRACFLAGS DLLEXT DLLFLAGS DLLIBS LDSHARED LDDLLFLAGS LIBEXT IMPLIBEXT DLLTOOL ac_ct_DLLTOOL DLLWRAP ac_ct_DLLWRAP LDEXECFLAGS LDLIBWINEFLAGS COREFOUNDATIONLIB IOKITLIB CROSSTEST CROSSCC CROSSWINDRES LDPATH CRTLIBS SOCKETLIBS WINE_BINARIES MAIN_BINARY LDD ALLOCA LIBOBJS LTLIBOBJS'
ac_subst_files='MAKE_RULES MAKE_DLL_RULES MAKE_TEST_RULES MAKE_LIB_RULES MAKE_PROG_RULES'
# Initialize some variables set by options.
@@ -11629,231 +11629,6 @@
-for ac_header in lcms.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to wine-devel@winehq.org ##
-## ------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
- echo "$as_me:$LINENO: checking for cmsOpenProfileFromFile in -llcms" >&5
-echo $ECHO_N "checking for cmsOpenProfileFromFile in -llcms... $ECHO_C" >&6
-if test "${ac_cv_lib_lcms_cmsOpenProfileFromFile+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-llcms $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char cmsOpenProfileFromFile ();
-int
-main ()
-{
-cmsOpenProfileFromFile ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_lcms_cmsOpenProfileFromFile=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_lcms_cmsOpenProfileFromFile=no
-fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_lcms_cmsOpenProfileFromFile" >&5
-echo "${ECHO_T}$ac_cv_lib_lcms_cmsOpenProfileFromFile" >&6
-if test $ac_cv_lib_lcms_cmsOpenProfileFromFile = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LCMS 1
-_ACEOF
-
- LCMSLIBS="-llcms"
-
-
-fi
-
-
-fi
-
-done
-
-
-
-
for ac_header in capi20.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -15860,6 +15635,80 @@
#define SONAME_LIBGIF "$ac_cv_lib_soname_gif"
_ACEOF
fi
+
+echo "$as_me:$LINENO: checking for -llcms soname" >&5
+echo $ECHO_N "checking for -llcms soname... $ECHO_C" >&6
+if test "${ac_cv_lib_soname_lcms+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_get_soname_save_LIBS=$LIBS
+LIBS="-llcms $LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char cmsOpenProfileFromFile ();
+int
+main ()
+{
+cmsOpenProfileFromFile ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_soname_lcms=`$ac_cv_path_LDD conftest$ac_exeext | grep liblcms\\.$LIBEXT | sed "s/^.*\(liblcms\.$LIBEXT[^ ]*\).*$/\1/"`
+ if test "x$ac_cv_lib_soname_lcms" = "x"
+ then
+ ac_cv_lib_soname_lcms="liblcms.$LIBEXT"
+ fi
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_soname_lcms="liblcms.$LIBEXT"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_get_soname_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_soname_lcms" >&5
+echo "${ECHO_T}$ac_cv_lib_soname_lcms" >&6
+if test "x$ac_cv_lib_soname_lcms" != xNONE
+then
+cat >>confdefs.h <<_ACEOF
+#define SONAME_LIBLCMS "$ac_cv_lib_soname_lcms"
+_ACEOF
+fi
fi
@@ -16530,6 +16379,7 @@
+
for ac_header in \
arpa/inet.h \
arpa/nameser.h \
@@ -16544,6 +16394,7 @@
io.h \
jack/jack.h \
jpeglib.h \
+ lcms.h \
libio.h \
libutil.h \
link.h \
@@ -20278,7 +20129,7 @@
MAKE_PROG_RULES=programs/Makeprog.rules
- ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/advpack/Makefile dlls/amstream/Makefile dlls/atl/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cards/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3drm/Makefile dlls/d3dx8/Makefile dlls/d3dxof/Makefile dlls/dbghelp/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnet/Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/dxdiagn/Makefile dlls/dxerr8/Makefile dlls/dxerr9/Makefile dlls/dxguid/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/hhctrl.ocx/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/ifsmgr.vxd/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/itss/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mapi32/tests/Makefile dlls/mlang/Makefile dlls/mlang/tests/Makefile dlls/mmdevldr.vxd/Makefile dlls/monodebg.vxd/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msacm/tests/Makefile dlls/mscms/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvcrtd/tests/Makefile dlls/msvidc32/Makefile dlls/msvideo/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/ole32/tests/Makefile dlls/oleacc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/psapi/tests/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/quartz/tests/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/rsabase/Makefile dlls/rsabase/tests/Makefile dlls/secur32/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/strmiids/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uuid/Makefile dlls/uxtheme/Makefile dlls/vdhcp.vxd/Makefile dlls/vdmdbg/Makefile dlls/version/Makefile dlls/version/tests/Makefile dlls/vmm.vxd/Makefile dlls/vnbt.vxd/Makefile dlls/vnetbios.vxd/Makefile dlls/vtdapi.vxd/Makefile dlls/vwin32.vxd/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/wined3d/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winejack/Makefile dlls/winmm/winenas/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile fonts/Makefile include/Makefile libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/msiexec/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/taskmgr/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile"
+ ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/advpack/Makefile dlls/amstream/Makefile dlls/atl/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cards/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3drm/Makefile dlls/d3dx8/Makefile dlls/d3dxof/Makefile dlls/dbghelp/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnet/Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/dxdiagn/Makefile dlls/dxerr8/Makefile dlls/dxerr9/Makefile dlls/dxguid/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/hhctrl.ocx/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/ifsmgr.vxd/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/itss/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mapi32/tests/Makefile dlls/mlang/Makefile dlls/mlang/tests/Makefile dlls/mmdevldr.vxd/Makefile dlls/monodebg.vxd/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msacm/tests/Makefile dlls/mscms/Makefile dlls/mscms/tests/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvcrtd/tests/Makefile dlls/msvidc32/Makefile dlls/msvideo/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/ole32/tests/Makefile dlls/oleacc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/psapi/tests/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/quartz/tests/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/rsabase/Makefile dlls/rsabase/tests/Makefile dlls/secur32/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/strmiids/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uuid/Makefile dlls/uxtheme/Makefile dlls/vdhcp.vxd/Makefile dlls/vdmdbg/Makefile dlls/version/Makefile dlls/version/tests/Makefile dlls/vmm.vxd/Makefile dlls/vnbt.vxd/Makefile dlls/vnetbios.vxd/Makefile dlls/vtdapi.vxd/Makefile dlls/vwin32.vxd/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/wined3d/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winejack/Makefile dlls/winmm/winenas/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile fonts/Makefile include/Makefile libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/msiexec/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/taskmgr/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile"
cat >confcache <<\_ACEOF
@@ -20897,6 +20748,7 @@
"dlls/msacm/winemp3/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/msacm/winemp3/Makefile" ;;
"dlls/msacm/tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/msacm/tests/Makefile" ;;
"dlls/mscms/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/mscms/Makefile" ;;
+ "dlls/mscms/tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/mscms/tests/Makefile" ;;
"dlls/msdmo/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/msdmo/Makefile" ;;
"dlls/mshtml/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/mshtml/Makefile" ;;
"dlls/msi/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/msi/Makefile" ;;
@@ -21240,7 +21092,6 @@
s,@ARTSINCL@,$ARTSINCL,;t t
s,@ALSALIBS@,$ALSALIBS,;t t
s,@AUDIOIOLIBS@,$AUDIOIOLIBS,;t t
-s,@LCMSLIBS@,$LCMSLIBS,;t t
s,@CAPI4LINUXLIBS@,$CAPI4LINUXLIBS,;t t
s,@EXTRACFLAGS@,$EXTRACFLAGS,;t t
s,@DLLEXT@,$DLLEXT,;t t
diff --git a/configure.ac b/configure.ac
index b08512e..ef88545 100644
--- a/configure.ac
+++ b/configure.ac
@@ -631,15 +631,6 @@
[AUDIOIOLIBS="-laudioio"
AC_DEFINE(HAVE_LIBAUDIOIO, 1, [Define if you have libaudioIO])])])
-dnl **** Check for lcms ****
-
-AC_CHECK_HEADERS(lcms.h,
- [AC_CHECK_LIB(lcms,cmsOpenProfileFromFile,
- [AC_DEFINE(HAVE_LCMS,1,[Define if you have lcms libs and headers])
- AC_SUBST(LCMSLIBS,"-llcms")
- ])
-])
-
dnl **** Check for capi4linux ****
AC_CHECK_HEADERS(capi20.h,[
@@ -1047,6 +1038,7 @@
WINE_GET_SONAME(jpeg,jpeg_start_decompress)
WINE_GET_SONAME(ungif,DGifOpen)
WINE_GET_SONAME(gif,DGifOpen)
+ WINE_GET_SONAME(lcms,cmsOpenProfileFromFile)
fi
@@ -1131,6 +1123,7 @@
io.h \
jack/jack.h \
jpeglib.h \
+ lcms.h \
libio.h \
libutil.h \
link.h \
@@ -1619,6 +1612,7 @@
dlls/msacm/winemp3/Makefile
dlls/msacm/tests/Makefile
dlls/mscms/Makefile
+dlls/mscms/tests/Makefile
dlls/msdmo/Makefile
dlls/mshtml/Makefile
dlls/msi/Makefile
diff --git a/dlls/mscms/Makefile.in b/dlls/mscms/Makefile.in
index cd2acdb..fba3e7d 100644
--- a/dlls/mscms/Makefile.in
+++ b/dlls/mscms/Makefile.in
@@ -4,10 +4,13 @@
VPATH = @srcdir@
MODULE = mscms.dll
IMPORTS = kernel32
-EXTRALIBS = @LCMSLIBS@
C_SRCS = \
- mscms_main.c
+ handle.c \
+ mscms_main.c \
+ profile.c
+
+SUBDIRS = tests
@MAKE_DLL_RULES@
diff --git a/dlls/mscms/handle.c b/dlls/mscms/handle.c
new file mode 100644
index 0000000..66c6610
--- /dev/null
+++ b/dlls/mscms/handle.c
@@ -0,0 +1,154 @@
+/*
+ * MSCMS - Color Management System for Wine
+ *
+ * Copyright 2004 Hans Leidekker
+ *
+ * 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 "config.h"
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+
+#include "wingdi.h"
+#include "icm.h"
+
+#include "mscms_priv.h"
+
+#ifdef HAVE_LCMS_H
+
+static CRITICAL_SECTION MSCMS_handle_cs;
+static CRITICAL_SECTION_DEBUG MSCMS_handle_cs_debug =
+{
+ 0, 0, &MSCMS_handle_cs,
+ { &MSCMS_handle_cs_debug.ProcessLocksList,
+ &MSCMS_handle_cs_debug.ProcessLocksList },
+ 0, 0, { 0, (DWORD)(__FILE__ ": MSCMS_handle_cs") }
+};
+static CRITICAL_SECTION MSCMS_handle_cs = { &MSCMS_handle_cs_debug, -1, 0, 0, 0, 0 };
+
+/* A simple structure to tie together Windows file handles and lcms color
+ * profile handles. Windows color profile handles are built from indexes
+ * into an array of these structures. The 'file' field is set to NULL in
+ * case of a memory based profile
+ */
+
+struct handlemap
+{
+ HANDLE file;
+ cmsHPROFILE cmsprofile;
+};
+
+#define CMSMAXHANDLES 0x80
+
+static struct handlemap handlemaptable[CMSMAXHANDLES];
+
+HPROFILE MSCMS_cmsprofile2hprofile( cmsHPROFILE cmsprofile )
+{
+ HPROFILE ret = NULL;
+ unsigned int i;
+
+ if (!cmsprofile) return ret;
+
+ EnterCriticalSection( &MSCMS_handle_cs );
+
+ for (i = 0; i <= CMSMAXHANDLES; i++)
+ {
+ if (handlemaptable[i].cmsprofile == cmsprofile)
+ {
+ ret = (HPROFILE)(i + 1); goto out;
+ }
+ }
+
+out:
+ LeaveCriticalSection( &MSCMS_handle_cs );
+
+ return ret;
+}
+
+cmsHPROFILE MSCMS_hprofile2cmsprofile( HPROFILE profile )
+{
+ HANDLE ret;
+ unsigned int i;
+
+ EnterCriticalSection( &MSCMS_handle_cs );
+
+ i = (unsigned int)profile - 1;
+ ret = handlemaptable[i].cmsprofile;
+
+ LeaveCriticalSection( &MSCMS_handle_cs );
+
+ return ret;
+}
+
+HANDLE MSCMS_hprofile2handle( HPROFILE profile )
+{
+ HANDLE ret;
+ unsigned int i;
+
+ EnterCriticalSection( &MSCMS_handle_cs );
+
+ i = (unsigned int)profile - 1;
+ ret = handlemaptable[i].file;
+
+ LeaveCriticalSection( &MSCMS_handle_cs );
+
+ return ret;
+}
+
+HPROFILE MSCMS_create_hprofile_handle( HANDLE file, cmsHPROFILE cmsprofile )
+{
+ HPROFILE ret = NULL;
+ unsigned int i;
+
+ if (!cmsprofile) return ret;
+
+ EnterCriticalSection( &MSCMS_handle_cs );
+
+ for (i = 0; i <= CMSMAXHANDLES; i++)
+ {
+ if (handlemaptable[i].cmsprofile == 0)
+ {
+ handlemaptable[i].file = file;
+ handlemaptable[i].cmsprofile = cmsprofile;
+
+ ret = (HPROFILE)(i + 1); goto out;
+ }
+ }
+
+out:
+ LeaveCriticalSection( &MSCMS_handle_cs );
+
+ return ret;
+}
+
+void MSCMS_destroy_hprofile_handle( HPROFILE profile )
+{
+ unsigned int i;
+
+ if (profile)
+ {
+ EnterCriticalSection( &MSCMS_handle_cs );
+
+ i = (unsigned int)profile - 1;
+ memset( &handlemaptable[i], 0, sizeof(struct handlemap) );
+
+ LeaveCriticalSection( &MSCMS_handle_cs );
+ }
+}
+
+#endif /* HAVE_LCMS_H */
diff --git a/dlls/mscms/lcms_api.h b/dlls/mscms/lcms_api.h
new file mode 100644
index 0000000..5cf7ac3
--- /dev/null
+++ b/dlls/mscms/lcms_api.h
@@ -0,0 +1,39 @@
+/*
+ * MSCMS - Color Management System for Wine
+ *
+ * Copyright 2004 Hans Leidekker
+ *
+ * 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 "mscms_priv.h"
+
+#ifndef LCMS_API_FUNCTION
+#error "This file should be included with LCMS_API_FUNCTION defined!"
+#endif
+
+#ifdef HAVE_LCMS_H
+
+LCMS_API_FUNCTION(cmsCloseProfile)
+LCMS_API_FUNCTION(cmsOpenProfileFromFile)
+LCMS_API_FUNCTION(cmsOpenProfileFromMem)
+
+#ifndef LCMS_API_NO_REDEFINE
+#define cmsCloseProfile pcmsCloseProfile
+#define cmsOpenProfileFromFile pcmsOpenProfileFromFile
+#define cmsOpenProfileFromMem pcmsOpenProfileFromMem
+#endif /* LCMS_API_NO_REDEFINE */
+
+#endif /* HAVE_LCMS_H */
diff --git a/dlls/mscms/mscms.spec b/dlls/mscms/mscms.spec
index 065ac89..a4e8b53 100644
--- a/dlls/mscms/mscms.spec
+++ b/dlls/mscms/mscms.spec
@@ -18,8 +18,8 @@
@ stub EnumColorProfilesW
@ stub GenerateCopyFilePaths
@ stub GetCMMInfo
-@ stub GetColorDirectoryA
-@ stub GetColorDirectoryW
+@ stdcall GetColorDirectoryA(ptr ptr long)
+@ stdcall GetColorDirectoryW(ptr ptr long)
@ stub GetColorProfileElement
@ stub GetColorProfileElementTag
@ stub GetColorProfileFromHandle
@@ -31,8 +31,8 @@
@ stub GetPS2ColorSpaceArray
@ stub GetStandardColorSpaceProfileA
@ stub GetStandardColorSpaceProfileW
-@ stub InstallColorProfileA
-@ stub InstallColorProfileW
+@ stdcall InstallColorProfileA(ptr ptr)
+@ stdcall InstallColorProfileW(ptr ptr)
@ stub InternalGetDeviceConfig
@ stub InternalGetPS2CSAFromLCS
@ stub InternalGetPS2ColorRenderingDictionary
@@ -55,7 +55,7 @@
@ stub SpoolerCopyFileEvent
@ stub TranslateBitmapBits
@ stub TranslateColors
-@ stub UninstallColorProfileA
-@ stub UninstallColorProfileW
+@ stdcall UninstallColorProfileA(ptr ptr long)
+@ stdcall UninstallColorProfileW(ptr ptr long)
@ stub UnregisterCMMA
@ stub UnregisterCMMW
diff --git a/dlls/mscms/mscms_main.c b/dlls/mscms/mscms_main.c
index e4757d8..94d7a3e 100644
--- a/dlls/mscms/mscms_main.c
+++ b/dlls/mscms/mscms_main.c
@@ -20,77 +20,113 @@
#include "config.h"
+#include "wine/port.h"
+#include "wine/debug.h"
+#include "wine/library.h"
+
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
+
#include "wingdi.h"
#include "icm.h"
-#include "wine/debug.h"
+
+#define LCMS_API_NO_REDEFINE
+#define LCMS_API_FUNCTION(f) typeof(f) * p##f;
+#include "lcms_api.h"
+#undef LCMS_API_FUNCTION
WINE_DEFAULT_DEBUG_CHANNEL(mscms);
-#ifdef HAVE_LCMS
-
-/* These basic Windows types are defined in lcms.h when compiling on
- * a non-Windows platforms (why?), so they would normally not conflict
- * with anything included earlier. But since we are building Wine they
- * most certainly will have been defined before we include lcms.h.
- * The preprocessor comes to the rescue.
- */
-
-#define BYTE LCMS_BYTE
-#define LPBYTE LCMS_LPBYTE
-#define WORD LCMS_WORD
-#define LPWORD LCMS_LPWORD
-#define DWORD LCMS_DWORD
-#define LPDWORD LCMS_LPDWORD
-#define BOOL LCMS_BOOL
-#define LPSTR LCMS_LPSTR
-#define LPVOID LCMS_LPVOID
-
-#undef cdecl
-#undef FAR
-
-#undef ZeroMemory
-#undef CopyMemory
-
-#undef LOWORD
-#undef MAX_PATH
-
-#include <lcms.h>
-
-/* Funny thing is lcms.h defines DWORD as an 'unsigned int' whereas Wine
- * defines it as an 'unsigned long'. To avoid compiler warnings we use a
- * preprocessor define for DWORD and LPDWORD to get back Wine's orginal
- * (typedef) definitions.
- */
-
-#undef DWORD
-#undef LPDWORD
-
-#define DWORD DWORD
-#define LPDWORD LPDWORD
-
+#ifdef HAVE_LCMS_H
+#ifndef SONAME_LIBLCMS
+#define SONAME_LIBLCMS "liblcms.so"
#endif
-HPROFILE WINAPI OpenColorProfileA( PPROFILE profile, DWORD access, DWORD sharing, DWORD creation )
+static void *lcmshandle = NULL;
+#endif /* HAVE_LCMS_H */
+
+static BOOL MSCMS_init_lcms()
{
- FIXME("( %p, %lx, %lx, %lx ) stub!\n", profile, access, sharing, creation );
+#ifdef HAVE_LCMS_H
+ /* dynamically load lcms if not yet loaded */
+ if (!lcmshandle)
+ {
+ lcmshandle = wine_dlopen( SONAME_LIBLCMS, RTLD_NOW, NULL, 0 );
- return NULL;
-}
+ /* We can't really do anything useful without liblcms */
+ if (!lcmshandle)
+ {
+ WINE_MESSAGE(
+ "Wine cannot find the LittleCMS library. To enable Wine to use color\n"
+ "management functions please install a version of LittleCMS greater\n"
+ "than or equal to 1.13.\n"
+ "http://www.littlecms.com\n" );
-HPROFILE WINAPI OpenColorProfileW( PPROFILE profile, DWORD access, DWORD sharing, DWORD creation )
-{
- FIXME("( %p, %lx, %lx, %lx ) stub!\n", profile, access, sharing, creation );
+ return FALSE;
+ }
+ }
- return NULL;
-}
+ #define LOAD_FUNCPTR(f) \
+ if ((p##f = wine_dlsym( lcmshandle, #f, NULL, 0 )) == NULL) \
+ goto sym_not_found;
-BOOL WINAPI CloseColorProfile( HPROFILE profile )
-{
- FIXME("( %p ) stub!\n", profile );
+ LOAD_FUNCPTR(cmsCloseProfile);
+ LOAD_FUNCPTR(cmsOpenProfileFromFile);
+ LOAD_FUNCPTR(cmsOpenProfileFromMem);
+ #undef LOAD_FUNCPTR
+
+return TRUE;
+
+sym_not_found:
+ WINE_MESSAGE(
+ "Wine cannot find certain functions that it needs inside the LittleCMS\n"
+ "library. To enable Wine to use LittleCMS for color management please\n"
+ "upgrade liblcms to at least version 1.13.\n"
+ "http://www.littlecms.com\n" );
+
+ wine_dlclose( lcmshandle, NULL, 0 );
+ lcmshandle = NULL;
return FALSE;
+
+#endif /* HAVE_LCMS_H */
+ WINE_MESSAGE(
+ "This version of Wine was compiled without support for color management\n"
+ "functions. This means many color functions are empty stubs and you should\n"
+ "expect your application to fail. To enable Wine to use LittleCMS for color\n"
+ "management please install a liblcms development package version 1.13 or\n"
+ "higher and rebuild Wine.\n"
+ "http://www.littlecms.com\n" );
+
+ return TRUE;
+}
+
+static void MSCMS_deinit_lcms()
+{
+#ifdef HAVE_LCMS_H
+ if (lcmshandle)
+ {
+ wine_dlclose( lcmshandle, NULL, 0 );
+ lcmshandle = NULL;
+ }
+#endif /* HAVE_LCMS_H */
+}
+
+BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
+{
+ TRACE( "(%p, 0x%08lx, %p)\n", hinst, reason, reserved );
+
+ switch (reason)
+ {
+ case DLL_PROCESS_ATTACH:
+ return MSCMS_init_lcms();
+
+ case DLL_PROCESS_DETACH:
+ MSCMS_deinit_lcms();
+ break;
+ }
+
+ return TRUE;
}
diff --git a/dlls/mscms/mscms_priv.h b/dlls/mscms/mscms_priv.h
new file mode 100644
index 0000000..9e9e8a0
--- /dev/null
+++ b/dlls/mscms/mscms_priv.h
@@ -0,0 +1,70 @@
+/*
+ * MSCMS - Color Management System for Wine
+ *
+ * Copyright 2004 Hans Leidekker
+ *
+ * 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
+ */
+
+#ifdef HAVE_LCMS_H
+
+/* These basic Windows types are defined in lcms.h when compiling on
+ * a non-Windows platforms (why?), so they would normally not conflict
+ * with anything included earlier. But since we are building Wine they
+ * most certainly will have been defined before we include lcms.h.
+ * The preprocessor comes to the rescue.
+ */
+
+#define BYTE LCMS_BYTE
+#define LPBYTE LCMS_LPBYTE
+#define WORD LCMS_WORD
+#define LPWORD LCMS_LPWORD
+#define DWORD LCMS_DWORD
+#define LPDWORD LCMS_LPDWORD
+#define BOOL LCMS_BOOL
+#define LPSTR LCMS_LPSTR
+#define LPVOID LCMS_LPVOID
+
+#undef cdecl
+#undef FAR
+
+#undef ZeroMemory
+#undef CopyMemory
+
+#undef LOWORD
+#undef MAX_PATH
+
+#include <lcms.h>
+
+/* Funny thing is lcms.h defines DWORD as an 'unsigned int' whereas Wine
+ * defines it as an 'unsigned long'. To avoid compiler warnings we use a
+ * preprocessor define for DWORD and LPDWORD to get back Wine's orginal
+ * (typedef) definitions.
+ */
+
+#undef DWORD
+#undef LPDWORD
+
+#define DWORD DWORD
+#define LPDWORD LPDWORD
+
+extern HPROFILE MSCMS_cmsprofile2hprofile( cmsHPROFILE cmsprofile );
+extern cmsHPROFILE MSCMS_hprofile2cmsprofile( HPROFILE profile );
+extern HANDLE MSCMS_hprofile2handle( HPROFILE profile );
+
+extern HPROFILE MSCMS_create_hprofile_handle( HANDLE file, cmsHPROFILE cmsprofile );
+extern void MSCMS_destroy_hprofile_handle( HPROFILE profile );
+
+#endif /* HAVE_LCMS_H */
diff --git a/dlls/mscms/profile.c b/dlls/mscms/profile.c
new file mode 100644
index 0000000..b95fd1b
--- /dev/null
+++ b/dlls/mscms/profile.c
@@ -0,0 +1,263 @@
+/*
+ * MSCMS - Color Management System for Wine
+ *
+ * Copyright 2004 Hans Leidekker
+ *
+ * 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 "config.h"
+#include "wine/debug.h"
+
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "winnls.h"
+
+#include "wingdi.h"
+#include "icm.h"
+
+#define LCMS_API_FUNCTION(f) extern typeof(f) * p##f;
+#include "lcms_api.h"
+#undef LCMS_API_FUNCTION
+
+WINE_DEFAULT_DEBUG_CHANNEL(mscms);
+
+BOOL WINAPI GetColorDirectoryA( PCSTR machine, PSTR buffer, PDWORD size )
+{
+ INT len;
+ LPWSTR bufferW;
+ BOOL ret = FALSE;
+ DWORD sizeW = *size * sizeof(WCHAR);
+
+ TRACE( "( %p, %ld )\n", buffer, *size );
+
+ if (machine || !buffer) return FALSE;
+
+ bufferW = HeapAlloc( GetProcessHeap(), 0, sizeW );
+
+ if (bufferW)
+ {
+ ret = GetColorDirectoryW( NULL, bufferW, &sizeW );
+ *size = sizeW / sizeof(WCHAR);
+
+ if (ret)
+ {
+ len = WideCharToMultiByte( CP_ACP, 0, bufferW, *size, buffer, *size, NULL, NULL );
+ if (!len) ret = FALSE;
+ }
+
+ HeapFree( GetProcessHeap(), 0, bufferW );
+ }
+
+ return ret;
+}
+
+BOOL WINAPI GetColorDirectoryW( PCWSTR machine, PWSTR buffer, PDWORD size )
+{
+ /* FIXME: Get this directory from the registry? */
+ 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;
+
+ TRACE( "( %p, %ld )\n", buffer, *size );
+
+ if (machine || !buffer) return FALSE;
+
+ len = lstrlenW( colordir ) * sizeof(WCHAR);
+
+ if (len <= *size)
+ {
+ lstrcatW( buffer, colordir );
+ return TRUE;
+ }
+
+ *size = len;
+ return FALSE;
+}
+
+BOOL WINAPI InstallColorProfileA( PCSTR machine, PCSTR profile )
+{
+ UINT len;
+ LPWSTR profileW;
+ BOOL ret = FALSE;
+
+ TRACE( "( %s )\n", debugstr_a(profile) );
+
+ if (machine || !profile) return FALSE;
+
+ len = MultiByteToWideChar( CP_ACP, 0, profile, -1, NULL, 0 );
+ profileW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
+
+ if (profileW)
+ {
+ MultiByteToWideChar( CP_ACP, 0, profile, -1, profileW, len );
+
+ ret = InstallColorProfileW( NULL, profileW );
+ HeapFree( GetProcessHeap(), 0, profileW );
+ }
+
+ return ret;
+}
+
+BOOL WINAPI InstallColorProfileW( PCWSTR machine, PCWSTR profile )
+{
+ FIXME( "( %s ) stub\n", debugstr_w(profile) );
+
+ if (machine || !profile) return FALSE;
+
+ return FALSE;
+}
+
+BOOL WINAPI UninstallColorProfileA( PCSTR machine, PCSTR profile, BOOL delete )
+{
+ if (machine || !profile) return FALSE;
+
+ if (delete)
+ return DeleteFileA( profile );
+
+ return TRUE;
+}
+
+BOOL WINAPI UninstallColorProfileW( PCWSTR machine, PCWSTR profile, BOOL delete )
+{
+ if (machine || !profile) return FALSE;
+
+ if (delete)
+ return DeleteFileW( profile );
+
+ return TRUE;
+}
+
+HPROFILE WINAPI OpenColorProfileA( PPROFILE profile, DWORD access, DWORD sharing, DWORD creation )
+{
+ HPROFILE handle = NULL;
+
+ TRACE( "( %p, %lx, %lx, %lx )\n", profile, access, sharing, creation );
+
+ if (!profile || !profile->pProfileData) return NULL;
+
+ /* No AW conversion needed for memory based profiles */
+ if (profile->dwType & PROFILE_MEMBUFFER)
+ return OpenColorProfileW( profile, access, sharing, creation );
+
+ if (profile->dwType & PROFILE_FILENAME)
+ {
+ UINT len;
+ PROFILE profileW;
+
+ profileW.dwType = profile->dwType;
+
+ len = MultiByteToWideChar( CP_ACP, 0, profile->pProfileData, -1, NULL, 0 );
+ profileW.pProfileData = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
+
+ if (profileW.pProfileData)
+ {
+ profileW.cbDataSize = len * sizeof(WCHAR);
+ MultiByteToWideChar( CP_ACP, 0, profile->pProfileData, -1, profileW.pProfileData, len );
+
+ handle = OpenColorProfileW( &profileW, access, sharing, creation );
+ HeapFree( GetProcessHeap(), 0, profileW.pProfileData );
+ }
+ }
+
+ return handle;
+}
+
+/******************************************************************************
+ * OpenColorProfileW [MSCMS.@]
+ *
+ * Open a color profile.
+ *
+ * PARAMS
+ * profile [I] Pointer to a color profile structure
+ * access [I] Desired access
+ * sharing [I] Sharing mode
+ * creation [I] Creation mode
+ *
+ * RETURNS
+ * Success: Handle to the opened profile
+ * Failure: NULL
+ *
+ * NOTES
+ * Values for access: PROFILE_READ or PROFILE_READWRITE
+ * Values for sharing: 0 (no sharing), FILE_SHARE_READ and/or FILE_SHARE_WRITE
+ * Values for creation: one of CREATE_NEW, CREATE_ALWAYS, OPEN_EXISTING,
+ * OPEN_ALWAYS, TRUNCATE_EXISTING.
+ */
+
+HPROFILE WINAPI OpenColorProfileW( PPROFILE profile, DWORD access, DWORD sharing, DWORD creation )
+{
+#ifdef HAVE_LCMS_H
+ cmsHPROFILE cmsprofile = NULL;
+ HANDLE handle = NULL;
+
+ TRACE( "( %p, %lx, %lx, %lx )\n", profile, access, sharing, creation );
+
+ if (!profile || !profile->pProfileData) return NULL;
+
+ if (profile->dwType & PROFILE_MEMBUFFER)
+ {
+ FIXME( "Memory based profile not yet supported.\n" ); return NULL;
+ }
+
+ if (profile->dwType & PROFILE_FILENAME)
+ {
+ char *unixname;
+ DWORD flags = 0;
+
+ TRACE("profile file: %s\n", debugstr_w( (WCHAR *)profile->pProfileData ));
+
+ if (access & PROFILE_READ) flags = GENERIC_READ;
+ if (access & PROFILE_READWRITE) flags = GENERIC_READ|GENERIC_WRITE;
+
+ if (!flags) return NULL;
+
+ handle = CreateFileW( profile->pProfileData, flags, sharing, NULL, creation, 0, NULL );
+ if (handle == INVALID_HANDLE_VALUE) return NULL;
+
+ unixname = wine_get_unix_file_name( (WCHAR *)profile->pProfileData );
+
+ if (unixname)
+ {
+ cmsprofile = cmsOpenProfileFromFile( unixname, flags & GENERIC_READ ? "r" : "w" );
+ HeapFree( GetProcessHeap(), 0, unixname );
+ }
+ }
+
+ if (cmsprofile) return MSCMS_create_hprofile_handle( handle, cmsprofile );
+
+#endif /* HAVE_LCMS_H */
+ return NULL;
+}
+
+BOOL WINAPI CloseColorProfile( HPROFILE profile )
+{
+ BOOL ret1, ret2 = FALSE;
+
+ TRACE( "( %p )\n", profile );
+
+#ifdef HAVE_LCMS_H
+ ret1 = cmsCloseProfile( MSCMS_hprofile2cmsprofile( profile ) );
+ ret2 = CloseHandle( MSCMS_hprofile2handle( profile ) );
+
+ MSCMS_destroy_hprofile_handle( profile );
+
+#endif /* HAVE_LCMS_H */
+ return ret1 && ret2;
+}
diff --git a/dlls/mscms/tests/.cvsignore b/dlls/mscms/tests/.cvsignore
new file mode 100644
index 0000000..a41660f
--- /dev/null
+++ b/dlls/mscms/tests/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+profile.ok
+testlist.c
diff --git a/dlls/mscms/tests/Makefile.in b/dlls/mscms/tests/Makefile.in
new file mode 100644
index 0000000..7d45911
--- /dev/null
+++ b/dlls/mscms/tests/Makefile.in
@@ -0,0 +1,13 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../../..
+SRCDIR = @srcdir@
+VPATH = @srcdir@
+TESTDLL = mscms.dll
+IMPORTS = mscms kernel32
+
+CTESTS = \
+ profile.c
+
+@MAKE_TEST_RULES@
+
+### Dependencies:
diff --git a/dlls/mscms/tests/profile.c b/dlls/mscms/tests/profile.c
new file mode 100644
index 0000000..9690b32
--- /dev/null
+++ b/dlls/mscms/tests/profile.c
@@ -0,0 +1,398 @@
+/*
+ * Tests for color profile functions
+ *
+ * Copyright 2004 Hans Leidekker
+ *
+ * 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"
+#include "winnls.h"
+
+#include "wingdi.h"
+#include "icm.h"
+
+#include "wine/test.h"
+
+static const char machine[] = "dummy";
+static const WCHAR machineW[] = { 'd','u','m','m','y',0 };
+
+/* Two common places to find the standard color space profile */
+static const char profile1[] =
+"c:\\windows\\system\\color\\srgb color space profile.icm";
+static const char profile2[] =
+"c:\\windows\\system32\\spool\\drivers\\color\\srgb color space profile.icm";
+
+static const WCHAR profile1W[] =
+{ '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',' ',
+ '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 };
+
+static LPSTR standardprofile = NULL;
+static LPWSTR standardprofileW = NULL;
+
+static LPSTR testprofile = NULL;
+static LPWSTR testprofileW = NULL;
+
+static void test_GetColorDirectoryA()
+{
+ BOOL ret;
+ DWORD size;
+ char buffer[MAX_PATH];
+
+ /* Parameter checks */
+
+ size = 0;
+
+ ret = GetColorDirectoryA( NULL, NULL, &size );
+ ok( !ret, "GetColorDirectoryA() succeeded (%ld)\n", GetLastError() );
+
+ size = 0;
+
+ ret = GetColorDirectoryA( NULL, buffer, &size );
+ ok( !ret, "GetColorDirectoryA() succeeded (%ld)\n", GetLastError() );
+
+ size = 1;
+
+ ret = GetColorDirectoryA( NULL, buffer, &size );
+ ok( !ret, "GetColorDirectoryA() succeeded (%ld)\n", GetLastError() );
+
+ size = sizeof(buffer);
+
+ ret = GetColorDirectoryA( machine, buffer, &size );
+ ok( !ret, "GetColorDirectoryA() succeeded (%ld)\n", GetLastError() );
+
+ /* Functional checks */
+
+ size = sizeof(buffer);
+
+ ret = GetColorDirectoryA( NULL, buffer, &size );
+ ok( ret, "GetColorDirectoryA() failed (%ld)\n", GetLastError() );
+}
+
+static void test_GetColorDirectoryW()
+{
+ BOOL ret;
+ DWORD size;
+ WCHAR buffer[MAX_PATH];
+
+ /* Parameter checks */
+
+ size = 0;
+
+ ret = GetColorDirectoryW( NULL, NULL, &size );
+ ok( !ret, "GetColorDirectoryW() succeeded (%ld)\n", GetLastError() );
+
+ size = 0;
+
+ ret = GetColorDirectoryW( NULL, buffer, &size );
+ ok( !ret, "GetColorDirectoryW() succeeded (%ld)\n", GetLastError() );
+
+ size = 1;
+
+ ret = GetColorDirectoryW( NULL, buffer, &size );
+ ok( !ret, "GetColorDirectoryW() succeeded (%ld)\n", GetLastError() );
+
+ size = sizeof(buffer);
+
+ ret = GetColorDirectoryW( machineW, buffer, &size );
+ ok( !ret, "GetColorDirectoryW() succeeded (%ld)\n", GetLastError() );
+
+ /* Functional checks */
+
+ size = sizeof(buffer);
+
+ ret = GetColorDirectoryW( NULL, buffer, &size );
+ ok( ret, "GetColorDirectoryW() failed (%ld)\n", GetLastError() );
+}
+
+static void test_InstallColorProfileA()
+{
+ BOOL ret;
+
+ /* Parameter checks */
+
+ ret = InstallColorProfileA( NULL, NULL );
+ ok( !ret, "InstallColorProfileA() succeeded (%ld)\n", GetLastError() );
+
+ ret = InstallColorProfileA( machine, NULL );
+ ok( !ret, "InstallColorProfileA() succeeded (%ld)\n", GetLastError() );
+
+ ret = InstallColorProfileA( NULL, machine );
+ ok( !ret, "InstallColorProfileA() failed (%ld)\n", GetLastError() );
+
+ if (standardprofile)
+ {
+ ret = InstallColorProfileA( NULL, standardprofile );
+ ok( ret, "InstallColorProfileA() failed (%ld)\n", GetLastError() );
+ }
+
+ /* Functional checks */
+
+ if (testprofile)
+ {
+ ret = InstallColorProfileA( NULL, testprofile );
+ ok( ret, "InstallColorProfileA() failed (%ld)\n", GetLastError() );
+
+ ret = UninstallColorProfileA( NULL, testprofile, TRUE );
+ ok( ret, "UninstallColorProfileA() failed (%ld)\n", GetLastError() );
+ }
+}
+
+static void test_InstallColorProfileW()
+{
+ BOOL ret;
+
+ /* Parameter checks */
+
+ ret = InstallColorProfileW( NULL, NULL );
+ ok( !ret, "InstallColorProfileW() succeeded (%ld)\n", GetLastError() );
+
+ ret = InstallColorProfileW( machineW, NULL );
+ ok( !ret, "InstallColorProfileW() succeeded (%ld)\n", GetLastError() );
+
+ ret = InstallColorProfileW( NULL, machineW );
+ ok( !ret, "InstallColorProfileW() failed (%ld)\n", GetLastError() );
+
+ if (standardprofileW)
+ {
+ ret = InstallColorProfileW( NULL, standardprofileW );
+ ok( ret, "InstallColorProfileW() failed (%ld)\n", GetLastError() );
+ }
+
+ /* Functional checks */
+
+ if (testprofileW)
+ {
+ ret = InstallColorProfileW( NULL, testprofileW );
+ ok( ret, "InstallColorProfileW() failed (%ld)\n", GetLastError() );
+
+ ret = UninstallColorProfileW( NULL, testprofileW, TRUE );
+ ok( ret, "UninstallColorProfileW() failed (%ld)\n", GetLastError() );
+ }
+}
+
+static void test_OpenColorProfileA()
+{
+ PROFILE profile;
+ HPROFILE handle;
+
+ profile.dwType = PROFILE_FILENAME;
+ profile.pProfileData = NULL;
+ profile.cbDataSize = 0;
+
+ /* Parameter checks */
+
+ handle = OpenColorProfileA( NULL, 0, 0, 0 );
+ ok( handle == NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
+
+ handle = OpenColorProfileA( &profile, 0, 0, 0 );
+ ok( handle == NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
+
+ handle = OpenColorProfileA( &profile, PROFILE_READ, 0, 0 );
+ ok( handle == NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
+
+ handle = OpenColorProfileA( &profile, PROFILE_READWRITE, 0, 0 );
+ ok( handle == NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
+
+ ok ( !CloseColorProfile( NULL ), "CloseColorProfile() succeeded" );
+
+ if (standardprofile)
+ {
+ profile.pProfileData = standardprofile;
+ profile.cbDataSize = strlen(standardprofile);
+
+ handle = OpenColorProfileA( &profile, 0, 0, 0 );
+ ok( handle == NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
+
+ handle = OpenColorProfileA( &profile, PROFILE_READ, 0, 0 );
+ ok( handle == NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
+
+ handle = OpenColorProfileA( &profile, PROFILE_READ|PROFILE_READWRITE, 0, 0 );
+ ok( handle == NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
+
+ /* Functional checks */
+
+ handle = OpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING );
+ ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() );
+
+ ok( CloseColorProfile( handle ), "CloseColorProfile() failed (%ld)\n", GetLastError() );
+ }
+}
+
+static void test_OpenColorProfileW()
+{
+ PROFILE profile;
+ HPROFILE handle;
+
+ profile.dwType = PROFILE_FILENAME;
+ profile.pProfileData = NULL;
+ profile.cbDataSize = 0;
+
+ /* Parameter checks */
+
+ handle = OpenColorProfileW( NULL, 0, 0, 0 );
+ ok( handle == NULL, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
+
+ handle = OpenColorProfileW( &profile, 0, 0, 0 );
+ ok( handle == NULL, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
+
+ handle = OpenColorProfileW( &profile, PROFILE_READ, 0, 0 );
+ ok( handle == NULL, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
+
+ handle = OpenColorProfileW( &profile, PROFILE_READWRITE, 0, 0 );
+ ok( handle == NULL, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
+
+ ok ( !CloseColorProfile( NULL ), "CloseColorProfile() succeeded" );
+
+ if (standardprofileW)
+ {
+ profile.pProfileData = standardprofileW;
+ profile.cbDataSize = lstrlenW(standardprofileW) * sizeof(WCHAR);
+
+ handle = OpenColorProfileW( &profile, 0, 0, 0 );
+ ok( handle == NULL, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
+
+ handle = OpenColorProfileW( &profile, PROFILE_READ, 0, 0 );
+ ok( handle == NULL, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
+
+ handle = OpenColorProfileW( &profile, PROFILE_READ|PROFILE_READWRITE, 0, 0 );
+ ok( handle == NULL, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
+
+ /* Functional checks */
+
+ handle = OpenColorProfileW( &profile, PROFILE_READ, 0, OPEN_EXISTING );
+ ok( handle != NULL, "OpenColorProfileW() failed (%ld)\n", GetLastError() );
+
+ ok( CloseColorProfile( handle ), "CloseColorProfile() failed (%ld)\n", GetLastError() );
+ }
+}
+
+static void test_UninstallColorProfileA()
+{
+ BOOL ret;
+
+ /* Parameter checks */
+
+ ret = UninstallColorProfileA( NULL, NULL, FALSE );
+ ok( !ret, "UninstallColorProfileA() succeeded (%ld)\n", GetLastError() );
+
+ ret = UninstallColorProfileA( machine, NULL, FALSE );
+ ok( !ret, "UninstallColorProfileA() succeeded (%ld)\n", GetLastError() );
+
+ /* Functional checks */
+
+ if (testprofile)
+ {
+ ret = InstallColorProfileA( NULL, testprofile );
+ ok( ret, "InstallColorProfileA() failed (%ld)\n", GetLastError() );
+
+ ret = UninstallColorProfileA( NULL, testprofile, TRUE );
+ ok( ret, "UninstallColorProfileA() failed (%ld)\n", GetLastError() );
+ }
+}
+
+static void test_UninstallColorProfileW()
+{
+ BOOL ret;
+
+ /* Parameter checks */
+
+ ret = UninstallColorProfileW( NULL, NULL, FALSE );
+ ok( !ret, "UninstallColorProfileW() succeeded (%ld)\n", GetLastError() );
+
+ ret = UninstallColorProfileW( machineW, NULL, FALSE );
+ ok( !ret, "UninstallColorProfileW() succeeded (%ld)\n", GetLastError() );
+
+ /* Functional checks */
+
+ if (testprofileW)
+ {
+ ret = InstallColorProfileW( NULL, testprofileW );
+ ok( ret, "InstallColorProfileW() failed (%ld)\n", GetLastError() );
+
+ ret = UninstallColorProfileW( NULL, testprofileW, TRUE );
+ ok( ret, "UninstallColorProfileW() failed (%ld)\n", GetLastError() );
+ }
+}
+
+START_TEST(profile)
+{
+ UINT len;
+ HANDLE handle;
+ char path[MAX_PATH], file[MAX_PATH];
+ WCHAR fileW[MAX_PATH];
+
+ /* See if we can find the standard color profile */
+ handle = CreateFileA( (LPCSTR)&profile1, 0 , 0, NULL, OPEN_EXISTING, 0, NULL );
+
+ if (handle != INVALID_HANDLE_VALUE)
+ {
+ standardprofile = (LPSTR)&profile1;
+ standardprofileW = (LPWSTR)&profile1W;
+ CloseHandle( handle );
+ }
+
+ handle = CreateFileA( (LPCSTR)&profile2, 0 , 0, NULL, OPEN_EXISTING, 0, NULL );
+
+ if (handle != INVALID_HANDLE_VALUE)
+ {
+ standardprofile = (LPSTR)&profile2;
+ standardprofileW = (LPWSTR)&profile2W;
+ 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();
+
+ test_InstallColorProfileA();
+ test_InstallColorProfileW();
+
+ test_OpenColorProfileA();
+ test_OpenColorProfileW();
+
+ test_UninstallColorProfileA();
+ test_UninstallColorProfileW();
+
+ /* Clean up */
+ if (testprofile)
+ DeleteFileA( testprofile );
+}
diff --git a/include/config.h.in b/include/config.h.in
index c791121..6e42a46 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -245,9 +245,6 @@
/* Define to 1 if you have the <jpeglib.h> header file. */
#undef HAVE_JPEGLIB_H
-/* Define if you have lcms libs and headers */
-#undef HAVE_LCMS
-
/* Define to 1 if you have the <lcms.h> header file. */
#undef HAVE_LCMS_H
@@ -905,6 +902,9 @@
/* Define to the soname of the libjpeg library. */
#undef SONAME_LIBJPEG
+/* Define to the soname of the liblcms library. */
+#undef SONAME_LIBLCMS
+
/* Define to the soname of the libncurses library. */
#undef SONAME_LIBNCURSES
diff --git a/include/icm.h b/include/icm.h
index 7d71f57..9854aa0 100644
--- a/include/icm.h
+++ b/include/icm.h
@@ -98,14 +98,30 @@
DWORD cbDataSize;
} PROFILE, *PPROFILE, *LPPROFILE;
+BOOL WINAPI GetColorDirectoryA(PCSTR,PSTR,PDWORD);
+BOOL WINAPI GetColorDirectoryW(PCWSTR,PWSTR,PDWORD);
+#define GetColorDirectory WINELIB_NAME_AW(GetColorDirectory)
+
+BOOL WINAPI InstallColorProfileA(PCSTR,PCSTR);
+BOOL WINAPI InstallColorProfileW(PCWSTR,PCWSTR);
+#define InstallColorProfile WINELIB_NAME_AW(InstallColorProfile)
+
+BOOL WINAPI UninstallColorProfileA(PCSTR,PCSTR,BOOL);
+BOOL WINAPI UninstallColorProfileW(PCWSTR,PCWSTR,BOOL);
+#define UninstallColorProfile WINELIB_NAME_AW(UninstallColorProfile)
+
HPROFILE WINAPI OpenColorProfileA(PPROFILE,DWORD,DWORD,DWORD);
HPROFILE WINAPI OpenColorProfileW(PPROFILE,DWORD,DWORD,DWORD);
#define OpenColorProfile WINELIB_NAME_AW(OpenColorProfile)
+
BOOL WINAPI CloseColorProfile(HPROFILE);
#define PROFILE_FILENAME 1
#define PROFILE_MEMBUFFER 2
+#define PROFILE_READ 1
+#define PROFILE_READWRITE 2
+
#ifdef __cplusplus
}
#endif