[ADVAPI32] wine/crypt.*: Misc fixes

Import
62df03af96
8b9e3dae4f
2df16753f0

And use explicit '#ifndef __REACTOS__'.
This commit is contained in:
Serge Gautherie 2020-03-25 07:54:36 +01:00 committed by Thomas Faber
parent 8ae8083378
commit 5542dd50d6
No known key found for this signature in database
GPG key ID: 076E7C3D44720826
2 changed files with 13 additions and 12 deletions

View file

@ -604,7 +604,7 @@ BOOL WINAPI CryptAcquireContextA (HCRYPTPROV *phProv, LPCSTR pszContainer,
* PARAMS * PARAMS
* hProv [I] Handle to the CSP whose reference is being incremented. * hProv [I] Handle to the CSP whose reference is being incremented.
* pdwReserved [IN] Reserved for future use and must be NULL. * 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 * RETURNS
* Success: TRUE * Success: TRUE
@ -628,7 +628,7 @@ BOOL WINAPI CryptContextAddRef (HCRYPTPROV hProv, DWORD *pdwReserved, DWORD dwFl
return FALSE; return FALSE;
} }
pProv->refcount++; InterlockedIncrement(&pProv->refcount);
return TRUE; return TRUE;
} }
@ -654,7 +654,7 @@ BOOL WINAPI CryptReleaseContext (HCRYPTPROV hProv, DWORD dwFlags)
if (!pProv) if (!pProv)
{ {
SetLastError(NTE_BAD_UID); SetLastError(ERROR_INVALID_PARAMETER);
return FALSE; return FALSE;
} }
@ -664,8 +664,7 @@ BOOL WINAPI CryptReleaseContext (HCRYPTPROV hProv, DWORD dwFlags)
return FALSE; return FALSE;
} }
pProv->refcount--; if (InterlockedDecrement(&pProv->refcount) == 0)
if (pProv->refcount <= 0)
{ {
ret = pProv->pFuncs->pCPReleaseContext(pProv->hPrivate, dwFlags); ret = pProv->pFuncs->pCPReleaseContext(pProv->hPrivate, dwFlags);
pProv->dwMagic = 0; pProv->dwMagic = 0;
@ -728,7 +727,7 @@ BOOL WINAPI CryptGenRandom (HCRYPTPROV hProv, DWORD dwLen, BYTE *pbBuffer)
* hProv [I] Handle of a CSP. * hProv [I] Handle of a CSP.
* Algid [I] Identifies the hash algorithm to use. * Algid [I] Identifies the hash algorithm to use.
* hKey [I] Key for the hash (if required). * 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. * phHash [O] Address of the future handle to the new hash object.
* *
* RETURNS * RETURNS
@ -963,7 +962,7 @@ BOOL WINAPI CryptDestroyKey (HCRYPTKEY hKey)
* *
* PARAMS * PARAMS
* hHash [I] Handle to the hash to be copied. * 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. * dwFlags [I] Reserved for future use and must be zero.
* phHash [O] Address of the handle to receive the copy. * phHash [O] Address of the handle to receive the copy.
* *

View file

@ -21,11 +21,13 @@
#ifndef __WINE_CRYPT_H #ifndef __WINE_CRYPT_H
#define __WINE_CRYPT_H #define __WINE_CRYPT_H
//#include <stdarg.h> #ifndef __REACTOS__
#include <stdarg.h>
//#include "windef.h" #include "windef.h"
//#include "winbase.h" #include "winbase.h"
//#include "wincrypt.h" #include "wincrypt.h"
#endif
typedef struct tagPROVFUNCS typedef struct tagPROVFUNCS
{ {
@ -63,7 +65,7 @@ typedef struct tagPROVFUNCS
typedef struct tagCRYPTPROV typedef struct tagCRYPTPROV
{ {
DWORD dwMagic; DWORD dwMagic;
UINT refcount; LONG refcount;
HMODULE hModule; HMODULE hModule;
PPROVFUNCS pFuncs; PPROVFUNCS pFuncs;
HCRYPTPROV hPrivate; /*CSP's handle - Should not be given to application under any circumstances!*/ HCRYPTPROV hPrivate; /*CSP's handle - Should not be given to application under any circumstances!*/