reactos/reactos/subsystems/win32/win32k/objects/coord.c

1033 lines
24 KiB
C
Raw Normal View History

/*
* ReactOS W32 Subsystem
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
2002-07-04 David Welch <welch@computer2.darkstar.org> * subsys/win32k/include/callback.h: Fixed callback argument definitions. * subsys/win32k/ntuser/winpos.c: Implemented some more of the windows sizing/moving code. * subsys/win32k/ntuser/painting.c: Implemented some more of the window painting code. * subsys/win32k/objects/coord.c: Implemented LPtoDP and DPtoLP. * subsys/win32k/objects/region.c: Added stubs for some more region functions. 2002-07-04 David Welch <welch@computer2.darkstar.org> * ntoskrnl/ps/process.c (NtCreateProcess): Duplicate the process desktop handle as well. 2002-07-04 David Welch <welch@computer2.darkstar.org> * ntoskrnl/se/token.c: Don't call the ZwXXX variant of system calls when in system context. 2002-07-04 David Welch <welch@computer2.darkstar.org> * ntoskrnl/Makefile: Added file with MDA output code. * ntoskrnl/kd/kdebug.c: Recognize MDA as a destination for debug output. 2002-07-04 David Welch <welch@computer2.darkstar.org> * lib/user32/windows/defwnd.c: Implemented some more of the default window handler. 2002-07-04 David Welch <welch@computer2.darkstar.org> * lib/user32/misc/stubs.c: Removed some stubs to seperate files. 2002-07-04 David Welch <welch@computer2.darkstar.org> * lib/user32/user32.def: Export ScreenToClient otherwise we get problems when code in user32 tries to call it. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/win32k/region.h: Added prototypes for some missing region functions. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/win32k/ntuser.h: Added prototypes for some missing NtUserXXX functions. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/user32/wininternal.h: Added some constants for private GetDCEx styles that WINE needs. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/user32/callback.h: Fixed callbacks for messages with parameters. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/napi/win32.h (W32THREAD): Added pointer to the thread's desktop. * include/napi/win32.h (W32PROCESS): Removed handle table, added a pointer to the process's window station. * subsys/win32k/ntuser/guicheck.c (W32kGuiCheck): Reference a process's window station on the first win32k system call. Reference a thread's desktop on the first win32k system call. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/messages.h: Added some missing WM_XXX constants. 2002-07-04 David Welch <welch@computer2.darkstar.org> * drivers/dd/ide/makefile: Compiling with debugging messages needs libgcc to be linked in. 2002-07-04 David Welch <welch@computer2.darkstar.org> * iface/addsys/genw32k.c: Generate a variable with the number of system calls. * iface/native/genntdll.c: Generate a proper stack frame for the user system call stubs. * ntoskrnl/ke/i386/syscall.S: Generate a proper stack frame for the handler for system calls. 2002-07-04 David Welch <welch@computer2.darkstar.org> * Makefile: Build the GUI startup application. * subsys/system/gstart/gstart.c: Application to start up the GUI. svn path=/trunk/; revision=3179
2002-07-04 19:56:38 +00:00
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* PURPOSE: Coordinate systems
* FILE: subsys/win32k/objects/coord.c
* PROGRAMER: Unknown
*/
2002-07-04 David Welch <welch@computer2.darkstar.org> * subsys/win32k/include/callback.h: Fixed callback argument definitions. * subsys/win32k/ntuser/winpos.c: Implemented some more of the windows sizing/moving code. * subsys/win32k/ntuser/painting.c: Implemented some more of the window painting code. * subsys/win32k/objects/coord.c: Implemented LPtoDP and DPtoLP. * subsys/win32k/objects/region.c: Added stubs for some more region functions. 2002-07-04 David Welch <welch@computer2.darkstar.org> * ntoskrnl/ps/process.c (NtCreateProcess): Duplicate the process desktop handle as well. 2002-07-04 David Welch <welch@computer2.darkstar.org> * ntoskrnl/se/token.c: Don't call the ZwXXX variant of system calls when in system context. 2002-07-04 David Welch <welch@computer2.darkstar.org> * ntoskrnl/Makefile: Added file with MDA output code. * ntoskrnl/kd/kdebug.c: Recognize MDA as a destination for debug output. 2002-07-04 David Welch <welch@computer2.darkstar.org> * lib/user32/windows/defwnd.c: Implemented some more of the default window handler. 2002-07-04 David Welch <welch@computer2.darkstar.org> * lib/user32/misc/stubs.c: Removed some stubs to seperate files. 2002-07-04 David Welch <welch@computer2.darkstar.org> * lib/user32/user32.def: Export ScreenToClient otherwise we get problems when code in user32 tries to call it. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/win32k/region.h: Added prototypes for some missing region functions. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/win32k/ntuser.h: Added prototypes for some missing NtUserXXX functions. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/user32/wininternal.h: Added some constants for private GetDCEx styles that WINE needs. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/user32/callback.h: Fixed callbacks for messages with parameters. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/napi/win32.h (W32THREAD): Added pointer to the thread's desktop. * include/napi/win32.h (W32PROCESS): Removed handle table, added a pointer to the process's window station. * subsys/win32k/ntuser/guicheck.c (W32kGuiCheck): Reference a process's window station on the first win32k system call. Reference a thread's desktop on the first win32k system call. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/messages.h: Added some missing WM_XXX constants. 2002-07-04 David Welch <welch@computer2.darkstar.org> * drivers/dd/ide/makefile: Compiling with debugging messages needs libgcc to be linked in. 2002-07-04 David Welch <welch@computer2.darkstar.org> * iface/addsys/genw32k.c: Generate a variable with the number of system calls. * iface/native/genntdll.c: Generate a proper stack frame for the user system call stubs. * ntoskrnl/ke/i386/syscall.S: Generate a proper stack frame for the handler for system calls. 2002-07-04 David Welch <welch@computer2.darkstar.org> * Makefile: Build the GUI startup application. * subsys/system/gstart/gstart.c: Application to start up the GUI. svn path=/trunk/; revision=3179
2002-07-04 19:56:38 +00:00
/* INCLUDES ******************************************************************/
#include <w32k.h>
#define NDEBUG
#include <debug.h>
2002-07-04 David Welch <welch@computer2.darkstar.org> * subsys/win32k/include/callback.h: Fixed callback argument definitions. * subsys/win32k/ntuser/winpos.c: Implemented some more of the windows sizing/moving code. * subsys/win32k/ntuser/painting.c: Implemented some more of the window painting code. * subsys/win32k/objects/coord.c: Implemented LPtoDP and DPtoLP. * subsys/win32k/objects/region.c: Added stubs for some more region functions. 2002-07-04 David Welch <welch@computer2.darkstar.org> * ntoskrnl/ps/process.c (NtCreateProcess): Duplicate the process desktop handle as well. 2002-07-04 David Welch <welch@computer2.darkstar.org> * ntoskrnl/se/token.c: Don't call the ZwXXX variant of system calls when in system context. 2002-07-04 David Welch <welch@computer2.darkstar.org> * ntoskrnl/Makefile: Added file with MDA output code. * ntoskrnl/kd/kdebug.c: Recognize MDA as a destination for debug output. 2002-07-04 David Welch <welch@computer2.darkstar.org> * lib/user32/windows/defwnd.c: Implemented some more of the default window handler. 2002-07-04 David Welch <welch@computer2.darkstar.org> * lib/user32/misc/stubs.c: Removed some stubs to seperate files. 2002-07-04 David Welch <welch@computer2.darkstar.org> * lib/user32/user32.def: Export ScreenToClient otherwise we get problems when code in user32 tries to call it. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/win32k/region.h: Added prototypes for some missing region functions. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/win32k/ntuser.h: Added prototypes for some missing NtUserXXX functions. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/user32/wininternal.h: Added some constants for private GetDCEx styles that WINE needs. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/user32/callback.h: Fixed callbacks for messages with parameters. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/napi/win32.h (W32THREAD): Added pointer to the thread's desktop. * include/napi/win32.h (W32PROCESS): Removed handle table, added a pointer to the process's window station. * subsys/win32k/ntuser/guicheck.c (W32kGuiCheck): Reference a process's window station on the first win32k system call. Reference a thread's desktop on the first win32k system call. 2002-07-04 David Welch <welch@computer2.darkstar.org> * include/messages.h: Added some missing WM_XXX constants. 2002-07-04 David Welch <welch@computer2.darkstar.org> * drivers/dd/ide/makefile: Compiling with debugging messages needs libgcc to be linked in. 2002-07-04 David Welch <welch@computer2.darkstar.org> * iface/addsys/genw32k.c: Generate a variable with the number of system calls. * iface/native/genntdll.c: Generate a proper stack frame for the user system call stubs. * ntoskrnl/ke/i386/syscall.S: Generate a proper stack frame for the handler for system calls. 2002-07-04 David Welch <welch@computer2.darkstar.org> * Makefile: Build the GUI startup application. * subsys/system/gstart/gstart.c: Application to start up the GUI. svn path=/trunk/; revision=3179
2002-07-04 19:56:38 +00:00
/* FUNCTIONS *****************************************************************/
void FASTCALL
IntFixIsotropicMapping(PDC dc)
{
PDC_ATTR pDcAttr;
LONG fx, fy, s;
/* Get a pointer to the DC_ATTR */
pDcAttr = dc->pDc_Attr;
if (!pDcAttr) pDcAttr = &dc->Dc_Attr;
/* Check if all values are valid */
if (pDcAttr->szlWindowExt.cx == 0 || pDcAttr->szlWindowExt.cy == 0 ||
pDcAttr->szlViewportExt.cx == 0 || pDcAttr->szlViewportExt.cy == 0)
{
/* Don't recalculate */
return;
}
fx = abs(pDcAttr->szlWindowExt.cx * pDcAttr->szlViewportExt.cy);
fy = abs(pDcAttr->szlWindowExt.cy * pDcAttr->szlViewportExt.cx);
if (fy > fx)
{
s = pDcAttr->szlWindowExt.cy * pDcAttr->szlViewportExt.cx > 0 ? 1 : -1;
pDcAttr->szlViewportExt.cx = s * fx / pDcAttr->szlWindowExt.cy;
}
else if (fx > fy)
{
s = pDcAttr->szlWindowExt.cx * pDcAttr->szlViewportExt.cy > 0 ? 1 : -1;
pDcAttr->szlViewportExt.cy = s * fy / pDcAttr->szlWindowExt.cx;
}
}
BOOL FASTCALL
IntGdiCombineTransform(LPXFORM XFormResult,
LPXFORM xform1,
LPXFORM xform2)
{
XFORM xformTemp;
/* Check for illegal parameters */
if (!XFormResult || !xform1 || !xform2)
{
return FALSE;
}
/* Create the result in a temporary XFORM, since xformResult may be
* equal to xform1 or xform2 */
xformTemp.eM11 = xform1->eM11 * xform2->eM11 + xform1->eM12 * xform2->eM21;
xformTemp.eM12 = xform1->eM11 * xform2->eM12 + xform1->eM12 * xform2->eM22;
xformTemp.eM21 = xform1->eM21 * xform2->eM11 + xform1->eM22 * xform2->eM21;
xformTemp.eM22 = xform1->eM21 * xform2->eM12 + xform1->eM22 * xform2->eM22;
xformTemp.eDx = xform1->eDx * xform2->eM11 + xform1->eDy * xform2->eM21 + xform2->eDx;
xformTemp.eDy = xform1->eDx * xform2->eM12 + xform1->eDy * xform2->eM22 + xform2->eDy;
*XFormResult = xformTemp;
return TRUE;
}
BOOL APIENTRY NtGdiCombineTransform(LPXFORM UnsafeXFormResult,
LPXFORM Unsafexform1,
LPXFORM Unsafexform2)
{
BOOL Ret;
_SEH2_TRY
{
ProbeForWrite(UnsafeXFormResult, sizeof(XFORM), 1);
ProbeForRead(Unsafexform1, sizeof(XFORM), 1);
ProbeForRead(Unsafexform2, sizeof(XFORM), 1);
Ret = IntGdiCombineTransform(UnsafeXFormResult,
Unsafexform1,
Unsafexform2);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
Ret = FALSE;
}
_SEH2_END;
return Ret;
}
int
FASTCALL
IntGetGraphicsMode(PDC dc)
{
PDC_ATTR Dc_Attr;
ASSERT(dc);
Dc_Attr = dc->pDc_Attr;
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
return Dc_Attr->iGraphicsMode;
}
BOOL
FASTCALL
IntGdiModifyWorldTransform(PDC pDc,
CONST LPXFORM lpXForm,
DWORD Mode)
{
ASSERT(pDc);
XFORM xformWorld2Wnd;
switch (Mode)
{
case MWT_IDENTITY:
xformWorld2Wnd.eM11 = 1.0f;
xformWorld2Wnd.eM12 = 0.0f;
xformWorld2Wnd.eM21 = 0.0f;
xformWorld2Wnd.eM22 = 1.0f;
xformWorld2Wnd.eDx = 0.0f;
xformWorld2Wnd.eDy = 0.0f;
XForm2MatrixS(&pDc->DcLevel.mxWorldToPage, &xformWorld2Wnd);
break;
case MWT_LEFTMULTIPLY:
MatrixS2XForm(&xformWorld2Wnd, &pDc->DcLevel.mxWorldToPage);
IntGdiCombineTransform(&xformWorld2Wnd, lpXForm, &xformWorld2Wnd);
XForm2MatrixS(&pDc->DcLevel.mxWorldToPage, &xformWorld2Wnd);
break;
case MWT_RIGHTMULTIPLY:
MatrixS2XForm(&xformWorld2Wnd, &pDc->DcLevel.mxWorldToPage);
IntGdiCombineTransform(&xformWorld2Wnd, &xformWorld2Wnd, lpXForm);
XForm2MatrixS(&pDc->DcLevel.mxWorldToPage, &xformWorld2Wnd);
break;
case MWT_MAX+1: // Must be MWT_SET????
XForm2MatrixS(&pDc->DcLevel.mxWorldToPage, lpXForm); // Do it like Wine.
break;
default:
return FALSE;
}
DC_UpdateXforms(pDc);
return TRUE;
}
BOOL
APIENTRY
NtGdiGetTransform(HDC hDC,
DWORD iXform,
LPXFORM XForm)
{
PDC dc;
NTSTATUS Status = STATUS_SUCCESS;
dc = DC_LockDc(hDC);
if (!dc)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
if (!XForm)
{
DC_UnlockDc(dc);
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return FALSE;
}
_SEH2_TRY
{
ProbeForWrite(XForm, sizeof(XFORM), 1);
switch (iXform)
{
case GdiWorldSpaceToPageSpace:
MatrixS2XForm(XForm, &dc->DcLevel.mxWorldToPage);
break;
default:
break;
}
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
Status = _SEH2_GetExceptionCode();
}
_SEH2_END;
DC_UnlockDc(dc);
return NT_SUCCESS(Status);
}
/*!
* Converts points from logical coordinates into device coordinates. Conversion depends on the mapping mode,
* world transfrom, viewport origin settings for the given device context.
* \param hDC device context.
* \param Points an array of POINT structures (in/out).
* \param Count number of elements in the array of POINT structures.
* \return TRUE if success.
*/
BOOL
APIENTRY
NtGdiTransformPoints(HDC hDC,
PPOINT UnsafePtsIn,
PPOINT UnsafePtOut,
INT Count,
INT iMode)
{
PDC dc;
NTSTATUS Status = STATUS_SUCCESS;
LPPOINT Points;
ULONG Size;
dc = DC_LockDc(hDC);
if (!dc)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
if (!UnsafePtsIn || !UnsafePtOut || Count <= 0)
{
DC_UnlockDc(dc);
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return FALSE;
}
Size = Count * sizeof(POINT);
Points = (LPPOINT)ExAllocatePoolWithTag(PagedPool, Size, TAG_COORD);
if (!Points)
{
DC_UnlockDc(dc);
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
_SEH2_TRY
{
ProbeForWrite(UnsafePtOut, Size, 1);
ProbeForRead(UnsafePtsIn, Size, 1);
RtlCopyMemory(Points, UnsafePtsIn, Size);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
Status = _SEH2_GetExceptionCode();
}
_SEH2_END;
if (!NT_SUCCESS(Status))
{
DC_UnlockDc(dc);
ExFreePoolWithTag(Points, TAG_COORD);
SetLastNtError(Status);
return FALSE;
}
switch (iMode)
{
case GdiDpToLp:
IntDPtoLP(dc, Points, Count);
break;
case GdiLpToDp:
IntLPtoDP(dc, Points, Count);
break;
case 2: // Not supported yet. Need testing.
default:
{
DC_UnlockDc(dc);
ExFreePoolWithTag(Points, TAG_COORD);
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return FALSE;
}
}
_SEH2_TRY
{
/* pointer was already probed! */
RtlCopyMemory(UnsafePtOut, Points, Size);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
Status = _SEH2_GetExceptionCode();
}
_SEH2_END;
if (!NT_SUCCESS(Status))
{
DC_UnlockDc(dc);
ExFreePoolWithTag(Points, TAG_COORD);
SetLastNtError(Status);
return FALSE;
}
//
// If we are getting called that means User XForms is a mess!
//
DC_UnlockDc(dc);
ExFreePoolWithTag(Points, TAG_COORD);
return TRUE;
}
BOOL
APIENTRY
NtGdiModifyWorldTransform(HDC hDC,
LPXFORM UnsafeXForm,
DWORD Mode)
{
PDC dc;
XFORM SafeXForm;
BOOL Ret = TRUE;
dc = DC_LockDc(hDC);
if (!dc)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
// The xform is permitted to be NULL for MWT_IDENTITY.
// However, if it is not NULL, then it must be valid even though it is not used.
if (UnsafeXForm != NULL || Mode != MWT_IDENTITY)
{
_SEH2_TRY
{
ProbeForRead(UnsafeXForm, sizeof(XFORM), 1);
RtlCopyMemory(&SafeXForm, UnsafeXForm, sizeof(XFORM));
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
Ret = FALSE;
}
_SEH2_END;
}
// Safe to handle kernel mode data.
if (Ret) Ret = IntGdiModifyWorldTransform(dc, &SafeXForm, Mode);
DC_UnlockDc(dc);
return Ret;
}
BOOL
APIENTRY
NtGdiOffsetViewportOrgEx(HDC hDC,
int XOffset,
int YOffset,
LPPOINT UnsafePoint)
{
PDC dc;
PDC_ATTR Dc_Attr;
NTSTATUS Status = STATUS_SUCCESS;
dc = DC_LockDc(hDC);
if (!dc)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
Dc_Attr = dc->pDc_Attr;
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
if (UnsafePoint)
{
modified include/reactos/probe.h Workaround for gcc 4.1.3. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38054#c7 modified ntoskrnl/include/internal/mm.h gcc 4.3.2 doesn't like to be told to inline MmAcquirePageListLock modified ntoskrnl/include/internal/probe.h Cleaning up after TSVN's buggy "apply patch" modified subsystems/win32/win32k/ntuser/message.c Silence a gcc 4.3.2 warning (possibly incorrectly) modified dll/directx/ddraw/ddraw.rbuild modified dll/win32/gdi32/gdi32.rbuild modified dll/win32/kernel32/kernel32.rbuild modified dll/win32/psapi/psapi.rbuild modified dll/win32/setupapi/setupapi.rbuild modified dll/win32/syssetup/syssetup.rbuild modified dll/win32/user32/user32.rbuild modified drivers/input/kbdclass/kbdclass.rbuild modified drivers/input/mouclass/mouclass.rbuild modified drivers/network/afd/afd.rbuild modified drivers/network/tcpip/tcpip.rbuild modified lib/rtl/rtl.rbuild modified subsystems/win32/win32k/win32k.rbuild modified subsystems/win32/win32k/objects/gdiobj.c gcc 4.1.3 workarounds. See embedded comments modified base/services/eventlog/eventlog.h modified dll/win32/advapi32/advapi32.h Removed superfluous includes of pseh/pseh.h modified dll/directx/ddraw/Ddraw/ddraw_displaymode.c modified dll/directx/ddraw/Ddraw/ddraw_main.c modified dll/directx/ddraw/Ddraw/ddraw_setcooperativelevel.c modified dll/directx/ddraw/Ddraw/GetCaps.c modified dll/directx/ddraw/Ddraw/GetDeviceIdentifier.c modified dll/directx/ddraw/main.c modified dll/directx/ddraw/rosdraw.h modified dll/directx/ddraw/Surface/surface_main.c ddraw migrated to PSEH 2.0 modified dll/win32/gdi32/include/precomp.h modified dll/win32/gdi32/misc/misc.c modified dll/win32/gdi32/objects/bitmap.c gdi32 migrated to PSEH 2.0 modified dll/win32/kernel32/except/except.c modified dll/win32/kernel32/file/find.c modified dll/win32/kernel32/k32.h modified dll/win32/kernel32/mem/isbad.c modified dll/win32/kernel32/misc/console.c modified dll/win32/kernel32/process/procsup.c modified dll/win32/kernel32/string/lstring.c modified dll/win32/kernel32/thread/thread.c kernel32 migrated to PSEH 2.0 modified dll/win32/psapi/precomp.h modified dll/win32/psapi/psapi.c psapi migrated to PSEH 2.0 modified dll/win32/setupapi/cfgmgr.c modified dll/win32/setupapi/setupapi_private.h setupapi migrated to PSEH 2.0 modified dll/win32/syssetup/wizard.c syssetup migrated to PSEH 2.0 modified dll/win32/user32/include/user32.h modified dll/win32/user32/windows/class.c modified dll/win32/user32/windows/text.c modified dll/win32/user32/windows/window.c user32 migrated to PSEH 2.0 modified drivers/input/kbdclass/kbdclass.c modified drivers/input/kbdclass/kbdclass.h kbdclass migrated to PSEH 2.0 modified drivers/input/mouclass/mouclass.c modified drivers/input/mouclass/mouclass.h mouclass migrated to PSEH 2.0 modified drivers/network/afd/afd/info.c modified drivers/network/afd/afd/lock.c modified drivers/network/afd/afd/tdi.c modified drivers/network/afd/afd/tdiconn.c afd migrated to PSEH 2.0 modified drivers/network/lan/lan/lan.c lan migrated to PSEH 2.0 modified drivers/network/tcpip/tcpip/dispatch.c tcpip migrated to PSEH 2.0 modified lib/rtl/debug.c modified lib/rtl/res.c modified lib/rtl/rtl.h modified lib/rtl/unicode.c modified lib/rtl/workitem.c rtl migrated to PSEH 2.0 modified ntoskrnl/include/precomp.h ntoskrnl migrated to PSEH 2.0 modified subsystems/csr/csrsrv/api.c csrsrv migrated to PSEH 2.0 modified subsystems/win32/win32k/eng/bitblt.c modified subsystems/win32/win32k/eng/mem.c modified subsystems/win32/win32k/include/mmcopy.h modified subsystems/win32/win32k/misc/copy.c modified subsystems/win32/win32k/ntuser/callback.c modified subsystems/win32/win32k/ntuser/class.c modified subsystems/win32/win32k/ntuser/clipboard.c modified subsystems/win32/win32k/ntuser/cursoricon.c modified subsystems/win32/win32k/ntuser/display.c modified subsystems/win32/win32k/ntuser/hook.c modified subsystems/win32/win32k/ntuser/input.c modified subsystems/win32/win32k/ntuser/kbdlayout.c modified subsystems/win32/win32k/ntuser/menu.c modified subsystems/win32/win32k/ntuser/misc.c modified subsystems/win32/win32k/ntuser/ntstubs.c modified subsystems/win32/win32k/ntuser/painting.c modified subsystems/win32/win32k/ntuser/simplecall.c modified subsystems/win32/win32k/ntuser/sysparams.c modified subsystems/win32/win32k/ntuser/window.c modified subsystems/win32/win32k/objects/bitblt.c modified subsystems/win32/win32k/objects/bitmaps.c modified subsystems/win32/win32k/objects/brush.c modified subsystems/win32/win32k/objects/cliprgn.c modified subsystems/win32/win32k/objects/color.c modified subsystems/win32/win32k/objects/coord.c modified subsystems/win32/win32k/objects/dc.c modified subsystems/win32/win32k/objects/dcutil.c modified subsystems/win32/win32k/objects/dibobj.c modified subsystems/win32/win32k/objects/fillshap.c modified subsystems/win32/win32k/objects/font.c modified subsystems/win32/win32k/objects/freetype.c modified subsystems/win32/win32k/objects/icm.c modified subsystems/win32/win32k/objects/line.c modified subsystems/win32/win32k/objects/path.c modified subsystems/win32/win32k/objects/pen.c modified subsystems/win32/win32k/objects/print.c modified subsystems/win32/win32k/objects/region.c modified subsystems/win32/win32k/objects/text.c modified subsystems/win32/win32k/pch.h win32k migrated to PSEH 2.0 svn path=/trunk/; revision=37776
2008-11-30 19:28:11 +00:00
_SEH2_TRY
{
ProbeForWrite(UnsafePoint, sizeof(POINT), 1);
UnsafePoint->x = Dc_Attr->ptlViewportOrg.x;
UnsafePoint->y = Dc_Attr->ptlViewportOrg.y;
if (Dc_Attr->dwLayout & LAYOUT_RTL)
{
UnsafePoint->x = -UnsafePoint->x;
}
}
modified include/reactos/probe.h Workaround for gcc 4.1.3. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38054#c7 modified ntoskrnl/include/internal/mm.h gcc 4.3.2 doesn't like to be told to inline MmAcquirePageListLock modified ntoskrnl/include/internal/probe.h Cleaning up after TSVN's buggy "apply patch" modified subsystems/win32/win32k/ntuser/message.c Silence a gcc 4.3.2 warning (possibly incorrectly) modified dll/directx/ddraw/ddraw.rbuild modified dll/win32/gdi32/gdi32.rbuild modified dll/win32/kernel32/kernel32.rbuild modified dll/win32/psapi/psapi.rbuild modified dll/win32/setupapi/setupapi.rbuild modified dll/win32/syssetup/syssetup.rbuild modified dll/win32/user32/user32.rbuild modified drivers/input/kbdclass/kbdclass.rbuild modified drivers/input/mouclass/mouclass.rbuild modified drivers/network/afd/afd.rbuild modified drivers/network/tcpip/tcpip.rbuild modified lib/rtl/rtl.rbuild modified subsystems/win32/win32k/win32k.rbuild modified subsystems/win32/win32k/objects/gdiobj.c gcc 4.1.3 workarounds. See embedded comments modified base/services/eventlog/eventlog.h modified dll/win32/advapi32/advapi32.h Removed superfluous includes of pseh/pseh.h modified dll/directx/ddraw/Ddraw/ddraw_displaymode.c modified dll/directx/ddraw/Ddraw/ddraw_main.c modified dll/directx/ddraw/Ddraw/ddraw_setcooperativelevel.c modified dll/directx/ddraw/Ddraw/GetCaps.c modified dll/directx/ddraw/Ddraw/GetDeviceIdentifier.c modified dll/directx/ddraw/main.c modified dll/directx/ddraw/rosdraw.h modified dll/directx/ddraw/Surface/surface_main.c ddraw migrated to PSEH 2.0 modified dll/win32/gdi32/include/precomp.h modified dll/win32/gdi32/misc/misc.c modified dll/win32/gdi32/objects/bitmap.c gdi32 migrated to PSEH 2.0 modified dll/win32/kernel32/except/except.c modified dll/win32/kernel32/file/find.c modified dll/win32/kernel32/k32.h modified dll/win32/kernel32/mem/isbad.c modified dll/win32/kernel32/misc/console.c modified dll/win32/kernel32/process/procsup.c modified dll/win32/kernel32/string/lstring.c modified dll/win32/kernel32/thread/thread.c kernel32 migrated to PSEH 2.0 modified dll/win32/psapi/precomp.h modified dll/win32/psapi/psapi.c psapi migrated to PSEH 2.0 modified dll/win32/setupapi/cfgmgr.c modified dll/win32/setupapi/setupapi_private.h setupapi migrated to PSEH 2.0 modified dll/win32/syssetup/wizard.c syssetup migrated to PSEH 2.0 modified dll/win32/user32/include/user32.h modified dll/win32/user32/windows/class.c modified dll/win32/user32/windows/text.c modified dll/win32/user32/windows/window.c user32 migrated to PSEH 2.0 modified drivers/input/kbdclass/kbdclass.c modified drivers/input/kbdclass/kbdclass.h kbdclass migrated to PSEH 2.0 modified drivers/input/mouclass/mouclass.c modified drivers/input/mouclass/mouclass.h mouclass migrated to PSEH 2.0 modified drivers/network/afd/afd/info.c modified drivers/network/afd/afd/lock.c modified drivers/network/afd/afd/tdi.c modified drivers/network/afd/afd/tdiconn.c afd migrated to PSEH 2.0 modified drivers/network/lan/lan/lan.c lan migrated to PSEH 2.0 modified drivers/network/tcpip/tcpip/dispatch.c tcpip migrated to PSEH 2.0 modified lib/rtl/debug.c modified lib/rtl/res.c modified lib/rtl/rtl.h modified lib/rtl/unicode.c modified lib/rtl/workitem.c rtl migrated to PSEH 2.0 modified ntoskrnl/include/precomp.h ntoskrnl migrated to PSEH 2.0 modified subsystems/csr/csrsrv/api.c csrsrv migrated to PSEH 2.0 modified subsystems/win32/win32k/eng/bitblt.c modified subsystems/win32/win32k/eng/mem.c modified subsystems/win32/win32k/include/mmcopy.h modified subsystems/win32/win32k/misc/copy.c modified subsystems/win32/win32k/ntuser/callback.c modified subsystems/win32/win32k/ntuser/class.c modified subsystems/win32/win32k/ntuser/clipboard.c modified subsystems/win32/win32k/ntuser/cursoricon.c modified subsystems/win32/win32k/ntuser/display.c modified subsystems/win32/win32k/ntuser/hook.c modified subsystems/win32/win32k/ntuser/input.c modified subsystems/win32/win32k/ntuser/kbdlayout.c modified subsystems/win32/win32k/ntuser/menu.c modified subsystems/win32/win32k/ntuser/misc.c modified subsystems/win32/win32k/ntuser/ntstubs.c modified subsystems/win32/win32k/ntuser/painting.c modified subsystems/win32/win32k/ntuser/simplecall.c modified subsystems/win32/win32k/ntuser/sysparams.c modified subsystems/win32/win32k/ntuser/window.c modified subsystems/win32/win32k/objects/bitblt.c modified subsystems/win32/win32k/objects/bitmaps.c modified subsystems/win32/win32k/objects/brush.c modified subsystems/win32/win32k/objects/cliprgn.c modified subsystems/win32/win32k/objects/color.c modified subsystems/win32/win32k/objects/coord.c modified subsystems/win32/win32k/objects/dc.c modified subsystems/win32/win32k/objects/dcutil.c modified subsystems/win32/win32k/objects/dibobj.c modified subsystems/win32/win32k/objects/fillshap.c modified subsystems/win32/win32k/objects/font.c modified subsystems/win32/win32k/objects/freetype.c modified subsystems/win32/win32k/objects/icm.c modified subsystems/win32/win32k/objects/line.c modified subsystems/win32/win32k/objects/path.c modified subsystems/win32/win32k/objects/pen.c modified subsystems/win32/win32k/objects/print.c modified subsystems/win32/win32k/objects/region.c modified subsystems/win32/win32k/objects/text.c modified subsystems/win32/win32k/pch.h win32k migrated to PSEH 2.0 svn path=/trunk/; revision=37776
2008-11-30 19:28:11 +00:00
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
modified include/reactos/probe.h Workaround for gcc 4.1.3. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38054#c7 modified ntoskrnl/include/internal/mm.h gcc 4.3.2 doesn't like to be told to inline MmAcquirePageListLock modified ntoskrnl/include/internal/probe.h Cleaning up after TSVN's buggy "apply patch" modified subsystems/win32/win32k/ntuser/message.c Silence a gcc 4.3.2 warning (possibly incorrectly) modified dll/directx/ddraw/ddraw.rbuild modified dll/win32/gdi32/gdi32.rbuild modified dll/win32/kernel32/kernel32.rbuild modified dll/win32/psapi/psapi.rbuild modified dll/win32/setupapi/setupapi.rbuild modified dll/win32/syssetup/syssetup.rbuild modified dll/win32/user32/user32.rbuild modified drivers/input/kbdclass/kbdclass.rbuild modified drivers/input/mouclass/mouclass.rbuild modified drivers/network/afd/afd.rbuild modified drivers/network/tcpip/tcpip.rbuild modified lib/rtl/rtl.rbuild modified subsystems/win32/win32k/win32k.rbuild modified subsystems/win32/win32k/objects/gdiobj.c gcc 4.1.3 workarounds. See embedded comments modified base/services/eventlog/eventlog.h modified dll/win32/advapi32/advapi32.h Removed superfluous includes of pseh/pseh.h modified dll/directx/ddraw/Ddraw/ddraw_displaymode.c modified dll/directx/ddraw/Ddraw/ddraw_main.c modified dll/directx/ddraw/Ddraw/ddraw_setcooperativelevel.c modified dll/directx/ddraw/Ddraw/GetCaps.c modified dll/directx/ddraw/Ddraw/GetDeviceIdentifier.c modified dll/directx/ddraw/main.c modified dll/directx/ddraw/rosdraw.h modified dll/directx/ddraw/Surface/surface_main.c ddraw migrated to PSEH 2.0 modified dll/win32/gdi32/include/precomp.h modified dll/win32/gdi32/misc/misc.c modified dll/win32/gdi32/objects/bitmap.c gdi32 migrated to PSEH 2.0 modified dll/win32/kernel32/except/except.c modified dll/win32/kernel32/file/find.c modified dll/win32/kernel32/k32.h modified dll/win32/kernel32/mem/isbad.c modified dll/win32/kernel32/misc/console.c modified dll/win32/kernel32/process/procsup.c modified dll/win32/kernel32/string/lstring.c modified dll/win32/kernel32/thread/thread.c kernel32 migrated to PSEH 2.0 modified dll/win32/psapi/precomp.h modified dll/win32/psapi/psapi.c psapi migrated to PSEH 2.0 modified dll/win32/setupapi/cfgmgr.c modified dll/win32/setupapi/setupapi_private.h setupapi migrated to PSEH 2.0 modified dll/win32/syssetup/wizard.c syssetup migrated to PSEH 2.0 modified dll/win32/user32/include/user32.h modified dll/win32/user32/windows/class.c modified dll/win32/user32/windows/text.c modified dll/win32/user32/windows/window.c user32 migrated to PSEH 2.0 modified drivers/input/kbdclass/kbdclass.c modified drivers/input/kbdclass/kbdclass.h kbdclass migrated to PSEH 2.0 modified drivers/input/mouclass/mouclass.c modified drivers/input/mouclass/mouclass.h mouclass migrated to PSEH 2.0 modified drivers/network/afd/afd/info.c modified drivers/network/afd/afd/lock.c modified drivers/network/afd/afd/tdi.c modified drivers/network/afd/afd/tdiconn.c afd migrated to PSEH 2.0 modified drivers/network/lan/lan/lan.c lan migrated to PSEH 2.0 modified drivers/network/tcpip/tcpip/dispatch.c tcpip migrated to PSEH 2.0 modified lib/rtl/debug.c modified lib/rtl/res.c modified lib/rtl/rtl.h modified lib/rtl/unicode.c modified lib/rtl/workitem.c rtl migrated to PSEH 2.0 modified ntoskrnl/include/precomp.h ntoskrnl migrated to PSEH 2.0 modified subsystems/csr/csrsrv/api.c csrsrv migrated to PSEH 2.0 modified subsystems/win32/win32k/eng/bitblt.c modified subsystems/win32/win32k/eng/mem.c modified subsystems/win32/win32k/include/mmcopy.h modified subsystems/win32/win32k/misc/copy.c modified subsystems/win32/win32k/ntuser/callback.c modified subsystems/win32/win32k/ntuser/class.c modified subsystems/win32/win32k/ntuser/clipboard.c modified subsystems/win32/win32k/ntuser/cursoricon.c modified subsystems/win32/win32k/ntuser/display.c modified subsystems/win32/win32k/ntuser/hook.c modified subsystems/win32/win32k/ntuser/input.c modified subsystems/win32/win32k/ntuser/kbdlayout.c modified subsystems/win32/win32k/ntuser/menu.c modified subsystems/win32/win32k/ntuser/misc.c modified subsystems/win32/win32k/ntuser/ntstubs.c modified subsystems/win32/win32k/ntuser/painting.c modified subsystems/win32/win32k/ntuser/simplecall.c modified subsystems/win32/win32k/ntuser/sysparams.c modified subsystems/win32/win32k/ntuser/window.c modified subsystems/win32/win32k/objects/bitblt.c modified subsystems/win32/win32k/objects/bitmaps.c modified subsystems/win32/win32k/objects/brush.c modified subsystems/win32/win32k/objects/cliprgn.c modified subsystems/win32/win32k/objects/color.c modified subsystems/win32/win32k/objects/coord.c modified subsystems/win32/win32k/objects/dc.c modified subsystems/win32/win32k/objects/dcutil.c modified subsystems/win32/win32k/objects/dibobj.c modified subsystems/win32/win32k/objects/fillshap.c modified subsystems/win32/win32k/objects/font.c modified subsystems/win32/win32k/objects/freetype.c modified subsystems/win32/win32k/objects/icm.c modified subsystems/win32/win32k/objects/line.c modified subsystems/win32/win32k/objects/path.c modified subsystems/win32/win32k/objects/pen.c modified subsystems/win32/win32k/objects/print.c modified subsystems/win32/win32k/objects/region.c modified subsystems/win32/win32k/objects/text.c modified subsystems/win32/win32k/pch.h win32k migrated to PSEH 2.0 svn path=/trunk/; revision=37776
2008-11-30 19:28:11 +00:00
Status = _SEH2_GetExceptionCode();
}
modified include/reactos/probe.h Workaround for gcc 4.1.3. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38054#c7 modified ntoskrnl/include/internal/mm.h gcc 4.3.2 doesn't like to be told to inline MmAcquirePageListLock modified ntoskrnl/include/internal/probe.h Cleaning up after TSVN's buggy "apply patch" modified subsystems/win32/win32k/ntuser/message.c Silence a gcc 4.3.2 warning (possibly incorrectly) modified dll/directx/ddraw/ddraw.rbuild modified dll/win32/gdi32/gdi32.rbuild modified dll/win32/kernel32/kernel32.rbuild modified dll/win32/psapi/psapi.rbuild modified dll/win32/setupapi/setupapi.rbuild modified dll/win32/syssetup/syssetup.rbuild modified dll/win32/user32/user32.rbuild modified drivers/input/kbdclass/kbdclass.rbuild modified drivers/input/mouclass/mouclass.rbuild modified drivers/network/afd/afd.rbuild modified drivers/network/tcpip/tcpip.rbuild modified lib/rtl/rtl.rbuild modified subsystems/win32/win32k/win32k.rbuild modified subsystems/win32/win32k/objects/gdiobj.c gcc 4.1.3 workarounds. See embedded comments modified base/services/eventlog/eventlog.h modified dll/win32/advapi32/advapi32.h Removed superfluous includes of pseh/pseh.h modified dll/directx/ddraw/Ddraw/ddraw_displaymode.c modified dll/directx/ddraw/Ddraw/ddraw_main.c modified dll/directx/ddraw/Ddraw/ddraw_setcooperativelevel.c modified dll/directx/ddraw/Ddraw/GetCaps.c modified dll/directx/ddraw/Ddraw/GetDeviceIdentifier.c modified dll/directx/ddraw/main.c modified dll/directx/ddraw/rosdraw.h modified dll/directx/ddraw/Surface/surface_main.c ddraw migrated to PSEH 2.0 modified dll/win32/gdi32/include/precomp.h modified dll/win32/gdi32/misc/misc.c modified dll/win32/gdi32/objects/bitmap.c gdi32 migrated to PSEH 2.0 modified dll/win32/kernel32/except/except.c modified dll/win32/kernel32/file/find.c modified dll/win32/kernel32/k32.h modified dll/win32/kernel32/mem/isbad.c modified dll/win32/kernel32/misc/console.c modified dll/win32/kernel32/process/procsup.c modified dll/win32/kernel32/string/lstring.c modified dll/win32/kernel32/thread/thread.c kernel32 migrated to PSEH 2.0 modified dll/win32/psapi/precomp.h modified dll/win32/psapi/psapi.c psapi migrated to PSEH 2.0 modified dll/win32/setupapi/cfgmgr.c modified dll/win32/setupapi/setupapi_private.h setupapi migrated to PSEH 2.0 modified dll/win32/syssetup/wizard.c syssetup migrated to PSEH 2.0 modified dll/win32/user32/include/user32.h modified dll/win32/user32/windows/class.c modified dll/win32/user32/windows/text.c modified dll/win32/user32/windows/window.c user32 migrated to PSEH 2.0 modified drivers/input/kbdclass/kbdclass.c modified drivers/input/kbdclass/kbdclass.h kbdclass migrated to PSEH 2.0 modified drivers/input/mouclass/mouclass.c modified drivers/input/mouclass/mouclass.h mouclass migrated to PSEH 2.0 modified drivers/network/afd/afd/info.c modified drivers/network/afd/afd/lock.c modified drivers/network/afd/afd/tdi.c modified drivers/network/afd/afd/tdiconn.c afd migrated to PSEH 2.0 modified drivers/network/lan/lan/lan.c lan migrated to PSEH 2.0 modified drivers/network/tcpip/tcpip/dispatch.c tcpip migrated to PSEH 2.0 modified lib/rtl/debug.c modified lib/rtl/res.c modified lib/rtl/rtl.h modified lib/rtl/unicode.c modified lib/rtl/workitem.c rtl migrated to PSEH 2.0 modified ntoskrnl/include/precomp.h ntoskrnl migrated to PSEH 2.0 modified subsystems/csr/csrsrv/api.c csrsrv migrated to PSEH 2.0 modified subsystems/win32/win32k/eng/bitblt.c modified subsystems/win32/win32k/eng/mem.c modified subsystems/win32/win32k/include/mmcopy.h modified subsystems/win32/win32k/misc/copy.c modified subsystems/win32/win32k/ntuser/callback.c modified subsystems/win32/win32k/ntuser/class.c modified subsystems/win32/win32k/ntuser/clipboard.c modified subsystems/win32/win32k/ntuser/cursoricon.c modified subsystems/win32/win32k/ntuser/display.c modified subsystems/win32/win32k/ntuser/hook.c modified subsystems/win32/win32k/ntuser/input.c modified subsystems/win32/win32k/ntuser/kbdlayout.c modified subsystems/win32/win32k/ntuser/menu.c modified subsystems/win32/win32k/ntuser/misc.c modified subsystems/win32/win32k/ntuser/ntstubs.c modified subsystems/win32/win32k/ntuser/painting.c modified subsystems/win32/win32k/ntuser/simplecall.c modified subsystems/win32/win32k/ntuser/sysparams.c modified subsystems/win32/win32k/ntuser/window.c modified subsystems/win32/win32k/objects/bitblt.c modified subsystems/win32/win32k/objects/bitmaps.c modified subsystems/win32/win32k/objects/brush.c modified subsystems/win32/win32k/objects/cliprgn.c modified subsystems/win32/win32k/objects/color.c modified subsystems/win32/win32k/objects/coord.c modified subsystems/win32/win32k/objects/dc.c modified subsystems/win32/win32k/objects/dcutil.c modified subsystems/win32/win32k/objects/dibobj.c modified subsystems/win32/win32k/objects/fillshap.c modified subsystems/win32/win32k/objects/font.c modified subsystems/win32/win32k/objects/freetype.c modified subsystems/win32/win32k/objects/icm.c modified subsystems/win32/win32k/objects/line.c modified subsystems/win32/win32k/objects/path.c modified subsystems/win32/win32k/objects/pen.c modified subsystems/win32/win32k/objects/print.c modified subsystems/win32/win32k/objects/region.c modified subsystems/win32/win32k/objects/text.c modified subsystems/win32/win32k/pch.h win32k migrated to PSEH 2.0 svn path=/trunk/; revision=37776
2008-11-30 19:28:11 +00:00
_SEH2_END;
if (!NT_SUCCESS(Status))
{
SetLastNtError(Status);
DC_UnlockDc(dc);
return FALSE;
}
}
if (Dc_Attr->dwLayout & LAYOUT_RTL)
{
XOffset = -XOffset;
}
Dc_Attr->ptlViewportOrg.x += XOffset;
Dc_Attr->ptlViewportOrg.y += YOffset;
DC_UpdateXforms(dc);
DC_UnlockDc(dc);
return TRUE;
}
BOOL
APIENTRY
NtGdiOffsetWindowOrgEx(HDC hDC,
int XOffset,
int YOffset,
LPPOINT Point)
{
PDC dc;
PDC_ATTR Dc_Attr;
dc = DC_LockDc(hDC);
if (!dc)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
Dc_Attr = dc->pDc_Attr;
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
if (Point)
{
NTSTATUS Status = STATUS_SUCCESS;
_SEH2_TRY
{
ProbeForWrite(Point, sizeof(POINT), 1);
Point->x = Dc_Attr->ptlWindowOrg.x;
Point->y = Dc_Attr->ptlWindowOrg.y;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
Status = _SEH2_GetExceptionCode();
}
_SEH2_END;
if (!NT_SUCCESS(Status))
{
SetLastNtError(Status);
DC_UnlockDc(dc);
return FALSE;
}
}
Dc_Attr->ptlWindowOrg.x += XOffset;
Dc_Attr->ptlWindowOrg.y += YOffset;
DC_UpdateXforms(dc);
DC_UnlockDc(dc);
return TRUE;
}
BOOL
APIENTRY
NtGdiScaleViewportExtEx(HDC hDC,
int Xnum,
int Xdenom,
int Ynum,
int Ydenom,
LPSIZE pSize)
{
PDC pDC;
PDC_ATTR pDc_Attr;
BOOL Ret = FALSE;
LONG X, Y;
pDC = DC_LockDc(hDC);
if (!pDC)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
pDc_Attr = pDC->pDc_Attr;
if (!pDc_Attr) pDc_Attr = &pDC->Dc_Attr;
if (pSize)
{
NTSTATUS Status = STATUS_SUCCESS;
_SEH2_TRY
{
ProbeForWrite(pSize, sizeof(LPSIZE), 1);
pSize->cx = pDc_Attr->szlViewportExt.cx;
pSize->cy = pDc_Attr->szlViewportExt.cy;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
Status = _SEH2_GetExceptionCode();
}
_SEH2_END;
if (!NT_SUCCESS(Status))
{
SetLastNtError(Status);
DC_UnlockDc(pDC);
return FALSE;
}
}
if (pDc_Attr->iMapMode > MM_TWIPS)
{
if (Xdenom && Ydenom)
{
X = Xnum * pDc_Attr->szlViewportExt.cx / Xdenom;
if (X)
{
Y = Ynum * pDc_Attr->szlViewportExt.cy / Ydenom;
if (Y)
{
pDc_Attr->szlViewportExt.cx = X;
pDc_Attr->szlViewportExt.cy = Y;
IntMirrorWindowOrg(pDC);
pDc_Attr->flXform |= (PAGE_EXTENTS_CHANGED |
INVALIDATE_ATTRIBUTES |
DEVICE_TO_WORLD_INVALID);
if (pDc_Attr->iMapMode == MM_ISOTROPIC)
{
IntFixIsotropicMapping(pDC);
}
DC_UpdateXforms(pDC);
Ret = TRUE;
}
}
}
}
else
Ret = TRUE;
DC_UnlockDc(pDC);
return Ret;
}
BOOL
APIENTRY
NtGdiScaleWindowExtEx(HDC hDC,
int Xnum,
int Xdenom,
int Ynum,
int Ydenom,
LPSIZE pSize)
{
PDC pDC;
PDC_ATTR pDc_Attr;
BOOL Ret = FALSE;
LONG X, Y;
pDC = DC_LockDc(hDC);
if (!pDC)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
pDc_Attr = pDC->pDc_Attr;
if (!pDc_Attr) pDc_Attr = &pDC->Dc_Attr;
if (pSize)
{
NTSTATUS Status = STATUS_SUCCESS;
_SEH2_TRY
{
ProbeForWrite(pSize, sizeof(LPSIZE), 1);
X = pDc_Attr->szlWindowExt.cx;
if (pDc_Attr->dwLayout & LAYOUT_RTL) X = -X;
pSize->cx = X;
pSize->cy = pDc_Attr->szlWindowExt.cy;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
Status = _SEH2_GetExceptionCode();
}
_SEH2_END;
if (!NT_SUCCESS(Status))
{
SetLastNtError(Status);
DC_UnlockDc(pDC);
return FALSE;
}
}
if (pDc_Attr->iMapMode > MM_TWIPS)
{
if (Xdenom && Ydenom)
{
X = Xnum * pDc_Attr->szlWindowExt.cx / Xdenom;
if (X)
{
Y = Ynum * pDc_Attr->szlWindowExt.cy / Ydenom;
if (Y)
{
pDc_Attr->szlWindowExt.cx = X;
pDc_Attr->szlWindowExt.cy = Y;
IntMirrorWindowOrg(pDC);
pDc_Attr->flXform |= (PAGE_EXTENTS_CHANGED|INVALIDATE_ATTRIBUTES|DEVICE_TO_WORLD_INVALID);
if (pDc_Attr->iMapMode == MM_ISOTROPIC) IntFixIsotropicMapping(pDC);
DC_UpdateXforms(pDC);
Ret = TRUE;
}
}
}
}
else
Ret = TRUE;
DC_UnlockDc(pDC);
return Ret;
}
int
APIENTRY
IntGdiSetMapMode(PDC dc,
int MapMode)
{
int PrevMapMode;
PDC_ATTR Dc_Attr = dc->pDc_Attr;
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
PrevMapMode = Dc_Attr->iMapMode;
Dc_Attr->iMapMode = MapMode;
switch (MapMode)
{
case MM_TEXT:
Dc_Attr->szlWindowExt.cx = 1;
Dc_Attr->szlWindowExt.cy = 1;
Dc_Attr->szlViewportExt.cx = 1;
Dc_Attr->szlViewportExt.cy = 1;
Dc_Attr->flXform &= ~(ISO_OR_ANISO_MAP_MODE|PTOD_EFM22_NEGATIVE|
PTOD_EFM11_NEGATIVE|POSITIVE_Y_IS_UP);
Dc_Attr->flXform |= (PAGE_XLATE_CHANGED|PAGE_TO_DEVICE_SCALE_IDENTITY|
INVALIDATE_ATTRIBUTES|DEVICE_TO_WORLD_INVALID);
break;
case MM_ISOTROPIC:
Dc_Attr->flXform |= ISO_OR_ANISO_MAP_MODE;
/* Fall through */
case MM_LOMETRIC:
Dc_Attr->szlWindowExt.cx = 3600;
Dc_Attr->szlWindowExt.cy = 2700;
Dc_Attr->szlViewportExt.cx = ((PGDIDEVICE)dc->ppdev)->GDIInfo.ulHorzRes;
Dc_Attr->szlViewportExt.cy = -((PGDIDEVICE)dc->ppdev)->GDIInfo.ulVertRes;
break;
case MM_HIMETRIC:
Dc_Attr->szlWindowExt.cx = 36000;
Dc_Attr->szlWindowExt.cy = 27000;
Dc_Attr->szlViewportExt.cx = ((PGDIDEVICE)dc->ppdev)->GDIInfo.ulHorzRes;
Dc_Attr->szlViewportExt.cy = -((PGDIDEVICE)dc->ppdev)->GDIInfo.ulVertRes;
break;
case MM_LOENGLISH:
Dc_Attr->szlWindowExt.cx = 1417;
Dc_Attr->szlWindowExt.cy = 1063;
Dc_Attr->szlViewportExt.cx = ((PGDIDEVICE)dc->ppdev)->GDIInfo.ulHorzRes;
Dc_Attr->szlViewportExt.cy = -((PGDIDEVICE)dc->ppdev)->GDIInfo.ulVertRes;
break;
case MM_HIENGLISH:
Dc_Attr->szlWindowExt.cx = 14173;
Dc_Attr->szlWindowExt.cy = 10630;
Dc_Attr->szlViewportExt.cx = ((PGDIDEVICE)dc->ppdev)->GDIInfo.ulHorzRes;
Dc_Attr->szlViewportExt.cy = -((PGDIDEVICE)dc->ppdev)->GDIInfo.ulVertRes;
break;
case MM_TWIPS:
Dc_Attr->szlWindowExt.cx = 20409;
Dc_Attr->szlWindowExt.cy = 15307;
Dc_Attr->szlViewportExt.cx = ((PGDIDEVICE)dc->ppdev)->GDIInfo.ulHorzRes;
Dc_Attr->szlViewportExt.cy = -((PGDIDEVICE)dc->ppdev)->GDIInfo.ulVertRes;
break;
case MM_ANISOTROPIC:
Dc_Attr->flXform &= ~(PAGE_TO_DEVICE_IDENTITY|POSITIVE_Y_IS_UP);
Dc_Attr->flXform |= ISO_OR_ANISO_MAP_MODE;
break;
default:
Dc_Attr->iMapMode = PrevMapMode;
PrevMapMode = 0;
}
DC_UpdateXforms(dc);
return PrevMapMode;
}
BOOL
APIENTRY
NtGdiSetViewportOrgEx(HDC hDC,
int X,
int Y,
LPPOINT Point)
{
PDC dc;
PDC_ATTR Dc_Attr;
dc = DC_LockDc(hDC);
if (!dc)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
Dc_Attr = dc->pDc_Attr;
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
if (Point)
{
NTSTATUS Status = STATUS_SUCCESS;
_SEH2_TRY
{
ProbeForWrite(Point, sizeof(POINT), 1);
Point->x = Dc_Attr->ptlViewportOrg.x;
Point->y = Dc_Attr->ptlViewportOrg.y;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
Status = _SEH2_GetExceptionCode();
}
_SEH2_END;
if (!NT_SUCCESS(Status))
{
SetLastNtError(Status);
DC_UnlockDc(dc);
return FALSE;
}
}
Dc_Attr->ptlViewportOrg.x = X;
Dc_Attr->ptlViewportOrg.y = Y;
DC_UpdateXforms(dc);
DC_UnlockDc(dc);
return TRUE;
}
BOOL
APIENTRY
NtGdiSetWindowOrgEx(HDC hDC,
int X,
int Y,
LPPOINT Point)
{
PDC dc;
PDC_ATTR Dc_Attr;
dc = DC_LockDc(hDC);
if (!dc)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
Dc_Attr = dc->pDc_Attr;
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
if (Point)
{
NTSTATUS Status = STATUS_SUCCESS;
_SEH2_TRY
{
ProbeForWrite(Point, sizeof(POINT), 1);
Point->x = Dc_Attr->ptlWindowOrg.x;
Point->y = Dc_Attr->ptlWindowOrg.y;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
Status = _SEH2_GetExceptionCode();
}
_SEH2_END;
if (!NT_SUCCESS(Status))
{
SetLastNtError(Status);
DC_UnlockDc(dc);
return FALSE;
}
}
Dc_Attr->ptlWindowOrg.x = X;
Dc_Attr->ptlWindowOrg.y = Y;
DC_UpdateXforms(dc);
DC_UnlockDc(dc);
return TRUE;
}
//
// Mirror Window function.
//
VOID
FASTCALL
IntMirrorWindowOrg(PDC dc)
{
PDC_ATTR Dc_Attr;
LONG X;
Dc_Attr = dc->pDc_Attr;
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
if (!(Dc_Attr->dwLayout & LAYOUT_RTL))
{
Dc_Attr->ptlWindowOrg.x = Dc_Attr->lWindowOrgx; // Flip it back.
return;
}
if (!Dc_Attr->szlViewportExt.cx) return;
//
// WOrgx = wox - (Width - 1) * WExtx / VExtx
//
X = (dc->erclWindow.right - dc->erclWindow.left) - 1; // Get device width - 1
X = (X * Dc_Attr->szlWindowExt.cx) / Dc_Attr->szlViewportExt.cx;
Dc_Attr->ptlWindowOrg.x = Dc_Attr->lWindowOrgx - X; // Now set the inverted win origion.
return;
}
// NtGdiSetLayout
//
// The default is left to right. This function changes it to right to left, which
// is the standard in Arabic and Hebrew cultures.
//
/*
* @implemented
*/
DWORD
APIENTRY
NtGdiSetLayout(
IN HDC hdc,
IN LONG wox,
IN DWORD dwLayout)
{
PDC dc;
PDC_ATTR Dc_Attr;
DWORD oLayout;
dc = DC_LockDc(hdc);
if (!dc)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
return GDI_ERROR;
}
Dc_Attr = dc->pDc_Attr;
if (!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
Dc_Attr->dwLayout = dwLayout;
oLayout = Dc_Attr->dwLayout;
if (!(dwLayout & LAYOUT_ORIENTATIONMASK))
{
DC_UnlockDc(dc);
return oLayout;
}
if (dwLayout & LAYOUT_RTL)
{
Dc_Attr->iMapMode = MM_ANISOTROPIC;
}
Dc_Attr->szlWindowExt.cy = -Dc_Attr->szlWindowExt.cy;
Dc_Attr->ptlWindowOrg.x = -Dc_Attr->ptlWindowOrg.x;
if (wox == -1)
IntMirrorWindowOrg(dc);
else
Dc_Attr->ptlWindowOrg.x = wox - Dc_Attr->ptlWindowOrg.x;
if (!(Dc_Attr->flTextAlign & TA_CENTER)) Dc_Attr->flTextAlign |= TA_RIGHT;
if (dc->DcLevel.flPath & DCPATH_CLOCKWISE)
dc->DcLevel.flPath &= ~DCPATH_CLOCKWISE;
else
dc->DcLevel.flPath |= DCPATH_CLOCKWISE;
Dc_Attr->flXform |= (PAGE_EXTENTS_CHANGED |
INVALIDATE_ATTRIBUTES |
DEVICE_TO_WORLD_INVALID);
// DC_UpdateXforms(dc);
DC_UnlockDc(dc);
return oLayout;
}
/*
* @implemented
*/
LONG
APIENTRY
NtGdiGetDeviceWidth(
IN HDC hdc)
{
PDC dc;
LONG Ret;
dc = DC_LockDc(hdc);
if (!dc)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
return 0;
}
Ret = dc->erclWindow.right - dc->erclWindow.left;
DC_UnlockDc(dc);
return Ret;
}
/*
* @implemented
*/
BOOL
APIENTRY
NtGdiMirrorWindowOrg(
IN HDC hdc)
{
PDC dc;
dc = DC_LockDc(hdc);
if (!dc)
{
SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE;
}
IntMirrorWindowOrg(dc);
DC_UnlockDc(dc);
return TRUE;
}
/*
* @implemented
*/
BOOL
APIENTRY
NtGdiSetSizeDevice(
IN HDC hdc,
IN INT cxVirtualDevice,
IN INT cyVirtualDevice)
{
PDC dc;
PDC_ATTR pDc_Attr;
if (!cxVirtualDevice || !cyVirtualDevice)
{
return FALSE;
}
dc = DC_LockDc(hdc);
if (!dc) return FALSE;
pDc_Attr = dc->pDc_Attr;
if (!pDc_Attr) pDc_Attr = &dc->Dc_Attr;
pDc_Attr->szlVirtualDeviceSize.cx = cxVirtualDevice;
pDc_Attr->szlVirtualDeviceSize.cy = cyVirtualDevice;
// DC_UpdateXforms(dc);
DC_UnlockDc(dc);
return TRUE;
}
/*
* @implemented
*/
BOOL
APIENTRY
NtGdiSetVirtualResolution(
IN HDC hdc,
IN INT cxVirtualDevicePixel,
IN INT cyVirtualDevicePixel,
IN INT cxVirtualDeviceMm,
IN INT cyVirtualDeviceMm)
{
PDC dc;
PDC_ATTR pDc_Attr;
// Need test types for zeros and non zeros
dc = DC_LockDc(hdc);
if (!dc) return FALSE;
pDc_Attr = dc->pDc_Attr;
if (!pDc_Attr) pDc_Attr = &dc->Dc_Attr;
pDc_Attr->szlVirtualDevicePixel.cx = cxVirtualDevicePixel;
pDc_Attr->szlVirtualDevicePixel.cy = cyVirtualDevicePixel;
pDc_Attr->szlVirtualDeviceMm.cx = cxVirtualDeviceMm;
pDc_Attr->szlVirtualDeviceMm.cy = cyVirtualDeviceMm;
// DC_UpdateXforms(dc);
DC_UnlockDc(dc);
return TRUE;
}
/* EOF */