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@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8c12672b06
commit
aeec35ab5a
|
@ -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
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue