MCPcopy Create free account
hub / github.com/ThirteenAG/Ultimate-ASI-Loader / GetModulePath

Function GetModulePath

source/dllmain.cpp:398–420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

396}
397
398std::wstring GetModulePath(HMODULE hModule)
399{
400 static constexpr auto INITIAL_BUFFER_SIZE = MAX_PATH;
401 static constexpr auto MAX_ITERATIONS = 7;
402 std::wstring ret;
403 auto bufferSize = INITIAL_BUFFER_SIZE;
404 for (size_t iterations = 0; iterations < MAX_ITERATIONS; ++iterations)
405 {
406 ret.resize(bufferSize);
407 size_t charsReturned = 0;
408 charsReturned = GetModuleFileNameW(hModule, ret.data(), bufferSize);
409 if (charsReturned < ret.length())
410 {
411 ret.resize(charsReturned);
412 return ret;
413 }
414 else
415 {
416 bufferSize *= 2;
417 }
418 }
419 return std::wstring();
420}
421
422std::wstring GetExeModulePath()
423{

Callers 3

GetExeModulePathFunction · 0.70
InitFunction · 0.70

Calls 1

GetModuleFileNameWFunction · 0.85

Tested by

no test coverage detected