diff --git a/reactos/subsystems/win32/win32k/include/dc.h b/reactos/subsystems/win32/win32k/include/dc.h index e124521e800..131712002d2 100644 --- a/reactos/subsystems/win32/win32k/include/dc.h +++ b/reactos/subsystems/win32/win32k/include/dc.h @@ -46,8 +46,6 @@ typedef struct _WIN_DC_INFO FARPROC lpfnPrint; /* AbortProc for Printing */ #endif - INT CursPosX; /* Current position */ - INT CursPosY; INT ArcDirection; XFORM xformWorld2Wnd; /* World-to-window transformation */ diff --git a/reactos/subsystems/win32/win32k/objects/dc.c b/reactos/subsystems/win32/win32k/objects/dc.c index 2d5256ba3b3..6e63ee15b07 100644 --- a/reactos/subsystems/win32/win32k/objects/dc.c +++ b/reactos/subsystems/win32/win32k/objects/dc.c @@ -1150,7 +1150,7 @@ NtGdiGetCurrentObject(HDC hDC, UINT ObjectType) return SelObject; } -DC_GET_VAL_EX ( GetCurrentPositionEx, w.CursPosX, w.CursPosY, POINT, x, y ) +DC_GET_VAL_EX ( GetCurrentPositionEx, Dc_Attr.ptlCurrent.x, Dc_Attr.ptlCurrent.y, POINT, x, y ) BOOL FASTCALL IntGdiGetDCOrgEx(DC *dc, LPPOINT Point) @@ -1317,8 +1317,8 @@ IntGdiGetDCState(HDC hDC) newdc->w.DCOrgX = dc->w.DCOrgX; newdc->w.DCOrgY = dc->w.DCOrgY; #endif - newdc->w.CursPosX = dc->w.CursPosX; - newdc->w.CursPosY = dc->w.CursPosY; + newdc->Dc_Attr.ptlCurrent.x = dc->Dc_Attr.ptlCurrent.x; + newdc->Dc_Attr.ptlCurrent.y = dc->Dc_Attr.ptlCurrent.y; newdc->w.ArcDirection = dc->w.ArcDirection; newdc->w.xformWorld2Wnd = dc->w.xformWorld2Wnd; newdc->w.xformWorld2Vport = dc->w.xformWorld2Vport; @@ -1398,8 +1398,8 @@ IntGdiSetDCState ( HDC hDC, HDC hDCSave ) dc->w.DCOrgX = dcs->w.DCOrgX; dc->w.DCOrgY = dcs->w.DCOrgY; #endif - dc->w.CursPosX = dcs->w.CursPosX; - dc->w.CursPosY = dcs->w.CursPosY; + dc->Dc_Attr.ptlCurrent.x = dcs->Dc_Attr.ptlCurrent.x; + dc->Dc_Attr.ptlCurrent.y = dcs->Dc_Attr.ptlCurrent.y; dc->w.ArcDirection = dcs->w.ArcDirection; dc->w.xformWorld2Wnd = dcs->w.xformWorld2Wnd; @@ -2128,6 +2128,167 @@ IntGdiSetHookFlags(HDC hDC, WORD Flags) return wRet; } + +BOOL +STDCALL +NtGdiGetDCDword( + HDC hDC, + UINT u, + DWORD *Result + ) +{ + BOOL Ret = TRUE; + DC *dc; + DWORD SafeResult = 0; + NTSTATUS Status = STATUS_SUCCESS; + + if(!Result) + { + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return FALSE; + } + + dc = DC_LockDc(hDC); + if(!dc) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return FALSE; + } + + switch (u) + { + case GdiGetJournal: + break; + case GdiGetRelAbs: + break; + case GdiGetBreakExtra: + break; + case GdiGerCharBreak: + break; + case GdiGetArcDirection: + break; + case GdiGetEMFRestorDc: + break; + case GdiGetFontLanguageInfo: + break; + case GdiGetIsMemDc: + break; + case GdiGetMapMode: + break; + case GdiGetTextCharExtra: + break; + default: + SetLastWin32Error(ERROR_INVALID_PARAMETER); + Ret = FALSE; + break; + } + + if (Ret) + { + _SEH_TRY + { + ProbeForWrite(Result, + sizeof(DWORD), + 1); + *Result = SafeResult; + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + } + + if(!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + DC_UnlockDc(dc); + return FALSE; + } + + DC_UnlockDc(dc); + return Ret; +} + +BOOL +STDCALL +NtGdiGetAndSetDCDword( + HDC hDC, + UINT u, + DWORD dwIn, + DWORD *Result + ) +{ + BOOL Ret = TRUE; + DC *dc; + DWORD SafeResult = 0; + NTSTATUS Status = STATUS_SUCCESS; + + if(!Result) + { + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return FALSE; + } + + dc = DC_LockDc(hDC); + if(!dc) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return FALSE; + } + + switch (u) + { + case GdtGetSetCopyCount: + break; + case GdiGetSetTextAlign: + break; + case GdiGetSetRelAbs: + break; + case GdiGetSetTextCharExtra: + break; + case GdiGetSetSelectFont: + break; + case GdiGetSetMapperFlagsInternal: + break; + case GdiGetSetMapMode: + break; + case GdiGetSetArcDirection: + break; + default: + SetLastWin32Error(ERROR_INVALID_PARAMETER); + Ret = FALSE; + break; + } + + if (Ret) + { + _SEH_TRY + { + ProbeForWrite(Result, + sizeof(DWORD), + 1); + *Result = SafeResult; + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + } + + if(!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + DC_UnlockDc(dc); + return FALSE; + } + + DC_UnlockDc(dc); + return Ret; +} + + DC_SET_MODE( NtGdiSetBkMode, Dc_Attr.jBkMode, TRANSPARENT, OPAQUE ) DC_SET_MODE( NtGdiSetPolyFillMode, Dc_Attr.jFillMode, ALTERNATE, WINDING ) // DC_SET_MODE( NtGdiSetRelAbs, Dc_Attr.lRelAbs, ABSOLUTE, RELATIVE ) diff --git a/reactos/subsystems/win32/win32k/objects/line.c b/reactos/subsystems/win32/win32k/objects/line.c index de73b5a8a14..a2c1a602e37 100644 --- a/reactos/subsystems/win32/win32k/objects/line.c +++ b/reactos/subsystems/win32/win32k/objects/line.c @@ -35,11 +35,11 @@ IntGdiMoveToEx(DC *dc, if ( Point ) { - Point->x = dc->w.CursPosX; - Point->y = dc->w.CursPosY; + Point->x = dc->Dc_Attr.ptlCurrent.x; + Point->y = dc->Dc_Attr.ptlCurrent.y; } - dc->w.CursPosX = X; - dc->w.CursPosY = Y; + dc->Dc_Attr.ptlCurrent.x = X; + dc->Dc_Attr.ptlCurrent.y = Y; PathIsOpen = PATH_IsPathOpen(dc->w.path); @@ -67,8 +67,8 @@ IntGdiLineTo(DC *dc, if (Ret) { // FIXME - PATH_LineTo should maybe do this... - dc->w.CursPosX = XEnd; - dc->w.CursPosY = YEnd; + dc->Dc_Attr.ptlCurrent.x = XEnd; + dc->Dc_Attr.ptlCurrent.y = YEnd; } return Ret; } @@ -81,8 +81,8 @@ IntGdiLineTo(DC *dc, return FALSE; } - Points[0].x = dc->w.CursPosX; - Points[0].y = dc->w.CursPosY; + Points[0].x = dc->Dc_Attr.ptlCurrent.x; + Points[0].y = dc->Dc_Attr.ptlCurrent.y; Points[1].x = XEnd; Points[1].y = YEnd; @@ -122,8 +122,8 @@ IntGdiLineTo(DC *dc, if (Ret) { - dc->w.CursPosX = XEnd; - dc->w.CursPosY = YEnd; + dc->Dc_Attr.ptlCurrent.x = XEnd; + dc->Dc_Attr.ptlCurrent.y = YEnd; } return Ret; @@ -172,8 +172,8 @@ IntGdiPolyBezierTo(DC *dc, npt = ExAllocatePoolWithTag(PagedPool, sizeof(POINT) * (Count + 1), TAG_BEZIER); if ( npt ) { - npt[0].x = dc->w.CursPosX; - npt[0].y = dc->w.CursPosY; + npt[0].x = dc->Dc_Attr.ptlCurrent.x; + npt[0].y = dc->Dc_Attr.ptlCurrent.y; memcpy(npt + 1, pt, sizeof(POINT) * Count); ret = IntGdiPolyBezier(dc, npt, Count+1); ExFreePool(npt); @@ -181,8 +181,8 @@ IntGdiPolyBezierTo(DC *dc, } if ( ret ) { - dc->w.CursPosX = pt[Count-1].x; - dc->w.CursPosY = pt[Count-1].y; + dc->Dc_Attr.ptlCurrent.x = pt[Count-1].x; + dc->Dc_Attr.ptlCurrent.y = pt[Count-1].y; } return ret; @@ -262,8 +262,8 @@ IntGdiPolylineTo(DC *dc, POINT *pts = ExAllocatePoolWithTag(PagedPool, sizeof(POINT) * (Count + 1), TAG_SHAPE); if ( pts ) { - pts[0].x = dc->w.CursPosX; - pts[0].y = dc->w.CursPosY; + pts[0].x = dc->Dc_Attr.ptlCurrent.x; + pts[0].y = dc->Dc_Attr.ptlCurrent.y; memcpy( pts + 1, pt, sizeof(POINT) * Count); ret = IntGdiPolyline(dc, pts, Count + 1); ExFreePool(pts); @@ -271,8 +271,8 @@ IntGdiPolylineTo(DC *dc, } if ( ret ) { - dc->w.CursPosX = pt[Count-1].x; - dc->w.CursPosY = pt[Count-1].y; + dc->Dc_Attr.ptlCurrent.x = pt[Count-1].x; + dc->Dc_Attr.ptlCurrent.y = pt[Count-1].y; } return ret; @@ -636,8 +636,8 @@ NtGdiPolyDraw( } /* if no moveto occurs, we will close the figure here */ - lastmove.x = dc->w.CursPosX; - lastmove.y = dc->w.CursPosY; + lastmove.x = dc->Dc_Attr.ptlCurrent.x; + lastmove.y = dc->Dc_Attr.ptlCurrent.y; /* now let's draw */ for( i = 0; i < cCount; i++ ) @@ -645,16 +645,16 @@ NtGdiPolyDraw( if( lpbTypes[i] == PT_MOVETO ) { IntGdiMoveToEx( dc, lppt[i].x, lppt[i].y, NULL ); - lastmove.x = dc->w.CursPosX; - lastmove.y = dc->w.CursPosY; + lastmove.x = dc->Dc_Attr.ptlCurrent.x; + lastmove.y = dc->Dc_Attr.ptlCurrent.y; } else if( lpbTypes[i] & PT_LINETO ) IntGdiLineTo( dc, lppt[i].x, lppt[i].y ); else if( lpbTypes[i] & PT_BEZIERTO ) { POINT pts[4]; - pts[0].x = dc->w.CursPosX; - pts[0].y = dc->w.CursPosY; + pts[0].x = dc->Dc_Attr.ptlCurrent.x; + pts[0].y = dc->Dc_Attr.ptlCurrent.y; RtlCopyMemory(pts + 1, &lppt[i], sizeof(POINT) * 3); IntGdiPolyBezier(dc, pts, 4); i += 2; diff --git a/reactos/subsystems/win32/win32k/w32ksvc.db b/reactos/subsystems/win32/win32k/w32ksvc.db index 0a91ee518db..7391a4508b0 100644 --- a/reactos/subsystems/win32/win32k/w32ksvc.db +++ b/reactos/subsystems/win32/win32k/w32ksvc.db @@ -161,7 +161,7 @@ NtGdiFlush 0 # NtGdiForceUFIMapping 2 NtGdiFrameRgn 5 # NtGdiFullscreenControl 5 -# NtGdiGetAndSetDCDword 4 +NtGdiGetAndSetDCDword 4 # NtGdiGetAppClipBox 2 NtGdiGetBitmapBits 3 # NtGdiGetBitmapDimension 2 @@ -173,7 +173,7 @@ NtGdiGetCharSet 1 # NtGdiGetCharWidthInfo 2 NtGdiGetColorAdjustment 2 # NtGdiGetColorSpaceforBitmap 1 -# NtGdiGetDCDword 3 +NtGdiGetDCDword 3 # NtGdiGetDCforBitmap 1 # NtGdiGetDCObject 2 NtGdiGetDCPoint 3