#include #include #include /* Patch for ST3 to accept any correctly formatted license ----- BEGIN LICENSE ----- rufo Unlimited User License EA7E-700000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ----- END LICENSE ----- */ int main(int argc, char *argv[]) { long int OFFSET = 0xae011; unsigned char OLD[] = { 0x89, 0x44, 0x24, 0x0c, 0xe8, 0x76, 0x85, 0x34, 0x00, 0x8b, 0x44, 0x24, 0x0c }; unsigned char NEW[] = { 0xe8, 0x7a, 0x85, 0x34, 0x00, 0xb8, 0x02, 0x00, 0x00, 0x00, 0x90, 0x90, 0x90 }; if (argc != 2) { printf("Sublime Text 3 build 3141 (64-bit) patcher\nUsage: %s /opt/sublime_text/sublime_text\n", argv[0]); return 0; } FILE *fp; fp = fopen(argv[1], "r+"); if (fp == NULL) { printf("Failed to open %s for writing. Do you have permission?\n", argv[1]); return 1; } bool found, success = false; if (fseek(fp, OFFSET, SEEK_SET) == 0) { char buf[sizeof(OLD)]; if (fread(buf, sizeof(OLD), 1, fp) == 1) { found = (memcmp(buf, OLD, sizeof(OLD)) == 0); } } if (found) { fseek(fp, OFFSET, SEEK_SET); if (fwrite(NEW, sizeof(NEW), 1, fp) == 1) { puts("Patch successful!"); success = true; } else { puts("Failed to write patch"); } } else { puts("Incorrect version of file or it may already be patched"); } fclose(fp); return (success ? 0 : 1); }