mov [eax + SEH3_REGISTRATION_FRAME_Esi], esi
mov [eax + SEH3_REGISTRATION_FRAME_Edi], edi
+ /* Safe the return address */
+ mov ebx, [esp]
+ mov [eax + SEH3_REGISTRATION_FRAME_ReturnAddress], ebx
+
.global __SEH3$_RegisterFrameWithStackLayout
__SEH3$_RegisterFrameWithStackLayout:
mov [eax + SEH3_REGISTRATION_FRAME_Esi], esi
mov [eax + SEH3_REGISTRATION_FRAME_Edi], edi
+ /* Safe the return address */
+ mov ebx, [esp]
+ mov [eax + SEH3_REGISTRATION_FRAME_ReturnAddress], ebx
+
.global __SEH3$_RegisterTryLevelWithStackLayout
__SEH3$_RegisterTryLevelWithStackLayout:
mov edi, [eax + SEH3_REGISTRATION_FRAME_Edi]
mov ebp, [eax + SEH3_REGISTRATION_FRAME_Ebp]
- jmp __SEH3$_InvokeEmbeddedFilter2
+ /* Calculate the size of the temp stack frame region */
+ mov ecx, [eax + SEH3_REGISTRATION_FRAME_AllocaFrame]
+ sub ecx, [eax + SEH3_REGISTRATION_FRAME_Esp]
- /* Get the saved stack pointer */
- mov edx, [eax + SEH3_REGISTRATION_FRAME_Esp]
+ /* Put the return address on the stack */
+ push offset __SEH3$_InvokeEmbeddedFilterReturn
- xor eax, eax
- inc eax
- call [edx]
+ /* Save the current stack pointer in the AllocaFrame member */
+ mov [eax + SEH3_REGISTRATION_FRAME_AllocaFrame], esp
- /* Restore the current non-volatiles */
- pop edi
- pop esi
- pop ebx
- pop ebp
+ /* Allocate enough temp stack space on the stack */
+ sub esp, ecx
- ret
+ /* Get the return address that was saved when registering the frame */
+ mov edx, [eax + SEH3_REGISTRATION_FRAME_ReturnAddress]
+
+ /* Jump into the filter or finally function */
+ xor eax, eax
+ inc eax
+ jmp edx
.global __SEH3$_InvokeEmbeddedFilter
/* Load ebp from the registration invocation */
mov ebp, [eax + SEH3_REGISTRATION_FRAME_Ebp]
-__SEH3$_InvokeEmbeddedFilter2:
+
/* Calculate the size of the temp stack frame region */
mov ecx, [eax + SEH3_REGISTRATION_FRAME_AllocaFrame]
sub ecx, [eax + SEH3_REGISTRATION_FRAME_Esp]