#21 crash on vista x64 after latest windows update

closed
nobody
None
5
2010-02-14
2010-02-11
addmx
No

MPC (latest from repository, compiled as x86) crashes after latest security updates on vista x64 (DX9 renderer VMR9)
The solution is to correct the function HookNewSegmentAndReceive (in IPinHook.cpp line 59), now on all 64bit windows systems (vista, win7) VirtualProtect uses 2bytes granularity, the crash is due to sizeof(IMemInputPinC) == 4 AND pMemInputPinC->lpVtbl->Receive is far above this :)
corrected function below:
If someone cares plz. put this into repository and make binary for (un)happy x64 users :)
(all changed lines marked by '// !!MS')

bool HookNewSegmentAndReceive(IPinC* pPinC, IMemInputPinC* pMemInputPinC)
{
if(!pPinC || !pMemInputPinC || (GetVersion()&0x80000000))
return false;

g_tSegmentStart = 0;
g_tSampleStart = 0;

BOOL res;
DWORD flOldProtect = 0;
DWORD flSetProtect = 0; // !!MS

res = VirtualProtect(pPinC->lpVtbl, sizeof(IPinCVtbl /*IPinC*/), PAGE_WRITECOPY, &flOldProtect); // !!MS
flSetProtect = flOldProtect; // !!MS
if(NewSegmentOrg == NULL) NewSegmentOrg = pPinC->lpVtbl->NewSegment;
pPinC->lpVtbl->NewSegment = NewSegmentMine;
res = VirtualProtect(pPinC->lpVtbl, sizeof(IPinCVtbl /*IPinC*/), flSetProtect /* PAGE_EXECUTE */, &flOldProtect); // !!MS

flOldProtect = 0; // !!MS
res = VirtualProtect(pMemInputPinC->lpVtbl, sizeof(IMemInputPinCVtbl /*IMemInputPinC*/), PAGE_WRITECOPY, &flOldProtect); // !!MS
flSetProtect = flOldProtect; // !!MS

if(ReceiveOrg == NULL) ReceiveOrg = pMemInputPinC->lpVtbl->Receive;
pMemInputPinC->lpVtbl->Receive = ReceiveMine;
res = VirtualProtect(pMemInputPinC->lpVtbl, sizeof(IMemInputPinCVtbl /*IMemInputPinC*/), flSetProtect /*PAGE_EXECUTE*/, &flOldProtect); // !!MS

return true;
}

Discussion

  • clsid
    clsid
    2010-02-14

    Thanks!
    Committed at revision 107.

     
  • clsid
    clsid
    2010-02-14

    • status: open --> closed