| 164 | } |
| 165 | |
| 166 | std::string GetUnrealEngineVersion(const std::string& filePath, const std::string& exeName) { |
| 167 | DWORD processID = 0; |
| 168 | std::string version; |
| 169 | // If the process is running, try to scan its memory first. |
| 170 | if (IsProcessRunning(exeName, processID)) { |
| 171 | std::cout << "Process " << exeName << " is running (PID: " << processID << "). Attaching...\n"; |
| 172 | HANDLE hProcess = OpenProcess(PROCESS_VM_READ | PROCESS_QUERY_INFORMATION, FALSE, processID); |
| 173 | if (hProcess) { |
| 174 | version = GetVersionFromProcessMemory(hProcess); |
| 175 | CloseHandle(hProcess); |
| 176 | } |
| 177 | } |
| 178 | // Fall back to file-based methods. |
| 179 | if (version.empty() || version == "EngineVersion" || version == "FEngineVersion") |
| 180 | version = GetVersionFromResource(filePath); |
| 181 | if (version.empty()) |
| 182 | version = GetVersionFromFiles(filePath); |
| 183 | if (version.empty()) |
| 184 | version = GetVersionFromMemoryScan(); |
| 185 | return version.empty() ? "Unknown" : version; |
| 186 | } |
no test coverage detected