2018-07-17 14:05:22 +02:00
|
|
|
//for printf()
|
|
|
|
#include <stdio.h>
|
|
|
|
//for errno
|
|
|
|
#include <errno.h>
|
|
|
|
//for strerror()
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
//Import our code
|
|
|
|
#include "decrypt.h"
|
|
|
|
|
|
|
|
void getFileReader(unsigned char path[], unsigned long offset, unsigned long length) {
|
|
|
|
//Opens the given file at the given address
|
|
|
|
//Returns a function that will read into memory and return that memory.
|
|
|
|
|
|
|
|
FILE *fileFrom = NULL;
|
|
|
|
char* fileName = path;
|
|
|
|
|
|
|
|
fileFrom = fopen(fileName, "r");
|
|
|
|
if (fileFrom == NULL) {
|
|
|
|
fprintf(stderr, "Could not open file %s for reading: %s\n", fileName, strerror(errno));
|
|
|
|
//error();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, unsigned char *argv[]) {
|
|
|
|
printf("Hello World!\n");
|
|
|
|
|
2018-07-17 15:05:57 +02:00
|
|
|
//Initialise file reader
|
2018-07-17 14:05:22 +02:00
|
|
|
getFileReader("1234", 0, 10);
|
2018-07-17 15:05:57 +02:00
|
|
|
|
|
|
|
//Skip header (30 bytes + additional length)
|
|
|
|
|
|
|
|
//Initialise decryption (pass decryption keys)
|
|
|
|
|
|
|
|
//Skip 12-byte encryption header
|
|
|
|
|
|
|
|
//Decompress file
|
|
|
|
|
|
|
|
//Optionally perform xdelta3
|
|
|
|
|
2018-07-17 14:05:22 +02:00
|
|
|
return 0;
|
|
|
|
}
|