diff --git a/reactos/include/defines.h b/reactos/include/defines.h index e71c52138cd..3c6b00db51a 100644 --- a/reactos/include/defines.h +++ b/reactos/include/defines.h @@ -1092,19 +1092,20 @@ extern "C" { #define TRUETYPE_FONTTYPE (4) /* EnumObjects, GetCurrentObject, GetObjectType */ -#define OBJ_BRUSH (2) #define OBJ_PEN (1) +#define OBJ_BRUSH (2) +#define OBJ_DC (3) +#define OBJ_METADC (4) #define OBJ_PAL (5) #define OBJ_FONT (6) #define OBJ_BITMAP (7) -#define OBJ_EXTPEN (11) #define OBJ_REGION (8) -#define OBJ_DC (3) -#define OBJ_MEMDC (10) #define OBJ_METAFILE (9) -#define OBJ_METADC (4) -#define OBJ_ENHMETAFILE (13) +#define OBJ_MEMDC (10) +#define OBJ_EXTPEN (11) #define OBJ_ENHMETADC (12) +#define OBJ_ENHMETAFILE (13) +#define OBJ_COLORSPACE (14) /* EnumPrinters */ diff --git a/reactos/lib/gdi32/misc/stubs.c b/reactos/lib/gdi32/misc/stubs.c index 016457c0d0c..ab3eeb849cc 100644 --- a/reactos/lib/gdi32/misc/stubs.c +++ b/reactos/lib/gdi32/misc/stubs.c @@ -1,4 +1,4 @@ -/* $Id: stubs.c,v 1.55 2004/04/25 14:46:53 weiden Exp $ +/* $Id: stubs.c,v 1.56 2004/04/25 15:31:43 weiden Exp $ * * reactos/lib/gdi32/misc/stubs.c * @@ -256,21 +256,6 @@ GetMetaRgn( } -/* - * @unimplemented - */ -HGDIOBJ -STDCALL -GetCurrentObject( - HDC a0, - UINT a1 - ) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - - /* * @unimplemented */ diff --git a/reactos/lib/gdi32/objects/dc.c b/reactos/lib/gdi32/objects/dc.c index d9e1dc8e196..643333aa17c 100644 --- a/reactos/lib/gdi32/objects/dc.c +++ b/reactos/lib/gdi32/objects/dc.c @@ -1030,3 +1030,16 @@ FixBrushOrgEx( return FALSE; } + +/* + * @implemented + */ +HGDIOBJ +STDCALL +GetCurrentObject( + HDC hdc, + UINT uObjectType + ) +{ + return NtGdiGetCurrentObject(hdc, uObjectType); +} diff --git a/reactos/subsys/win32k/objects/dc.c b/reactos/subsys/win32k/objects/dc.c index f930ace7f93..78e6494aa24 100644 --- a/reactos/subsys/win32k/objects/dc.c +++ b/reactos/subsys/win32k/objects/dc.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: dc.c,v 1.130 2004/04/25 12:51:53 weiden Exp $ +/* $Id: dc.c,v 1.131 2004/04/25 15:31:43 weiden Exp $ * * DC.C - Device context functions * @@ -56,6 +56,10 @@ #define NDEBUG #include +#ifndef OBJ_COLORSPACE +#define OBJ_COLORSPACE (14) +#endif + static GDIDEVICE PrimarySurface; /* FIXME: DCs should probably be thread safe */ @@ -962,7 +966,43 @@ DC_GET_VAL( HRGN, NtGdiGetClipRgn, w.hClipRgn ) HGDIOBJ STDCALL NtGdiGetCurrentObject(HDC hDC, UINT ObjectType) { - UNIMPLEMENTED; + HGDIOBJ SelObject; + DC *dc; + + if(!(dc = DC_LockDc(hDC))) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return NULL; + } + + switch(ObjectType) + { + case OBJ_PEN: + SelObject = dc->w.hPen; + break; + case OBJ_BRUSH: + SelObject = dc->w.hBrush; + break; + case OBJ_PAL: + DPRINT1("FIXME: NtGdiGetCurrentObject() ObjectType OBJ_PAL not supported yet!\n"); + break; + case OBJ_FONT: + SelObject = dc->w.hFont; + break; + case OBJ_BITMAP: + SelObject = dc->w.hBitmap; + break; + case OBJ_COLORSPACE: + DPRINT1("FIXME: NtGdiGetCurrentObject() ObjectType OBJ_COLORSPACE not supported yet!\n"); + break; + default: + SelObject = NULL; + SetLastWin32Error(ERROR_INVALID_PARAMETER); + break; + } + + DC_UnlockDc(hDC); + return SelObject; } DC_GET_VAL_EX ( GetCurrentPositionEx, w.CursPosX, w.CursPosY, POINT, x, y )