예제 #1
0
ENUM_ExtractErrorCode ExtractOfficePackage( LPCTSTR szPkgFilename, LPCTSTR szDestPath, Files &files )
{
	Files mspfiles, cabfiles, dstfiles;
	
	if(!CreateDirectoryNested(szDestPath))
		return EE_PATH;
	
	if(!ExtractExe(szPkgFilename, szDestPath, mspfiles))
		return EE_EXE;
	
	for(int i=0; i<mspfiles.size(); ++i)
	{
		CString strPath = mspfiles[i];
		strPath += UPK_PATH_SUFFIX;
		if(!CreateDirectoryNested(strPath))
			return EE_PATH;
		if(!ExtractMSP(mspfiles[i], strPath, cabfiles))
			return EE_MSP;
	}

	for(int i=0; i<cabfiles.size(); ++i)
	{
		CString strPath = cabfiles[i];
		strPath += UPK_PATH_SUFFIX;
		if(!CreateDirectoryNested(strPath))
			return EE_PATH;
		if(!ExtractCab(cabfiles[i], strPath, files))
			return EE_CAB;
	}
	return EE_SUCCESS;
}
예제 #2
0
HRESULT CImplRepairVul::Repair(LPCTSTR sDownloadPath, LPCTSTR szImportPath, DWORD dwFlags)
{
	if(m_arrDownloadItem.GetSize()==0)
		return KERR_NONE;
	if( !sDownloadPath  || !CreateDirectoryNested(sDownloadPath) )
		return KERR_WRITE_FILE;
	
	HRESULT hr = S_OK;
	CSysEnv& sysEnv = singleton<CSysEnv>::Instance();
	sysEnv.Init();
	if( FAILED( hr=sysEnv.IsSupported(TRUE) ) )
		return hr;
	
	//if(CheckIfFirstRunLeakRepair())
	//	FixUpdateGarbage();

	m_strDownloadPath = sDownloadPath;
	m_strImportPath = szImportPath ? szImportPath : _T("");
	m_dwRepairFlags = dwFlags;
	m_bCanceled = FALSE;
	if(m_thinfo.m_hInstallEvent)
	{
		CloseHandle( m_thinfo.m_hInstallEvent );
		m_thinfo.m_hInstallEvent = NULL;
	}
	m_thinfo.m_hInstallEvent = CreateEvent(NULL,FALSE,FALSE,NULL);
	
	m_hHandleDownload = CreateThread(NULL, 0, _ThreadFuncDownload, (PVOID)this, 0, NULL);
	m_hHandleInstall = CreateThread(NULL, 0, _ThreadFuncInstall, (PVOID)this, 0, NULL);
	return S_OK;
}
예제 #3
0
BOOL CreateDirectoryNested( LPCTSTR  lpszDir )
{
	if( ::PathIsDirectory( lpszDir ) ) 
		return TRUE;

	if(_tcslen(lpszDir)>=MAX_PATH)
		return FALSE;
	
	TCHAR   szPreDir[ MAX_PATH ];
	_tcscpy_s( szPreDir, lpszDir );
	//确保路径末尾没有反斜杠
	ModifyPathSpec( szPreDir, FALSE );

	//获取上级目录
	BOOL  bGetPreDir  = ::PathRemoveFileSpec( szPreDir );
	if( !bGetPreDir ) return FALSE;

	//如果上级目录不存在,则递归创建上级目录
	if( !::PathIsDirectory( szPreDir ) )
	{
		CreateDirectoryNested( szPreDir );
	}

	return ::CreateDirectory( lpszDir, NULL );
}
예제 #4
0
void UpkExeFile( BOOL bNewMethod, LPCTSTR szPath )
{
	CString strTmpPath;
	GetTempUpkPath(strTmpPath);
	CreateDirectoryNested(strTmpPath);

	Files files;
	INT err = bNewMethod ? ExtractOfficePackage(szPath, strTmpPath, files) : UpkUse7z(szPath, strTmpPath, files);

	_tprintf(_T("- UPK OFFICE FILE :%s - %d -> %s\r\n"), szPath, err, strTmpPath);
	DumpFiles(files, TRUE);
	_tprintf(_T("--END \r\n"));

	//DeletePath(strTmpPath);
}
예제 #5
0
BOOL CreateDirEx (const char *lpFullPath, DWORD dwFileAttributes)
{
	USES_CONVERSION;
	return CreateDirectoryNested( CA2CT(lpFullPath) );
}
예제 #6
0
BOOL CCommon::gr_create_folder(CString csPath)
{
	return CreateDirectoryNested(csPath);
}