Home > Software engineering >  The main function of the argv [0] supposedly path should be a program, how to call to hide the progr
The main function of the argv [0] supposedly path should be a program, how to call to hide the progr

Time:10-23

I found a program calls another application, the incoming parameters argv [0], is not a program path, but it is a common parameters [-] I
How can we achieve such a call, other exe?

CodePudding user response:

Start from the command line you have compiled exe files, in the back with the incoming parameters, or the process of creating apis to use win32 provided start your program, the incoming parameters you need

CodePudding user response:

 
//argv. CPP: Defines the entry point for the console application.
//

# include "stdafx. H"
H # include "Windows."
#include
#include

Int main (int arg c, char * argv [])
{
Printf (" % s \ n ", argv [0]).
TCHAR exe [0 x200];
_tcscpy (exe, argv [0]);


STARTUPINFO si;
PROCESS_INFORMATION PI;

ZeroMemory (& amp; Si, sizeof (si));
Si. Cb=sizeof (si);
Si. DwFlags |=STARTF_USESHOWWINDOW;
Si. WShowWindow=SW_SHOWDEFAULT;
ZeroMemory (& amp; PI, sizeof (PI));


if( ! CreateProcess (exe,//No module name (use the command line).
_T (" \ r \ n - I -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "),//the Command line.
NULL,//Process handle not inheritable.
NULL,//the Thread handle not inheritable.
FALSE,//Set the handle inheritance to FALSE.
0,//No creation flags.
NULL,//Use the parent 's environment block.
NULL,//Use the parent 's starting directory.
& Si,//Pointer to STARTUPINFO structure.
& PI)//Pointer to PROCESS_INFORMATION structure.
)
{
Update//AfxMessageBox (_T (" failure "));
return 0;
}

return 0;
}




Tried to call themselves, called argv [0], preach anything,
  • Related