int wmain(int argc, wchar_t *argv[]) { if (argc < 2) { printf("usage: ReviveInjector.exe [/handle] <process path/process handle>\n"); return -1; } WCHAR LogPath[MAX_PATH]; if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, LogPath))) { wcsncat(LogPath, L"\\Revive", MAX_PATH); BOOL exists = PathFileExists(LogPath); if (!exists) exists = CreateDirectory(LogPath, NULL); wcsncat(LogPath, L"\\ReviveInjector.txt", MAX_PATH); if (exists) g_LogFile = _wfopen(LogPath, L"w"); } LOG("Launched injector with: %ls\n", GetCommandLine()); bool xr = !IsSteamVRRunning(); WCHAR path[MAX_PATH] = { 0 }; for (int i = 1; i < argc; i++) { if (wcscmp(argv[i], L"/xr") == 0) { xr = true; } else if (wcscmp(argv[i], L"/revive") == 0) { xr = false; } else if (wcscmp(argv[i], L"/handle") == 0) { return OpenProcessAndInject(argv[++i], xr); } else if (wcscmp(argv[i], L"/base") == 0) { if (!GetOculusBasePath(path, MAX_PATH)) return -1; wnsprintf(path, MAX_PATH, L"%s\\%s ", path, argv[++i]); } else if (wcscmp(argv[i], L"/library") == 0) { if (!GetDefaultLibraryPath(path, MAX_PATH)) return -1; wnsprintf(path, MAX_PATH, L"%s\\%s ", path, argv[++i]); } else { // Concatenate all other arguments wcsncat(path, argv[i], MAX_PATH); wcsncat(path, L" ", MAX_PATH); } } return CreateProcessAndInject(path, xr); }
int main(int argc, char *argv[]) { if (argc < 2) { printf("usage: ReviveInjector.exe [/handle] <process path/process handle>\n"); return -1; } if (strcmp(argv[1], "/handle") == 0 && argc > 2) return OpenProcessAndInject(argv[2]); else return CreateProcessAndInject(argv[1]); }
int wmain(int argc, wchar_t *argv[]) { if (argc < 2) { printf("usage: ReviveInjector.exe [/handle] <process path/process handle>\n"); return -1; } WCHAR LogPath[MAX_PATH]; if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, LogPath))) { wcsncat(LogPath, L"\\Revive", MAX_PATH); BOOL exists = PathFileExists(LogPath); if (!exists) exists = CreateDirectory(LogPath, NULL); wcsncat(LogPath, L"\\ReviveInjector.log", MAX_PATH); if (exists) g_LogFile = _wfopen(LogPath, L"w"); } LOG("Launched injector with: %ls\n", GetCommandLine()); for (int i = 0; i < argc - 1; i++) { if (wcscmp(argv[i], L"/handle") == 0) return OpenProcessAndInject(argv[i + 1]); // Prepend the base path if (wcscmp(argv[i], L"/base") == 0) { // Replace all forward slashes with backslashes in the argument wchar_t* arg = argv[i + 1]; for (wchar_t* ptr = arg; *ptr != L'\0'; ptr++) if (*ptr == L'/') *ptr = L'\\'; DWORD size = MAX_PATH; WCHAR path[MAX_PATH]; HKEY oculusKey; RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Oculus VR, LLC\\Oculus", 0, KEY_READ | KEY_WOW64_32KEY, &oculusKey); RegQueryValueEx(oculusKey, L"Base", NULL, NULL, (PBYTE)path, &size); wcsncat(path, arg, MAX_PATH); return CreateProcessAndInject(path); } } return CreateProcessAndInject(argv[argc - 1]); }