ReactOS  0.4.13-dev-66-gc714b7f
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  {
16  case DLL_PROCESS_ATTACH:
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);
38  CertFreeCertificateContext(pvContext);
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 {
59  LPWSTR fileW;
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 }
#define TRUE
Definition: types.h:120
EXTERN_C VOID WINAPI CryptExtOpenCERW(HWND hWnd, HINSTANCE hInst, LPCWSTR file, DWORD nCmdShow)
Definition: cryptext.c:26
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define CP_ACP
Definition: compat.h:99
BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT pCertContext)
Definition: cert.c:371
HWND hWnd
Definition: settings.c:17
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
#define CERT_QUERY_OBJECT_FILE
Definition: wincrypt.h:3526
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
DWORD dwReason
Definition: misc.cpp:154
HINSTANCE hInstance
Definition: charmap.c:20
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
Definition: cryptext.c:12
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
#define IDS_INVALIDFILE
Definition: resource.h:1
#define CERT_QUERY_CONTENT_FLAG_CERT
Definition: wincrypt.h:3543
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
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:8
unsigned long DWORD
Definition: ntddk_ex.h:95
CHAR Message[80]
Definition: alive.c:5
static const WCHAR L[]
Definition: oid.c:1250
GLenum GLsizei len
Definition: glext.h:6722
HINSTANCE hInst
Definition: dxdiag.c:13
HINSTANCE g_hInstance
Definition: cryptext.c:10
#define CERT_QUERY_FORMAT_FLAG_ALL
Definition: wincrypt.h:3589
#define MB_OK
Definition: winuser.h:784
BOOL WINAPI CryptUIDlgViewCertificateW(PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo, BOOL *pfPropertiesChanged)
Definition: main.c:4397
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184
EXTERN_C VOID WINAPI CryptExtOpenCER(HWND hWnd, HINSTANCE hInst, LPCSTR file, DWORD nCmdShow)
Definition: cryptext.c:57
#define EXTERN_C
Definition: basetyps.h:12
static const WCHAR fileW[]
Definition: url.c:111
#define HeapFree(x, y, z)
Definition: compat.h:394
#define CONST
Definition: pedump.c:81
Definition: fci.c:126