crypt32: Close file when appropriate in CertSaveStore.
This commit is contained in:
parent
6917fdd3a8
commit
befce84f4c
@ -833,7 +833,7 @@ BOOL WINAPI CertSaveStore(HCERTSTORE hCertStore, DWORD dwMsgAndCertEncodingType,
|
|||||||
{
|
{
|
||||||
BOOL (*saveFunc)(HCERTSTORE, DWORD, void *);
|
BOOL (*saveFunc)(HCERTSTORE, DWORD, void *);
|
||||||
void *handle;
|
void *handle;
|
||||||
BOOL ret;
|
BOOL ret, closeFile = TRUE;
|
||||||
|
|
||||||
TRACE("(%p, %08x, %d, %d, %p, %08x)\n", hCertStore,
|
TRACE("(%p, %08x, %d, %d, %p, %08x)\n", hCertStore,
|
||||||
dwMsgAndCertEncodingType, dwSaveAs, dwSaveTo, pvSaveToPara, dwFlags);
|
dwMsgAndCertEncodingType, dwSaveAs, dwSaveTo, pvSaveToPara, dwFlags);
|
||||||
@ -861,6 +861,7 @@ BOOL WINAPI CertSaveStore(HCERTSTORE hCertStore, DWORD dwMsgAndCertEncodingType,
|
|||||||
{
|
{
|
||||||
case CERT_STORE_SAVE_TO_FILE:
|
case CERT_STORE_SAVE_TO_FILE:
|
||||||
handle = pvSaveToPara;
|
handle = pvSaveToPara;
|
||||||
|
closeFile = FALSE;
|
||||||
break;
|
break;
|
||||||
case CERT_STORE_SAVE_TO_FILENAME_A:
|
case CERT_STORE_SAVE_TO_FILENAME_A:
|
||||||
handle = CreateFileA((LPCSTR)pvSaveToPara, GENERIC_WRITE, 0, NULL,
|
handle = CreateFileA((LPCSTR)pvSaveToPara, GENERIC_WRITE, 0, NULL,
|
||||||
@ -879,6 +880,8 @@ BOOL WINAPI CertSaveStore(HCERTSTORE hCertStore, DWORD dwMsgAndCertEncodingType,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
ret = saveFunc(hCertStore, dwMsgAndCertEncodingType, handle);
|
ret = saveFunc(hCertStore, dwMsgAndCertEncodingType, handle);
|
||||||
|
if (closeFile)
|
||||||
|
CloseHandle(handle);
|
||||||
TRACE("returning %d\n", ret);
|
TRACE("returning %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user