2 * Image Color Management
4 * Copyright 2004 Marcus Meissner
5 * Copyright 2008 Hans Leidekker
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
33 #include "wine/debug.h"
34 #include "wine/unicode.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(icm
);
39 /***********************************************************************
40 * EnumICMProfilesA (GDI32.@)
42 INT WINAPI
EnumICMProfilesA(HDC hdc
, ICMENUMPROCA func
, LPARAM lparam
)
44 FIXME("%p, %p, 0x%08lx stub\n", hdc
, func
, lparam
);
48 /***********************************************************************
49 * EnumICMProfilesW (GDI32.@)
51 INT WINAPI
EnumICMProfilesW(HDC hdc
, ICMENUMPROCW func
, LPARAM lparam
)
53 FIXME("%p, %p, 0x%08lx stub\n", hdc
, func
, lparam
);
57 /**********************************************************************
58 * GetICMProfileA (GDI32.@)
60 * Returns the filename of the specified device context's color
61 * management profile, even if color management is not enabled
65 * TRUE if filename is copied successfully.
66 * FALSE if the buffer length pointed to by size is too small.
69 * How does Windows assign these? Some registry key?
71 BOOL WINAPI
GetICMProfileA(HDC hdc
, LPDWORD size
, LPSTR filename
)
73 WCHAR filenameW
[MAX_PATH
];
74 DWORD buflen
= MAX_PATH
;
77 TRACE("%p, %p, %p\n", hdc
, size
, filename
);
79 if (!hdc
|| !size
|| !filename
) return FALSE
;
81 if (GetICMProfileW(hdc
, &buflen
, filenameW
))
83 int len
= WideCharToMultiByte(CP_ACP
, 0, filenameW
, -1, NULL
, 0, NULL
, NULL
);
86 WideCharToMultiByte(CP_ACP
, 0, filenameW
, -1, filename
, *size
, NULL
, NULL
);
89 else SetLastError(ERROR_INSUFFICIENT_BUFFER
);
95 /**********************************************************************
96 * GetICMProfileW (GDI32.@)
98 BOOL WINAPI
GetICMProfileW(HDC hdc
, LPDWORD size
, LPWSTR filename
)
102 WCHAR profile
[MAX_PATH
], fullname
[MAX_PATH
];
103 static const WCHAR path
[] =
104 {'\\','s','p','o','o','l','\\','d','r','i','v','e','r','s',
105 '\\','c','o','l','o','r','\\',0};
106 static const WCHAR srgb
[] =
107 {'s','R','G','B',' ','C','o','l','o','r',' ','S','p','a','c','e',' ',
108 'P','r','o','f','i','l','e','.','i','c','m',0};
109 static const WCHAR mntr
[] =
110 {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
111 'W','i','n','d','o','w','s',' ','N','T','\\','C','u','r','r','e','n','t',
112 'V','e','r','s','i','o','n','\\','I','C','M','\\','m','n','t','r',0};
114 TRACE("%p, %p, %p\n", hdc
, size
, filename
);
116 if (!hdc
|| !size
) return FALSE
;
118 strcpyW(profile
, srgb
);
119 if (!RegCreateKeyExW(HKEY_LOCAL_MACHINE
, mntr
, 0, NULL
, 0, KEY_ALL_ACCESS
, NULL
, &hkey
, NULL
))
121 DWORD size
= sizeof(profile
) / sizeof(WCHAR
);
122 /* FIXME handle multiple values */
123 RegEnumValueW(hkey
, 0, profile
, &size
, NULL
, NULL
, NULL
, NULL
);
126 GetSystemDirectoryW(fullname
, MAX_PATH
);
127 strcatW(fullname
, path
);
128 strcatW(fullname
, profile
);
130 required
= strlenW(fullname
) + 1;
131 if (*size
< required
)
134 SetLastError(ERROR_INSUFFICIENT_BUFFER
);
139 strcpyW(filename
, fullname
);
140 if (GetFileAttributesW(filename
) == INVALID_FILE_ATTRIBUTES
)
141 WARN("color profile not found\n");
147 /**********************************************************************
148 * GetLogColorSpaceA (GDI32.@)
150 BOOL WINAPI
GetLogColorSpaceA(HCOLORSPACE colorspace
, LPLOGCOLORSPACEA buffer
, DWORD size
)
152 FIXME("%p %p 0x%08x stub\n", colorspace
, buffer
, size
);
156 /**********************************************************************
157 * GetLogColorSpaceW (GDI32.@)
159 BOOL WINAPI
GetLogColorSpaceW(HCOLORSPACE colorspace
, LPLOGCOLORSPACEW buffer
, DWORD size
)
161 FIXME("%p %p 0x%08x stub\n", colorspace
, buffer
, size
);
165 /**********************************************************************
166 * SetICMProfileA (GDI32.@)
168 BOOL WINAPI
SetICMProfileA(HDC hdc
, LPSTR filename
)
170 FIXME("%p %s stub\n", hdc
, debugstr_a(filename
));
174 /**********************************************************************
175 * SetICMProfileW (GDI32.@)
177 BOOL WINAPI
SetICMProfileW(HDC hdc
, LPWSTR filename
)
179 FIXME("%p %s stub\n", hdc
, debugstr_w(filename
));
183 /**********************************************************************
184 * UpdateICMRegKeyA (GDI32.@)
186 BOOL WINAPI
UpdateICMRegKeyA(DWORD reserved
, LPSTR cmid
, LPSTR filename
, UINT command
)
188 FIXME("0x%08x, %s, %s, 0x%08x stub\n", reserved
, debugstr_a(cmid
), debugstr_a(filename
), command
);
192 /**********************************************************************
193 * UpdateICMRegKeyW (GDI32.@)
195 BOOL WINAPI
UpdateICMRegKeyW(DWORD reserved
, LPWSTR cmid
, LPWSTR filename
, UINT command
)
197 FIXME("0x%08x, %s, %s, 0x%08x stub\n", reserved
, debugstr_w(cmid
), debugstr_w(filename
), command
);