[ADVAPI32] Sync crypt.c with Wine Staging 1.7.55 and update the exports list accordingly. CORE-10536

svn path=/trunk/; revision=70195
This commit is contained in:
Amine Khaldi 2015-11-28 21:21:52 +00:00
parent 234bd67427
commit eea4a9e43c
3 changed files with 47 additions and 29 deletions

View file

@ -59,7 +59,7 @@
59 stdcall ClearEventLogA(long str)
60 stdcall ClearEventLogW(long wstr)
61 stub CloseCodeAuthzLevel
62 stub CloseEncryptedFileRaw
62 stdcall CloseEncryptedFileRaw(ptr)
63 stdcall CloseEventLog(long)
64 stdcall CloseServiceHandle(long)
65 stub CloseTrace

View file

@ -294,6 +294,23 @@ static void CRYPT_CreateMachineGuid(void)
}
}
/******************************************************************************
* CloseEncryptedFileRaw (ADVAPI32.@)
*
* Close encrypted files
*
* PARAMS
* context [I] pointer to the context
* RETURNS
* Success: ERROR_SUCCESS
* Failure: NTSTATUS error code
*/
void WINAPI CloseEncryptedFileRaw(PVOID context)
{
FIXME("(%p): stub\n", context);
}
/******************************************************************************
* CryptAcquireContextW (ADVAPI32.@)
*
@ -306,7 +323,7 @@ static void CRYPT_CreateMachineGuid(void)
* dwProvType [I] Crypto provider type to get a handle.
* dwFlags [I] flags for the operation
*
* RETURNS
* RETURNS
* TRUE on success, FALSE on failure.
*/
BOOL WINAPI CryptAcquireContextW (HCRYPTPROV *phProv, LPCWSTR pszContainer,
@ -330,7 +347,7 @@ BOOL WINAPI CryptAcquireContextW (HCRYPTPROV *phProv, LPCWSTR pszContainer,
SetLastError(NTE_BAD_PROV_TYPE);
return FALSE;
}
if (!phProv)
{
SetLastError(ERROR_INVALID_PARAMETER);
@ -566,7 +583,7 @@ BOOL WINAPI CryptAcquireContextA (HCRYPTPROV *phProv, LPCSTR pszContainer,
*/
BOOL WINAPI CryptContextAddRef (HCRYPTPROV hProv, DWORD *pdwReserved, DWORD dwFlags)
{
PCRYPTPROV pProv = (PCRYPTPROV)hProv;
PCRYPTPROV pProv = (PCRYPTPROV)hProv;
TRACE("(0x%lx, %p, %08x)\n", hProv, pdwReserved, dwFlags);
@ -619,7 +636,7 @@ BOOL WINAPI CryptReleaseContext (HCRYPTPROV hProv, DWORD dwFlags)
}
pProv->refcount--;
if (pProv->refcount <= 0)
if (pProv->refcount <= 0)
{
ret = pProv->pFuncs->pCPReleaseContext(pProv->hPrivate, dwFlags);
pProv->dwMagic = 0;
@ -1127,10 +1144,10 @@ BOOL WINAPI CryptEnumProvidersW (DWORD dwIndex, DWORD *pdwReserved,
{
DWORD numkeys;
WCHAR *provNameW;
RegQueryInfoKeyW(hKey, NULL, NULL, NULL, &numkeys, pcbProvName,
NULL, NULL, NULL, NULL, NULL, NULL);
if (!(provNameW = CRYPT_Alloc(*pcbProvName * sizeof(WCHAR))))
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
@ -1152,7 +1169,7 @@ BOOL WINAPI CryptEnumProvidersW (DWORD dwIndex, DWORD *pdwReserved,
DWORD size = sizeof(DWORD);
DWORD result;
HKEY subkey;
result = RegEnumKeyW(hKey, dwIndex, pszProvName, *pcbProvName / sizeof(WCHAR));
if (result)
{
@ -1296,7 +1313,7 @@ BOOL WINAPI CryptEnumProviderTypesW (DWORD dwIndex, DWORD *pdwReserved,
*pdwProvType += (*(--ch) - '0') * 10;
*pdwProvType += (*(--ch) - '0') * 100;
CRYPT_Free(keyname);
result = RegQueryValueExW(hSubkey, typenameW, NULL, &dwType, (LPBYTE)pszTypeName, pcbTypeName);
if (result)
{
@ -1349,7 +1366,7 @@ BOOL WINAPI CryptEnumProviderTypesA (DWORD dwIndex, DWORD *pdwReserved,
/******************************************************************************
* CryptExportKey (ADVAPI32.@)
*
*
* Exports a cryptographic key from a CSP.
*
* PARAMS
@ -1490,8 +1507,8 @@ BOOL WINAPI CryptGetDefaultProviderW (DWORD dwProvType, DWORD *pdwReserved,
return FALSE;
}
CRYPT_Free(keyname);
result = RegQueryValueExW(hKey, nameW, NULL, NULL, (LPBYTE)pszProvName, pcbProvName);
result = RegQueryValueExW(hKey, nameW, NULL, NULL, (LPBYTE)pszProvName, pcbProvName);
RegCloseKey(hKey);
if (result)
@ -1500,10 +1517,10 @@ BOOL WINAPI CryptGetDefaultProviderW (DWORD dwProvType, DWORD *pdwReserved,
SetLastError(NTE_PROV_TYPE_ENTRY_BAD);
else
SetLastError(result);
return FALSE;
}
return TRUE;
}
@ -1751,7 +1768,7 @@ BOOL WINAPI CryptHashData (HCRYPTHASH hHash, const BYTE *pbData, DWORD dwDataLen
*
* Compute the cryptographic hash of a session key object.
*
* PARAMS
* PARAMS
* hHash [I] Handle to the hash object.
* hKey [I] Handle to the key to be hashed.
* dwFlags [I] Can be CRYPT_LITTLE_ENDIAN.
@ -1866,7 +1883,7 @@ BOOL WINAPI CryptSignHashW (HCRYPTHASH hHash, DWORD dwKeySpec, LPCWSTR sDescript
PCRYPTHASH hash = (PCRYPTHASH)hHash;
PCRYPTPROV prov;
TRACE("(0x%lx, %d, %s, %08x, %p, %p)\n",
TRACE("(0x%lx, %d, %s, %08x, %p, %p)\n",
hHash, dwKeySpec, debugstr_w(sDescription), dwFlags, pbSignature, pdwSigLen);
if (!hash)
@ -1897,7 +1914,7 @@ BOOL WINAPI CryptSignHashA (HCRYPTHASH hHash, DWORD dwKeySpec, LPCSTR sDescripti
LPWSTR wsDescription;
BOOL result;
TRACE("(0x%lx, %d, %s, %08x, %p, %p)\n",
TRACE("(0x%lx, %d, %s, %08x, %p, %p)\n",
hHash, dwKeySpec, debugstr_a(sDescription), dwFlags, pbSignature, pdwSigLen);
CRYPT_ANSIToUnicode(sDescription, &wsDescription, -1);
@ -2058,7 +2075,7 @@ BOOL WINAPI CryptSetProviderExW (LPCWSTR pszProvName, DWORD dwProvType, DWORD *p
return FALSE;
}
CRYPT_Free(keyname);
if (dwFlags & CRYPT_DELETE_DEFAULT)
{
RegDeleteValueW(hTypeKey, nameW);
@ -2080,7 +2097,7 @@ BOOL WINAPI CryptSetProviderExW (LPCWSTR pszProvName, DWORD dwProvType, DWORD *p
return FALSE;
}
CRYPT_Free(keyname);
if (RegSetValueExW(hTypeKey, nameW, 0, REG_SZ, (const BYTE *)pszProvName,
(strlenW(pszProvName) + 1)*sizeof(WCHAR)))
{
@ -2088,7 +2105,7 @@ BOOL WINAPI CryptSetProviderExW (LPCWSTR pszProvName, DWORD dwProvType, DWORD *p
RegCloseKey(hProvKey);
return FALSE;
}
RegCloseKey(hProvKey);
}
RegCloseKey(hTypeKey);
@ -2184,7 +2201,7 @@ BOOL WINAPI CryptSetProvParam (HCRYPTPROV hProv, DWORD dwParam, const BYTE *pbDa
* RETURNS
* Success: TRUE
* Failure: FALSE
*
*
* NOTES
* Because of security flaws sDescription should not be used and should thus be
* NULL. It is supported only for compatibility with Microsoft's Cryptographic
@ -2207,7 +2224,7 @@ BOOL WINAPI CryptVerifySignatureW (HCRYPTHASH hHash, const BYTE *pbSignature, DW
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
prov = hash->pProvider;
return prov->pFuncs->pCPVerifySignature(prov->hPrivate, hash->hPrivate, pbSignature, dwSigLen,
key->hPrivate, sDescription, dwFlags);
@ -2288,7 +2305,8 @@ BOOLEAN WINAPI SystemFunction036(PVOID pbBuffer, ULONG dwLen)
dev_random = open("/dev/urandom", O_RDONLY);
if (dev_random != -1)
{
if (read(dev_random, pbBuffer, dwLen) == (ssize_t)dwLen)
if (!IsBadWritePtr( pbBuffer, dwLen ) &&
read(dev_random, pbBuffer, dwLen) == (ssize_t)dwLen)
{
close(dev_random);
return TRUE;
@ -2299,8 +2317,8 @@ BOOLEAN WINAPI SystemFunction036(PVOID pbBuffer, ULONG dwLen)
FIXME("couldn't open /dev/urandom\n");
SetLastError(NTE_FAIL);
return FALSE;
}
}
/*
These functions have nearly identical prototypes to CryptProtectMemory and CryptUnprotectMemory,
in crypt32.dll.
@ -2315,10 +2333,10 @@ BOOLEAN WINAPI SystemFunction036(PVOID pbBuffer, ULONG dwLen)
* memory [I/O] Pointer to memory to encrypt.
* length [I] Length of region to encrypt in bytes.
* flags [I] Control whether other processes are able to decrypt the memory.
* RTL_ENCRYPT_OPTION_SAME_PROCESS
* RTL_ENCRYPT_OPTION_CROSS_PROCESS
* RTL_ENCRYPT_OPTION_SAME_PROCESS
* RTL_ENCRYPT_OPTION_CROSS_PROCESS
* RTL_ENCRYPT_OPTION_SAME_LOGON
*
*
* RETURNS
* Success: STATUS_SUCCESS
* Failure: NTSTATUS error code

View file

@ -257,7 +257,7 @@ reactos/lib/rtl/timerqueue.c # Partly synced with WineStaging-1.7
advapi32 -
reactos/dll/win32/advapi32/wine/cred.c # Synced to WineStaging-1.7.37
reactos/dll/win32/advapi32/wine/crypt.c # Synced to Wine-1.7.27
reactos/dll/win32/advapi32/wine/crypt.c # Synced to WineStaging-1.7.55
reactos/dll/win32/advapi32/wine/crypt_des.c # Synced to WineStaging-1.7.37
reactos/dll/win32/advapi32/wine/crypt_lmhash.c # Synced to WineStaging-1.7.37
reactos/dll/win32/advapi32/wine/security.c # Out of Sync