ReactOS  0.4.15-dev-1397-g19779b3
cryptext.c File Reference
#include "precomp.h"
Include dependency graph for cryptext.c:

Go to the source code of this file.

Functions

BOOL WINAPI DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
 
EXTERN_C VOID WINAPI CryptExtOpenCERW (HWND hWnd, HINSTANCE hInst, LPCWSTR file, DWORD nCmdShow)
 
EXTERN_C VOID WINAPI CryptExtOpenCER (HWND hWnd, HINSTANCE hInst, LPCSTR file, DWORD nCmdShow)
 

Variables

HINSTANCE g_hInstance
 

Function Documentation

◆ CryptExtOpenCER()

EXTERN_C VOID WINAPI CryptExtOpenCER ( HWND  hWnd,
HINSTANCE  hInst,
LPCSTR  file,
DWORD  nCmdShow 
)

Definition at line 57 of file cryptext.c.

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 }
EXTERN_C VOID WINAPI CryptExtOpenCERW(HWND hWnd, HINSTANCE hInst, LPCWSTR file, DWORD nCmdShow)
Definition: cryptext.c:26
#define CP_ACP
Definition: compat.h:109
HWND hWnd
Definition: settings.c:17
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLsizei len
Definition: glext.h:6722
HINSTANCE hInst
Definition: dxdiag.c:13
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static const WCHAR fileW[]
Definition: url.c:111
#define HeapFree(x, y, z)
Definition: compat.h:594
Definition: fci.c:126

◆ CryptExtOpenCERW()

EXTERN_C VOID WINAPI CryptExtOpenCERW ( HWND  hWnd,
HINSTANCE  hInst,
LPCWSTR  file,
DWORD  nCmdShow 
)

Definition at line 26 of file cryptext.c.

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 }
BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT pCertContext)
Definition: cert.c:371
#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)
#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
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:34
CHAR Message[80]
Definition: alive.c:5
static const WCHAR L[]
Definition: oid.c:1250
HINSTANCE g_hInstance
Definition: cryptext.c:10
#define CERT_QUERY_FORMAT_FLAG_ALL
Definition: wincrypt.h:3589
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
BOOL WINAPI CryptUIDlgViewCertificateW(PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo, BOOL *pfPropertiesChanged)
Definition: main.c:4395
#define CONST
Definition: pedump.c:81
Definition: fci.c:126

Referenced by CryptExtOpenCER().

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hInstance,
DWORD  dwReason,
LPVOID  lpReserved 
)

Definition at line 12 of file cryptext.c.

13 {
14  switch (dwReason)
15  {
16  case DLL_PROCESS_ATTACH:
19  break;
20  }
21 
22  return TRUE;
23 }
#define TRUE
Definition: types.h:120
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
DWORD dwReason
Definition: misc.cpp:154
HINSTANCE hInstance
Definition: charmap.c:20
HINSTANCE g_hInstance
Definition: cryptext.c:10

Variable Documentation

◆ g_hInstance

HINSTANCE g_hInstance

Definition at line 10 of file cryptext.c.

Referenced by CryptExtOpenCERW(), and DllMain().