MCPcopy Create free account
hub / github.com/Sinflower/UberWolf / writeFile

Method writeFile

UberWolfLib/WolfPro.cpp:461–483  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

459}
460
461bool 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
485std::vector<uint8_t> WolfPro::decrypt(const tString& filePath, const SeedIncides seedIdx) const
486{

Callers

nothing calls this directly

Calls 3

vFormatFunction · 0.85
dataMethod · 0.80
sizeMethod · 0.80

Tested by

no test coverage detected