Valhalla Legends Forums Archive | General Programming | Catching a Command Line passed to an exe

AuthorMessageTime
Spilled[DW]
Ok so heres the question I have. I have an exe that is having a command line passed to it. What i need to do is find out exactly what it is being passed to it so I can "mimic" it and utilize this in one of my programs, How would i go about doing this?
August 22, 2008, 2:36 AM
BreW
Is this for an application launcher or something? To bypass a piss poor attempt at authentication? You could just make a program that well... dumps the command line parameters being passed to it then rename that to the target executable. Or am i not understanding you correctly?
August 22, 2008, 4:18 AM
K
[quote author=Spilled link=topic=17613.msg179447#msg179447 date=1219372617]
Ok so heres the question I have. I have an exe that is having a command line passed to it. What i need to do is find out exactly what it is being passed to it so I can "mimic" it and utilize this in one of my programs, How would i go about doing this?
[/quote]

Replace said program with a new executable.

[code]
#include <stdio.h>

int main (int argc, char* argv[])
{
    for(int i = 0; i < argc; ++i) {
        printf("argv[%d] = '%s'\n", i, argv[i]);
    }

    return 0;
}[/code]
August 22, 2008, 7:05 PM
thebigred
It sounds like you want a wrapper type deal for the exe?  Can you use exec and pass in arguments with that?

and doh i realized this was quite an old post....
May 15, 2009, 10:52 PM
Yegg
[quote author=thebigred link=topic=17613.msg182753#msg182753 date=1242427951]
It sounds like you want a wrapper type deal for the exe?  Can you use exec and pass in arguments with that?

and doh i realized this was quite an old post....
[/quote]

It seems that there is an executable that was not created by him. Another executable, also not created by him, is sending arguments to the first executable. He just needs to figure out what these arguments are.
May 16, 2009, 2:38 AM
Explicit[nK]
Way to bump an old topic, guys....
May 16, 2009, 5:22 AM
Yegg
[quote author=Explicit link=topic=17613.msg182759#msg182759 date=1242451321]
Way to bump an old topic, guys....
[/quote]

I figured since he already bumped it, it wouldn't be as bad :). Not to mention, the activity in the forums still isn't all that great, but I do see a few new members around now.
May 16, 2009, 6:28 AM
chyea
Yegg, use your fucking brain. Come on. Were you born yesterday?
May 16, 2009, 9:16 AM
BreW
[quote author=Yegg link=topic=17613.msg182760#msg182760 date=1242455330]
I figured since he already bumped it, it wouldn't be as bad :). Not to mention, the activity in the forums still isn't all that great, but I do see a few new members around now.
[/quote]
But it is just as bad. Remember how I said that stupid posts are better than no posts? I was dead wrong. It's better to burn out than fade away. Please stop posting ambiguous, no-brainer shit, and preserve the post quality, Yegg!
Not to mention the aforementioned question had been answered by the FIRST post (my own). The OP hasn't responded, meaning he had already solved the problem a long time ago and your posts here are just dead unnecessary.
May 16, 2009, 1:03 PM
Yegg
Brew:How do you know that you answered his question? You made it clear in your post that you were not clear about exactly what he was asking. I guess you're also not aware that people see this site in Google and can often have a problem solved by reading the posts on here. The topic isn't ancient and at least more valid infotmation was tossed in. Way to waste a post. 
May 16, 2009, 4:50 PM
dRAgoN
K answered it best, just replace the exicutable with your own and print out whats being passed to it.

edit: btw 2008?
May 16, 2009, 8:18 PM
Yegg
[quote author=bulletproof tiger link=topic=17613.msg182761#msg182761 date=1242465375]
Yegg, use your fucking brain. Come on. Were you born yesterday?
[/quote]

Use your fucking brain. If I was born yesterday, how would I have made posts on the forum prior to that day.
May 16, 2009, 8:55 PM
BreW
[quote author=Yegg link=topic=17613.msg182763#msg182763 date=1242492635]
Brew:How do you know that you answered his question? You made it clear in your post that you were not clear about exactly what he was asking.
[/quote]

In my first post, I was indeed speculative. Not as to what the possible solution may be (that was made quite clear by the topic), but instead the purpose behind this.

[quote author=Yegg link=topic=17613.msg182763#msg182763 date=1242492635]
I guess you're also not aware that people see this site in Google and can often have a problem solved by reading the posts on here. The topic isn't ancient and at least more valid infotmation was tossed in.
[/quote]
No, I'm perfectly aware of this. I do have confidence in googleers, however. They probably can infer from the first post all the obstensibly apparent information you "added" to the discussion.

[quote author=Yegg link=topic=17613.msg182763#msg182763 date=1242492635]
Way to waste a post.
[/quote]
touché!
May 17, 2009, 12:33 PM
Yegg
I already agree with Dragon that K's post is the best answer.
May 17, 2009, 4:16 PM
Grok
Bump!

Query the process?  You may be able to get the Command Line string directly or from the Process Information or environment block.  It seems the command line string is available to the process itself, in ungarbled form, so reading it should merely involve the proper API, or locating it in the target process memory.
June 16, 2009, 3:49 PM
dRAgoN
[quote author=Grok link=topic=17613.msg182971#msg182971 date=1245167395]
Bump!

Query the process?  You may be able to get the Command Line string directly or from the Process Information or environment block.  It seems the command line string is available to the process itself, in ungarbled form, so reading it should merely involve the proper API, or locating it in the target process memory.
[/quote]
pretty sure nlock etc. prevents pokeing process level api calls.
June 21, 2009, 12:45 AM

Search