-
Notifications
You must be signed in to change notification settings - Fork 2
/
bltool.c
46 lines (41 loc) · 1.03 KB
/
bltool.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
FILE *misc;
if(argc == 3) {
misc = fopen(argv[1], "r+b");
} else {
goto quit;
}
if(NULL == misc) {
fprintf(stderr, "File could not be opened.\n");
return 1;
}
if(fseek(misc, 224L, SEEK_SET) != 0) {
fprintf(stderr, "Could not find offset in file.\n");
fclose(misc);
return 1;
}
if(argc == 3 && strcmp(argv[2], "unlock") == 0) {
fwrite("HTCU", 4, 1, misc);
} else if(argc == 3 && strcmp(argv[2], "relock") == 0) {
fwrite("HTCL", 4, 1, misc);
} else if(argc == 3 && strcmp(argv[2], "lock") == 0) {
fwrite("\0\0\0\0", 4, 1, misc);
} else if(argc == 3 && strcmp(argv[2], "superversion") == 0) {
if(fseek(misc, 160L, SEEK_SET) != 0) {
printf("Could not find offset in file.\n");
fclose(misc);
return 1;
}
fwrite("0.0.0.0\0\0\0\0\0\0\0\0\0", 16, 1, misc);
} else {
fclose(misc);
quit:
fprintf(stderr, "usage:bltool <file> <option>\nOptions: unlock|relock|lock|superversion\n");
return 1;
}
fclose(misc);
return 0;
}