https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5542dd50d64ba0712fa3d…
commit 5542dd50d64ba0712fa3ddca3497b8ac5bcd2949
Author: Serge Gautherie <reactos-git_serge_171003(a)gautherie.fr>
AuthorDate: Wed Mar 25 07:54:36 2020 +0100
Commit: Thomas Faber <thomas.faber(a)reactos.org>
CommitDate: Sat Mar 28 20:43:04 2020 +0100
[ADVAPI32] wine/crypt.*: Misc fixes
Import
https://source.winehq.org/git/wine.git/commit/62df03af96822bda36aef398d00bf…
https://source.winehq.org/git/wine.git/commit/8b9e3dae4fb875d6a445bd5182bb6…
https://source.winehq.org/git/wine.git/commit/2df16753f0008099e119f39469bad…
And use explicit '#ifndef __REACTOS__'.
---
dll/win32/advapi32/wine/crypt.c | 13 ++++++-------
dll/win32/advapi32/wine/crypt.h | 12 +++++++-----
2 files changed, 13 insertions(+), 12 deletions(-)
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 <stdarg.h>
+#ifndef __REACTOS__
+#include <stdarg.h>
-//#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!*/