00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
#ifdef _USERK_
00029
00030
BOOL xxxPSMGetTextExtent(
00031 HDC hdc,
00032 LPWSTR lpstr,
00033
int cch,
00034 PSIZE psize)
00035 {
00036
int result;
00037 WCHAR szTemp[255], *pchOut;
00038
PTHREADINFO ptiCurrent =
PtiCurrentShared();
00039
TL tl;
00040
00041
if (cch >
sizeof(szTemp)/
sizeof(WCHAR)) {
00042 pchOut = (WCHAR*)UserAllocPool((cch+1) *
sizeof(WCHAR), TAG_RTL);
00043
if (pchOut ==
NULL)
00044
return FALSE;
00045
ThreadLockPool(ptiCurrent, pchOut, &tl);
00046 }
else {
00047 pchOut = szTemp;
00048 }
00049
00050 result = HIWORD(
GetPrefixCount(lpstr, cch, pchOut, cch));
00051
00052
if (result) {
00053 lpstr = pchOut;
00054 cch -= result;
00055 }
00056
if (
CALL_LPK(ptiCurrent)) {
00057
xxxClientGetTextExtentPointW(hdc, lpstr, cch, psize);
00058 }
else {
00059
UserGetTextExtentPointW(hdc, lpstr, cch, psize);
00060 }
00061
if (pchOut != szTemp)
00062
ThreadUnlockAndFreePool(ptiCurrent, &tl);
00063
00064
00065
00066
00067
return TRUE;
00068 }
00069
00070
#else
00071
00072 BOOL PSMGetTextExtent(
00073 HDC hdc,
00074 LPCWSTR lpstr,
00075
int cch,
00076 PSIZE psize)
00077 {
00078
int result;
00079 WCHAR szTemp[255], *pchOut;
00080
00081
if (cch >
sizeof(szTemp)/
sizeof(WCHAR)) {
00082 pchOut = (WCHAR*)
UserLocalAlloc(0, (cch+1) *
sizeof(WCHAR));
00083
if (pchOut ==
NULL)
00084
return FALSE;
00085 }
else {
00086 pchOut = szTemp;
00087 }
00088
00089 result = HIWORD(
GetPrefixCount(lpstr, cch, pchOut, cch));
00090
00091
if (result) {
00092 lpstr = pchOut;
00093 cch -= result;
00094 }
00095
00096
UserGetTextExtentPointW(hdc, lpstr, cch, psize);
00097
00098
if (pchOut != szTemp)
00099
UserLocalFree(pchOut);
00100
00101
00102
00103
00104
return TRUE;
00105 }
00106
00107
#endif // _USERK_