⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exestartmoduleloader.cpp

📁 VC++编程
💻 CPP
字号:
//********************************
// Code for running the EXE Module
//********************************

#include "stdafx.h"

#ifdef _STARTMODULE_IS_EXE
#include "LoaderPriv.h"

int CLoader::Run()
{
	{
		PROCESS_INFORMATION pi;
		STARTUPINFO si= {0};
		si.cb						= sizeof(STARTUPINFO);
		/*si.dwFlags			= STARTF_USESHOWWINDOW;
		si.wShowWindow	= SW_HIDE;*/

		size_t lenStartModule= _tcsclen(m_pStartModuleName);
		size_t lenModule= _tcsclen(m_pModuleName);

		LPTSTR pCmdLine= new TCHAR[lenStartModule+lenModule+5+1];
		*pCmdLine= _T('"');
		_tcscpy(&pCmdLine[1], m_pStartModuleName);
		_tcscpy(&pCmdLine[lenStartModule+1], _T("\" \""));
		_tcscpy(&pCmdLine[lenStartModule+4], m_pModuleName);
		_tcscpy(&pCmdLine[lenStartModule+4+lenModule], _T("\""));

		if (!CreateProcess(NULL, pCmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
		{
			delete [] pCmdLine;
			return SFX_CANNOTRUNSTARTMODULE;
		}
		delete [] pCmdLine;
		CloseHandle(pi.hThread); //close this, we do not need it.
		m_hStartModule= pi.hProcess;
	}

	WaitForSingleObject(m_hStartModule, INFINITE); //waits for module end

	DWORD dwExitCode;
	GetExitCodeProcess(m_hStartModule, &dwExitCode);

	return dwExitCode;
}

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -