Author: zguo
Date: Fri Mar 18 06:40:39 2016
New Revision: 71020
URL:
http://svn.reactos.org/svn/reactos?rev=71020&view=rev
Log:
Implement SHA1 checksum in new RAPPS. Patch by Mark Jansen.
CORE-10908 #resolve
Added:
trunk/reactos/base/applications/rapps_new/integrity.cpp (with props)
Modified:
trunk/reactos/base/applications/rapps_new/CMakeLists.txt
trunk/reactos/base/applications/rapps_new/available.cpp
trunk/reactos/base/applications/rapps_new/lang/bg-BG.rc
trunk/reactos/base/applications/rapps_new/lang/cs-CZ.rc
trunk/reactos/base/applications/rapps_new/lang/de-DE.rc
trunk/reactos/base/applications/rapps_new/lang/en-US.rc
trunk/reactos/base/applications/rapps_new/lang/es-ES.rc
trunk/reactos/base/applications/rapps_new/lang/fr-FR.rc
trunk/reactos/base/applications/rapps_new/lang/he-IL.rc
trunk/reactos/base/applications/rapps_new/lang/it-IT.rc
trunk/reactos/base/applications/rapps_new/lang/ja-JP.rc
trunk/reactos/base/applications/rapps_new/lang/no-NO.rc
trunk/reactos/base/applications/rapps_new/lang/pl-PL.rc
trunk/reactos/base/applications/rapps_new/lang/pt-BR.rc
trunk/reactos/base/applications/rapps_new/lang/ro-RO.rc
trunk/reactos/base/applications/rapps_new/lang/ru-RU.rc
trunk/reactos/base/applications/rapps_new/lang/sk-SK.rc
trunk/reactos/base/applications/rapps_new/lang/sq-AL.rc
trunk/reactos/base/applications/rapps_new/lang/sv-SE.rc
trunk/reactos/base/applications/rapps_new/lang/tr-TR.rc
trunk/reactos/base/applications/rapps_new/lang/uk-UA.rc
trunk/reactos/base/applications/rapps_new/lang/zh-CN.rc
trunk/reactos/base/applications/rapps_new/lang/zh-TW.rc
trunk/reactos/base/applications/rapps_new/loaddlg.cpp
trunk/reactos/base/applications/rapps_new/rapps.h
trunk/reactos/base/applications/rapps_new/resource.h
trunk/reactos/lib/cryptlib/sha1.h
Modified: trunk/reactos/base/applications/rapps_new/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/CMakeLists.txt [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -3,6 +3,7 @@
set_cpp(WITH_RUNTIME)
include_directories(${REACTOS_SOURCE_DIR}/lib/atl)
+include_directories(${REACTOS_SOURCE_DIR}/lib/cryptlib)
list(APPEND SOURCE
aboutdlg.cpp
@@ -10,6 +11,7 @@
gui.cpp
installdlg.cpp
installed.cpp
+ integrity.cpp
loaddlg.cpp
misc.cpp
settingsdlg.cpp
Modified: trunk/reactos/base/applications/rapps_new/available.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/available.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/available.cpp [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -260,6 +260,7 @@
GET_STRING2(L"Size", Info->szSize);
GET_STRING2(L"URLSite", Info->szUrlSite);
GET_STRING2(L"CDPath", Info->szCDPath);
+ GET_STRING2(L"SHA1", Info->szSHA1);
}
if (!lpEnumProc(Info))
Added: trunk/reactos/base/applications/rapps_new/integrity.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/integrity.cpp (added)
+++ trunk/reactos/base/applications/rapps_new/integrity.cpp [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -0,0 +1,61 @@
+/*
+ * PROJECT: ReactOS Applications Manager
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: base/applications/rapps_new/integrity.cpp
+ * PURPOSE: Various integrity check mechanisms
+ * PROGRAMMERS: Ismael Ferreras Morezuelas (swyterzone+ros(a)gmail.com)
+ * Mark Jansen
+ */
+
+#include "rapps.h"
+#include <sha1.h>
+
+
+BOOL VerifyInteg(LPCWSTR lpSHA1Hash, LPCWSTR lpFileName)
+{
+ BOOL ret = FALSE;
+
+ /* first off, does it exist at all? */
+ HANDLE file = CreateFileW(lpFileName, GENERIC_READ, 0, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_READONLY, NULL);
+
+ if (file == INVALID_HANDLE_VALUE)
+ return FALSE;
+
+ /* let's grab the actual file size to organize the mmap'ing rounds */
+ LARGE_INTEGER size;
+ GetFileSizeEx(file, &size);
+
+ /* retrieve a handle to map the file contents to memory */
+ HANDLE map = CreateFileMappingW(file, NULL, PAGE_READONLY, 0, 0, NULL);
+ if (map)
+ {
+ /* map that thing in address space */
+ const unsigned char *file_map = static_cast<const unsigned char
*>(MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0));
+ if (file_map)
+ {
+ SHA_CTX ctx;
+ /* initialize the SHA-1 context */
+ A_SHAInit(&ctx);
+
+ /* feed the data to the cookie monster */
+ A_SHAUpdate(&ctx, file_map, size.LowPart);
+
+ /* cool, we don't need this anymore */
+ UnmapViewOfFile(file_map);
+
+ /* we're done, compute the final hash */
+ ULONG sha[5];
+ A_SHAFinal(&ctx, sha);
+
+ WCHAR buf[(sizeof(sha) * 2) + 1];
+ for (UINT i = 0; i < sizeof(sha); i++)
+ swprintf(buf + 2 * i, L"%02x", ((unsigned char *)sha)[i]);
+ /* does the resulting SHA1 match with the provided one? */
+ if (!_wcsicmp(buf, lpSHA1Hash))
+ ret = TRUE;
+ }
+ CloseHandle(map);
+ }
+ CloseHandle(file);
+ return ret;
+}
Propchange: trunk/reactos/base/applications/rapps_new/integrity.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/base/applications/rapps_new/lang/bg-BG.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/lang/bg-BG.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/lang/bg-BG.rc [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -201,4 +201,7 @@
IDS_INFORMATION "СведениÑ"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not
found!"
IDS_UNABLE_TO_REMOVE "ÐÑемаÑ
ванеÑо на данниÑе за пÑиложениеÑо Ð¾Ñ ÑегиÑÑÑÑа е
невÑзможно!"
-END
+ IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+ IDS_INTEG_CHECK_TITLE "Verifying package integrity..."
+ IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may have
been corrupted or tampered with during downloading. Running the software is not
recommended."
+END
Modified: trunk/reactos/base/applications/rapps_new/lang/cs-CZ.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/lang/cs-CZ.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/lang/cs-CZ.rc [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -202,4 +202,7 @@
IDS_INFORMATION "Informace"
IDS_UNABLE_TO_DOWNLOAD "Soubor se nepodaÅilo stáhnout! Adresa
nenalezena!"
IDS_UNABLE_TO_REMOVE "NepodaÅilo se odstranit data programu z registru!"
-END
+ IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+ IDS_INTEG_CHECK_TITLE "Verifying package integrity..."
+ IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may have
been corrupted or tampered with during downloading. Running the software is not
recommended."
+END
Modified: trunk/reactos/base/applications/rapps_new/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/lang/de-DE.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/lang/de-DE.rc [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -197,4 +197,7 @@
IDS_INFORMATION "Informationen"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not
found!"
IDS_UNABLE_TO_REMOVE "Konnte die Daten nicht aus der Registry löschen!"
-END
+ IDS_CERT_DOES_NOT_MATCH "Ãberprüfung des SSL-Zertifikats
fehlgeschlagen."
+ IDS_INTEG_CHECK_TITLE "Verifying package integrity..."
+ IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may have
been corrupted or tampered with during downloading. Running the software is not
recommended."
+END
Modified: trunk/reactos/base/applications/rapps_new/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/lang/en-US.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/lang/en-US.rc [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -197,4 +197,7 @@
IDS_INFORMATION "Information"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not
found!"
IDS_UNABLE_TO_REMOVE "Unable to remove data on the program from the
registry!"
-END
+ IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+ IDS_INTEG_CHECK_TITLE "Verifying package integrity..."
+ IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may have
been corrupted or tampered with during downloading. Running the software is not
recommended."
+END
Modified: trunk/reactos/base/applications/rapps_new/lang/es-ES.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/lang/es-ES.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/lang/es-ES.rc [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -200,4 +200,7 @@
IDS_INFORMATION "Información"
IDS_UNABLE_TO_DOWNLOAD "No se pudo descargar el paquete. No se ha encontrado la
dirección de Internet."
IDS_UNABLE_TO_REMOVE "No se pudieron borrar del Registro los datos de
instalación del programa."
-END
+ IDS_CERT_DOES_NOT_MATCH "Ha fallado la comprobación del certificado SSL."
+ IDS_INTEG_CHECK_TITLE "Verificando integridad del paquete..."
+ IDS_INTEG_CHECK_FAIL "El paquete no ha pasado la comprobación de integridad,
puede haber sido alterado o estar corrupto. No se recomienda ejecutarlo."
+END
Modified: trunk/reactos/base/applications/rapps_new/lang/fr-FR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/lang/fr-FR.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/lang/fr-FR.rc [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -197,4 +197,7 @@
IDS_INFORMATION "Information"
IDS_UNABLE_TO_DOWNLOAD "Impossible de télécharger le paquet : adresse
introuvable !"
IDS_UNABLE_TO_REMOVE "Impossible de supprimer du registre les données du
programme !"
-END
+ IDS_CERT_DOES_NOT_MATCH "La vérification du certificat SSL a échoué."
+ IDS_INTEG_CHECK_TITLE "Vérification de l'intégrité du paquet..."
+ IDS_INTEG_CHECK_FAIL "Le contrôle d'intégrité du paquet a échoué, il se
peut qu'il ait été corrompu ou altéré au cours du téléchargement.
L'exécution du programme n'est pas recommandée."
+END
Modified: trunk/reactos/base/applications/rapps_new/lang/he-IL.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/lang/he-IL.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/lang/he-IL.rc [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -199,4 +199,7 @@
IDS_INFORMATION "××××¢"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not
found!"
IDS_UNABLE_TO_REMOVE "Unable to remove data on the program from the
registry!"
-END
+ IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+ IDS_INTEG_CHECK_TITLE "Verifying package integrity..."
+ IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may have
been corrupted or tampered with during downloading. Running the software is not
recommended."
+END
Modified: trunk/reactos/base/applications/rapps_new/lang/it-IT.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/lang/it-IT.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/lang/it-IT.rc [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -197,4 +197,7 @@
IDS_INFORMATION "Informazioni"
IDS_UNABLE_TO_DOWNLOAD "Impossibile scaricare il pacchetto! Indirizzo non
trovato!"
IDS_UNABLE_TO_REMOVE "Impossibile cancellare i dati dal registro!"
-END
+ IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+ IDS_INTEG_CHECK_TITLE "Verifying package integrity..."
+ IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may have
been corrupted or tampered with during downloading. Running the software is not
recommended."
+END
Modified: trunk/reactos/base/applications/rapps_new/lang/ja-JP.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/lang/ja-JP.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/lang/ja-JP.rc [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -197,4 +197,7 @@
IDS_INFORMATION "æ
å ±"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not
found!"
IDS_UNABLE_TO_REMOVE
"ã¬ã¸ã¹ããªãããã®ããã°ã©ã ã«é¢ãããã¼ã¿ãåé¤ã§ãã¾ãã!"
-END
+ IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+ IDS_INTEG_CHECK_TITLE "Verifying package integrity..."
+ IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may have
been corrupted or tampered with during downloading. Running the software is not
recommended."
+END
Modified: trunk/reactos/base/applications/rapps_new/lang/no-NO.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/lang/no-NO.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/lang/no-NO.rc [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -197,4 +197,7 @@
IDS_INFORMATION "Information"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not
found!"
IDS_UNABLE_TO_REMOVE "Unable to remove data on the program from the
registry!"
-END
+ IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+ IDS_INTEG_CHECK_TITLE "Verifying package integrity..."
+ IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may have
been corrupted or tampered with during downloading. Running the software is not
recommended."
+END
Modified: trunk/reactos/base/applications/rapps_new/lang/pl-PL.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/lang/pl-PL.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/lang/pl-PL.rc [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -205,4 +205,7 @@
IDS_INFORMATION "Informacja"
IDS_UNABLE_TO_DOWNLOAD "Nie można pobraÄ pakietu! Nie znaleziono
adresu!"
IDS_UNABLE_TO_REMOVE "Nie można byÅo usunÄ
Ä wpisu z rejestru!"
-END
+ IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+ IDS_INTEG_CHECK_TITLE "Verifying package integrity..."
+ IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may have
been corrupted or tampered with during downloading. Running the software is not
recommended."
+END
Modified: trunk/reactos/base/applications/rapps_new/lang/pt-BR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/lang/pt-BR.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/lang/pt-BR.rc [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -199,4 +199,7 @@
IDS_INFORMATION "Informações"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not
found!"
IDS_UNABLE_TO_REMOVE "Não foi possÃvel remover as informações do programa do
registro!"
-END
+ IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+ IDS_INTEG_CHECK_TITLE "Verifying package integrity..."
+ IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may have
been corrupted or tampered with during downloading. Running the software is not
recommended."
+END
Modified: trunk/reactos/base/applications/rapps_new/lang/ro-RO.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/lang/ro-RO.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/lang/ro-RO.rc [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -203,4 +203,7 @@
IDS_INFORMATION "InformaÈie"
IDS_UNABLE_TO_DOWNLOAD "Pachetul nu poate fi descÄrcat! Adresa nu este
gÄsitÄ!"
IDS_UNABLE_TO_REMOVE "Nu se pot elimina datele din registru pentru acest
program!"
-END
+ IDS_CERT_DOES_NOT_MATCH "Verificarea certificatului SSL a eÈuat."
+ IDS_INTEG_CHECK_TITLE "Se verificÄ integritatea pachetuluiâ¦"
+ IDS_INTEG_CHECK_FAIL "Pachetul nu a trecut de verificarea de integritate.
Utilizarea programului nu este recomandatÄ."
+END
Modified: trunk/reactos/base/applications/rapps_new/lang/ru-RU.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/lang/ru-RU.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/lang/ru-RU.rc [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -197,4 +197,7 @@
IDS_INFORMATION "ÐнÑоÑмаÑиÑ"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not
found!"
IDS_UNABLE_TO_REMOVE "Ðе ÑдалоÑÑ ÑдалиÑÑ Ð´Ð°Ð½Ð½Ñе о
пÑогÑамме из ÑееÑÑÑа!"
-END
+ IDS_CERT_DOES_NOT_MATCH "ÐÑибка пÑовеÑки SSL
ÑеÑÑиÑикаÑа."
+ IDS_INTEG_CHECK_TITLE "ÐÑовеÑка ÑелоÑÑноÑÑи
пÑиложениÑ..."
+ IDS_INTEG_CHECK_FAIL "ÐÑиложение не пÑоÑло пÑовеÑкÑ
ÑелоÑÑноÑÑи, возможно оно бÑло повÑеждено или
подменено. ÐапÑÑк пÑÐ¸Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð½Ðµ
ÑекомендÑеÑÑÑ."
+END
Modified: trunk/reactos/base/applications/rapps_new/lang/sk-SK.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/lang/sk-SK.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/lang/sk-SK.rc [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -202,4 +202,7 @@
IDS_INFORMATION "Informácie"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not
found!"
IDS_UNABLE_TO_REMOVE "Nie je možné odstrániť z registrov údaje o
programe!"
-END
+ IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+ IDS_INTEG_CHECK_TITLE "Verifying package integrity..."
+ IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may have
been corrupted or tampered with during downloading. Running the software is not
recommended."
+END
Modified: trunk/reactos/base/applications/rapps_new/lang/sq-AL.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/lang/sq-AL.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/lang/sq-AL.rc [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -201,4 +201,7 @@
IDS_INFORMATION "Informacione"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not
found!"
IDS_UNABLE_TO_REMOVE "E pamundur te fshihen informacionet e programit nga
regjistri!"
-END
+ IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+ IDS_INTEG_CHECK_TITLE "Verifying package integrity..."
+ IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may have
been corrupted or tampered with during downloading. Running the software is not
recommended."
+END
Modified: trunk/reactos/base/applications/rapps_new/lang/sv-SE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/lang/sv-SE.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/lang/sv-SE.rc [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -204,4 +204,7 @@
IDS_INFORMATION "Information"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not
found!"
IDS_UNABLE_TO_REMOVE "Det gick ej att ta bort programmets data från
registret!"
-END
+ IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+ IDS_INTEG_CHECK_TITLE "Verifying package integrity..."
+ IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may have
been corrupted or tampered with during downloading. Running the software is not
recommended."
+END
Modified: trunk/reactos/base/applications/rapps_new/lang/tr-TR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/lang/tr-TR.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/lang/tr-TR.rc [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -199,4 +199,7 @@
IDS_INFORMATION "Bilgi"
IDS_UNABLE_TO_DOWNLOAD "Paket indirilemez! Adres bulunamadı!"
IDS_UNABLE_TO_REMOVE "Ä°zlencenin giriÅi deÄer defterinden silinemiyor."
-END
+ IDS_CERT_DOES_NOT_MATCH "SSL onay belgesi doÄrulaması baÅarısız."
+ IDS_INTEG_CHECK_TITLE "Paket bütünlüÄü doÄrulanıyor..."
+ IDS_INTEG_CHECK_FAIL "Paket bütünlük denetimini geçmedi, bozulmuŠveyâ
indirme esnâsında oynanmıŠolabilir. Yazılımı çalıÅtırmak önerilmez."
+END
Modified: trunk/reactos/base/applications/rapps_new/lang/uk-UA.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/lang/uk-UA.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/lang/uk-UA.rc [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -205,4 +205,7 @@
IDS_INFORMATION "ÐнÑоÑмаÑÑÑ"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not
found!"
IDS_UNABLE_TO_REMOVE "Ðе вдалоÑÑ Ð²Ð¸Ð´Ð°Ð»Ð¸Ñи Ð´Ð°Ð½Ñ Ð¿Ñо
пÑогÑÐ°Ð¼Ñ Ð· ÑеÑÑÑÑÑ!"
-END
+ IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+ IDS_INTEG_CHECK_TITLE "Verifying package integrity..."
+ IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may have
been corrupted or tampered with during downloading. Running the software is not
recommended."
+END
Modified: trunk/reactos/base/applications/rapps_new/lang/zh-CN.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/lang/zh-CN.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/lang/zh-CN.rc [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -199,4 +199,7 @@
IDS_INFORMATION "ä¿¡æ¯"
IDS_UNABLE_TO_DOWNLOAD "æ æ³ä¸è½½è¯¥è½¯ä»¶å
ï¼æ¾ä¸å°ç½ç»çå°å ï¼"
IDS_UNABLE_TO_REMOVE "æ æ³ä»æ³¨å表å é¤è¯¥ç¨åºçæ°æ®ï¼"
-END
+ IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+ IDS_INTEG_CHECK_TITLE "Verifying package integrity..."
+ IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may have
been corrupted or tampered with during downloading. Running the software is not
recommended."
+END
Modified: trunk/reactos/base/applications/rapps_new/lang/zh-TW.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/lang/zh-TW.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/lang/zh-TW.rc [iso-8859-1] Fri Mar 18
06:40:39 2016
@@ -199,4 +199,7 @@
IDS_INFORMATION "è³è¨"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not
found!"
IDS_UNABLE_TO_REMOVE "ç¡æ³å¾ç»éæªåªé¤è©²ç¨å¼çè³æï¼"
-END
+ IDS_CERT_DOES_NOT_MATCH "SSL æèé©è失æã"
+ IDS_INTEG_CHECK_TITLE "é©èå¥è£è»é«çå®æ´æ§..."
+ IDS_INTEG_CHECK_FAIL "å
æ²æééå®æ´æ§æª¢æ¥ï¼å®å¯è½å·²æå£ï¼æè
å¨ä¸è¼éç¨ä¸ç¯¡æ¹ã建è°æ¨ä¸è¦éè¡è©²è»é«ã"
+END
Modified: trunk/reactos/base/applications/rapps_new/loaddlg.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/loaddlg.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/loaddlg.cpp [iso-8859-1] Fri Mar 18 06:40:39
2016
@@ -207,6 +207,13 @@
if (FAILED(StringCbCatW(path, sizeof(path), p + 1)))
goto end;
+ if (!bCab && AppInfo->szSHA1[0] != 0 && GetFileAttributesW(path)
!= INVALID_FILE_ATTRIBUTES)
+ {
+ /* only open it in case of total correctness */
+ if (VerifyInteg(AppInfo->szSHA1, path))
+ goto run;
+ }
+
/* download it */
bTempfile = TRUE;
CDownloadDialog_Constructor(Dlg, &bCancelled, IID_PPV_ARG(IBindStatusCallback,
&dl));
@@ -293,8 +300,32 @@
if (bCancelled)
goto end;
+ /* if this thing isn't a RAPPS update and it has a SHA-1 checksum
+ verify its integrity by using the native advapi32.A_SHA1 functions */
+ if (!bCab && AppInfo->szSHA1[0] != 0)
+ {
+ WCHAR szMsgText[MAX_STR_LEN];
+
+ /* change a few strings in the download dialog to reflect the verification
process */
+ LoadStringW(hInst, IDS_INTEG_CHECK_TITLE, szMsgText, _countof(szMsgText));
+
+ SetWindowText(Dlg, szMsgText);
+ SendMessageW(GetDlgItem(Dlg, IDC_DOWNLOAD_STATUS), WM_SETTEXT, 0, (LPARAM)path);
+
+ /* this may take a while, depending on the file size */
+ if (!VerifyInteg(AppInfo->szSHA1, path))
+ {
+ if (!LoadStringW(hInst, IDS_INTEG_CHECK_FAIL, szMsgText,
_countof(szMsgText)))
+ goto end;
+
+ MessageBoxW(Dlg, szMsgText, NULL, MB_OK | MB_ICONERROR);
+ goto end;
+ }
+ }
+
ShowWindow(Dlg, SW_HIDE);
+run:
/* run it */
if (!bCab)
ShellExecuteW( NULL, L"open", path, NULL, NULL, SW_SHOWNORMAL );
Modified: trunk/reactos/base/applications/rapps_new/rapps.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/rapps.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/rapps.h [iso-8859-1] Fri Mar 18 06:40:39
2016
@@ -89,8 +89,8 @@
FILETIME ftCacheStamp;
LIST_ENTRY List;
- /* optional integrity checks */
- BYTE MD5Checksum[16];
+ /* optional integrity checks (SHA-1 digests are 160 bit = 40 characters in hex string
form) */
+ WCHAR szSHA1[40 + 1];
} APPLICATION_INFO, *PAPPLICATION_INFO;
@@ -185,6 +185,9 @@
extern HWND hListView;
extern WCHAR szSearchPattern[MAX_STR_LEN];
+/* integrity.cpp */
+BOOL VerifyInteg(LPCWSTR lpSHA1Hash, LPCWSTR lpFileName);
+
//extern HWND hTreeView;
//BOOL CreateTreeView(HWND hwnd);
//HTREEITEM TreeViewAddItem(HTREEITEM hParent, LPWSTR lpText, INT Image, INT
SelectedImage, LPARAM lParam);
Modified: trunk/reactos/base/applications/rapps_new/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/resource.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/resource.h [iso-8859-1] Fri Mar 18 06:40:39
2016
@@ -96,6 +96,9 @@
#define IDS_INFORMATION 117
#define IDS_UNABLE_TO_REMOVE 118
#define IDS_UNABLE_TO_DOWNLOAD 119
+#define IDS_CERT_DOES_NOT_MATCH 120
+#define IDS_INTEG_CHECK_TITLE 121
+#define IDS_INTEG_CHECK_FAIL 122
/* Tooltips */
#define IDS_TOOLTIP_INSTALL 200
Modified: trunk/reactos/lib/cryptlib/sha1.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cryptlib/sha1.h?rev=71…
==============================================================================
--- trunk/reactos/lib/cryptlib/sha1.h [iso-8859-1] (original)
+++ trunk/reactos/lib/cryptlib/sha1.h [iso-8859-1] Fri Mar 18 06:40:39 2016
@@ -1,5 +1,10 @@
#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <ntdef.h>
@@ -21,4 +26,7 @@
VOID NTAPI
A_SHAFinal(PSHA_CTX Context, PULONG Result);
+#ifdef __cplusplus
+}
+#endif