1. Billy O'Neal
  2. pevFind

Commits

Billy O'Neal  committed 94f2ebd

Tabs -> spaces.

  • Participants
  • Parent commits 8340e08
  • Branches default

Comments (0)

Files changed (64)

File pevFind/main.cpp

View file
  • Ignore whitespace
 
 int __cdecl wmain(int argc, wchar_t* argv[])
 {
-	using namespace boost::algorithm;
-	try {
-	if (argc < 2) throw std::runtime_error("Invalid number of arguments."); //We always require at least one option.
-	
-	if (iequals(argv[1], L"vfind")) //vFind is the default, and therefore we don't need to bother reallocating
-		return vFind::main(); //It's argument pointers and such.
-	
-	boost::iterator_range<wchar_t *> firstArgument(argv[1], argv[1] + wcslen(argv[1]));
-	argc -= 1;
-	argv += 1;
-	
-	if      (iequals(firstArgument, L"CLSID"))
-		return clsidCompressor::main(argc, argv);
-	else if (iequals(firstArgument, L"EXEC"))
-		return exec::main();
-	else if (iequals(firstArgument, L"PLIST"))
-		return plist::main(argc, argv);
-	else if (iequals(firstArgument, L"CLIST"))
-		return clist::main();
-	else if (iequals(firstArgument, L"LINK"))
-		return link::main(argc, argv);
-	else if (iequals(firstArgument, L"VOLUME"))
-		return volumeEnumerate::main();
-	else if (iequals(firstArgument, L"UZIP"))
-		return uZip::main(argc, argv);
-	else if (iequals(firstArgument, L"TIME"))
-		return times::main(argc, argv);
-	else if (iequals(firstArgument, L"RIMPORT"))
+    using namespace boost::algorithm;
+    try {
+    if (argc < 2) throw std::runtime_error("Invalid number of arguments."); //We always require at least one option.
+    
+    if (iequals(argv[1], L"vfind")) //vFind is the default, and therefore we don't need to bother reallocating
+        return vFind::main(); //It's argument pointers and such.
+    
+    boost::iterator_range<wchar_t *> firstArgument(argv[1], argv[1] + wcslen(argv[1]));
+    argc -= 1;
+    argv += 1;
+    
+    if      (iequals(firstArgument, L"CLSID"))
+        return clsidCompressor::main(argc, argv);
+    else if (iequals(firstArgument, L"EXEC"))
+        return exec::main();
+    else if (iequals(firstArgument, L"PLIST"))
+        return plist::main(argc, argv);
+    else if (iequals(firstArgument, L"CLIST"))
+        return clist::main();
+    else if (iequals(firstArgument, L"LINK"))
+        return link::main(argc, argv);
+    else if (iequals(firstArgument, L"VOLUME"))
+        return volumeEnumerate::main();
+    else if (iequals(firstArgument, L"UZIP"))
+        return uZip::main(argc, argv);
+    else if (iequals(firstArgument, L"TIME"))
+        return times::main(argc, argv);
+    else if (iequals(firstArgument, L"RIMPORT"))
         return regImport::main(argc, argv, KEY_WOW64_32KEY);
-	else if (iequals(firstArgument, L"RIMPORT32"))
+    else if (iequals(firstArgument, L"RIMPORT32"))
         return regImport::main(argc, argv, KEY_WOW64_32KEY);
-	else if (iequals(firstArgument, L"RIMPORT64"))
-		return regImport::main(argc, argv, KEY_WOW64_64KEY);
-	else if (iequals(firstArgument, L"MOVEEX"))
-		return moveex::main(argc, argv);
-	else if (iequals(firstArgument, L"SC"))
-		return serviceControl::main(argc, argv);
-	else if (iequals(firstArgument, L"DDEV"))
-		return dosdev::main(argc, argv);
-	else if (iequals(firstArgument, L"LINKRESOLVE"))
-		return linkResolve::main(argc, argv);
-	else if (iequals(firstArgument, L"REXPORT"))
-		return rexport::main(argc, argv);
-	else if (iequals(firstArgument, L"WAIT"))
-		return wait::main(argc, argv);
-	return vFind::main();
-	}
-	catch (std::exception& except)
-	{
-		std::cerr << 
-		"                         _____ _           _ \n"
-		"        _ __   _____   _|  ___(_)_ __   __| |\n"
-		"       | '_ \\ / _ \\ \\ / / |_  | | '_ \\ / _` |\n"
-		"       | |_) |  __/\\ V /|  _| | | | | | (_| |\n"
-		"       | .__/ \\___| \\_/ |_|   |_|_| |_|\\__,_|\n"
-		"       |_|    by Billy Robert O'Neal III\n"
-		"                      Version " PEVFIND_VERSION "\n"
-		"  Distributed under the Boost Software License, Version 1.0.\n"
-		"         http://www.boost.org/LICENSE_1_0.txt\n"
-		"pevFind contains some code from Info-ZIP, used with permission.\n"
-		"  In accordance with Info-ZIP's License, it can be found at\n"
-		"           http://billy-oneal.com/infozip.txt\n"
-		"            Filename regular expressions library is\n"
-		" Copyright (C)1997-1998 by David R. Tribble, all rights reserved.\n\n";
-		std::cerr << except.what() << "\n";
-	}
+    else if (iequals(firstArgument, L"RIMPORT64"))
+        return regImport::main(argc, argv, KEY_WOW64_64KEY);
+    else if (iequals(firstArgument, L"MOVEEX"))
+        return moveex::main(argc, argv);
+    else if (iequals(firstArgument, L"SC"))
+        return serviceControl::main(argc, argv);
+    else if (iequals(firstArgument, L"DDEV"))
+        return dosdev::main(argc, argv);
+    else if (iequals(firstArgument, L"LINKRESOLVE"))
+        return linkResolve::main(argc, argv);
+    else if (iequals(firstArgument, L"REXPORT"))
+        return rexport::main(argc, argv);
+    else if (iequals(firstArgument, L"WAIT"))
+        return wait::main(argc, argv);
+    return vFind::main();
+    }
+    catch (std::exception& except)
+    {
+        std::cerr << 
+        "                         _____ _           _ \n"
+        "        _ __   _____   _|  ___(_)_ __   __| |\n"
+        "       | '_ \\ / _ \\ \\ / / |_  | | '_ \\ / _` |\n"
+        "       | |_) |  __/\\ V /|  _| | | | | | (_| |\n"
+        "       | .__/ \\___| \\_/ |_|   |_|_| |_|\\__,_|\n"
+        "       |_|    by Billy Robert O'Neal III\n"
+        "                      Version " PEVFIND_VERSION "\n"
+        "  Distributed under the Boost Software License, Version 1.0.\n"
+        "         http://www.boost.org/LICENSE_1_0.txt\n"
+        "pevFind contains some code from Info-ZIP, used with permission.\n"
+        "  In accordance with Info-ZIP's License, it can be found at\n"
+        "           http://billy-oneal.com/infozip.txt\n"
+        "            Filename regular expressions library is\n"
+        " Copyright (C)1997-1998 by David R. Tribble, all rights reserved.\n\n";
+        std::cerr << except.what() << "\n";
+    }
 }

File pevLib/FILTER.cpp

