[core] add SHA-256 validation DB for downloadable content

* Downloadable content will now be indicating, in the log, whether it can be trusted with ✓ (validated) or ✗ (caution)
* Of course this validation only applies for files we know of, i.e. the downloadable content that existed at the time the DB was
  created. So, if Syslinux 8.x gets released tomorrow and we put it on our server, you'll get an ✗ regardless of its integrity.
* Closes #758
This commit is contained in:
Pete Batard 2016-05-25 12:20:20 +01:00
parent 04d6ac0cdd
commit 790aacd49a
10 changed files with 201 additions and 43 deletions

View File

@ -222,6 +222,7 @@
<ClInclude Include="..\resource.h" /> <ClInclude Include="..\resource.h" />
<ClInclude Include="..\rufus.h" /> <ClInclude Include="..\rufus.h" />
<ClInclude Include="..\license.h" /> <ClInclude Include="..\license.h" />
<ClInclude Include="..\db.h" />
<ClInclude Include="..\smart.h" /> <ClInclude Include="..\smart.h" />
<ClInclude Include="..\sys_types.h" /> <ClInclude Include="..\sys_types.h" />
<ClInclude Include="..\dev.h" /> <ClInclude Include="..\dev.h" />

View File

@ -140,6 +140,9 @@
<ClInclude Include="..\dev.h"> <ClInclude Include="..\dev.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\db.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="..\..\res\rufus.ico"> <None Include="..\..\res\rufus.ico">

View File

@ -51,6 +51,7 @@
#include <errno.h> #include <errno.h>
#include <windowsx.h> #include <windowsx.h>
#include "db.h"
#include "rufus.h" #include "rufus.h"
#include "missing.h" #include "missing.h"
#include "resource.h" #include "resource.h"
@ -714,19 +715,18 @@ sum_write_t *sum_write[CHECKSUM_MAX] = { md5_write, sha1_write , sha256_write };
sum_final_t *sum_final[CHECKSUM_MAX] = { md5_final, sha1_final , sha256_final }; sum_final_t *sum_final[CHECKSUM_MAX] = { md5_final, sha1_final , sha256_final };
// Compute an individual checksum without threading or buffering, for a single file // Compute an individual checksum without threading or buffering, for a single file
BOOL Checksum(const unsigned type, const char* path, uint8_t* sum) BOOL HashFile(const unsigned type, const char* path, uint8_t* sum)
{ {
BOOL r = FALSE; BOOL r = FALSE;
SUM_CONTEXT sum_ctx = { 0 }; SUM_CONTEXT sum_ctx = { 0 };
HANDLE h = INVALID_HANDLE_VALUE; HANDLE h = INVALID_HANDLE_VALUE;
DWORD read_size = 0; DWORD rs = 0;
uint64_t rb; uint64_t rb;
char buffer[4096]; unsigned char buf[4096];
if ((type >= CHECKSUM_MAX) || (path == NULL) || (sum == NULL)) if ((type >= CHECKSUM_MAX) || (path == NULL) || (sum == NULL))
goto out; goto out;
uprintf("\r\nComputing checksum for '%s'...", path);
h = CreateFileU(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); h = CreateFileU(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (h == INVALID_HANDLE_VALUE) { if (h == INVALID_HANDLE_VALUE) {
uprintf("Could not open file: %s", WindowsErrorString()); uprintf("Could not open file: %s", WindowsErrorString());
@ -735,16 +735,16 @@ BOOL Checksum(const unsigned type, const char* path, uint8_t* sum)
} }
sum_init[type](&sum_ctx); sum_init[type](&sum_ctx);
for (rb = 0; ; rb += read_size) { for (rb = 0; ; rb += rs) {
CHECK_FOR_USER_CANCEL; CHECK_FOR_USER_CANCEL;
if (!ReadFile(h, buffer, sizeof(buffer), &read_size, NULL)) { if (!ReadFile(h, buf, sizeof(buf), &rs, NULL)) {
FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | ERROR_READ_FAULT; FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | ERROR_READ_FAULT;
uprintf(" Read error: %s", WindowsErrorString()); uprintf(" Read error: %s", WindowsErrorString());
goto out; goto out;
} }
if (read_size == 0) if (rs == 0)
break; break;
sum_write[type](&sum_ctx, buffer, (size_t)read_size); sum_write[type](&sum_ctx, buf, (size_t)rs);
} }
sum_final[type](&sum_ctx); sum_final[type](&sum_ctx);
@ -756,6 +756,25 @@ out:
return r; return r;
} }
BOOL HashBuffer(const unsigned type, const unsigned char* buf, const size_t len, uint8_t* sum)
{
BOOL r = FALSE;
SUM_CONTEXT sum_ctx = { 0 };
if ((type >= CHECKSUM_MAX) || (sum == NULL))
goto out;
sum_init[type](&sum_ctx);
sum_write[type](&sum_ctx, buf, len);
sum_final[type](&sum_ctx);
memcpy(sum, sum_ctx.buf, sum_count[type]);
r = TRUE;
out:
return r;
}
/* /*
* Checksum dialog callback * Checksum dialog callback
*/ */
@ -975,3 +994,30 @@ out:
MyDialogBox(hMainInstance, IDD_CHECKSUM, hMainDialog, ChecksumCallback); MyDialogBox(hMainInstance, IDD_CHECKSUM, hMainDialog, ChecksumCallback);
ExitThread(r); ExitThread(r);
} }
/*
* The following 2 calls are used to check whether a buffer/file is in our hash DB
*/
BOOL IsBufferInDB(const unsigned char* buf, const size_t len)
{
int i;
uint8_t sum[32];
if (!HashBuffer(CHECKSUM_SHA256, buf, len, sum))
return FALSE;
for (i = 0; i < ARRAYSIZE(sha256db); i += 32)
if (memcmp(sum, &sha256db[i], 32) == 0)
return TRUE;
return FALSE;
}
BOOL IsFileInDB(const char* path)
{
int i;
uint8_t sum[32];
if (!HashFile(CHECKSUM_SHA256, path, sum))
return FALSE;
for (i = 0; i < ARRAYSIZE(sha256db); i += 32)
if (memcmp(sum, &sha256db[i], 32) == 0)
return TRUE;
return FALSE;
}

