ReactOS 0.4.16-dev-2284-g3529151
CStore Class Reference

#include <CStore.hpp>

Collaboration diagram for CStore:

Public Member Functions

 CStore (_In_ LPCWSTR cryptName, DWORD dwFlags)
 
 ~CStore ()
 
LPCWSTR GetStoreName () const
 
void Expand ()
 
void EnumCertificates ()
 
template<typename Fn >
void ForEach (Fn callback)
 

Private Member Functions

HCERTSTORE StoreHandle ()
 

Private Attributes

CAtlStringW m_CryptName
 
DWORD m_dwFlags
 
CAtlStringW m_StoreName
 
HCERTSTORE m_hStore = NULL
 
CAtlList< CCert * > m_Certificates
 
bool m_Expanded = false
 

Detailed Description

Definition at line 8 of file CStore.hpp.

Constructor & Destructor Documentation

◆ CStore()

CStore::CStore ( _In_ LPCWSTR  cryptName,
DWORD  dwFlags 
)
inline

Definition at line 31 of file CStore.hpp.

31 : m_CryptName(cryptName), m_dwFlags(dwFlags)
32 {
33 if (auto localized = CryptFindLocalizedName(cryptName))
34 {
35 m_StoreName = localized;
36 }
37 else
38 {
39 m_StoreName = cryptName;
40 }
41 }
CAtlStringW m_StoreName
Definition: CStore.hpp:13
DWORD m_dwFlags
Definition: CStore.hpp:12
CAtlStringW m_CryptName
Definition: CStore.hpp:11
LPCWSTR WINAPI CryptFindLocalizedName(LPCWSTR pwszCryptName)
Definition: oid.c:1182
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141

◆ ~CStore()

CStore::~CStore ( )
inline

Definition at line 42 of file CStore.hpp.

43 {
44 if (m_hStore)
45 {
47 }
48 }
HCERTSTORE m_hStore
Definition: CStore.hpp:14
BOOL WINAPI CertCloseStore(HCERTSTORE hCertStore, DWORD dwFlags)
Definition: store.c:1127

Member Function Documentation

◆ EnumCertificates()

void CStore::EnumCertificates ( )
inline

Definition at line 68 of file CStore.hpp.

69 {
70 auto handle = StoreHandle();
71 if (!handle)
72 return;
73 PCCERT_CONTEXT pContext = NULL;
74 while ((pContext = CertEnumCertificatesInStore(handle, pContext)))
75 {
76 CCert *newCert = new CCert(pContext);
77 m_Certificates.AddTail(newCert);
78 }
79 }
Definition: CCert.hpp:9
HCERTSTORE StoreHandle()
Definition: CStore.hpp:19
CAtlList< CCert * > m_Certificates
Definition: CStore.hpp:15
#define NULL
Definition: types.h:112
PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pPrev)
Definition: store.c:928

Referenced by Expand().

◆ Expand()

void CStore::Expand ( )
inline

Definition at line 57 of file CStore.hpp.

58 {
59 if (m_Expanded)
60 return;
61 m_Expanded = true;
62 // EnumCertificateRevocationLists()
63 // EnumCertificateTrustLists()
65 }
bool m_Expanded
Definition: CStore.hpp:16
void EnumCertificates()
Definition: CStore.hpp:68

Referenced by ForEach(), and CCertMgrProperties::OnStoreChanged().

◆ ForEach()

template<typename Fn >
void CStore::ForEach ( Fn  callback)
inline

Definition at line 83 of file CStore.hpp.

84 {
85 Expand();
86
87 for (POSITION it = m_Certificates.GetHeadPosition(); it; m_Certificates.GetNext(it))
88 {
89 auto current = m_Certificates.GetAt(it);
91 }
92 }
void Expand()
Definition: CStore.hpp:57
struct task_struct * current
Definition: linux.c:32
static IPrintDialogCallback callback
Definition: printdlg.c:326

Referenced by CCertMgrProperties::OnStoreChanged().

◆ GetStoreName()

LPCWSTR CStore::GetStoreName ( ) const
inline

Definition at line 51 of file CStore.hpp.

52 {
53 return m_StoreName;
54 }

◆ StoreHandle()

HCERTSTORE CStore::StoreHandle ( )
inlineprivate

Definition at line 19 of file CStore.hpp.

20 {
21 if (!m_hStore)
22 {
26 }
27 return m_hStore;
28 }
HCERTSTORE WINAPI CertOpenStore(LPCSTR lpszStoreProvider, DWORD dwMsgAndCertEncodingType, HCRYPTPROV_LEGACY hCryptProv, DWORD dwFlags, const void *pvPara)
Definition: store.c:815
#define X509_ASN_ENCODING
Definition: wincrypt.h:2501
#define CERT_STORE_PROV_SYSTEM_W
Definition: wincrypt.h:2463
#define PKCS_7_ASN_ENCODING
Definition: wincrypt.h:2503
#define CERT_STORE_SET_LOCALIZED_NAME_FLAG
Definition: wincrypt.h:2622
#define CERT_STORE_MAXIMUM_ALLOWED_FLAG
Definition: wincrypt.h:2632

Referenced by EnumCertificates().

Member Data Documentation

◆ m_Certificates

CAtlList<CCert *> CStore::m_Certificates
private

Definition at line 15 of file CStore.hpp.

Referenced by EnumCertificates(), and ForEach().

◆ m_CryptName

CAtlStringW CStore::m_CryptName
private

Definition at line 11 of file CStore.hpp.

Referenced by StoreHandle().

◆ m_dwFlags

DWORD CStore::m_dwFlags
private

Definition at line 12 of file CStore.hpp.

Referenced by StoreHandle().

◆ m_Expanded

bool CStore::m_Expanded = false
private

Definition at line 16 of file CStore.hpp.

Referenced by Expand().

◆ m_hStore

HCERTSTORE CStore::m_hStore = NULL
private

Definition at line 14 of file CStore.hpp.

Referenced by StoreHandle(), and ~CStore().

◆ m_StoreName

CAtlStringW CStore::m_StoreName
private

Definition at line 13 of file CStore.hpp.

Referenced by CStore(), and GetStoreName().


The documentation for this class was generated from the following file: