Signed-off-by: Serge Gautherie winehq-git_serge_180711@gautherie.fr --- dlls/advapi32/crypt.c | 5 ++--- dlls/advapi32/crypt.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/dlls/advapi32/crypt.c b/dlls/advapi32/crypt.c index 9ede750..5aecf01 100644 --- a/dlls/advapi32/crypt.c +++ b/dlls/advapi32/crypt.c @@ -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; diff --git a/dlls/advapi32/crypt.h b/dlls/advapi32/crypt.h index afee3e2..32e8d2b 100644 --- a/dlls/advapi32/crypt.h +++ b/dlls/advapi32/crypt.h @@ -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!*/