ASM Function Call & Ret - ret 0xC 有什么作用?
ASM Function Call & Ret - What does ret 0xC do?
ret 是做什么的?为什么这里需要ret 0xC?如果它只是 ret 而不是 ret 0xC 或 0x4 呢?
mov eax,[esp+10] // param3
mov ecx,[esp+0C] // param2
mov edx,[esp+08] // param1
push eax
push ecx
push edx
mov ecx,esi
call File.exe+333330
pop esi
ret 000C
简而言之,ret 00C
在call File.exe+333330
之后清理堆栈。在调用之前,您将三个 4 字节的值压入堆栈(eax
、ecx
和 edx
的内容)。 4 * 3 = 12 = 0xC(十六进制)。如果 ret
没有值,它会从您的子例程返回,但根本不会清理堆栈。如果您有 ret 4
,它只会清除其中一个值。 ret 12
或 ret 0xC
负责所有三个。
有关类似问题,请参阅 here。
ret 是做什么的?为什么这里需要ret 0xC?如果它只是 ret 而不是 ret 0xC 或 0x4 呢?
mov eax,[esp+10] // param3
mov ecx,[esp+0C] // param2
mov edx,[esp+08] // param1
push eax
push ecx
push edx
mov ecx,esi
call File.exe+333330
pop esi
ret 000C
简而言之,ret 00C
在call File.exe+333330
之后清理堆栈。在调用之前,您将三个 4 字节的值压入堆栈(eax
、ecx
和 edx
的内容)。 4 * 3 = 12 = 0xC(十六进制)。如果 ret
没有值,它会从您的子例程返回,但根本不会清理堆栈。如果您有 ret 4
,它只会清除其中一个值。 ret 12
或 ret 0xC
负责所有三个。
有关类似问题,请参阅 here。