From 92c2879d16148f47ff38f3490f24768bb8eb61f6 Mon Sep 17 00:00:00 2001 From: Joshua Hill Date: Mon, 24 May 2010 15:35:08 -0400 Subject: Have it sending DeviceTree now and started on ramdisk. Started to clean up a little bit, but not everything yet. --- src/ipsw.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/ipsw.c') diff --git a/src/ipsw.c b/src/ipsw.c index f601201..56fd216 100644 --- a/src/ipsw.c +++ b/src/ipsw.c @@ -26,6 +26,13 @@ #include "ipsw.h" #include "idevicerestore.h" +typedef struct { + struct zip* zip; +} ipsw_archive; + +ipsw_archive* ipsw_open(const char* ipsw); +void ipsw_close(ipsw_archive* archive); + ipsw_archive* ipsw_open(const char* ipsw) { int err = 0; ipsw_archive* archive = (ipsw_archive*) malloc(sizeof(ipsw_archive)); @@ -44,7 +51,8 @@ ipsw_archive* ipsw_open(const char* ipsw) { return archive; } -ipsw_file* ipsw_extract_file(ipsw_archive* archive, const char* filename) { +ipsw_file* ipsw_extract_file(const char* ipsw, const char* filename) { + ipsw_archive* archive = ipsw_open(ipsw); if(archive == NULL || archive->zip == NULL) { error("ERROR: Invalid archive\n"); return NULL; @@ -95,6 +103,7 @@ ipsw_file* ipsw_extract_file(ipsw_archive* archive, const char* filename) { } zip_fclose(zfile); + ipsw_close(archive); return file; } -- cgit v1.1-32-gdbae