kernelbase: Let GetModuleBaseName succeed on 64bit modules in wow64.
[wine.git] / dlls / gdi32 / icm.c
blob549c09c16b03667fb47a90d00b61d40e4d2cd215
1 /*
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
22 #include "gdi_private.h"
23 #include "winnls.h"
25 #include "wine/debug.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(icm);
30 struct enum_profiles
32 ICMENUMPROCA funcA;
33 LPARAM data;
36 static INT CALLBACK enum_profiles_callbackA( LPWSTR filename, LPARAM lparam )
38 int len, ret = -1;
39 struct enum_profiles *ep = (struct enum_profiles *)lparam;
40 char *filenameA;
42 len = WideCharToMultiByte( CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL );
43 filenameA = HeapAlloc( GetProcessHeap(), 0, len );
44 if (filenameA)
46 WideCharToMultiByte( CP_ACP, 0, filename, -1, filenameA, len, NULL, NULL );
47 ret = ep->funcA( filenameA, ep->data );
48 HeapFree( GetProcessHeap(), 0, filenameA );
50 return ret;
53 /***********************************************************************
54 * EnumICMProfilesA (GDI32.@)
56 INT WINAPI EnumICMProfilesA(HDC hdc, ICMENUMPROCA func, LPARAM lparam)
58 struct enum_profiles ep;
60 if (!func) return -1;
61 ep.funcA = func;
62 ep.data = lparam;
63 return EnumICMProfilesW( hdc, enum_profiles_callbackA, (LPARAM)&ep );
66 /***********************************************************************
67 * EnumICMProfilesW (GDI32.@)
69 INT WINAPI EnumICMProfilesW(HDC hdc, ICMENUMPROCW func, LPARAM lparam)
71 WCHAR profile[MAX_PATH];
72 DWORD size = ARRAYSIZE(profile);
74 TRACE( "%p, %p, 0x%08Ix\n", hdc, func, lparam );
76 if (!func) return -1;
77 if (!__wine_get_icm_profile( hdc, FALSE, &size, profile )) return -1;
78 /* FIXME: support multiple profiles */
79 return func( profile, lparam );
82 /**********************************************************************
83 * GetICMProfileA (GDI32.@)
85 * Returns the filename of the specified device context's color
86 * management profile, even if color management is not enabled
87 * for that DC.
89 * RETURNS
90 * TRUE if filename is copied successfully.
91 * FALSE if the buffer length pointed to by size is too small.
93 * FIXME
94 * How does Windows assign these? Some registry key?
96 BOOL WINAPI GetICMProfileA(HDC hdc, LPDWORD size, LPSTR filename)
98 WCHAR filenameW[MAX_PATH];
99 DWORD buflen = MAX_PATH;
100 BOOL ret = FALSE;
102 TRACE("%p, %p, %p\n", hdc, size, filename);
104 if (!hdc || !size) return FALSE;
106 if (GetICMProfileW(hdc, &buflen, filenameW))
108 int len = WideCharToMultiByte(CP_ACP, 0, filenameW, -1, NULL, 0, NULL, NULL);
110 if (!filename)
112 *size = len;
113 return FALSE;
116 if (*size >= len)
118 WideCharToMultiByte(CP_ACP, 0, filenameW, -1, filename, *size, NULL, NULL);
119 ret = TRUE;
121 else SetLastError(ERROR_INSUFFICIENT_BUFFER);
122 *size = len;
124 return ret;
127 /**********************************************************************
128 * GetICMProfileW (GDI32.@)
130 BOOL WINAPI GetICMProfileW(HDC hdc, LPDWORD size, LPWSTR filename)
132 TRACE("%p, %p, %p\n", hdc, size, filename);
134 return __wine_get_icm_profile( hdc, TRUE, size, filename );
137 /**********************************************************************
138 * GetLogColorSpaceA (GDI32.@)
140 BOOL WINAPI GetLogColorSpaceA(HCOLORSPACE colorspace, LPLOGCOLORSPACEA buffer, DWORD size)
142 FIXME("%p %p 0x%08lx stub\n", colorspace, buffer, size);
143 return FALSE;
146 /**********************************************************************
147 * GetLogColorSpaceW (GDI32.@)
149 BOOL WINAPI GetLogColorSpaceW(HCOLORSPACE colorspace, LPLOGCOLORSPACEW buffer, DWORD size)
151 FIXME("%p %p 0x%08lx stub\n", colorspace, buffer, size);
152 return FALSE;
155 /**********************************************************************
156 * SetICMProfileA (GDI32.@)
158 BOOL WINAPI SetICMProfileA(HDC hdc, LPSTR filename)
160 FIXME("%p %s stub\n", hdc, debugstr_a(filename));
162 if (!filename)
164 SetLastError( ERROR_INVALID_PARAMETER );
165 return FALSE;
167 if (!hdc)
169 SetLastError( ERROR_INVALID_HANDLE );
170 return FALSE;
172 return TRUE;
175 /**********************************************************************
176 * SetICMProfileW (GDI32.@)
178 BOOL WINAPI SetICMProfileW(HDC hdc, LPWSTR filename)
180 FIXME("%p %s stub\n", hdc, debugstr_w(filename));
182 if (!filename)
184 SetLastError( ERROR_INVALID_PARAMETER );
185 return FALSE;
187 if (!hdc)
189 SetLastError( ERROR_INVALID_HANDLE );
190 return FALSE;
192 return TRUE;
195 /**********************************************************************
196 * UpdateICMRegKeyA (GDI32.@)
198 BOOL WINAPI UpdateICMRegKeyA(DWORD reserved, LPSTR cmid, LPSTR filename, UINT command)
200 FIXME("0x%08lx, %s, %s, 0x%08x stub\n", reserved, debugstr_a(cmid), debugstr_a(filename), command);
201 return TRUE;
204 /**********************************************************************
205 * UpdateICMRegKeyW (GDI32.@)
207 BOOL WINAPI UpdateICMRegKeyW(DWORD reserved, LPWSTR cmid, LPWSTR filename, UINT command)
209 FIXME("0x%08lx, %s, %s, 0x%08x stub\n", reserved, debugstr_w(cmid), debugstr_w(filename), command);
210 return TRUE;