|
-
February 21st, 2009, 05:47 PM
#1
Getting process arguments
Hi all,
I am writing a program in c# and i want to get arguments of an unmanaged .exe file. I am using System.Diagnostics.Process class to start process and i think Process class only allow us to set the arguments of the processes by using Process.StartInfo.Arguments.
Is it possible to get the arguments of the processes in c#?
Thanks in advance.
-
February 21st, 2009, 07:26 PM
#2
Re: Getting process arguments
 Originally Posted by izzetbaysal
Hi all,
I am writing a program in c# and i want to get arguments of an unmanaged .exe file. I am using System.Diagnostics.Process class to start process and i think Process class only allow us to set the arguments of the processes by using Process.StartInfo.Arguments.
Is it possible to get the arguments of the processes in c#?
Thanks in advance.
I don't understand what you mean. You say that you are starting the process, so how could you not know the arguments? You are creating the StartInfo object with a string, so you know the contents of that string already.
-
February 22nd, 2009, 02:04 AM
#3
Re: Getting process arguments
you should look at memory to see with what arguments the process have been started.
it is not possible to do it with C#.
look at these sysntaxes in C# and C++ to see in what variables arguments resides.
blue names are compiler generated and user can change those names.
Code:
// C#
static void Main( string[] args )
// C++
int main(int argc, char** argv)
// or C++
int main(int argc, char *argv[])
Please rate my post if it was helpful for you.  Java, C#, C++, PHP, ASP.NET
SQL Server, MySQL
DirectX
MATH Touraj Ebrahimi
[toraj_e] [at] [yahoo] [dot] [com]
-
February 22nd, 2009, 05:36 AM
#4
Re: Getting process arguments
Thanks for the reply but what i am trying to do is getting the argument types of the process and generating inputs automatically. After that i will send those inputs to the .exe file and get the outputs. So exe file can be any file that i don't know which arguments it take as inputs.
Thanks in advance
-
February 22nd, 2009, 07:25 AM
#5
Re: Getting process arguments
 Originally Posted by izzetbaysal
So exe file can be any file that i don't know which arguments it take as inputs.
you should know what exactly are the arguments than can be accepted by the exe file otherwise the program may have unpredictable behaviour or even not working.
Please rate my post if it was helpful for you.  Java, C#, C++, PHP, ASP.NET
SQL Server, MySQL
DirectX
MATH Touraj Ebrahimi
[toraj_e] [at] [yahoo] [dot] [com]
-
February 23rd, 2009, 06:14 PM
#6
Re: Getting process arguments
If you started the process (from your process), then you know what the process arguments are.
If you didn't start the process, then you are out of luck.
This is because Windows passes the start up arguments to the application upon startup, but it doesn't save the information. It's up to the application to save that information if necessary.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|