forked from len0rd/rockbox
Check if the file could be modified, error if not.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6501 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
15379c792c
commit
ae0abdc4d0
1 changed files with 12 additions and 3 deletions
|
@ -231,12 +231,21 @@ int PatchFirmware()
|
||||||
}
|
}
|
||||||
for (i = 0; i < sizeof(checksums)/sizeof(char *); ++i) {
|
for (i = 0; i < sizeof(checksums)/sizeof(char *); ++i) {
|
||||||
if (strncmp(checksums[i], md5sum_str, 32) == 0) {
|
if (strncmp(checksums[i], md5sum_str, 32) == 0) {
|
||||||
/* all is fine, rename the patched file to original name of the firmware */
|
|
||||||
MoveFileEx(name3, fn, MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING);
|
|
||||||
/* delete temp files */
|
/* delete temp files */
|
||||||
DeleteFile(name1);
|
DeleteFile(name1);
|
||||||
DeleteFile(name2);
|
DeleteFile(name2);
|
||||||
return 1;
|
/* all is fine, rename the patched file to original name of the firmware */
|
||||||
|
if (MoveFileEx(name3, fn, MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
DeleteFile(name3); /* Deleting a perfectly good firmware here really */
|
||||||
|
MessageBox(NULL,
|
||||||
|
TEXT("Couldn't modify existing file.\n")
|
||||||
|
TEXT("Check if file is write protected, then try again."),
|
||||||
|
TEXT("Error"), MB_ICONERROR);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MessageBox(NULL,
|
MessageBox(NULL,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue