advapi32: Use standard refcount in CRYPTPROV.

Signed-off-by: Serge Gautherie <winehq-git_serge_180711@gautherie.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Serge Gautherie 2020-03-17 14:48:17 +01:00 committed by Alexandre Julliard
parent 9cc8b501ee
commit 62df03af96
2 changed files with 3 additions and 4 deletions

View File

@ -636,7 +636,7 @@ BOOL WINAPI CryptContextAddRef (HCRYPTPROV hProv, DWORD *pdwReserved, DWORD dwFl
return FALSE;
}
pProv->refcount++;
InterlockedIncrement(&pProv->refcount);
return TRUE;
}
@ -672,8 +672,7 @@ BOOL WINAPI CryptReleaseContext (HCRYPTPROV hProv, DWORD dwFlags)
return FALSE;
}
pProv->refcount--;
if (pProv->refcount <= 0)
if (InterlockedDecrement(&pProv->refcount) == 0)
{
ret = pProv->pFuncs->pCPReleaseContext(pProv->hPrivate, dwFlags);
pProv->dwMagic = 0;

View File

@ -63,7 +63,7 @@ typedef struct tagPROVFUNCS
typedef struct tagCRYPTPROV
{
DWORD dwMagic;
UINT refcount;
LONG refcount;
HMODULE hModule;
PPROVFUNCS pFuncs;
HCRYPTPROV hPrivate; /*CSP's handle - Should not be given to application under any circumstances!*/