Skip to content

Commit

Permalink
[ui] add experimental optional display of transfer speed and time rem…
Browse files Browse the repository at this point in the history
…aining

* You can use <Alt> to switch modes during an operation that supports it (e.g. Checksum
  computation, DD image writing or zeroing, save to VHD, download, etc.
* IMPORTANT: This is *NOT* available for all operations. Especially, if you were hoping
  to get transfer speed or ETA during ISO or WIM extraction, you *WILL* be disappointed.
* Also harmonize the code in checksum.c
  • Loading branch information
pbatard committed Aug 20, 2019
1 parent 94e2015 commit af95de8
Show file tree
Hide file tree
Showing 16 changed files with 525 additions and 430 deletions.
44 changes: 22 additions & 22 deletions res/loc/po/fr-FR.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: 3.5\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2019-03-12 13:52+0000\n"
"PO-Revision-Date: 2019-04-11 14:19+0100\n"
"POT-Creation-Date: 2019-08-20 17:03+0100\n"
"PO-Revision-Date: 2019-08-20 17:03+0100\n"
"Language: fr_FR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand All @@ -13,7 +13,7 @@ msgstr ""
"X-Rufus-LCID: 0x040c, 0x080c, 0x0c0c, 0x100c, 0x140c, 0x180c, 0x1c0c, 0x200c, 0x240c, 0x280c, 0x2c0c, 0x300c, 0x340c, 0x380c, 0xe40c\n"
"Last-Translator: \n"
"Language-Team: \n"
"X-Generator: Poedit 2.2.1\n"
"X-Generator: Poedit 2.2.3\n"

#. • IDD_DIALOG → IDS_DRIVE_PROPERTIES_TXT
msgid "Drive Properties"
Expand Down Expand Up @@ -1285,8 +1285,8 @@ msgstr "%s sauvegardé"
#. • MSG_217
#.
#. Formatting status (make sure you use a double % to print the percent sign)
msgid "Formatting: %0.1f%% completed"
msgstr "Formatage : %0.1f%% complété"
msgid "Formatting: %s"
msgstr "Formatage : %s"

#. • MSG_218
msgid "Creating file system: Task %d/%d completed"
Expand Down Expand Up @@ -1335,20 +1335,20 @@ msgid "Closing existing volume..."
msgstr "Fermeture des volumes existants..."

#. • MSG_228
msgid "Writing master boot record..."
msgid "Writing Master Boot Record..."
msgstr "Ecriture du MBR..."

#. • MSG_229
msgid "Writing partition boot record..."
msgid "Writing Partition Boot Record..."
msgstr "Ecriture du PBR..."

#. • MSG_230
msgid "Copying DOS files..."
msgstr "Copie des fichiers DOS..."

#. • MSG_231
msgid "Copying ISO files..."
msgstr "Copie des fichiers ISO..."
msgid "Copying ISO files: %s"
msgstr "Copie des fichiers ISO : %s"

#. • MSG_232
msgid "Win7 EFI boot setup (This may take a while)..."
Expand Down Expand Up @@ -1403,8 +1403,8 @@ msgstr ""
"Le téléchargement va être supprimé. Veuillez consulter le log pour plus de détails."

#. • MSG_241
msgid "Downloading: %0.1f%%"
msgstr "Téléchargement : %0.1f%%"
msgid "Downloading: %s"
msgstr "Téléchargement : %s"

#. • MSG_242
msgid "Failed to download file."
Expand Down Expand Up @@ -1485,8 +1485,8 @@ msgid "NTFS compression"
msgstr "Compression NTFS"

#. • MSG_261
msgid "Writing image: %0.1f%% completed"
msgstr "Ecriture d'image : %0.1f%% complété"
msgid "Writing image: %s"
msgstr "Ecriture d'image : %s"

#. • MSG_262
#.
Expand All @@ -1513,8 +1513,8 @@ msgid "Dual UEFI/BIOS mode"
msgstr "Mode dual UEFI/BIOS"

#. • MSG_267
msgid "Applying Windows image: %0.1f%% completed"
msgstr "Application de l'image Windows : %0.1f%% complété"
msgid "Applying Windows image: %s"
msgstr "Application de l'image Windows : %s"

#. • MSG_268
msgid "Applying Windows image..."
Expand All @@ -1529,8 +1529,8 @@ msgid "USB debug"
msgstr "Debug USB"

#. • MSG_271
msgid "Computing image checksums: %0.1f%% completed"
msgstr "Calculation des checksums de l'image : %0.1f%% complété"
msgid "Computing image checksums: %s"
msgstr "Calculation des checksums de l'image : %s"

#. • MSG_272
msgid "Compute the MD5, SHA1 and SHA256 checksums for the selected image"
Expand Down Expand Up @@ -1607,12 +1607,12 @@ msgid ""
"Are you sure you want to run this file?"
msgstr ""
"L'exécutable téléchargé est signé par '%s'.\n"
"Ce n’est pas une signature que nous reconnaissons et pourrait indiquer une activité malicieuse...\n"
"Il ne s'agit pas d'une signature que nous connaissons et peut indiquer une activité malicieuse...\n"
"Êtes-vous certain de vouloir lancer ce fichier ?"

#. • MSG_286
msgid "Zeroing drive: %0.1f%% completed"
msgstr "Effacement à zéro : %0.1f%% complété"
msgid "Zeroing drive: %s"
msgstr "Effacement à zéro : %s"

#. • MSG_287
msgid "Detection of non-USB removable drives"
Expand Down Expand Up @@ -1716,5 +1716,5 @@ msgstr "Utilisez cette option pour indiquer si vous voulez utiliser ce périphé
#.
#. You can see this status message by pressing <Ctrl>-<Alt>-<Z> and then selecting START.
#. It's the same as MSG_286 but with a process that *may* be faster, hence the name.
msgid "Fast-zeroing drive: %0.1f%% completed"
msgstr "Effacement 'rapide' à zéro : %0.1f%% complété"
msgid "Fast-zeroing drive: %s"
msgstr "Effacement 'rapide' à zéro : %s"
610 changes: 305 additions & 305 deletions res/loc/rufus.loc

Large diffs are not rendered by default.

60 changes: 27 additions & 33 deletions src/checksum.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,18 @@ unsigned char ALIGNED(64) buffer[2][BUFFER_SIZE];

/* SHA-256 constants */
static const uint32_t K[64] = {
0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,
0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,
0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,
0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967,
0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,
0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,
0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,
0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
};

/*
* For convenience, we use a common context for all the checksums algorithms,
* For convenience, we use a common context for all the checksum algorithms,
* which means some elements may be unused...
*/
typedef struct ALIGNED(64) {
Expand Down Expand Up @@ -159,19 +159,19 @@ static void sha1_transform(SUM_CONTEXT *ctx, const unsigned char *data)
}
#endif

#define K1 0x5A827999L
#define K2 0x6ED9EBA1L
#define K3 0x8F1BBCDCL
#define K4 0xCA62C1D6L
#define K1 0x5a827999L
#define K2 0x6ed9eba1L
#define K3 0x8f1bbcdcL
#define K4 0xca62c1d6L
#define F1(x,y,z) ( z ^ ( x & ( y ^ z ) ) )
#define F2(x,y,z) ( x ^ y ^ z )
#define F3(x,y,z) ( ( x & y ) | ( z & ( x | y ) ) )
#define F4(x,y,z) ( x ^ y ^ z )

#define M(i) ( tm = x[i&0x0f] ^ x[(i-14)&0x0f] ^ x[(i-8)&0x0f] ^ x[(i-3)&0x0f], (x[i&0x0f] = ROL(tm,1)) )

#define SHA1STEP(a,b,c,d,e,f,k,m) do { e += ROL(a, 5) + f(b, c, d) + k + m; \
b = ROL(b, 30); } while(0)
#define SHA1STEP(a, b, c, d, e, f, k, m) do { e += ROL(a, 5) + f(b, c, d) + k + m; \
b = ROL(b, 30); } while(0)
SHA1STEP(a, b, c, d, e, F1, K1, x[0]);
SHA1STEP(e, a, b, c, d, F1, K1, x[1]);
SHA1STEP(d, e, a, b, c, F1, K1, x[2]);
Expand Down Expand Up @@ -289,19 +289,19 @@ static __inline void sha256_transform(SUM_CONTEXT *ctx, const unsigned char *dat
#define s1(x) (ROR(ROR(x,2)^(x),17)^((x)>>10))
#define BLK0(i) (x[i])
#define BLK2(i) (x[i] += s1(x[((i)-2)&15]) + x[((i)-7)&15] + s0(x[((i)-15)&15]))
#define R(a,b,c,d,e,f,g,h,i) \
#define R(a, b, c, d, e, f, g, h, i) \
h += S1(e) + CH(e,f,g) + K[(i)+(j)] + (j ? BLK2(i) : BLK0(i)); \
d += h; \
h += S0(a) + MAJ(a, b, c)
#define RX_8(i) \
R(a,b,c,d,e,f,g,h, i); \
R(h,a,b,c,d,e,f,g, i+1); \
R(g,h,a,b,c,d,e,f, i+2); \
R(f,g,h,a,b,c,d,e, i+3); \
R(e,f,g,h,a,b,c,d, i+4); \
R(d,e,f,g,h,a,b,c, i+5); \
R(c,d,e,f,g,h,a,b, i+6); \
R(b,c,d,e,f,g,h,a, i+7)
R(a, b, c, d, e, f, g, h, i); \
R(h, a, b, c, d, e, f, g, i+1); \
R(g, h, a, b, c, d, e, f, i+2); \
R(f, g, h, a, b, c, d, e, i+3); \
R(e, f, g, h, a, b, c, d, i+4); \
R(d, e, f, g, h, a, b, c, i+5); \
R(c, d, e, f, g, h, a, b, i+6); \
R(b, c, d, e, f, g, h, a, i+7)

#ifdef BIG_ENDIAN_HOST
memcpy(x, data, sizeof(x));
Expand Down Expand Up @@ -880,9 +880,8 @@ DWORD WINAPI SumThread(void* param)
DWORD_PTR* thread_affinity = (DWORD_PTR*)param;
HANDLE sum_thread[CHECKSUM_MAX] = { NULL, NULL, NULL };
HANDLE h = INVALID_HANDLE_VALUE;
uint64_t rb, LastRefresh = 0;
uint64_t rb;
int i, _bufnum, r = -1;
float format_percent = 0.0f;

if ((image_path == NULL) || (thread_affinity == NULL))
ExitThread(r);
Expand Down Expand Up @@ -926,15 +925,10 @@ DWORD WINAPI SumThread(void* param)
bufnum = 0;
_bufnum = 0;
read_size[0] = 1; // Don't trigger the first loop break
UpdateProgressWithInfoInit(hMainDialog, FALSE);
for (rb = 0; ;rb += read_size[_bufnum]) {
// Update the progress and check for cancel
if (GetTickCount64() > LastRefresh + MAX_REFRESH) {
LastRefresh = GetTickCount64();
format_percent = (100.0f*rb) / (1.0f*img_report.image_size);
PrintInfo(0, MSG_271, format_percent);
SendMessage(hProgress, PBM_SETPOS, (WPARAM)((format_percent / 100.0f)*MAX_PROGRESS), 0);
SetTaskbarProgressValue(rb, img_report.image_size);
}
UpdateProgressWithInfo(OP_NOOP_WITH_TASKBAR, MSG_271, rb, img_report.image_size);
CHECK_FOR_USER_CANCEL;

// Signal the threads that we have data to process
Expand Down
4 changes: 2 additions & 2 deletions src/dos.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ static BOOL ExtractMSDOS(const char* path)
if (memcmp(extractlist[j], &DiskImage[FAT12_ROOTDIR_OFFSET + i*FAT_BYTES_PER_DIRENT], 8+3) == 0) {
r = ExtractFAT(i, (j<3)?path:locale_path);
if ((j == 2) || (j == 7) || (j == 12))
UpdateProgress(OP_DOS, -1.0f);
UpdateProgress(OP_FILE_COPY, -1.0f);
}
}
}
Expand Down Expand Up @@ -405,7 +405,7 @@ BOOL ExtractFreeDOS(const char* path)
uprintf("Successfully wrote '%s' (%d bytes)\n", filename, res_size);

if ((i == 4) || (i == 10) || (i == 16) || (i == 22) || (i == ARRAYSIZE(res_name)-1))
UpdateProgress(OP_DOS, -1.0f);
UpdateProgress(OP_FILE_COPY, -1.0f);
}

return SetDOSLocale(path, TRUE);
Expand Down
Loading

0 comments on commit af95de8

Please sign in to comment.