的撒旦撒旦撒

BOOLCompress( string & strPath,string & strFile )
{

//开始压缩
CString strPathCommand = GetModulePath();
CString strModulePath = strPathCommand;
CString StrCommand = "winRAR a -ibck -ep1 ";
StrCommand.Append("-v5m ");
CString strFileName = funGetSysTime().c_str();


//拼接压缩命令
strPathCommand.Append("\\LogCollect\\");
strPathCommand.Append(strFileName);
strPathCommand.Append("_log.rar");
//strBackName = strPathCommand;
strFileName.Append("_log.rar");
strFile = strFileName;
strPathCommand.Append(" ");
strPathCommand.Append(strModulePath);
strPathCommand.Append("\\LogCollect");
StrCommand.Append(strPathCommand);
DWORD dwRet = 0;


STARTUPINFO StartupInfo = {sizeof(STARTUPINFO)};
StartupInfo.wShowWindow = 0;
StartupInfo.dwFlags = STARTF_USESHOWWINDOW;


PROCESS_INFORMATION ProcessInformation = {};
CString strCurrentDir;
(void)GetCurrentDirectory( MAX_PATH, strCurrentDir.GetBuffer(MAX_PATH));
strCurrentDir.ReleaseBuffer();


//开始压缩
if (CreateProcess(NULL, StrCommand.GetBuffer(), NULL, NULL, false, CREATE_NO_WINDOW, NULL, 
strCurrentDir,
&StartupInfo,
&ProcessInformation))
{
(void)CloseHandle(ProcessInformation.hThread);
(void)WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
(void)GetExitCodeProcess(ProcessInformation.hProcess, &dwRet);
(void)CloseHandle(ProcessInformation.hProcess);
(void)SecureZeroMemory(&ProcessInformation, sizeof(ProcessInformation));
}
}
 
}

你可能感兴趣的:(String,null,Path)