WinMain lpCmdLine

int APIENTRY WinMain(HINSTANCE hInst,
HINSTANCE,
LPSTR lpCmdLine,
int)
{
//命令行参数
TCHAR pCommandLine[256] = {0};
lstrcpy(pCommandLine,lpCmdLine);

TCHAR pProtectEventName[256]={0};
lstrcpy(pProtectEventName,FR_PROTECT_EVENT_NAME);
lstrcat(pProtectEventName,lpCmdLine);

//启动保护进程
InitModulePath(hInst);

HANDLE hEvent = OpenEvent(EVENT_ALL_ACCESS,FALSE,pProtectEventName);
if(!hEvent)
{
STARTUPINFO StartInfo = {sizeof(STARTUPINFO)};
PROCESS_INFORMATION ProcessInfo = {0};
TCHAR cBuffer[256];
lstrcpy(cBuffer,m_strAppPath);
lstrcat(cBuffer,FRPOFILENAME); //启动保护进程
memset(pCommandLine,0,256);
lstrcpy(pCommandLine," ");
lstrcat(pCommandLine,lpCmdLine);

BOOL bSuccessful = CreateProcess(cBuffer,pCommandLine,NULL,NULL,
FALSE,0,NULL,NULL,&StartInfo,&ProcessInfo);

if(bSuccessful)
{
CloseHandle(ProcessInfo.hProcess);
CloseHandle(ProcessInfo.hThread);
}
}
else
CloseHandle(hEvent);

return 0;
}

转载于:https://www.cnblogs.com/hshy/p/10867583.html

你可能感兴趣的:(WinMain lpCmdLine)