From 35f8d7397b538948dab447953207420bc5029d5b Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Mon, 11 Oct 2010 11:17:26 -0500 Subject: [PATCH] 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 7fe1e32de2d..2cef5b622ad 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 b8da67131dd..aab3724e08e 100644 --- a/dlls/cryptnet/tests/cryptnet.c +++ b/dlls/cryptnet/tests/cryptnet.c @@ -24,6 +24,7 @@ #include #include #include +#include #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, -- 2.11.4.GIT