Commit 3abb8e63 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

- implement Crypt{Get|Set}OIDFunctionValue

- fix bug and memory leak in last patch
parent a2f1fd3a
......@@ -143,7 +143,7 @@
@ stdcall CryptSIPRemoveProvider(ptr)
@ stdcall CryptSIPRetrieveSubjectGuid(wstr long ptr)
@ stub CryptSetAsyncParam
@ stub CryptSetOIDFunctionValue
@ stdcall CryptSetOIDFunctionValue(long str str wstr long ptr long)
@ stub CryptSetProviderU
@ stub CryptSignAndEncodeCertificate
@ stub CryptSignAndEncryptMessage
......
......@@ -132,8 +132,83 @@ BOOL WINAPI CryptUnregisterOIDFunction(DWORD dwEncodingType, LPCSTR pszFuncName,
szKey = CRYPT_GetKeyName(dwEncodingType, pszFuncName, pszOID);
rc = RegDeleteKeyA(HKEY_LOCAL_MACHINE, szKey);
if (!rc)
HeapFree(GetProcessHeap(), 0, szKey);
if (rc)
SetLastError(rc);
return rc ? FALSE : TRUE;
}
BOOL WINAPI CryptGetOIDFunctionValue(DWORD dwEncodingType, LPCSTR pszFuncName,
LPCSTR pszOID, LPCWSTR pwszValueName, DWORD *pdwValueType, BYTE *pbValueData,
DWORD *pcbValueData)
{
LPSTR szKey;
LONG rc;
HKEY hKey;
TRACE("%lx %s %s %s %p %p %p\n", dwEncodingType, debugstr_a(pszFuncName),
debugstr_a(pszOID), debugstr_w(pwszValueName), pdwValueType, pbValueData,
pcbValueData);
if (!GET_CERT_ENCODING_TYPE(dwEncodingType))
return TRUE;
if (!pszFuncName || !pszOID || !pwszValueName)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
szKey = CRYPT_GetKeyName(dwEncodingType, pszFuncName, pszOID);
rc = RegOpenKeyA(HKEY_LOCAL_MACHINE, szKey, &hKey);
HeapFree(GetProcessHeap(), 0, szKey);
if (rc)
SetLastError(rc);
else
{
rc = RegQueryValueExW(hKey, pwszValueName, NULL, pdwValueType,
pbValueData, pcbValueData);
if (rc)
SetLastError(rc);
RegCloseKey(hKey);
}
return rc ? FALSE : TRUE;
}
BOOL WINAPI CryptSetOIDFunctionValue(DWORD dwEncodingType, LPCSTR pszFuncName,
LPCSTR pszOID, LPCWSTR pwszValueName, DWORD dwValueType,
const BYTE *pbValueData, DWORD cbValueData)
{
LPSTR szKey;
LONG rc;
HKEY hKey;
TRACE("%lx %s %s %s %ld %p %ld\n", dwEncodingType, debugstr_a(pszFuncName),
debugstr_a(pszOID), debugstr_w(pwszValueName), dwValueType, pbValueData,
cbValueData);
if (!GET_CERT_ENCODING_TYPE(dwEncodingType))
return TRUE;
if (!pszFuncName || !pszOID || !pwszValueName)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
szKey = CRYPT_GetKeyName(dwEncodingType, pszFuncName, pszOID);
rc = RegOpenKeyA(HKEY_LOCAL_MACHINE, szKey, &hKey);
HeapFree(GetProcessHeap(), 0, szKey);
if (rc)
SetLastError(rc);
else
{
rc = RegSetValueExW(hKey, pwszValueName, 0, dwValueType, pbValueData,
cbValueData);
if (rc)
SetLastError(rc);
RegCloseKey(hKey);
}
return rc ? FALSE : TRUE;
}
......
......@@ -183,16 +183,6 @@ BOOL WINAPI CryptSIPLoad
return FALSE;
}
BOOL WINAPI CryptGetOIDFunctionValue(DWORD dwEncodingType, LPCSTR pszFuncName,
LPCSTR pszOID, LPCWSTR pwszValueName,
DWORD *pdwValueType, BYTE *pbValueData,
DWORD *pcbValueData)
{
FIXME("(%lx,%s,%s,%s,%p,%p,%p) stub!\n", dwEncodingType, pszFuncName, pszOID,
debugstr_w(pwszValueName), pdwValueType, pbValueData, pcbValueData);
return FALSE;
}
BOOL WINAPI CryptRegisterDefaultOIDFunction(DWORD dwEncodingType,
LPCSTR pszFuncName, DWORD dwIndex,
LPCWSTR pwszDll)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment