ReactOS 0.4.16-dev-2284-g3529151
CStore.hpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Certificate Manager
3 * LICENSE: MIT (https://spdx.org/licenses/MIT)
4 * PURPOSE: CStore definition
5 * COPYRIGHT: Copyright 2025 Mark Jansen <mark.jansen@reactos.org>
6 */
7
8class CStore
9{
10 private:
11 CAtlStringW m_CryptName;
13 CAtlStringW m_StoreName;
15 CAtlList<CCert *> m_Certificates;
16 bool m_Expanded = false;
17
20 {
21 if (!m_hStore)
22 {
26 }
27 return m_hStore;
28 }
29
30 public:
32 {
33 if (auto localized = CryptFindLocalizedName(cryptName))
34 {
35 m_StoreName = localized;
36 }
37 else
38 {
39 m_StoreName = cryptName;
40 }
41 }
43 {
44 if (m_hStore)
45 {
47 }
48 }
49
52 {
53 return m_StoreName;
54 }
55
56 void
58 {
59 if (m_Expanded)
60 return;
61 m_Expanded = true;
62 // EnumCertificateRevocationLists()
63 // EnumCertificateTrustLists()
65 }
66
67 void
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 }
80
81 template <typename Fn>
82 void
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 }
93};
Definition: CCert.hpp:9
Definition: CStore.hpp:9
CAtlStringW m_StoreName
Definition: CStore.hpp:13
CStore(_In_ LPCWSTR cryptName, DWORD dwFlags)
Definition: CStore.hpp:31
~CStore()
Definition: CStore.hpp:42
DWORD m_dwFlags
Definition: CStore.hpp:12
void ForEach(Fn callback)
Definition: CStore.hpp:83
CAtlStringW m_CryptName
Definition: CStore.hpp:11
HCERTSTORE StoreHandle()
Definition: CStore.hpp:19
bool m_Expanded
Definition: CStore.hpp:16
LPCWSTR GetStoreName() const
Definition: CStore.hpp:51
CAtlList< CCert * > m_Certificates
Definition: CStore.hpp:15
void Expand()
Definition: CStore.hpp:57
HCERTSTORE m_hStore
Definition: CStore.hpp:14
void EnumCertificates()
Definition: CStore.hpp:68
#define NULL
Definition: types.h:112
LPCWSTR WINAPI CryptFindLocalizedName(LPCWSTR pwszCryptName)
Definition: oid.c:1182
HCERTSTORE WINAPI CertOpenStore(LPCSTR lpszStoreProvider, DWORD dwMsgAndCertEncodingType, HCRYPTPROV_LEGACY hCryptProv, DWORD dwFlags, const void *pvPara)
Definition: store.c:815
PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pPrev)
Definition: store.c:928
BOOL WINAPI CertCloseStore(HCERTSTORE hCertStore, DWORD dwFlags)
Definition: store.c:1127
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOLEAN(* Fn)(ULONG Argc, PCHAR Argv[])
Definition: kdb_cli.c:346
struct task_struct * current
Definition: linux.c:32
static IPrintDialogCallback callback
Definition: printdlg.c:326
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
#define _In_
Definition: no_sal2.h:158
#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
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185