mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[GDI32]
- Add annotations for text function - Improve formatting and some variable names - No code change svn path=/trunk/; revision=65324
This commit is contained in:
parent
34353069cc
commit
b461fd27f1
1 changed files with 304 additions and 235 deletions
|
@ -9,27 +9,30 @@
|
|||
BOOL
|
||||
WINAPI
|
||||
TextOutA(
|
||||
HDC hdc,
|
||||
int nXStart,
|
||||
int nYStart,
|
||||
LPCSTR lpString,
|
||||
int cchString)
|
||||
_In_ HDC hdc,
|
||||
_In_ INT nXStart,
|
||||
_In_ INT nYStart,
|
||||
_In_reads_(cchString) LPCSTR lpString,
|
||||
_In_ INT cchString)
|
||||
{
|
||||
ANSI_STRING StringA;
|
||||
UNICODE_STRING StringU;
|
||||
BOOL ret;
|
||||
BOOL bResult;
|
||||
|
||||
if (NULL != lpString)
|
||||
if (lpString != NULL)
|
||||
{
|
||||
RtlInitAnsiString(&StringA, (LPSTR)lpString);
|
||||
RtlAnsiStringToUnicodeString(&StringU, &StringA, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
StringU.Buffer = NULL;
|
||||
}
|
||||
|
||||
bResult = TextOutW(hdc, nXStart, nYStart, StringU.Buffer, cchString);
|
||||
|
||||
ret = TextOutW(hdc, nXStart, nYStart, StringU.Buffer, cchString);
|
||||
RtlFreeUnicodeString(&StringU);
|
||||
return ret;
|
||||
return bResult;
|
||||
}
|
||||
|
||||
|
||||
|
@ -39,13 +42,20 @@ TextOutA(
|
|||
BOOL
|
||||
WINAPI
|
||||
TextOutW(
|
||||
HDC hdc,
|
||||
int nXStart,
|
||||
int nYStart,
|
||||
LPCWSTR lpString,
|
||||
int cchString)
|
||||
_In_ HDC hdc,
|
||||
_In_ INT nXStart,
|
||||
_In_ INT nYStart,
|
||||
_In_reads_(cchString) LPCWSTR lpString,
|
||||
_In_ INT cchString)
|
||||
{
|
||||
return NtGdiExtTextOutW(hdc, nXStart, nYStart, 0, NULL, (LPWSTR)lpString, cchString, NULL, 0);
|
||||
return NtGdiExtTextOutW(hdc,
|
||||
nXStart,
|
||||
nYStart,
|
||||
0, NULL,
|
||||
(LPWSTR)lpString,
|
||||
cchString,
|
||||
NULL,
|
||||
0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,11 +64,26 @@ TextOutW(
|
|||
*/
|
||||
BOOL
|
||||
WINAPI
|
||||
PolyTextOutA( HDC hdc, const POLYTEXTA *pptxt, INT cStrings )
|
||||
PolyTextOutA(
|
||||
_In_ HDC hdc,
|
||||
_In_reads_(cStrings) const POLYTEXTA *pptxt,
|
||||
_In_ INT cStrings)
|
||||
{
|
||||
for (; cStrings>0; cStrings--, pptxt++)
|
||||
if (!ExtTextOutA( hdc, pptxt->x, pptxt->y, pptxt->uiFlags, &pptxt->rcl, pptxt->lpstr, pptxt->n, pptxt->pdx ))
|
||||
{
|
||||
if (!ExtTextOutA(hdc,
|
||||
pptxt->x,
|
||||
pptxt->y,
|
||||
pptxt->uiFlags,
|
||||
&pptxt->rcl,
|
||||
pptxt->lpstr,
|
||||
pptxt->n,
|
||||
pptxt->pdx))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -68,11 +93,26 @@ PolyTextOutA( HDC hdc, const POLYTEXTA *pptxt, INT cStrings )
|
|||
*/
|
||||
BOOL
|
||||
WINAPI
|
||||
PolyTextOutW( HDC hdc, const POLYTEXTW *pptxt, INT cStrings )
|
||||
PolyTextOutW(
|
||||
_In_ HDC hdc,
|
||||
_In_reads_(cStrings) const POLYTEXTW *pptxt,
|
||||
_In_ INT cStrings)
|
||||
{
|
||||
for (; cStrings>0; cStrings--, pptxt++)
|
||||
if (!ExtTextOutW( hdc, pptxt->x, pptxt->y, pptxt->uiFlags, &pptxt->rcl, pptxt->lpstr, pptxt->n, pptxt->pdx ))
|
||||
{
|
||||
if (!ExtTextOutW(hdc,
|
||||
pptxt->x,
|
||||
pptxt->y,
|
||||
pptxt->uiFlags,
|
||||
&pptxt->rcl,
|
||||
pptxt->lpstr,
|
||||
pptxt->n,
|
||||
pptxt->pdx))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -82,7 +122,8 @@ PolyTextOutW( HDC hdc, const POLYTEXTW *pptxt, INT cStrings )
|
|||
*/
|
||||
DWORD
|
||||
WINAPI
|
||||
GdiGetCodePage(HDC hdc)
|
||||
GdiGetCodePage(
|
||||
_In_ HDC hdc)
|
||||
{
|
||||
PDC_ATTR pdcattr;
|
||||
|
||||
|
@ -104,11 +145,10 @@ GdiGetCodePage(HDC hdc)
|
|||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
int
|
||||
INT
|
||||
WINAPI
|
||||
GetTextCharacterExtra(
|
||||
HDC hdc
|
||||
)
|
||||
_In_ HDC hdc)
|
||||
{
|
||||
PDC_ATTR pdcattr;
|
||||
|
||||
|
@ -127,25 +167,24 @@ GetTextCharacterExtra(
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int
|
||||
INT
|
||||
WINAPI
|
||||
GetTextCharset(HDC hdc)
|
||||
GetTextCharset(
|
||||
_In_ HDC hdc)
|
||||
{
|
||||
/* MSDN docs say this is equivalent */
|
||||
return NtGdiGetTextCharsetInfo(hdc,NULL,0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL
|
||||
WINAPI
|
||||
GetTextMetricsA(
|
||||
HDC hdc,
|
||||
LPTEXTMETRICA lptm
|
||||
)
|
||||
_In_ HDC hdc,
|
||||
_Out_ LPTEXTMETRICA lptm)
|
||||
{
|
||||
TMW_INTERNAL tmwi;
|
||||
|
||||
|
@ -165,13 +204,12 @@ GetTextMetricsA(
|
|||
BOOL
|
||||
WINAPI
|
||||
GetTextMetricsW(
|
||||
HDC hdc,
|
||||
LPTEXTMETRICW lptm
|
||||
)
|
||||
_In_ HDC hdc,
|
||||
_Out_ LPTEXTMETRICW lptm)
|
||||
{
|
||||
TMW_INTERNAL tmwi;
|
||||
|
||||
if (! NtGdiGetTextMetricsW(hdc, &tmwi, sizeof(TMW_INTERNAL)))
|
||||
if (!NtGdiGetTextMetricsW(hdc, &tmwi, sizeof(TMW_INTERNAL)))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -187,11 +225,10 @@ GetTextMetricsW(
|
|||
BOOL
|
||||
APIENTRY
|
||||
GetTextExtentPointA(
|
||||
HDC hdc,
|
||||
LPCSTR lpString,
|
||||
int cchString,
|
||||
LPSIZE lpSize
|
||||
)
|
||||
_In_ HDC hdc,
|
||||
_In_reads_(cchString) LPCSTR lpString,
|
||||
_In_ INT cchString,
|
||||
_Out_ LPSIZE lpsz)
|
||||
{
|
||||
ANSI_STRING StringA;
|
||||
UNICODE_STRING StringU;
|
||||
|
@ -200,7 +237,7 @@ GetTextExtentPointA(
|
|||
RtlInitAnsiString(&StringA, (LPSTR)lpString);
|
||||
RtlAnsiStringToUnicodeString(&StringU, &StringA, TRUE);
|
||||
|
||||
ret = GetTextExtentPointW(hdc, StringU.Buffer, cchString, lpSize);
|
||||
ret = GetTextExtentPointW(hdc, StringU.Buffer, cchString, lpsz);
|
||||
|
||||
RtlFreeUnicodeString(&StringU);
|
||||
|
||||
|
@ -214,38 +251,12 @@ GetTextExtentPointA(
|
|||
BOOL
|
||||
APIENTRY
|
||||
GetTextExtentPointW(
|
||||
HDC hdc,
|
||||
LPCWSTR lpString,
|
||||
int cchString,
|
||||
LPSIZE lpSize
|
||||
)
|
||||
_In_ HDC hdc,
|
||||
_In_reads_(cchString) LPCWSTR lpString,
|
||||
_In_ INT cchString,
|
||||
_Out_ LPSIZE lpsz)
|
||||
{
|
||||
return NtGdiGetTextExtent(hdc, (LPWSTR)lpString, cchString, lpSize, 0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL
|
||||
APIENTRY
|
||||
GetTextExtentExPointW(
|
||||
HDC hdc,
|
||||
LPCWSTR lpszStr,
|
||||
int cchString,
|
||||
int nMaxExtent,
|
||||
LPINT lpnFit,
|
||||
LPINT alpDx,
|
||||
LPSIZE lpSize
|
||||
)
|
||||
{
|
||||
|
||||
/* Windows doesn't check nMaxExtent validity in unicode version */
|
||||
if(nMaxExtent < -1)
|
||||
DPRINT("nMaxExtent is invalid: %d\n", nMaxExtent);
|
||||
|
||||
return NtGdiGetTextExtentExW (
|
||||
hdc, (LPWSTR)lpszStr, cchString, nMaxExtent, (PULONG)lpnFit, (PULONG)alpDx, lpSize, 0 );
|
||||
return NtGdiGetTextExtent(hdc, (LPWSTR)lpString, cchString, lpsz, 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -254,54 +265,87 @@ GetTextExtentExPointW(
|
|||
*/
|
||||
BOOL
|
||||
WINAPI
|
||||
GetTextExtentExPointWPri(HDC hdc,
|
||||
LPWSTR lpwsz,
|
||||
ULONG cwc,
|
||||
ULONG dxMax,
|
||||
ULONG *pcCh,
|
||||
PULONG pdxOut,
|
||||
LPSIZE psize)
|
||||
GetTextExtentExPointW(
|
||||
_In_ HDC hdc,
|
||||
_In_reads_(cchString) LPCWSTR lpszString,
|
||||
_In_ INT cchString,
|
||||
_In_ INT nMaxExtent,
|
||||
_Out_opt_ LPINT lpnFit,
|
||||
_Out_writes_to_opt_(cchString, *lpnFit) LPINT lpnDx,
|
||||
_Out_ LPSIZE lpSize)
|
||||
{
|
||||
return NtGdiGetTextExtentExW(hdc,lpwsz,cwc,dxMax,pcCh,pdxOut,psize,0);
|
||||
|
||||
/* Windows doesn't check nMaxExtent validity in unicode version */
|
||||
if (nMaxExtent < -1)
|
||||
{
|
||||
DPRINT("nMaxExtent is invalid: %d\n", nMaxExtent);
|
||||
}
|
||||
|
||||
return NtGdiGetTextExtentExW (
|
||||
hdc, (LPWSTR)lpszString, cchString, nMaxExtent, (PULONG)lpnFit, (PULONG)lpnDx, lpSize, 0 );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
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_ LPSIZE psize)
|
||||
{
|
||||
return NtGdiGetTextExtentExW(hdc, lpwsz, cwc, dxMax, pcCh, pdxOut, psize, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL
|
||||
APIENTRY
|
||||
WINAPI
|
||||
GetTextExtentExPointA(
|
||||
HDC hdc,
|
||||
LPCSTR lpszStr,
|
||||
int cchString,
|
||||
int nMaxExtent,
|
||||
LPINT lpnFit,
|
||||
LPINT alpDx,
|
||||
LPSIZE lpSize
|
||||
)
|
||||
_In_ HDC hdc,
|
||||
_In_reads_(cchString) LPCSTR lpszStr,
|
||||
_In_ INT cchString,
|
||||
_In_ INT nMaxExtent,
|
||||
_Out_opt_ LPINT lpnFit,
|
||||
_Out_writes_to_opt_ (cchString, *lpnFit) LPINT lpnDx,
|
||||
_Out_ LPSIZE lpSize)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
LPWSTR lpszStrW;
|
||||
BOOL rc = 0;
|
||||
BOOL bResult = FALSE;
|
||||
|
||||
if(nMaxExtent < -1)
|
||||
if (nMaxExtent < -1)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = HEAP_strdupA2W ( &lpszStrW, lpszStr );
|
||||
Status = HEAP_strdupA2W(&lpszStrW, lpszStr);
|
||||
if (!NT_SUCCESS (Status))
|
||||
SetLastError (RtlNtStatusToDosError(Status));
|
||||
else
|
||||
{
|
||||
rc = NtGdiGetTextExtentExW (
|
||||
hdc, lpszStrW, cchString, nMaxExtent, (PULONG)lpnFit, (PULONG)alpDx, lpSize, 0 );
|
||||
|
||||
HEAP_free ( lpszStrW );
|
||||
SetLastError(RtlNtStatusToDosError(Status));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return rc;
|
||||
bResult = NtGdiGetTextExtentExW(hdc,
|
||||
lpszStrW,
|
||||
cchString,
|
||||
nMaxExtent,
|
||||
(PULONG)lpnFit,
|
||||
(PULONG)lpnDx,
|
||||
lpSize,
|
||||
0);
|
||||
|
||||
HEAP_free(lpszStrW);
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
|
||||
|
@ -309,13 +353,12 @@ GetTextExtentExPointA(
|
|||
* @implemented
|
||||
*/
|
||||
BOOL
|
||||
APIENTRY
|
||||
WINAPI
|
||||
GetTextExtentPoint32A(
|
||||
HDC hdc,
|
||||
LPCSTR lpString,
|
||||
int cchString,
|
||||
LPSIZE lpSize
|
||||
)
|
||||
_In_ HDC hdc,
|
||||
_In_reads_(cchString) LPCSTR lpString,
|
||||
_In_ INT cchString,
|
||||
_Out_ LPSIZE lpSize)
|
||||
{
|
||||
ANSI_STRING StringA;
|
||||
UNICODE_STRING StringU;
|
||||
|
@ -337,13 +380,12 @@ GetTextExtentPoint32A(
|
|||
* @implemented
|
||||
*/
|
||||
BOOL
|
||||
APIENTRY
|
||||
WINAPI
|
||||
GetTextExtentPoint32W(
|
||||
HDC hdc,
|
||||
LPCWSTR lpString,
|
||||
int cchString,
|
||||
LPSIZE lpSize
|
||||
)
|
||||
_In_ HDC hdc,
|
||||
_In_reads_(cchString) LPCWSTR lpString,
|
||||
_In_ int cchString,
|
||||
_Out_ LPSIZE lpSize)
|
||||
{
|
||||
return NtGdiGetTextExtent(hdc, (LPWSTR)lpString, cchString, lpSize, 0);
|
||||
}
|
||||
|
@ -353,15 +395,23 @@ GetTextExtentPoint32W(
|
|||
*/
|
||||
BOOL
|
||||
WINAPI
|
||||
GetTextExtentExPointI(HDC hdc,
|
||||
LPWORD pgiIn,
|
||||
int cgi,
|
||||
int nMaxExtent,
|
||||
LPINT lpnFit,
|
||||
LPINT alpDx,
|
||||
LPSIZE lpSize)
|
||||
GetTextExtentExPointI(
|
||||
_In_ HDC hdc,
|
||||
_In_reads_(cgi) LPWORD pgiIn,
|
||||
_In_ INT cgi,
|
||||
_In_ INT nMaxExtent,
|
||||
_Out_opt_ LPINT lpnFit,
|
||||
_Out_writes_to_opt_(cwchString, *lpnFit) LPINT lpnDx,
|
||||
_Out_ LPSIZE lpSize)
|
||||
{
|
||||
return NtGdiGetTextExtentExW(hdc,pgiIn,cgi,nMaxExtent,(ULONG *)lpnFit, (PULONG) alpDx,lpSize,GTEF_INDICES);
|
||||
return NtGdiGetTextExtentExW(hdc,
|
||||
pgiIn,
|
||||
cgi,
|
||||
nMaxExtent,
|
||||
(PULONG)lpnFit,
|
||||
(PULONG)lpnDx,
|
||||
lpSize,
|
||||
GTEF_INDICES);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -369,12 +419,13 @@ GetTextExtentExPointI(HDC hdc,
|
|||
*/
|
||||
BOOL
|
||||
WINAPI
|
||||
GetTextExtentPointI(HDC hdc,
|
||||
LPWORD pgiIn,
|
||||
int cgi,
|
||||
LPSIZE lpSize)
|
||||
GetTextExtentPointI(
|
||||
_In_ HDC hdc,
|
||||
_In_reads_(cgi) LPWORD pgiIn,
|
||||
_In_ int cgi,
|
||||
_Out_ LPSIZE lpSize)
|
||||
{
|
||||
return NtGdiGetTextExtent(hdc,pgiIn,cgi,lpSize,GTEF_INDICES);
|
||||
return NtGdiGetTextExtent(hdc, pgiIn, cgi, lpSize, GTEF_INDICES);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -383,15 +434,14 @@ GetTextExtentPointI(HDC hdc,
|
|||
BOOL
|
||||
WINAPI
|
||||
ExtTextOutA(
|
||||
HDC hdc,
|
||||
int X,
|
||||
int Y,
|
||||
UINT fuOptions,
|
||||
CONST RECT *lprc,
|
||||
LPCSTR lpString,
|
||||
UINT cchString,
|
||||
CONST INT *lpDx
|
||||
)
|
||||
_In_ HDC hdc,
|
||||
_In_ INT x,
|
||||
_In_ INT y,
|
||||
_In_ UINT fuOptions,
|
||||
_In_opt_ const RECT *lprc,
|
||||
_In_reads_opt_(cch) LPCSTR lpString,
|
||||
_In_ UINT cch,
|
||||
_In_reads_opt_(cch) const INT *lpDx)
|
||||
{
|
||||
ANSI_STRING StringA;
|
||||
UNICODE_STRING StringU;
|
||||
|
@ -400,7 +450,7 @@ ExtTextOutA(
|
|||
RtlInitAnsiString(&StringA, (LPSTR)lpString);
|
||||
RtlAnsiStringToUnicodeString(&StringU, &StringA, TRUE);
|
||||
|
||||
ret = ExtTextOutW(hdc, X, Y, fuOptions, lprc, StringU.Buffer, cchString, lpDx);
|
||||
ret = ExtTextOutW(hdc, x, y, fuOptions, lprc, StringU.Buffer, cch, lpDx);
|
||||
|
||||
RtlFreeUnicodeString(&StringU);
|
||||
|
||||
|
@ -414,17 +464,24 @@ ExtTextOutA(
|
|||
BOOL
|
||||
WINAPI
|
||||
ExtTextOutW(
|
||||
HDC hdc,
|
||||
int X,
|
||||
int Y,
|
||||
UINT fuOptions,
|
||||
CONST RECT *lprc,
|
||||
LPCWSTR lpString,
|
||||
UINT cchString,
|
||||
CONST INT *lpDx
|
||||
)
|
||||
_In_ HDC hdc,
|
||||
_In_ INT x,
|
||||
_In_ INT y,
|
||||
_In_ UINT fuOptions,
|
||||
_In_opt_ const RECT *lprc,
|
||||
_In_reads_opt_(cwc) LPCWSTR lpString,
|
||||
_In_ UINT cwc,
|
||||
_In_reads_opt_(cwc) const INT *lpDx)
|
||||
{
|
||||
return NtGdiExtTextOutW(hdc, X, Y, fuOptions, (LPRECT)lprc, (LPWSTR)lpString, cchString, (LPINT)lpDx, 0);
|
||||
return NtGdiExtTextOutW(hdc,
|
||||
x,
|
||||
y,
|
||||
fuOptions,
|
||||
(LPRECT)lprc,
|
||||
(LPWSTR)lpString,
|
||||
cwc,
|
||||
(LPINT)lpDx,
|
||||
0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -433,12 +490,13 @@ ExtTextOutW(
|
|||
*/
|
||||
INT
|
||||
WINAPI
|
||||
GetTextFaceW(HDC hDC,
|
||||
INT nCount,
|
||||
PWSTR pFaceName)
|
||||
GetTextFaceW(
|
||||
_In_ HDC hdc,
|
||||
_In_ INT cwcMax,
|
||||
_Out_writes_to_opt_(cwcMax, return) LPWSTR pFaceName)
|
||||
{
|
||||
/* Validate parameters */
|
||||
if (pFaceName && nCount <= 0)
|
||||
if (pFaceName && cwcMax <= 0)
|
||||
{
|
||||
/* Set last error and return failure */
|
||||
GdiSetLastError(ERROR_INVALID_PARAMETER);
|
||||
|
@ -446,22 +504,25 @@ GetTextFaceW(HDC hDC,
|
|||
}
|
||||
|
||||
/* Forward to kernel */
|
||||
return NtGdiGetTextFaceW(hDC, nCount, pFaceName, FALSE);
|
||||
return NtGdiGetTextFaceW(hdc, cwcMax, pFaceName, FALSE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int
|
||||
INT
|
||||
WINAPI
|
||||
GetTextFaceA( HDC hdc, INT count, LPSTR name )
|
||||
GetTextFaceA(
|
||||
_In_ HDC hdc,
|
||||
_In_ INT cchMax,
|
||||
_Out_writes_to_opt_(cchMax, return) LPSTR lpName)
|
||||
{
|
||||
INT res;
|
||||
LPWSTR nameW;
|
||||
|
||||
/* Validate parameters */
|
||||
if (name && count <= 0)
|
||||
if (lpName && cchMax <= 0)
|
||||
{
|
||||
/* Set last error and return failure */
|
||||
GdiSetLastError(ERROR_INVALID_PARAMETER);
|
||||
|
@ -474,16 +535,20 @@ GetTextFaceA( HDC hdc, INT count, LPSTR name )
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
GetTextFaceW( hdc, res, nameW );
|
||||
|
||||
if (name)
|
||||
if (lpName)
|
||||
{
|
||||
if (count && !WideCharToMultiByte( CP_ACP, 0, nameW, -1, name, count, NULL, NULL))
|
||||
name[count-1] = 0;
|
||||
res = strlen(name);
|
||||
if (cchMax && !WideCharToMultiByte( CP_ACP, 0, nameW, -1, lpName, cchMax, NULL, NULL))
|
||||
lpName[cchMax-1] = 0;
|
||||
res = strlen(lpName);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = WideCharToMultiByte( CP_ACP, 0, nameW, -1, NULL, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, nameW );
|
||||
return res;
|
||||
}
|
||||
|
@ -494,27 +559,28 @@ GetTextFaceA( HDC hdc, INT count, LPSTR name )
|
|||
*/
|
||||
INT
|
||||
WINAPI
|
||||
GetTextFaceAliasW(HDC hdc,
|
||||
int cChar,
|
||||
LPWSTR pszOut)
|
||||
GetTextFaceAliasW(
|
||||
_In_ HDC hdc,
|
||||
_In_ INT cwcMax,
|
||||
_Out_writes_to_opt_(cwcMax, return) LPWSTR pszOut)
|
||||
{
|
||||
if ( pszOut && !cChar )
|
||||
if (pszOut && !cwcMax)
|
||||
{
|
||||
GdiSetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
return NtGdiGetTextFaceW(hdc,cChar,pszOut,TRUE);
|
||||
|
||||
return NtGdiGetTextFaceW(hdc, cwcMax, pszOut, TRUE);
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
GetFontResourceInfoW(
|
||||
LPCWSTR lpFileName,
|
||||
DWORD *pdwBufSize,
|
||||
void* lpBuffer,
|
||||
DWORD dwType
|
||||
)
|
||||
_In_z_ LPCWSTR lpFileName,
|
||||
_Inout_ DWORD *pdwBufSize,
|
||||
_Out_writes_to_(*pdwBufSize, *pdwBufSize) PVOID lpBuffer,
|
||||
_In_ DWORD dwType)
|
||||
{
|
||||
BOOL bRet;
|
||||
UNICODE_STRING NtFileName;
|
||||
|
@ -545,29 +611,23 @@ GetFontResourceInfoW(
|
|||
|
||||
RtlFreeHeap(RtlGetProcessHeap(), 0, NtFileName.Buffer);
|
||||
|
||||
if (!bRet)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return bRet;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
int
|
||||
INT
|
||||
WINAPI
|
||||
SetTextCharacterExtra(
|
||||
HDC hdc,
|
||||
int CharExtra
|
||||
)
|
||||
_In_ HDC hdc,
|
||||
_In_ INT nCharExtra)
|
||||
{
|
||||
INT cExtra;
|
||||
PDC_ATTR pdcattr;
|
||||
INT nOldCharExtra;
|
||||
|
||||
if (CharExtra == 0x80000000)
|
||||
if (nCharExtra == 0x80000000)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0x80000000;
|
||||
|
@ -576,7 +636,7 @@ SetTextCharacterExtra(
|
|||
#if 0
|
||||
if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC)
|
||||
{
|
||||
return MFDRV_SetTextCharacterExtra( hdc, CharExtra ); // Wine port.
|
||||
return MFDRV_SetTextCharacterExtra( hdc, nCharExtra ); // Wine port.
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -597,9 +657,9 @@ SetTextCharacterExtra(
|
|||
}
|
||||
}
|
||||
|
||||
cExtra = pdcattr->lTextExtra;
|
||||
pdcattr->lTextExtra = CharExtra;
|
||||
return cExtra;
|
||||
nOldCharExtra = pdcattr->lTextExtra;
|
||||
pdcattr->lTextExtra = nCharExtra;
|
||||
return nOldCharExtra;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -608,7 +668,8 @@ SetTextCharacterExtra(
|
|||
*/
|
||||
UINT
|
||||
WINAPI
|
||||
GetTextAlign(HDC hdc)
|
||||
GetTextAlign(
|
||||
_In_ HDC hdc)
|
||||
{
|
||||
PDC_ATTR pdcattr;
|
||||
|
||||
|
@ -630,7 +691,8 @@ GetTextAlign(HDC hdc)
|
|||
*/
|
||||
COLORREF
|
||||
WINAPI
|
||||
GetTextColor(HDC hdc)
|
||||
GetTextColor(
|
||||
_In_ HDC hdc)
|
||||
{
|
||||
PDC_ATTR pdcattr;
|
||||
|
||||
|
@ -651,11 +713,12 @@ GetTextColor(HDC hdc)
|
|||
*/
|
||||
UINT
|
||||
WINAPI
|
||||
SetTextAlign(HDC hdc,
|
||||
UINT fMode)
|
||||
SetTextAlign(
|
||||
_In_ HDC hdc,
|
||||
_In_ UINT fMode)
|
||||
{
|
||||
PDC_ATTR pdcattr;
|
||||
INT OldMode;
|
||||
INT fOldMode;
|
||||
|
||||
/* Get the DC attribute */
|
||||
pdcattr = GdiGetDcAttr(hdc);
|
||||
|
@ -686,7 +749,7 @@ SetTextAlign(HDC hdc,
|
|||
}
|
||||
#endif
|
||||
|
||||
OldMode = pdcattr->lTextAlign;
|
||||
fOldMode = pdcattr->lTextAlign;
|
||||
pdcattr->lTextAlign = fMode; // Raw
|
||||
if (pdcattr->dwLayout & LAYOUT_RTL)
|
||||
{
|
||||
|
@ -694,7 +757,7 @@ SetTextAlign(HDC hdc,
|
|||
}
|
||||
|
||||
pdcattr->flTextAlign = fMode & TA_MASK;
|
||||
return OldMode;
|
||||
return fOldMode;
|
||||
}
|
||||
|
||||
|
||||
|
@ -704,12 +767,11 @@ SetTextAlign(HDC hdc,
|
|||
COLORREF
|
||||
WINAPI
|
||||
SetTextColor(
|
||||
HDC hdc,
|
||||
COLORREF crColor
|
||||
)
|
||||
_In_ HDC hdc,
|
||||
_In_ COLORREF crColor)
|
||||
{
|
||||
PDC_ATTR pdcattr;
|
||||
COLORREF OldColor = CLR_INVALID;
|
||||
COLORREF crOldColor = CLR_INVALID;
|
||||
|
||||
/* Get the DC attribute */
|
||||
pdcattr = GdiGetDcAttr(hdc);
|
||||
|
@ -740,15 +802,16 @@ SetTextColor(
|
|||
}
|
||||
#endif
|
||||
|
||||
OldColor = (COLORREF) pdcattr->ulForegroundClr;
|
||||
pdcattr->ulForegroundClr = (ULONG) crColor;
|
||||
crOldColor = (COLORREF) pdcattr->ulForegroundClr;
|
||||
pdcattr->ulForegroundClr = (ULONG)crColor;
|
||||
|
||||
if ( pdcattr->crForegroundClr != crColor )
|
||||
if (pdcattr->crForegroundClr != crColor)
|
||||
{
|
||||
pdcattr->ulDirty_ |= (DIRTY_TEXT|DIRTY_LINE|DIRTY_FILL);
|
||||
pdcattr->crForegroundClr = crColor;
|
||||
}
|
||||
return OldColor;
|
||||
|
||||
return crOldColor;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -757,10 +820,9 @@ SetTextColor(
|
|||
BOOL
|
||||
WINAPI
|
||||
SetTextJustification(
|
||||
HDC hdc,
|
||||
int extra,
|
||||
int breaks
|
||||
)
|
||||
_In_ HDC hdc,
|
||||
_In_ INT nBreakExtra,
|
||||
_In_ INT nBreakCount)
|
||||
{
|
||||
PDC_ATTR pdcattr;
|
||||
|
||||
|
@ -776,7 +838,7 @@ SetTextJustification(
|
|||
if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)
|
||||
{
|
||||
if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC)
|
||||
return MFDRV_SetTextJustification( hdc, extra, breaks )
|
||||
return MFDRV_SetTextJustification( hdc, nBreakExtra, nBreakCount )
|
||||
else
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
|
@ -793,8 +855,8 @@ SetTextJustification(
|
|||
}
|
||||
}
|
||||
|
||||
pdcattr->cBreak = breaks;
|
||||
pdcattr->lBreakExtra = extra;
|
||||
pdcattr->cBreak = nBreakCount;
|
||||
pdcattr->lBreakExtra = nBreakExtra;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -803,32 +865,35 @@ SetTextJustification(
|
|||
*/
|
||||
UINT
|
||||
WINAPI
|
||||
GetStringBitmapA(HDC hdc,
|
||||
LPSTR psz,
|
||||
BOOL DoCall,
|
||||
UINT cj,
|
||||
BYTE *lpSB)
|
||||
GetStringBitmapA(
|
||||
_In_ HDC hdc,
|
||||
_In_ LPSTR psz,
|
||||
_In_ BOOL bDoCall,
|
||||
_In_ UINT cj,
|
||||
_Out_writes_(cj) BYTE *lpSB)
|
||||
{
|
||||
|
||||
NTSTATUS Status;
|
||||
PWSTR pwsz;
|
||||
UINT retValue = 0;
|
||||
UINT uResult = 0;
|
||||
|
||||
if (DoCall)
|
||||
if (!bDoCall)
|
||||
{
|
||||
Status = HEAP_strdupA2W ( &pwsz, psz );
|
||||
if ( !NT_SUCCESS (Status) )
|
||||
{
|
||||
SetLastError (RtlNtStatusToDosError(Status));
|
||||
}
|
||||
else
|
||||
{
|
||||
retValue = NtGdiGetStringBitmapW(hdc, pwsz, 1, lpSB, cj);
|
||||
HEAP_free ( pwsz );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
Status = HEAP_strdupA2W(&pwsz, psz);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastError (RtlNtStatusToDosError(Status));
|
||||
}
|
||||
else
|
||||
{
|
||||
uResult = NtGdiGetStringBitmapW(hdc, pwsz, 1, lpSB, cj);
|
||||
HEAP_free(pwsz);
|
||||
}
|
||||
|
||||
return uResult;
|
||||
|
||||
}
|
||||
|
||||
|
@ -837,20 +902,19 @@ GetStringBitmapA(HDC hdc,
|
|||
*/
|
||||
UINT
|
||||
WINAPI
|
||||
GetStringBitmapW(HDC hdc,
|
||||
LPWSTR pwsz,
|
||||
BOOL doCall,
|
||||
UINT cj,
|
||||
BYTE *lpSB)
|
||||
GetStringBitmapW(
|
||||
_In_ HDC hdc,
|
||||
_In_ LPWSTR pwsz,
|
||||
_In_ BOOL bDoCall,
|
||||
_In_ UINT cj,
|
||||
_Out_writes_(cj) BYTE *lpSB)
|
||||
{
|
||||
UINT retValue = 0;
|
||||
|
||||
if (doCall)
|
||||
if (!bDoCall)
|
||||
{
|
||||
retValue = NtGdiGetStringBitmapW(hdc, pwsz, 1, lpSB, cj);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
return NtGdiGetStringBitmapW(hdc, pwsz, 1, lpSB, cj);
|
||||
|
||||
}
|
||||
|
||||
|
@ -859,13 +923,18 @@ GetStringBitmapW(HDC hdc,
|
|||
*/
|
||||
BOOL
|
||||
WINAPI
|
||||
GetETM(HDC hdc,
|
||||
EXTTEXTMETRIC *petm)
|
||||
GetETM(
|
||||
_In_ HDC hdc,
|
||||
_Out_ EXTTEXTMETRIC *petm)
|
||||
{
|
||||
BOOL Ret = NtGdiGetETM(hdc, petm);
|
||||
BOOL bResult;
|
||||
|
||||
if (Ret && petm)
|
||||
bResult = NtGdiGetETM(hdc, petm);
|
||||
|
||||
if (bResult && petm)
|
||||
{
|
||||
petm->emKernPairs = (WORD)GetKerningPairsA(hdc, 0, 0);
|
||||
}
|
||||
|
||||
return Ret;
|
||||
return bResult;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue