From 9c1ed84d28edfa4a2b5b0a327dccd83d1a1beef8 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sun, 23 Dec 2012 23:36:00 +0100 Subject: sansapatcher: move sectorbuf pointer into sansa_t structure. Similar as the ipod_t structure for ipodpatcher the sansa_t structure holds all relevant information for sansapatcher. Put the global sansa_sectorbuf pointer into it as well. Change-Id: Iad08ef6aafc49609c3d0d556914246f230ee0179 --- rbutil/sansapatcher/sansaio-win32.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'rbutil/sansapatcher/sansaio-win32.c') diff --git a/rbutil/sansapatcher/sansaio-win32.c b/rbutil/sansapatcher/sansaio-win32.c index 196ee1c636..256712fe20 100644 --- a/rbutil/sansapatcher/sansaio-win32.c +++ b/rbutil/sansapatcher/sansaio-win32.c @@ -150,12 +150,12 @@ int sansa_close(struct sansa_t* sansa) return 0; } -int sansa_alloc_buffer(unsigned char** sectorbuf, int bufsize) +int sansa_alloc_buffer(struct sansa_t* sansa, int bufsize) { /* The ReadFile function requires a memory buffer aligned to a multiple of the disk sector size. */ - *sectorbuf = (unsigned char*)VirtualAlloc(NULL, bufsize, MEM_COMMIT, PAGE_READWRITE); - if (*sectorbuf == NULL) { + sansa->sectorbuf = (unsigned char*)VirtualAlloc(NULL, bufsize, MEM_COMMIT, PAGE_READWRITE); + if (sansa->sectorbuf == NULL) { sansa_print_error(" Error allocating a buffer: "); return -1; } @@ -189,11 +189,11 @@ int sansa_read(struct sansa_t* sansa, unsigned char* buf, int nbytes) return count; } -int sansa_write(struct sansa_t* sansa, unsigned char* buf, int nbytes) +int sansa_write(struct sansa_t* sansa, int nbytes) { unsigned long count; - if (!WriteFile(sansa->dh, buf, nbytes, &count, NULL)) { + if (!WriteFile(sansa->dh, sansa->sectorbuf, nbytes, &count, NULL)) { sansa_print_error(" Error writing to disk: "); return -1; } -- cgit v1.2.3