cryptnet: Implement CryptRetrieveObjectByUrlA on top of CryptRetrieveObjectByUrlW.

This commit is contained in:
Juan Lang 2007-10-22 10:20:11 -07:00 committed by Alexandre Julliard
parent a7cfe075c8
commit 1fbb0f6a5a
2 changed files with 28 additions and 3 deletions

View File

@ -24,6 +24,7 @@
#include "wine/debug.h" #include "wine/debug.h"
#include "winbase.h" #include "winbase.h"
#include "winnt.h" #include "winnt.h"
#include "winnls.h"
#define NONAMELESSUNION #define NONAMELESSUNION
#include "wincrypt.h" #include "wincrypt.h"
@ -298,10 +299,35 @@ BOOL WINAPI CryptRetrieveObjectByUrlA(LPCSTR pszURL, LPCSTR pszObjectOid,
HCRYPTASYNC hAsyncRetrieve, PCRYPT_CREDENTIALS pCredentials, LPVOID pvVerify, HCRYPTASYNC hAsyncRetrieve, PCRYPT_CREDENTIALS pCredentials, LPVOID pvVerify,
PCRYPT_RETRIEVE_AUX_INFO pAuxInfo) PCRYPT_RETRIEVE_AUX_INFO pAuxInfo)
{ {
FIXME("(%s, %s, %08x, %d, %p, %p, %p, %p, %p)\n", debugstr_a(pszURL), BOOL ret = FALSE;
int len;
TRACE("(%s, %s, %08x, %d, %p, %p, %p, %p, %p)\n", debugstr_a(pszURL),
debugstr_a(pszObjectOid), dwRetrievalFlags, dwTimeout, ppvObject, debugstr_a(pszObjectOid), dwRetrievalFlags, dwTimeout, ppvObject,
hAsyncRetrieve, pCredentials, pvVerify, pAuxInfo); hAsyncRetrieve, pCredentials, pvVerify, pAuxInfo);
return FALSE;
if (!pszURL)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
len = MultiByteToWideChar(CP_ACP, 0, pszURL, -1, NULL, 0);
if (len)
{
LPWSTR url = CryptMemAlloc(len * sizeof(WCHAR));
if (url)
{
MultiByteToWideChar(CP_ACP, 0, pszURL, -1, url, len);
ret = CryptRetrieveObjectByUrlW(url, pszObjectOid,
dwRetrievalFlags, dwTimeout, ppvObject, hAsyncRetrieve,
pCredentials, pvVerify, pAuxInfo);
CryptMemFree(url);
}
else
SetLastError(ERROR_OUTOFMEMORY);
}
return ret;
} }
/*********************************************************************** /***********************************************************************

View File

@ -267,7 +267,6 @@ static void test_retrieveObjectByUrl(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CryptRetrieveObjectByUrlA(NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, ret = CryptRetrieveObjectByUrlA(NULL, NULL, 0, 0, NULL, NULL, NULL, NULL,
NULL); NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %08x\n", GetLastError()); "Expected ERROR_INVALID_PARAMETER, got %08x\n", GetLastError());