From a5622c7b9b4734ab1d24f47f41d742874c68b424 Mon Sep 17 00:00:00 2001 From: Iru Cai Date: Tue, 11 May 2021 20:09:47 +0800 Subject: move out part of fclose() --- asm/rich4_clib.asm | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'asm/rich4_clib.asm') diff --git a/asm/rich4_clib.asm b/asm/rich4_clib.asm index d1e3b86..cb550e5 100644 --- a/asm/rich4_clib.asm +++ b/asm/rich4_clib.asm @@ -1,7 +1,12 @@ global clib_fopen +global clib_fclose extern fcn_00457135 extern fcn_004590b9 extern fcn_00457254 +extern fcn_00457902 +extern ref_00488f60 +extern ref_00488f64 +extern ref_004991d4 section .text @@ -63,4 +68,33 @@ add esp, 0xc pop ebx ret +clib_fclose: +push ebx +mov ebx, dword [esp + 8] +call dword [ref_00488f60] ; ucall: call dword [0x488f60] +mov eax, dword [ref_004991d4] ; mov eax, dword [0x4991d4] + +loc_004578d5: +test eax, eax +jne short loc_004578e6 ; jne 0x4578e6 +call dword [ref_00488f64] ; ucall: call dword [0x488f64] +mov eax, 0xffffffff +pop ebx +ret + +loc_004578e6: +cmp ebx, dword [eax + 4] +je short loc_004578ef ; je 0x4578ef +mov eax, dword [eax] +jmp short loc_004578d5 ; jmp 0x4578d5 + +loc_004578ef: +call dword [ref_00488f64] ; ucall: call dword [0x488f64] +push 1 +push ebx +call fcn_00457902 ; call 0x457902 +add esp, 8 +pop ebx +ret + section .data -- cgit v1.2.3