Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
3.0 KiB

  1. /*++
  2. *
  3. * WOW v1.0
  4. *
  5. * Copyright (c) 1991, Microsoft Corporation
  6. *
  7. * WGTEXT.C
  8. * WOW32 16-bit GDI API support
  9. *
  10. * History:
  11. * Created 07-Mar-1991 by Jeff Parsons (jeffpar)
  12. * 10-Nov-1992 Modified GetTextMetrics to GetTextMetricsWOW by Chandan Chauhan
  13. --*/
  14. #include "precomp.h"
  15. #pragma hdrstop
  16. MODNAME(wgtext.c);
  17. ULONG FASTCALL WG32ExtTextOut(PVDMFRAME pFrame)
  18. {
  19. ULONG ul;
  20. RECT t5;
  21. PSTR pstr6;
  22. PINT p8;
  23. register PEXTTEXTOUT16 parg16;
  24. INT BufferT[256];
  25. GETARGPTR(pFrame, sizeof(EXTTEXTOUT16), parg16);
  26. GETRECT16(parg16->f5, &t5);
  27. GETSTRPTR(parg16->f6, parg16->f7, pstr6);
  28. if (DWORD32(parg16->f8)) {
  29. p8 = STACKORHEAPALLOC(parg16->f7 * sizeof(INT), sizeof(BufferT), BufferT);
  30. getintarray16((VPINT16)DWORD32(parg16->f8), parg16->f7, p8); // *this* INT array is optional
  31. } else {
  32. p8 = NULL;
  33. }
  34. ul = GETBOOL16(ExtTextOut(
  35. HDC32(parg16->f1),
  36. INT32(parg16->f2),
  37. INT32(parg16->f3),
  38. (WORD32(parg16->f4) & (ETO_CLIPPED|ETO_OPAQUE)),
  39. &t5,
  40. pstr6,
  41. WORD32(parg16->f7),
  42. (LPINT)p8
  43. ));
  44. FREESTRPTR(pstr6);
  45. STACKORHEAPFREE(p8, BufferT);
  46. FREEARGPTR(parg16);
  47. RETURN(ul);
  48. }
  49. ULONG FASTCALL WG32GetTextExtent(PVDMFRAME pFrame)
  50. {
  51. ULONG ul = 0;
  52. PSTR pstr2;
  53. SIZE size4;
  54. register PGETTEXTEXTENT16 parg16;
  55. GETARGPTR(pFrame, sizeof(GETTEXTEXTENT16), parg16);
  56. GETSTRPTR(parg16->f2, parg16->f3, pstr2);
  57. if (GETDWORD16(GetTextExtentPoint(
  58. HDC32(parg16->f1),
  59. pstr2,
  60. INT32(parg16->f3),
  61. &size4
  62. )))
  63. {
  64. // check if either cx or cy are bigger than SHRT_MAX == 7fff
  65. // but do it in ONE SINGLE check
  66. if ((size4.cx | size4.cy) & ~SHRT_MAX)
  67. {
  68. if (size4.cx > SHRT_MAX)
  69. ul = SHRT_MAX;
  70. else
  71. ul = (ULONG)size4.cx;
  72. if (size4.cy > SHRT_MAX)
  73. ul |= (SHRT_MAX << 16);
  74. else
  75. ul |= (ULONG)(size4.cy << 16);
  76. }
  77. else
  78. {
  79. ul = (ULONG)(size4.cx | (size4.cy << 16));
  80. }
  81. }
  82. FREESTRPTR(pstr2);
  83. FREEARGPTR(parg16);
  84. RETURN(ul);
  85. }
  86. ULONG FASTCALL WG32GetTextMetrics(PVDMFRAME pFrame)
  87. {
  88. ULONG ul;
  89. TEXTMETRIC t2;
  90. register PGETTEXTMETRICS16 parg16;
  91. GETARGPTR(pFrame, sizeof(GETTEXTMETRICS16), parg16);
  92. ul = GETBOOL16(GetTextMetrics(
  93. HDC32(parg16->f1),
  94. &t2
  95. ));
  96. #ifdef FE_SB
  97. // original source code should be fixed
  98. // If GetTextMetrics return value is FALSE, don't need set data to 16bit
  99. // TEXTMETRICS STRUCTURE.
  100. // kksuzuka #3759 BC++40J is not see return value and used TEXTMETRICS
  101. // data. 1994.11.16 V-HIDEKK
  102. if( ul )
  103. #endif // FE_SB
  104. PUTTEXTMETRIC16(parg16->f2, &t2);
  105. FREEARGPTR(parg16);
  106. RETURN(ul);
  107. }