HKCR,"batfile\shell\edit\command","",0x00020000,"%SystemRoot%\system32\notepad.exe ""%1"""
HKCR,"batfile\shell\open\command","",0x00000000,"""%1"" %*"
+; Certificate
+HKCR,".cer","",0x00000000,"cerfile"
+HKCR,"cerfile\shell\open\command","",0x00020000,"%SystemRoot%\system32\rundll32.exe cryptext.dll,CryptExtOpenCER %1"
+
; ReactOS Command Script Files
HKCR,".cmd","",0x00000000,"cmdfile"
HKCR,"cmdfile","",0x00000000,"ReactOS Command Script"
--- /dev/null
+
+spec2def(cryptext.dll cryptext.spec)
+
+list(APPEND SOURCE
+ cryptext.c
+ precomp.h)
+
+add_library(cryptext SHARED
+ ${SOURCE}
+ cryptext.spec
+ ${CMAKE_CURRENT_BINARY_DIR}/cryptext.def)
+
+set_module_type(cryptext win32dll UNICODE)
+target_link_libraries(cryptext uuid)
+add_importlibs(cryptext cryptui crypt32 user32 msvcrt kernel32 ntdll)
+add_pch(cryptext precomp.h SOURCE)
+add_cd_file(TARGET cryptext DESTINATION reactos/system32 FOR all)
--- /dev/null
+/*
+ * PROJECT: ReactOS CryptExt Shell Extension
+ * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: cryptext implementation
+ * COPYRIGHT: Copyright 2019 Mark Jansen (mark.jansen@reactos.org)
+ */
+
+#include "precomp.h"
+
+
+BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
+{
+ switch (dwReason)
+ {
+ case DLL_PROCESS_ATTACH:
+ DisableThreadLibraryCalls(hInstance);
+ break;
+ }
+
+ return TRUE;
+}
+
+EXTERN_C
+VOID WINAPI CryptExtOpenCERW(HWND hWnd, HINSTANCE hInst, LPCWSTR file, DWORD nCmdShow)
+{
+ PCCERT_CONTEXT pvContext;
+ if (file)
+ {
+ 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};
+ CertViewInfo.dwSize = sizeof(CertViewInfo);
+ CertViewInfo.pCertContext = pvContext;
+ CryptUIDlgViewCertificate(&CertViewInfo, NULL);
+ CertFreeCertificateContext(pvContext);
+ }
+ else
+ {
+ MessageBoxW(NULL, L"This is not a valid certificate", NULL, MB_OK);
+ }
+ }
+}
+
+EXTERN_C
+VOID WINAPI CryptExtOpenCER(HWND hWnd, HINSTANCE hInst, LPCSTR file, DWORD nCmdShow)
+{
+ LPWSTR fileW;
+ int len;
+
+ if (file)
+ {
+
+ len = MultiByteToWideChar(CP_ACP, 0, file, -1, NULL, 0);
+ fileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+ if (fileW)
+ {
+ MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, len);
+ CryptExtOpenCERW(hWnd, hInst, fileW, nCmdShow);
+ HeapFree(GetProcessHeap(), 0, fileW);
+ }
+ }
+}