Esempio n. 1
0
void FindNGenRec(const std_string& strPath, std_string& strNGenPath, FILETIME& ftCreation)
{
	const std_string strSearch = strPath + _T("*.*");
	const std_string strNGen = _T("ngen.exe");

	WIN32_FIND_DATA wfd;
	ZeroMemory(&wfd, sizeof(WIN32_FIND_DATA));
	HANDLE hFind = FindFirstFile(strSearch.c_str(), &wfd);
	if(hFind == INVALID_HANDLE_VALUE) return;

	while(true)
	{
		if((wfd.cFileName[0] == 0) || (_tcsicmp(wfd.cFileName, _T(".")) == 0) ||
			(_tcsicmp(wfd.cFileName, _T("..")) == 0)) { }
		else if((wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
			FindNGenRec((strPath + wfd.cFileName) + _T("\\"), strNGenPath, ftCreation);
		else if(_tcsicmp(wfd.cFileName, strNGen.c_str()) == 0)
		{
			if((wfd.ftCreationTime.dwHighDateTime > ftCreation.dwHighDateTime) ||
				((wfd.ftCreationTime.dwHighDateTime == ftCreation.dwHighDateTime) &&
				(wfd.ftCreationTime.dwLowDateTime > ftCreation.dwLowDateTime)))
			{
				strNGenPath = strPath + wfd.cFileName;
				ftCreation = wfd.ftCreationTime;
			}
		}

		if(FindNextFile(hFind, &wfd) == FALSE) break;
	}

	FindClose(hFind);
}
Esempio n. 2
0
void FindNGenRec(const std_string& strPath, std_string& strNGenPath,
	ULONGLONG& ullVersion)
{
	const std_string strSearch = strPath + _T("*.*");
	const std_string strNGen = _T("ngen.exe");

	WIN32_FIND_DATA wfd;
	ZeroMemory(&wfd, sizeof(WIN32_FIND_DATA));
	HANDLE hFind = FindFirstFile(strSearch.c_str(), &wfd);
	if(hFind == INVALID_HANDLE_VALUE) return;

	while(true)
	{
		if((wfd.cFileName[0] == 0) || (_tcsicmp(wfd.cFileName, _T(".")) == 0) ||
			(_tcsicmp(wfd.cFileName, _T("..")) == 0)) { }
		else if((wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
			FindNGenRec((strPath + wfd.cFileName) + _T("\\"), strNGenPath, ullVersion);
		else if(_tcsicmp(wfd.cFileName, strNGen.c_str()) == 0)
		{
			const std_string strFullPath = strPath + strNGen;
			const ULONGLONG ullThisVer = SiuGetFileVersion(strFullPath);
			if(ullThisVer >= ullVersion)
			{
				strNGenPath = strFullPath;
				ullVersion = ullThisVer;
			}
		}

		if(FindNextFile(hFind, &wfd) == FALSE) break;
	}

	FindClose(hFind);
}
Esempio n. 3
0
std_string FindNGen()
{
	std_string strNGen;

	std_string strRoot = GetNetInstallRoot();
	if(strRoot.size() == 0) return strNGen;
	EnsureTerminatingSeparator(strRoot);

	ULONGLONG ullVersion = 0;
	FindNGenRec(strRoot, strNGen, ullVersion);

	return strNGen;
}
Esempio n. 4
0
std_string FindNGen()
{
	std_string strNGen;

	std_string strRoot = GetNetInstallRoot();
	if(strRoot.size() == 0) return strNGen;
	EnsureTerminatingSeparator(strRoot);

	FILETIME ftCreation;
	ZeroMemory(&ftCreation, sizeof(FILETIME));
	FindNGenRec(strRoot, strNGen, ftCreation);

	return strNGen;
}