Skip to content

Commit

Permalink
fixed a few windows problems
Browse files Browse the repository at this point in the history
  • Loading branch information
planetbeing committed Jul 20, 2008
1 parent 99b6bb0 commit 5c47bd6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 20 deletions.
5 changes: 5 additions & 0 deletions dfu-util/dfu.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
#include <usb.h>
#include "usb_dfu.h"

#ifdef WIN32
#define sleep(x) Sleep(1000 * x)
#define usleep(x) Sleep(x / 1000)
#endif

/* DFU states */
#define STATE_APP_IDLE 0x00
#define STATE_APP_DETACH 0x01
Expand Down
16 changes: 8 additions & 8 deletions dfu-util/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,18 @@ static int verbose = 0;
#define DFU_IFF_PATH 0x4000

struct usb_vendprod {
u_int16_t vendor;
u_int16_t product;
uint16_t vendor;
uint16_t product;
};

struct dfu_if {
u_int16_t vendor;
u_int16_t product;
u_int8_t configuration;
u_int8_t interface;
u_int8_t altsetting;
uint16_t vendor;
uint16_t product;
uint8_t configuration;
uint8_t interface;
uint8_t altsetting;
int bus;
u_int8_t devnum;
uint8_t devnum;
const char *path;
unsigned int flags;
struct usb_device *dev;
Expand Down
9 changes: 0 additions & 9 deletions dfu-util/usb_dfu.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,6 @@ struct usb_dfu_func_descriptor {
#define USB_REQ_DFU_GETSTATE 0x05
#define USB_REQ_DFU_ABORT 0x06

#if 0
struct dfu_status {
u_int8_t bStatus;
u_int8_t bwPollTimeout[3];
u_int8_t bState;
u_int8_t iString;
} __attribute__((packed));
#endif

#define DFU_STATUS_OK 0x00
#define DFU_STATUS_errTARGET 0x01
#define DFU_STATUS_errFILE 0x02
Expand Down
7 changes: 4 additions & 3 deletions ipsw-patch/pwnutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Dictionary* parseIPSW(const char* inputIPSW, const char* bundleRoot, char** bund
DIR* dir;
struct dirent* ent;
StringValue* plistSHA1String;
char plistHash[20];
unsigned char plistHash[20];
int i;

*bundlePath = NULL;
Expand All @@ -48,7 +48,7 @@ Dictionary* parseIPSW(const char* inputIPSW, const char* bundleRoot, char** bund

fclose(inputIPSWFile);

printf("Matching IPSW...\n");
printf("Matching IPSW... (%02hhx%02hhx%02hhx%02hhx...)\n", hash[0], hash[1], hash[2], hash[3]);

dir = opendir(bundleRoot);
if(dir == NULL) {
Expand All @@ -64,6 +64,7 @@ Dictionary* parseIPSW(const char* inputIPSW, const char* bundleRoot, char** bund
strcpy(infoPath, bundleRoot);
strcat(infoPath, ent->d_name);
strcat(infoPath, "/Info.plist");
printf("checking: %s\n", infoPath);

if((plistFile = createAbstractFileFromFile(fopen(infoPath, "rb"))) != NULL) {
plist = (char*) malloc(plistFile->getLength(plistFile));
Expand All @@ -81,7 +82,7 @@ Dictionary* parseIPSW(const char* inputIPSW, const char* bundleRoot, char** bund
&plistHash[15], &plistHash[16], &plistHash[17], &plistHash[18], &plistHash[19]);

for(i = 0; i < 20; i++) {
if(plistHash[0] != hash[0]) {
if(plistHash[i] != hash[i]) {
break;
}
}
Expand Down

0 comments on commit 5c47bd6

Please sign in to comment.