New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIN32SS][LPK] Add BiDi support to menus and window captions #738
Changes from 9 commits
19218cc
aeacc29
022856a
d8244bf
2ebfc8e
f0c2f93
8564744
9816642
501ab44
0d55499
e251960
51e338a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -939,6 +939,100 @@ static void TEXT_DrawUnderscore (HDC hdc, int x, int y, const WCHAR *str, int of | |
#endif | ||
} | ||
|
||
#ifdef _WIN32K_ | ||
BOOL UserExtTextOutW(HDC hdc, | ||
INT x, | ||
INT y, | ||
UINT flags, | ||
PRECTL lprc, | ||
LPCWSTR lpString, | ||
UINT count) | ||
{ | ||
PVOID ResultPointer; | ||
ULONG ResultLength; | ||
ULONG ArgumentLength; | ||
ULONG_PTR pStringBuffer = 0; | ||
NTSTATUS Status; | ||
PLPK_CALLBACK_ARGUMENTS Argument; | ||
BOOL bResult; | ||
|
||
ArgumentLength = sizeof(LPK_CALLBACK_ARGUMENTS); | ||
|
||
pStringBuffer = ArgumentLength; | ||
ArgumentLength += sizeof(WCHAR) * (count + 2); | ||
|
||
Argument = IntCbAllocateMemory(ArgumentLength); | ||
|
||
if (!Argument) | ||
{ | ||
goto fallback; | ||
} | ||
|
||
/* Initialize struct members */ | ||
Argument->hdc = hdc; | ||
Argument->x = x; | ||
Argument->y = y; | ||
Argument->flags = flags; | ||
Argument->count = count; | ||
|
||
if (lprc) | ||
{ | ||
Argument->rect = *lprc; | ||
Argument->bRect = TRUE; | ||
} | ||
else | ||
{ | ||
Argument->bRect = FALSE; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're leaving |
||
} | ||
|
||
/* Align lpString | ||
* mimicks code from co_IntClientLoadLibrary */ | ||
pStringBuffer += (ULONG_PTR)Argument; | ||
Argument->lpString = (LPWSTR)pStringBuffer; | ||
RtlStringCchCopyNW(Argument->lpString, count + 1, lpString, count); | ||
|
||
pStringBuffer -= (ULONG_PTR)Argument; | ||
Argument->lpString = (LPWSTR)(pStringBuffer); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems a little cumbersome. Why not set
|
||
|
||
UserLeaveCo(); | ||
|
||
Status = KeUserModeCallback(USER32_CALLBACK_LPK, | ||
Argument, | ||
ArgumentLength, | ||
&ResultPointer, | ||
&ResultLength); | ||
|
||
UserEnterCo(); | ||
|
||
IntCbFreeMemory(Argument); | ||
|
||
if (NT_SUCCESS(Status)) | ||
{ | ||
_SEH2_TRY | ||
{ | ||
ProbeForRead(ResultPointer, sizeof(BOOL), 1); | ||
bResult = *(LPBOOL)ResultPointer; | ||
} | ||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) | ||
{ | ||
ERR("Failed to copy result from user mode!\n"); | ||
Status = _SEH2_GetExceptionCode(); | ||
} | ||
_SEH2_END; | ||
} | ||
|
||
if (!NT_SUCCESS(Status)) | ||
{ | ||
goto fallback; | ||
} | ||
|
||
return bResult; | ||
|
||
fallback: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove the indentation. |
||
return GreExtTextOutW(hdc, x, y, flags, lprc, lpString, count, NULL, 0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reduce the indentation to 4 spaces. |
||
} | ||
#endif | ||
|
||
/*********************************************************************** | ||
* DrawTextExW (USER32.@) | ||
* | ||
|
@@ -1198,10 +1292,10 @@ INT WINAPI DrawTextExWorker( HDC hdc, | |
else | ||
len_seg = len; | ||
#ifdef _WIN32K_ | ||
if (!GreExtTextOutW( hdc, xseg, y, | ||
((flags & DT_NOCLIP) ? 0 : ETO_CLIPPED) | | ||
((flags & DT_RTLREADING) ? ETO_RTLREADING : 0), | ||
rect, str, len_seg, NULL, 0 )) | ||
if (!UserExtTextOutW( hdc, xseg, y, | ||
((flags & DT_NOCLIP) ? 0 : ETO_CLIPPED) | | ||
((flags & DT_RTLREADING) ? ETO_RTLREADING : 0), | ||
rect, str, len_seg)) | ||
#else | ||
if (!ExtTextOutW( hdc, xseg, y, | ||
((flags & DT_NOCLIP) ? 0 : ETO_CLIPPED) | | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,6 +205,7 @@ PVOID apfnDispatch[USER32_CALLBACK_MAXIMUM + 1] = | |
User32CallDDEPostFromKernel, | ||
User32CallDDEGetFromKernel, | ||
User32CallOBMFromKernel, | ||
User32CallLPKFromKernel, | ||
}; | ||
|
||
|
||
|
@@ -641,3 +642,24 @@ User32CallOBMFromKernel(PVOID Arguments, ULONG ArgumentLength) | |
|
||
return ZwCallbackReturn(Arguments, ArgumentLength, STATUS_SUCCESS); | ||
} | ||
|
||
NTSTATUS WINAPI User32CallLPKFromKernel(PVOID Arguments, ULONG ArgumentLength) | ||
{ | ||
BOOL bResult; | ||
PLPK_CALLBACK_ARGUMENTS Argument; | ||
|
||
Argument = (PLPK_CALLBACK_ARGUMENTS)Arguments; | ||
|
||
Argument->lpString = (LPWSTR)((ULONG_PTR)Argument->lpString + (ULONG_PTR)Argument); | ||
|
||
bResult = ExtTextOutW(Argument->hdc, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the future this certainly will have to be generalized. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you mean by "generalization"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Err forget what I've just said. I indeed see in the user32 symbols that there is indeed a special callback for ExtTextOutW (ClientExtTextOutW). |
||
Argument->x, | ||
Argument->y, | ||
Argument->flags, | ||
(Argument->bRect) ? &Argument->rect : NULL, | ||
Argument->lpString, | ||
Argument->count, | ||
NULL); | ||
|
||
return ZwCallbackReturn(&bResult, sizeof(BOOL), STATUS_SUCCESS); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not need to be zero-initialized.