ReactOS  0.4.15-dev-2721-g5912c11
ntgdibad.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tagFONTFAMILYINFO
 

Typedefs

typedef struct tagFONTFAMILYINFO FONTFAMILYINFO
 
typedef struct tagFONTFAMILYINFOPFONTFAMILYINFO
 

Functions

LONG NTAPI NtGdiGetFontFamilyInfo (HDC Dc, const LOGFONTW *LogFont, PFONTFAMILYINFO Info, LPLONG UnsafeInfoCount)
 
BOOL APIENTRY NtGdiGetViewportExtEx (HDC hDC, LPSIZE viewportExt)
 
BOOL APIENTRY NtGdiGetViewportOrgEx (HDC hDC, LPPOINT viewportOrg)
 
BOOL APIENTRY NtGdiGetWindowExtEx (HDC hDC, LPSIZE windowExt)
 
BOOL APIENTRY NtGdiGetWindowOrgEx (HDC hDC, LPPOINT windowOrg)
 
BOOL APIENTRY NtGdiOffsetViewportOrgEx (HDC hDC, int XOffset, int YOffset, LPPOINT Point)
 
BOOL APIENTRY NtGdiOffsetWindowOrgEx (HDC hDC, int XOffset, int YOffset, LPPOINT Point)
 
BOOL APIENTRY NtGdiSetViewportOrgEx (HDC hDC, int X, int Y, LPPOINT Point)
 
BOOL APIENTRY NtGdiSetWindowOrgEx (HDC hDC, int X, int Y, LPPOINT Point)
 

Typedef Documentation

◆ FONTFAMILYINFO

◆ PFONTFAMILYINFO

Function Documentation

◆ NtGdiGetFontFamilyInfo()

LONG NTAPI NtGdiGetFontFamilyInfo ( HDC  Dc,
const LOGFONTW LogFont,
PFONTFAMILYINFO  Info,
LPLONG  UnsafeInfoCount 
)

Definition at line 5769 of file freetype.c.

