Release 1.3.7.
[wine/gsoc-2012-control.git] / dlls / gdi32 / gdiobj.c
blob196ebc95e53e71e87d88847ff759758ca94ba076
1 /*
2 * GDI functions
4 * Copyright 1993 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
23 #include <assert.h>
24 #include <stdlib.h>
25 #include <stdarg.h>
26 #include <stdio.h>
28 #include "windef.h"
29 #include "winbase.h"
30 #include "wingdi.h"
31 #include "winreg.h"
32 #include "winnls.h"
33 #include "winerror.h"
34 #include "winternl.h"
36 #include "gdi_private.h"
37 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(gdi);
41 #define HGDIOBJ_32(h16) ((HGDIOBJ)(ULONG_PTR)(h16))
43 #define GDI_HEAP_SIZE 0xffe0
45 /***********************************************************************
46 * GDI stock objects
49 static const LOGBRUSH WhiteBrush = { BS_SOLID, RGB(255,255,255), 0 };
50 static const LOGBRUSH BlackBrush = { BS_SOLID, RGB(0,0,0), 0 };
51 static const LOGBRUSH NullBrush = { BS_NULL, 0, 0 };
53 static const LOGBRUSH LtGrayBrush = { BS_SOLID, RGB(192,192,192), 0 };
54 static const LOGBRUSH GrayBrush = { BS_SOLID, RGB(128,128,128), 0 };
55 static const LOGBRUSH DkGrayBrush = { BS_SOLID, RGB(64,64,64), 0 };
57 static const LOGPEN WhitePen = { PS_SOLID, { 0, 0 }, RGB(255,255,255) };
58 static const LOGPEN BlackPen = { PS_SOLID, { 0, 0 }, RGB(0,0,0) };
59 static const LOGPEN NullPen = { PS_NULL, { 0, 0 }, 0 };
61 static const LOGBRUSH DCBrush = { BS_SOLID, RGB(255,255,255), 0 };
62 static const LOGPEN DCPen = { PS_SOLID, { 0, 0 }, RGB(0,0,0) };
64 /* reserve one extra entry for the stock default bitmap */
65 /* this is what Windows does too */
66 #define NB_STOCK_OBJECTS (STOCK_LAST+2)
68 static HGDIOBJ stock_objects[NB_STOCK_OBJECTS];
70 static CRITICAL_SECTION gdi_section;
71 static CRITICAL_SECTION_DEBUG critsect_debug =
73 0, 0, &gdi_section,
74 { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
75 0, 0, { (DWORD_PTR)(__FILE__ ": gdi_section") }
77 static CRITICAL_SECTION gdi_section = { &critsect_debug, -1, 0, 0, 0, 0 };
80 /****************************************************************************
82 * language-independent stock fonts
86 static const LOGFONTW OEMFixedFont =
87 { 12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, OEM_CHARSET,
88 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, {'\0'} };
90 static const LOGFONTW AnsiFixedFont =
91 { 12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
92 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
93 {'C','o','u','r','i','e','r','\0'} };
95 static const LOGFONTW AnsiVarFont =
96 { 12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
97 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
98 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'} };
100 /******************************************************************************
102 * language-dependent stock fonts
104 * 'ANSI' charset and 'DEFAULT' charset is not same.
105 * The chars in CP_ACP should be drawn with 'DEFAULT' charset.
106 * 'ANSI' charset seems to be identical with ISO-8859-1.
107 * 'DEFAULT' charset is a language-dependent charset.
109 * 'System' font seems to be an alias for language-dependent font.
113 * language-dependent stock fonts for all known charsets
114 * please see TranslateCharsetInfo (dlls/gdi/font.c) and
115 * CharsetBindingInfo (dlls/x11drv/xfont.c),
116 * and modify entries for your language if needed.
118 struct DefaultFontInfo
120 UINT charset;
121 LOGFONTW SystemFont;
122 LOGFONTW DeviceDefaultFont;
123 LOGFONTW SystemFixedFont;
124 LOGFONTW DefaultGuiFont; /* Note for this font the lfHeight member should be the point size */
127 static const struct DefaultFontInfo default_fonts[] =
129 { ANSI_CHARSET,
130 { /* System */
131 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
132 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
133 {'S','y','s','t','e','m','\0'}
135 { /* Device Default */
136 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
137 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
138 {'\0'}
140 { /* System Fixed */
141 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
142 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
143 {'\0'}
145 { /* DefaultGuiFont */
146 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
147 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
148 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
151 { EASTEUROPE_CHARSET,
152 { /* System */
153 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, EASTEUROPE_CHARSET,
154 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
155 {'S','y','s','t','e','m','\0'}
157 { /* Device Default */
158 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, EASTEUROPE_CHARSET,
159 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
160 {'\0'}
162 { /* System Fixed */
163 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, EASTEUROPE_CHARSET,
164 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
165 {'\0'}
167 { /* DefaultGuiFont */
168 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, EASTEUROPE_CHARSET,
169 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
170 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
173 { RUSSIAN_CHARSET,
174 { /* System */
175 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, RUSSIAN_CHARSET,
176 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
177 {'S','y','s','t','e','m','\0'}
179 { /* Device Default */
180 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, RUSSIAN_CHARSET,
181 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
182 {'\0'}
184 { /* System Fixed */
185 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, RUSSIAN_CHARSET,
186 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
187 {'\0'}
189 { /* DefaultGuiFont */
190 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, RUSSIAN_CHARSET,
191 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
192 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
195 { GREEK_CHARSET,
196 { /* System */
197 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GREEK_CHARSET,
198 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
199 {'S','y','s','t','e','m','\0'}
201 { /* Device Default */
202 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GREEK_CHARSET,
203 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
204 {'\0'}
206 { /* System Fixed */
207 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GREEK_CHARSET,
208 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
209 {'\0'}
211 { /* DefaultGuiFont */
212 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GREEK_CHARSET,
213 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
214 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
217 { TURKISH_CHARSET,
218 { /* System */
219 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, TURKISH_CHARSET,
220 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
221 {'S','y','s','t','e','m','\0'}
223 { /* Device Default */
224 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, TURKISH_CHARSET,
225 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
226 {'\0'}
228 { /* System Fixed */
229 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, TURKISH_CHARSET,
230 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
231 {'\0'}
233 { /* DefaultGuiFont */
234 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, TURKISH_CHARSET,
235 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
236 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
239 { HEBREW_CHARSET,
240 { /* System */
241 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HEBREW_CHARSET,
242 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
243 {'S','y','s','t','e','m','\0'}
245 { /* Device Default */
246 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HEBREW_CHARSET,
247 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
248 {'\0'}
250 { /* System Fixed */
251 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HEBREW_CHARSET,
252 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
253 {'\0'}
255 { /* DefaultGuiFont */
256 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HEBREW_CHARSET,
257 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
258 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
261 { ARABIC_CHARSET,
262 { /* System */
263 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ARABIC_CHARSET,
264 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
265 {'S','y','s','t','e','m','\0'}
267 { /* Device Default */
268 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ARABIC_CHARSET,
269 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
270 {'\0'}
272 { /* System Fixed */
273 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ARABIC_CHARSET,
274 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
275 {'\0'}
277 { /* DefaultGuiFont */
278 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ARABIC_CHARSET,
279 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
280 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
283 { BALTIC_CHARSET,
284 { /* System */
285 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, BALTIC_CHARSET,
286 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
287 {'S','y','s','t','e','m','\0'}
289 { /* Device Default */
290 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, BALTIC_CHARSET,
291 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
292 {'\0'}
294 { /* System Fixed */
295 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, BALTIC_CHARSET,
296 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
297 {'\0'}
299 { /* DefaultGuiFont */
300 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, BALTIC_CHARSET,
301 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
302 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
305 { THAI_CHARSET,
306 { /* System */
307 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, THAI_CHARSET,
308 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
309 {'S','y','s','t','e','m','\0'}
311 { /* Device Default */
312 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, THAI_CHARSET,
313 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
314 {'\0'}
316 { /* System Fixed */
317 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, THAI_CHARSET,
318 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
319 {'\0'}
321 { /* DefaultGuiFont */
322 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, THAI_CHARSET,
323 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
324 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
327 { SHIFTJIS_CHARSET,
328 { /* System */
329 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET,
330 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
331 {'S','y','s','t','e','m','\0'}
333 { /* Device Default */
334 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET,
335 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
336 {'\0'}
338 { /* System Fixed */
339 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET,
340 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
341 {'\0'}
343 { /* DefaultGuiFont */
344 9, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET,
345 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
346 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
349 { GB2312_CHARSET,
350 { /* System */
351 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GB2312_CHARSET,
352 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
353 {'S','y','s','t','e','m','\0'}
355 { /* Device Default */
356 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GB2312_CHARSET,
357 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
358 {'\0'}
360 { /* System Fixed */
361 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GB2312_CHARSET,
362 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
363 {'\0'}
365 { /* DefaultGuiFont */
366 9, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GB2312_CHARSET,
367 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
368 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
371 { HANGEUL_CHARSET,
372 { /* System */
373 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HANGEUL_CHARSET,
374 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
375 {'S','y','s','t','e','m','\0'}
377 { /* Device Default */
378 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HANGEUL_CHARSET,
379 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
380 {'\0'}
382 { /* System Fixed */
383 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HANGEUL_CHARSET,
384 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
385 {'\0'}
387 { /* DefaultGuiFont */
388 9, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HANGEUL_CHARSET,
389 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
390 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
393 { CHINESEBIG5_CHARSET,
394 { /* System */
395 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, CHINESEBIG5_CHARSET,
396 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
397 {'S','y','s','t','e','m','\0'}
399 { /* Device Default */
400 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, CHINESEBIG5_CHARSET,
401 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
402 {'\0'}
404 { /* System Fixed */
405 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, CHINESEBIG5_CHARSET,
406 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
407 {'\0'}
409 { /* DefaultGuiFont */
410 9, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, CHINESEBIG5_CHARSET,
411 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
412 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
415 { JOHAB_CHARSET,
416 { /* System */
417 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, JOHAB_CHARSET,
418 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
419 {'S','y','s','t','e','m','\0'}
421 { /* Device Default */
422 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, JOHAB_CHARSET,
423 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
424 {'\0'}
426 { /* System Fixed */
427 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, JOHAB_CHARSET,
428 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
429 {'\0'}
431 { /* DefaultGuiFont */
432 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, JOHAB_CHARSET,
433 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
434 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
440 /*************************************************************************
441 * __wine_make_gdi_object_system (GDI32.@)
443 * USER has to tell GDI that its system brushes and pens are non-deletable.
444 * For a description of the GDI object magics and their flags,
445 * see "Undocumented Windows" (wrong about the OBJECT_NOSYSTEM flag, though).
447 void CDECL __wine_make_gdi_object_system( HGDIOBJ handle, BOOL set)
449 GDIOBJHDR *ptr = GDI_GetObjPtr( handle, 0 );
450 ptr->system = !!set;
451 GDI_ReleaseObj( handle );
454 /******************************************************************************
455 * get_default_fonts
457 static const struct DefaultFontInfo* get_default_fonts(UINT charset)
459 unsigned int n;
461 for(n=0;n<(sizeof(default_fonts)/sizeof(default_fonts[0]));n++)
463 if ( default_fonts[n].charset == charset )
464 return &default_fonts[n];
467 FIXME( "unhandled charset 0x%08x - use ANSI_CHARSET for default stock objects\n", charset );
468 return &default_fonts[0];
472 /******************************************************************************
473 * get_default_charset (internal)
475 * get the language-dependent charset that can handle CP_ACP correctly.
477 static UINT get_default_charset( void )
479 CHARSETINFO csi;
480 UINT uACP;
482 uACP = GetACP();
483 csi.ciCharset = ANSI_CHARSET;
484 if ( !TranslateCharsetInfo( ULongToPtr(uACP), &csi, TCI_SRCCODEPAGE ) )
486 FIXME( "unhandled codepage %u - use ANSI_CHARSET for default stock objects\n", uACP );
487 return ANSI_CHARSET;
490 return csi.ciCharset;
493 static const WCHAR dpi_key_name[] = {'S','o','f','t','w','a','r','e','\\','F','o','n','t','s','\0'};
494 static const WCHAR dpi_value_name[] = {'L','o','g','P','i','x','e','l','s','\0'};
496 /******************************************************************************
497 * get_dpi (internal)
499 * get the dpi from the registry
501 static DWORD get_dpi( void )
503 DWORD dpi = 96;
504 HKEY hkey;
506 if (RegOpenKeyW(HKEY_CURRENT_CONFIG, dpi_key_name, &hkey) == ERROR_SUCCESS)
508 DWORD type, size, new_dpi;
510 size = sizeof(new_dpi);
511 if(RegQueryValueExW(hkey, dpi_value_name, NULL, &type, (void *)&new_dpi, &size) == ERROR_SUCCESS)
513 if(type == REG_DWORD && new_dpi != 0)
514 dpi = new_dpi;
516 RegCloseKey(hkey);
518 return dpi;
522 /***********************************************************************
523 * GDI_inc_ref_count
525 * Increment the reference count of a GDI object.
527 HGDIOBJ GDI_inc_ref_count( HGDIOBJ handle )
529 GDIOBJHDR *header;
531 if ((header = GDI_GetObjPtr( handle, 0 )))
533 header->selcount++;
534 GDI_ReleaseObj( handle );
536 else handle = 0;
538 return handle;
542 /***********************************************************************
543 * GDI_dec_ref_count
545 * Decrement the reference count of a GDI object.
547 BOOL GDI_dec_ref_count( HGDIOBJ handle )
549 GDIOBJHDR *header;
551 if ((header = GDI_GetObjPtr( handle, 0 )))
553 assert( header->selcount );
554 if (!--header->selcount && header->deleted)
556 /* handle delayed DeleteObject*/
557 header->deleted = 0;
558 GDI_ReleaseObj( handle );
559 TRACE( "executing delayed DeleteObject for %p\n", handle );
560 DeleteObject( handle );
562 else GDI_ReleaseObj( handle );
564 return header != NULL;
568 /***********************************************************************
569 * DllMain
571 * GDI initialization.
573 BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
575 LOGFONTW default_gui_font;
576 const struct DefaultFontInfo* deffonts;
577 int i;
579 if (reason != DLL_PROCESS_ATTACH) return TRUE;
581 DisableThreadLibraryCalls( inst );
582 WineEngInit();
584 /* create stock objects */
585 stock_objects[WHITE_BRUSH] = CreateBrushIndirect( &WhiteBrush );
586 stock_objects[LTGRAY_BRUSH] = CreateBrushIndirect( &LtGrayBrush );
587 stock_objects[GRAY_BRUSH] = CreateBrushIndirect( &GrayBrush );
588 stock_objects[DKGRAY_BRUSH] = CreateBrushIndirect( &DkGrayBrush );
589 stock_objects[BLACK_BRUSH] = CreateBrushIndirect( &BlackBrush );
590 stock_objects[NULL_BRUSH] = CreateBrushIndirect( &NullBrush );
592 stock_objects[WHITE_PEN] = CreatePenIndirect( &WhitePen );
593 stock_objects[BLACK_PEN] = CreatePenIndirect( &BlackPen );
594 stock_objects[NULL_PEN] = CreatePenIndirect( &NullPen );
596 stock_objects[DEFAULT_PALETTE] = PALETTE_Init();
597 stock_objects[DEFAULT_BITMAP] = CreateBitmap( 1, 1, 1, 1, NULL );
599 /* language-independent stock fonts */
600 stock_objects[OEM_FIXED_FONT] = CreateFontIndirectW( &OEMFixedFont );
601 stock_objects[ANSI_FIXED_FONT] = CreateFontIndirectW( &AnsiFixedFont );
602 stock_objects[ANSI_VAR_FONT] = CreateFontIndirectW( &AnsiVarFont );
604 /* language-dependent stock fonts */
605 deffonts = get_default_fonts(get_default_charset());
606 stock_objects[SYSTEM_FONT] = CreateFontIndirectW( &deffonts->SystemFont );
607 stock_objects[DEVICE_DEFAULT_FONT] = CreateFontIndirectW( &deffonts->DeviceDefaultFont );
608 stock_objects[SYSTEM_FIXED_FONT] = CreateFontIndirectW( &deffonts->SystemFixedFont );
610 /* For the default gui font, we use the lfHeight member in deffonts as a place-holder
611 for the point size so we must convert this into a true height */
612 default_gui_font = deffonts->DefaultGuiFont;
613 default_gui_font.lfHeight = -MulDiv(default_gui_font.lfHeight, get_dpi(), 72);
614 stock_objects[DEFAULT_GUI_FONT] = CreateFontIndirectW( &default_gui_font );
616 stock_objects[DC_BRUSH] = CreateBrushIndirect( &DCBrush );
617 stock_objects[DC_PEN] = CreatePenIndirect( &DCPen );
619 /* clear the NOSYSTEM bit on all stock objects*/
620 for (i = 0; i < NB_STOCK_OBJECTS; i++)
622 if (!stock_objects[i])
624 if (i == 9) continue; /* there's no stock object 9 */
625 ERR( "could not create stock object %d\n", i );
626 return FALSE;
628 __wine_make_gdi_object_system( stock_objects[i], TRUE );
631 return TRUE;
634 #define FIRST_LARGE_HANDLE 16
635 #define MAX_LARGE_HANDLES ((GDI_HEAP_SIZE >> 2) - FIRST_LARGE_HANDLE)
636 static GDIOBJHDR *large_handles[MAX_LARGE_HANDLES];
637 static int next_large_handle;
638 static LONG debug_count;
640 static const char *gdi_obj_type( unsigned type )
642 switch ( type )
644 case OBJ_PEN: return "OBJ_PEN";
645 case OBJ_BRUSH: return "OBJ_BRUSH";
646 case OBJ_DC: return "OBJ_DC";
647 case OBJ_METADC: return "OBJ_METADC";
648 case OBJ_PAL: return "OBJ_PAL";
649 case OBJ_FONT: return "OBJ_FONT";
650 case OBJ_BITMAP: return "OBJ_BITMAP";
651 case OBJ_REGION: return "OBJ_REGION";
652 case OBJ_METAFILE: return "OBJ_METAFILE";
653 case OBJ_MEMDC: return "OBJ_MEMDC";
654 case OBJ_EXTPEN: return "OBJ_EXTPEN";
655 case OBJ_ENHMETADC: return "OBJ_ENHMETADC";
656 case OBJ_ENHMETAFILE: return "OBJ_ENHMETAFILE";
657 case OBJ_COLORSPACE: return "OBJ_COLORSPACE";
658 default: return "UNKNOWN";
662 static void dump_gdi_objects( void )
664 int i;
666 TRACE( "%u objects:\n", MAX_LARGE_HANDLES );
668 EnterCriticalSection( &gdi_section );
669 for (i = 0; i < MAX_LARGE_HANDLES; i++)
671 if (!large_handles[i])
673 TRACE( "index %d handle %p FREE\n", i, (HGDIOBJ)(ULONG_PTR)((i + FIRST_LARGE_HANDLE) << 2) );
674 continue;
676 TRACE( "handle %p obj %p type %s selcount %u deleted %u\n",
677 (HGDIOBJ)(ULONG_PTR)((i + FIRST_LARGE_HANDLE) << 2),
678 large_handles[i], gdi_obj_type( large_handles[i]->type ),
679 large_handles[i]->selcount, large_handles[i]->deleted );
681 LeaveCriticalSection( &gdi_section );
684 /***********************************************************************
685 * alloc_gdi_handle
687 * Allocate a GDI handle for an object, which must have been allocated on the process heap.
689 HGDIOBJ alloc_gdi_handle( GDIOBJHDR *obj, WORD type, const struct gdi_obj_funcs *funcs )
691 int i;
693 /* initialize the object header */
694 obj->type = type;
695 obj->system = 0;
696 obj->deleted = 0;
697 obj->selcount = 0;
698 obj->funcs = funcs;
699 obj->hdcs = NULL;
701 EnterCriticalSection( &gdi_section );
702 for (i = next_large_handle + 1; i < MAX_LARGE_HANDLES; i++)
703 if (!large_handles[i]) goto found;
704 for (i = 0; i <= next_large_handle; i++)
705 if (!large_handles[i]) goto found;
706 LeaveCriticalSection( &gdi_section );
708 ERR( "out of GDI object handles, expect a crash\n" );
709 if (TRACE_ON(gdi)) dump_gdi_objects();
710 return 0;
712 found:
713 large_handles[i] = obj;
714 next_large_handle = i;
715 LeaveCriticalSection( &gdi_section );
716 TRACE( "allocated %s %p %u/%u\n",
717 gdi_obj_type(type), (HGDIOBJ)(ULONG_PTR)((i + FIRST_LARGE_HANDLE) << 2),
718 InterlockedIncrement( &debug_count ), MAX_LARGE_HANDLES );
719 return (HGDIOBJ)(ULONG_PTR)((i + FIRST_LARGE_HANDLE) << 2);
723 /***********************************************************************
724 * free_gdi_handle
726 * Free a GDI handle and return a pointer to the object.
728 void *free_gdi_handle( HGDIOBJ handle )
730 GDIOBJHDR *object = NULL;
731 int i;
733 i = ((ULONG_PTR)handle >> 2) - FIRST_LARGE_HANDLE;
734 if (i >= 0 && i < MAX_LARGE_HANDLES)
736 EnterCriticalSection( &gdi_section );
737 object = large_handles[i];
738 large_handles[i] = NULL;
739 LeaveCriticalSection( &gdi_section );
741 if (object)
743 TRACE( "freed %s %p %u/%u\n", gdi_obj_type( object->type ), handle,
744 InterlockedDecrement( &debug_count ) + 1, MAX_LARGE_HANDLES );
745 object->type = 0; /* mark it as invalid */
746 object->funcs = NULL;
748 return object;
752 /***********************************************************************
753 * GDI_GetObjPtr
755 * Return a pointer to the GDI object associated to the handle.
756 * Return NULL if the object has the wrong magic number.
757 * The object must be released with GDI_ReleaseObj.
759 void *GDI_GetObjPtr( HGDIOBJ handle, WORD type )
761 GDIOBJHDR *ptr = NULL;
762 int i;
764 EnterCriticalSection( &gdi_section );
766 i = ((UINT_PTR)handle >> 2) - FIRST_LARGE_HANDLE;
767 if (i >= 0 && i < MAX_LARGE_HANDLES)
769 ptr = large_handles[i];
770 if (ptr && type && ptr->type != type) ptr = NULL;
773 if (!ptr)
775 LeaveCriticalSection( &gdi_section );
776 WARN( "Invalid handle %p\n", handle );
779 return ptr;
783 /***********************************************************************
784 * GDI_ReleaseObj
787 void GDI_ReleaseObj( HGDIOBJ handle )
789 LeaveCriticalSection( &gdi_section );
793 /***********************************************************************
794 * GDI_CheckNotLock
796 void GDI_CheckNotLock(void)
798 if (gdi_section.OwningThread == ULongToHandle(GetCurrentThreadId()) && gdi_section.RecursionCount)
800 ERR( "BUG: holding GDI lock\n" );
801 DebugBreak();
806 /***********************************************************************
807 * DeleteObject (GDI32.@)
809 * Delete a Gdi object.
811 * PARAMS
812 * obj [I] Gdi object to delete
814 * RETURNS
815 * Success: TRUE. If obj was not returned from GetStockObject(), any resources
816 * it consumed are released.
817 * Failure: FALSE, if obj is not a valid Gdi object, or is currently selected
818 * into a DC.
820 BOOL WINAPI DeleteObject( HGDIOBJ obj )
822 /* Check if object is valid */
824 struct hdc_list *hdcs_head;
825 const struct gdi_obj_funcs *funcs;
826 GDIOBJHDR * header;
828 if (HIWORD(obj)) return FALSE;
830 if (!(header = GDI_GetObjPtr( obj, 0 ))) return FALSE;
832 if (header->system)
834 TRACE("Preserving system object %p\n", obj);
835 GDI_ReleaseObj( obj );
836 return TRUE;
839 while ((hdcs_head = header->hdcs) != NULL)
841 DC *dc = get_dc_ptr(hdcs_head->hdc);
843 header->hdcs = hdcs_head->next;
844 TRACE("hdc %p has interest in %p\n", hdcs_head->hdc, obj);
846 if(dc)
848 if(dc->funcs->pDeleteObject)
850 GDI_ReleaseObj( obj ); /* release the GDI lock */
851 dc->funcs->pDeleteObject( dc->physDev, obj );
852 header = GDI_GetObjPtr( obj, 0 ); /* and grab it again */
854 release_dc_ptr( dc );
856 HeapFree(GetProcessHeap(), 0, hdcs_head);
857 if (!header) return FALSE;
860 if (header->selcount)
862 TRACE("delayed for %p because object in use, count %u\n", obj, header->selcount );
863 header->deleted = 1; /* mark for delete */
864 GDI_ReleaseObj( obj );
865 return TRUE;
868 TRACE("%p\n", obj );
870 /* Delete object */
872 funcs = header->funcs;
873 GDI_ReleaseObj( obj );
874 if (funcs && funcs->pDeleteObject)
875 return funcs->pDeleteObject( obj );
876 else
877 return FALSE;
880 /***********************************************************************
881 * GDI_hdc_using_object
883 * Call this if the dc requires DeleteObject notification
885 BOOL GDI_hdc_using_object(HGDIOBJ obj, HDC hdc)
887 GDIOBJHDR * header;
888 struct hdc_list **pphdc;
890 TRACE("obj %p hdc %p\n", obj, hdc);
892 if (!(header = GDI_GetObjPtr( obj, 0 ))) return FALSE;
894 if (header->system)
896 GDI_ReleaseObj(obj);
897 return FALSE;
900 for(pphdc = &header->hdcs; *pphdc; pphdc = &(*pphdc)->next)
901 if((*pphdc)->hdc == hdc)
902 break;
904 if(!*pphdc) {
905 *pphdc = HeapAlloc(GetProcessHeap(), 0, sizeof(**pphdc));
906 (*pphdc)->hdc = hdc;
907 (*pphdc)->next = NULL;
910 GDI_ReleaseObj(obj);
911 return TRUE;
914 /***********************************************************************
915 * GDI_hdc_not_using_object
918 BOOL GDI_hdc_not_using_object(HGDIOBJ obj, HDC hdc)
920 GDIOBJHDR * header;
921 struct hdc_list *phdc, **prev;
923 TRACE("obj %p hdc %p\n", obj, hdc);
925 if (!(header = GDI_GetObjPtr( obj, 0 ))) return FALSE;
927 if (header->system)
929 GDI_ReleaseObj(obj);
930 return FALSE;
933 phdc = header->hdcs;
934 prev = &header->hdcs;
936 while(phdc) {
937 if(phdc->hdc == hdc) {
938 *prev = phdc->next;
939 HeapFree(GetProcessHeap(), 0, phdc);
940 phdc = *prev;
941 } else {
942 prev = &phdc->next;
943 phdc = phdc->next;
947 GDI_ReleaseObj(obj);
948 return TRUE;
951 /***********************************************************************
952 * GetStockObject (GDI32.@)
954 HGDIOBJ WINAPI GetStockObject( INT obj )
956 HGDIOBJ ret;
957 if ((obj < 0) || (obj >= NB_STOCK_OBJECTS)) return 0;
958 ret = stock_objects[obj];
959 TRACE("returning %p\n", ret );
960 return ret;
964 /***********************************************************************
965 * GetObjectA (GDI32.@)
967 INT WINAPI GetObjectA( HGDIOBJ handle, INT count, LPVOID buffer )
969 const struct gdi_obj_funcs *funcs;
970 GDIOBJHDR * ptr;
971 INT result = 0;
973 TRACE("%p %d %p\n", handle, count, buffer );
975 if (!(ptr = GDI_GetObjPtr( handle, 0 ))) return 0;
976 funcs = ptr->funcs;
977 GDI_ReleaseObj( handle );
979 if (funcs && funcs->pGetObjectA)
981 if (buffer && ((ULONG_PTR)buffer >> 16) == 0) /* catch apps getting argument order wrong */
982 SetLastError( ERROR_NOACCESS );
983 else
984 result = funcs->pGetObjectA( handle, count, buffer );
986 else
987 SetLastError( ERROR_INVALID_HANDLE );
989 return result;
992 /***********************************************************************
993 * GetObjectW (GDI32.@)
995 INT WINAPI GetObjectW( HGDIOBJ handle, INT count, LPVOID buffer )
997 const struct gdi_obj_funcs *funcs;
998 GDIOBJHDR * ptr;
999 INT result = 0;
1000 TRACE("%p %d %p\n", handle, count, buffer );
1002 if (!(ptr = GDI_GetObjPtr( handle, 0 ))) return 0;
1003 funcs = ptr->funcs;
1004 GDI_ReleaseObj( handle );
1006 if (funcs && funcs->pGetObjectW)
1008 if (buffer && ((ULONG_PTR)buffer >> 16) == 0) /* catch apps getting argument order wrong */
1009 SetLastError( ERROR_NOACCESS );
1010 else
1011 result = funcs->pGetObjectW( handle, count, buffer );
1013 else
1014 SetLastError( ERROR_INVALID_HANDLE );
1016 return result;
1019 /***********************************************************************
1020 * GetObjectType (GDI32.@)
1022 DWORD WINAPI GetObjectType( HGDIOBJ handle )
1024 GDIOBJHDR * ptr;
1025 DWORD result;
1027 if (!(ptr = GDI_GetObjPtr( handle, 0 )))
1029 SetLastError( ERROR_INVALID_HANDLE );
1030 return 0;
1032 result = ptr->type;
1033 GDI_ReleaseObj( handle );
1034 TRACE("%p -> %u\n", handle, result );
1035 return result;
1038 /***********************************************************************
1039 * GetCurrentObject (GDI32.@)
1041 * Get the currently selected object of a given type in a device context.
1043 * PARAMS
1044 * hdc [I] Device context to get the current object from
1045 * type [I] Type of current object to get (OBJ_* defines from "wingdi.h")
1047 * RETURNS
1048 * Success: The current object of the given type selected in hdc.
1049 * Failure: A NULL handle.
1051 * NOTES
1052 * - only the following object types are supported:
1053 *| OBJ_PEN
1054 *| OBJ_BRUSH
1055 *| OBJ_PAL
1056 *| OBJ_FONT
1057 *| OBJ_BITMAP
1059 HGDIOBJ WINAPI GetCurrentObject(HDC hdc,UINT type)
1061 HGDIOBJ ret = 0;
1062 DC * dc = get_dc_ptr( hdc );
1064 if (!dc) return 0;
1066 switch (type) {
1067 case OBJ_EXTPEN: /* fall through */
1068 case OBJ_PEN: ret = dc->hPen; break;
1069 case OBJ_BRUSH: ret = dc->hBrush; break;
1070 case OBJ_PAL: ret = dc->hPalette; break;
1071 case OBJ_FONT: ret = dc->hFont; break;
1072 case OBJ_BITMAP: ret = dc->hBitmap; break;
1074 /* tests show that OBJ_REGION is explicitly ignored */
1075 case OBJ_REGION: break;
1076 default:
1077 /* the SDK only mentions those above */
1078 FIXME("(%p,%d): unknown type.\n",hdc,type);
1079 break;
1081 release_dc_ptr( dc );
1082 return ret;
1086 /***********************************************************************
1087 * SelectObject (GDI32.@)
1089 * Select a Gdi object into a device context.
1091 * PARAMS
1092 * hdc [I] Device context to associate the object with
1093 * hObj [I] Gdi object to associate with hdc
1095 * RETURNS
1096 * Success: A non-NULL handle representing the previously selected object of
1097 * the same type as hObj.
1098 * Failure: A NULL object. If hdc is invalid, GetLastError() returns ERROR_INVALID_HANDLE.
1099 * if hObj is not a valid object handle, no last error is set. In either
1100 * case, hdc is unaffected by the call.
1102 HGDIOBJ WINAPI SelectObject( HDC hdc, HGDIOBJ hObj )
1104 HGDIOBJ ret = 0;
1105 GDIOBJHDR *header;
1107 TRACE( "(%p,%p)\n", hdc, hObj );
1109 header = GDI_GetObjPtr( hObj, 0 );
1110 if (header)
1112 const struct gdi_obj_funcs *funcs = header->funcs;
1113 GDI_ReleaseObj( hObj );
1114 if (funcs && funcs->pSelectObject) ret = funcs->pSelectObject( hObj, hdc );
1116 return ret;
1120 /***********************************************************************
1121 * UnrealizeObject (GDI32.@)
1123 BOOL WINAPI UnrealizeObject( HGDIOBJ obj )
1125 BOOL result = FALSE;
1126 GDIOBJHDR * header = GDI_GetObjPtr( obj, 0 );
1128 if (header)
1130 const struct gdi_obj_funcs *funcs = header->funcs;
1132 GDI_ReleaseObj( obj );
1133 if (funcs && funcs->pUnrealizeObject)
1134 result = header->funcs->pUnrealizeObject( obj );
1135 else
1136 result = TRUE;
1138 return result;
1142 /* Solid colors to enumerate */
1143 static const COLORREF solid_colors[] =
1144 { RGB(0x00,0x00,0x00), RGB(0xff,0xff,0xff),
1145 RGB(0xff,0x00,0x00), RGB(0x00,0xff,0x00),
1146 RGB(0x00,0x00,0xff), RGB(0xff,0xff,0x00),
1147 RGB(0xff,0x00,0xff), RGB(0x00,0xff,0xff),
1148 RGB(0x80,0x00,0x00), RGB(0x00,0x80,0x00),
1149 RGB(0x80,0x80,0x00), RGB(0x00,0x00,0x80),
1150 RGB(0x80,0x00,0x80), RGB(0x00,0x80,0x80),
1151 RGB(0x80,0x80,0x80), RGB(0xc0,0xc0,0xc0)
1155 /***********************************************************************
1156 * EnumObjects (GDI32.@)
1158 INT WINAPI EnumObjects( HDC hdc, INT nObjType,
1159 GOBJENUMPROC lpEnumFunc, LPARAM lParam )
1161 UINT i;
1162 INT retval = 0;
1163 LOGPEN pen;
1164 LOGBRUSH brush;
1166 TRACE("%p %d %p %08lx\n", hdc, nObjType, lpEnumFunc, lParam );
1167 switch(nObjType)
1169 case OBJ_PEN:
1170 /* Enumerate solid pens */
1171 for (i = 0; i < sizeof(solid_colors)/sizeof(solid_colors[0]); i++)
1173 pen.lopnStyle = PS_SOLID;
1174 pen.lopnWidth.x = 1;
1175 pen.lopnWidth.y = 0;
1176 pen.lopnColor = solid_colors[i];
1177 retval = lpEnumFunc( &pen, lParam );
1178 TRACE("solid pen %08x, ret=%d\n",
1179 solid_colors[i], retval);
1180 if (!retval) break;
1182 break;
1184 case OBJ_BRUSH:
1185 /* Enumerate solid brushes */
1186 for (i = 0; i < sizeof(solid_colors)/sizeof(solid_colors[0]); i++)
1188 brush.lbStyle = BS_SOLID;
1189 brush.lbColor = solid_colors[i];
1190 brush.lbHatch = 0;
1191 retval = lpEnumFunc( &brush, lParam );
1192 TRACE("solid brush %08x, ret=%d\n",
1193 solid_colors[i], retval);
1194 if (!retval) break;
1197 /* Now enumerate hatched brushes */
1198 if (retval) for (i = HS_HORIZONTAL; i <= HS_DIAGCROSS; i++)
1200 brush.lbStyle = BS_HATCHED;
1201 brush.lbColor = RGB(0,0,0);
1202 brush.lbHatch = i;
1203 retval = lpEnumFunc( &brush, lParam );
1204 TRACE("hatched brush %d, ret=%d\n",
1205 i, retval);
1206 if (!retval) break;
1208 break;
1210 default:
1211 /* FIXME: implement Win32 types */
1212 WARN("(%d): Invalid type\n", nObjType );
1213 break;
1215 return retval;
1219 /***********************************************************************
1220 * SetObjectOwner (GDI32.@)
1222 void WINAPI SetObjectOwner( HGDIOBJ handle, HANDLE owner )
1224 /* Nothing to do */
1227 /***********************************************************************
1228 * GdiInitializeLanguagePack (GDI32.@)
1230 DWORD WINAPI GdiInitializeLanguagePack( DWORD arg )
1232 FIXME("stub\n");
1233 return 0;
1236 /***********************************************************************
1237 * GdiFlush (GDI32.@)
1239 BOOL WINAPI GdiFlush(void)
1241 return TRUE; /* FIXME */
1245 /***********************************************************************
1246 * GdiGetBatchLimit (GDI32.@)
1248 DWORD WINAPI GdiGetBatchLimit(void)
1250 return 1; /* FIXME */
1254 /***********************************************************************
1255 * GdiSetBatchLimit (GDI32.@)
1257 DWORD WINAPI GdiSetBatchLimit( DWORD limit )
1259 return 1; /* FIXME */
1263 /*******************************************************************
1264 * GetColorAdjustment [GDI32.@]
1268 BOOL WINAPI GetColorAdjustment(HDC hdc, LPCOLORADJUSTMENT lpca)
1270 FIXME("stub\n");
1271 return 0;
1274 /*******************************************************************
1275 * GdiComment [GDI32.@]
1279 BOOL WINAPI GdiComment(HDC hdc, UINT cbSize, const BYTE *lpData)
1281 DC *dc = get_dc_ptr(hdc);
1282 BOOL ret = FALSE;
1283 if(dc)
1285 if (dc->funcs->pGdiComment)
1286 ret = dc->funcs->pGdiComment( dc->physDev, cbSize, lpData );
1287 release_dc_ptr( dc );
1289 return ret;
1292 /*******************************************************************
1293 * SetColorAdjustment [GDI32.@]
1297 BOOL WINAPI SetColorAdjustment(HDC hdc, const COLORADJUSTMENT* lpca)
1299 FIXME("stub\n");
1300 return 0;