diff options
Diffstat (limited to 'rbutil/sansapatcher/sansaio-win32.c')
-rw-r--r-- | rbutil/sansapatcher/sansaio-win32.c | 10 |
1 files changed, 5 insertions, 5 deletions
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) | |||
150 | return 0; | 150 | return 0; |
151 | } | 151 | } |
152 | 152 | ||
153 | int sansa_alloc_buffer(unsigned char** sectorbuf, int bufsize) | 153 | int sansa_alloc_buffer(struct sansa_t* sansa, int bufsize) |
154 | { | 154 | { |
155 | /* The ReadFile function requires a memory buffer aligned to a multiple of | 155 | /* The ReadFile function requires a memory buffer aligned to a multiple of |
156 | the disk sector size. */ | 156 | the disk sector size. */ |
157 | *sectorbuf = (unsigned char*)VirtualAlloc(NULL, bufsize, MEM_COMMIT, PAGE_READWRITE); | 157 | sansa->sectorbuf = (unsigned char*)VirtualAlloc(NULL, bufsize, MEM_COMMIT, PAGE_READWRITE); |
158 | if (*sectorbuf == NULL) { | 158 | if (sansa->sectorbuf == NULL) { |
159 | sansa_print_error(" Error allocating a buffer: "); | 159 | sansa_print_error(" Error allocating a buffer: "); |
160 | return -1; | 160 | return -1; |
161 | } | 161 | } |
@@ -189,11 +189,11 @@ int sansa_read(struct sansa_t* sansa, unsigned char* buf, int nbytes) | |||
189 | return count; | 189 | return count; |
190 | } | 190 | } |
191 | 191 | ||
192 | int sansa_write(struct sansa_t* sansa, unsigned char* buf, int nbytes) | 192 | int sansa_write(struct sansa_t* sansa, int nbytes) |
193 | { | 193 | { |
194 | unsigned long count; | 194 | unsigned long count; |
195 | 195 | ||
196 | if (!WriteFile(sansa->dh, buf, nbytes, &count, NULL)) { | 196 | if (!WriteFile(sansa->dh, sansa->sectorbuf, nbytes, &count, NULL)) { |
197 | sansa_print_error(" Error writing to disk: "); | 197 | sansa_print_error(" Error writing to disk: "); |
198 | return -1; | 198 | return -1; |
199 | } | 199 | } |