[C++] Creating a Process

I got allot of questions about CreateProcess so heres a simple wrapper for it:

BOOL CreateProcessWrapper( LPTSTR process_name, DWORD CreationFlag )
{
STARTUPINFO si;
PROCESS_INFORMATION pi;

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

int retval = CreateProcess( process_name,
NULL,NULL,NULL,FALSE, CreationFlag , NULL,NULL,&si,&pi);

CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
return retval;
}

For a list of Creation Flags look here.

Advertisements

~ by Rhys Mossom on April 20, 2007.

2 Responses to “[C++] Creating a Process”

  1. why do you need all those nulls O_O

  2. Theyre the params of CreateProcess. This whole function is only like 3 lines long, but for some reason wordpress has fucked it up like this… 😡

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: