From 63d0d35656306ac6b93030689ec3d24efa2a079c Mon Sep 17 00:00:00 2001 From: wuggy Date: Thu, 9 Jul 2026 21:58:09 +0100 Subject: [PATCH] Initial commit --- main.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 main.c diff --git a/main.c b/main.c new file mode 100644 index 0000000..6562199 --- /dev/null +++ b/main.c @@ -0,0 +1,83 @@ +#include +#include + +typedef BOOL (WINAPI *GETVERSIONEXA)(LPOSVERSIONINFOA); + +BOOL WINAPI FakeGetVersionExA(LPOSVERSIONINFOA lpVersionInformation) +{ + if (!lpVersionInformation) return FALSE; + + lpVersionInformation->dwMajorVersion = 5; + lpVersionInformation->dwMinorVersion = 1; + lpVersionInformation->dwBuildNumber = 2600; + lpVersionInformation->dwPlatformId = VER_PLATFORM_WIN32_NT; + + if (lpVersionInformation->dwOSVersionInfoSize == sizeof(OSVERSIONINFOA)) + lstrcpyA(lpVersionInformation->szCSDVersion, "Service Pack 3"); + + return TRUE; +} + +void PatchGetVersionEx() +{ + HMODULE hKernel; + FARPROC real; + DWORD oldProtect; + BYTE *p; + DWORD rel; + + hKernel = GetModuleHandleA("kernel32.dll"); + if (!hKernel) + return; + + real = GetProcAddress(hKernel, "GetVersionExA"); + if (!real) + return; + + // Allow writing to the first 5 bytes + if (!VirtualProtect((LPVOID)real, 5, PAGE_EXECUTE_READWRITE, &oldProtect)) + return; + + p = (BYTE*)real; + rel = (DWORD)FakeGetVersionExA - ((DWORD)real + 5); + + p[0] = 0xE9; // JMP rel32 + *(DWORD*)(p + 1) = rel; // Write relative offset + + // Restore protection + VirtualProtect((LPVOID)real, 5, oldProtect, &oldProtect); +} + +int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow) +{ + const char targetExe[] = "dactyloidae.exe"; + char exePath[MAX_PATH]; + char *p; + STARTUPINFOA si; + PROCESS_INFORMATION pi; + + PatchGetVersionEx(); + + GetModuleFileNameA(NULL, exePath, MAX_PATH); + + p = strrchr(exePath, '\\'); + if (!p) + return 0; + + lstrcpyA(p + 1, targetExe); + + ZeroMemory(&si, sizeof(si)); + ZeroMemory(&pi, sizeof(pi)); + si.cb = sizeof(si); + + if (!CreateProcessA(exePath, NULL, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) + { + MessageBoxA(NULL, "Failed to launch Dactyloidae.", "Error", MB_ICONERROR); + return 0; + } + + CloseHandle(pi.hThread); + CloseHandle(pi.hProcess); + + return 0; +} \ No newline at end of file