Results 1 to 7 of 7

Thread: Getting the command tail

  1. #1
    Guest

    Post

    How do i get the command tail and parse it into an array, kinda like C++?

  2. #2
    Guest
    How about a proc to return the command tail?

  3. #3
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    what's the command tail?
    If it wasn't for this sentence I wouldn't have a signature at all.

  4. #4
    Guest
    C:\FOO\MAN\CHOO\MYPROG test.txt

  5. #5
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    ahh, you get a pointer to that in WinMain, say you use a standard C style procedure for WinMain (or whatever the starting procedure is) something like this

    Code:
    proc WinMain
    
    push ebp
    mov ebp, esp           ;store the stack pointer in ebp
                           ;so we can get at the parameters
    
    
    ;any code you need for your program
    
    
    mov esp, ebp
    pop ebp
    ret 10;
    
    endp WinMain
    ebp is then a pointer to the bottom of the stack just after you pushed ebp

    so ebp points to what is essentially a structure
    Code:
    struct 
    {
        unsigned long   Old_EBP;
        void*           Return_Address;
        HINSTANCE       hInstance;       
        HINSTANCE       hPrevInstance;
        LPSTR           lpCmdLine;
        int             nCmdShow;
    } Wot_EBP_Points_To;
    so [ebp + 10h] is a pointer to a null terminated char array which contains the command tail, the string will stay in memory until the end of the winmain procedure, which should be the end of your program.

    hope it helps
    If it wasn't for this sentence I wouldn't have a signature at all.

  6. #6
    Guest
    Im doing it in dos, if i was using windows i would call "GetCommandLine".

  7. #7
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    oh, err, I don't know then
    If it wasn't for this sentence I wouldn't have a signature at all.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width