View file
  • Ignore whitespace
 
 std::wstring sizeFilter::debugTreeInternal(const std::wstring& type) const
 {
-	return std::wstring(L"+ SIZEFILTER ").append(type).append(L" ").append(boost::lexical_cast<std::wstring>(size));
+    return std::wstring(L"+ SIZEFILTER ").append(type).append(L" ").append(boost::lexical_cast<std::wstring>(size));
 }
 unsigned __int32 sizeFilter::getPriorityClass() const
 {
-	return PRIORITY_SLOW_FILTER;
+    return PRIORITY_SLOW_FILTER;
 }
 sizeFilter::sizeFilter(unsigned __int64 createdSize) : size(createdSize)
 {}
 {}
 BOOL gtSizeFilter::include(FileData &file) const
 {
-	return file.getSize() > size;
+    return file.getSize() > size;
 }
 std::wstring gtSizeFilter::debugTree() const
 {
-	return debugTreeInternal(L"GREATERTHAN");
+    return debugTreeInternal(L"GREATERTHAN");
 }
 ltSizeFilter::ltSizeFilter(unsigned __int64 createdSize) : sizeFilter(createdSize)
 {}
 BOOL ltSizeFilter::include(FileData &file) const
 {
-	return file.getSize() < size;
+    return file.getSize() < size;
 }
 std::wstring ltSizeFilter::debugTree() const
 {
-	return debugTreeInternal(L"LESSTHAN");
+    return debugTreeInternal(L"LESSTHAN");
 }
 notSizeFilter::notSizeFilter(unsigned __int64 createdSize) : sizeFilter(createdSize)
 {}
 BOOL notSizeFilter::include(FileData &file) const
 {
-	return file.getSize() != size;
+    return file.getSize() != size;
 }
 std::wstring notSizeFilter::debugTree() const
 {
-	return debugTreeInternal(L"ISNOT");
+    return debugTreeInternal(L"ISNOT");
 }
 isSizeFilter::isSizeFilter(unsigned __int64 createdSize) : sizeFilter(createdSize)
 {}
 BOOL isSizeFilter::include(FileData &file) const
 {
-	return file.getSize() == size;
+    return file.getSize() == size;
 }
 std::wstring isSizeFilter::debugTree() const
 {
-	return debugTreeInternal(L"EQUALS");
+    return debugTreeInternal(L"EQUALS");
 }
 unsigned __int32 dateFilter::getPriorityClass() const
 {
-	return PRIORITY_SLOW_FILTER;
+    return PRIORITY_SLOW_FILTER;
 }
 dateFilter::dateFilter(const FILETIME &inDate) : date(inDate)
 {}
 {}
 std::wstring accessLDate::debugTree() const
 {
-	return L"ACCESS DATEFILTER LESSTHAN " + getDateAsString(date);
+    return L"ACCESS DATEFILTER LESSTHAN " + getDateAsString(date);
 }
 BOOL accessLDate::include(FileData &file) const
 {
-	return file.getLastAccessTime() < date;
+    return file.getLastAccessTime() < date;
 }
 accessGDate::accessGDate(const FILETIME &inDate) : dateFilter(inDate)
 {}
 std::wstring accessGDate::debugTree() const
 {
-	return L"ACCESS DATEFILTER GREATERTHAN " + getDateAsString(date);
+    return L"ACCESS DATEFILTER GREATERTHAN " + getDateAsString(date);
 }
 BOOL accessGDate::include(FileData &file) const
 {
-	return date < file.getLastAccessTime();
+    return date < file.getLastAccessTime();
 }
 modifiedLDate::modifiedLDate(const FILETIME &inDate) : dateFilter(inDate)
 {}
 std::wstring modifiedLDate::debugTree() const
 {
-	return L"MOD DATEFILTER LESSTHAN " + getDateAsString(date);
+    return L"MOD DATEFILTER LESSTHAN " + getDateAsString(date);
 }
 BOOL modifiedLDate::include(FileData &file) const
 {
-	return file.getLastModTime() < date;
+    return file.getLastModTime() < date;
 }
 modifiedGDate::modifiedGDate(const FILETIME &inDate) : dateFilter(inDate)
 {}
 std::wstring modifiedGDate::debugTree() const
 {
-	return L"MOD DATEFILTER GREATERTHAN " + getDateAsString(date);
+    return L"MOD DATEFILTER GREATERTHAN " + getDateAsString(date);
 }
 BOOL modifiedGDate::include(FileData &file) const
 {
-	return date < file.getLastModTime();
+    return date < file.getLastModTime();
 }
 createdLDate::createdLDate(const FILETIME &inDate) : dateFilter(inDate)
 {}
 std::wstring createdLDate::debugTree() const
 {
-	return L"CREATED DATEFILTER LESSTHAN " + getDateAsString(date);
+    return L"CREATED DATEFILTER LESSTHAN " + getDateAsString(date);
 }
 BOOL createdLDate::include(FileData &file) const
 {
-	return file.getCreationTime() < date;
+    return file.getCreationTime() < date;
 }
 createdGDate::createdGDate(const FILETIME &inDate) : dateFilter(inDate)
 {}
 std::wstring createdGDate::debugTree() const
 {
-	return L"CREATED DATEFILTER GREATERTHAN " + getDateAsString(date);
+    return L"CREATED DATEFILTER GREATERTHAN " + getDateAsString(date);
 }
 BOOL createdGDate::include(FileData &file) const
 {
-	return date < file.getCreationTime();
+    return date < file.getCreationTime();
 }
 unsigned __int32 fastFilter::getPriorityClass() const
 {
-	return PRIORITY_FAST_FILTER;
+    return PRIORITY_FAST_FILTER;
 }
 BOOL isArchive::include(FileData &file) const
 {
-	return file.isArchive();
+    return file.isArchive();
 }
 std::wstring isArchive::debugTree() const
 {
-	return std::wstring(L"+ ISARCHIVE");
+    return std::wstring(L"+ ISARCHIVE");
 }
 BOOL isCompressed::include(FileData &file) const
 {
-	return file.isCompressed();
+    return file.isCompressed();
 }
 std::wstring isCompressed::debugTree() const
 {
-	return std::wstring(L"+ ISCOMPRESSED");
+    return std::wstring(L"+ ISCOMPRESSED");
 }
 BOOL isDirectory::include(FileData &file) const
 {
-	return file.isDirectory();
+    return file.isDirectory();
 }
 std::wstring isDirectory::debugTree() const
 {
-	return std::wstring(L"+ ISDIRECTORY");
+    return std::wstring(L"+ ISDIRECTORY");
 }
 BOOL isFile::include(FileData &file) const
 {
-	return file.isFile();
+    return file.isFile();
 }
 std::wstring isFile::debugTree() const
 {
-	return std::wstring(L"+ ISFILE");
+    return std::wstring(L"+ ISFILE");
 }
 BOOL isReparsePoint::include(FileData &file) const
 {
-	return file.isReparsePoint();
+    return file.isReparsePoint();
 }
 std::wstring isReparsePoint::debugTree() const
 {
-	return std::wstring(L"+ ISREPARSEPOINT");
+    return std::wstring(L"+ ISREPARSEPOINT");
 }
 BOOL isSFCProtected::include(FileData &file) const
 {
-	return file.isSfcProtected();
+    return file.isSfcProtected();
 }
 std::wstring isSFCProtected::debugTree() const
 {
-	return std::wstring(L"+ ISSFCPROTECTED");
+    return std::wstring(L"+ ISSFCPROTECTED");
 }
 BOOL isHidden::include(FileData &file) const
 {
-	return file.isHidden();
+    return file.isHidden();
 }
 std::wstring isHidden::debugTree() const
 {
-	return std::wstring(L"+ ISHIDDEN");
+    return std::wstring(L"+ ISHIDDEN");
 }
 BOOL isReadOnly::include(FileData &file) const
 {
-	return file.isReadOnly();
+    return file.isReadOnly();
 }
 std::wstring isReadOnly::debugTree() const
 {
-	return std::wstring(L"+ ISREADONLY");
+    return std::wstring(L"+ ISREADONLY");
 }
 BOOL isSystem::include(FileData &file) const
 {
-	return file.isSystem();
+    return file.isSystem();
 }
 std::wstring isSystem::debugTree() const
 {
-	return std::wstring(L"+ ISSYSTEM"); 
+    return std::wstring(L"+ ISSYSTEM"); 
 }
 BOOL isVolumeLabel::include(FileData &file) const
 {
-	return file.isVolumeLabel();
+    return file.isVolumeLabel();
 }
 std::wstring isVolumeLabel::debugTree() const
 {
-	return std::wstring(L"+ ISVOLLABEL");
+    return std::wstring(L"+ ISVOLLABEL");
 }
 BOOL isWritable::include(FileData &file) const
 {
-	return file.isWritable();
+    return file.isWritable();
 }
 std::wstring isWritable::debugTree() const
 {
-	return std::wstring(L"+ ISWRITABLE");
+    return std::wstring(L"+ ISWRITABLE");
 }
 BOOL isTemp::include(FileData &file) const
 {
-	return file.isTemporary();
+    return file.isTemporary();
 }
 std::wstring isTemp::debugTree() const
 {
-	return std::wstring(L"+ ISTEMP");
+    return std::wstring(L"+ ISTEMP");
 }
 unsigned __int32 sigIsValid::getPriorityClass() const
 {
-	return PRIORITY_SIGCHECK;
+    return PRIORITY_SIGCHECK;
 }
 BOOL sigIsValid::include(FileData &file) const
 {
-	return file.hasValidDigitalSignature();
+    return file.hasValidDigitalSignature();
 }
 std::wstring sigIsValid::debugTree() const
 {
-	return std::wstring(L"+ SIGVALID");
+    return std::wstring(L"+ SIGVALID");
 }
 unsigned __int32 peFilter::getPriorityClass() const
 {
-	return PRIORITY_PE_DATA;
+    return PRIORITY_PE_DATA;
 }
 BOOL hasSig::include(FileData &file) const
 {
-	return file.hasAuthenticodeSignature();
+    return file.hasAuthenticodeSignature();
 }
 std::wstring hasSig::debugTree() const
 {
-	return std::wstring(L"+ HASSIGNATURE");
+    return std::wstring(L"+ HASSIGNATURE");
 }
 BOOL isPEFile::include(FileData &file) const
 {
-	return file.isPE();
+    return file.isPE();
 }
 std::wstring isPEFile::debugTree() const
 {
-	return std::wstring(L"+ ISPORTABLEEXE");
+    return std::wstring(L"+ ISPORTABLEEXE");
 }
 BOOL timestampValid::include(FileData &file) const
 {
-	return file.peHeaderTimeIsValid();
+    return file.peHeaderTimeIsValid();
 }
 std::wstring timestampValid::debugTree() const
 {
-	return std::wstring(L"+ PETIMESTAMPVALID");
+    return std::wstring(L"+ PETIMESTAMPVALID");
 }
 BOOL checkSumValid::include(FileData &file) const
 {
-	return file.peHeaderChecksumIsValid(); 
+    return file.peHeaderChecksumIsValid(); 
 }
 std::wstring checkSumValid::debugTree() const
 {
-	return std::wstring(L"+ CHECKSUMVALID");
+    return std::wstring(L"+ CHECKSUMVALID");
 }
 BOOL isDLLFile::include(FileData &file) const
 {
-	return file.isDLL();
+    return file.isDLL();
 }
 std::wstring isDLLFile::debugTree() const
 {
-	return std::wstring(L"+ ISDLL");
+    return std::wstring(L"+ ISDLL");
 }
 unsigned __int32 hash::getPriorityClass() const
 {
-	return PRIORITY_HASH_CHECK;
+    return PRIORITY_HASH_CHECK;
 }
 BOOL md5Match::include(FileData &file) const
 {
-	return file.MD5() == md5Val;
+    return file.MD5() == md5Val;
 }
 std::wstring md5Match::debugTree() const
 {
-	return std::wstring(L"+ MD5 MATCHES ").append(md5Val);
+    return std::wstring(L"+ MD5 MATCHES ").append(md5Val);
 }
 md5Match::md5Match(std::wstring md5Value): md5Val(md5Value)
 {
-	boost::algorithm::to_upper(md5Val);
+    boost::algorithm::to_upper(md5Val);
 }
 BOOL sha1Match::include(FileData &file) const
 {
-	return file.SHA1() == sha1Val;
+    return file.SHA1() == sha1Val;
 }
 std::wstring sha1Match::debugTree() const
 {
-	return std::wstring(L"+ SHA-1 MATCHES ").append(sha1Val);
+    return std::wstring(L"+ SHA-1 MATCHES ").append(sha1Val);
 }
 sha1Match::sha1Match(std::wstring sha1Value): sha1Val(sha1Value)
 {
-	boost::algorithm::to_upper(sha1Val);
+    boost::algorithm::to_upper(sha1Val);
 }
 std::wstring hashList::listValues() const
 {
-	std::wstring retVal;
-	for( std::vector<std::wstring>::const_iterator it = values.begin(); it != values.end(); it++)
-		retVal.append(L"  ").append(*it).append(L"\r\n");
-	retVal.erase(retVal.end() - 2, retVal.end());
-	return retVal;
+    std::wstring retVal;
+    for( std::vector<std::wstring>::const_iterator it = values.begin(); it != values.end(); it++)
+        retVal.append(L"  ").append(*it).append(L"\r\n");
+    retVal.erase(retVal.end() - 2, retVal.end());
+    return retVal;
 }
 hashList::hashList(std::vector<std::wstring> hashes) : values(hashes)
 {
-	std::sort(values.begin(),values.end());
-	for(std::vector<std::wstring>::iterator it = hashes.begin(); it != hashes.end(); it++)
-	{
-		boost::algorithm::to_upper(*it);
-	}
+    std::sort(values.begin(),values.end());
+    for(std::vector<std::wstring>::iterator it = hashes.begin(); it != hashes.end(); it++)
+    {
+        boost::algorithm::to_upper(*it);
+    }
 }
 BOOL md5List::include(FileData &file) const
 {
-	return std::binary_search(values.begin(),values.end(),file.MD5());
+    return std::binary_search(values.begin(),values.end(),file.MD5());
 }
 std::wstring md5List::debugTree() const
 {
-	return L"+ MD5 LIST:\r\n" + listValues();
+    return L"+ MD5 LIST:\r\n" + listValues();
 }
 md5List::md5List(std::vector<std::wstring> md5s): hashList(md5s)
 {}
 BOOL sha1List::include(FileData &file) const
 {
-	return std::binary_search(values.begin(),values.end(),file.SHA1());
+    return std::binary_search(values.begin(),values.end(),file.SHA1());
 }
 std::wstring sha1List::debugTree() const
 {
-	return L"+ SHA-1 LIST:\r\n" + listValues();
+    return L"+ SHA-1 LIST:\r\n" + listValues();
 }
 sha1List::sha1List(std::vector<std::wstring> sha1s): hashList(sha1s)
 {}
 BOOL md5EList::include(FileData &file) const
 {
-	std::wstring calcHash = file.MD5();
-	if (calcHash[0] == L'!')
-		return true;
-	return std::binary_search(values.begin(),values.end(),calcHash);
+    std::wstring calcHash = file.MD5();
+    if (calcHash[0] == L'!')
+        return true;
+    return std::binary_search(values.begin(),values.end(),calcHash);
 }
 std::wstring md5EList::debugTree() const
 {
-	return L"+ MD5 OR ERROR LIST:\r\n" + listValues();
+    return L"+ MD5 OR ERROR LIST:\r\n" + listValues();
 }
 md5EList::md5EList(std::vector<std::wstring> md5s): hashList(md5s)
 {}
 BOOL sha1EList::include(FileData &file) const
 {
-	std::wstring calcHash = file.SHA1();
-	if (calcHash[0] == L'!')
-		return true;
-	return std::binary_search(values.begin(),values.end(),calcHash);
+    std::wstring calcHash = file.SHA1();
+    if (calcHash[0] == L'!')
+        return true;
+    return std::binary_search(values.begin(),values.end(),calcHash);
 }
 std::wstring sha1EList::debugTree() const
 {
-	return L"+ SHA-1 OR ERROR LIST:\r\n" + listValues();
+    return L"+ SHA-1 OR ERROR LIST:\r\n" + listValues();
 }
 sha1EList::sha1EList(std::vector<std::wstring> sha1s): hashList(sha1s)
 {}
 unsigned __int32 skipper::getPriorityClass() const 
 { 
-	return PRIORITY_FAST_FILTER; 
+    return PRIORITY_FAST_FILTER; 
 }
 BOOL skipper::include(FileData & /*file*/) const
 { 
-	return true; 
+    return true; 
 }
 std::wstring skipper::debugTree() const 
 { 
-	return L"SKIP " + _toSkip;
+    return L"SKIP " + _toSkip;
 }
 unsigned int skipper::directoryCheck(const std::wstring& directory)
 {
-	wchar_t relPath[MAX_PATH];
-	if (!PathRelativePathTo(relPath, _toSkip.c_str(), FILE_ATTRIBUTE_DIRECTORY, directory.c_str(), FILE_ATTRIBUTE_DIRECTORY))
-		return DIRECTORY_DONTCARE;
-	if (relPath[0] == L'.' && relPath[1] == NULL)
-		return DIRECTORY_EXCLUDE;
-	return DIRECTORY_DONTCARE;
+    wchar_t relPath[MAX_PATH];
+    if (!PathRelativePathTo(relPath, _toSkip.c_str(), FILE_ATTRIBUTE_DIRECTORY, directory.c_str(), FILE_ATTRIBUTE_DIRECTORY))
+        return DIRECTORY_DONTCARE;
+    if (relPath[0] == L'.' && relPath[1] == NULL)
+        return DIRECTORY_EXCLUDE;
+    return DIRECTORY_DONTCARE;
 }
 skipper::skipper(const std::wstring& toSkip) : _toSkip(toSkip)
 {}
 
 BOOL isNEFile::include(FileData &file) const
 {
-	return file.isNE();
+    return file.isNE();
 }
 
 std::wstring isNEFile::debugTree() const
 {
-	return std::wstring(L"+ ISNEWEXE");
+    return std::wstring(L"+ ISNEWEXE");
 }
 
 BOOL isLEFile::include(FileData &file) const
 {
-	return file.isLE();
+    return file.isLE();
 }
 
 std::wstring isLEFile::debugTree() const
 {
-	return std::wstring(L"+ ISLEFORMATEXE");
+    return std::wstring(L"+ ISLEFORMATEXE");
 }
 
 BOOL isMZFile::include(FileData &file) const
 {
-	return file.isMZ();
+    return file.isMZ();
 }
 
 std::wstring isMZFile::debugTree() const
 {
-	return std::wstring(L"+ ISMZCOMPLIANTEXE");
+    return std::wstring(L"+ ISMZCOMPLIANTEXE");
 }
 
 BOOL is2ExecFile::include(FileData &file) const
 {
-	return file.isStrongExecutable();
+    return file.isStrongExecutable();
 }
 
 std::wstring is2ExecFile::debugTree() const
 {
-	return std::wstring(L"+ ISSTRONGTYPEEXE");
+    return std::wstring(L"+ ISSTRONGTYPEEXE");
 }
 
 unsigned __int32 headerLDate::getPriorityClass() const
 {
-	return PRIORITY_PE_DATA;
+    return PRIORITY_PE_DATA;
 }
 
 std::wstring headerLDate::debugTree() const
 {
-	return L"HEADER DATEFILTER LESSTHAN " + getDateAsString(date);
+    return L"HEADER DATEFILTER LESSTHAN " + getDateAsString(date);
 }
 
 BOOL headerLDate::include(FileData &file) const
 {
-	if (!file.isPE())
-		return false;
-	return file.getPEHeaderTime() < date;
+    if (!file.isPE())
+        return false;
+    return file.getPEHeaderTime() < date;
 }
 
 unsigned __int32 headerGDate::getPriorityClass() const
 {
-	return PRIORITY_PE_DATA;
+    return PRIORITY_PE_DATA;
 }
 
 std::wstring headerGDate::debugTree() const
 {
-	return L"HEADER DATEFILTER GREATERTHAN " + getDateAsString(date);
+    return L"HEADER DATEFILTER GREATERTHAN " + getDateAsString(date);
 }
 
 BOOL headerGDate::include(FileData &file) const
 {
-	if (!file.isPE())
-		return false;
-	return date < file.getPEHeaderTime();
+    if (!file.isPE())
+        return false;
+    return date < file.getPEHeaderTime();
 }
 
 BOOL isPEPlusFile::include( FileData &file ) const
 {
-	return file.isPEPlus();
+    return file.isPEPlus();
 }
 
 std::wstring isPEPlusFile::debugTree() const
 {
-	return std::wstring(L"+ IS64BITPORTABLEEXE");
+    return std::wstring(L"+ IS64BITPORTABLEEXE");
 }

