How to retrieve parameters which were passed to one process in Command Line from another independent process

Posted on 2003-02-27
Medium Priority
Last Modified: 2010-04-01
I need to know how to retrieve parameters which were passed to one process in Command Line from another independent process. I have a handle and a pid of the process ,which parameters I want to get.

I need to do in it WinXp under win32 (no MFC).

Please give me a tip . :(

Thank you.
Question by:EliL
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 86

Expert Comment

ID: 8034594
Well, there's an undocumented method for NT/2k/XP...

Author Comment

ID: 8034633
What method?
Can you be more specific.
LVL 86

Expert Comment

ID: 8034659
I am sorry to say so, but this is quite an advanced topic for 50pts...
LVL 12

Accepted Solution

Salte earned 150 total points
ID: 8034795
Do I understand you right?

You want to get the command line arguments that was given to a different process than your own? If the process is your own the args are available in argc, argv and are easy to get.

For a different process' args there is a way but it is quite tricky and as jkr says, it is worth a lot more than 50 points.

However, I can give you a hint for 50 points: Check out the process API in PS.DLL - at least I think that's what the DLL is called. It has a couple of functions that you might find useful. You can list all available processes get their pid, their status, you can even get a handle to their memory and if you know how to do it you can read their memory.... Now, I won't go into details, it's not worth it for 50 points but yes, there are functions. Not so sure they are undocumented, I believe they are documented somewhere - perhaps not in the official documentation but in some white papers from Microsoft they are documented. It's the API that the task manager uses to display all processes etc.

Now, that is enough hints for 50 points.


Author Comment

ID: 8050961
Thank you for your help.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question