[0.4.13][USER32] Fix BSOD 0x50 in 'WineVDM + Castle Of Winds' CORE-17856 CORE-17857

CORE-17856 BSOD 0x50 when starting Castle of the Winds second time, with WineVDM
CORE-17857 BSOD 0x50 on shutdown after closing Castle of the Winds with WineVDM

The fix is a squashed back port of:
0.4.15-dev-3430-g 9cff384c22
0.4.15-dev-3440-g a89844f740

I took also the following small off-topic-fix with me:
0.4.14-dev-1002-g feb7df42b4
which made both files 100% in sync with 0.4.14-release-0-g9963bba
This commit is contained in:
Joachim Henze 2022-01-11 09:52:10 +01:00
parent 9ee44dc632
commit 853fcdfc48
2 changed files with 6 additions and 3 deletions

View file

@ -205,7 +205,7 @@ VersionRegisterClass(
WCHAR ClassNameBuf[MAX_PATH] = {0};
RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame = { sizeof(Frame), 1 };
ERR("VersionRegisterClass: Attempting to call RegisterClassNameW in %S\n.", lpLibFileName);
ERR("VersionRegisterClass: Attempting to call RegisterClassNameW in %S.\n", lpLibFileName);
RtlActivateActivationContextUnsafeFast(&Frame, Contex);
@ -1134,6 +1134,8 @@ LONG_PTR IntGetWindowLong( HWND hwnd, INT offset, UINT size, BOOL unicode )
{
SetLastError(ERROR_ACCESS_DENIED);
retvalue = 0;
ERR("Outside Access and Denied!\n");
break;
}
retvalue = (ULONG_PTR)IntGetWndProc(wndPtr, !unicode);
break;

View file

@ -712,7 +712,7 @@ User32CallHookProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
CWPSTRUCT *pCWPT = &pcwps->cwps;
pCWP = HeapAlloc(GetProcessHeap(), 0, Common->lParamSize + sizeof(CWPSTRUCT));
RtlCopyMemory(pCWP, pCWPT, sizeof(CWPSTRUCT));
// ERR("WH_CALLWNDPROC: Code %d, wParam %d msg %d\n",Common->Code,Common->wParam,pCWP->message);
//ERR("WH_CALLWNDPROC: Code %d, wParam %d hwnd %p msg %d\n",Common->Code,Common->wParam,pCWP->hwnd,pCWP->message);
/* If more memory is reserved, then lParam is a pointer.
* Size of the buffer is stocked in the lParam member, and its content
* is at the end of the argument buffer */
@ -731,7 +731,8 @@ User32CallHookProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
PCWPR_Struct pcwprs = (PCWPR_Struct)Common;
CWPRETSTRUCT *pCWPRT = &pcwprs->cwprs;
pCWPR = HeapAlloc(GetProcessHeap(), 0, Common->lParamSize + sizeof(CWPRETSTRUCT));
RtlCopyMemory(pCWPR, pCWPRT, sizeof(CWPSTRUCT));
RtlCopyMemory(pCWPR, pCWPRT, sizeof(CWPRETSTRUCT));
//ERR("WH_CALLWNDPROCRET: Code %d, wParam %d hwnd %p msg %d\n",Common->Code,Common->wParam,pCWPRT->hwnd,pCWPRT->message);
if ( Common->lParamSize )
{
pCWPR->lParam = (LPARAM)((PCHAR)pCWPR + sizeof(CWPRETSTRUCT));