mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-13 06:00:29 +02:00
Merge pull request #5124 from bylaws/wfnamec
Windows: Switch GetSection/ExecutableFilePath to returning full paths
This commit is contained in:
3 files changed
+18
-14
No files matched your search
@@ -328,7 +328,7 @@ void LoadImageVolatileMetadata(const fextl::string& ModuleName, uint64_t Address
|
||||
}
|
||||
|
||||
void HandleImageMap(uint64_t Address) {
|
||||
fextl::string ModuleName = FEX::Windows::GetSectionFilePath(Address);
|
||||
fextl::string ModuleName = fextl::string {FEX::Windows::BaseName(FEX::Windows::GetSectionFilePath(Address))};
|
||||
LogMan::Msg::DFmt("Load module {}: {:X}", ModuleName, Address);
|
||||
FEX_CONFIG_OPT(VolatileMetadata, VOLATILEMETADATA);
|
||||
if (VolatileMetadata) {
|
||||
@@ -626,8 +626,8 @@ NTSTATUS ProcessInit() {
|
||||
InitSyscalls();
|
||||
|
||||
FEX::Windows::InitCRTProcess();
|
||||
const auto ExecutablePath = FEX::Windows::GetExecutableFilePath();
|
||||
FEX::Config::LoadConfig(ExecutablePath, _environ, FEX::ReadPortabilityInformation());
|
||||
const auto ExecutableName = FEX::Windows::BaseName(FEX::Windows::GetExecutableFilePath());
|
||||
FEX::Config::LoadConfig(fextl::string {ExecutableName}, _environ, FEX::ReadPortabilityInformation());
|
||||
FEXCore::Config::ReloadMetaLayer();
|
||||
FEX::Windows::Logging::Init();
|
||||
|
||||
@@ -688,8 +688,8 @@ NTSTATUS ProcessInit() {
|
||||
StatAllocHandler = fextl::make_unique<FEX::Windows::StatAlloc>(FEXCore::SHMStats::AppType::WIN_ARM64EC);
|
||||
}
|
||||
|
||||
if (StartupSleep() && (StartupSleepProcName().empty() || ExecutablePath == StartupSleepProcName())) {
|
||||
LogMan::Msg::IFmt("[{}][{}] Sleeping for {} seconds", GetCurrentProcessId(), ExecutablePath, StartupSleep());
|
||||
if (StartupSleep() && (StartupSleepProcName().empty() || ExecutableName == StartupSleepProcName())) {
|
||||
LogMan::Msg::IFmt("[{}][{}] Sleeping for {} seconds", GetCurrentProcessId(), ExecutableName, StartupSleep());
|
||||
std::this_thread::sleep_for(std::chrono::seconds(StartupSleep()));
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <winternl.h>
|
||||
|
||||
namespace FEX::Windows {
|
||||
fextl::string GetExecutableFilePath() {
|
||||
inline fextl::string GetExecutableFilePath() {
|
||||
std::array<WCHAR, PATH_MAX> Buf;
|
||||
UNICODE_STRING PathW {.Length = 0, .MaximumLength = Buf.size() * sizeof(WCHAR), .Buffer = Buf.data()};
|
||||
|
||||
@@ -19,16 +19,16 @@ fextl::string GetExecutableFilePath() {
|
||||
fextl::string Path(PathA.Buffer);
|
||||
RtlFreeAnsiString(&PathA);
|
||||
|
||||
return Path.substr(Path.find_last_of('\\') + 1);
|
||||
return Path;
|
||||
}
|
||||
|
||||
fextl::string GetSectionFilePath(uint64_t Address) {
|
||||
inline fextl::string GetSectionFilePath(uint64_t Address) {
|
||||
struct {
|
||||
MEMORY_SECTION_NAME Info;
|
||||
std::array<WCHAR, PATH_MAX> PathW;
|
||||
} Buffer;
|
||||
|
||||
if (NtQueryVirtualMemory(GetCurrentProcess(), reinterpret_cast<void*>(Address), MemoryMappedFilenameInformation, &Buffer, sizeof(Buffer), NULL)) {
|
||||
if (NtQueryVirtualMemory(NtCurrentProcess(), reinterpret_cast<void*>(Address), MemoryMappedFilenameInformation, &Buffer, sizeof(Buffer), NULL)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -37,6 +37,10 @@ fextl::string GetSectionFilePath(uint64_t Address) {
|
||||
fextl::string Path(PathA.Buffer);
|
||||
RtlFreeAnsiString(&PathA);
|
||||
|
||||
return Path;
|
||||
}
|
||||
|
||||
inline std::string_view BaseName(std::string_view Path) {
|
||||
return Path.substr(Path.find_last_of('\\') + 1);
|
||||
}
|
||||
} // namespace FEX::Windows
|
||||
@@ -187,7 +187,7 @@ void LoadImageVolatileMetadata(const fextl::string& ModuleName, uint64_t Address
|
||||
}
|
||||
|
||||
void HandleImageMap(uint64_t Address) {
|
||||
fextl::string ModuleName = FEX::Windows::GetSectionFilePath(Address);
|
||||
fextl::string ModuleName = fextl::string {FEX::Windows::BaseName(FEX::Windows::GetSectionFilePath(Address))};
|
||||
LogMan::Msg::DFmt("Load module {}: {:X}", ModuleName, Address);
|
||||
FEX_CONFIG_OPT(VolatileMetadata, VOLATILEMETADATA);
|
||||
if (VolatileMetadata) {
|
||||
@@ -508,8 +508,8 @@ public:
|
||||
|
||||
void BTCpuProcessInit() {
|
||||
FEX::Windows::InitCRTProcess();
|
||||
const auto ExecutablePath = FEX::Windows::GetExecutableFilePath();
|
||||
FEX::Config::LoadConfig(ExecutablePath, _environ, FEX::ReadPortabilityInformation());
|
||||
const auto ExecutableName = FEX::Windows::BaseName(FEX::Windows::GetExecutableFilePath());
|
||||
FEX::Config::LoadConfig(fextl::string {ExecutableName}, _environ, FEX::ReadPortabilityInformation());
|
||||
FEXCore::Config::ReloadMetaLayer();
|
||||
FEX::Windows::Logging::Init();
|
||||
|
||||
@@ -582,8 +582,8 @@ void BTCpuProcessInit() {
|
||||
StatAllocHandler = fextl::make_unique<FEX::Windows::StatAlloc>(FEXCore::SHMStats::AppType::WIN_WOW64);
|
||||
}
|
||||
|
||||
if (StartupSleep() && (StartupSleepProcName().empty() || ExecutablePath == StartupSleepProcName())) {
|
||||
LogMan::Msg::IFmt("[{}][{}] Sleeping for {} seconds", GetCurrentProcessId(), ExecutablePath, StartupSleep());
|
||||
if (StartupSleep() && (StartupSleepProcName().empty() || ExecutableName == StartupSleepProcName())) {
|
||||
LogMan::Msg::IFmt("[{}][{}] Sleeping for {} seconds", GetCurrentProcessId(), ExecutableName, StartupSleep());
|
||||
std::this_thread::sleep_for(std::chrono::seconds(StartupSleep()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user