ReactOS 0.4.15-dev-7834-g00c4b3d
cryptext.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS CryptExt Shell Extension
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: cryptext implementation
5 * COPYRIGHT: Copyright 2019 Mark Jansen (mark.jansen@reactos.org)
6 */
7
8#include "precomp.h"
9
11
13{
14 switch (dwReason)
15 {
19 break;
20 }
21
22 return TRUE;
23}
24
27{
28 PCCERT_CONTEXT pvContext;
29 if (file)
30 {
32 0, NULL, NULL, NULL, NULL, NULL, (CONST VOID**)&pvContext))
33 {
34 CRYPTUI_VIEWCERTIFICATE_STRUCTW CertViewInfo = {0};
35 CertViewInfo.dwSize = sizeof(CertViewInfo);
36 CertViewInfo.pCertContext = pvContext;
37 CryptUIDlgViewCertificateW(&CertViewInfo, NULL);
39 }
40 else
41 {
43
45 {
47 }
48 else
49 {
50 MessageBoxW(NULL, L"This is not a valid certificate file.", NULL, MB_OK);
51 }
52 }
53 }
54}
55
58{
60 int len;
61
62 if (file)
63 {
64
65 len = MultiByteToWideChar(CP_ACP, 0, file, -1, NULL, 0);
66 fileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
67 if (fileW)
68 {
70 CryptExtOpenCERW(hWnd, hInst, fileW, nCmdShow);
72 }
73 }
74}
HWND hWnd
Definition: settings.c:17
DWORD dwReason
Definition: misc.cpp:154
#define EXTERN_C
Definition: basetyps.h:12
HINSTANCE hInstance
Definition: charmap.c:19
EXTERN_C VOID WINAPI CryptExtOpenCERW(HWND hWnd, HINSTANCE hInst, LPCWSTR file, DWORD nCmdShow)
Definition: cryptext.c:26
EXTERN_C VOID WINAPI CryptExtOpenCER(HWND hWnd, HINSTANCE hInst, LPCSTR file, DWORD nCmdShow)
Definition: cryptext.c:57
HINSTANCE g_hInstance
Definition: cryptext.c:10
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
Definition: cryptext.c:12
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define IDS_INVALIDFILE
Definition: resource.h:1
BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT pCertContext)
Definition: cert.c:371
BOOL WINAPI CryptQueryObject(DWORD dwObjectType, const void *pvObject, DWORD dwExpectedContentTypeFlags, DWORD dwExpectedFormatTypeFlags, DWORD dwFlags, DWORD *pdwMsgAndCertEncodingType, DWORD *pdwContentType, DWORD *pdwFormatType, HCERTSTORE *phCertStore, HCRYPTMSG *phMsg, const void **ppvContext)
Definition: object.c:699
BOOL WINAPI CryptUIDlgViewCertificateW(PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo, BOOL *pfPropertiesChanged)
Definition: main.c:4413
#define GetProcessHeap()
Definition: compat.h:736
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define MultiByteToWideChar
Definition: compat.h:110
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
static const WCHAR fileW[]
Definition: url.c:111
static const WCHAR Message[]
Definition: register.c:74
HINSTANCE hInst
Definition: dxdiag.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define L(x)
Definition: ntvdm.h:50
#define CONST
Definition: pedump.c:81
Definition: fci.c:127
#define CERT_QUERY_OBJECT_FILE
Definition: wincrypt.h:3526
#define CERT_QUERY_CONTENT_FLAG_CERT
Definition: wincrypt.h:3543
#define CERT_QUERY_FORMAT_FLAG_ALL
Definition: wincrypt.h:3589
#define WINAPI
Definition: msvc.h:6
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_OK
Definition: winuser.h:790
const char * LPCSTR
Definition: xmlstorage.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185