I just opened a file in IDA Pro and I found some code that looks completely useless. However, I thought it might have some use. Doesn't the sub eax,0
just subtract 0 from eax?
The code:
hinstDLL= dword ptr 4
fdwReason= dword ptr 8
lpReserved= dword ptr 0Ch
mov eax, [esp+fdwReason]
sub eax, 0
jz short loc_10001038
The sub
instruction sets flags (OF
, SF
, ZF
, AF
, PF
, and CF
, according to the documentation) - the mov
instruction does not. The jz
will jump only if the zero flag (ZF
) is set, so if you want to jump based on the value in eax
that flag has to be set appropriately.
The sub
instruction will set the zero flag if its result is zero. In this case this means that the zero flag will be set if eax is zero.
So these three instructions check if [esp+fdwReason]
is zero and jump to loc_10001038
in that case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With