diff --git a/dll/win32/advapi32/wine/crypt.c b/dll/win32/advapi32/wine/crypt.c index a7e130c86c9..27e70585731 100644 --- a/dll/win32/advapi32/wine/crypt.c +++ b/dll/win32/advapi32/wine/crypt.c @@ -604,7 +604,7 @@ BOOL WINAPI CryptAcquireContextA (HCRYPTPROV *phProv, LPCSTR pszContainer, * PARAMS * hProv [I] Handle to the CSP whose reference is being incremented. * pdwReserved [IN] Reserved for future use and must be NULL. - * dwFlags [I] Reserved for future use and must be NULL. + * dwFlags [I] Reserved for future use and must be 0. * * RETURNS * Success: TRUE @@ -628,7 +628,7 @@ BOOL WINAPI CryptContextAddRef (HCRYPTPROV hProv, DWORD *pdwReserved, DWORD dwFl return FALSE; } - pProv->refcount++; + InterlockedIncrement(&pProv->refcount); return TRUE; } @@ -654,7 +654,7 @@ BOOL WINAPI CryptReleaseContext (HCRYPTPROV hProv, DWORD dwFlags) if (!pProv) { - SetLastError(NTE_BAD_UID); + SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } @@ -664,8 +664,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; @@ -728,7 +727,7 @@ BOOL WINAPI CryptGenRandom (HCRYPTPROV hProv, DWORD dwLen, BYTE *pbBuffer) * hProv [I] Handle of a CSP. * Algid [I] Identifies the hash algorithm to use. * hKey [I] Key for the hash (if required). - * dwFlags [I] Reserved for future use and must be NULL. + * dwFlags [I] Reserved for future use and must be 0. * phHash [O] Address of the future handle to the new hash object. * * RETURNS @@ -963,7 +962,7 @@ BOOL WINAPI CryptDestroyKey (HCRYPTKEY hKey) * * PARAMS * hHash [I] Handle to the hash to be copied. - * pdwReserved [I] Reserved for future use and must be zero. + * pdwReserved [I] Reserved for future use and must be NULL. * dwFlags [I] Reserved for future use and must be zero. * phHash [O] Address of the handle to receive the copy. * diff --git a/dll/win32/advapi32/wine/crypt.h b/dll/win32/advapi32/wine/crypt.h index 75cf937fda2..0b101bb0b01 100644 --- a/dll/win32/advapi32/wine/crypt.h +++ b/dll/win32/advapi32/wine/crypt.h @@ -21,11 +21,13 @@ #ifndef __WINE_CRYPT_H #define __WINE_CRYPT_H -//#include +#ifndef __REACTOS__ +#include -//#include "windef.h" -//#include "winbase.h" -//#include "wincrypt.h" +#include "windef.h" +#include "winbase.h" +#include "wincrypt.h" +#endif typedef struct tagPROVFUNCS { @@ -63,7 +65,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!*/