From d6bb9e76b307d2d2a8c83e13ed2b69ddc3cf5c79 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Wed, 27 Feb 2008 15:13:44 +0100 Subject: [PATCH] gdi32: Return registered monitor profile from GetICMProfile. --- dlls/gdi32/icm.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/dlls/gdi32/icm.c b/dlls/gdi32/icm.c index 860a6f25443..12d1f3b1f22 100644 --- a/dlls/gdi32/icm.c +++ b/dlls/gdi32/icm.c @@ -28,6 +28,7 @@ #include "winbase.h" #include "wingdi.h" #include "winnls.h" +#include "winreg.h" #include "wine/debug.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) { + HKEY hkey; DWORD required; - WCHAR systemdir[MAX_PATH]; - static const WCHAR profile[] = + WCHAR profile[MAX_PATH], fullname[MAX_PATH]; + static const WCHAR path[] = {'\\','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}; + '\\','c','o','l','o','r','\\',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); if (!hdc || !size) return FALSE; - required = GetSystemDirectoryW(systemdir, MAX_PATH); - required += sizeof(profile) / sizeof(WCHAR); + strcpyW(profile, srgb); + 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) { *size = required; @@ -118,9 +136,7 @@ BOOL WINAPI GetICMProfileW(HDC hdc, LPDWORD size, LPWSTR filename) } if (filename) { - strcpyW(filename, systemdir); - strcatW(filename, profile); - + strcpyW(filename, fullname); if (GetFileAttributesW(filename) == INVALID_FILE_ATTRIBUTES) WARN("color profile not found\n"); } -- 2.11.4.GIT