From bcc73fd1164578f529acb013e997b77dd2a19735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=CC=B7N=CC=B7?= <6h8fn1zo@duck.com> Date: Sun, 16 Apr 2023 17:41:19 +0700 Subject: [PATCH] Change Win32 ExitProcess to exit C lib Calling C runtime function must also terminated by C runtime itself (exit). Calling printf and then call ExitProcess without CRT function leads to hang because that does not let the C runtime terminate as gracefully. First argument also passed in `RCX`, `RAX` is used as return value. Did you mean `add rsp, 40; xor eax, eax; ret` ? --- docs/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/index.html b/docs/index.html index 037dda4..7baf405 100644 --- a/docs/index.html +++ b/docs/index.html @@ -178,7 +178,7 @@ segment .text global main -extern ExitProcess +extern exit extern printf @@ -190,8 +190,8 @@ lea rcx, [msg] call printf - xor rax, rax - call ExitProcess + xor ecx, ecx + call exit ~~~~~~~~~~~~~~~~~~~~~~~~~~~ You might be asking, "what on earth am I typing here?" at this point. We'll go