Module: wine Branch: master Commit: 217e0119d92bb701e9a140ad4c42a6d9b7f4cb9f URL: http://source.winehq.org/git/wine.git/?a=commit;h=217e0119d92bb701e9a140ad4c...
Author: Jacek Caban jacek@codeweavers.com Date: Mon Oct 21 15:59:11 2013 +0200
crypt32: Get rid of no longer needed hCertStore checks.
---
dlls/crypt32/cert.c | 10 +--------- dlls/crypt32/crl.c | 9 +-------- dlls/crypt32/ctl.c | 32 ++++++++++---------------------- dlls/crypt32/store.c | 40 ++++++++++++++-------------------------- 4 files changed, 26 insertions(+), 65 deletions(-)
diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c index f23629b..1858a1b 100644 --- a/dlls/crypt32/cert.c +++ b/dlls/crypt32/cert.c @@ -555,15 +555,7 @@ BOOL WINAPI CertGetCertificateContextProperty(PCCERT_CONTEXT pCertContext, ret = FALSE; break; case CERT_ACCESS_STATE_PROP_ID: - if (pCertContext->hCertStore) - ret = CertGetStoreProperty(pCertContext->hCertStore, dwPropId, - pvData, pcbData); - else - { - DWORD state = 0; - - ret = CertContext_CopyParam(pvData, pcbData, &state, sizeof(state)); - } + ret = CertGetStoreProperty(cert->ctx.hCertStore, dwPropId, pvData, pcbData); break; case CERT_KEY_PROV_HANDLE_PROP_ID: { diff --git a/dlls/crypt32/crl.c b/dlls/crypt32/crl.c index 07e86b2..db80651 100644 --- a/dlls/crypt32/crl.c +++ b/dlls/crypt32/crl.c @@ -499,14 +499,7 @@ BOOL WINAPI CertGetCRLContextProperty(PCCRL_CONTEXT pCRLContext, } else { - if (pCRLContext->hCertStore) - ret = CertGetStoreProperty(pCRLContext->hCertStore, dwPropId, - pvData, pcbData); - else - { - *(DWORD *)pvData = 0; - ret = TRUE; - } + ret = CertGetStoreProperty(pCRLContext->hCertStore, dwPropId, pvData, pcbData); } break; default: diff --git a/dlls/crypt32/ctl.c b/dlls/crypt32/ctl.c index 6893e2d..fa98556 100644 --- a/dlls/crypt32/ctl.c +++ b/dlls/crypt32/ctl.c @@ -341,26 +341,21 @@ PCCTL_CONTEXT WINAPI CertFindCTLInStore(HCERTSTORE hCertStore,
BOOL WINAPI CertDeleteCTLFromStore(PCCTL_CONTEXT pCtlContext) { + WINECRYPT_CERTSTORE *hcs = pCtlContext->hCertStore; + ctl_t *ctl = ctl_from_ptr(pCtlContext); BOOL ret;
TRACE("(%p)\n", pCtlContext);
if (!pCtlContext) - ret = TRUE; - else if (!pCtlContext->hCertStore) - ret = CertFreeCTLContext(pCtlContext); - else - { - WINECRYPT_CERTSTORE *hcs = pCtlContext->hCertStore; - ctl_t *ctl = ctl_from_ptr(pCtlContext); + return TRUE;
- if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC) - ret = FALSE; - else - ret = hcs->vtbl->ctls.delete(hcs, &ctl->base); - if (ret) - ret = CertFreeCTLContext(pCtlContext); - } + if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC) + return FALSE; + + ret = hcs->vtbl->ctls.delete(hcs, &ctl->base); + if (ret) + ret = CertFreeCTLContext(pCtlContext); return ret; }
@@ -621,14 +616,7 @@ BOOL WINAPI CertGetCTLContextProperty(PCCTL_CONTEXT pCTLContext, } else { - if (pCTLContext->hCertStore) - ret = CertGetStoreProperty(pCTLContext->hCertStore, dwPropId, - pvData, pcbData); - else - { - *(DWORD *)pvData = 0; - ret = TRUE; - } + ret = CertGetStoreProperty(pCTLContext->hCertStore, dwPropId, pvData, pcbData); } break; default: diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c index 7e22b95..6c34e55 100644 --- a/dlls/crypt32/store.c +++ b/dlls/crypt32/store.c @@ -949,24 +949,17 @@ PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore, PCCERT_
BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext) { - BOOL ret; + WINECRYPT_CERTSTORE *hcs = pCertContext->hCertStore;
TRACE("(%p)\n", pCertContext);
if (!pCertContext) - ret = TRUE; - else if (!pCertContext->hCertStore) - ret = CertFreeCertificateContext(pCertContext); - else - { - WINECRYPT_CERTSTORE *hcs = pCertContext->hCertStore; + return TRUE;
- if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC) - ret = FALSE; - else - ret = hcs->vtbl->certs.delete(hcs, &cert_from_ptr(pCertContext)->base); - } - return ret; + if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC) + return FALSE; + + return hcs->vtbl->certs.delete(hcs, &cert_from_ptr(pCertContext)->base); }
BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE hCertStore, @@ -1091,25 +1084,20 @@ BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE hCertStore,
BOOL WINAPI CertDeleteCRLFromStore(PCCRL_CONTEXT pCrlContext) { + WINECRYPT_CERTSTORE *hcs = pCrlContext->hCertStore; BOOL ret;
TRACE("(%p)\n", pCrlContext);
if (!pCrlContext) - ret = TRUE; - else if (!pCrlContext->hCertStore) - ret = CertFreeCRLContext(pCrlContext); - else - { - WINECRYPT_CERTSTORE *hcs = pCrlContext->hCertStore; + return TRUE;
- if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC) - ret = FALSE; - else - ret = hcs->vtbl->crls.delete(hcs, &crl_from_ptr(pCrlContext)->base); - if (ret) - ret = CertFreeCRLContext(pCrlContext); - } + if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC) + return FALSE; + + ret = hcs->vtbl->crls.delete(hcs, &crl_from_ptr(pCrlContext)->base); + if (ret) + ret = CertFreeCRLContext(pCrlContext); return ret; }