Juan Lang : crypt32: Implement CertAddEncodedCertificateToSystemStoreA/W.

Alexandre Julliard julliard at winehq.org
Wed Nov 4 10:26:24 CST 2009


Module: wine
Branch: master
Commit: d8094382a89c980ffadaa84b98a061972a63cdcd
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d8094382a89c980ffadaa84b98a061972a63cdcd

Author: Juan Lang <juan.lang at gmail.com>
Date:   Tue Nov  3 13:54:15 2009 -0800

crypt32: Implement CertAddEncodedCertificateToSystemStoreA/W.

---

 dlls/crypt32/cert.c       |   38 ++++++++++++++++++++++++++++++++++++++
 dlls/crypt32/crypt32.spec |    4 ++--
 include/wincrypt.h        |    7 +++++++
 3 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c
index 208f3fc..2a65290 100644
--- a/dlls/crypt32/cert.c
+++ b/dlls/crypt32/cert.c
@@ -71,6 +71,44 @@ BOOL WINAPI CertAddEncodedCertificateToStore(HCERTSTORE hCertStore,
     return ret;
 }
 
+BOOL WINAPI CertAddEncodedCertificateToSystemStoreA(LPCSTR pszCertStoreName,
+ const BYTE *pbCertEncoded, DWORD cbCertEncoded)
+{
+    HCERTSTORE store;
+    BOOL ret = FALSE;
+
+    TRACE("(%s, %p, %d)\n", debugstr_a(pszCertStoreName), pbCertEncoded,
+     cbCertEncoded);
+
+    store = CertOpenSystemStoreA(0, pszCertStoreName);
+    if (store)
+    {
+        ret = CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING,
+         pbCertEncoded, cbCertEncoded, CERT_STORE_ADD_USE_EXISTING, NULL);
+        CertCloseStore(store, 0);
+    }
+    return ret;
+}
+
+BOOL WINAPI CertAddEncodedCertificateToSystemStoreW(LPCWSTR pszCertStoreName,
+ const BYTE *pbCertEncoded, DWORD cbCertEncoded)
+{
+    HCERTSTORE store;
+    BOOL ret = FALSE;
+
+    TRACE("(%s, %p, %d)\n", debugstr_w(pszCertStoreName), pbCertEncoded,
+     cbCertEncoded);
+
+    store = CertOpenSystemStoreW(0, pszCertStoreName);
+    if (store)
+    {
+        ret = CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING,
+         pbCertEncoded, cbCertEncoded, CERT_STORE_ADD_USE_EXISTING, NULL);
+        CertCloseStore(store, 0);
+    }
+    return ret;
+}
+
 BOOL WINAPI CertAddCertificateLinkToStore(HCERTSTORE hCertStore,
  PCCERT_CONTEXT pCertContext, DWORD dwAddDisposition,
  PCCERT_CONTEXT *ppCertContext)
diff --git a/dlls/crypt32/crypt32.spec b/dlls/crypt32/crypt32.spec
index ef5d6e6..b096c09 100644
--- a/dlls/crypt32/crypt32.spec
+++ b/dlls/crypt32/crypt32.spec
@@ -5,8 +5,8 @@
 @ stdcall CertAddEncodedCRLToStore(ptr long ptr long long ptr)
 @ stdcall CertAddEncodedCTLToStore(ptr long ptr long long ptr)
 @ stdcall CertAddEncodedCertificateToStore(ptr long ptr long long ptr)
-@ stub CertAddEncodedCertificateToSystemStoreA
-@ stub CertAddEncodedCertificateToSystemStoreW
+@ stdcall CertAddEncodedCertificateToSystemStoreA(str ptr long)
+@ stdcall CertAddEncodedCertificateToSystemStoreW(wstr ptr long)
 @ stdcall CertAddEnhancedKeyUsageIdentifier(ptr str)
 @ stdcall CertAddSerializedElementToStore(ptr ptr long long long long ptr ptr)
 @ stdcall CertAddStoreToCollection(ptr ptr long long)
diff --git a/include/wincrypt.h b/include/wincrypt.h
index 32b523d..4e2f60b 100644
--- a/include/wincrypt.h
+++ b/include/wincrypt.h
@@ -4054,6 +4054,13 @@ BOOL WINAPI CertAddEncodedCertificateToStore(HCERTSTORE hCertStore,
  DWORD dwCertEncodingType, const BYTE *pbCertEncoded, DWORD cbCertEncoded,
  DWORD dwAddDisposition, PCCERT_CONTEXT *ppCertContext);
 
+BOOL WINAPI CertAddEncodedCertificateToSystemStoreA(LPCSTR pszCertStoreName,
+ const BYTE *pbCertEncoded, DWORD cbCertEncoded);
+BOOL WINAPI CertAddEncodedCertificateToSystemStoreW(LPCWSTR pszCertStoreName,
+ const BYTE *pbCertEncoded, DWORD cbCertEncoded);
+#define CertAddEncodedCertificateToSystemStore \
+ WINELIB_NAME_AW(CertAddEncodedCertificateToSystemStore)
+
 BOOL WINAPI CertAddEncodedCRLToStore(HCERTSTORE hCertStore,
  DWORD dwCertEncodingType, const BYTE *pbCrlEncoded, DWORD cbCrlEncoded,
  DWORD dwAddDisposition, PCCRL_CONTEXT *ppCrlContext);




More information about the wine-cvs mailing list