From 7b205923df4c1d20f71601b359b9b4f7b676eb17 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Fri, 20 Apr 2007 22:44:37 +0000 Subject: [PATCH] Reimplement GetStockObject, based on Wine. It is bypassed in the def file. Init support code is not added yet. svn path=/trunk/; revision=26442 --- reactos/dll/win32/gdi32/include/gdi32p.h | 4 ++++ reactos/dll/win32/gdi32/objects/dc.c | 27 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/reactos/dll/win32/gdi32/include/gdi32p.h b/reactos/dll/win32/gdi32/include/gdi32p.h index aa018341e8b..4810455dc7c 100644 --- a/reactos/dll/win32/gdi32/include/gdi32p.h +++ b/reactos/dll/win32/gdi32/include/gdi32p.h @@ -29,6 +29,10 @@ typedef INT #define METAFILE_MEMORY 1 #define METAFILE_DISK 2 +#define STOCK_LAST 19 +#define DEFAULT_BITMAP (STOCK_LAST+1) +#define NB_STOCK_OBJECTS (STOCK_LAST+2) + /* TYPES *********************************************************************/ // Based on wmfapi.h and Wine. This is the DC_ATTR for a MetaDC file. diff --git a/reactos/dll/win32/gdi32/objects/dc.c b/reactos/dll/win32/gdi32/objects/dc.c index 3b66fb2bb43..3efc0995264 100644 --- a/reactos/dll/win32/gdi32/objects/dc.c +++ b/reactos/dll/win32/gdi32/objects/dc.c @@ -3,6 +3,8 @@ #define NDEBUG #include +HGDIOBJ stock_objects[NB_STOCK_OBJECTS]; // temp location. + HDC FASTCALL IntCreateDICW ( LPCWSTR lpwszDriver, @@ -577,3 +579,28 @@ GetObjectType( } +/* + * @implemented + */ +HGDIOBJ +WINAPI +GetStockObject( + INT h + ) +{ + HGDIOBJ Ret = NULL; + if ((h < 0) || (h >= NB_STOCK_OBJECTS)) return Ret; + Ret = stock_objects[h]; + if (!Ret) + { + HGDIOBJ Obj = NtGdiGetStockObject( h ); + + if (GdiIsHandleValid(Obj)) + { + stock_objects[h] = Obj; + return Obj; + }// Returns Null anyway. + } + return Ret; +} +