➕ Add miniz source code
This commit is contained in:
parent
d541b16d39
commit
d390e0affe
8 changed files with 8955 additions and 17 deletions
26
src/fileReader.c
Normal file
26
src/fileReader.c
Normal 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
5
src/fileReader.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
void initFileReader(unsigned char path[], unsigned long offset, unsigned long length);
|
||||
|
||||
unsigned char* readBytes(unsigned long numBytes);
|
18
src/main.c
18
src/main.c
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue