Files
HexUnlocked/src/unlocker/utils.cpp
T
neru 6aeb90cc82
Build / build (push) Failing after 7m17s
build: add win-platform.h
2026-06-19 12:24:40 -03:00

26 lines
658 B
C++

#include "utils.h"
#include "win-platform.h"
#include <libloaderapi.h>
std::string utils::getExePath()
{
char buffer[MAX_PATH];
GetModuleFileNameA(NULL, buffer, MAX_PATH);
std::string path(buffer);
size_t pos = path.find_last_of("\\/");
if (pos != std::string::npos) return path.substr(0, pos + 1);
return "";
}
std::string utils::randomizeString(size_t length)
{
const char charset[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
std::string result;
result.resize(length);
for (size_t i = 0; i < length; ++i)
result[i] = charset[rand() % (sizeof(charset) - 1)];
return result;
}