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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
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 /***********************************************************************
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 /* FIXME: these should perhaps be BS_HATCHED, at least for 1 bitperpixel */
54 static const LOGBRUSH LtGrayBrush = { BS_SOLID, RGB(192,192,192), 0 };
55 static const LOGBRUSH GrayBrush = { BS_SOLID, RGB(128,128,128), 0 };
57 /* This is BS_HATCHED, for 1 bitperpixel. This makes the spray work in pbrush */
58 /* See HatchBrushes in x11drv for the HS_DIAGCROSS+1 hack */
59 static const LOGBRUSH DkGrayBrush = { BS_HATCHED, RGB(0,0,0), (HS_DIAGCROSS+1) };
61 static const LOGPEN WhitePen = { PS_SOLID, { 0, 0 }, RGB(255,255,255) };
62 static const LOGPEN BlackPen = { PS_SOLID, { 0, 0 }, RGB(0,0,0) };
63 static const LOGPEN NullPen = { PS_NULL, { 0, 0 }, 0 };
65 static const LOGBRUSH DCBrush = { BS_SOLID, RGB(255,255,255), 0 };
66 static const LOGPEN DCPen = { PS_SOLID, { 0, 0 }, RGB(0,0,0) };
68 /* reserve one extra entry for the stock default bitmap */
69 /* this is what Windows does too */
70 #define NB_STOCK_OBJECTS (STOCK_LAST+2)
72 static HGDIOBJ stock_objects[NB_STOCK_OBJECTS];
74 static SYSLEVEL GDI_level;
75 static CRITICAL_SECTION_DEBUG critsect_debug =
77 0, 0, &GDI_level.crst,
78 { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
79 0, 0, { 0, (DWORD)(__FILE__ ": GDI_level") }
81 static SYSLEVEL GDI_level = { { &critsect_debug, -1, 0, 0, 0, 0 }, 3 };
83 static WORD GDI_HeapSel;
85 inline static BOOL get_bool(char *buffer)
87 return (buffer[0] == 'y' || buffer[0] == 'Y' ||
88 buffer[0] == 't' || buffer[0] == 'T' ||
93 /****************************************************************************
95 * language-independent stock fonts
99 static const LOGFONTW OEMFixedFont =
100 { 12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, OEM_CHARSET,
101 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, {'\0'} };
103 static const LOGFONTW AnsiFixedFont =
104 { 12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
105 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, {'\0'} };
107 static const LOGFONTW AnsiVarFont =
108 { 12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
109 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
110 {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'} };
112 /******************************************************************************
114 * language-dependent stock fonts
116 * 'ANSI' charset and 'DEFAULT' charset is not same.
117 * The chars in CP_ACP should be drawn with 'DEFAULT' charset.
118 * 'ANSI' charset seems to be identical with ISO-8859-1.
119 * 'DEFAULT' charset is a language-dependent charset.
121 * 'System' font seems to be an alias for language-dependent font.
125 * language-dependent stock fonts for all known charsets
126 * please see TranslateCharsetInfo (dlls/gdi/font.c) and
127 * CharsetBindingInfo (dlls/x11drv/xfont.c),
128 * and modify entries for your language if needed.
130 struct DefaultFontInfo
134 LOGFONTW DeviceDefaultFont;
135 LOGFONTW SystemFixedFont;
136 LOGFONTW DefaultGuiFont; /* Note for this font the lfHeight member should be the point size */
139 static const struct DefaultFontInfo default_fonts[] =
143 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
144 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
145 {'S','y','s','t','e','m','\0'}
147 { /* Device Default */
148 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
149 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
153 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
154 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
157 { /* DefaultGuiFont */
158 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
159 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
160 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
163 { EASTEUROPE_CHARSET,
165 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, EASTEUROPE_CHARSET,
166 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
167 {'S','y','s','t','e','m','\0'}
169 { /* Device Default */
170 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, EASTEUROPE_CHARSET,
171 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
175 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, EASTEUROPE_CHARSET,
176 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
179 { /* DefaultGuiFont */
180 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, EASTEUROPE_CHARSET,
181 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
182 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
187 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, RUSSIAN_CHARSET,
188 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
189 {'S','y','s','t','e','m','\0'}
191 { /* Device Default */
192 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, RUSSIAN_CHARSET,
193 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
197 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, RUSSIAN_CHARSET,
198 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
201 { /* DefaultGuiFont */
202 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, RUSSIAN_CHARSET,
203 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
204 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
209 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GREEK_CHARSET,
210 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
211 {'S','y','s','t','e','m','\0'}
213 { /* Device Default */
214 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GREEK_CHARSET,
215 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
219 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GREEK_CHARSET,
220 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
223 { /* DefaultGuiFont */
224 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GREEK_CHARSET,
225 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
226 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
231 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, TURKISH_CHARSET,
232 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
233 {'S','y','s','t','e','m','\0'}
235 { /* Device Default */
236 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, TURKISH_CHARSET,
237 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
241 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, TURKISH_CHARSET,
242 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
245 { /* DefaultGuiFont */
246 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, TURKISH_CHARSET,
247 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
248 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
253 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HEBREW_CHARSET,
254 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
255 {'S','y','s','t','e','m','\0'}
257 { /* Device Default */
258 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HEBREW_CHARSET,
259 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
263 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HEBREW_CHARSET,
264 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
267 { /* DefaultGuiFont */
268 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HEBREW_CHARSET,
269 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
270 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
275 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ARABIC_CHARSET,
276 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
277 {'S','y','s','t','e','m','\0'}
279 { /* Device Default */
280 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ARABIC_CHARSET,
281 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
285 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ARABIC_CHARSET,
286 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
289 { /* DefaultGuiFont */
290 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ARABIC_CHARSET,
291 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
292 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
297 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, BALTIC_CHARSET,
298 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
299 {'S','y','s','t','e','m','\0'}
301 { /* Device Default */
302 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, BALTIC_CHARSET,
303 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
307 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, BALTIC_CHARSET,
308 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
311 { /* DefaultGuiFont */
312 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, BALTIC_CHARSET,
313 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
314 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
319 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, THAI_CHARSET,
320 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
321 {'S','y','s','t','e','m','\0'}
323 { /* Device Default */
324 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, THAI_CHARSET,
325 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
329 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, THAI_CHARSET,
330 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
333 { /* DefaultGuiFont */
334 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, THAI_CHARSET,
335 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
336 {'M','S',' ','S','h','e','l','l',' ','D','l','g','\0'}
341 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET,
342 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
343 {'S','y','s','t','e','m','\0'}
345 { /* Device Default */
346 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET,
347 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
351 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET,
352 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
355 { /* DefaultGuiFont */
356 9, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, SHIFTJIS_CHARSET,
357 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
358 {'M','S',' ','U','I',' ','G','o','t','h','i','c','\0'}
363 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GB2312_CHARSET,
364 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
365 {'S','y','s','t','e','m','\0'}
367 { /* Device Default */
368 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GB2312_CHARSET,
369 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
373 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GB2312_CHARSET,
374 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
377 { /* DefaultGuiFont */
378 9, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, GB2312_CHARSET,
379 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
380 {'M','S',' ','S','o','n','g','\0'} /* FIXME: Is this correct? */
385 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HANGEUL_CHARSET,
386 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
387 {'S','y','s','t','e','m','\0'}
389 { /* Device Default */
390 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HANGEUL_CHARSET,
391 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
395 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HANGEUL_CHARSET,
396 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
399 { /* DefaultGuiFont */
400 9, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, HANGEUL_CHARSET,
401 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
402 {'G','u','l','i','m','\0'},
405 { CHINESEBIG5_CHARSET,
407 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, CHINESEBIG5_CHARSET,
408 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
409 {'S','y','s','t','e','m','\0'}
411 { /* Device Default */
412 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, CHINESEBIG5_CHARSET,
413 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
417 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, CHINESEBIG5_CHARSET,
418 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
421 { /* DefaultGuiFont */
422 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, CHINESEBIG5_CHARSET,
423 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
424 {'\0'} /* FIXME - what is the native font??? */
429 16, 7, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, JOHAB_CHARSET,
430 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
431 {'S','y','s','t','e','m','\0'}
433 { /* Device Default */
434 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, JOHAB_CHARSET,
435 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
439 16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, JOHAB_CHARSET,
440 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN,
443 { /* DefaultGuiFont */
444 8, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, JOHAB_CHARSET,
445 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS,
446 {'M','S',' ','M','i','n','g','l','i','u','\0'} /* FIXME: Is this correct? */
452 /******************************************************************************
455 static const struct DefaultFontInfo* get_default_fonts(UINT charset)
459 for(n=0;n<(sizeof(default_fonts)/sizeof(default_fonts[0]));n++)
461 if ( default_fonts[n].charset == charset )
462 return &default_fonts[n];
465 FIXME( "unhandled charset 0x%08x - use ANSI_CHARSET for default stock objects\n", charset );
466 return &default_fonts[0];
470 /******************************************************************************
471 * get_default_charset (internal)
473 * get the language-dependent charset that can handle CP_ACP correctly.
475 static UINT get_default_charset( void )
481 csi.ciCharset = ANSI_CHARSET;
482 if ( ! TranslateCharsetInfo( (LPDWORD)uACP, &csi, TCI_SRCCODEPAGE ) )
484 FIXME( "unhandled codepage %u - use ANSI_CHARSET for default stock objects\n", uACP );
488 return csi.ciCharset;
491 static const WCHAR dpi_key_name[] = {'S','o','f','t','w','a','r','e','\\','F','o','n','t','s','\0'};
492 static const WCHAR dpi_value_name[] = {'L','o','g','P','i','x','e','l','s','\0'};
494 /******************************************************************************
497 * get the dpi from the registry
499 static DWORD get_dpi( void )
504 if (RegOpenKeyW(HKEY_CURRENT_CONFIG, dpi_key_name, &hkey) == ERROR_SUCCESS)
506 DWORD type, size, new_dpi;
508 size = sizeof(new_dpi);
509 if(RegQueryValueExW(hkey, dpi_value_name, NULL, &type, (void *)&new_dpi, &size) == ERROR_SUCCESS)
511 if(type == REG_DWORD && new_dpi != 0)
519 /******************************************************************************
522 static HFONT create_stock_font( char const *fontName, const LOGFONTW *font, HKEY hkey )
526 char buffer[MAX_PATH];
529 if (!hkey) return CreateFontIndirectW( font );
532 sprintf(key, "%s.Height", fontName);
533 count = sizeof(buffer);
534 if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count))
535 lf.lfHeight = atoi(buffer);
537 sprintf(key, "%s.Bold", fontName);
538 count = sizeof(buffer);
539 if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count))
540 lf.lfWeight = get_bool(buffer) ? FW_BOLD : FW_NORMAL;
542 sprintf(key, "%s.Italic", fontName);
543 count = sizeof(buffer);
544 if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count))
545 lf.lfItalic = get_bool(buffer);
547 sprintf(key, "%s.Underline", fontName);
548 count = sizeof(buffer);
549 if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count))
550 lf.lfUnderline = get_bool(buffer);
552 sprintf(key, "%s.StrikeOut", fontName);
553 count = sizeof(buffer);
554 if(!RegQueryValueExA(hkey, key, 0, &type, buffer, &count))
555 lf.lfStrikeOut = get_bool(buffer);
556 return CreateFontIndirectW( &lf );
560 #define TRACE_SEC(handle,text) \
561 TRACE("(%p): " text " %ld\n", (handle), GDI_level.crst.RecursionCount)
564 /***********************************************************************
567 * Increment the reference count of a GDI object.
569 inline static void inc_ref_count( HGDIOBJ handle )
573 if ((header = GDI_GetObjPtr( handle, MAGIC_DONTCARE )))
576 GDI_ReleaseObj( handle );
581 /***********************************************************************
584 * Decrement the reference count of a GDI object.
586 inline static void dec_ref_count( HGDIOBJ handle )
590 if ((header = GDI_GetObjPtr( handle, MAGIC_DONTCARE )))
592 if (header->dwCount) header->dwCount--;
593 if (header->dwCount != 0x80000000) GDI_ReleaseObj( handle );
596 /* handle delayed DeleteObject*/
598 GDI_ReleaseObj( handle );
599 TRACE( "executing delayed DeleteObject for %p\n", handle );
600 DeleteObject( handle );
606 /***********************************************************************
609 * GDI initialization.
613 HINSTANCE16 instance;
616 LOGFONTW default_gui_font;
617 const struct DefaultFontInfo* deffonts;
620 if (RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Tweak.Fonts", &hkey))
623 /* create GDI heap */
624 if ((instance = LoadLibrary16( "GDI.EXE" )) >= 32) GDI_HeapSel = instance | 7;
626 /* create stock objects */
627 stock_objects[WHITE_BRUSH] = CreateBrushIndirect( &WhiteBrush );
628 stock_objects[LTGRAY_BRUSH] = CreateBrushIndirect( &LtGrayBrush );
629 stock_objects[GRAY_BRUSH] = CreateBrushIndirect( &GrayBrush );
630 stock_objects[DKGRAY_BRUSH] = CreateBrushIndirect( &DkGrayBrush );
631 stock_objects[BLACK_BRUSH] = CreateBrushIndirect( &BlackBrush );
632 stock_objects[NULL_BRUSH] = CreateBrushIndirect( &NullBrush );
634 stock_objects[WHITE_PEN] = CreatePenIndirect( &WhitePen );
635 stock_objects[BLACK_PEN] = CreatePenIndirect( &BlackPen );
636 stock_objects[NULL_PEN] = CreatePenIndirect( &NullPen );
638 stock_objects[DEFAULT_PALETTE] = PALETTE_Init();
639 stock_objects[DEFAULT_BITMAP] = CreateBitmap( 1, 1, 1, 1, NULL );
641 /* language-independent stock fonts */
642 stock_objects[OEM_FIXED_FONT] = create_stock_font( "OEMFixed", &OEMFixedFont, hkey );
643 stock_objects[ANSI_FIXED_FONT] = create_stock_font( "AnsiFixed", &AnsiFixedFont, hkey );
644 stock_objects[ANSI_VAR_FONT] = create_stock_font( "AnsiVar", &AnsiVarFont, hkey );
646 /* language-dependent stock fonts */
647 deffonts = get_default_fonts(get_default_charset());
648 stock_objects[SYSTEM_FONT] = create_stock_font( "System", &deffonts->SystemFont, hkey );
649 stock_objects[DEVICE_DEFAULT_FONT] = create_stock_font( "DeviceDefault", &deffonts->DeviceDefaultFont, hkey );
650 stock_objects[SYSTEM_FIXED_FONT] = create_stock_font( "SystemFixed", &deffonts->SystemFixedFont, hkey );
652 /* For the default gui font, we use the lfHeight member in deffonts as a place-holder
653 for the point size so we must convert this into a true height */
654 memcpy(&default_gui_font, &deffonts->DefaultGuiFont, sizeof(default_gui_font));
655 default_gui_font.lfHeight = -MulDiv(default_gui_font.lfHeight, get_dpi(), 72);
656 stock_objects[DEFAULT_GUI_FONT] = create_stock_font( "DefaultGui", &default_gui_font, hkey );
658 stock_objects[DC_BRUSH] = CreateBrushIndirect( &DCBrush );
659 stock_objects[DC_PEN] = CreatePenIndirect( &DCPen );
661 /* clear the NOSYSTEM bit on all stock objects*/
662 for (i = 0; i < NB_STOCK_OBJECTS; i++)
664 if (!stock_objects[i])
666 if (i == 9) continue; /* there's no stock object 9 */
667 ERR( "could not create stock object %d\n", i );
670 ptr = GDI_GetObjPtr( stock_objects[i], MAGIC_DONTCARE );
671 ptr->wMagic &= ~OBJECT_NOSYSTEM;
672 GDI_ReleaseObj( stock_objects[i] );
675 if (hkey) RegCloseKey( hkey );
682 #define FIRST_LARGE_HANDLE 16
683 #define MAX_LARGE_HANDLES ((GDI_HEAP_SIZE >> 2) - FIRST_LARGE_HANDLE)
684 static GDIOBJHDR *large_handles[MAX_LARGE_HANDLES];
685 static int next_large_handle;
687 /***********************************************************************
690 * Allocate a GDI handle from the large heap. Helper for GDI_AllocObject
692 inline static GDIOBJHDR *alloc_large_heap( WORD size, HGDIOBJ *handle )
697 for (i = next_large_handle + 1; i < MAX_LARGE_HANDLES; i++)
698 if (!large_handles[i]) goto found;
699 for (i = 0; i <= next_large_handle; i++)
700 if (!large_handles[i]) goto found;
705 if ((obj = HeapAlloc( GetProcessHeap(), 0, size )))
707 large_handles[i] = obj;
708 *handle = (HGDIOBJ)(ULONG_PTR)((i + FIRST_LARGE_HANDLE) << 2);
709 next_large_handle = i;
715 /***********************************************************************
718 void *GDI_AllocObject( WORD size, WORD magic, HGDIOBJ *handle, const struct gdi_obj_funcs *funcs )
723 _EnterSysLevel( &GDI_level );
729 if (!(hlocal = LOCAL_Alloc( GDI_HeapSel, LMEM_MOVEABLE, size ))) goto error;
730 assert( hlocal & 2 );
731 obj = (GDIOBJHDR *)LOCAL_Lock( GDI_HeapSel, hlocal );
732 *handle = (HGDIOBJ)(ULONG_PTR)hlocal;
737 case DISABLED_DC_MAGIC:
740 case METAFILE_DC_MAGIC:
741 case ENHMETAFILE_MAGIC:
742 case ENHMETAFILE_DC_MAGIC:
743 case MEMORY_DC_MAGIC:
746 if (!(obj = alloc_large_heap( size, handle ))) goto error;
751 obj->wMagic = magic|OBJECT_NOSYSTEM;
756 TRACE_SEC( *handle, "enter" );
760 _LeaveSysLevel( &GDI_level );
766 /***********************************************************************
769 * The object ptr must have been obtained with GDI_GetObjPtr.
770 * The new pointer must be released with GDI_ReleaseObj.
772 void *GDI_ReallocObject( WORD size, HGDIOBJ handle, void *object )
776 if ((UINT_PTR)handle & 2) /* GDI heap handle */
778 HLOCAL16 h = LOWORD(handle);
779 LOCAL_Unlock( GDI_HeapSel, h );
780 if ((new_handle = (HGDIOBJ)(ULONG_PTR)LOCAL_ReAlloc( GDI_HeapSel, h, size, LMEM_MOVEABLE )))
782 assert( new_handle == handle ); /* moveable handle cannot change */
783 return LOCAL_Lock( GDI_HeapSel, h );
788 int i = ((ULONG_PTR)handle >> 2) - FIRST_LARGE_HANDLE;
789 if (i >= 0 && i < MAX_LARGE_HANDLES && large_handles[i])
791 void *new_ptr = HeapReAlloc( GetProcessHeap(), 0, large_handles[i], size );
794 large_handles[i] = new_ptr;
798 else ERR( "Invalid handle %p\n", handle );
800 TRACE_SEC( handle, "leave" );
801 _LeaveSysLevel( &GDI_level );
806 /***********************************************************************
809 BOOL GDI_FreeObject( HGDIOBJ handle, void *ptr )
811 GDIOBJHDR *object = ptr;
813 object->wMagic = 0; /* Mark it as invalid */
814 object->funcs = NULL;
815 if ((UINT_PTR)handle & 2) /* GDI heap handle */
817 HLOCAL16 h = LOWORD(handle);
818 LOCAL_Unlock( GDI_HeapSel, h );
819 LOCAL_Free( GDI_HeapSel, h );
821 else /* large heap handle */
823 int i = ((ULONG_PTR)handle >> 2) - FIRST_LARGE_HANDLE;
824 if (i >= 0 && i < MAX_LARGE_HANDLES && large_handles[i])
826 HeapFree( GetProcessHeap(), 0, large_handles[i] );
827 large_handles[i] = NULL;
829 else ERR( "Invalid handle %p\n", handle );
831 TRACE_SEC( handle, "leave" );
832 _LeaveSysLevel( &GDI_level );
837 /***********************************************************************
840 * Return a pointer to the GDI object associated to the handle.
841 * Return NULL if the object has the wrong magic number.
842 * The object must be released with GDI_ReleaseObj.
844 void *GDI_GetObjPtr( HGDIOBJ handle, WORD magic )
846 GDIOBJHDR *ptr = NULL;
848 _EnterSysLevel( &GDI_level );
850 if ((UINT_PTR)handle & 2) /* GDI heap handle */
852 HLOCAL16 h = LOWORD(handle);
853 ptr = (GDIOBJHDR *)LOCAL_Lock( GDI_HeapSel, h );
856 if (((magic != MAGIC_DONTCARE) && (GDIMAGIC(ptr->wMagic) != magic)) ||
857 (GDIMAGIC(ptr->wMagic) < FIRST_MAGIC) ||
858 (GDIMAGIC(ptr->wMagic) > LAST_MAGIC))
860 LOCAL_Unlock( GDI_HeapSel, h );
865 else /* large heap handle */
867 int i = ((UINT_PTR)handle >> 2) - FIRST_LARGE_HANDLE;
868 if (i >= 0 && i < MAX_LARGE_HANDLES)
870 ptr = large_handles[i];
871 if (ptr && (magic != MAGIC_DONTCARE) && (GDIMAGIC(ptr->wMagic) != magic)) ptr = NULL;
877 _LeaveSysLevel( &GDI_level );
878 WARN( "Invalid handle %p\n", handle );
880 else TRACE_SEC( handle, "enter" );
886 /***********************************************************************
890 void GDI_ReleaseObj( HGDIOBJ handle )
892 if ((UINT_PTR)handle & 2) LOCAL_Unlock( GDI_HeapSel, LOWORD(handle) );
893 TRACE_SEC( handle, "leave" );
894 _LeaveSysLevel( &GDI_level );
898 /***********************************************************************
901 void GDI_CheckNotLock(void)
903 _CheckNotSysLevel( &GDI_level );
907 /***********************************************************************
908 * DeleteObject (GDI32.@)
910 * Delete a Gdi object.
913 * obj [I] Gdi object to delete
916 * Success: TRUE. If obj was not returned from GetStockObject(), any resources
917 * it consumed are released.
918 * Failure: FALSE, if obj is not a valid Gdi object, or is currently selected
921 BOOL WINAPI DeleteObject( HGDIOBJ obj )
923 /* Check if object is valid */
926 if (HIWORD(obj)) return FALSE;
928 if (!(header = GDI_GetObjPtr( obj, MAGIC_DONTCARE ))) return FALSE;
930 if (!(header->wMagic & OBJECT_NOSYSTEM)
931 && (header->wMagic >= FIRST_MAGIC) && (header->wMagic <= LAST_MAGIC))
933 TRACE("Preserving system object %p\n", obj);
934 GDI_ReleaseObj( obj );
940 DC *dc = DC_GetDCPtr(header->hdcs->hdc);
941 struct hdc_list *tmp;
943 TRACE("hdc %p has interest in %p\n", header->hdcs->hdc, obj);
946 if(dc->funcs->pDeleteObject)
947 dc->funcs->pDeleteObject( dc->physDev, obj );
948 GDI_ReleaseObj( header->hdcs->hdc );
951 header->hdcs = header->hdcs->next;
952 HeapFree(GetProcessHeap(), 0, tmp);
957 TRACE("delayed for %p because object in use, count %ld\n", obj, header->dwCount );
958 header->dwCount |= 0x80000000; /* mark for delete */
959 GDI_ReleaseObj( obj );
967 if (header->funcs && header->funcs->pDeleteObject)
968 return header->funcs->pDeleteObject( obj, header );
970 GDI_ReleaseObj( obj );
974 /***********************************************************************
975 * GDI_hdc_using_object
977 * Call this if the dc requires DeleteObject notification
979 BOOL GDI_hdc_using_object(HGDIOBJ obj, HDC hdc)
982 struct hdc_list **pphdc;
984 TRACE("obj %p hdc %p\n", obj, hdc);
986 if (!(header = GDI_GetObjPtr( obj, MAGIC_DONTCARE ))) return FALSE;
988 if (!(header->wMagic & OBJECT_NOSYSTEM) &&
989 (header->wMagic >= FIRST_MAGIC) && (header->wMagic <= LAST_MAGIC))
995 for(pphdc = &header->hdcs; *pphdc; pphdc = &(*pphdc)->next)
996 if((*pphdc)->hdc == hdc)
1000 *pphdc = HeapAlloc(GetProcessHeap(), 0, sizeof(**pphdc));
1001 (*pphdc)->hdc = hdc;
1002 (*pphdc)->next = NULL;
1005 GDI_ReleaseObj(obj);
1009 /***********************************************************************
1010 * GDI_hdc_not_using_object
1013 BOOL GDI_hdc_not_using_object(HGDIOBJ obj, HDC hdc)
1016 struct hdc_list *phdc, **prev;
1018 TRACE("obj %p hdc %p\n", obj, hdc);
1020 if (!(header = GDI_GetObjPtr( obj, MAGIC_DONTCARE ))) return FALSE;
1022 if (!(header->wMagic & OBJECT_NOSYSTEM) &&
1023 (header->wMagic >= FIRST_MAGIC) && (header->wMagic <= LAST_MAGIC))
1025 GDI_ReleaseObj(obj);
1029 phdc = header->hdcs;
1030 prev = &header->hdcs;
1033 if(phdc->hdc == hdc) {
1035 HeapFree(GetProcessHeap(), 0, phdc);
1043 GDI_ReleaseObj(obj);
1047 /***********************************************************************
1048 * GetStockObject (GDI32.@)
1050 HGDIOBJ WINAPI GetStockObject( INT obj )
1053 if ((obj < 0) || (obj >= NB_STOCK_OBJECTS)) return 0;
1054 ret = stock_objects[obj];
1055 TRACE("returning %p\n", ret );
1060 /***********************************************************************
1061 * GetObject (GDI.82)
1063 INT16 WINAPI GetObject16( HGDIOBJ16 handle16, INT16 count, LPVOID buffer )
1066 HGDIOBJ handle = HGDIOBJ_32( handle16 );
1069 TRACE("%p %d %p\n", handle, count, buffer );
1070 if (!count) return 0;
1072 if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ))) return 0;
1074 if (ptr->funcs && ptr->funcs->pGetObject16)
1075 result = ptr->funcs->pGetObject16( handle, ptr, count, buffer );
1077 SetLastError( ERROR_INVALID_HANDLE );
1079 GDI_ReleaseObj( handle );
1084 /***********************************************************************
1085 * GetObjectA (GDI32.@)
1087 INT WINAPI GetObjectA( HGDIOBJ handle, INT count, LPVOID buffer )
1091 TRACE("%p %d %p\n", handle, count, buffer );
1093 if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ))) return 0;
1095 if (ptr->funcs && ptr->funcs->pGetObjectA)
1096 result = ptr->funcs->pGetObjectA( handle, ptr, count, buffer );
1098 SetLastError( ERROR_INVALID_HANDLE );
1100 GDI_ReleaseObj( handle );
1104 /***********************************************************************
1105 * GetObjectW (GDI32.@)
1107 INT WINAPI GetObjectW( HGDIOBJ handle, INT count, LPVOID buffer )
1111 TRACE("%p %d %p\n", handle, count, buffer );
1113 if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ))) return 0;
1115 if (ptr->funcs && ptr->funcs->pGetObjectW)
1116 result = ptr->funcs->pGetObjectW( handle, ptr, count, buffer );
1118 SetLastError( ERROR_INVALID_HANDLE );
1120 GDI_ReleaseObj( handle );
1124 /***********************************************************************
1125 * GetObjectType (GDI32.@)
1127 DWORD WINAPI GetObjectType( HGDIOBJ handle )
1131 TRACE("%p\n", handle );
1133 if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE )))
1135 SetLastError( ERROR_INVALID_HANDLE );
1139 switch(GDIMAGIC(ptr->wMagic))
1148 result = OBJ_BITMAP;
1157 result = OBJ_REGION;
1163 result = OBJ_METADC;
1165 case METAFILE_MAGIC:
1166 result = OBJ_METAFILE;
1168 case METAFILE_DC_MAGIC:
1169 result = OBJ_METADC;
1171 case ENHMETAFILE_MAGIC:
1172 result = OBJ_ENHMETAFILE;
1174 case ENHMETAFILE_DC_MAGIC:
1175 result = OBJ_ENHMETADC;
1177 case MEMORY_DC_MAGIC:
1181 FIXME("Magic %04x not implemented\n", GDIMAGIC(ptr->wMagic) );
1184 GDI_ReleaseObj( handle );
1188 /***********************************************************************
1189 * GetCurrentObject (GDI32.@)
1191 * Get the currently selected object of a given type in a device context.
1194 * hdc [I] Device context to get the current object from
1195 * type [I] Type of current object to get (OBJ_* defines from "wingdi.h")
1198 * Success: The current object of the given type selected in hdc.
1199 * Failure: A NULL handle.
1202 * - only the following object types are supported:
1209 HGDIOBJ WINAPI GetCurrentObject(HDC hdc,UINT type)
1212 DC * dc = DC_GetDCPtr( hdc );
1217 case OBJ_PEN: ret = dc->hPen; break;
1218 case OBJ_BRUSH: ret = dc->hBrush; break;
1219 case OBJ_PAL: ret = dc->hPalette; break;
1220 case OBJ_FONT: ret = dc->hFont; break;
1221 case OBJ_BITMAP: ret = dc->hBitmap; break;
1223 /* the SDK only mentions those above */
1224 FIXME("(%p,%d): unknown type.\n",hdc,type);
1227 GDI_ReleaseObj( hdc );
1233 /***********************************************************************
1234 * SelectObject (GDI32.@)
1236 * Select a Gdi object into a device context.
1239 * hdc [I] Device context to associate the object with
1240 * hObj [I] Gdi object to associate with hdc
1243 * Success: A non-NULL handle representing the previously selected object of
1244 * the same type as hObj.
1245 * Failure: A NULL object. If hdc is invalid, GetLastError() returns ERROR_INVALID_HANDLE.
1246 * if hObj is not a valid object handle, no last error is set. In either
1247 * case, hdc is unaffected by the call.
1249 HGDIOBJ WINAPI SelectObject( HDC hdc, HGDIOBJ hObj )
1255 TRACE( "(%p,%p)\n", hdc, hObj );
1257 if (!(dc = DC_GetDCPtr( hdc )))
1258 SetLastError( ERROR_INVALID_HANDLE );
1261 GDI_ReleaseObj( (GDIOBJHDR *)dc );
1263 header = GDI_GetObjPtr( hObj, MAGIC_DONTCARE );
1266 if (header->funcs && header->funcs->pSelectObject)
1268 ret = header->funcs->pSelectObject( hObj, header, hdc );
1269 if (ret && ret != hObj && (INT)ret > COMPLEXREGION)
1271 inc_ref_count( hObj );
1272 dec_ref_count( ret );
1275 GDI_ReleaseObj( hObj );
1282 /***********************************************************************
1283 * UnrealizeObject (GDI32.@)
1285 BOOL WINAPI UnrealizeObject( HGDIOBJ obj )
1288 /* Check if object is valid */
1290 GDIOBJHDR * header = GDI_GetObjPtr( obj, MAGIC_DONTCARE );
1291 if (!header) return FALSE;
1293 TRACE("%p\n", obj );
1295 /* Unrealize object */
1297 if (header->funcs && header->funcs->pUnrealizeObject)
1298 result = header->funcs->pUnrealizeObject( obj, header );
1300 GDI_ReleaseObj( obj );
1305 /* Solid colors to enumerate */
1306 static const COLORREF solid_colors[] =
1307 { RGB(0x00,0x00,0x00), RGB(0xff,0xff,0xff),
1308 RGB(0xff,0x00,0x00), RGB(0x00,0xff,0x00),
1309 RGB(0x00,0x00,0xff), RGB(0xff,0xff,0x00),
1310 RGB(0xff,0x00,0xff), RGB(0x00,0xff,0xff),
1311 RGB(0x80,0x00,0x00), RGB(0x00,0x80,0x00),
1312 RGB(0x80,0x80,0x00), RGB(0x00,0x00,0x80),
1313 RGB(0x80,0x00,0x80), RGB(0x00,0x80,0x80),
1314 RGB(0x80,0x80,0x80), RGB(0xc0,0xc0,0xc0)
1318 /***********************************************************************
1319 * EnumObjects (GDI32.@)
1321 INT WINAPI EnumObjects( HDC hdc, INT nObjType,
1322 GOBJENUMPROC lpEnumFunc, LPARAM lParam )
1329 TRACE("%p %d %p %08lx\n", hdc, nObjType, lpEnumFunc, lParam );
1333 /* Enumerate solid pens */
1334 for (i = 0; i < sizeof(solid_colors)/sizeof(solid_colors[0]); i++)
1336 pen.lopnStyle = PS_SOLID;
1337 pen.lopnWidth.x = 1;
1338 pen.lopnWidth.y = 0;
1339 pen.lopnColor = solid_colors[i];
1340 retval = lpEnumFunc( &pen, lParam );
1341 TRACE("solid pen %08lx, ret=%d\n",
1342 solid_colors[i], retval);
1348 /* Enumerate solid brushes */
1349 for (i = 0; i < sizeof(solid_colors)/sizeof(solid_colors[0]); i++)
1351 brush.lbStyle = BS_SOLID;
1352 brush.lbColor = solid_colors[i];
1354 retval = lpEnumFunc( &brush, lParam );
1355 TRACE("solid brush %08lx, ret=%d\n",
1356 solid_colors[i], retval);
1360 /* Now enumerate hatched brushes */
1361 if (retval) for (i = HS_HORIZONTAL; i <= HS_DIAGCROSS; i++)
1363 brush.lbStyle = BS_HATCHED;
1364 brush.lbColor = RGB(0,0,0);
1366 retval = lpEnumFunc( &brush, lParam );
1367 TRACE("hatched brush %d, ret=%d\n",
1374 /* FIXME: implement Win32 types */
1375 WARN("(%d): Invalid type\n", nObjType );
1382 /***********************************************************************
1383 * IsGDIObject (GDI.462)
1385 * returns type of object if valid (W95 system programming secrets p. 264-5)
1387 BOOL16 WINAPI IsGDIObject16( HGDIOBJ16 handle16 )
1390 HGDIOBJ handle = HGDIOBJ_32( handle16 );
1392 GDIOBJHDR *object = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
1395 magic = GDIMAGIC(object->wMagic) - PEN_MAGIC + 1;
1396 GDI_ReleaseObj( handle );
1402 /***********************************************************************
1403 * SetObjectOwner (GDI32.@)
1405 void WINAPI SetObjectOwner( HGDIOBJ handle, HANDLE owner )
1411 /***********************************************************************
1412 * MakeObjectPrivate (GDI.463)
1414 * What does that mean ?
1415 * Some little docu can be found in "Undocumented Windows",
1416 * but this is basically useless.
1417 * At least we know that this flags the GDI object's wMagic
1418 * with 0x2000 (OBJECT_PRIVATE), so we just do it.
1419 * But Wine doesn't react on that yet.
1421 void WINAPI MakeObjectPrivate16( HGDIOBJ16 handle16, BOOL16 private )
1423 HGDIOBJ handle = HGDIOBJ_32( handle16 );
1424 GDIOBJHDR *ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
1427 ERR("invalid GDI object %p !\n", handle);
1430 ptr->wMagic |= OBJECT_PRIVATE;
1431 GDI_ReleaseObj( handle );
1435 /***********************************************************************
1436 * GdiFlush (GDI32.@)
1438 BOOL WINAPI GdiFlush(void)
1440 return TRUE; /* FIXME */
1444 /***********************************************************************
1445 * GdiGetBatchLimit (GDI32.@)
1447 DWORD WINAPI GdiGetBatchLimit(void)
1449 return 1; /* FIXME */
1453 /***********************************************************************
1454 * GdiSetBatchLimit (GDI32.@)
1456 DWORD WINAPI GdiSetBatchLimit( DWORD limit )
1458 return 1; /* FIXME */
1462 /***********************************************************************
1463 * GdiSeeGdiDo (GDI.452)
1465 DWORD WINAPI GdiSeeGdiDo16( WORD wReqType, WORD wParam1, WORD wParam2,
1470 case 0x0001: /* LocalAlloc */
1471 return LOCAL_Alloc( GDI_HeapSel, wParam1, wParam3 );
1472 case 0x0002: /* LocalFree */
1473 return LOCAL_Free( GDI_HeapSel, wParam1 );
1474 case 0x0003: /* LocalCompact */
1475 return LOCAL_Compact( GDI_HeapSel, wParam3, 0 );
1476 case 0x0103: /* LocalHeap */
1479 WARN("(wReqType=%04x): Unknown\n", wReqType);
1484 /***********************************************************************
1485 * GdiSignalProc32 (GDI.610)
1487 WORD WINAPI GdiSignalProc( UINT uCode, DWORD dwThreadOrProcessID,
1488 DWORD dwFlags, HMODULE16 hModule )
1493 /***********************************************************************
1494 * GdiInit2 (GDI.403)
1496 * See "Undocumented Windows"
1498 HANDLE16 WINAPI GdiInit216(
1499 HANDLE16 h1, /* [in] GDI object */
1500 HANDLE16 h2 /* [in] global data */
1503 FIXME("(%04x, %04x), stub.\n", h1, h2);
1505 return 0xffff; /* undefined return value */
1506 return h1; /* FIXME: should be the memory handle of h1 */
1509 /***********************************************************************
1510 * FinalGdiInit (GDI.405)
1512 void WINAPI FinalGdiInit16( HBRUSH16 hPattern /* [in] fill pattern of desktop */ )
1516 /***********************************************************************
1517 * GdiFreeResources (GDI.609)
1519 WORD WINAPI GdiFreeResources16( DWORD reserve )
1521 return (WORD)( (int)LOCAL_CountFree( GDI_HeapSel ) * 100 /
1522 (int)LOCAL_HeapSize( GDI_HeapSel ) );
1526 /*******************************************************************
1527 * GetColorAdjustment [GDI32.@]
1531 BOOL WINAPI GetColorAdjustment(HDC hdc, LPCOLORADJUSTMENT lpca)
1533 FIXME("GetColorAdjustment, stub\n");
1537 /*******************************************************************
1538 * GdiComment [GDI32.@]
1542 BOOL WINAPI GdiComment(HDC hdc, UINT cbSize, const BYTE *lpData)
1544 DC *dc = DC_GetDCPtr(hdc);
1548 if (dc->funcs->pGdiComment)
1549 ret = dc->funcs->pGdiComment( dc->physDev, cbSize, lpData );
1551 GDI_ReleaseObj( hdc );
1555 /*******************************************************************
1556 * SetColorAdjustment [GDI32.@]
1560 BOOL WINAPI SetColorAdjustment(HDC hdc, const COLORADJUSTMENT* lpca)
1562 FIXME("SetColorAdjustment, stub\n");