gdi32: Return registered monitor profile from GetICMProfile.
This commit is contained in:
parent
eaea28e5d8
commit
d6bb9e76b3
@ -28,6 +28,7 @@
|
|||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "wingdi.h"
|
#include "wingdi.h"
|
||||||
#include "winnls.h"
|
#include "winnls.h"
|
||||||
|
#include "winreg.h"
|
||||||
|
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
#include "wine/unicode.h"
|
#include "wine/unicode.h"
|
||||||
@ -96,20 +97,37 @@ BOOL WINAPI GetICMProfileA(HDC hdc, LPDWORD size, LPSTR filename)
|
|||||||
*/
|
*/
|
||||||
BOOL WINAPI GetICMProfileW(HDC hdc, LPDWORD size, LPWSTR filename)
|
BOOL WINAPI GetICMProfileW(HDC hdc, LPDWORD size, LPWSTR filename)
|
||||||
{
|
{
|
||||||
|
HKEY hkey;
|
||||||
DWORD required;
|
DWORD required;
|
||||||
WCHAR systemdir[MAX_PATH];
|
WCHAR profile[MAX_PATH], fullname[MAX_PATH];
|
||||||
static const WCHAR profile[] =
|
static const WCHAR path[] =
|
||||||
{'\\','s','p','o','o','l','\\','d','r','i','v','e','r','s',
|
{'\\','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',' ',
|
'\\','c','o','l','o','r','\\',0};
|
||||||
'S','p','a','c','e',' ','P','r','o','f','i','l','e','.','i','c','m',0};
|
static const WCHAR srgb[] =
|
||||||
|
{'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 mntr[] =
|
||||||
|
{'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
|
||||||
|
'W','i','n','d','o','w','s',' ','N','T','\\','C','u','r','r','e','n','t',
|
||||||
|
'V','e','r','s','i','o','n','\\','I','C','M','\\','m','n','t','r',0};
|
||||||
|
|
||||||
TRACE("%p, %p, %p\n", hdc, size, filename);
|
TRACE("%p, %p, %p\n", hdc, size, filename);
|
||||||
|
|
||||||
if (!hdc || !size) return FALSE;
|
if (!hdc || !size) return FALSE;
|
||||||
|
|
||||||
required = GetSystemDirectoryW(systemdir, MAX_PATH);
|
strcpyW(profile, srgb);
|
||||||
required += sizeof(profile) / sizeof(WCHAR);
|
if (!RegCreateKeyExW(HKEY_LOCAL_MACHINE, mntr, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL))
|
||||||
|
{
|
||||||
|
DWORD size = sizeof(profile) / sizeof(WCHAR);
|
||||||
|
/* FIXME handle multiple values */
|
||||||
|
RegEnumValueW(hkey, 0, profile, &size, NULL, NULL, NULL, NULL);
|
||||||
|
RegCloseKey(hkey);
|
||||||
|
}
|
||||||
|
GetSystemDirectoryW(fullname, MAX_PATH);
|
||||||
|
strcatW(fullname, path);
|
||||||
|
strcatW(fullname, profile);
|
||||||
|
|
||||||
|
required = strlenW(fullname) + 1;
|
||||||
if (*size < required)
|
if (*size < required)
|
||||||
{
|
{
|
||||||
*size = required;
|
*size = required;
|
||||||
@ -118,9 +136,7 @@ BOOL WINAPI GetICMProfileW(HDC hdc, LPDWORD size, LPWSTR filename)
|
|||||||
}
|
}
|
||||||
if (filename)
|
if (filename)
|
||||||
{
|
{
|
||||||
strcpyW(filename, systemdir);
|
strcpyW(filename, fullname);
|
||||||
strcatW(filename, profile);
|
|
||||||
|
|
||||||
if (GetFileAttributesW(filename) == INVALID_FILE_ATTRIBUTES)
|
if (GetFileAttributesW(filename) == INVALID_FILE_ATTRIBUTES)
|
||||||
WARN("color profile not found\n");
|
WARN("color profile not found\n");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user