File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -86,11 +86,11 @@ namespace
8686 DWORD dwFunc = FUNC_CPtrListSingleLink_Remove;
8787 __asm
8888 {
89- pushfd
89+ pushfd // Preserve flags (including Direction Flag)
9090 mov ecx, ppStreamEntryList
9191 push pCheckEntity
9292 call dwFunc
93- popfd
93+ popfd // Restore flags
9494 }
9595 }
9696
@@ -113,11 +113,11 @@ namespace
113113 DWORD dwFunc = FUNC_CPtrListDoubleLink_Remove;
114114 __asm
115115 {
116- pushfd
116+ pushfd // Preserve flags (including Direction Flag)
117117 mov ecx, ppStreamEntryList
118118 push pCheckEntity
119119 call dwFunc
120- popfd
120+ popfd // Restore flags
121121 }
122122 }
123123
@@ -589,23 +589,31 @@ static void __declspec(naked) HOOK_CEntityRemove()
589589
590590 __asm
591591 {
592+ // Save original ESI (callee-saved)
592593 push esi
593- mov esi, ecx
594- mov ecx, esi
594+
595+ // Get entity pointer from ECX (it's __thiscall!)
596+ mov esi, ecx // Entity is in ECX, not on stack!
597+
598+ // Inner function expects entity in ECX (not on stack!)
599+ mov ecx, esi // Ensure ECX has entity
595600 call inner
596601
602+ // Call post-removal handler
597603 pushad
598604 pushfd
599- push esi
605+ push esi // Push cached entity
600606 call OnCEntityRemovePost
601607 add esp, 4 *1
602608 popfd
603609 popad
604610
611+ // Restore original ESI
605612 pop esi
606- ret
613+ ret
607614
608615inner:
616+ // Original code (expects entity in ECX)
609617 sub esp, 30h
610618 push ebx
611619 push ebp
You can’t perform that action at this time.
0 commit comments