diff --git a/dlls/gdi32/gdiobj.c b/dlls/gdi32/gdiobj.c index 16a7b897e30..326414372e6 100644 --- a/dlls/gdi32/gdiobj.c +++ b/dlls/gdi32/gdiobj.c @@ -613,6 +613,16 @@ static void set_gdi_shared(void) NtCurrentTeb()->Peb->GdiSharedHandleTable = &gdi_shared; } +static HGDIOBJ make_stock_object( HGDIOBJ obj ) +{ + GDI_HANDLE_ENTRY *entry; + + if (!(entry = handle_entry( obj ))) return 0; + entry_obj( entry )->system = TRUE; + entry->StockFlag = 1; + return entry_to_handle( entry ); +} + /*********************************************************************** * DllMain * @@ -668,8 +678,8 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) /* clear the NOSYSTEM bit on all stock objects*/ for (i = 0; i < NB_STOCK_OBJECTS; i++) { - if (stock_objects[i]) __wine_make_gdi_object_system( stock_objects[i], TRUE ); - if (scaled_stock_objects[i]) __wine_make_gdi_object_system( scaled_stock_objects[i], TRUE ); + stock_objects[i] = make_stock_object( stock_objects[i] ); + scaled_stock_objects[i] = make_stock_object( scaled_stock_objects[i] ); } return TRUE; } diff --git a/dlls/gdi32/tests/gdiobj.c b/dlls/gdi32/tests/gdiobj.c index 789c9ecb0f8..64d37e39ab6 100644 --- a/dlls/gdi32/tests/gdiobj.c +++ b/dlls/gdi32/tests/gdiobj.c @@ -396,7 +396,6 @@ static void test_shared_handle_entry( HGDIOBJ obj, unsigned int type, BOOL is_st todo_wine ok(entry->ExtType == NTGDI_OBJ_DC, "ExtType = %x, expected NTGDI_OBJ_DC\n", entry->ExtType); } - todo_wine_if(is_stock) ok(entry->StockFlag == is_stock, "StockFlag = %x\n", entry->StockFlag); ok(entry->Type == (type & 0x1f), "Type = %x, expected %x\n", entry->Type, type & 0x1f); ok(entry->Object, "Object = NULL\n"); diff --git a/include/ntgdi.h b/include/ntgdi.h index d023d10bfc6..d6d7a5572d1 100644 --- a/include/ntgdi.h +++ b/include/ntgdi.h @@ -67,8 +67,9 @@ typedef struct _GDI_HANDLE_ENTRY /* Wine extension, native uses NTGDI_OBJ_DC */ #define NTGDI_OBJ_MEMDC 0x41 -#define NTGDI_HANDLE_TYPE_SHIFT 16 -#define NTGDI_HANDLE_TYPE_MASK 0x007f0000 +#define NTGDI_HANDLE_TYPE_SHIFT 16 +#define NTGDI_HANDLE_TYPE_MASK 0x007f0000 +#define NTGDI_HANDLE_STOCK_OBJECT 0x00800000 typedef struct _GDI_SHARED_MEMORY {