Commit befce84f authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Close file when appropriate in CertSaveStore.

parent 6917fdd3
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment