Commit 183df56c authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

cryptui: Separate opening a file from importing it.

parent 9169e6ed
......@@ -3627,12 +3627,10 @@ static BOOL import_store(DWORD dwFlags, HWND hwnd, LPCWSTR szTitle,
return ret;
}
static BOOL import_file(DWORD dwFlags, HWND hwnd, LPCWSTR szTitle,
LPCWSTR fileName, HCERTSTORE dest)
static HCERTSTORE open_store_from_file(DWORD dwFlags, LPCWSTR fileName)
{
HCERTSTORE source;
HCERTSTORE store = NULL;
DWORD contentType, expectedContentTypeFlags;
BOOL ret;
if (dwFlags &
(CRYPTUI_WIZ_IMPORT_ALLOW_CERT | CRYPTUI_WIZ_IMPORT_ALLOW_CRL |
......@@ -3667,14 +3665,25 @@ static BOOL import_file(DWORD dwFlags, HWND hwnd, LPCWSTR szTitle,
CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED |
CERT_QUERY_CONTENT_FLAG_PFX;
ret = CryptQueryObject(CERT_QUERY_OBJECT_FILE, fileName,
CryptQueryObject(CERT_QUERY_OBJECT_FILE, fileName,
expectedContentTypeFlags, CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL,
&contentType, NULL, &source, NULL, NULL);
if (ret)
&contentType, NULL, &store, NULL, NULL);
return store;
}
static BOOL import_file(DWORD dwFlags, HWND hwnd, LPCWSTR szTitle,
LPCWSTR fileName, HCERTSTORE dest)
{
HCERTSTORE source;
BOOL ret;
if ((source = open_store_from_file(dwFlags, fileName)))
{
ret = import_store(dwFlags, hwnd, szTitle, source, dest);
CertCloseStore(source, 0);
}
else
ret = FALSE;
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