// SPDX-License-Identifier: MIT #pragma once #include #include #include namespace FEX::Windows { fextl::string GetExecutableFilePath() { std::array Buf; UNICODE_STRING PathW {.Length = 0, .MaximumLength = Buf.size() * sizeof(WCHAR), .Buffer = Buf.data()}; if (LdrGetDllFullName(nullptr, &PathW)) { return {}; } STRING PathA; RtlUnicodeStringToAnsiString(&PathA, &PathW, TRUE); fextl::string Path(PathA.Buffer); RtlFreeAnsiString(&PathA); return Path.substr(Path.find_last_of('\\') + 1); } } // namespace FEX::Windows