Hans Leidekker : mscms: Add a partial implementation of WcsOpenColorProfileA/W.
Alexandre Julliard
julliard at winehq.org
Wed May 15 14:32:21 CDT 2019
Module: wine
Branch: stable
Commit: fc1c66874574fe894f1ec725d2a1b419908c9186
URL: https://source.winehq.org/git/wine.git/?a=commit;h=fc1c66874574fe894f1ec725d2a1b419908c9186
Author: Hans Leidekker <hans at codeweavers.com>
Date: Mon Feb 25 09:12:36 2019 +0100
mscms: Add a partial implementation of WcsOpenColorProfileA/W.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46708
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit aeec35ab5a2a9f3239bf46699264ed9e1ef5a8b0)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
dlls/mscms/mscms.spec | 4 +--
dlls/mscms/profile.c | 71 +++++++++++++++++++++++++++++++++++++--------------
include/icm.h | 2 ++
3 files changed, 56 insertions(+), 21 deletions(-)
diff --git a/dlls/mscms/mscms.spec b/dlls/mscms/mscms.spec
index f521ac6..fec0af5 100644
--- a/dlls/mscms/mscms.spec
+++ b/dlls/mscms/mscms.spec
@@ -96,8 +96,8 @@
@ stub WcsGetDefaultRenderingIntent
@ stdcall WcsGetUsePerUserProfiles(wstr long ptr)
@ stub WcsGpCanInstallOrUninstallProfiles
-@ stub WcsOpenColorProfileA
-@ stub WcsOpenColorProfileW
+@ stdcall WcsOpenColorProfileA(ptr ptr ptr long long long long)
+@ stdcall WcsOpenColorProfileW(ptr ptr ptr long long long long)
@ stub WcsSetCalibrationManagementState
@ stub WcsSetDefaultColorProfile
@ stub WcsSetDefaultRenderingIntent
diff --git a/dlls/mscms/profile.c b/dlls/mscms/profile.c
index a0b9d41..6bc55e7 100644
--- a/dlls/mscms/profile.c
+++ b/dlls/mscms/profile.c
@@ -1327,6 +1327,18 @@ BOOL WINAPI UninstallColorProfileW( PCWSTR machine, PCWSTR profile, BOOL delete
return TRUE;
}
+static BOOL profile_AtoW( const PROFILE *in, PROFILE *out )
+{
+ int len;
+ if (!in->pProfileData) return FALSE;
+ len = MultiByteToWideChar( CP_ACP, 0, in->pProfileData, -1, NULL, 0 );
+ if (!(out->pProfileData = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return FALSE;
+ out->cbDataSize = len * sizeof(WCHAR);
+ MultiByteToWideChar( CP_ACP, 0, in->pProfileData, -1, out->pProfileData, len );
+ out->dwType = in->dwType;
+ return TRUE;
+}
+
/******************************************************************************
* OpenColorProfileA [MSCMS.@]
*
@@ -1335,6 +1347,7 @@ BOOL WINAPI UninstallColorProfileW( PCWSTR machine, PCWSTR profile, BOOL delete
HPROFILE WINAPI OpenColorProfileA( PPROFILE profile, DWORD access, DWORD sharing, DWORD creation )
{
HPROFILE handle = NULL;
+ PROFILE profileW;
TRACE( "( %p, 0x%08x, 0x%08x, 0x%08x )\n", profile, access, sharing, creation );
@@ -1344,25 +1357,9 @@ HPROFILE WINAPI OpenColorProfileA( PPROFILE profile, DWORD access, DWORD sharing
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 );
- }
- }
+ if (!profile_AtoW( profile, &profileW )) return FALSE;
+ handle = OpenColorProfileW( &profileW, access, sharing, creation );
+ HeapFree( GetProcessHeap(), 0, profileW.pProfileData );
return handle;
}
@@ -1546,3 +1543,39 @@ BOOL WINAPI WcsEnumColorProfilesSize( WCS_PROFILE_MANAGEMENT_SCOPE scope, ENUMTY
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return FALSE;
}
+
+/******************************************************************************
+ * WcsOpenColorProfileA [MSCMS.@]
+ */
+HPROFILE WINAPI WcsOpenColorProfileA( PROFILE *cdm, PROFILE *camp, PROFILE *gmmp, DWORD access, DWORD sharing,
+ DWORD creation, DWORD flags )
+{
+ PROFILE cdmW, campW = {0}, gmmpW = {0};
+ HPROFILE ret = NULL;
+
+ TRACE( "%p, %p, %p, %08x, %08x, %08x, %08x\n", cdm, camp, gmmp, access, sharing, creation, flags );
+
+ if (!cdm || !profile_AtoW( cdm, &cdmW )) return NULL;
+ if (camp && !profile_AtoW( camp, &campW )) goto done;
+ if (gmmp && !profile_AtoW( gmmp, &gmmpW )) goto done;
+
+ ret = WcsOpenColorProfileW( &cdmW, &campW, &gmmpW, access, sharing, creation, flags );
+
+done:
+ HeapFree( GetProcessHeap(), 0, cdmW.pProfileData );
+ HeapFree( GetProcessHeap(), 0, campW.pProfileData );
+ HeapFree( GetProcessHeap(), 0, gmmpW.pProfileData );
+ return ret;
+}
+
+/******************************************************************************
+ * WcsOpenColorProfileW [MSCMS.@]
+ */
+HPROFILE WINAPI WcsOpenColorProfileW( PROFILE *cdm, PROFILE *camp, PROFILE *gmmp, DWORD access, DWORD sharing,
+ DWORD creation, DWORD flags )
+{
+ TRACE( "%p, %p, %p, %08x, %08x, %08x, %08x\n", cdm, camp, gmmp, access, sharing, creation, flags );
+ FIXME("no support for WCS profiles\n" );
+
+ return OpenColorProfileW( cdm, access, sharing, creation );
+}
diff --git a/include/icm.h b/include/icm.h
index fbbdede..de5bf26 100644
--- a/include/icm.h
+++ b/include/icm.h
@@ -411,6 +411,8 @@ BOOL WINAPI UnregisterCMMW(PCWSTR,DWORD);
#define UnregisterCMM WINELIB_NAME_AW(UnregisterCMM)
BOOL WINAPI WcsEnumColorProfilesSize(WCS_PROFILE_MANAGEMENT_SCOPE,ENUMTYPEW*,DWORD*);
BOOL WINAPI WcsGetUsePerUserProfiles(const WCHAR*,DWORD,BOOL*);
+HPROFILE WINAPI WcsOpenColorProfileA(PROFILE*,PROFILE*,PROFILE*,DWORD,DWORD,DWORD,DWORD);
+HPROFILE WINAPI WcsOpenColorProfileW(PROFILE*,PROFILE*,PROFILE*,DWORD,DWORD,DWORD,DWORD);
#define PROFILE_FILENAME 1
#define PROFILE_MEMBUFFER 2
More information about the wine-cvs
mailing list