https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7143e411c46380b4ec73f…
commit 7143e411c46380b4ec73f51b481c382504602901
Author: Baruch Rutman <peterooch(a)gmail.com>
AuthorDate: Fri Feb 15 03:57:35 2019 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sat Mar 23 23:34:09 2019 +0100
[GDI32] Integrate LpkGetTextExtentExPoint(). (#1362)
- Assume that GetTextExtentExPointWPri() uses the same kind of
arguments as GetTextExtentExPointW().
- Add GetTextExtentExPointWPri() declaration to undocgdi.h.
---
sdk/include/reactos/undocgdi.h | 11 +++++++++++
win32ss/gdi/gdi32/include/gdi32p.h | 15 +++++++++++++++
win32ss/gdi/gdi32/objects/text.c | 15 +++++++++------
win32ss/gdi/gdi32/objects/utils.c | 15 ++++++++++++++-
4 files changed, 49 insertions(+), 7 deletions(-)
diff --git a/sdk/include/reactos/undocgdi.h b/sdk/include/reactos/undocgdi.h
index 4a0ea8f5d5..9abdbef944 100644
--- a/sdk/include/reactos/undocgdi.h
+++ b/sdk/include/reactos/undocgdi.h
@@ -30,4 +30,15 @@ BOOL
WINAPI
GdiDrawStream(HDC dc, ULONG l, PGDI_DRAW_STREAM pDS);
+BOOL
+WINAPI
+GetTextExtentExPointWPri(
+ HDC hdc,
+ LPCWSTR lpwsz,
+ INT cwc,
+ INT dxMax,
+ LPINT pcCh,
+ LPINT pdxOut,
+ LPSIZE psize);
+
#endif
\ No newline at end of file
diff --git a/win32ss/gdi/gdi32/include/gdi32p.h b/win32ss/gdi/gdi32/include/gdi32p.h
index 03ce3afcf8..3574850683 100644
--- a/win32ss/gdi/gdi32/include/gdi32p.h
+++ b/win32ss/gdi/gdi32/include/gdi32p.h
@@ -51,9 +51,23 @@ typedef DWORD
DWORD dwUnused
);
+typedef BOOL
+(WINAPI* LPKGTEP)(
+ HDC hdc,
+ LPCWSTR lpString,
+ INT cString,
+ INT nMaxExtent,
+ LPINT lpnFit,
+ LPINT lpnDx,
+ LPSIZE lpSize,
+ DWORD dwUnused,
+ int unknown
+);
+
extern HINSTANCE hLpk;
extern LPKETO LpkExtTextOut;
extern LPKGCP LpkGetCharacterPlacement;
+extern LPKGTEP LpkGetTextExtentExPoint;
/* DEFINES *******************************************************************/
@@ -67,6 +81,7 @@ extern LPKGCP LpkGetCharacterPlacement;
#define LPK_INIT 1
#define LPK_ETO 2
#define LPK_GCP 3
+#define LPK_GTEP 4
/* MACRO ********************************************************************/
diff --git a/win32ss/gdi/gdi32/objects/text.c b/win32ss/gdi/gdi32/objects/text.c
index 9ff4fde9df..e35c7c99e8 100644
--- a/win32ss/gdi/gdi32/objects/text.c
+++ b/win32ss/gdi/gdi32/objects/text.c
@@ -296,6 +296,9 @@ GetTextExtentExPointW(
DPRINT("nMaxExtent is invalid: %d\n", nMaxExtent);
}
+ if (LoadLPK(LPK_GTEP))
+ return LpkGetTextExtentExPoint(hdc, lpszString, cchString, nMaxExtent, lpnFit,
lpnDx, lpSize, 0, 0);
+
return NtGdiGetTextExtentExW (
hdc, (LPWSTR)lpszString, cchString, nMaxExtent, (PULONG)lpnFit,
(PULONG)lpnDx, lpSize, 0 );
}
@@ -308,14 +311,14 @@ BOOL
WINAPI
GetTextExtentExPointWPri(
_In_ HDC hdc,
- _In_reads_(cwc) LPWSTR lpwsz,
- _In_ ULONG cwc,
- _In_ ULONG dxMax,
- _Out_opt_ ULONG *pcCh,
- _Out_writes_to_opt_(cwc, *pcCh) PULONG pdxOut,
+ _In_reads_(cwc) LPCWSTR lpwsz,
+ _In_ INT cwc,
+ _In_ INT dxMax,
+ _Out_opt_ LPINT pcCh,
+ _Out_writes_to_opt_(cwc, *pcCh) LPINT pdxOut,
_In_ LPSIZE psize)
{
- return NtGdiGetTextExtentExW(hdc, lpwsz, cwc, dxMax, pcCh, pdxOut, psize, 0);
+ return NtGdiGetTextExtentExW(hdc, (LPWSTR)lpwsz, cwc, dxMax, (PULONG)pcCh,
(PULONG)pdxOut, psize, 0);
}
/*
diff --git a/win32ss/gdi/gdi32/objects/utils.c b/win32ss/gdi/gdi32/objects/utils.c
index d594b46cb6..93491d9e00 100644
--- a/win32ss/gdi/gdi32/objects/utils.c
+++ b/win32ss/gdi/gdi32/objects/utils.c
@@ -4,6 +4,7 @@
HINSTANCE hLpk = NULL;
LPKETO LpkExtTextOut = NULL;
LPKGCP LpkGetCharacterPlacement = NULL;
+LPKGTEP LpkGetTextExtentExPoint = NULL;
/**
* @name CalculateColorTableSize
@@ -417,7 +418,7 @@ EnumLogFontExW2A( LPENUMLOGFONTEXA fontA, CONST ENUMLOGFONTEXW *fontW
)
* LPK.DLL loader function
*
* Returns TRUE if a valid parameter was passed and loading was successful,
-* retruns FALSE otherwise.
+* returns FALSE otherwise.
*/
BOOL WINAPI LoadLPK(INT LpkFunctionID)
{
@@ -455,6 +456,18 @@ BOOL WINAPI LoadLPK(INT LpkFunctionID)
return TRUE;
+ case LPK_GTEP:
+ if (!LpkGetTextExtentExPoint) // Check if the function is already loaded
+ LpkGetTextExtentExPoint = (LPKGTEP) GetProcAddress(hLpk,
"LpkGetTextExtentExPoint");
+
+ if (!LpkGetTextExtentExPoint)
+ {
+ FreeLibrary(hLpk);
+ return FALSE;
+ }
+
+ return TRUE;
+
default:
FreeLibrary(hLpk);
return FALSE;