[LPK][GDI32] Enable mirroring via version resource (#965)

Add a mechanism that detects via the version resource whether it's needed to mirror
the application layout or not. This is a "follow up" to commit 5b14b6f.

This code is taken from the GetProcessDefaultLayout() function from Wine
(called there "WIN_CreateWindowEx").

In Windows the version-resource mirroring happens when the GDI is loading the LPK.

- Implement mirroring via version resource. GDI linking on startup is required.

- GDI32: Add LPK loading on GDI startup.

To enable mirroring via version resource the lpk.dll must be loaded before any windows are created.
This is done through GdiInitializeLanguagePack() function which is called in GdiProcessSetup().

- LPK: Use Wine debug messaging.
This commit is contained in:
Baruch Rutman 2018-10-24 22:34:38 +03:00 committed by Hermès BÉLUSCA - MAÏTO
parent 17449bcff1
commit 6a3b1879a1
9 changed files with 99 additions and 10 deletions

View file

@ -64,8 +64,9 @@ extern LPKGCP LpkGetCharacterPlacement;
#define SAPCALLBACKDELAY 244
#define LPK_ETO 1
#define LPK_GCP 2
#define LPK_INIT 1
#define LPK_ETO 2
#define LPK_GCP 3
/* MACRO ********************************************************************/
@ -319,6 +320,16 @@ LoadLPK(
INT LpkFunctionID
);
VOID
WINAPI
GdiInitializeLanguagePack(
_In_ DWORD InitParam);
VOID
WINAPI
InitializeLpkHooks(
_In_ FARPROC *hookfuncs);
BOOL
WINAPI
GetETM(HDC hdc,

View file

@ -51,6 +51,7 @@ GdiProcessSetup(VOID)
GdiHandleCache = (PGDIHANDLECACHE)NtCurrentTeb()->ProcessEnvironmentBlock->GdiHandleBuffer;
RtlInitializeCriticalSection(&semLocal);
InitializeCriticalSection(&gcsClientObjLinks);
GdiInitializeLanguagePack(0);
}
VOID

View file

@ -1021,12 +1021,34 @@ GdiRealizationInfo(HDC hdc,
/*
* @unimplemented
* @halfplemented
*/
VOID WINAPI GdiInitializeLanguagePack(DWORD InitParam)
{
UNIMPLEMENTED;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
/* Lpk function pointers to be passed to user32 */
#if 0
FARPROC hookfuncs[4];
#endif
#ifdef LANGPACK
if (!LoadLPK(LPK_INIT)) // no lpk found!
#endif
return;
/* Call InitializeLpkHooks with 4 procedure addresses
loaded from lpk.dll but currently only one of them is currently implemented.
Then InitializeLpkHooks (in user32) uses these to replace certain internal functions
and ORs a DWORD being used also by ClientThreadSetup and calls
NtUserOneParam with parameter 54 which is ONEPARAM_ROUTINE_REGISTERLPK
which most likely changes the value of dwLpkEntryPoints in the
PROCESSINFO struct */
#if 0
hookfuncs[0] = GetProcAddress(hLpk, "LpkPSMTextOut");
InitializeLpkHooks(hookfuncs);
#endif
gbLpk = TRUE;
}
BOOL

View file

@ -428,6 +428,9 @@ BOOL WINAPI LoadLPK(INT LpkFunctionID)
{
switch (LpkFunctionID)
{
case LPK_INIT:
return TRUE;
case LPK_ETO:
if (!LpkExtTextOut) // Check if the function is already loaded
LpkExtTextOut = (LPKETO) GetProcAddress(hLpk, "LpkExtTextOut");