108
src/db.h Normal file
View File

@ -0,0 +1,108 @@
/*
* Rufus: The Reliable USB Formatting Utility
* DB of the hash values we know for downloadable content (GRUB, Syslinux, etc.)
* Copyright © 2016 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#pragma once
/*
* NB: Table data was generated from the files/ directory the server with:
* find . -not -name "*.txt" -not -name "*.sh" -not -name "*pre*" -type f -print0 | xargs -0 sha256sum | awk '{print $1}' | sort | uniq | xxd -r -p | hexdump -v -e '31/1 "0x%02x, " 1/1 " 0x%02x,\n"'
*/
static uint8_t sha256db[] = {
0x12, 0xbd, 0x22, 0xd2, 0xb3, 0x69, 0x56, 0x0f, 0x89, 0xb8, 0x50, 0x7e, 0x7e, 0x74, 0xeb, 0xc5, 0xea, 0x44, 0x91, 0x48, 0x75, 0xf0, 0xa4, 0xcb, 0x1e, 0xa6, 0xfb, 0x4e, 0xc9, 0x89, 0x58, 0x17,
0x15, 0x5f, 0x36, 0x7b, 0xb1, 0x30, 0xfe, 0x05, 0x5c, 0x79, 0x9f, 0x88, 0xb3, 0xc0, 0xc1, 0xa0, 0x0a, 0x18, 0x05, 0x78, 0x22, 0x69, 0xcf, 0x7e, 0x54, 0xaa, 0x61, 0xbd, 0xe3, 0x8e, 0x05, 0x92,
0x1c, 0xb7, 0x8b, 0x98, 0xbc, 0xd6, 0x76, 0x7b, 0x01, 0x44, 0xf5, 0x00, 0xaf, 0x81, 0xef, 0x4f, 0x3c, 0x54, 0xea, 0xaf, 0xe3, 0xc9, 0x4e, 0x1f, 0xd6, 0x24, 0x68, 0x41, 0x4e, 0x98, 0x92, 0x25,
0x1c, 0xc6, 0x32, 0x21, 0xfd, 0xf4, 0x46, 0xfc, 0xda, 0xc6, 0xc0, 0x56, 0x35, 0x79, 0x54, 0xc1, 0x5b, 0x61, 0x75, 0xca, 0x1b, 0xc2, 0xa4, 0x9f, 0x85, 0x52, 0xec, 0xca, 0x28, 0xac, 0x3e, 0x51,
0x22, 0x96, 0x82, 0xac, 0x61, 0xb8, 0x8b, 0x11, 0x25, 0xfc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x35, 0xe0, 0x7e, 0x8e, 0x89, 0xf7, 0x02, 0x85, 0x3d, 0xb7, 0xae, 0x2a,
0xec, 0xfd, 0xbc, 0x3f, 0x4f, 0x2e, 0x4d, 0x99, 0x16, 0x9c, 0xdd, 0xfb, 0x15, 0x2d, 0x92, 0x4d, 0x7d, 0xe6, 0x8a, 0xb6, 0x7f, 0x4d, 0x12, 0x54, 0x40, 0xfa, 0xbc, 0x9f, 0x00, 0x46, 0xd5, 0xbc,
0xee, 0xed, 0xc0, 0x4c, 0x13, 0x73, 0xb5, 0xc4, 0x04, 0x4d, 0x1f, 0xde, 0x0d, 0x2f, 0xb8, 0xe2, 0x8c, 0x74, 0xb1, 0x02, 0x9c, 0x99, 0xed, 0x67, 0x0a, 0x15, 0x98, 0x3f, 0x18, 0xa0, 0x4d, 0x36,
0xf5, 0x40, 0x26, 0x1c, 0x09, 0x7d, 0xbd, 0x8a, 0x8a, 0x12, 0x9b, 0x68, 0x99, 0x5f, 0x33, 0xab, 0xe7, 0x1c, 0x29, 0x40, 0xf8, 0x87, 0xc6, 0x68, 0x9b, 0xf8, 0xdc, 0x3f, 0x1a, 0xcf, 0x0b, 0x44,
0xfb, 0x0a, 0x23, 0xca, 0x4d, 0x22, 0xfd, 0xd2, 0xad, 0x4e, 0xfa, 0x1b, 0x21, 0x08, 0xb6, 0x60, 0xd2, 0xff, 0xa3, 0xf2, 0xfb, 0xdd, 0x25, 0x32, 0xdc, 0xf1, 0x3f, 0x49, 0x33, 0x28, 0x46, 0x7b,
0xfb, 0x49, 0xfd, 0x45, 0x8c, 0xaf, 0x47, 0x5a, 0x16, 0x05, 0x5e, 0x4a, 0x75, 0x5a, 0xc3, 0xe3, 0x95, 0x52, 0xf4, 0xe9, 0x6c, 0xa2, 0x0d, 0xea, 0x53, 0xf5, 0xc4, 0x09, 0x2b, 0x68, 0xfd, 0x4f,
};

