Reactos

[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

authored by

Baruch Rutman and committed by
Hermès BÉLUSCA - MAÏTO
d56d9c1a c0d97cec

+71 -4
+3
boot/bootdata/hivecls.inf
··· 78 78 79 79 ; Certificate 80 80 HKCR,".cer","",0x00000000,"cerfile" 81 + HKCR,"cerfile","",0x00000000,"Certificate File" 82 + HKCR,"cerfile","FriendlyTypeName",0x00020000,"@%SystemRoot%\system32\cryptext.dll,-101" 83 + HKCR,"cerfile\DefaultIcon","",0x00020000,"%SystemRoot%\system32\cryptext.dll,-1" 81 84 HKCR,"cerfile\shell\open\command","",0x00020000,"%SystemRoot%\system32\rundll32.exe cryptext.dll,CryptExtOpenCER %1" 82 85 83 86 ; ReactOS Command Script Files
+1
dll/shellext/cryptext/CMakeLists.txt
··· 8 8 add_library(cryptext SHARED 9 9 ${SOURCE} 10 10 cryptext.spec 11 + cryptext.rc 11 12 ${CMAKE_CURRENT_BINARY_DIR}/cryptext.def) 12 13 13 14 set_module_type(cryptext win32dll UNICODE)
+14 -3
dll/shellext/cryptext/cryptext.c
··· 7 7 8 8 #include "precomp.h" 9 9 10 + HINSTANCE g_hInstance; 10 11 11 12 BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) 12 13 { 13 14 switch (dwReason) 14 15 { 15 16 case DLL_PROCESS_ATTACH: 17 + g_hInstance = hInstance; 16 18 DisableThreadLibraryCalls(hInstance); 17 19 break; 18 20 } ··· 29 31 if (CryptQueryObject(CERT_QUERY_OBJECT_FILE, file, CERT_QUERY_CONTENT_FLAG_CERT, CERT_QUERY_FORMAT_FLAG_ALL, 30 32 0, NULL, NULL, NULL, NULL, NULL, (CONST VOID**)&pvContext)) 31 33 { 32 - CRYPTUI_VIEWCERTIFICATE_STRUCT CertViewInfo = {0}; 34 + CRYPTUI_VIEWCERTIFICATE_STRUCTW CertViewInfo = {0}; 33 35 CertViewInfo.dwSize = sizeof(CertViewInfo); 34 36 CertViewInfo.pCertContext = pvContext; 35 - CryptUIDlgViewCertificate(&CertViewInfo, NULL); 37 + CryptUIDlgViewCertificateW(&CertViewInfo, NULL); 36 38 CertFreeCertificateContext(pvContext); 37 39 } 38 40 else 39 41 { 40 - MessageBoxW(NULL, L"This is not a valid certificate", NULL, MB_OK); 42 + WCHAR Message[MAX_PATH]; 43 + 44 + if (LoadStringW(g_hInstance, IDS_INVALIDFILE, Message, MAX_PATH)) 45 + { 46 + MessageBoxW(NULL, Message, NULL, MB_OK); 47 + } 48 + else 49 + { 50 + MessageBoxW(NULL, L"This is not a valid certificate file.", NULL, MB_OK); 51 + } 41 52 } 42 53 } 43 54 }
+22
dll/shellext/cryptext/cryptext.rc
··· 1 + #include <windef.h> 2 + #include <winuser.h> 3 + 4 + #include "resource.h" 5 + 6 + 1 ICON "res/cerfile.ico" 7 + 8 + #define REACTOS_VERSION_DLL 9 + #define REACTOS_STR_FILE_DESCRIPTION "ReactOS CryptExt Shell Extension" 10 + #define REACTOS_STR_INTERNAL_NAME "cryptext" 11 + #define REACTOS_STR_ORIGINAL_FILENAME "cryptext.dll" 12 + #include <reactos/version.rc> 13 + 14 + /* UTF-8 */ 15 + #pragma code_page(65001) 16 + 17 + #ifdef LANGUAGE_EN_US 18 + #include "lang/en-US.rc" 19 + #endif 20 + #ifdef LANGUAGE_HE_IL 21 + #include "lang/he-IL.rc" 22 + #endif
+14
dll/shellext/cryptext/lang/en-US.rc
··· 1 + /* 2 + * PROJECT: ReactOS CryptExt Shell Extension 3 + * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) 4 + * PURPOSE: English (United States) resource translation 5 + * COPYRIGHT: Copyright 2019 Mark Jansen (mark.jansen@reactos.org) 6 + */ 7 + 8 + LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 9 + 10 + STRINGTABLE 11 + BEGIN 12 + IDS_INVALIDFILE "This is not a valid certificate file." 13 + IDS_CER_FILE "Certificate File" 14 + END
+14
dll/shellext/cryptext/lang/he-IL.rc
··· 1 + /* 2 + * PROJECT: ReactOS CryptExt Shell Extension 3 + * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) 4 + * PURPOSE: Hebrew resource translation 5 + * COPYRIGHT: Copyright 2019 Baruch Rutman (peterooch at gmail dot com) 6 + */ 7 + 8 + LANGUAGE LANG_HEBREW, SUBLANG_DEFAULT 9 + 10 + STRINGTABLE 11 + BEGIN 12 + IDS_INVALIDFILE "קובץ זה הוא לא קובץ אישורי הצפנה תקין." 13 + IDS_CER_FILE "קובץ אישורי הצפנה" 14 + END
+1 -1
dll/shellext/cryptext/precomp.h
··· 13 13 #include <wincrypt.h> 14 14 #include <winuser.h> 15 15 #include <cryptuiapi.h> 16 - 16 + #include "resource.h" 17 17 18 18 #endif /* CRYPTEXT_PRECOMP_H */
dll/shellext/cryptext/res/cerfile.ico

This is a binary file and will not be displayed.

+2
dll/shellext/cryptext/resource.h
··· 1 + #define IDS_INVALIDFILE 100 2 + #define IDS_CER_FILE 101