crypt32: Close file when appropriate in CertSaveStore.

This commit is contained in:
Juan Lang 2009-01-24 13:08:21 -08:00 committed by Alexandre Julliard
parent 6917fdd3a8
commit befce84f4c
1 changed files with 4 additions and 1 deletions

View File

@ -833,7 +833,7 @@ BOOL WINAPI CertSaveStore(HCERTSTORE hCertStore, DWORD dwMsgAndCertEncodingType,
{
BOOL (*saveFunc)(HCERTSTORE, DWORD, void *);
void *handle;
BOOL ret;
BOOL ret, closeFile = TRUE;
TRACE("(%p, %08x, %d, %d, %p, %08x)\n", hCertStore,
dwMsgAndCertEncodingType, dwSaveAs, dwSaveTo, pvSaveToPara, dwFlags);
@ -861,6 +861,7 @@ BOOL WINAPI CertSaveStore(HCERTSTORE hCertStore, DWORD dwMsgAndCertEncodingType,
{
case CERT_STORE_SAVE_TO_FILE:
handle = pvSaveToPara;
closeFile = FALSE;
break;
case CERT_STORE_SAVE_TO_FILENAME_A:
handle = CreateFileA((LPCSTR)pvSaveToPara, GENERIC_WRITE, 0, NULL,
@ -879,6 +880,8 @@ BOOL WINAPI CertSaveStore(HCERTSTORE hCertStore, DWORD dwMsgAndCertEncodingType,
return FALSE;
}
ret = saveFunc(hCertStore, dwMsgAndCertEncodingType, handle);
if (closeFile)
CloseHandle(handle);
TRACE("returning %d\n", ret);
return ret;
}