File pevLib/FILTER.h

View file
  • Ignore whitespace
 class sizeFilter : public criterion
 {
 protected:
-	unsigned __int64 size;
-	std::wstring debugTreeInternal(const std::wstring& type) const;
+    unsigned __int64 size;
+    std::wstring debugTreeInternal(const std::wstring& type) const;
 public:
-	unsigned __int32 getPriorityClass() const;
-	sizeFilter(unsigned __int64 createdSize);
+    unsigned __int32 getPriorityClass() const;
+    sizeFilter(unsigned __int64 createdSize);
 };
 
 struct gtSizeFilter : sizeFilter
 {
-	gtSizeFilter(unsigned __int64 createdSize);
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    gtSizeFilter(unsigned __int64 createdSize);
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 
 struct ltSizeFilter : sizeFilter
 {
-	ltSizeFilter(unsigned __int64 createdSize);
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    ltSizeFilter(unsigned __int64 createdSize);
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 
 struct notSizeFilter : sizeFilter
 {
-	notSizeFilter(unsigned __int64 createdSize);
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    notSizeFilter(unsigned __int64 createdSize);
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 
 struct isSizeFilter : sizeFilter
 {
-	isSizeFilter(unsigned __int64 createdSize);
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    isSizeFilter(unsigned __int64 createdSize);
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 
 class dateFilter : public criterion
 {
 protected:
-	FILETIME date;
+    FILETIME date;
 public:
-	virtual unsigned __int32 getPriorityClass() const;
-	dateFilter(const FILETIME &inDate);
-	
+    virtual unsigned __int32 getPriorityClass() const;
+    dateFilter(const FILETIME &inDate);
+    
 };
 
 struct headerLDate : dateFilter
 {
-	unsigned __int32 getPriorityClass() const;
-	headerLDate(const FILETIME &inDate) : dateFilter(inDate) {};
-	std::wstring debugTree() const;
-	BOOL include(FileData &file) const;
+    unsigned __int32 getPriorityClass() const;
+    headerLDate(const FILETIME &inDate) : dateFilter(inDate) {};
+    std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
 };
 
 struct headerGDate : dateFilter
 {
-	unsigned __int32 getPriorityClass() const;
-	headerGDate(const FILETIME &inDate) : dateFilter(inDate) {};
-	std::wstring debugTree() const;
-	BOOL include(FileData &file) const;
+    unsigned __int32 getPriorityClass() const;
+    headerGDate(const FILETIME &inDate) : dateFilter(inDate) {};
+    std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
 };
 
 class accessLDate : public dateFilter
 {
 public:
-	accessLDate(const FILETIME &inDate);
-	std::wstring debugTree() const;
-	BOOL include(FileData &file) const;
+    accessLDate(const FILETIME &inDate);
+    std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
 };
 
 class accessGDate : public dateFilter
 {
 public:
-	accessGDate(const FILETIME &inDate);
-	std::wstring debugTree() const;
-	BOOL include(FileData &file) const;
+    accessGDate(const FILETIME &inDate);
+    std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
 };
 
 class modifiedLDate : public dateFilter
 {
 public:
-	modifiedLDate(const FILETIME &inDate);
-	std::wstring debugTree() const;
-	BOOL include(FileData &file) const;
+    modifiedLDate(const FILETIME &inDate);
+    std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
 };
 
 class modifiedGDate : public dateFilter
 {
 public:
-	modifiedGDate(const FILETIME &inDate);
-	std::wstring debugTree() const;
-	BOOL include(FileData &file) const;
+    modifiedGDate(const FILETIME &inDate);
+    std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
 };
 
 class createdLDate : public dateFilter
 {
 public:
-	createdLDate(const FILETIME &inDate);
-	std::wstring debugTree() const;
-	BOOL include(FileData &file) const;
+    createdLDate(const FILETIME &inDate);
+    std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
 };
 
 class createdGDate : public dateFilter
 {
 public:
-	createdGDate(const FILETIME &inDate);
-	std::wstring debugTree() const;
-	BOOL include(FileData &file) const;
+    createdGDate(const FILETIME &inDate);
+    std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
 };
 
 struct fastFilter : public criterion
 {
-	unsigned __int32 getPriorityClass() const;
+    unsigned __int32 getPriorityClass() const;
 };
 
 struct isArchive : public fastFilter
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 struct isCompressed : public fastFilter
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 struct isDirectory : public fastFilter
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 struct isFile : public fastFilter
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 struct isReparsePoint : public fastFilter
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 struct isSFCProtected : public fastFilter
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 struct isHidden : public fastFilter
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 struct isReadOnly : public fastFilter
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 struct isSystem : public fastFilter
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 struct isVolumeLabel : public fastFilter
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 struct isWritable : public fastFilter
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 struct isTemp : public fastFilter
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 struct sigIsValid : public criterion
 {
-	unsigned __int32 getPriorityClass() const;
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    unsigned __int32 getPriorityClass() const;
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 struct peFilter : public criterion
 {
-	unsigned __int32 getPriorityClass() const;
+    unsigned __int32 getPriorityClass() const;
 };
 struct hasSig : public peFilter
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 struct isPEFile : public peFilter
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 struct isPEPlusFile : public peFilter
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 struct isNEFile : public peFilter
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 struct isLEFile : public peFilter
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 struct isMZFile : public peFilter
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 struct is2ExecFile : public peFilter
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 struct timestampValid : public peFilter
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 struct checkSumValid : public peFilter
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 struct isDLLFile : public peFilter
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
 };
 
 struct hash : public criterion
 {
-	unsigned __int32 getPriorityClass() const;
+    unsigned __int32 getPriorityClass() const;
 };
 
 class md5Match : public hash
 {
-	std::wstring md5Val;
+    std::wstring md5Val;
 public:
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
-	md5Match(std::wstring md5Value);
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
+    md5Match(std::wstring md5Value);
 };
 class sha1Match : public hash
 {
-	std::wstring sha1Val;
+    std::wstring sha1Val;
 public:
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
-	sha1Match(std::wstring sha1Value);
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
+    sha1Match(std::wstring sha1Value);
 };
 class hashList : public hash
 {
 protected:
-	std::vector<std::wstring> values;
-	std::wstring listValues() const;
+    std::vector<std::wstring> values;
+    std::wstring listValues() const;
 public:
-	hashList(std::vector<std::wstring> hashes);
+    hashList(std::vector<std::wstring> hashes);
 };
 struct md5List : public hashList
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
-	md5List(std::vector<std::wstring> md5s);
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
+    md5List(std::vector<std::wstring> md5s);
 };
 struct sha1List : public hashList
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
-	sha1List(std::vector<std::wstring> sha1s);
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
+    sha1List(std::vector<std::wstring> sha1s);
 };
 struct md5EList : public hashList
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
-	md5EList(std::vector<std::wstring> md5s);
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
+    md5EList(std::vector<std::wstring> md5s);
 };
 struct sha1EList : public hashList
 {
-	BOOL include(FileData &file) const;
-	std::wstring debugTree() const;
-	sha1EList(std::vector<std::wstring> sha1s);
+    BOOL include(FileData &file) const;
+    std::wstring debugTree() const;
+    sha1EList(std::vector<std::wstring> sha1s);
 };
 class skipper : public criterion
 {
-	std::wstring _toSkip;
+    std::wstring _toSkip;
 public:
-	unsigned __int32 getPriorityClass() const;
-	BOOL include(FileData & /*file*/) const;
-	std::wstring debugTree() const;
-	virtual unsigned int directoryCheck(const std::wstring& directory);
-	skipper(const std::wstring& toSkip);
+    unsigned __int32 getPriorityClass() const;
+    BOOL include(FileData & /*file*/) const;
+    std::wstring debugTree() const;
+    virtual unsigned int directoryCheck(const std::wstring& directory);
+    skipper(const std::wstring& toSkip);
 };

File pevLib/OPSTRUCT.h

View file
  • Ignore whitespace
 class operation : public criterion
 {
 protected:
-	std::shared_ptr<criterion> operandA;
-	std::shared_ptr<criterion> operandB;
-	std::wstring debugTreeInternal(const std::wstring& curOp) const;
+    std::shared_ptr<criterion> operandA;
+    std::shared_ptr<criterion> operandB;
+    std::wstring debugTreeInternal(const std::wstring& curOp) const;
 public:
-	virtual void reorderTree();
-	unsigned __int32 getPriorityClass() const;
-	operation(std::shared_ptr<criterion> a, std::shared_ptr<criterion> b);
-	void makeNonRecursive();
+    virtual void reorderTree();
+    unsigned __int32 getPriorityClass() const;
+    operation(std::shared_ptr<criterion> a, std::shared_ptr<criterion> b);
+    void makeNonRecursive();
 };
 
 class andAndClass : public operation
 {
 public:
-	BOOL include(FileData &file) const;
-	virtual unsigned int directoryCheck(const std::wstring& directory) const;
-	andAndClass(std::shared_ptr<criterion> a, std::shared_ptr<criterion> b);
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    virtual unsigned int directoryCheck(const std::wstring& directory) const;
+    andAndClass(std::shared_ptr<criterion> a, std::shared_ptr<criterion> b);
+    std::wstring debugTree() const;
 };
 class orAndClass : public operation
 {
 public:
-	BOOL include(FileData &file) const;
-	virtual unsigned int directoryCheck(const std::wstring& directory) const;
-	orAndClass(std::shared_ptr<criterion> a, std::shared_ptr<criterion> b);
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    virtual unsigned int directoryCheck(const std::wstring& directory) const;
+    orAndClass(std::shared_ptr<criterion> a, std::shared_ptr<criterion> b);
+    std::wstring debugTree() const;
 };
 class xorAndClass : public operation
 {
 public:
-	BOOL include(FileData &file) const;
-	virtual unsigned int directoryCheck(const std::wstring& directory) const;
-	xorAndClass(std::shared_ptr<criterion> a, std::shared_ptr<criterion> b);
-	std::wstring debugTree() const;
+    BOOL include(FileData &file) const;
+    virtual unsigned int directoryCheck(const std::wstring& directory) const;
+    xorAndClass(std::shared_ptr<criterion> a, std::shared_ptr<criterion> b);
+    std::wstring debugTree() const;
 };
 class notAndClass : public criterion
 {
-	std::shared_ptr<criterion> operand;
+    std::shared_ptr<criterion> operand;
 public:
-	virtual void reorderTree();
-	unsigned __int32 getPriorityClass() const;
-	BOOL include(FileData &file) const;
-	virtual unsigned int directoryCheck(const std::wstring& directory) const;
-	notAndClass(std::shared_ptr<criterion> a);
-	std::wstring debugTree() const;
-	void makeNonRecursive();
+    virtual void reorderTree();
+    unsigned __int32 getPriorityClass() const;
+    BOOL include(FileData &file) const;
+    virtual unsigned int directoryCheck(const std::wstring& directory) const;
+    notAndClass(std::shared_ptr<criterion> a);
+    std::wstring debugTree() const;
+    void makeNonRecursive();
 };
 class bracketClass : public criterion
 {
-	std::vector<std::shared_ptr<criterion> > expr;
+    std::vector<std::shared_ptr<criterion> > expr;
 public:
-	virtual void reorderTree();
-	unsigned __int32 getPriorityClass() const;
-	BOOL include(FileData &file) const;
-	virtual unsigned int directoryCheck(const std::wstring& directory);
-	bracketClass(std::vector<std::shared_ptr<criterion> > exprA);
-	std::wstring debugTree() const;
-	void makeNonRecursive();
+    virtual void reorderTree();
+    unsigned __int32 getPriorityClass() const;
+    BOOL include(FileData &file) const;
+    virtual unsigned int directoryCheck(const std::wstring& directory);
+    bracketClass(std::vector<std::shared_ptr<criterion> > exprA);
+    std::wstring debugTree() const;
+    void makeNonRecursive();
 };
 
 class ifClass : public criterion
 {
-	std::shared_ptr<criterion> condVal;
-	std::shared_ptr<criterion> tVal;
-	std::shared_ptr<criterion> fVal;
+    std::shared_ptr<criterion> condVal;
+    std::shared_ptr<criterion> tVal;
+    std::shared_ptr<criterion> fVal;
 public:
-	virtual void reorderTree();
-	unsigned __int32 getPriorityClass() const;
-	BOOL include(FileData &file) const;
-	virtual unsigned int directoryCheck(const std::wstring& directory) const;
-	ifClass(std::shared_ptr<criterion> condition,std::shared_ptr<criterion> valueIfTrue,std::shared_ptr<criterion> valueIfFalse = std::shared_ptr<criterion>((criterion *)NULL));
-	std::wstring debugTree() const;
-	void makeNonRecursive();
+    virtual void reorderTree();
+    unsigned __int32 getPriorityClass() const;
+    BOOL include(FileData &file) const;
+    virtual unsigned int directoryCheck(const std::wstring& directory) const;
+    ifClass(std::shared_ptr<criterion> condition,std::shared_ptr<criterion> valueIfTrue,std::shared_ptr<criterion> valueIfFalse = std::shared_ptr<criterion>((criterion *)NULL));
+    std::wstring debugTree() const;
+    void makeNonRecursive();
 };
 
 #endif

File pevLib/clsidCompressor.cpp

View file
  • Ignore whitespace
 
 namespace clsidCompressor {
 
-	typedef union _clsidStructure
-	{
-		BYTE bytes[16];
-		unsigned __int64 bigNums[2];
-	} clsidStructure;
+    typedef union _clsidStructure
+    {
+        BYTE bytes[16];
+        unsigned __int64 bigNums[2];
+    } clsidStructure;
 
-	const clsidStructure operator+(const clsidStructure& a, const clsidStructure& b);
+    const clsidStructure operator+(const clsidStructure& a, const clsidStructure& b);
 
-	const clsidStructure operator-(const clsidStructure& a, const clsidStructure& b);
+    const clsidStructure operator-(const clsidStructure& a, const clsidStructure& b);
 
-	int compress(const std::wstring& inFileName, const std::wstring& outFileName);
-	int decompress(const std::wstring& inFileName, const std::wstring& outFileName, const bool append);
-	clsidStructure createClsidFromString(const std::string& clsidString);
-	std::string createStringFromClsid(const clsidStructure& clsidStruct);
-	BYTE minLengthOfClsid(const clsidStructure& clsidStruct)
-	{
-		for(BYTE idx = 15; idx > 0; idx--)
-		{
-			if(clsidStruct.bytes[idx])
-				return idx+1;
-		}
-		return 1;
-	}
+    int compress(const std::wstring& inFileName, const std::wstring& outFileName);
+    int decompress(const std::wstring& inFileName, const std::wstring& outFileName, const bool append);
+    clsidStructure createClsidFromString(const std::string& clsidString);
+    std::string createStringFromClsid(const clsidStructure& clsidStruct);
+    BYTE minLengthOfClsid(const clsidStructure& clsidStruct)
+    {
+        for(BYTE idx = 15; idx > 0; idx--)
+        {
+            if(clsidStruct.bytes[idx])
+                return idx+1;
+        }
+        return 1;
+    }
 
 int main(int argc, wchar_t* argv[])
 {
-	//Verify 4 Arguments
-	if (argc != 4)
-		throw std::invalid_argument("Usage: <OPTIONS> <INFILE> <OUTFILE>");
-	
-	std::wstring options(argv[1]);
-	std::wstring infile(argv[2]);
-	std::wstring outfile(argv[3]);
+    //Verify 4 Arguments
+    if (argc != 4)
+        throw std::invalid_argument("Usage: <OPTIONS> <INFILE> <OUTFILE>");
+    
+    std::wstring options(argv[1]);
+    std::wstring infile(argv[2]);
+    std::wstring outfile(argv[3]);
 
-	//Option: Compress
-	if (options.find_first_of(L"Cc") != options.npos)
-		return compress(infile, outfile);
-	//Option: Decompress
-	if (options.find_first_of(L"Dd") != options.npos)
-	{
-		if (options.find_first_of(L"Aa") == options.npos)
-		{
-			//Don't append to file
-			return decompress(infile,outfile,false);
-		} else
-		{
-			//Append to filee=
-			return decompress(infile,outfile,true);
-		}
-	}
-	throw std::invalid_argument("Invalid operation for CLSID Compressor.");
+    //Option: Compress
+    if (options.find_first_of(L"Cc") != options.npos)
+        return compress(infile, outfile);
+    //Option: Decompress
+    if (options.find_first_of(L"Dd") != options.npos)
+    {
+        if (options.find_first_of(L"Aa") == options.npos)
+        {
+            //Don't append to file
+            return decompress(infile,outfile,false);
+        } else
+        {
+            //Append to filee=
+            return decompress(infile,outfile,true);
+        }
+    }
+    throw std::invalid_argument("Invalid operation for CLSID Compressor.");
 }
 
 int compress(const std::wstring& inFileName, const std::wstring& outFileName)
 {
-	DWORD squat;
-	HANDLE hFile;
-	hFile = CreateFile(inFileName.c_str(),GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_DELETE|FILE_SHARE_WRITE,NULL,OPEN_EXISTING, 0,NULL);
-	if (hFile == INVALID_HANDLE_VALUE)
-		throw std::runtime_error("Could not open input file.");
-	DWORD bufferLength;
-	bufferLength = SetFilePointer(hFile,0,0,FILE_END);
-	SetFilePointer(hFile,0,0,FILE_BEGIN);
-	LPBYTE inputBuffer = new BYTE[bufferLength];
-	if (!ReadFile(hFile,inputBuffer,bufferLength,&squat,NULL))
-	{
-		throw std::runtime_error("Could not read input file.");
-	}
-	std::string rawFileString;
-	if (IsTextUnicode(inputBuffer, bufferLength, NULL))
-		rawFileString.assign(convertUnicode(std::wstring(reinterpret_cast<wchar_t *>(inputBuffer),bufferLength/sizeof(TCHAR))));
-	else
-		rawFileString.assign(std::string(reinterpret_cast<char *>(inputBuffer),bufferLength));
-	CloseHandle(hFile);
-	std::vector<std::string> clsidStrings;
-	boost::algorithm::split(clsidStrings,rawFileString,boost::algorithm::is_any_of(L"\r\n"));
-	for (std::vector<std::string>::iterator curLine = clsidStrings.begin(); curLine != clsidStrings.end(); curLine++)
-	{
-		boost::algorithm::to_upper(*curLine);
-		boost::algorithm::trim(*curLine);
-	}
-	std::sort(clsidStrings.begin(), clsidStrings.end());
-	std::vector<clsidStructure> convertedClsids;
-	std::string invalidClsids;
-	for (std::vector<std::string>::const_iterator it = clsidStrings.begin(); it != clsidStrings.end(); it++)
-	{
-		if (it->empty()) continue;
-		try
-		{
-			//Convert the clsid into a number
-			convertedClsids.push_back(createClsidFromString(*it));
-		} catch (...)
-		{
-			//Invalid CLSID number -- add to invalid list
-			invalidClsids.append(*it).append("\r\n");
-		}
-	}
-	clsidStrings.clear();
-	//Buffer for use to write later
-	std::vector<BYTE> compressedBytes;
+    DWORD squat;
+    HANDLE hFile;
+    hFile = CreateFile(inFileName.c_str(),GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_DELETE|FILE_SHARE_WRITE,NULL,OPEN_EXISTING, 0,NULL);
+    if (hFile == INVALID_HANDLE_VALUE)
+        throw std::runtime_error("Could not open input file.");
+    DWORD bufferLength;
+    bufferLength = SetFilePointer(hFile,0,0,FILE_END);
+    SetFilePointer(hFile,0,0,FILE_BEGIN);
+    LPBYTE inputBuffer = new BYTE[bufferLength];
+    if (!ReadFile(hFile,inputBuffer,bufferLength,&squat,NULL))
+    {
+        throw std::runtime_error("Could not read input file.");
+    }
+    std::string rawFileString;
+    if (IsTextUnicode(inputBuffer, bufferLength, NULL))
+        rawFileString.assign(convertUnicode(std::wstring(reinterpret_cast<wchar_t *>(inputBuffer),bufferLength/sizeof(TCHAR))));
+    else
+        rawFileString.assign(std::string(reinterpret_cast<char *>(inputBuffer),bufferLength));
+    CloseHandle(hFile);
+    std::vector<std::string> clsidStrings;
+    boost::algorithm::split(clsidStrings,rawFileString,boost::algorithm::is_any_of(L"\r\n"));
+    for (std::vector<std::string>::iterator curLine = clsidStrings.begin(); curLine != clsidStrings.end(); curLine++)
+    {
+        boost::algorithm::to_upper(*curLine);
+        boost::algorithm::trim(*curLine);
+    }
+    std::sort(clsidStrings.begin(), clsidStrings.end());
+    std::vector<clsidStructure> convertedClsids;
+    std::string invalidClsids;
+    for (std::vector<std::string>::const_iterator it = clsidStrings.begin(); it != clsidStrings.end(); it++)
+    {
+        if (it->empty()) continue;
+        try
+        {
+            //Convert the clsid into a number
+            convertedClsids.push_back(createClsidFromString(*it));
+        } catch (...)
+        {
+            //Invalid CLSID number -- add to invalid list
+            invalidClsids.append(*it).append("\r\n");
+        }
+    }
+    clsidStrings.clear();
+    //Buffer for use to write later
+    std::vector<BYTE> compressedBytes;
 
-	//Length of invalid string plus length integer plus the size of the CLSID list.
-	compressedBytes.reserve(invalidClsids.length() + 4 + convertedClsids.size() * 16);
+    //Length of invalid string plus length integer plus the size of the CLSID list.
+    compressedBytes.reserve(invalidClsids.length() + 4 + convertedClsids.size() * 16);
 
-	//Append length of invalid string
-	union {
-		DWORD dwordVal;
-		BYTE bytes[4];
-	} invalidLength;
-	invalidLength.dwordVal = (DWORD) invalidClsids.length();
-	compressedBytes.push_back((BYTE)  invalidLength.bytes[0]);
-	compressedBytes.push_back((BYTE)  invalidLength.bytes[1]);
-	compressedBytes.push_back((BYTE)  invalidLength.bytes[2]);
-	compressedBytes.push_back((BYTE)  invalidLength.bytes[3]);
-	//Append invalid string
-	for(register DWORD idx = 0; idx < invalidLength.dwordVal; idx++)
-	{
-		compressedBytes.push_back(invalidClsids[idx]);
-	}
-	invalidClsids.clear();
+    //Append length of invalid string
+    union {
+        DWORD dwordVal;
+        BYTE bytes[4];
+    } invalidLength;
+    invalidLength.dwordVal = (DWORD) invalidClsids.length();
+    compressedBytes.push_back((BYTE)  invalidLength.bytes[0]);
+    compressedBytes.push_back((BYTE)  invalidLength.bytes[1]);
+    compressedBytes.push_back((BYTE)  invalidLength.bytes[2]);
+    compressedBytes.push_back((BYTE)  invalidLength.bytes[3]);
+    //Append invalid string
+    for(register DWORD idx = 0; idx < invalidLength.dwordVal; idx++)
+    {
+        compressedBytes.push_back(invalidClsids[idx]);
+    }
+    invalidClsids.clear();
 
-	//Compress the 128 bit integers
-	clsidStructure differenceValA;
-	ZeroMemory(&differenceValA, sizeof(clsidStructure));
-	clsidStructure differenceValB;
-	ZeroMemory(&differenceValB, sizeof(clsidStructure));
-	clsidStructure previousClsid;
-	ZeroMemory(&previousClsid, sizeof(clsidStructure));
-	BYTE lengthByte = 0;
-	for (size_t idx = 0; idx < convertedClsids.size(); idx += 2)
-	{
-		//Calculate the differences
-		differenceValA = convertedClsids[idx] - previousClsid;
-		previousClsid = convertedClsids[idx];
-		if (idx+1 < convertedClsids.size())
-		{
-			differenceValB = convertedClsids[idx+1] - previousClsid;
-			previousClsid = convertedClsids[idx+1];
-		}
+    //Compress the 128 bit integers
+    clsidStructure differenceValA;
+    ZeroMemory(&differenceValA, sizeof(clsidStructure));
+    clsidStructure differenceValB;
+    ZeroMemory(&differenceValB, sizeof(clsidStructure));
+    clsidStructure previousClsid;
+    ZeroMemory(&previousClsid, sizeof(clsidStructure));
+    BYTE lengthByte = 0;
+    for (size_t idx = 0; idx < convertedClsids.size(); idx += 2)
+    {
+        //Calculate the differences
+        differenceValA = convertedClsids[idx] - previousClsid;
+        previousClsid = convertedClsids[idx];
+        if (idx+1 < convertedClsids.size())
+        {
+            differenceValB = convertedClsids[idx+1] - previousClsid;
+            previousClsid = convertedClsids[idx+1];
+        }
 
-		//Calculate the length byte
-		lengthByte = minLengthOfClsid(differenceValA);
-		if (idx+1 < convertedClsids.size())
-			lengthByte |= (minLengthOfClsid(differenceValB) << 4);
+        //Calculate the length byte
+        lengthByte = minLengthOfClsid(differenceValA);
+        if (idx+1 < convertedClsids.size())
+            lengthByte |= (minLengthOfClsid(differenceValB) << 4);
 
-		//Push the results onto our result stack.
-		compressedBytes.push_back(lengthByte);
-		for(BYTE clsidIdx = 0; clsidIdx < (lengthByte & 0x0F); clsidIdx++)
-		{
-			compressedBytes.push_back(differenceValA.bytes[clsidIdx]);
-		}
-		if (idx+1 < convertedClsids.size())
-			for(BYTE clsidIdx = 0; clsidIdx < (lengthByte >> 4); clsidIdx++)
-			{
-				compressedBytes.push_back(differenceValB.bytes[clsidIdx]);
-			};
-	}
-	convertedClsids.clear();
-	if (lengthByte & 0xF0  >> 4)
-		compressedBytes.push_back(0x00);
+        //Push the results onto our result stack.
+        compressedBytes.push_back(lengthByte);
+        for(BYTE clsidIdx = 0; clsidIdx < (lengthByte & 0x0F); clsidIdx++)
+        {
+            compressedBytes.push_back(differenceValA.bytes[clsidIdx]);
+        }
+        if (idx+1 < convertedClsids.size())
+            for(BYTE clsidIdx = 0; clsidIdx < (lengthByte >> 4); clsidIdx++)
+            {
+                compressedBytes.push_back(differenceValB.bytes[clsidIdx]);
+            };
+    }
+    convertedClsids.clear();
+    if (lengthByte & 0xF0  >> 4)
+        compressedBytes.push_back(0x00);
 
-	hFile = CreateFile(outFileName.c_str(),GENERIC_WRITE, 0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
-	if (hFile == INVALID_HANDLE_VALUE)
-		throw std::runtime_error("Could not open output file.");
-	if (!WriteFile(hFile,&compressedBytes[0],static_cast<DWORD>(compressedBytes.size()),&squat,NULL))
-		throw std::runtime_error("Could not write to output file.");
-	CloseHandle(hFile);
+    hFile = CreateFile(outFileName.c_str(),GENERIC_WRITE, 0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
+    if (hFile == INVALID_HANDLE_VALUE)
+        throw std::runtime_error("Could not open output file.");
+    if (!WriteFile(hFile,&compressedBytes[0],static_cast<DWORD>(compressedBytes.size()),&squat,NULL))
+        throw std::runtime_error("Could not write to output file.");
+    CloseHandle(hFile);
 
-	return 0;
+    return 0;
 }
 
 #define WRITE_ERROR_MESSAGE std::runtime_error("Could not write to output file.")
 
 int decompress(const std::wstring& inFileName, const std::wstring& outFileName, const bool append)
 {
-	HANDLE hInFile;
-	hInFile = CreateFile(inFileName.c_str(),GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_DELETE|FILE_SHARE_WRITE,NULL,OPEN_EXISTING, 0,NULL);
-	if (hInFile == INVALID_HANDLE_VALUE)
-		throw std::runtime_error("Could not open input file.");
-	HANDLE hOutFile;
-	hOutFile = CreateFile(outFileName.c_str(),GENERIC_WRITE, 0,NULL,OPEN_ALWAYS, 0,NULL);
-	if (hOutFile == INVALID_HANDLE_VALUE)
-		throw std::runtime_error("Could not open output file.");
+    HANDLE hInFile;
+    hInFile = CreateFile(inFileName.c_str(),GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_DELETE|FILE_SHARE_WRITE,NULL,OPEN_EXISTING, 0,NULL);
+    if (hInFile == INVALID_HANDLE_VALUE)
+        throw std::runtime_error("Could not open input file.");
+    HANDLE hOutFile;
+    hOutFile = CreateFile(outFileName.c_str(),GENERIC_WRITE, 0,NULL,OPEN_ALWAYS, 0,NULL);
+    if (hOutFile == INVALID_HANDLE_VALUE)
+        throw std::runtime_error("Could not open output file.");
 
-	if (append)
-		SetFilePointer(hOutFile, 0, 0, FILE_END);
-	DWORD invalidLength;
-	DWORD bytesRead;
-	DWORD bytesWritten;
+    if (append)
+        SetFilePointer(hOutFile, 0, 0, FILE_END);
+    DWORD invalidLength;
+    DWORD bytesRead;
+    DWORD bytesWritten;
 
-	if (!ReadFile(hInFile,&invalidLength,4,&bytesRead,NULL))
-		throw READ_ERROR_MESSAGE;
-	if (bytesRead != 4)
-		throw READ_ERROR_MESSAGE;
+    if (!ReadFile(hInFile,&invalidLength,4,&bytesRead,NULL))
+        throw READ_ERROR_MESSAGE;
+    if (bytesRead != 4)
+        throw READ_ERROR_MESSAGE;
 
-	LPBYTE invalids = new BYTE[invalidLength+1];
-	if (!ReadFile(hInFile,invalids,invalidLength,&bytesRead,NULL))
-		throw READ_ERROR_MESSAGE;
-	if (bytesRead != invalidLength)
-		throw READ_ERROR_MESSAGE;
-	if (!WriteFile(hOutFile,invalids,invalidLength,&bytesWritten,NULL))
-		throw WRITE_ERROR_MESSAGE;
-	if (invalidLength != bytesWritten)
-		throw WRITE_ERROR_MESSAGE;
-	delete [] invalids;
+    LPBYTE invalids = new BYTE[invalidLength+1];
+    if (!ReadFile(hInFile,invalids,invalidLength,&bytesRead,NULL))
+        throw READ_ERROR_MESSAGE;
+    if (bytesRead != invalidLength)
+        throw READ_ERROR_MESSAGE;
+    if (!WriteFile(hOutFile,invalids,invalidLength,&bytesWritten,NULL))
+        throw WRITE_ERROR_MESSAGE;
+    if (invalidLength != bytesWritten)
+        throw WRITE_ERROR_MESSAGE;
+    delete [] invalids;
 
-	BYTE clsidLenByte, lengthA;
-	clsidStructure clsidStruct, prevClsid;
-	ZeroMemory(&prevClsid,sizeof(clsidStructure));
-	for (;;)
-	{
-		if (!ReadFile(hInFile,&clsidLenByte,1,&bytesRead,NULL))
-			throw READ_ERROR_MESSAGE;
-		if (!bytesRead)
-			throw READ_ERROR_MESSAGE;
+    BYTE clsidLenByte, lengthA;
+    clsidStructure clsidStruct, prevClsid;
+    ZeroMemory(&prevClsid,sizeof(clsidStructure));
+    for (;;)
+    {
+        if (!ReadFile(hInFile,&clsidLenByte,1,&bytesRead,NULL))
+            throw READ_ERROR_MESSAGE;
+        if (!bytesRead)
+            throw READ_ERROR_MESSAGE;
 
-		lengthA = clsidLenByte & 0x0F;
-		clsidLenByte >>= 4;
-		if (!lengthA)
-			break;
-		ZeroMemory(&clsidStruct,sizeof(clsidStruct));
-		if (!ReadFile(hInFile,clsidStruct.bytes,lengthA,&bytesRead,NULL))
-			throw READ_ERROR_MESSAGE;
-		if (bytesRead != lengthA)
-			throw READ_ERROR_MESSAGE;
-		prevClsid = clsidStruct + prevClsid;
-		if (!WriteFile(hOutFile,
-			createStringFromClsid(prevClsid).c_str(),
-			40,&bytesWritten,NULL))
-			throw WRITE_ERROR_MESSAGE;
-		if (bytesWritten != 40)
-			throw WRITE_ERROR_MESSAGE;
-		if (!clsidLenByte)
-			break;
-		ZeroMemory(&clsidStruct,sizeof(clsidStruct));
-		if (!ReadFile(hInFile,clsidStruct.bytes,clsidLenByte,&bytesRead,NULL))
-			throw READ_ERROR_MESSAGE;
-		if (bytesRead != clsidLenByte)
-			throw READ_ERROR_MESSAGE;
-		prevClsid = clsidStruct + prevClsid;
-		if (!WriteFile(hOutFile,
-			createStringFromClsid(prevClsid).c_str(),
-			40,&bytesWritten,NULL))
-			throw WRITE_ERROR_MESSAGE;
-		if (bytesWritten != 40)
-			throw WRITE_ERROR_MESSAGE;
-	}
-	CloseHandle(hInFile);
-	CloseHandle(hOutFile);
-	return 0;
+        lengthA = clsidLenByte & 0x0F;
+        clsidLenByte >>= 4;
+        if (!lengthA)
+            break;
+        ZeroMemory(&clsidStruct,sizeof(clsidStruct));
+        if (!ReadFile(hInFile,clsidStruct.bytes,lengthA,&bytesRead,NULL))
+            throw READ_ERROR_MESSAGE;
+        if (bytesRead != lengthA)
+            throw READ_ERROR_MESSAGE;
+        prevClsid = clsidStruct + prevClsid;
+        if (!WriteFile(hOutFile,
+            createStringFromClsid(prevClsid).c_str(),
+            40,&bytesWritten,NULL))
+            throw WRITE_ERROR_MESSAGE;
+        if (bytesWritten != 40)
+            throw WRITE_ERROR_MESSAGE;
+        if (!clsidLenByte)
+            break;
+        ZeroMemory(&clsidStruct,sizeof(clsidStruct));
+        if (!ReadFile(hInFile,clsidStruct.bytes,clsidLenByte,&bytesRead,NULL))
+            throw READ_ERROR_MESSAGE;
+        if (bytesRead != clsidLenByte)
+            throw READ_ERROR_MESSAGE;
+        prevClsid = clsidStruct + prevClsid;
+        if (!WriteFile(hOutFile,
+            createStringFromClsid(prevClsid).c_str(),
+            40,&bytesWritten,NULL))
+            throw WRITE_ERROR_MESSAGE;
+        if (bytesWritten != 40)
+            throw WRITE_ERROR_MESSAGE;
+    }
+    CloseHandle(hInFile);
+    CloseHandle(hOutFile);
+    return 0;
 }
 const char hexLetters[] = "0123456789ABCDEF";
 clsidStructure createClsidFromString(const std::string& clsidString)
 {
-	//Sanity check
-	if (
-		(clsidString.length() != 38) ||
-		clsidString[ 0] != '{' ||
-		clsidString[ 9] != '-' ||
-		clsidString[14] != '-' ||
-		clsidString[19] != '-' ||
-		clsidString[24] != '-' ||
-		clsidString[37] != '}'
-		)
-		throw std::invalid_argument("Invalid CLSID");
-	std::string workingClsidString(clsidString);
+    //Sanity check
+    if (
+        (clsidString.length() != 38) ||
+        clsidString[ 0] != '{' ||
+        clsidString[ 9] != '-' ||
+        clsidString[14] != '-' ||
+        clsidString[19] != '-' ||
+        clsidString[24] != '-' ||
+        clsidString[37] != '}'
+        )
+        throw std::invalid_argument("Invalid CLSID");
+    std::string workingClsidString(clsidString);
 
-	//Remove the -s and {}s
-	workingClsidString.erase(0,1);
-	workingClsidString.erase(8,1);
-	workingClsidString.erase(12,1);
-	workingClsidString.erase(16,1);
-	workingClsidString.erase(20,1);
-	workingClsidString.erase(32);
+    //Remove the -s and {}s
+    workingClsidString.erase(0,1);
+    workingClsidString.erase(8,1);
+    workingClsidString.erase(12,1);
+    workingClsidString.erase(16,1);
+    workingClsidString.erase(20,1);
+    workingClsidString.erase(32);
 
-	//Ensure all digits are in hex
-	for(register unsigned int idx = 0; idx < 32; idx++)
-	{
-		if (! ((workingClsidString[idx] >= '0' && workingClsidString[idx] <= '9') || (workingClsidString[idx] >= 'A' && workingClsidString[idx] <= 'F')))
-			throw std::invalid_argument("Invalid CLSID");
-	}
+    //Ensure all digits are in hex
+    for(register unsigned int idx = 0; idx < 32; idx++)
+    {
+        if (! ((workingClsidString[idx] >= '0' && workingClsidString[idx] <= '9') || (workingClsidString[idx] >= 'A' && workingClsidString[idx] <= 'F')))
+            throw std::invalid_argument("Invalid CLSID");
+    }
 
-	clsidStructure clsidStruct;
+    clsidStructure clsidStruct;
 
-	//Convert hex to bytes
-	for (register unsigned int idx = 0; idx < 16; idx++)
-	{
-		clsidStruct.bytes[15-idx] = (BYTE) (strchr(hexLetters,workingClsidString[idx*2]) - hexLetters);
-		clsidStruct.bytes[15-idx] <<= 4;
-		clsidStruct.bytes[15-idx] |= strchr(hexLetters,workingClsidString[idx*2+1]) - hexLetters;
-	}
+    //Convert hex to bytes
+    for (register unsigned int idx = 0; idx < 16; idx++)
+    {
+        clsidStruct.bytes[15-idx] = (BYTE) (strchr(hexLetters,workingClsidString[idx*2]) - hexLetters);
+        clsidStruct.bytes[15-idx] <<= 4;
+        clsidStruct.bytes[15-idx] |= strchr(hexLetters,workingClsidString[idx*2+1]) - hexLetters;
+    }
 
-	return clsidStruct;
+    return clsidStruct;
 }
 
 std::string createStringFromClsid(const clsidStructure& clsidStruct)
 {
-	std::string retVal("{",1);
-	retVal.reserve(40);
-	char temp[2];
-	for(register unsigned int idx=0; idx < 4; idx++)
-	{
-		temp[1] = *(hexLetters + (clsidStruct.bytes[15-idx] & 0x0F));
-		temp[0] = *(hexLetters + (clsidStruct.bytes[15-idx] >> 4));
-		retVal.append(temp,2);
-	}
-	retVal.append("-",1);
-	for(register unsigned int idx=4; idx < 6; idx++)
-	{
-		temp[1] = *(hexLetters + (clsidStruct.bytes[15-idx] & 0x0F));
-		temp[0] = *(hexLetters + (clsidStruct.bytes[15-idx] >> 4));
-		retVal.append(temp,2);
-	}
-	retVal.append("-",1);
-	for(register unsigned int idx=6; idx < 8; idx++)
-	{
-		temp[1] = *(hexLetters + (clsidStruct.bytes[15-idx] & 0x0F));
-		temp[0] = *(hexLetters + (clsidStruct.bytes[15-idx] >> 4));
-		retVal.append(temp,2);
-	}
-	retVal.append("-",1);
-	for(register unsigned int idx=8; idx < 10; idx++)
-	{
-		temp[1] = *(hexLetters + (clsidStruct.bytes[15-idx] & 0x0F));
-		temp[0] = *(hexLetters + (clsidStruct.bytes[15-idx] >> 4));
-		retVal.append(temp,2);
-	}
-	retVal.append("-",1);
-	for(register unsigned int idx=10; idx < 16; idx++)
-	{
-		temp[1] = *(hexLetters + (clsidStruct.bytes[15-idx] & 0x0F));
-		temp[0] = *(hexLetters + (clsidStruct.bytes[15-idx] >> 4));
-		retVal.append(temp,2);
-	}
-	retVal.append("}\r\n",3);
-	return retVal;
+    std::string retVal("{",1);
+    retVal.reserve(40);
+    char temp[2];
+    for(register unsigned int idx=0; idx < 4; idx++)
+    {
+        temp[1] = *(hexLetters + (clsidStruct.bytes[15-idx] & 0x0F));
+        temp[0] = *(hexLetters + (clsidStruct.bytes[15-idx] >> 4));
+        retVal.append(temp,2);
+    }
+    retVal.append("-",1);
+    for(register unsigned int idx=4; idx < 6; idx++)
+    {
+        temp[1] = *(hexLetters + (clsidStruct.bytes[15-idx] & 0x0F));
+        temp[0] = *(hexLetters + (clsidStruct.bytes[15-idx] >> 4));
+        retVal.append(temp,2);
+    }
+    retVal.append("-",1);
+    for(register unsigned int idx=6; idx < 8; idx++)
+    {
+        temp[1] = *(hexLetters + (clsidStruct.bytes[15-idx] & 0x0F));
+        temp[0] = *(hexLetters + (clsidStruct.bytes[15-idx] >> 4));
+        retVal.append(temp,2);
+    }
+    retVal.append("-",1);
+    for(register unsigned int idx=8; idx < 10; idx++)
+    {
+        temp[1] = *(hexLetters + (clsidStruct.bytes[15-idx] & 0x0F));
+        temp[0] = *(hexLetters + (clsidStruct.bytes[15-idx] >> 4));
+        retVal.append(temp,2);
+    }
+    retVal.append("-",1);
+    for(register unsigned int idx=10; idx < 16; idx++)
+    {
+        temp[1] = *(hexLetters + (clsidStruct.bytes[15-idx] & 0x0F));
+        temp[0] = *(hexLetters + (clsidStruct.bytes[15-idx] >> 4));
+        retVal.append(temp,2);
+    }
+    retVal.append("}\r\n",3);
+    return retVal;
 }
 
 const clsidStructure operator-(const clsidStructure& a, const clsidStructure& b)
 {
-	clsidStructure ret(a);
-	ret.bigNums[0] -= b.bigNums[0];
-	ret.bigNums[1] -= b.bigNums[1];
+    clsidStructure ret(a);
+    ret.bigNums[0] -= b.bigNums[0];
+    ret.bigNums[1] -= b.bigNums[1];
     if (ret.bigNums[0] > a.bigNums[0])
         ret.bigNums[1]--;
-	return ret;
+    return ret;
 }
 
 const clsidStructure operator+(const clsidStructure& a, const clsidStructure& b)
 {
-	clsidStructure ret(a);
-	ret.bigNums[0] += b.bigNums[0];
-	ret.bigNums[1] += b.bigNums[1];
-	if (ret.bigNums[0] < a.bigNums[0] || ret.bigNums[0] < b.bigNums[0])
-		ret.bigNums[1]++;
-	return ret;
+    clsidStructure ret(a);
+    ret.bigNums[0] += b.bigNums[0];
+    ret.bigNums[1] += b.bigNums[1];
+    if (ret.bigNums[0] < a.bigNums[0] || ret.bigNums[0] < b.bigNums[0])
+        ret.bigNums[1]++;
+    return ret;
 }
 
 } //namespace CLSIDCompressor

File pevLib/clsidCompressor.h

View file
  • Ignore whitespace
 // by the CLSID compressor and decompressor.
 
 namespace clsidCompressor {
-	int main(int argc, wchar_t* argv[]);
+    int main(int argc, wchar_t* argv[]);
 }; //namespace clsidCompressor

File pevLib/consoleParser.cpp

View file
  • Ignore whitespace
 {
     using namespace boost::xpressive;
     mark_tag argument(2), option(3);
-    wsregex tokenRegex =	(argument= as_xpr(L"{")) | (argument= as_xpr("}")) | as_xpr(L'"') >> (*as_xpr(L'-') >> (argument= as_xpr(L'-') >> +(~set[_s | (set= L'"', L'#', L'{', L'}') ])) >>
+    wsregex tokenRegex =    (argument= as_xpr(L"{")) | (argument= as_xpr("}")) | as_xpr(L'"') >> (*as_xpr(L'-') >> (argument= as_xpr(L'-') >> +(~set[_s | (set= L'"', L'#', L'{', L'}') ])) >>
         !(as_xpr(L'#') >> (option= +(as_xpr(L'#') >> set[range(L'A', L'Z') | range(L'a', L'z') | range(L'0', L'9')
         | L'#' ]| ~set[L'#'])) >> L'#' | as_xpr(L'"') >> (option= +(L"\"\"" | ~set[L'"'])) >> L'"')) >> L'"' |
                             as_xpr(L'"') >> (argument= +(L"\"\"" |~set[L'"'])) >> L'"' |
     do {
         if(      istarts_with(token.argument, L"custom"))
         {
-            globalOptions::displaySpecification = token.option;	
+            globalOptions::displaySpecification = token.option;    
             return;
         }
         else if (istarts_with(token.argument, L"c"))
 }
 void consoleParser::processAbsoluteDate( std::wstring& toProcess, FILETIME& lowerBound, FILETIME& upperBound)
 {
-    long		v;
+    long        v;
     SYSTEMTIME now;
     SYSTEMTIME st;
     int significantFigures = 0;

File pevLib/criterion.h

View file
  • Ignore whitespace
 class criterion
 {
 public:
-	virtual unsigned __int32 getPriorityClass() const = 0;
-	virtual BOOL include(FileData &file) const = 0;
-	virtual void reorderTree() {};
-	virtual unsigned int directoryCheck(const std::wstring& /*directory*/) { return DIRECTORY_DONTCARE; };
-	virtual std::wstring debugTree() const = 0;
-	virtual ~criterion() {}; //Virtual destructor DO NOT REMOVE!
-	virtual void makeNonRecursive() {};
+    virtual unsigned __int32 getPriorityClass() const = 0;
+    virtual BOOL include(FileData &file) const = 0;
+    virtual void reorderTree() {};
+    virtual unsigned int directoryCheck(const std::wstring& /*directory*/) { return DIRECTORY_DONTCARE; };
+    virtual std::wstring debugTree() const = 0;
+    virtual ~criterion() {}; //Virtual destructor DO NOT REMOVE!
+    virtual void makeNonRecursive() {};
 };
 
 //Functor which converts pointers to criteria to priority classes
 static struct _getPriorityFunctor : std::unary_function<const criterion*, __int32>
 {
-	__int32 operator()(const std::shared_ptr<criterion> crit)
-	{
-		return crit->getPriorityClass();
-	};
+    __int32 operator()(const std::shared_ptr<criterion> crit)
+    {
+        return crit->getPriorityClass();
+    };
 } getPriorityFunctor;
 
 static struct _criterionByPriorityClass : std::binary_function<const std::shared_ptr<criterion>, std::shared_ptr<criterion>, bool>
 {
-	bool operator()(const std::shared_ptr<criterion> a, const std::shared_ptr<criterion> b)
-	{
-		return a->getPriorityClass() < b->getPriorityClass();
-	}
+    bool operator()(const std::shared_ptr<criterion> a, const std::shared_ptr<criterion> b)
+    {
+        return a->getPriorityClass() < b->getPriorityClass();