https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d56d9c1aaa6107394f6bc1...
commit d56d9c1aaa6107394f6bc13570de8ca08a917b80 Author: Baruch Rutman peterooch@gmail.com AuthorDate: Sun Feb 10 18:57:43 2019 +0200 Commit: Hermès BÉLUSCA - MAÏTO hermes.belusca-maito@reactos.org CommitDate: Sun Feb 10 17:57:43 2019 +0100
[CRYPTEXT] Make extension localizable, and add an icon for certificate files (#1347)
- Localize error message and shell file extension description. - Added Hebrew resources. - Added Icon.
The icon is the Tango icon named "certificate". If anybody has a idea for more fitting icon please recommend it.
Follow up of #1343
CORE-15736 --- boot/bootdata/hivecls.inf | 3 +++ dll/shellext/cryptext/CMakeLists.txt | 1 + dll/shellext/cryptext/cryptext.c | 17 ++++++++++++++--- dll/shellext/cryptext/cryptext.rc | 22 ++++++++++++++++++++++ dll/shellext/cryptext/lang/en-US.rc | 14 ++++++++++++++ dll/shellext/cryptext/lang/he-IL.rc | 14 ++++++++++++++ dll/shellext/cryptext/precomp.h | 2 +- dll/shellext/cryptext/res/cerfile.ico | Bin 0 -> 9662 bytes dll/shellext/cryptext/resource.h | 2 ++ 9 files changed, 71 insertions(+), 4 deletions(-)
diff --git a/boot/bootdata/hivecls.inf b/boot/bootdata/hivecls.inf index 37d81fd4b1..1b38c910e5 100644 --- a/boot/bootdata/hivecls.inf +++ b/boot/bootdata/hivecls.inf @@ -78,6 +78,9 @@ HKCR,"batfile\shell\open\command","",0x00000000,"""%1"" %*"
; Certificate HKCR,".cer","",0x00000000,"cerfile" +HKCR,"cerfile","",0x00000000,"Certificate File" +HKCR,"cerfile","FriendlyTypeName",0x00020000,"@%SystemRoot%\system32\cryptext.dll,-101" +HKCR,"cerfile\DefaultIcon","",0x00020000,"%SystemRoot%\system32\cryptext.dll,-1" HKCR,"cerfile\shell\open\command","",0x00020000,"%SystemRoot%\system32\rundll32.exe cryptext.dll,CryptExtOpenCER %1"
; ReactOS Command Script Files diff --git a/dll/shellext/cryptext/CMakeLists.txt b/dll/shellext/cryptext/CMakeLists.txt index faa2301ce9..8cd10f4a43 100644 --- a/dll/shellext/cryptext/CMakeLists.txt +++ b/dll/shellext/cryptext/CMakeLists.txt @@ -8,6 +8,7 @@ list(APPEND SOURCE add_library(cryptext SHARED ${SOURCE} cryptext.spec + cryptext.rc ${CMAKE_CURRENT_BINARY_DIR}/cryptext.def)
set_module_type(cryptext win32dll UNICODE) diff --git a/dll/shellext/cryptext/cryptext.c b/dll/shellext/cryptext/cryptext.c index 8825f41b91..ae5e40b813 100644 --- a/dll/shellext/cryptext/cryptext.c +++ b/dll/shellext/cryptext/cryptext.c @@ -7,12 +7,14 @@
#include "precomp.h"
+HINSTANCE g_hInstance;
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { switch (dwReason) { case DLL_PROCESS_ATTACH: + g_hInstance = hInstance; DisableThreadLibraryCalls(hInstance); break; } @@ -29,15 +31,24 @@ VOID WINAPI CryptExtOpenCERW(HWND hWnd, HINSTANCE hInst, LPCWSTR file, DWORD nCm if (CryptQueryObject(CERT_QUERY_OBJECT_FILE, file, CERT_QUERY_CONTENT_FLAG_CERT, CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, NULL, NULL, NULL, NULL, (CONST VOID**)&pvContext)) { - CRYPTUI_VIEWCERTIFICATE_STRUCT CertViewInfo = {0}; + CRYPTUI_VIEWCERTIFICATE_STRUCTW CertViewInfo = {0}; CertViewInfo.dwSize = sizeof(CertViewInfo); CertViewInfo.pCertContext = pvContext; - CryptUIDlgViewCertificate(&CertViewInfo, NULL); + CryptUIDlgViewCertificateW(&CertViewInfo, NULL); CertFreeCertificateContext(pvContext); } else { - MessageBoxW(NULL, L"This is not a valid certificate", NULL, MB_OK); + WCHAR Message[MAX_PATH]; + + if (LoadStringW(g_hInstance, IDS_INVALIDFILE, Message, MAX_PATH)) + { + MessageBoxW(NULL, Message, NULL, MB_OK); + } + else + { + MessageBoxW(NULL, L"This is not a valid certificate file.", NULL, MB_OK); + } } } } diff --git a/dll/shellext/cryptext/cryptext.rc b/dll/shellext/cryptext/cryptext.rc new file mode 100644 index 0000000000..e12afbdb4e --- /dev/null +++ b/dll/shellext/cryptext/cryptext.rc @@ -0,0 +1,22 @@ +#include <windef.h> +#include <winuser.h> + +#include "resource.h" + +1 ICON "res/cerfile.ico" + +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS CryptExt Shell Extension" +#define REACTOS_STR_INTERNAL_NAME "cryptext" +#define REACTOS_STR_ORIGINAL_FILENAME "cryptext.dll" +#include <reactos/version.rc> + +/* UTF-8 */ +#pragma code_page(65001) + +#ifdef LANGUAGE_EN_US + #include "lang/en-US.rc" +#endif +#ifdef LANGUAGE_HE_IL + #include "lang/he-IL.rc" +#endif diff --git a/dll/shellext/cryptext/lang/en-US.rc b/dll/shellext/cryptext/lang/en-US.rc new file mode 100644 index 0000000000..5aeae89dbf --- /dev/null +++ b/dll/shellext/cryptext/lang/en-US.rc @@ -0,0 +1,14 @@ +/* + * PROJECT: ReactOS CryptExt Shell Extension + * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) + * PURPOSE: English (United States) resource translation + * COPYRIGHT: Copyright 2019 Mark Jansen (mark.jansen@reactos.org) + */ + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +STRINGTABLE +BEGIN + IDS_INVALIDFILE "This is not a valid certificate file." + IDS_CER_FILE "Certificate File" +END diff --git a/dll/shellext/cryptext/lang/he-IL.rc b/dll/shellext/cryptext/lang/he-IL.rc new file mode 100644 index 0000000000..5d821eb5a2 --- /dev/null +++ b/dll/shellext/cryptext/lang/he-IL.rc @@ -0,0 +1,14 @@ +/* + * PROJECT: ReactOS CryptExt Shell Extension + * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) + * PURPOSE: Hebrew resource translation + * COPYRIGHT: Copyright 2019 Baruch Rutman (peterooch at gmail dot com) + */ + +LANGUAGE LANG_HEBREW, SUBLANG_DEFAULT + +STRINGTABLE +BEGIN + IDS_INVALIDFILE "קובץ זה הוא לא קובץ אישורי הצפנה תקין." + IDS_CER_FILE "קובץ אישורי הצפנה" +END diff --git a/dll/shellext/cryptext/precomp.h b/dll/shellext/cryptext/precomp.h index e9df5d3270..21067f510b 100644 --- a/dll/shellext/cryptext/precomp.h +++ b/dll/shellext/cryptext/precomp.h @@ -13,6 +13,6 @@ #include <wincrypt.h> #include <winuser.h> #include <cryptuiapi.h> - +#include "resource.h"
#endif /* CRYPTEXT_PRECOMP_H */ diff --git a/dll/shellext/cryptext/res/cerfile.ico b/dll/shellext/cryptext/res/cerfile.ico new file mode 100644 index 0000000000..362fb40f88 Binary files /dev/null and b/dll/shellext/cryptext/res/cerfile.ico differ diff --git a/dll/shellext/cryptext/resource.h b/dll/shellext/cryptext/resource.h new file mode 100644 index 0000000000..1ec6542a78 --- /dev/null +++ b/dll/shellext/cryptext/resource.h @@ -0,0 +1,2 @@ +#define IDS_INVALIDFILE 100 +#define IDS_CER_FILE 101