How do i get the command tail and parse it into an array, kinda like C++?
Printable View
How do i get the command tail and parse it into an array, kinda like C++?
How about a proc to return the command tail?
what's the command tail?
C:\FOO\MAN\CHOO\MYPROG test.txt
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
ebp is then a pointer to the bottom of the stack just after you pushed ebpCode: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
so ebp points to what is essentially a structure
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.Code:struct
{
unsigned long Old_EBP;
void* Return_Address;
HINSTANCE hInstance;
HINSTANCE hPrevInstance;
LPSTR lpCmdLine;
int nCmdShow;
} Wot_EBP_Points_To;
hope it helps
Im doing it in dos, if i was using windows i would call "GetCommandLine".
oh, err, I don't know then