예제 #1
0
void _TestUpk()
{
	LPCTSTR szExeFile = _T("O:\\office\\2003\\ksafe_office2003-KB951535-FullFile-CHS.exe");
	LPCTSTR szExtractPath = _T("C:\\Program Files\\masdfasdf");
	DeletePath(szExtractPath);

	Files files;
	TRUE ? ExtractOfficePackage(szExeFile, szExtractPath, files) : UpkUse7z(szExeFile, szExtractPath, files);
	DumpFiles(files);
}
예제 #2
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);
}
예제 #3
0
파일: genmpits.c 프로젝트: gllort/extrae
int main (int argc, char *argv[])
{
	int pidlabel = FALSE;
	int i;

	files = (char**) malloc (MAX_MPIT_FILES*sizeof(char*));
	if (files == NULL)
	{
		fprintf (stderr, "Cannot allocate %ld bytes of memory to allocate file names\n", MAX_MPIT_FILES*sizeof(char*));
		return -2;
	}
	for (i = 0; i < MAX_MPIT_FILES; i++)
		files[i] = NULL;

	i = 1;
	while (i < argc)
	{
		if (strncmp ("-pidlabel", argv[i], 9) == 0)
		{
			pidlabel = TRUE;
		}
		else if (strncmp ("-f", argv[i], 2) == 0)
		{
			i++;
			if (i < argc)
				AddFileOfFiles(argv[i]);
			else
			{
				fprintf (stderr, "You must give a parameter for the -f option\n");
				return -2;
			}
		}
		else
		{
			struct stat sb;
			stat (argv[i], &sb);

			if ((sb.st_mode & S_IFMT) == S_IFDIR)
			{
				size_t len;
				struct dirent *de;
				DIR *d = opendir(argv[i]);

				if (d == NULL)
				{
					fprintf (stderr, "%s is not a directory!\n", argv[i]);
					return -1;
				}

				while ((de = readdir(d)) != NULL)
					if ((len = strlen(de->d_name)) > 5)
						if (strncmp (&de->d_name[len-5], ".mpit", 5) == 0)
						{
							char fullname[NAME_MAX];
							sprintf (fullname, "%s/%s", argv[i], de->d_name);
							AddFile (fullname);
						}
			}
			else if ((sb.st_mode & S_IFMT) == S_IFREG)
			{
				AddFile (argv[i]);
			}
			else
			{
				fprintf (stderr, "Parameter %s is neither a regular file nor a directory! Ignored...\n", argv[i]);
			}
		}
		i++;
	}

	SortFilesByTime ();
	DumpFiles (pidlabel);

	free (files);

	return 0;
}