home *** CD-ROM | disk | FTP | other *** search
- Command Line Arguments
- by lord lucifer
- August 12, 1999
-
-
- Here is a sample function which shows how to get the command line
- arguments only from the GetCommandLine API function. The GetCommandLine
- API function by itself returns the full command line, meaning the
- executable file's name as well as the parameters. This function is a
- simple method to retreive the arguments only.
-
-
- ; GetCommandLineArgs
- ; function to get the command line parameters only.
- ; returns: pointer to the argunments string
- ; or NULL if there are none
-
- GetCommandLineArgs proc USES esi
- call GetCommandLine
- mov esi, eax
- mov al, [esi]
- cmp al, 22h ;22h = "
- jz loop1
- xor eax,eax
- jmp return
- ;if path is delimited by quotes, there are parameters.
- loop1:
- inc esi
- mov al, [esi]
- cmp al, 22h
- jnz loop1
- inc esi
- inc esi
- mov eax,esi
- return:
- ret
- GetCommandLineArgs endp