home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / src / system / source / a_thunk.asm < prev    next >
Encoding:
Assembly Source File  |  2009-09-14  |  2.0 KB  |  64 lines

  1.         segment    .text
  2.         
  3.         align        16
  4.         global        _VDMethodToFunctionThunk32        
  5. _VDMethodToFunctionThunk32:
  6.         pop            eax                    ;get return address in thunk
  7.         
  8.         ;re-copy arguments
  9.         movzx        ecx, byte [eax+1]
  10.         mov            edx, ecx
  11. argsloop:
  12.         push        dword [esp+edx]
  13.         sub            ecx, 4
  14.         jnz            argsloop
  15.  
  16.         push        eax                    ;replace thunk return address
  17.         
  18.         mov            ecx, [eax+7]        ;load 'this' pointer
  19.         jmp            dword [eax+3]    ;tail-call function
  20.  
  21.         align        16
  22.         global        _VDMethodToFunctionThunk32_4
  23. _VDMethodToFunctionThunk32_4:
  24.         pop            eax                    ;get return address in thunk
  25.         push        dword [esp+4]        ;replicate 1st argument
  26.         push        eax                    ;replace thunk return address
  27.         mov            ecx, [eax+7]        ;load 'this' pointer
  28.         jmp            dword [eax+3]        ;tail-call function
  29.  
  30.         align        16
  31.         global        _VDMethodToFunctionThunk32_8
  32. _VDMethodToFunctionThunk32_8:
  33.         pop            eax                    ;get return address in thunk
  34.         push        dword [esp+8]        ;replicate 2nd argument
  35.         push        dword [esp+8]        ;replicate 1st argument
  36.         push        eax                    ;replace thunk return address
  37.         mov            ecx, [eax+7]        ;load 'this' pointer
  38.         jmp            dword [eax+3]        ;tail-call function
  39.  
  40.         align        16
  41.         global        _VDMethodToFunctionThunk32_12
  42. _VDMethodToFunctionThunk32_12:
  43.         pop            eax                    ;get return address in thunk
  44.         push        dword [esp+12]        ;replicate 3rd argument
  45.         push        dword [esp+12]        ;replicate 2nd argument
  46.         push        dword [esp+12]        ;replicate 1st argument
  47.         push        eax                    ;replace thunk return address
  48.         mov            ecx, [eax+7]        ;load 'this' pointer
  49.         jmp            dword [eax+3]        ;tail-call function
  50.  
  51.         align        16
  52.         global        _VDMethodToFunctionThunk32_16
  53. _VDMethodToFunctionThunk32_16:
  54.         pop            eax                    ;get return address in thunk
  55.         push        dword [esp+16]        ;replicate 4th argument
  56.         push        dword [esp+16]        ;replicate 3rd argument
  57.         push        dword [esp+16]        ;replicate 2nd argument
  58.         push        dword [esp+16]        ;replicate 1st argument
  59.         push        eax                    ;replace thunk return address
  60.         mov            ecx, [eax+7]        ;load 'this' pointer
  61.         jmp            dword [eax+3]        ;tail-call function
  62.  
  63.         end
  64.