int wmain( __in int argc,
__in_ecount(argc) WCHAR* argv[] )
{
...
WCHAR wszCommand[MAX_PATH] = {0};
// construct commandline parameters
StringCchCopyW( wszCommand, ARRAY_SIZE(wszCommand), argv[1] );
for( int i = 2; i < argc; i++ ) // any optional parameters?
{
StringCchPrintfW( wszCommand, MAX_PATH, L" %s", argv[i] );
}
BOOL bDebug = CreateProcess( argv[1],
wszCommand, // it's the program you wanna debug, not your debugger. Pass it as argv[1] with more parameters, if it's necessary
0,
0,
TRUE,
DEBUG_PROCESS,
0,
0,
&startinfo,
&pi );