Log in

View Full Version : Command Line Argument problem


the_lover
January 2nd, 2001, 08:43
I am reversing a silly program,in order to get some valuable experience from that. While disassembling (using IDA) I fell through the command line args identification routine.

In this proc I encountered some misleading istructions:

WhileBody: ; CODE XREF: _WinMain@16+89j
mov edx, [ebp+ArgumentStringPointer]
movsx eax, byte ptr [edx]
test eax, eax
jz short locazione3
mov ecx, [ebp+ArgumentStringPointer]
movsx edx, byte ptr [ecx]
cmp edx, '"'
jz short locazione3
mov eax, [ebp+ArgumentStringPointer]
add eax, 1
mov [ebp+ArgumentStringPointer], eax
jmp short WhileBody

What is the meaning of the sequence
mov edx, [ebp+ArgumentStringPointer]
movsx eax, byte ptr [edx]
test eax, eax
jz short locazione3

I thought it was a check of the string's end,but this seems not to be the right interpretation. Does anybody have any idea?

MagTians
January 2nd, 2001, 08:54
Quote:
What is the meaning of the sequence
mov edx, [ebp+ArgumentStringPointer]
movsx eax, byte ptr [edx]
test eax, eax
jz short locazione3


Looks like
if(ArgumentStringPointer[0] != '\0') ...
to test if the length of ArgumentStringPointer is not zero. I think that your interpretation is right.