MCPcopy Create free account
hub / github.com/BYVoid/OpenCC / GetModulePath

Function GetModulePath

src/Config.cpp:228–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226}
227
228std::string GetModulePath(HMODULE module) {
229 std::wstring buffer(MAX_PATH, L'\0');
230 for (;;) {
231 DWORD copied =
232 GetModuleFileNameW(module, buffer.data(), static_cast<DWORD>(buffer.size()));
233 if (copied == 0) {
234 return "";
235 }
236 if (copied < buffer.size() - 1) {
237 buffer.resize(copied);
238 return NormalizeModulePath(Utf8FromWide(buffer));
239 }
240 buffer.resize(buffer.size() * 2);
241 }
242}
243
244std::string GetCurrentProcessModulePath() {
245 return GetModulePath(nullptr);

Callers 2

Calls 5

NormalizeModulePathFunction · 0.85
Utf8FromWideFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected