diff options
Diffstat (limited to 'core/helpers.cpp')
-rw-r--r-- | core/helpers.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/core/helpers.cpp b/core/helpers.cpp index c03c3b62..a2f1a6c9 100644 --- a/core/helpers.cpp +++ b/core/helpers.cpp @@ -40,9 +40,12 @@ const PathNamePair &GetProcBinary() if(procbin) return *procbin; auto fullpath = al::vector<WCHAR>(256); - DWORD len; - while((len=GetModuleFileNameW(nullptr, fullpath.data(), static_cast<DWORD>(fullpath.size()))) == fullpath.size()) + DWORD len{GetModuleFileNameW(nullptr, fullpath.data(), static_cast<DWORD>(fullpath.size()))}; + while(len == fullpath.size()) + { fullpath.resize(fullpath.size() << 1); + len = GetModuleFileNameW(nullptr, fullpath.data(), static_cast<DWORD>(fullpath.size())); + } if(len == 0) { ERR("Failed to get process name: error %lu\n", GetLastError()); |