| 459 | } |
| 460 | |
| 461 | bool WolfPro::writeFile(const tString& filePath, std::vector<uint8_t>& bytes) const |
| 462 | { |
| 463 | HANDLE hFile = CreateFile(filePath.c_str(), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, 0, NULL); |
| 464 | |
| 465 | if (hFile == INVALID_HANDLE_VALUE) |
| 466 | { |
| 467 | ERROR_LOG << vFormat(LOCALIZE("open_file_error_msg"), filePath) << std::endl; |
| 468 | return false; |
| 469 | } |
| 470 | |
| 471 | DWORD dwBytesWritten = 0; |
| 472 | |
| 473 | BOOL bResult = WriteFile(hFile, bytes.data(), static_cast<DWORD>(bytes.size()), &dwBytesWritten, NULL); |
| 474 | CloseHandle(hFile); |
| 475 | |
| 476 | if (!bResult) |
| 477 | { |
| 478 | ERROR_LOG << vFormat(LOCALIZE("write_file_error_msg"), filePath) << std::endl; |
| 479 | return false; |
| 480 | } |
| 481 | |
| 482 | return true; |
| 483 | } |
| 484 | |
| 485 | std::vector<uint8_t> WolfPro::decrypt(const tString& filePath, const SeedIncides seedIdx) const |
| 486 | { |