5773 {
5774  NTSTATUS Status;
5775  LOGFONTW LogFont;
5777  LONG GotCount, AvailCount, SafeInfoCount;
5778  ULONG DataSize;
5779 
5780  if (UnsafeLogFont == NULL || UnsafeInfo == NULL || UnsafeInfoCount == NULL)
5781  {
5783  return -1;
5784  }
5785 
5786  Status = MmCopyFromCaller(&SafeInfoCount, UnsafeInfoCount, sizeof(SafeInfoCount));
5787  if (!NT_SUCCESS(Status))
5788  {
5790  return -1;
5791  }
5792  GotCount = 0;
5793  Status = MmCopyToCaller(UnsafeInfoCount, &GotCount, sizeof(*UnsafeInfoCount));
5794  if (!NT_SUCCESS(Status))
5795  {
5797  return -1;
5798  }
5799  Status = MmCopyFromCaller(&LogFont, UnsafeLogFont, sizeof(LOGFONTW));
5800  if (!NT_SUCCESS(Status))
5801  {
5803  return -1;
5804  }
5805  if (SafeInfoCount <= 0)
5806  {
5808  return -1;
5809  }
5810 
5811  /* Allocate space for a safe copy */
5812  Status = RtlULongMult(SafeInfoCount, sizeof(FONTFAMILYINFO), &DataSize);
5813  if (!NT_SUCCESS(Status) || DataSize > LONG_MAX)
5814  {
5815  DPRINT1("Overflowed.\n");
5817  return -1;
5818  }
5820  if (Info == NULL)
5821  {
5823  return -1;
5824  }
5825 
5826  /* Retrieve the information */
5827  AvailCount = IntGetFontFamilyInfo(Dc, &LogFont, Info, SafeInfoCount);
5828  GotCount = min(AvailCount, SafeInfoCount);
5829  SafeInfoCount = AvailCount;
5830 
5831  /* Return data to caller */
5832  if (GotCount > 0)
5833  {
5834  Status = RtlULongMult(GotCount, sizeof(FONTFAMILYINFO), &DataSize);
5835  if (!NT_SUCCESS(Status) || DataSize > LONG_MAX)
5836  {
5837  DPRINT1("Overflowed.\n");
5840  return -1;
5841  }
5842  Status = MmCopyToCaller(UnsafeInfo, Info, DataSize);
5843  if (!NT_SUCCESS(Status))
5844  {
5847  return -1;
5848  }
5849  Status = MmCopyToCaller(UnsafeInfoCount, &SafeInfoCount, sizeof(*UnsafeInfoCount));
5850  if (!NT_SUCCESS(Status))
5851  {
5854  return -1;
5855  }
5856  }
5857 
5859 
5860  return GotCount;
5861 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
LONG FASTCALL IntGetFontFamilyInfo(HDC Dc, const LOGFONTW *SafeLogFont, PFONTFAMILYINFO SafeInfo, LONG InfoCount)
Definition: freetype.c:5730
LONG NTSTATUS
Definition: precomp.h:26
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define MmCopyFromCaller
Definition: polytest.cpp:29
#define MmCopyToCaller(x, y, z)
Definition: mmcopy.h:19
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
long LONG
Definition: pedump.c:60
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define LONG_MAX
Definition: limits.h:43
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define GDITAG_TEXT
Definition: tags.h:171
#define min(a, b)
Definition: monoChain.cc:55
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4751
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by IntEnumFontFamilies().

◆ NtGdiGetViewportExtEx()

BOOL APIENTRY NtGdiGetViewportExtEx ( HDC  hDC,
LPSIZE  viewportExt 
)

◆ NtGdiGetViewportOrgEx()

BOOL APIENTRY NtGdiGetViewportOrgEx ( HDC  hDC,
LPPOINT  viewportOrg 
)

◆ NtGdiGetWindowExtEx()

BOOL APIENTRY NtGdiGetWindowExtEx ( HDC  hDC,
LPSIZE  windowExt 
)

◆ NtGdiGetWindowOrgEx()

BOOL APIENTRY NtGdiGetWindowOrgEx ( HDC  hDC,
LPPOINT  windowOrg 
)

◆ NtGdiOffsetViewportOrgEx()

BOOL APIENTRY NtGdiOffsetViewportOrgEx ( HDC  hDC,
int  XOffset,
int  YOffset,
LPPOINT  Point 
)

Definition at line 556 of file coord.c.

561 {
562  PDC dc;
563  PDC_ATTR pdcattr;
565 
566  dc = DC_LockDc(hDC);
567  if (!dc)
568  {
570  return FALSE;
571  }
572  pdcattr = dc->pdcattr;
573 
574  if (UnsafePoint)
575  {
576  _SEH2_TRY
577  {
578  ProbeForWrite(UnsafePoint, sizeof(POINT), 1);
579  UnsafePoint->x = pdcattr->ptlViewportOrg.x;
580  UnsafePoint->y = pdcattr->ptlViewportOrg.y;
581  if (pdcattr->dwLayout & LAYOUT_RTL)
582  {
583  UnsafePoint->x = -UnsafePoint->x;
584  }
585  }
587  {
589  }
590  _SEH2_END;
591 
592  if (!NT_SUCCESS(Status))
593  {
595  DC_UnlockDc(dc);
596  return FALSE;
597  }
598  }
599 
600  if (pdcattr->dwLayout & LAYOUT_RTL)
601  {
602  XOffset = -XOffset;
603  }
604  pdcattr->ptlViewportOrg.x += XOffset;
605  pdcattr->ptlViewportOrg.y += YOffset;
607 
608  DC_UnlockDc(dc);
609 
610  return TRUE;
611 }
POINTL ptlViewportOrg
Definition: ntgdihdl.h:347
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define LAYOUT_RTL
Definition: wingdi.h:1370
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
LONG y
Definition: windef.h:330
_SEH2_TRY
Definition: create.c:4226
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:201
#define FALSE
Definition: types.h:117
Status
Definition: gdiplustypes.h:24
Definition: polytest.cpp:40
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
LONG x
Definition: windef.h:329
FLONG flXform
Definition: ntgdihdl.h:349
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
static HDC hDC
Definition: 3dtext.c:33
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:203
_SEH2_END
Definition: create.c:4400
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:192
DWORD dwLayout
Definition: ntgdihdl.h:343
static const WCHAR dc[]
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define STATUS_SUCCESS
Definition: shellext.h:65
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

◆ NtGdiOffsetWindowOrgEx()

BOOL APIENTRY NtGdiOffsetWindowOrgEx ( HDC  hDC,
int  XOffset,
int  YOffset,
LPPOINT  Point 
)

Definition at line 615 of file coord.c.

620 {
621  PDC dc;
622  PDC_ATTR pdcattr;
623 
624  dc = DC_LockDc(hDC);
625  if (!dc)
626  {
628  return FALSE;
629  }
630  pdcattr = dc->pdcattr;
631 
632  if (Point)
633  {
635 
636  _SEH2_TRY
637  {
638  ProbeForWrite(Point, sizeof(POINT), 1);
639  Point->x = pdcattr->ptlWindowOrg.x;
640  Point->y = pdcattr->ptlWindowOrg.y;
641  }
643  {
645  }
646  _SEH2_END;
647 
648  if (!NT_SUCCESS(Status))
649  {
651  DC_UnlockDc(dc);
652  return FALSE;
653  }
654  }
655 
656  pdcattr->ptlWindowOrg.x += XOffset;
657  pdcattr->ptlWindowOrg.y += YOffset;
659 
660  DC_UnlockDc(dc);
661 
662  return TRUE;
663 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
LONG y
Definition: windef.h:330
_SEH2_TRY
Definition: create.c:4226
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:201
#define FALSE
Definition: types.h:117
Status
Definition: gdiplustypes.h:24
Definition: polytest.cpp:40
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
LONG x
Definition: windef.h:329
FLONG flXform
Definition: ntgdihdl.h:349
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
static HDC hDC
Definition: 3dtext.c:33
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:203
_SEH2_END
Definition: create.c:4400
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:192
static const WCHAR dc[]
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define STATUS_SUCCESS
Definition: shellext.h:65
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
POINTL ptlWindowOrg
Definition: ntgdihdl.h:345

◆ NtGdiSetViewportOrgEx()

BOOL APIENTRY NtGdiSetViewportOrgEx ( HDC  hDC,
int  X,
int  Y,
LPPOINT  Point 
)

Definition at line 948 of file coord.c.

953 {
954  PDC dc;
955  PDC_ATTR pdcattr;
956 
957  dc = DC_LockDc(hDC);
958  if (!dc)
959  {
961  return FALSE;
962  }
963  pdcattr = dc->pdcattr;
964 
965  if (Point)
966  {
968 
969  _SEH2_TRY
970  {
971  ProbeForWrite(Point, sizeof(POINT), 1);
972  Point->x = pdcattr->ptlViewportOrg.x;
973  Point->y = pdcattr->ptlViewportOrg.y;
974  }
976  {
978  }
979  _SEH2_END;
980 
981  if (!NT_SUCCESS(Status))
982  {
984  DC_UnlockDc(dc);
985  return FALSE;
986  }
987  }
988 
989  pdcattr->ptlViewportOrg.x = X;
990  pdcattr->ptlViewportOrg.y = Y;
992 
993  DC_UnlockDc(dc);
994 
995  return TRUE;
996 }
POINTL ptlViewportOrg
Definition: ntgdihdl.h:347
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define Y(I)
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
LONG y
Definition: windef.h:330
_SEH2_TRY
Definition: create.c:4226
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:201
#define FALSE
Definition: types.h:117
Status
Definition: gdiplustypes.h:24
Definition: polytest.cpp:40
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
LONG x
Definition: windef.h:329
FLONG flXform
Definition: ntgdihdl.h:349
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
static HDC hDC
Definition: 3dtext.c:33
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:203
_SEH2_END
Definition: create.c:4400
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:192
static const WCHAR dc[]
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define STATUS_SUCCESS
Definition: shellext.h:65
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
#define X(b, s)

◆ NtGdiSetWindowOrgEx()

BOOL APIENTRY NtGdiSetWindowOrgEx ( HDC  hDC,
int  X,
int  Y,
LPPOINT  Point 
)

Definition at line 1000 of file coord.c.

1005 {
1006  PDC dc;
1007  PDC_ATTR pdcattr;
1008 
1009  dc = DC_LockDc(hDC);
1010  if (!dc)
1011  {
1013  return FALSE;
1014  }
1015  pdcattr = dc->pdcattr;
1016 
1017  if (Point)
1018  {
1020 
1021  _SEH2_TRY
1022  {
1023  ProbeForWrite(Point, sizeof(POINT), 1);
1024  Point->x = pdcattr->ptlWindowOrg.x;
1025  Point->y = pdcattr->ptlWindowOrg.y;
1026  }
1028  {
1030  }
1031  _SEH2_END;
1032 
1033  if (!NT_SUCCESS(Status))
1034  {
1036  DC_UnlockDc(dc);
1037  return FALSE;
1038  }
1039  }
1040 
1041  pdcattr->ptlWindowOrg.x = X;
1042  pdcattr->ptlWindowOrg.y = Y;
1044 
1045  DC_UnlockDc(dc);
1046 
1047  return TRUE;
1048 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define Y(I)
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
LONG y
Definition: windef.h:330
_SEH2_TRY
Definition: create.c:4226
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:201
#define FALSE
Definition: types.h:117
Status
Definition: gdiplustypes.h:24
Definition: polytest.cpp:40
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
LONG x
Definition: windef.h:329
FLONG flXform
Definition: ntgdihdl.h:349
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
static HDC hDC
Definition: 3dtext.c:33
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:203
_SEH2_END
Definition: create.c:4400
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:192
static const WCHAR dc[]
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define STATUS_SUCCESS
Definition: shellext.h:65
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
#define X(b, s)
POINTL ptlWindowOrg
Definition: ntgdihdl.h:345