rendered paste body
.686p
.mmx
.model flat
; Segment type: Pure code
seg000 segment byte public 'CODE' use32
assume cs:seg000
assume es:nothing, ss:nothing, ds:nothing, fs:nothing, gs:nothing
; eax = luaState
; edx = relocated image base
luahack_load proc near
000 53 push ebx
004 56 push esi
008 52 push edx
00C 57 push edi
010 E8 00 00 00 00 call dword luahack_push_eip ; push eip
luahack_push_eip: ; DATA XREF: luahack_load+4t
; luahack_load+Ao
014 59 pop ecx ; ecx = eip
010 83 E9 09 sub ecx, offset luahack_push_eip ; eax = code base
010 89 D3 mov ebx, edx ; base luaopen func on image
010 89 D6 mov esi, edx ; base sz on image
010 89 D7 mov edi, edx ; base lua func on image
010 81 C3 D5 C1 5C 00 add ebx, 005CC1D5h ; luaopen_base
010 81 C6 10 91 5C 00 add esi, 005C9110h ; sz "luaopen_base"
010 81 C7 FD C1 5C 00 add edi, 005CC1FDh ; lua_pushcclosure
010 92 xchg eax, edx ; Exchange Register/Memory with Register
010 83 C6 0C add esi, 12 ; sz ""
010 05 4A 00 00 00 add eax, offset luahack_postreg ; eax = luahack_postreg
010 50 push eax ; return pointer = eax
luahack_reg: ; CODE XREF: luahack_load+50p
; luahack_load+5Bp ...
014 53 push ebx ; ptr luaopen_*
018 52 push edx ; ptr luaStack
01C FF 17 call dword ptr [edi] ; lua_pushcclosure
01C 83 C4 08 add esp, 2 * 4 ; clear stack
014 56 push esi ; ptr sz
018 52 push edx ; ptr luaStack
01C FF 57 04 call dword ptr [edi+4] ; lua_pushstring
01C 83 C4 08 add esp, 2 * 4 ; clear stack
014 6A 00 push 00000000h ; zero
018 6A 01 push 00000001h ; one
01C 52 push edx ; ptr luaStack
020 FF 57 08 call dword ptr [edi+8] ; lua_call
020 83 C4 0C add esp, 3 * 4 ; clear stack
014 C3 retn ; Return Near from Procedure
luahack_postreg: ; DATA XREF: luahack_load+29o
010 83 C6 0B add esi, 11 ; sz "package"
010 83 C3 04 add ebx, 4 ; luaopen_package
010 E8 DA FF FF FF call luahack_reg ; Call Procedure
010 83 C6 12 add esi, 18 ; sz "table"
010 83 C3 04 add ebx, 4 ; luaopen_table
010 E8 CF FF FF FF call luahack_reg ; Call Procedure
010 83 C6 10 add esi, 16 ; sz "io"
010 83 C3 04 add ebx, 4 ; luaopen_io
010 E8 C4 FF FF FF call luahack_reg ; Call Procedure
010 83 C6 0D add esi, 13 ; sz "os"
010 83 C3 04 add ebx, 4 ; luaopen_os
010 E8 B9 FF FF FF call luahack_reg ; Call Procedure
010 83 C6 0D add esi, 13 ; sz "string"
010 83 C3 04 add ebx, 4 ; luaopen_string
010 E8 AE FF FF FF call luahack_reg ; Call Procedure
010 83 C6 11 add esi, 17 ; sz "math"
010 83 C3 04 add ebx, 4 ; luaopen_math
010 E8 A3 FF FF FF call luahack_reg ; Call Procedure
010 83 C6 0F add esi, 15 ; sz "debug"
010 83 C3 04 add ebx, 4 ; luaopen_debug
010 E8 98 FF FF FF call luahack_reg ; Call Procedure
010 83 C6 10 add esi, 16 ; sz "jit"
010 83 C3 04 add ebx, 4 ; luaopen_jit
010 E8 8D FF FF FF call luahack_reg ; Call Procedure
010 83 C6 0E add esi, 14 ; sz "coco"
010 83 C3 04 add ebx, 4 ; luaopen_coco
010 E8 82 FF FF FF call luahack_reg ; Call Procedure
010 92 xchg eax, edx ; eax = luaState
010 5F pop edi
00C 5A pop edx
008 5E pop esi
004 5B pop ebx
000 C3 retn ; Return Near from Procedure
luahack_load endp
seg000 ends
end