I've been designing this function for a while so that I could get my arguments without using GetCl... It's working finely, except when it comes to quotation marks... There's no problem when you search for the first argument, but if you do it with 2 or more, you get something like this:

socket2 "www.some space path.com" "aaa"

Once you ask for the second parameter you the word space...

My function:

GetArg proc ArgNum:DWORD
    invoke GetCommandLine
@@:
    inc eax
    cmp byte ptr , 0
    jz error
    cmp byte ptr , " "
    jnz @B
    dec ArgNum
    jnz @B

    inc eax
    mov edx, eax
    cmp byte ptr , 34 ; 34 = "
    jz qmark
@@:
    inc edx
    cmp byte ptr , " "
    jnz @B
    mov byte ptr , 0
    ret
qmark:
    inc edx
    cmp byte ptr , 0
    jz error
    cmp byte ptr , 34
    jnz qmark
    mov byte ptr , 0
    inc eax
    ret
error:
    xor eax, eax
    ret
GetArg endp
Posted on 2005-11-07 17:31:01 by Lenin