Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <fstream>
- #include <iostream>
- #include <Windows.h>
- #include <stdlib.h>
- #include <io.h>
- using namespace std;
- class MD6
- {
- public:
- string folderPath;
- void CreateFilesList()
- {
- WIN32_FIND_DATAW findData;
- HANDLE hf;
- neededFolderPath = folderPath + "*.*";
- wstring s(neededFolderPath.begin(), neededFolderPath.end());
- hf = FindFirstFileW(s.c_str(), &findData);
- do { //
- if (findData.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE)
- {
- wcstombs(s2, findData.cFileName, 249);
- fileName = s2;
- filePath = folderPath + fileName;
- filePath = Exe + filePath;
- char *hashingFile = &filePath[0u];
- ofstream Name("Name.txt");
- wcout << endl << "File name: " << findData.cFileName << endl;
- char *N = &fileName[0u];
- Name << N;
- Name.close();
- printf("MD6 Hash =");
- system(hashingFile);
- char buff[64];
- string str;
- int i = 0;
- string path;
- char hash[64];
- string name;
- ifstream Name_check("Name.txt");
- Name_check >> name;
- ifstream Hash("FName.txt");
- Hash >> buff;
- string H = string(hash);
- ifstream file;
- file.open("files_list.txt");
- for (str; getline(file, str);)
- {
- i++;
- if (i % 2 != 0)
- {
- file >> str;
- path = str;
- if (path == name)
- {
- i++;
- file>>str;
- H = str;
- string B = buff;
- if (B == H)
- {
- cout << "Файл не повреждён!!!\n";
- }
- else{ cout << "Файл повреждён или не существует"; }
- Hash.close();
- i = i - 1;
- cout << i;
- }
- }Name.close();
- }
- file.close();
- }
- } while (FindNextFileW(hf, &findData));
- FindClose(hf);
- }
- private:
- string Exe = "MD6.exe ", fileName, neededFolderPath, filePath;
- int size;
- char s2[];
- long FileSize(string filePath)
- {
- char *tempSize = &filePath[0u];
- long nFileLen = 0;
- struct _finddata_t fData;
- int res = _findfirst(tempSize, &fData);
- if (res > 0)
- nFileLen = fData.size;
- return(nFileLen);
- }
- }MD6;
- int main()
- {
- setlocale(LC_ALL, "rus");
- cout << "Enter directory path: " << endl;
- cin >> MD6.folderPath;
- MD6.CreateFilesList();
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement