bool HookNewSegmentAndReceive(IPinC* pPinC, IMemInputPinC* pMemInputPinC) { if (!pPinC || !pMemInputPinC) { return false; } g_tSegmentStart = 0; g_tSampleStart = 0; BOOL res; DWORD flOldProtect = 0; UnhookNewSegmentAndReceive(); // Casimir666 : change sizeof(IPinC) to sizeof(IPinCVtbl) to fix crash with EVR hack on Vista! res = VirtualProtect(pPinC->lpVtbl, sizeof(IPinCVtbl), PAGE_WRITECOPY, &flOldProtect); if (NewSegmentOrg == nullptr) { NewSegmentOrg = pPinC->lpVtbl->NewSegment; } pPinC->lpVtbl->NewSegment = NewSegmentMine; // Function sets global variable(s) res = VirtualProtect(pPinC->lpVtbl, sizeof(IPinCVtbl), flOldProtect, &flOldProtect); // Casimir666 : change sizeof(IMemInputPinC) to sizeof(IMemInputPinCVtbl) to fix crash with EVR hack on Vista! res = VirtualProtect(pMemInputPinC->lpVtbl, sizeof(IMemInputPinCVtbl), PAGE_WRITECOPY, &flOldProtect); if (ReceiveOrg == nullptr) { ReceiveOrg = pMemInputPinC->lpVtbl->Receive; } pMemInputPinC->lpVtbl->Receive = ReceiveMine; // Function sets global variable(s) res = VirtualProtect(pMemInputPinC->lpVtbl, sizeof(IMemInputPinCVtbl), flOldProtect, &flOldProtect); g_pPinCVtbl = pPinC->lpVtbl; g_pMemInputPinCVtbl = pMemInputPinC->lpVtbl; return true; }
bool HookNewSegmentAndReceive(IPinC* pPinC, IMemInputPinC* pMemInputPinC) { if(!pPinC || !pMemInputPinC || (GetVersion()&0x80000000)) return false; g_tSegmentStart = 0; g_tSampleStart = 0; BOOL res; DWORD flOldProtect = 0; UnhookNewSegmentAndReceive(); // Casimir666 : change sizeof(IPinC) to sizeof(IPinCVtbl) to fix crash with EVR hack on Vista! res = VirtualProtect(pPinC->lpVtbl, sizeof(IPinCVtbl), PAGE_WRITECOPY, &flOldProtect); if(NewSegmentOrg == NULL) NewSegmentOrg = pPinC->lpVtbl->NewSegment; pPinC->lpVtbl->NewSegment = NewSegmentMine; res = VirtualProtect(pPinC->lpVtbl, sizeof(IPinCVtbl), flOldProtect, &flOldProtect); // Casimir666 : change sizeof(IMemInputPinC) to sizeof(IMemInputPinCVtbl) to fix crash with EVR hack on Vista! res = VirtualProtect(pMemInputPinC->lpVtbl, sizeof(IMemInputPinCVtbl), PAGE_WRITECOPY, &flOldProtect); if(ReceiveOrg == NULL) ReceiveOrg = pMemInputPinC->lpVtbl->Receive; pMemInputPinC->lpVtbl->Receive = ReceiveMine; res = VirtualProtect(pMemInputPinC->lpVtbl, sizeof(IMemInputPinCVtbl), flOldProtect, &flOldProtect); g_pPinCVtbl = pPinC->lpVtbl; g_pMemInputPinCVtbl = pMemInputPinC->lpVtbl; return true; }