Skip to content

Commit

Permalink
Fix CryptAcquireContext for Temporary User Profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Yann Diorcet committed Jun 25, 2013
1 parent d964449 commit e3c1552
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libs/filesystem/v3/src/unique_path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ void system_crypt_random(void* buf, std::size_t len, boost::system::error_code*
HCRYPTPROV handle;
int errval = 0;

if (!::CryptAcquireContextW(&handle, 0, 0, PROV_RSA_FULL, 0))
if (!::CryptAcquireContextW(&handle, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT))
{
errval = ::GetLastError();
if (errval == NTE_BAD_KEYSET)
{
if (!::CryptAcquireContextW(&handle, 0, 0, PROV_RSA_FULL, CRYPT_NEWKEYSET))
if (!::CryptAcquireContextW(&handle, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT | CRYPT_NEWKEYSET))
{
errval = ::GetLastError();
}
Expand Down

0 comments on commit e3c1552

Please sign in to comment.