For Programmers: Free Programming Magazines  


Home > Archive > VC Language > January 2006 > How to get the command line arguments of other running process









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to get the command line arguments of other running process
Manu

2006-01-30, 4:00 am

Hi All,

Any one can help me out, using c++ how to get the command line arguments of
all the process which is running in the system.

Thanks
Manu


James Brown

2006-01-30, 4:00 am


"Manu" <dinil_kv@hotmail.com> wrote in message
news:%23hWd8jWJGHA.2012@TK2MSFTNGP14.phx.gbl...
> Hi All,
>
> Any one can help me out, using c++ how to get the command line arguments
> of
> all the process which is running in the system.
>
> Thanks
> Manu
>
>


one way:

1. OpenProcess to get a process-handle
2. CreateRemoteThread to run the GetCommandLineA/W API in the remote
process.
3. GetExitCodeThread to get the return-value from GetCommandLine
4. ReadProcessMemory on this memory-address to get the command-line
5. CloseHandle(s) appropriately

You'll need to EnumProcesses if you want more than one process.

James

--
Microsoft MVP - Windows SDK
www.catch22.net
Free Win32 Source and Tutorials


Manu

2006-01-30, 8:02 am

Thanks James



"James Brown" <not@home> wrote in message
news:quedncQwkswjTEDeRVnyjA@pipex.net...
>
> "Manu" <dinil_kv@hotmail.com> wrote in message
> news:%23hWd8jWJGHA.2012@TK2MSFTNGP14.phx.gbl...
>
> one way:
>
> 1. OpenProcess to get a process-handle
> 2. CreateRemoteThread to run the GetCommandLineA/W API in the remote
> process.
> 3. GetExitCodeThread to get the return-value from GetCommandLine
> 4. ReadProcessMemory on this memory-address to get the command-line
> 5. CloseHandle(s) appropriately
>
> You'll need to EnumProcesses if you want more than one process.
>
> James
>
> --
> Microsoft MVP - Windows SDK
> www.catch22.net





> Free Win32 Source and Tutorials
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com