[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
This commit is contained in:
Baruch Rutman 2019-02-10 18:57:43 +02:00 committed by Hermès BÉLUSCA - MAÏTO
parent c0d97cec88
commit d56d9c1aaa
9 changed files with 71 additions and 4 deletions

View file

@ -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

View file

@ -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)

View file

@ -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);
}
}
}
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -13,6 +13,6 @@
#include <wincrypt.h>
#include <winuser.h>
#include <cryptuiapi.h>
#include "resource.h"
#endif /* CRYPTEXT_PRECOMP_H */

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View file

@ -0,0 +1,2 @@
#define IDS_INVALIDFILE 100
#define IDS_CER_FILE 101