View File

@ -1002,7 +1002,7 @@ static BOOL WriteSBR(HANDLE hPhysicalDrive)
switch (bt) { switch (bt) {
case BT_GRUB4DOS: case BT_GRUB4DOS:
uprintf("Writing Grub4Dos SBR..."); uprintf("Writing Grub4Dos SBR");
buf = GetResource(hMainInstance, MAKEINTRESOURCEA(IDR_GR_GRUB_GRLDR_MBR), _RT_RCDATA, "grldr.mbr", &size, FALSE); buf = GetResource(hMainInstance, MAKEINTRESOURCEA(IDR_GR_GRUB_GRLDR_MBR), _RT_RCDATA, "grldr.mbr", &size, FALSE);
if ((buf == NULL) || (size <= mbr_size)) { if ((buf == NULL) || (size <= mbr_size)) {
uprintf("grldr.mbr is either not present or too small"); uprintf("grldr.mbr is either not present or too small");
@ -1013,11 +1013,12 @@ static BOOL WriteSBR(HANDLE hPhysicalDrive)
break; break;
case BT_GRUB2: case BT_GRUB2:
if (grub2_buf != NULL) { if (grub2_buf != NULL) {
uprintf("Writing Grub 2.0 SBR (from download)..."); uprintf("Writing Grub 2.0 SBR (from download) %s",
IsBufferInDB(grub2_buf, grub2_len)?"":"");
buf = grub2_buf; buf = grub2_buf;
size = (DWORD)grub2_len; size = (DWORD)grub2_len;
} else { } else {
uprintf("Writing Grub 2.0 SBR (from embedded)..."); uprintf("Writing Grub 2.0 SBR (from embedded)");
buf = GetResource(hMainInstance, MAKEINTRESOURCEA(IDR_GR_GRUB2_CORE_IMG), _RT_RCDATA, "core.img", &size, FALSE); buf = GetResource(hMainInstance, MAKEINTRESOURCEA(IDR_GR_GRUB2_CORE_IMG), _RT_RCDATA, "core.img", &size, FALSE);
if (buf == NULL) { if (buf == NULL) {
uprintf("Could not access core.img"); uprintf("Could not access core.img");
@ -1898,8 +1899,9 @@ DWORD WINAPI FormatThread(void* param)
} }
} else if (bt == BT_GRUB4DOS) { } else if (bt == BT_GRUB4DOS) {
grub4dos_dst[0] = drive_name[0]; grub4dos_dst[0] = drive_name[0];
uprintf("Installing: %s (Grub4DOS loader)\n", grub4dos_dst);
IGNORE_RETVAL(_chdirU(app_dir)); IGNORE_RETVAL(_chdirU(app_dir));
uprintf("Installing: %s (Grub4DOS loader) %s\n", grub4dos_dst,
IsFileInDB(FILES_DIR "\\grub4dos-" GRUB4DOS_VERSION "\\grldr")?"":"");
if (!CopyFileU(FILES_DIR "\\grub4dos-" GRUB4DOS_VERSION "\\grldr", grub4dos_dst, FALSE)) if (!CopyFileU(FILES_DIR "\\grub4dos-" GRUB4DOS_VERSION "\\grldr", grub4dos_dst, FALSE))
uprintf("Failed to copy file: %s", WindowsErrorString()); uprintf("Failed to copy file: %s", WindowsErrorString());
} else if ((bt == BT_ISO) && (image_path != NULL)) { } else if ((bt == BT_ISO) && (image_path != NULL)) {

View File

@ -366,7 +366,7 @@ static int udf_extract_files(udf_t *p_udf, udf_dirent_t *p_udf_dirent, const cha
i_length = (int)(3 + strlen(psz_path) + strlen(psz_basename) + strlen(psz_extract_dir) + 24); i_length = (int)(3 + strlen(psz_path) + strlen(psz_basename) + strlen(psz_extract_dir) + 24);
psz_fullpath = (char*)calloc(sizeof(char), i_length); psz_fullpath = (char*)calloc(sizeof(char), i_length);
if (psz_fullpath == NULL) { if (psz_fullpath == NULL) {
uprintf("Error allocating file name\n"); uprintf("Error allocating file name");
goto out; goto out;
} }
i_length = _snprintf(psz_fullpath, i_length, "%s%s/%s", psz_extract_dir, psz_path, psz_basename); i_length = _snprintf(psz_fullpath, i_length, "%s%s/%s", psz_extract_dir, psz_path, psz_basename);
@ -398,23 +398,23 @@ static int udf_extract_files(udf_t *p_udf, udf_dirent_t *p_udf_dirent, const cha
for (i=0; i<NB_OLD_C32; i++) { for (i=0; i<NB_OLD_C32; i++) {
if (props.is_old_c32[i] && use_own_c32[i]) { if (props.is_old_c32[i] && use_own_c32[i]) {
static_sprintf(tmp, "%s/syslinux-%s/%s", FILES_DIR, embedded_sl_version_str[0], old_c32_name[i]); static_sprintf(tmp, "%s/syslinux-%s/%s", FILES_DIR, embedded_sl_version_str[0], old_c32_name[i]);
if (CopyFileA(tmp, psz_fullpath, FALSE)) { if (CopyFileU(tmp, psz_fullpath, FALSE)) {
uprintf(" Replaced with local version\n"); uprintf(" Replaced with local version %s", IsFileInDB(tmp)?"":"");
break; break;
} }
uprintf(" Could not replace file: %s\n", WindowsErrorString()); uprintf(" Could not replace file: %s", WindowsErrorString());
} }
} }
if (i < NB_OLD_C32) if (i < NB_OLD_C32)
continue; continue;
psz_sanpath = sanitize_filename(psz_fullpath, &is_identical); psz_sanpath = sanitize_filename(psz_fullpath, &is_identical);
if (!is_identical) if (!is_identical)
uprintf(" File name sanitized to '%s'\n", psz_sanpath); uprintf(" File name sanitized to '%s'", psz_sanpath);
file_handle = CreateFileU(psz_sanpath, GENERIC_READ | GENERIC_WRITE, file_handle = CreateFileU(psz_sanpath, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (file_handle == INVALID_HANDLE_VALUE) { if (file_handle == INVALID_HANDLE_VALUE) {
err = GetLastError(); err = GetLastError();
uprintf(" Unable to create file: %s\n", WindowsErrorString()); uprintf(" Unable to create file: %s", WindowsErrorString());
if ((err == ERROR_ACCESS_DENIED) && (safe_strcmp(&psz_sanpath[3], autorun_name) == 0)) if ((err == ERROR_ACCESS_DENIED) && (safe_strcmp(&psz_sanpath[3], autorun_name) == 0))
uprintf(stupid_antivirus); uprintf(stupid_antivirus);
else else
@ -424,7 +424,7 @@ static int udf_extract_files(udf_t *p_udf, udf_dirent_t *p_udf_dirent, const cha
memset(buf, 0, UDF_BLOCKSIZE); memset(buf, 0, UDF_BLOCKSIZE);
i_read = udf_read_block(p_udf_dirent, buf, 1); i_read = udf_read_block(p_udf_dirent, buf, 1);
if (i_read < 0) { if (i_read < 0) {
uprintf(" Error reading UDF file %s\n", &psz_fullpath[strlen(psz_extract_dir)]); uprintf(" Error reading UDF file %s", &psz_fullpath[strlen(psz_extract_dir)]);
goto out; goto out;
} }
buf_size = (DWORD)MIN(i_file_length, i_read); buf_size = (DWORD)MIN(i_file_length, i_read);
@ -491,7 +491,7 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path)
p_entlist = iso9660_ifs_readdir(p_iso, psz_path); p_entlist = iso9660_ifs_readdir(p_iso, psz_path);
if (!p_entlist) { if (!p_entlist) {
uprintf("Could not access directory %s\n", psz_path); uprintf("Could not access directory %s", psz_path);
return 1; return 1;
} }
@ -539,28 +539,28 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path)
for (i=0; i<NB_OLD_C32; i++) { for (i=0; i<NB_OLD_C32; i++) {
if (props.is_old_c32[i] && use_own_c32[i]) { if (props.is_old_c32[i] && use_own_c32[i]) {
static_sprintf(tmp, "%s/syslinux-%s/%s", FILES_DIR, embedded_sl_version_str[0], old_c32_name[i]); static_sprintf(tmp, "%s/syslinux-%s/%s", FILES_DIR, embedded_sl_version_str[0], old_c32_name[i]);
if (CopyFileA(tmp, psz_fullpath, FALSE)) { if (CopyFileU(tmp, psz_fullpath, FALSE)) {
uprintf(" Replaced with local version\n"); uprintf(" Replaced with local version %s", IsFileInDB(tmp)?"":"");
break; break;
} }
uprintf(" Could not replace file: %s\n", WindowsErrorString()); uprintf(" Could not replace file: %s", WindowsErrorString());
} }
} }
if (i < NB_OLD_C32) if (i < NB_OLD_C32)
continue; continue;
psz_sanpath = sanitize_filename(psz_fullpath, &is_identical); psz_sanpath = sanitize_filename(psz_fullpath, &is_identical);
if (!is_identical) if (!is_identical)
uprintf(" File name sanitized to '%s'\n", psz_sanpath); uprintf(" File name sanitized to '%s'", psz_sanpath);
if (is_symlink) { if (is_symlink) {
if (i_file_length == 0) if (i_file_length == 0)
uprintf(" Ignoring Rock Ridge symbolic link to '%s'\n", p_statbuf->rr.psz_symlink); uprintf(" Ignoring Rock Ridge symbolic link to '%s'", p_statbuf->rr.psz_symlink);
safe_free(p_statbuf->rr.psz_symlink); safe_free(p_statbuf->rr.psz_symlink);
} }
file_handle = CreateFileU(psz_sanpath, GENERIC_READ | GENERIC_WRITE, file_handle = CreateFileU(psz_sanpath, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (file_handle == INVALID_HANDLE_VALUE) { if (file_handle == INVALID_HANDLE_VALUE) {
err = GetLastError(); err = GetLastError();
uprintf(" Unable to create file: %s\n", WindowsErrorString()); uprintf(" Unable to create file: %s", WindowsErrorString());
if ((err == ERROR_ACCESS_DENIED) && (safe_strcmp(&psz_sanpath[3], autorun_name) == 0)) if ((err == ERROR_ACCESS_DENIED) && (safe_strcmp(&psz_sanpath[3], autorun_name) == 0))
uprintf(stupid_antivirus); uprintf(stupid_antivirus);
else else
@ -570,7 +570,7 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path)
memset(buf, 0, ISO_BLOCKSIZE); memset(buf, 0, ISO_BLOCKSIZE);
lsn = p_statbuf->lsn + (lsn_t)i; lsn = p_statbuf->lsn + (lsn_t)i;
if (iso9660_iso_seek_read(p_iso, buf, lsn, 1) != ISO_BLOCKSIZE) { if (iso9660_iso_seek_read(p_iso, buf, lsn, 1) != ISO_BLOCKSIZE) {
uprintf(" Error reading ISO9660 file %s at LSN %lu\n", uprintf(" Error reading ISO9660 file %s at LSN %lu",
psz_iso_name, (long unsigned int)lsn); psz_iso_name, (long unsigned int)lsn);
goto out; goto out;
} }

View File

@ -2271,13 +2271,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
#ifdef RUFUS_TEST #ifdef RUFUS_TEST
case IDC_TEST: case IDC_TEST:
{ {
int j;
char str[65];
uint8_t sum[32];
Checksum(CHECKSUM_SHA256, "C:\\rufus\\src\\.msvc\\rufus_files\\syslinux-6.03\\ldlinux.sys", sum);
for (j = 0; j < sizeof(sum); j++)
safe_sprintf(&str[2 * j], ARRAYSIZE(str) - 2 * j, "%02x", sum[j]);
uprintf(" Checksum: %s", str);
break; break;
} }
#endif #endif

View File

@ -456,7 +456,10 @@ extern BOOL IsFontAvailable(const char* font_name);
extern BOOL WriteFileWithRetry(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, extern BOOL WriteFileWithRetry(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
LPDWORD lpNumberOfBytesWritten, DWORD nNumRetries); LPDWORD lpNumberOfBytesWritten, DWORD nNumRetries);
extern BOOL SetThreadAffinity(DWORD_PTR* thread_affinity, size_t num_threads); extern BOOL SetThreadAffinity(DWORD_PTR* thread_affinity, size_t num_threads);
extern BOOL Checksum(const unsigned type, const char* path, uint8_t* sum); extern BOOL HashFile(const unsigned type, const char* path, uint8_t* sum);
extern BOOL HashBuffer(const unsigned type, const unsigned char* buf, const size_t len, uint8_t* sum);
extern BOOL IsFileInDB(const char* path);
extern BOOL IsBufferInDB(const unsigned char* buf, const size_t len);
#define printbits(x) _printbits(sizeof(x), &x, 0) #define printbits(x) _printbits(sizeof(x), &x, 0)
#define printbitslz(x) _printbits(sizeof(x), &x, 1) #define printbitslz(x) _printbits(sizeof(x), &x, 1)
extern char* _printbits(size_t const size, void const * const ptr, int leading_zeroes); extern char* _printbits(size_t const size, void const * const ptr, int leading_zeroes);

View File

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 242, 376 IDD_DIALOG DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 2.10.939" CAPTION "Rufus 2.10.940"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0 FONT 8, "Segoe UI Symbol", 400, 0, 0x0
BEGIN BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8 LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -320,8 +320,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,10,939,0 FILEVERSION 2,10,940,0
PRODUCTVERSION 2,10,939,0 PRODUCTVERSION 2,10,940,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -338,13 +338,13 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.10.939" VALUE "FileVersion", "2.10.940"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2016 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2016 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe" VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "2.10.939" VALUE "ProductVersion", "2.10.940"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -148,7 +148,8 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type)
uprintf("Could not read %s", path); uprintf("Could not read %s", path);
goto out; goto out;
} }
uprintf("Using existing './%s'", path); uprintf("Using existing './%s' %s", path,
IsBufferInDB(syslinux_ldlinux[i], (size_t)syslinux_ldlinux_len[i])?"":"");
} }
} else { } else {
for (i=0; i<2; i++) { for (i=0; i<2; i++) {
@ -313,8 +314,9 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type)
uprintf("Caution: No '%s' was provided. The target will be missing a required Syslinux file!", &path[3]); uprintf("Caution: No '%s' was provided. The target will be missing a required Syslinux file!", &path[3]);
} else { } else {
fclose(fd); fclose(fd);
if (CopyFileA(&path[3], path, TRUE)) { if (CopyFileU(&path[3], path, TRUE)) {
uprintf("Created '%s' (from '%s/%s-%s/%s')", path, FILES_DIR, syslinux, embedded_sl_version_str[1], &path[3]); uprintf("Created '%s' (from '%s/%s-%s/%s') %s", path, FILES_DIR, syslinux,
embedded_sl_version_str[1], &path[3], IsFileInDB(&path[3])?"":"");
} else { } else {
uprintf("Failed to create '%s': %s", path, WindowsErrorString()); uprintf("Failed to create '%s': %s", path, WindowsErrorString());
} }