Skip to content

Instantly share code, notes, and snippets.

Created October 21, 2015 08:09
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save hanjianwei/14e9a21c64fe286107d1 to your computer and use it in GitHub Desktop.
Check if a Windows exe built with Unity.
#include <stdio.h>
#include <string.h>
int check_unity(const char *filename)
FILE *f = fopen(filename, "rb");
const char *s = "UnityPlayer";
char buf[20];
int len = strlen(s);
int is_unity = 0;
if (!f)
return 0;
fseek(f, 8545324, SEEK_SET);
fscanf(f, "%15s", buf);
if (strncmp(s, buf, len) == 0)
is_unity = 1;
return is_unity;
int main(int argc, char *argv[])
if (argc < 2) {
printf("Usage: %s <filename>\n", argv[0]);
return 1;
if (check_unity(argv[1]))
printf("Not Unity\n");
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment