Add miniz source code

This commit is contained in:
C-3PO 2018-07-17 17:19:13 +02:00
parent d541b16d39
commit d390e0affe
Signed by: c3po
GPG key ID: 62993C4BB4D86F24
8 changed files with 8955 additions and 17 deletions

26
src/fileReader.c Normal file
View file

@ -0,0 +1,26 @@
//for printf()
#include <stdio.h>
//for errno
#include <errno.h>
//for strerror()
#include <string.h>
#include "fileReader.h"
void initFileReader(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();
}
}
unsigned char* readBytes(unsigned long numBytes) {
//TODO
}

5
src/fileReader.h Normal file
View file

@ -0,0 +1,5 @@
#pragma once
void initFileReader(unsigned char path[], unsigned long offset, unsigned long length);
unsigned char* readBytes(unsigned long numBytes);

View file

@ -7,28 +7,16 @@
//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();
}
}
#include "fileReader.h"
int main(int argc, unsigned char *argv[]) {
printf("Hello World!\n");
//Initialise file reader
getFileReader("1234", 0, 10);
initFileReader("1234", 0, 10);
//Skip header (30 bytes + additional length)
readBytes(30);
//Initialise decryption (pass decryption keys)