Juan Lang : cryptnet: Implement CryptRetrieveObjectByUrlA on top of CryptRetrieveObjectByUrlW.
Alexandre Julliard
julliard at winehq.org
Tue Oct 23 13:14:33 CDT 2007
Module: wine
Branch: master
Commit: 1fbb0f6a5ae82f74dc91d2fbb4c195bef2bcbec9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1fbb0f6a5ae82f74dc91d2fbb4c195bef2bcbec9
Author: Juan Lang <juan.lang at gmail.com>
Date: Mon Oct 22 10:20:11 2007 -0700
cryptnet: Implement CryptRetrieveObjectByUrlA on top of CryptRetrieveObjectByUrlW.
---
dlls/cryptnet/cryptnet_main.c | 30 ++++++++++++++++++++++++++++--
dlls/cryptnet/tests/cryptnet.c | 1 -
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/dlls/cryptnet/cryptnet_main.c b/dlls/cryptnet/cryptnet_main.c
index 0c5843b..669b12e 100644
--- a/dlls/cryptnet/cryptnet_main.c
+++ b/dlls/cryptnet/cryptnet_main.c
@@ -24,6 +24,7 @@
#include "wine/debug.h"
#include "winbase.h"
#include "winnt.h"
+#include "winnls.h"
#define NONAMELESSUNION
#include "wincrypt.h"
@@ -298,10 +299,35 @@ BOOL WINAPI CryptRetrieveObjectByUrlA(LPCSTR pszURL, LPCSTR pszObjectOid,
HCRYPTASYNC hAsyncRetrieve, PCRYPT_CREDENTIALS pCredentials, LPVOID pvVerify,
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,
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;
}
/***********************************************************************
diff --git a/dlls/cryptnet/tests/cryptnet.c b/dlls/cryptnet/tests/cryptnet.c
index a8f1db0..d1c4787 100644
--- a/dlls/cryptnet/tests/cryptnet.c
+++ b/dlls/cryptnet/tests/cryptnet.c
@@ -267,7 +267,6 @@ static void test_retrieveObjectByUrl(void)
SetLastError(0xdeadbeef);
ret = CryptRetrieveObjectByUrlA(NULL, NULL, 0, 0, NULL, NULL, NULL, NULL,
NULL);
- todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %08x\n", GetLastError());
More information about the wine-cvs
mailing list