| 7 | #include "nt.h" |
| 8 | |
| 9 | std::wstring kdmUtils::GetFullTempPath() { |
| 10 | wchar_t temp_directory[MAX_PATH + 1] = { 0 }; |
| 11 | const uint32_t get_temp_path_ret = GetTempPathW(sizeof(temp_directory) / 2, temp_directory); |
| 12 | if (!get_temp_path_ret || get_temp_path_ret > MAX_PATH + 1) { |
| 13 | Log::Error("Failed to get temp path", false); |
| 14 | return L""; |
| 15 | } |
| 16 | if (temp_directory[wcslen(temp_directory) - 1] == L'\\') |
| 17 | temp_directory[wcslen(temp_directory) - 1] = 0x0; |
| 18 | |
| 19 | return std::wstring(temp_directory); |
| 20 | } |
| 21 | |
| 22 | bool kdmUtils::ReadFileToMemory(const std::wstring& file_path, std::vector<BYTE>* out_buffer) { |
| 23 | std::ifstream file_ifstream(file_path, std::ios::binary); |