diff --git a/boot/bootdata/hivecls.inf b/boot/bootdata/hivecls.inf index 37d81fd4b12..1b38c910e56 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 faa2301ce9a..8cd10f4a431 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 8825f41b91b..ae5e40b813e 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 00000000000..e12afbdb4e5 --- /dev/null +++ b/dll/shellext/cryptext/cryptext.rc @@ -0,0 +1,22 @@ +#include +#include + +#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 + +/* 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 00000000000..5aeae89dbff --- /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 00000000000..5d821eb5a2b --- /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 e9df5d3270b..21067f510be 100644 --- a/dll/shellext/cryptext/precomp.h +++ b/dll/shellext/cryptext/precomp.h @@ -13,6 +13,6 @@ #include #include #include - +#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 00000000000..362fb40f88a 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 00000000000..1ec6542a784 --- /dev/null +++ b/dll/shellext/cryptext/resource.h @@ -0,0 +1,2 @@ +#define IDS_INVALIDFILE 100 +#define IDS_CER_FILE 101