From 2d29900df59af14936162e595a0e45c8923a6127 Mon Sep 17 00:00:00 2001 From: neru Date: Fri, 19 Jun 2026 04:47:58 -0300 Subject: [PATCH] feat: add getExePath --- src/unlocker/utils.cpp | 13 +++++++++++++ src/unlocker/utils.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/unlocker/utils.cpp b/src/unlocker/utils.cpp index a0dd62a..f19ea77 100644 --- a/src/unlocker/utils.cpp +++ b/src/unlocker/utils.cpp @@ -1,5 +1,18 @@ #include "utils.h" +#include +#include + +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"; diff --git a/src/unlocker/utils.h b/src/unlocker/utils.h index dac0119..427856b 100644 --- a/src/unlocker/utils.h +++ b/src/unlocker/utils.h @@ -4,5 +4,6 @@ namespace utils { + std::string getExePath(); std::string randomizeString(size_t length); }