Check if it's running under Linux

This commit is contained in:
EnderIce2 2024-01-26 03:34:00 +02:00
parent cba4fa1e2b
commit d2b23eb2e8
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD

17
main.c
View File

@ -52,6 +52,23 @@ void DetectWine()
GetErrorMessage(), MB_OK | MB_ICONINFORMATION);
ExitProcess(1);
}
static void(CDECL * wine_get_host_version)(const char **sysname, const char **release);
wine_get_host_version = (void *)GetProcAddress(hNTdll, "wine_get_host_version");
assert(wine_get_host_version);
const char *__sysname;
const char *__release;
wine_get_host_version(&__sysname, &__release);
if (strcmp(__sysname, "Linux") != 0)
{
int result = MessageBox(NULL, "This program is designed for Linux only!\nDo you want to proceed?",
NULL, MB_YESNO | MB_ICONQUESTION);
if (result == IDYES)
return;
else if (result == IDNO)
ExitProcess(1);
}
}
void print(char const *fmt, ...)