By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,956 Members | 1,457 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,956 IT Pros & Developers. It's quick & easy.

CreateProcess question

P: n/a
kal
Hi,

I am trying to write an application that will launch a second application
using CreateProcess...

SECURITY_ATTRIBUTES sa;
STARTUPINFO si;
PROCESS_INFORMATION pi;

::ZeroMemory( &sa, sizeof(sa) );
sa.nLength = sizeof(sa);
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = TRUE;

::ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);

::ZeroMemory( &pi, sizeof(pi) );

// Start the child process.
if ( !CreateProcess(
NULL,
"C:\\second_app.exe",
&sa,
&sa,
TRUE,
0,
NULL,
"C:\\",
&si,
&pi )
)
{
return;
}

What I want to do is monitor the second process for file read/write, in
other words if the second application interacts with the file system at all,
I want to know how and where, and place that information into a log file. I
know CreateProcess gives me...

pi.dwProcessId
pi.dwThreadId
pi.hProcess
pi.hThread

How can I do this? Any suggestions, ideas are greatly appreciated.

Thanks,
Kal
Nov 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
In article <kx*********************@twister.nyc.rr.com>,
ka*@nyc.rr.com says...

[ ... ]
What I want to do is monitor the second process for file read/write, in
other words if the second application interacts with the file system at all,
I want to know how and where, and place that information into a log file. I
know CreateProcess gives me...


Write the parent as basically a debugger. Set Breakpoints in the
child on the functions you care about, and when they're called, your
parent will receive control.

Of course, writing a debugger is a somewhat non-trivial task, but it
looks to me like about the most reasonable way to accomplish what
you're asking for.

--
Later,
Jerry.

The universe is a figment of its own imagination.
Nov 17 '05 #2

P: n/a
you'll need a specific privilege to begin with,
and you'll need to also programmatically obtain too,
it's the debug privilege (I am assuming you are using NT based OSes and
2000, XP).
you'll need to get a token to the process and so on...
these are just hints, I got the code but it's too long to attach

"kal" <ka*@nyc.rr.com> wrote in message
news:kx*********************@twister.nyc.rr.com...
Hi,

I am trying to write an application that will launch a second application
using CreateProcess...

SECURITY_ATTRIBUTES sa;
STARTUPINFO si;
PROCESS_INFORMATION pi;

::ZeroMemory( &sa, sizeof(sa) );
sa.nLength = sizeof(sa);
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = TRUE;

::ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);

::ZeroMemory( &pi, sizeof(pi) );

// Start the child process.
if ( !CreateProcess(
NULL,
"C:\\second_app.exe",
&sa,
&sa,
TRUE,
0,
NULL,
"C:\\",
&si,
&pi )
)
{
return;
}

What I want to do is monitor the second process for file read/write, in
other words if the second application interacts with the file system at all, I want to know how and where, and place that information into a log file. I know CreateProcess gives me...

pi.dwProcessId
pi.dwThreadId
pi.hProcess
pi.hThread

How can I do this? Any suggestions, ideas are greatly appreciated.

Thanks,
Kal

Nov 17 '05 #3

P: n/a
Hi Andrea,

That is not correct. You don't need the debug privilege to debug a process
you are starting up as a debuggee yourself.

Ronald Laeremans
Visual C++ team

"andrea catto'" <ac****@dataflight.com> wrote in message
news:uc**************@TK2MSFTNGP10.phx.gbl...
you'll need a specific privilege to begin with,
and you'll need to also programmatically obtain too,
it's the debug privilege (I am assuming you are using NT based OSes and
2000, XP).
you'll need to get a token to the process and so on...
these are just hints, I got the code but it's too long to attach

"kal" <ka*@nyc.rr.com> wrote in message
news:kx*********************@twister.nyc.rr.com...
Hi,

I am trying to write an application that will launch a second application
using CreateProcess...

SECURITY_ATTRIBUTES sa;
STARTUPINFO si;
PROCESS_INFORMATION pi;

::ZeroMemory( &sa, sizeof(sa) );
sa.nLength = sizeof(sa);
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = TRUE;

::ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);

::ZeroMemory( &pi, sizeof(pi) );

// Start the child process.
if ( !CreateProcess(
NULL,
"C:\\second_app.exe",
&sa,
&sa,
TRUE,
0,
NULL,
"C:\\",
&si,
&pi )
)
{
return;
}

What I want to do is monitor the second process for file read/write, in
other words if the second application interacts with the file system at

all,
I want to know how and where, and place that information into a log file.

I
know CreateProcess gives me...

pi.dwProcessId
pi.dwThreadId
pi.hProcess
pi.hThread

How can I do this? Any suggestions, ideas are greatly appreciated.

Thanks,
Kal


Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.