From 8a3261faed2e127ad796cb4243279a0c03df729a Mon Sep 17 00:00:00 2001 From: Paul Sladen Date: Sat, 18 Apr 2009 03:43:57 +0300 Subject: [PATCH] use uint64_t values, rather than zero pads --- src/AFC.c | 8 +------- src/AFC.h | 10 +++++++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/AFC.c b/src/AFC.c index 170ad69..4110d05 100644 --- a/src/AFC.c +++ b/src/AFC.c @@ -88,14 +88,9 @@ iphone_error_t iphone_afc_new_client(iphone_device_t device, int src_port, int d } client_loc->afc_packet->packet_num = 0; - client_loc->afc_packet->unknown1 = 0; - client_loc->afc_packet->unknown2 = 0; - client_loc->afc_packet->unknown3 = 0; - client_loc->afc_packet->unknown4 = 0; client_loc->afc_packet->entire_length = 0; client_loc->afc_packet->this_length = 0; - client_loc->afc_packet->header1 = 0x36414643; - client_loc->afc_packet->header2 = 0x4141504C; + memcpy(client_loc->afc_packet->magic, AFC_MAGIC, AFC_MAGIC_LEN); client_loc->file_handle = 0; client_loc->lock = 0; client_loc->mutex = g_mutex_new(); @@ -762,7 +757,6 @@ iphone_afc_read_file(iphone_afc_client_t client, iphone_afc_file_t file, char *d // Send the read command AFCFilePacket *packet = (AFCFilePacket *) malloc(sizeof(AFCFilePacket)); - packet->unknown1 = packet->unknown2 = 0; packet->filehandle = file->filehandle; packet->size = ((length - current_count) < MAXIMUM_READ_SIZE) ? (length - current_count) : MAXIMUM_READ_SIZE; client->afc_packet->operation = AFC_READ; diff --git a/src/AFC.h b/src/AFC.h index e9afb82..422b7c8 100644 --- a/src/AFC.h +++ b/src/AFC.h @@ -27,14 +27,18 @@ #include #include #include +#include + +#define AFC_MAGIC "CFA6LPAA" +#define AFC_MAGIC_LEN (8) typedef struct { - uint32_t header1, header2; - uint32_t entire_length, unknown1, this_length, unknown2, packet_num, unknown3, operation, unknown4; + char magic[AFC_MAGIC_LEN]; + uint64_t entire_length, this_length, packet_num, operation; } AFCPacket; typedef struct { - uint32_t filehandle, unknown1, size, unknown2; + uint64_t filehandle, size; } AFCFilePacket; typedef struct __AFCToken { -- 1.6.0.4