Module: wine Branch: master Commit: 35f8d7397b538948dab447953207420bc5029d5b URL: http://source.winehq.org/git/wine.git/?a=commit;h=35f8d7397b538948dab4479532...
Author: Andrew Eikum aeikum@codeweavers.com Date: Mon Oct 11 11:17:26 2010 -0500
cryptnet/tests: Use UrlCanonicalize to create a URL.
---
dlls/cryptnet/tests/Makefile.in | 2 +- dlls/cryptnet/tests/cryptnet.c | 17 +++++------------ 2 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/dlls/cryptnet/tests/Makefile.in b/dlls/cryptnet/tests/Makefile.in index 7fe1e32..2cef5b6 100644 --- a/dlls/cryptnet/tests/Makefile.in +++ b/dlls/cryptnet/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = cryptnet.dll -IMPORTS = cryptnet crypt32 +IMPORTS = cryptnet crypt32 shlwapi
C_SRCS = \ cryptnet.c diff --git a/dlls/cryptnet/tests/cryptnet.c b/dlls/cryptnet/tests/cryptnet.c index b8da671..aab3724 100644 --- a/dlls/cryptnet/tests/cryptnet.c +++ b/dlls/cryptnet/tests/cryptnet.c @@ -24,6 +24,7 @@ #include <winbase.h> #include <winerror.h> #include <wincrypt.h> +#include <shlwapi.h> #include "wine/test.h"
static const BYTE bigCert[] = { @@ -316,13 +317,14 @@ static void make_tmp_file(LPSTR path) static void test_retrieveObjectByUrl(void) { BOOL ret; - char tmpfile[MAX_PATH * 2], *ptr, url[MAX_PATH + 8]; + char tmpfile[MAX_PATH * 2], url[MAX_PATH + 8]; CRYPT_BLOB_ARRAY *pBlobArray; PCCERT_CONTEXT cert; PCCRL_CONTEXT crl; HCERTSTORE store; CRYPT_RETRIEVE_AUX_INFO aux = { 0 }; FILETIME ft = { 0 }; + DWORD urllen;
SetLastError(0xdeadbeef); ret = CryptRetrieveObjectByUrlA(NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL); @@ -332,17 +334,8 @@ static void test_retrieveObjectByUrl(void) GetLastError(), GetLastError());
make_tmp_file(tmpfile); - ptr = strchr(tmpfile, ':'); - if (ptr) - ptr += 2; /* skip colon and first slash */ - else - ptr = tmpfile; - snprintf(url, sizeof(url), "file:///%s", ptr); - do { - ptr = strchr(url, '\'); - if (ptr) - *ptr = '/'; - } while (ptr); + urllen = sizeof(url); + UrlCanonicalizeA(tmpfile, url, &urllen, URL_WININET_COMPATIBILITY);
pBlobArray = (CRYPT_BLOB_ARRAY *)0xdeadbeef; ret = CryptRetrieveObjectByUrlA(url, NULL, 0, 0, (void **)&pBlobArray,