Author: cwittich
Date: Sat Jan 31 08:49:08 2009
New Revision: 39239
URL:
http://svn.reactos.org/svn/reactos?rev=39239&view=rev
Log:
sync shlwapi_winetest with wine 1.1.14
Added:
trunk/rostests/winetests/shlwapi/assoc.c (with props)
Modified:
trunk/rostests/winetests/shlwapi/clist.c
trunk/rostests/winetests/shlwapi/clsid.c
trunk/rostests/winetests/shlwapi/generated.c
trunk/rostests/winetests/shlwapi/istream.c
trunk/rostests/winetests/shlwapi/ordinal.c
trunk/rostests/winetests/shlwapi/path.c
trunk/rostests/winetests/shlwapi/shlwapi.rbuild
trunk/rostests/winetests/shlwapi/shreg.c
trunk/rostests/winetests/shlwapi/string.c
trunk/rostests/winetests/shlwapi/url.c
Added: trunk/rostests/winetests/shlwapi/assoc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/assoc.c…
==============================================================================
--- trunk/rostests/winetests/shlwapi/assoc.c (added)
+++ trunk/rostests/winetests/shlwapi/assoc.c [iso-8859-1] Sat Jan 31 08:49:08 2009
@@ -1,0 +1,248 @@
+/* Unit test suite for SHLWAPI IQueryAssociations functions
+ *
+ * Copyright 2008 Google (Lei Zhang)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+
+#include "wine/test.h"
+#include "shlwapi.h"
+
+#define expect(expected, got) ok ( expected == got, "Expected %d, got %d\n",
expected, got)
+#define expect_hr(expected, got) ok ( expected == got, "Expected %08x, got
%08x\n", expected, got)
+
+static HRESULT (WINAPI *pAssocQueryStringA)(ASSOCF,ASSOCSTR,LPCSTR,LPCSTR,LPSTR,LPDWORD)
= NULL;
+static HRESULT (WINAPI
*pAssocQueryStringW)(ASSOCF,ASSOCSTR,LPCWSTR,LPCWSTR,LPWSTR,LPDWORD) = NULL;
+
+/* Every version of Windows with IE should have this association? */
+static const WCHAR dotHtml[] = {
'.','h','t','m','l',0 };
+static const WCHAR badBad[] = {
'b','a','d','b','a','d',0 };
+static const WCHAR dotBad[] = { '.','b','a','d',0 };
+static const WCHAR open[] = { 'o','p','e','n',0 };
+static const WCHAR invalid[] = {
'i','n','v','a','l','i','d',0 };
+
+static void test_getstring_bad(void)
+{
+ HRESULT hr;
+ DWORD len;
+
+ if (!pAssocQueryStringW)
+ {
+ win_skip("AssocQueryStringW() is missing\n");
+ return;
+ }
+
+ hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, NULL, open, NULL, &len);
+ expect_hr(E_INVALIDARG, hr);
+ hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, badBad, open, NULL, &len);
+ ok(hr == E_FAIL ||
+ hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION), /* Win9x/WinMe/NT4/W2K/Vista/W2K8
*/
+ "Unexpected result : %08x\n", hr);
+ hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotBad, open, NULL, &len);
+ ok(hr == E_FAIL ||
+ hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION), /* Win9x/WinMe/NT4/W2K/Vista/W2K8
*/
+ "Unexpected result : %08x\n", hr);
+ hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotHtml, invalid, NULL,
+ &len);
+ ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
+ hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION), /* Win9x/WinMe/NT4/W2K/Vista/W2K8
*/
+ "Unexpected result : %08x\n", hr);
+ hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotHtml, open, NULL, NULL);
+ ok(hr == E_UNEXPECTED ||
+ hr == E_INVALIDARG, /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
+ "Unexpected result : %08x\n", hr);
+
+ hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, NULL, open, NULL, &len);
+ expect_hr(E_INVALIDARG, hr);
+ hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, badBad, open, NULL,
+ &len);
+ ok(hr == E_FAIL ||
+ hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION), /* Win9x/WinMe/NT4/W2K/Vista/W2K8
*/
+ "Unexpected result : %08x\n", hr);
+ hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotBad, open, NULL,
+ &len);
+ ok(hr == E_FAIL ||
+ hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION), /* Win9x/WinMe/NT4/W2K/Vista/W2K8
*/
+ "Unexpected result : %08x\n", hr);
+ hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotHtml, invalid, NULL,
+ &len);
+ ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
+ hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) || /* W2K/Vista/W2K8 */
+ hr == E_FAIL, /* Win9x/WinMe/NT4 */
+ "Unexpected result : %08x\n", hr);
+ hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotHtml, open, NULL,
+ NULL);
+ ok(hr == E_UNEXPECTED ||
+ hr == E_INVALIDARG, /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
+ "Unexpected result : %08x\n", hr);
+}
+
+static void test_getstring_basic(void)
+{
+ HRESULT hr;
+ WCHAR * friendlyName;
+ WCHAR * executableName;
+ DWORD len, len2, slen;
+
+ if (!pAssocQueryStringW)
+ {
+ win_skip("AssocQueryStringW() is missing\n");
+ return;
+ }
+
+ hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotHtml, open, NULL, &len);
+ expect_hr(S_FALSE, hr);
+ if (hr != S_FALSE)
+ {
+ skip("failed to get initial len\n");
+ return;
+ }
+
+ executableName = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
+ len * sizeof(WCHAR));
+ if (!executableName)
+ {
+ skip("failed to allocate memory\n");
+ return;
+ }
+
+ len2 = len;
+ hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotHtml, open,
+ executableName, &len2);
+ expect_hr(S_OK, hr);
+ slen = lstrlenW(executableName) + 1;
+ expect(len, len2);
+ expect(len, slen);
+
+ hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotHtml, open, NULL,
+ &len);
+ ok(hr == S_FALSE ||
+ hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* Win9x/NT4 */
+ "Unexpected result : %08x\n", hr);
+ if (hr != S_FALSE)
+ {
+ HeapFree(GetProcessHeap(), 0, executableName);
+ skip("failed to get initial len\n");
+ return;
+ }
+
+ friendlyName = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
+ len * sizeof(WCHAR));
+ if (!friendlyName)
+ {
+ HeapFree(GetProcessHeap(), 0, executableName);
+ skip("failed to allocate memory\n");
+ return;
+ }
+
+ len2 = len;
+ hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotHtml, open,
+ friendlyName, &len2);
+ expect_hr(S_OK, hr);
+ slen = lstrlenW(friendlyName) + 1;
+ expect(len, len2);
+ expect(len, slen);
+
+ HeapFree(GetProcessHeap(), 0, executableName);
+ HeapFree(GetProcessHeap(), 0, friendlyName);
+}
+
+static void test_getstring_no_extra(void)
+{
+ LONG ret;
+ HKEY hkey;
+ HRESULT hr;
+ static const CHAR dotWinetest[] = {
+
'.','w','i','n','e','t','e','s','t',0
+ };
+ static const CHAR winetestfile[] = {
+
'w','i','n','e','t','e','s','t',
'f','i','l','e',0
+ };
+ static const CHAR winetestfileAction[] = {
+
'w','i','n','e','t','e','s','t','f','i','l','e',
+ '\\','s','h','e','l','l',
+ '\\','f','o','o',
+
'\\','c','o','m','m','a','n','d',0
+ };
+ static const CHAR action[] = {
+
'n','o','t','e','p','a','d','.','e','x','e',0
+ };
+ CHAR buf[MAX_PATH];
+ DWORD len = MAX_PATH;
+
+ if (!pAssocQueryStringA)
+ {
+ win_skip("AssocQueryStringA() is missing\n");
+ return;
+ }
+
+ buf[0] = '\0';
+ ret = RegCreateKeyA(HKEY_CLASSES_ROOT, dotWinetest, &hkey);
+ if (ret != ERROR_SUCCESS) {
+ skip("failed to create dotWinetest key\n");
+ return;
+ }
+
+ ret = RegSetValueA(hkey, NULL, REG_SZ, winetestfile, lstrlenA(winetestfile));
+ RegCloseKey(hkey);
+ if (ret != ERROR_SUCCESS)
+ {
+ skip("failed to set dotWinetest key\n");
+ goto cleanup;
+ }
+
+ ret = RegCreateKeyA(HKEY_CLASSES_ROOT, winetestfileAction, &hkey);
+ if (ret != ERROR_SUCCESS)
+ {
+ skip("failed to create winetestfileAction key\n");
+ goto cleanup;
+ }
+
+ ret = RegSetValueA(hkey, NULL, REG_SZ, action, lstrlenA(action));
+ RegCloseKey(hkey);
+ if (ret != ERROR_SUCCESS)
+ {
+ skip("failed to set winetestfileAction key\n");
+ goto cleanup;
+ }
+
+ hr = pAssocQueryStringA(0, ASSOCSTR_EXECUTABLE, dotWinetest, NULL, buf, &len);
+ ok(hr == S_OK ||
+ hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP and W2K3 */
+ "Unexpected result : %08x\n", hr);
+ hr = pAssocQueryStringA(0, ASSOCSTR_EXECUTABLE, dotWinetest, "foo", buf,
&len);
+ expect_hr(S_OK, hr);
+ ok(strstr(buf, action) != NULL,
+ "got '%s' (Expected result to include
'notepad.exe')\n", buf);
+
+cleanup:
+ SHDeleteKeyA(HKEY_CLASSES_ROOT, dotWinetest);
+ SHDeleteKeyA(HKEY_CLASSES_ROOT, winetestfile);
+
+}
+
+START_TEST(assoc)
+{
+ HMODULE hshlwapi;
+ hshlwapi = GetModuleHandleA("shlwapi.dll");
+ pAssocQueryStringA = (void*)GetProcAddress(hshlwapi, "AssocQueryStringA");
+ pAssocQueryStringW = (void*)GetProcAddress(hshlwapi, "AssocQueryStringW");
+
+ test_getstring_bad();
+ test_getstring_basic();
+ test_getstring_no_extra();
+}
Propchange: trunk/rostests/winetests/shlwapi/assoc.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/rostests/winetests/shlwapi/clist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/clist.c…
==============================================================================
--- trunk/rostests/winetests/shlwapi/clist.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/shlwapi/clist.c [iso-8859-1] Sat Jan 31 08:49:08 2009
@@ -116,7 +116,7 @@
else
{
unsigned int i;
- char* buff = (char*)lpMem;
+ char* buff = lpMem;
/* Read item data */
if (!This->item->ulSize)
Modified: trunk/rostests/winetests/shlwapi/clsid.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/clsid.c…
==============================================================================
--- trunk/rostests/winetests/shlwapi/clsid.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/shlwapi/clsid.c [iso-8859-1] Sat Jan 31 08:49:08 2009
@@ -24,12 +24,12 @@
#include "winerror.h"
#include "winnls.h"
#include "winuser.h"
+#include "initguid.h"
#include "shlguid.h"
#include "shobjidl.h"
#include "olectl.h"
-#define INITGUID
-#include "initguid.h"
+DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
/* This GUID has been removed from the PSDK */
DEFINE_OLEGUID(WINE_IID_IDelayedRelease, 0x000214EDL, 0, 0);
@@ -107,6 +107,7 @@
DWORD dwLen;
BOOL bRet;
int i = 0;
+ int is_vista = 0;
if (!pSHLWAPI_269 || !pSHLWAPI_23)
return;
@@ -114,7 +115,8 @@
while (*guids)
{
dwLen = pSHLWAPI_23(*guids, szBuff, 256);
- ok(dwLen == 39, "wrong size for id %d\n", i);
+ if (!i && dwLen == S_OK) is_vista = 1; /* seems to return an HRESULT on
vista */
+ ok(dwLen == (is_vista ? S_OK : 39), "wrong size %u for id %d\n", dwLen,
i);
bRet = pSHLWAPI_269(szBuff, &guid);
ok(bRet != FALSE, "created invalid string '%s'\n", szBuff);
@@ -128,7 +130,7 @@
/* Test endianess */
dwLen = pSHLWAPI_23(&IID_Endianess, szBuff, 256);
- ok(dwLen == 39, "wrong size for IID_Endianess\n");
+ ok(dwLen == (is_vista ? S_OK : 39), "wrong size %u for IID_Endianess\n",
dwLen);
ok(!strcmp(szBuff, "{01020304-0506-0708-090A-0B0C0D0E0F0A}"),
"Endianess Broken, got '%s'\n", szBuff);
@@ -136,17 +138,17 @@
/* test lengths */
szBuff[0] = ':';
dwLen = pSHLWAPI_23(&IID_Endianess, szBuff, 0);
- ok(dwLen == 0, "accepted bad length\n");
+ ok(dwLen == (is_vista ? E_FAIL : 0), "accepted bad length\n");
ok(szBuff[0] == ':', "wrote to buffer with no length\n");
szBuff[0] = ':';
dwLen = pSHLWAPI_23(&IID_Endianess, szBuff, 38);
- ok(dwLen == 0, "accepted bad length\n");
+ ok(dwLen == (is_vista ? E_FAIL : 0), "accepted bad length\n");
ok(szBuff[0] == ':', "wrote to buffer with no length\n");
szBuff[0] = ':';
dwLen = pSHLWAPI_23(&IID_Endianess, szBuff, 39);
- ok(dwLen == 39, "rejected ok length\n");
+ ok(dwLen == (is_vista ? S_OK : 39), "rejected ok length\n");
ok(szBuff[0] == '{', "Didn't write to buffer with ok length\n");
/* Test string */
@@ -155,7 +157,7 @@
ok(bRet == FALSE, "accepted invalid string\n");
dwLen = pSHLWAPI_23(&IID_Endianess, szBuff, 39);
- ok(dwLen == 39, "rejected ok length\n");
+ ok(dwLen == (is_vista ? S_OK : 39), "rejected ok length\n");
ok(szBuff[0] == '{', "Didn't write to buffer with ok length\n");
}
Modified: trunk/rostests/winetests/shlwapi/generated.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/generat…
==============================================================================
--- trunk/rostests/winetests/shlwapi/generated.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/shlwapi/generated.c [iso-8859-1] Sat Jan 31 08:49:08 2009
@@ -1,4 +1,4 @@
-/* File generated automatically from tools/winapi/test.dat; do not edit! */
+/* File generated automatically from tools/winapi/tests.dat; do not edit! */
/* This file can be copied, modified and distributed without restriction. */
/*
@@ -33,21 +33,13 @@
*/
#if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
-# define FIELD_ALIGNMENT(type, field) __alignof(((type*)0)->field)
-#elif defined(__GNUC__)
-# define FIELD_ALIGNMENT(type, field) __alignof__(((type*)0)->field)
-#else
-/* FIXME: Not sure if is possible to do without compiler extension */
-#endif
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
# define _TYPE_ALIGNMENT(type) __alignof(type)
#elif defined(__GNUC__)
# define _TYPE_ALIGNMENT(type) __alignof__(type)
#else
/*
- * FIXME: Not sure if is possible to do without compiler extension
- * (if type is not just a name that is, if so the normal)
+ * FIXME: May not be possible without a compiler extension
+ * (if type is not just a name that is, otherwise the normal
* TYPE_ALIGNMENT can be used)
*/
#endif
@@ -64,104 +56,109 @@
* Test helper macros
*/
-#ifdef FIELD_ALIGNMENT
-# define TEST_FIELD_ALIGNMENT(type, field, align) \
- ok(FIELD_ALIGNMENT(type, field) == align, \
- "FIELD_ALIGNMENT(" #type ", " #field ") == %d (expected
" #align ")\n", \
- (int)FIELD_ALIGNMENT(type, field))
+#ifdef _WIN64
+
+# define TEST_TYPE_SIZE(type, size)
+# define TEST_TYPE_ALIGN(type, align)
+# define TEST_TARGET_ALIGN(type, align)
+# define TEST_FIELD_ALIGN(type, field, align)
+# define TEST_FIELD_OFFSET(type, field, offset)
+
#else
-# define TEST_FIELD_ALIGNMENT(type, field, align) do { } while (0)
+
+# define TEST_TYPE_SIZE(type, size) C_ASSERT(sizeof(type) == size);
+
+# ifdef TYPE_ALIGNMENT
+# define TEST_TYPE_ALIGN(type, align) C_ASSERT(TYPE_ALIGNMENT(type) == align);
+# else
+# define TEST_TYPE_ALIGN(type, align)
+# endif
+
+# ifdef _TYPE_ALIGNMENT
+# define TEST_TARGET_ALIGN(type, align) C_ASSERT(_TYPE_ALIGNMENT(*(type)0) ==
align);
+# define TEST_FIELD_ALIGN(type, field, align)
C_ASSERT(_TYPE_ALIGNMENT(((type*)0)->field) == align);
+# else
+# define TEST_TARGET_ALIGN(type, align)
+# define TEST_FIELD_ALIGN(type, field, align)
+# endif
+
+# define TEST_FIELD_OFFSET(type, field, offset) C_ASSERT(FIELD_OFFSET(type, field) ==
offset);
+
#endif
-#define TEST_FIELD_OFFSET(type, field, offset) \
- ok(FIELD_OFFSET(type, field) == offset, \
- "FIELD_OFFSET(" #type ", " #field ") == %ld (expected
" #offset ")\n", \
- (long int)FIELD_OFFSET(type, field))
+#define TEST_TARGET_SIZE(type, size) TEST_TYPE_SIZE(*(type)0, size)
+#define TEST_FIELD_SIZE(type, field, size) TEST_TYPE_SIZE((((type*)0)->field),
size)
+#define TEST_TYPE_SIGNED(type) C_ASSERT((type) -1 < 0);
+#define TEST_TYPE_UNSIGNED(type) C_ASSERT((type) -1 > 0);
-#ifdef _TYPE_ALIGNMENT
-#define TEST__TYPE_ALIGNMENT(type, align) \
- ok(_TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d
(expected " #align ")\n", (int)_TYPE_ALIGNMENT(type))
-#else
-# define TEST__TYPE_ALIGNMENT(type, align) do { } while (0)
-#endif
-
-#ifdef TYPE_ALIGNMENT
-#define TEST_TYPE_ALIGNMENT(type, align) \
- ok(TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d
(expected " #align ")\n", (int)TYPE_ALIGNMENT(type))
-#else
-# define TEST_TYPE_ALIGNMENT(type, align) do { } while (0)
-#endif
-
-#define TEST_TYPE_SIZE(type, size) \
- ok(sizeof(type) == size, "sizeof(" #type ") == %d (expected "
#size ")\n", ((int) sizeof(type)))
-
-/***********************************************************************
- * Test macros
- */
-
-#define TEST_FIELD(type, field_type, field_name, field_offset, field_size, field_align)
\
- TEST_TYPE_SIZE(field_type, field_size); \
- TEST_FIELD_ALIGNMENT(type, field_name, field_align); \
- TEST_FIELD_OFFSET(type, field_name, field_offset); \
-
-#define TEST_TYPE(type, size, align) \
- TEST_TYPE_ALIGNMENT(type, align); \
- TEST_TYPE_SIZE(type, size)
-
-#define TEST_TYPE_POINTER(type, size, align) \
- TEST__TYPE_ALIGNMENT(*(type)0, align); \
- TEST_TYPE_SIZE(*(type)0, size)
-
-#define TEST_TYPE_SIGNED(type) \
- ok((type) -1 < 0, "(" #type ") -1 < 0\n");
-
-#define TEST_TYPE_UNSIGNED(type) \
- ok((type) -1 > 0, "(" #type ") -1 > 0\n");
static void test_pack_ASSOCF(void)
{
/* ASSOCF */
- TEST_TYPE(ASSOCF, 4, 4);
- TEST_TYPE_UNSIGNED(ASSOCF);
+ TEST_TYPE_SIZE (ASSOCF, 4)
+ TEST_TYPE_ALIGN (ASSOCF, 4)
+ TEST_TYPE_UNSIGNED(ASSOCF)
}
static void test_pack_DLLGETVERSIONPROC(void)
{
/* DLLGETVERSIONPROC */
- TEST_TYPE(DLLGETVERSIONPROC, 4, 4);
+ TEST_TYPE_SIZE (DLLGETVERSIONPROC, 4)
+ TEST_TYPE_ALIGN (DLLGETVERSIONPROC, 4)
}
static void test_pack_DLLVERSIONINFO(void)
{
/* DLLVERSIONINFO (pack 8) */
- TEST_TYPE(DLLVERSIONINFO, 20, 4);
- TEST_FIELD(DLLVERSIONINFO, DWORD, cbSize, 0, 4, 4);
- TEST_FIELD(DLLVERSIONINFO, DWORD, dwMajorVersion, 4, 4, 4);
- TEST_FIELD(DLLVERSIONINFO, DWORD, dwMinorVersion, 8, 4, 4);
- TEST_FIELD(DLLVERSIONINFO, DWORD, dwBuildNumber, 12, 4, 4);
- TEST_FIELD(DLLVERSIONINFO, DWORD, dwPlatformID, 16, 4, 4);
+ TEST_TYPE_SIZE (DLLVERSIONINFO, 20)
+ TEST_TYPE_ALIGN (DLLVERSIONINFO, 4)
+ TEST_FIELD_SIZE (DLLVERSIONINFO, cbSize, 4)
+ TEST_FIELD_ALIGN (DLLVERSIONINFO, cbSize, 4)
+ TEST_FIELD_OFFSET(DLLVERSIONINFO, cbSize, 0)
+ TEST_FIELD_SIZE (DLLVERSIONINFO, dwMajorVersion, 4)
+ TEST_FIELD_ALIGN (DLLVERSIONINFO, dwMajorVersion, 4)
+ TEST_FIELD_OFFSET(DLLVERSIONINFO, dwMajorVersion, 4)
+ TEST_FIELD_SIZE (DLLVERSIONINFO, dwMinorVersion, 4)
+ TEST_FIELD_ALIGN (DLLVERSIONINFO, dwMinorVersion, 4)
+ TEST_FIELD_OFFSET(DLLVERSIONINFO, dwMinorVersion, 8)
+ TEST_FIELD_SIZE (DLLVERSIONINFO, dwBuildNumber, 4)
+ TEST_FIELD_ALIGN (DLLVERSIONINFO, dwBuildNumber, 4)
+ TEST_FIELD_OFFSET(DLLVERSIONINFO, dwBuildNumber, 12)
+ TEST_FIELD_SIZE (DLLVERSIONINFO, dwPlatformID, 4)
+ TEST_FIELD_ALIGN (DLLVERSIONINFO, dwPlatformID, 4)
+ TEST_FIELD_OFFSET(DLLVERSIONINFO, dwPlatformID, 16)
}
static void test_pack_DLLVERSIONINFO2(void)
{
/* DLLVERSIONINFO2 (pack 8) */
- TEST_TYPE(DLLVERSIONINFO2, 32, 8);
- TEST_FIELD(DLLVERSIONINFO2, DLLVERSIONINFO, info1, 0, 20, 4);
- TEST_FIELD(DLLVERSIONINFO2, DWORD, dwFlags, 20, 4, 4);
- TEST_FIELD(DLLVERSIONINFO2, ULONGLONG, ullVersion, 24, 8, 8);
+ TEST_TYPE_SIZE (DLLVERSIONINFO2, 32)
+ TEST_TYPE_ALIGN (DLLVERSIONINFO2, 8)
+ TEST_FIELD_SIZE (DLLVERSIONINFO2, info1, 20)
+ TEST_FIELD_ALIGN (DLLVERSIONINFO2, info1, 4)
+ TEST_FIELD_OFFSET(DLLVERSIONINFO2, info1, 0)
+ TEST_FIELD_SIZE (DLLVERSIONINFO2, dwFlags, 4)
+ TEST_FIELD_ALIGN (DLLVERSIONINFO2, dwFlags, 4)
+ TEST_FIELD_OFFSET(DLLVERSIONINFO2, dwFlags, 20)
+ TEST_FIELD_SIZE (DLLVERSIONINFO2, ullVersion, 8)
+ TEST_FIELD_ALIGN (DLLVERSIONINFO2, ullVersion, 8)
+ TEST_FIELD_OFFSET(DLLVERSIONINFO2, ullVersion, 24)
}
static void test_pack_HUSKEY(void)
{
/* HUSKEY */
- TEST_TYPE(HUSKEY, 4, 4);
+ TEST_TYPE_SIZE (HUSKEY, 4)
+ TEST_TYPE_ALIGN (HUSKEY, 4)
}
static void test_pack_PHUSKEY(void)
{
/* PHUSKEY */
- TEST_TYPE(PHUSKEY, 4, 4);
- TEST_TYPE_POINTER(PHUSKEY, 4, 4);
+ TEST_TYPE_SIZE (PHUSKEY, 4)
+ TEST_TYPE_ALIGN (PHUSKEY, 4)
+ TEST_TARGET_SIZE (PHUSKEY, 4)
+ TEST_TARGET_ALIGN(PHUSKEY, 4)
}
static void test_pack(void)
@@ -176,5 +173,9 @@
START_TEST(generated)
{
+#ifdef _WIN64
+ ok(0, "The type size / alignment tests don't support Win64 yet\n");
+#else
test_pack();
+#endif
}
Modified: trunk/rostests/winetests/shlwapi/istream.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/istream…
==============================================================================
--- trunk/rostests/winetests/shlwapi/istream.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/shlwapi/istream.c [iso-8859-1] Sat Jan 31 08:49:08 2009
@@ -209,8 +209,12 @@
/* invalid arguments */
stream = NULL;
+ /* NT: ERROR_PATH_NOT_FOUND, 9x: ERROR_BAD_PATHNAME */
ret = (*pSHCreateStreamOnFileA)(NULL, mode | stgm, &stream);
- ok(ret == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), "SHCreateStreamOnFileA:
expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), got 0x%08x\n", ret);
+ ok(ret == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) ||
+ ret == HRESULT_FROM_WIN32(ERROR_BAD_PATHNAME),
+ "SHCreateStreamOnFileA: expected
HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)"
+ "or HRESULT_FROM_WIN32(ERROR_BAD_PATHNAME), got 0x%08x\n", ret);
ok(stream == NULL, "SHCreateStreamOnFileA: expected a NULL IStream object, got
%p\n", stream);
#if 0 /* This test crashes on WinXP SP2 */
@@ -290,27 +294,35 @@
HRESULT ret;
ULONG refcount;
WCHAR test_file[MAX_PATH];
- static const WCHAR testW_txt[] = { '\\', 't', 'e',
's', 't', 'W', '.', 't', 'x', 't',
'\0' };
+ CHAR test_fileA[MAX_PATH];
+ static const CHAR testW_txt[] = "\\testW.txt";
trace("SHCreateStreamOnFileW: testing mode %d, STGM flags %08x\n", mode,
stgm);
/* Don't used a fixed path for the testW.txt file */
- GetTempPathW(MAX_PATH, test_file);
- lstrcatW(test_file, testW_txt);
+ GetTempPathA(MAX_PATH, test_fileA);
+ lstrcatA(test_fileA, testW_txt);
+ MultiByteToWideChar(CP_ACP, 0, test_fileA, -1, test_file, MAX_PATH);
/* invalid arguments */
- stream = NULL;
- ret = (*pSHCreateStreamOnFileW)(NULL, mode | stgm, &stream);
- ok(ret == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) || /* XP */
- ret == E_INVALIDARG /* Vista */,
- "SHCreateStreamOnFileW: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) or
E_INVALIDARG, got 0x%08x\n", ret);
- ok(stream == NULL, "SHCreateStreamOnFileW: expected a NULL IStream object, got
%p\n", stream);
-
-#if 0 /* This test crashes on WinXP SP2 */
- ret = (*pSHCreateStreamOnFileW)(test_file, mode | stgm, NULL);
- ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG, got
0x%08x\n", ret);
-#endif
+ if (0)
+ {
+ /* Crashes on NT4 */
+ stream = NULL;
+ ret = (*pSHCreateStreamOnFileW)(NULL, mode | stgm, &stream);
+ ok(ret == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) || /* XP */
+ ret == E_INVALIDARG /* Vista */,
+ "SHCreateStreamOnFileW: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)
or E_INVALIDARG, got 0x%08x\n", ret);
+ ok(stream == NULL, "SHCreateStreamOnFileW: expected a NULL IStream object,
got %p\n", stream);
+ }
+
+ if (0)
+ {
+ /* This test crashes on WinXP SP2 */
+ ret = (*pSHCreateStreamOnFileW)(test_file, mode | stgm, NULL);
+ ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG,
got 0x%08x\n", ret);
+ }
stream = NULL;
ret = (*pSHCreateStreamOnFileW)(test_file, mode | STGM_CONVERT | stgm, &stream);
@@ -373,7 +385,9 @@
refcount = IStream_Release(stream);
ok(refcount == 0, "SHCreateStreamOnFileW: expected 0, got %d\n",
refcount);
- ok(DeleteFileW(test_file), "SHCreateStreamOnFileW: could not delete the test
file, got error %d\n", GetLastError());
+ ok(DeleteFileA(test_fileA),
+ "SHCreateStreamOnFileW: could not delete the test file, got error
%d\n",
+ GetLastError());
}
}
@@ -385,32 +399,44 @@
HRESULT ret;
ULONG refcount;
WCHAR test_file[MAX_PATH];
- static const WCHAR testEx_txt[] = { '\\', 't', 'e',
's', 't', 'E','x', '.', 't', 'x',
't', '\0' };
+ CHAR test_fileA[MAX_PATH];
+ static const CHAR testEx_txt[] = "\\testEx.txt";
trace("SHCreateStreamOnFileEx: testing mode %d, STGM flags %08x\n", mode,
stgm);
/* Don't used a fixed path for the testEx.txt file */
- GetTempPathW(MAX_PATH, test_file);
- lstrcatW(test_file, testEx_txt);
+ GetTempPathA(MAX_PATH, test_fileA);
+ lstrcatA(test_fileA, testEx_txt);
+ MultiByteToWideChar(CP_ACP, 0, test_fileA, -1, test_file, MAX_PATH);
/* invalid arguments */
- stream = NULL;
- ret = (*pSHCreateStreamOnFileEx)(NULL, mode, 0, FALSE, NULL, &stream);
- ok(ret == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) || /* XP */
- ret == E_INVALIDARG /* Vista */,
- "SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) or
E_INVALIDARG, got 0x%08x\n", ret);
+ if (0)
+ {
+ /* Crashes on NT4 */
+ stream = NULL;
+ ret = (*pSHCreateStreamOnFileEx)(NULL, mode, 0, FALSE, NULL, &stream);
+ ok(ret == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) || /* XP */
+ ret == E_INVALIDARG /* Vista */,
+ "SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)
or E_INVALIDARG, got 0x%08x\n", ret);
+ ok(stream == NULL, "SHCreateStreamOnFileEx: expected a NULL IStream object,
got %p\n", stream);
+ }
+
+ stream = NULL;
+ ret = (*pSHCreateStreamOnFileEx)(test_file, mode, 0, FALSE, template, &stream);
+ ok( ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
+ ret == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER),
+ "SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)
or "
+ "HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got 0x%08x\n", ret);
+
ok(stream == NULL, "SHCreateStreamOnFileEx: expected a NULL IStream object, got
%p\n", stream);
- stream = NULL;
- ret = (*pSHCreateStreamOnFileEx)(test_file, mode, 0, FALSE, template, &stream);
- ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "SHCreateStreamOnFileEx:
expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got 0x%08x\n", ret);
- ok(stream == NULL, "SHCreateStreamOnFileEx: expected a NULL IStream object, got
%p\n", stream);
-
-#if 0 /* This test crashes on WinXP SP2 */
- ret = (*pSHCreateStreamOnFileEx)(test_file, mode, 0, FALSE, NULL, NULL);
- ok(ret == E_INVALIDARG, "SHCreateStreamOnFileEx: expected E_INVALIDARG, got
0x%08x\n", ret);
-#endif
+ if (0)
+ {
+ /* This test crashes on WinXP SP2 */
+ ret = (*pSHCreateStreamOnFileEx)(test_file, mode, 0, FALSE, NULL, NULL);
+ ok(ret == E_INVALIDARG, "SHCreateStreamOnFileEx: expected E_INVALIDARG, got
0x%08x\n", ret);
+ }
/* file does not exist */
@@ -425,12 +451,22 @@
return;
}
} else {
- ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "SHCreateStreamOnFileEx:
expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got 0x%08x\n", ret);
+ ok( ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
+ ret == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER),
+ "SHCreateStreamOnFileEx: expected
HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) or "
+ "HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got 0x%08x\n", ret);
}
ok(stream == NULL, "SHCreateStreamOnFileEx: expected a NULL IStream object, got
%p\n", stream);
stream = NULL;
ret = (*pSHCreateStreamOnFileEx)(test_file, mode | STGM_FAILIFTHERE | stgm, 0, TRUE,
NULL, &stream);
+ /* not supported on win9x */
+ if (broken(ret == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER) && stream ==
NULL)) {
+ skip("Not supported\n");
+ DeleteFileA(test_fileA);
+ return;
+ }
+
ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n",
ret);
ok(stream != NULL, "SHCreateStreamOnFileEx: expected a valid IStream object, got
NULL\n");
@@ -440,7 +476,9 @@
refcount = IStream_Release(stream);
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n",
refcount);
- ok(DeleteFileW(test_file), "SHCreateStreamOnFileEx: could not delete the
test file, got error %d\n", GetLastError());
+ ok(DeleteFileA(test_fileA),
+ "SHCreateStreamOnFileEx: could not delete the test file, got error
%d\n",
+ GetLastError());
}
stream = NULL;
@@ -454,7 +492,9 @@
refcount = IStream_Release(stream);
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n",
refcount);
- ok(DeleteFileW(test_file), "SHCreateStreamOnFileEx: could not delete the
test file, got error %d\n", GetLastError());
+ ok(DeleteFileA(test_fileA),
+ "SHCreateStreamOnFileEx: could not delete the test file, got error
%d\n",
+ GetLastError());
}
stream = NULL;
@@ -514,7 +554,9 @@
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n",
refcount);
}
- ok(DeleteFileW(test_file), "SHCreateStreamOnFileEx: could not delete the test
file, got error %d\n", GetLastError());
+ ok(DeleteFileA(test_fileA),
+ "SHCreateStreamOnFileEx: could not delete the test file, got error
%d\n",
+ GetLastError());
}
Modified: trunk/rostests/winetests/shlwapi/ordinal.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/ordinal…
==============================================================================
--- trunk/rostests/winetests/shlwapi/ordinal.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/shlwapi/ordinal.c [iso-8859-1] Sat Jan 31 08:49:08 2009
@@ -42,13 +42,19 @@
DWORD buffersize, buffersize2, exactsize;
char buffer[100];
- if (!pGetAcceptLanguagesA)
+ if (!pGetAcceptLanguagesA) {
+ win_skip("GetAcceptLanguagesA is not available\n");
return;
+ }
buffersize = sizeof(buffer);
memset(buffer, 0, sizeof(buffer));
SetLastError(ERROR_SUCCESS);
retval = pGetAcceptLanguagesA( buffer, &buffersize);
+ if (!retval && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) {
+ win_skip("GetAcceptLanguagesA is not implemented\n");
+ return;
+ }
trace("GetAcceptLanguagesA: retval %08x, size %08x, buffer (%s),"
" last error %u\n", retval, buffersize, buffer, GetLastError());
if(retval != S_OK) {
@@ -58,28 +64,31 @@
ok( (ERROR_NO_IMPERSONATION_TOKEN == GetLastError()) ||
(ERROR_CLASS_DOES_NOT_EXIST == GetLastError()) ||
(ERROR_PROC_NOT_FOUND == GetLastError()) ||
- (ERROR_CALL_NOT_IMPLEMENTED == GetLastError()) ||
(ERROR_SUCCESS == GetLastError()), "last error set to %u\n", GetLastError());
exactsize = strlen(buffer);
SetLastError(ERROR_SUCCESS);
retval = pGetAcceptLanguagesA( NULL, NULL);
- ok(retval == E_FAIL,
+ ok(retval == E_FAIL ||
+ retval == E_INVALIDARG, /* w2k8 */
"function result wrong: got %08x; expected E_FAIL\n", retval);
ok(ERROR_SUCCESS == GetLastError(), "last error set to %u\n",
GetLastError());
buffersize = sizeof(buffer);
SetLastError(ERROR_SUCCESS);
retval = pGetAcceptLanguagesA( NULL, &buffersize);
- ok(retval == E_FAIL,
+ ok(retval == E_FAIL ||
+ retval == E_INVALIDARG, /* w2k8 */
"function result wrong: got %08x; expected E_FAIL\n", retval);
- ok(buffersize == sizeof(buffer),
- "buffersize was changed (2nd parameter; not on Win2k)\n");
+ ok(buffersize == sizeof(buffer) ||
+ buffersize == 0, /* w2k8*/
+ "buffersize was changed and is not 0; size (%d))\n", buffersize);
ok(ERROR_SUCCESS == GetLastError(), "last error set to %u\n",
GetLastError());
SetLastError(ERROR_SUCCESS);
retval = pGetAcceptLanguagesA( buffer, NULL);
- ok(retval == E_FAIL,
+ ok(retval == E_FAIL ||
+ retval == E_INVALIDARG, /* w2k8 */
"function result wrong: got %08x; expected E_FAIL\n", retval);
ok(ERROR_SUCCESS == GetLastError(), "last error set to %u\n",
GetLastError());
@@ -87,7 +96,8 @@
memset(buffer, 0, sizeof(buffer));
SetLastError(ERROR_SUCCESS);
retval = pGetAcceptLanguagesA( buffer, &buffersize);
- ok(retval == E_FAIL,
+ ok(retval == E_FAIL ||
+ retval == E_INVALIDARG, /* w2k8 */
"function result wrong: got %08x; expected E_FAIL\n", retval);
ok(buffersize == 0,
"buffersize wrong(changed) got %08x; expected 0 (2nd parameter; not on
Win2k)\n", buffersize);
@@ -100,9 +110,9 @@
switch(retval) {
case 0L:
if(buffersize == exactsize) {
- ok( (ERROR_SUCCESS == GetLastError()) || (ERROR_CALL_NOT_IMPLEMENTED ==
GetLastError()) ||
+ ok( (ERROR_SUCCESS == GetLastError()) ||
(ERROR_PROC_NOT_FOUND == GetLastError()) || (ERROR_NO_IMPERSONATION_TOKEN ==
GetLastError()),
- "last error wrong: got %u; expected
ERROR_SUCCESS(NT4)/ERROR_CALL_NOT_IMPLEMENTED(98/ME)/"
+ "last error wrong: got %u; expected ERROR_SUCCESS(NT4)/"
"ERROR_PROC_NOT_FOUND(NT4)/ERROR_NO_IMPERSONATION_TOKEN(XP)\n",
GetLastError());
ok(exactsize == strlen(buffer),
"buffer content (length) wrong: got %08x, expected %08x\n",
lstrlenA(buffer), exactsize);
@@ -219,7 +229,7 @@
hmem=pSHAllocShared(&val,4,procid);
ok(hmem!=NULL,"SHAllocShared(NULL...) failed: %u\n", GetLastError());
- p=(int*)pSHLockShared(hmem,procid);
+ p=pSHLockShared(hmem,procid);
ok(p!=NULL,"SHLockShared failed: %u\n", GetLastError());
if (p!=NULL)
ok(*p==val,"Wrong value in shared memory: %d instead of %d\n",*p,val);
@@ -363,12 +373,25 @@
pGetShellSecurityDescriptor=(void*)GetProcAddress(hShlwapi,(char*)475);
+ if(!pGetShellSecurityDescriptor)
+ {
+ win_skip("GetShellSecurityDescriptor not available\n");
+ return;
+ }
+
psd = pGetShellSecurityDescriptor(NULL, 2);
ok(psd==NULL, "GetShellSecurityDescriptor should fail\n");
psd = pGetShellSecurityDescriptor(rgsup, 0);
ok(psd==NULL, "GetShellSecurityDescriptor should fail\n");
+ SetLastError(0xdeadbeef);
psd = pGetShellSecurityDescriptor(rgsup, 2);
+ if (psd == NULL && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+ {
+ /* The previous calls to GetShellSecurityDescriptor don't set the last error
*/
+ win_skip("GetShellSecurityDescriptor is not implemented\n");
+ return;
+ }
ok(psd!=NULL, "GetShellSecurityDescriptor failed\n");
if (psd!=NULL)
{
Modified: trunk/rostests/winetests/shlwapi/path.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/path.c?…
==============================================================================
--- trunk/rostests/winetests/shlwapi/path.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/shlwapi/path.c [iso-8859-1] Sat Jan 31 08:49:08 2009
@@ -82,7 +82,26 @@
{"foo.bar", FALSE},
{"bogusscheme:", TRUE},
{"http:partial", TRUE},
- {"www.winehq.org", FALSE}
+ {"www.winehq.org", FALSE},
+ /* More examples that the user might enter as the browser start page */
+ {"winehq.org", FALSE},
+ {"ftp.winehq.org", FALSE},
+ {"http://winehq.org", TRUE},
+ {"http://www.winehq.org", TRUE},
+ {"https://winehq.org", TRUE},
+ {"https://www.winehq.org", TRUE},
+ {"ftp://winehq.org", TRUE},
+ {"ftp://ftp.winehq.org", TRUE},
+ {"file://does_not_exist.txt", TRUE},
+ {"about:blank", TRUE},
+ {"about:home", TRUE},
+ {"about:mozilla", TRUE},
+ /* scheme is case independent */
+ {"HTTP://www.winehq.org", TRUE},
+ /* a space at the start is not allowed */
+ {"
http://www.winehq.org"quot;, FALSE},
+ {"", FALSE},
+ {NULL, FALSE}
};
struct {
@@ -271,62 +290,34 @@
BOOL ret;
unsigned int c;
- ret = pPathIsValidCharA( 0x7f, 0 );
- ok ( !ret, "PathIsValidCharA succeeded: 0x%08x\n", (DWORD)ret );
-
- ret = pPathIsValidCharA( 0x7f, 1 );
- ok ( !ret, "PathIsValidCharA succeeded: 0x%08x\n", (DWORD)ret );
-
for (c = 0; c < 0x7f; c++)
{
ret = pPathIsValidCharA( c, ~0U );
- ok ( ret == SHELL_charclass[c] || (ret == 1 && SHELL_charclass[c] ==
0xffffffff),
- "PathIsValidCharA failed: 0x%02x got 0x%08x expected 0x%08x\n",
- c, (DWORD)ret, SHELL_charclass[c] );
+ ok ( ret || !SHELL_charclass[c], "PathIsValidCharA failed: 0x%02x got
0x%08x\n", c, ret );
}
for (c = 0x7f; c <= 0xff; c++)
{
ret = pPathIsValidCharA( c, ~0U );
- ok ( ret == 0x00000100,
- "PathIsValidCharA failed: 0x%02x got 0x%08x expected
0x00000100\n",
- c, (DWORD)ret );
+ ok ( ret, "PathIsValidCharA failed: 0x%02x got 0x%08x\n", c, ret );
}
}
static void test_PathIsValidCharW(void)
{
BOOL ret;
- unsigned int c, err_count = 0;
-
- ret = pPathIsValidCharW( 0x7f, 0 );
- ok ( !ret, "PathIsValidCharW succeeded: 0x%08x\n", (DWORD)ret );
-
- ret = pPathIsValidCharW( 0x7f, 1 );
- ok ( !ret, "PathIsValidCharW succeeded: 0x%08x\n", (DWORD)ret );
+ unsigned int c;
for (c = 0; c < 0x7f; c++)
{
ret = pPathIsValidCharW( c, ~0U );
- ok ( ret == SHELL_charclass[c] || (ret == 1 && SHELL_charclass[c] ==
0xffffffff),
- "PathIsValidCharW failed: 0x%02x got 0x%08x expected 0x%08x\n",
- c, (DWORD)ret, SHELL_charclass[c] );
+ ok ( ret || !SHELL_charclass[c], "PathIsValidCharW failed: 0x%02x got
0x%08x\n", c, ret );
}
for (c = 0x007f; c <= 0xffff; c++)
{
ret = pPathIsValidCharW( c, ~0U );
- ok ( ret == 0x00000100,
- "PathIsValidCharW failed: 0x%02x got 0x%08x expected
0x00000100\n",
- c, (DWORD)ret );
- if (ret != 0x00000100)
- {
- if(++err_count > 100 ) {
- trace("skipping rest of PathIsValidCharW tests "
- "because of the current number of errors\n");
- break;
- }
- }
+ ok ( ret, "PathIsValidCharW failed: 0x%02x got 0x%08x\n", c, ret );
}
}
@@ -799,7 +790,7 @@
static void test_PathCanonicalizeA(void)
{
- char dest[MAX_PATH];
+ char dest[LONG_LEN + MAX_PATH];
char too_long[LONG_LEN];
BOOL res;
@@ -891,7 +882,9 @@
res = PathCanonicalizeA(dest, "C:\\one/.\\two\\..");
ok(res, "Expected success\n");
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n",
GetLastError());
- ok(!lstrcmp(dest, "C:\\one/."), "Expected C:\\one/., got %s\n",
dest);
+ ok(!lstrcmp(dest, "C:\\one/.") ||
+ !lstrcmp(dest, "C:\\one/"), /* Vista */
+ "Expected \"C:\\one/.\" or \"C:\\one/\", got
\"%s\"\n", dest);
/* try forward slashes with change dirs
* NOTE: if there is a forward slash in between two backslashes,
@@ -913,7 +906,8 @@
ok(!res, "Expected failure\n");
todo_wine
{
- ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n",
GetLastError());
+ ok(GetLastError() == 0xdeadbeef || GetLastError() == ERROR_FILENAME_EXCED_RANGE
/* Vista */,
+ "Expected 0xdeadbeef or ERROR_FILENAME_EXCED_RANGE, got %d\n",
GetLastError());
}
ok(lstrlen(too_long) == LONG_LEN - 1, "Expected length LONG_LEN - 1, got
%i\n", lstrlen(too_long));
}
@@ -1012,7 +1006,9 @@
lstrcpy(path, "aaaaaaaaa");
root = PathBuildRootA(path, -1);
ok(root == path, "Expected root == path, got %p\n", root);
- ok(!lstrcmp(path, "aaaaaaaaa"), "Expected aaaaaaaaa, got %s\n",
path);
+ ok(!lstrcmp(path, "aaaaaaaaa") ||
+ lstrlenA(path) == 0, /* Vista */
+ "Expected aaaaaaaaa or empty string, got %s\n", path);
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n",
GetLastError());
/* test a drive number greater than 25 */
@@ -1020,7 +1016,9 @@
lstrcpy(path, "aaaaaaaaa");
root = PathBuildRootA(path, 26);
ok(root == path, "Expected root == path, got %p\n", root);
- ok(!lstrcmp(path, "aaaaaaaaa"), "Expected aaaaaaaaa, got %s\n",
path);
+ ok(!lstrcmp(path, "aaaaaaaaa") ||
+ lstrlenA(path) == 0, /* Vista */
+ "Expected aaaaaaaaa or empty string, got %s\n", path);
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n",
GetLastError());
/* length of path is less than 4 */
Modified: trunk/rostests/winetests/shlwapi/shlwapi.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/shlwapi…
==============================================================================
--- trunk/rostests/winetests/shlwapi/shlwapi.rbuild [iso-8859-1] (original)
+++ trunk/rostests/winetests/shlwapi/shlwapi.rbuild [iso-8859-1] Sat Jan 31 08:49:08 2009
@@ -5,6 +5,7 @@
<compilerflag compiler="cc">-Wno-format</compilerflag>
<include base="shlwapi_winetest">.</include>
<define name="__ROS_LONG64__" />
+ <file>assoc.c</file>
<file>clist.c</file>
<file>clsid.c</file>
<file>generated.c</file>
Modified: trunk/rostests/winetests/shlwapi/shreg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/shreg.c…
==============================================================================
--- trunk/rostests/winetests/shlwapi/shreg.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/shlwapi/shreg.c [iso-8859-1] Sat Jan 31 08:49:08 2009
@@ -31,7 +31,7 @@
/* Keys used for testing */
#define REG_TEST_KEY "Software\\Wine\\Test"
-#define REG_CURRENT_VERSION "Software\\Microsoft\\Windows\\CurrentVersion"
+#define REG_CURRENT_VERSION
"Software\\Microsoft\\Windows\\CurrentVersion\\explorer"
static HMODULE hshlwapi;
typedef DWORD (WINAPI *SHCopyKeyA_func)(HKEY,LPCSTR,HKEY,DWORD);
@@ -284,6 +284,12 @@
HKEY hKeySrc, hKeyDst;
DWORD dwRet;
+ if (!pSHCopyKeyA)
+ {
+ win_skip("SHCopyKeyA is not available\n");
+ return;
+ }
+
/* Delete existing destination sub keys */
hKeyDst = NULL;
if (!RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\CopyDestination",
&hKeyDst) && hKeyDst)
@@ -305,22 +311,19 @@
if (dwRet || !hKeySrc)
{
ok( 0, "Source couldn't be opened, RegOpenKeyA returned
(%u)\n", dwRet);
+ RegCloseKey(hKeyDst);
return;
}
-
- if (pSHCopyKeyA)
- {
- dwRet = (*pSHCopyKeyA)(hKeySrc, NULL, hKeyDst, 0);
- ok ( ERROR_SUCCESS == dwRet, "Copy failed, ret=(%u)\n",
dwRet);
- }
+ dwRet = (*pSHCopyKeyA)(hKeySrc, NULL, hKeyDst, 0);
+ ok ( ERROR_SUCCESS == dwRet, "Copy failed, ret=(%u)\n", dwRet);
RegCloseKey(hKeySrc);
RegCloseKey(hKeyDst);
/* Check we copied the sub keys, i.e. something that's on every windows
system (including Wine) */
hKeyDst = NULL;
- dwRet = RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY
"\\CopyDestination\\Setup", &hKeyDst);
+ dwRet = RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY
"\\CopyDestination\\Shell Folders", &hKeyDst);
if (dwRet || !hKeyDst)
{
ok ( 0, "Copy couldn't be opened, RegOpenKeyA returned
(%u)\n", dwRet);
@@ -328,7 +331,7 @@
}
/* And the we copied the values too */
- ok(!SHQueryValueExA(hKeyDst, "BootDir", NULL, NULL, NULL, NULL),
"SHQueryValueExA failed\n");
+ ok(!SHQueryValueExA(hKeyDst, "Common AppData", NULL, NULL, NULL, NULL),
"SHQueryValueExA failed\n");
RegCloseKey(hKeyDst);
}
Modified: trunk/rostests/winetests/shlwapi/string.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/string.…
==============================================================================
--- trunk/rostests/winetests/shlwapi/string.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/shlwapi/string.c [iso-8859-1] Sat Jan 31 08:49:08 2009
@@ -33,6 +33,11 @@
#define expect_eq(expr, val, type, fmt) do { \
type ret = expr; \
ok(ret == val, "Unexpected value of '" #expr "': " #fmt
" instead of " #val "\n", ret); \
+} while (0);
+
+#define expect_eq2(expr, val1, val2, type, fmt) do { \
+ type ret = expr; \
+ ok(ret == val1 || ret == val2, "Unexpected value of '" #expr
"': " #fmt " instead of " #val1 " or " #val2
"\n", ret); \
} while (0);
static BOOL (WINAPI *pIntlStrEqWorkerA)(BOOL,LPCSTR,LPCSTR,int);
@@ -198,9 +203,8 @@
for (count = 32; count < 128; count++)
{
LPSTR result = StrChrA(string+32, count);
- ok(result - string == count,
- "found char '%c' in wrong place: got %d, expected %d\n",
- count, result - string, count);
+ INT pos = result - string;
+ ok(pos == count, "found char '%c' in wrong place: got %d, expected
%d\n", count, pos, count);
}
for (count = 32; count < 128; count++)
@@ -335,9 +339,8 @@
for (count = 32; count < 128; count++)
{
LPWSTR result = StrRChrW(string+32, NULL, count);
- ok(result - string == count,
- "found char %d in wrong place: got %d, expected %d\n",
- count, result - string, count);
+ INT pos = result - string;
+ ok(pos == count, "found char %d in wrong place: got %d, expected %d\n",
count, pos, count);
}
for (count = 32; count < 128; count++)
@@ -481,7 +484,7 @@
if (lpszStr)
{
ok(!strcmp(result->byte_size_64, lpszStr), "Copied string wrong\n");
- LocalFree((HLOCAL)lpszStr);
+ LocalFree(lpszStr);
}
result++;
}
@@ -491,7 +494,7 @@
*/
lpszStr = StrDupA(NULL);
ok(lpszStr == NULL || *lpszStr == '\0', "NULL string returned %p\n",
lpszStr);
- LocalFree((HLOCAL)lpszStr);
+ LocalFree(lpszStr);
}
static void test_StrFormatByteSize64A(void)
@@ -659,16 +662,14 @@
ret = pStrRetToBSTR(&strret, NULL, &bstr);
ok(ret == S_OK && bstr && !strcmpW(bstr, szTestW),
"STRRET_WSTR: dup failed, ret=0x%08x, bstr %p\n", ret, bstr);
- if (bstr)
- SysFreeString(bstr);
+ SysFreeString(bstr);
strret.uType = STRRET_CSTR;
lstrcpyA(U(strret).cStr, "Test");
ret = pStrRetToBSTR(&strret, NULL, &bstr);
ok(ret == S_OK && bstr && !strcmpW(bstr, szTestW),
"STRRET_CSTR: dup failed, ret=0x%08x, bstr %p\n", ret, bstr);
- if (bstr)
- SysFreeString(bstr);
+ SysFreeString(bstr);
strret.uType = STRRET_OFFSET;
U(strret).uOffset = 1;
@@ -676,8 +677,7 @@
ret = pStrRetToBSTR(&strret, iidl, &bstr);
ok(ret == S_OK && bstr && !strcmpW(bstr, szTestW),
"STRRET_OFFSET: dup failed, ret=0x%08x, bstr %p\n", ret, bstr);
- if (bstr)
- SysFreeString(bstr);
+ SysFreeString(bstr);
/* Native crashes if str is NULL */
}
@@ -850,7 +850,7 @@
memset(wbuf, 0xbf, sizeof(wbuf));
strret.uType = STRRET_WSTR;
U(strret).pOleStr = StrDupW(wstr1);
- expect_eq(pStrRetToBufW(&strret, NULL, wbuf, 10), S_OK, HRESULT,
"%x");
+ expect_eq2(pStrRetToBufW(&strret, NULL, wbuf, 10), S_OK,
HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) /* Vista */, HRESULT, "%x");
expect_eq(wbuf[9], 0, WCHAR, "%x");
expect_eq(wbuf[10], (WCHAR)0xbfbf, WCHAR, "%x");
}
@@ -862,7 +862,7 @@
memset(buf, 0xbf, sizeof(buf));
strret.uType = STRRET_CSTR;
StrCpyN(U(strret).cStr, str1, MAX_PATH);
- expect_eq(pStrRetToBufA(&strret, NULL, buf, 10), S_OK, HRESULT,
"%x");
+ expect_eq2(pStrRetToBufA(&strret, NULL, buf, 10), S_OK,
HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) /* Vista */, HRESULT, "%x");
expect_eq(buf[9], 0, CHAR, "%x");
expect_eq(buf[10], (CHAR)0xbf, CHAR, "%x");
}
@@ -873,7 +873,7 @@
{
memset(buf, 0xbf, sizeof(buf));
ret = pwnsprintfA(buf, 10, "%s", str1);
- todo_wine ok(ret == 9, "Unexpected wsnprintfA return %d, expected 9\n",
ret);
+ ok(broken(ret == 9) || ret == -1 /* Vista */, "Unexpected wsnprintfA return
%d, expected 9 or -1\n", ret);
expect_eq(buf[9], 0, CHAR, "%x");
expect_eq(buf[10], (CHAR)0xbf, CHAR, "%x");
}
@@ -884,7 +884,7 @@
{
memset(wbuf, 0xbf, sizeof(wbuf));
ret = pwnsprintfW(wbuf, 10, fmt, wstr1);
- todo_wine ok(ret == 9, "Unexpected wsnprintfW return %d, expected 9\n",
ret);
+ ok(broken(ret == 9) || ret == -1 /* Vista */, "Unexpected wsnprintfW return
%d, expected 9 or -1\n", ret);
expect_eq(wbuf[9], 0, WCHAR, "%x");
expect_eq(wbuf[10], (WCHAR)0xbfbf, WCHAR, "%x");
}
Modified: trunk/rostests/winetests/shlwapi/url.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/url.c?r…
==============================================================================
--- trunk/rostests/winetests/shlwapi/url.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/shlwapi/url.c [iso-8859-1] Sat Jan 31 08:49:08 2009
@@ -1,7 +1,7 @@
/* Unit test suite for Path functions
*
* Copyright 2002 Matthew Mastracci
- * Copyright 2007 Detlef Riekenberg
+ * Copyright 2007,2008 Detlef Riekenberg
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -37,6 +37,35 @@
static const char* TEST_URL_3 =
"http://foo:bar@localhost:21/internal.php?query=x&return=y";
static const WCHAR winehqW[] =
{'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/',0};
static const CHAR winehqA[] =
{'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/',0};
+
+/* ################ */
+
+static const CHAR untouchedA[] = "untouched";
+
+#define TEST_APPLY_MAX_LENGTH INTERNET_MAX_URL_LENGTH
+
+typedef struct _TEST_URL_APPLY {
+ const char * url;
+ DWORD flags;
+ HRESULT res;
+ DWORD newlen;
+ const char * newurl;
+} TEST_URL_APPLY;
+
+static const TEST_URL_APPLY TEST_APPLY[] = {
+ {"www.winehq.org", URL_APPLY_GUESSSCHEME | URL_APPLY_DEFAULT, S_OK, 21,
"http://www.winehq.org"},
+ {"www.winehq.org", URL_APPLY_GUESSSCHEME, S_OK, 21,
"http://www.winehq.org"},
+ {"www.winehq.org", URL_APPLY_DEFAULT, S_OK, 21,
"http://www.winehq.org"},
+ {"ftp.winehq.org", URL_APPLY_GUESSSCHEME | URL_APPLY_DEFAULT, S_OK, 20,
"ftp://ftp.winehq.org"},
+ {"ftp.winehq.org", URL_APPLY_GUESSSCHEME, S_OK, 20,
"ftp://ftp.winehq.org"},
+ {"ftp.winehq.org", URL_APPLY_DEFAULT, S_OK, 21,
"http://ftp.winehq.org"},
+ {"winehq.org", URL_APPLY_GUESSSCHEME | URL_APPLY_DEFAULT, S_OK, 17,
"http://winehq.org"},
+ {"winehq.org", URL_APPLY_GUESSSCHEME, S_FALSE, TEST_APPLY_MAX_LENGTH,
untouchedA},
+ {"winehq.org", URL_APPLY_DEFAULT, S_OK, 17,
"http://winehq.org"},
+ {"", URL_APPLY_GUESSSCHEME | URL_APPLY_DEFAULT, S_OK, 7,
"http://"},
+ {"", URL_APPLY_GUESSSCHEME, S_FALSE, TEST_APPLY_MAX_LENGTH, untouchedA},
+ {"", URL_APPLY_DEFAULT, S_OK, 7, "http://"}
+};
/* ################ */
@@ -103,7 +132,7 @@
{"res:///c:\\tests\\foo bar", URL_DONT_SIMPLIFY, S_OK,
"res:///c:\\tests\\foo bar", TRUE},
{"A", 0, S_OK, "A", FALSE},
{"/uri-res/N2R?urn:sha1:B3K", URL_DONT_ESCAPE_EXTRA_INFO |
URL_WININET_COMPATIBILITY /*0x82000000*/, S_OK, "/uri-res/N2R?urn:sha1:B3K",
TRUE} /*LimeWire online installer calls this*/,
- {"", 0, S_OK, "", FALSE}
+ {"http:www.winehq.org/dir/../index.html", 0, S_OK,
"http:www.winehq.org/index.html"},
};
/* ################ */
@@ -233,6 +262,8 @@
{"foo:today", "bar:calendar", 0, S_OK,
"bar:calendar"},
{"foo:/today", "foo:calendar", 0, S_OK,
"foo:/calendar"},
{"foo:/today/", "foo:calendar", 0, S_OK,
"foo:/today/calendar"},
+ {"mk:@MSITStore:dir/test.chm::dir/index.html", "image.jpg", 0,
S_OK, "mk:@MSITStore:dir/test.chm::dir/image.jpg"},
+ {"mk:@MSITStore:dir/test.chm::dir/dir2/index.html",
"../image.jpg", 0, S_OK, "mk:@MSITStore:dir/test.chm::dir/image.jpg"}
};
/* ################ */
@@ -264,7 +295,8 @@
const char *expect;
} TEST_URL_UNESCAPE[] = {
{"file://foo/bar", "file://foo/bar"},
- {"file://fo%20o%5Ca/bar", "file://fo o\\a/bar"}
+ {"file://fo%20o%5Ca/bar", "file://fo o\\a/bar"},
+ {"file://%24%25foobar", "file://$%foobar"}
};
/* ################ */
@@ -335,6 +367,79 @@
/* ########################### */
+static void test_UrlApplyScheme(void)
+{
+ CHAR newurl[TEST_APPLY_MAX_LENGTH];
+ WCHAR urlW[TEST_APPLY_MAX_LENGTH];
+ WCHAR newurlW[TEST_APPLY_MAX_LENGTH];
+ HRESULT res;
+ DWORD len;
+ DWORD i;
+
+ for(i = 0; i < sizeof(TEST_APPLY)/sizeof(TEST_APPLY[0]); i++) {
+ len = TEST_APPLY_MAX_LENGTH;
+ lstrcpyA(newurl, untouchedA);
+ res = UrlApplySchemeA(TEST_APPLY[i].url, newurl, &len, TEST_APPLY[i].flags);
+ ok( res == TEST_APPLY[i].res,
+ "#%dA: got HRESULT 0x%x (expected 0x%x)\n", i, res,
TEST_APPLY[i].res);
+
+ ok( len == TEST_APPLY[i].newlen,
+ "#%dA: got len %d (expected %d)\n", i, len, TEST_APPLY[i].newlen);
+
+ ok( !lstrcmpA(newurl, TEST_APPLY[i].newurl),
+ "#%dA: got '%s' (expected '%s')\n", i, newurl,
TEST_APPLY[i].newurl);
+
+ /* returned length is in character */
+ len = TEST_APPLY_MAX_LENGTH;
+ lstrcpyA(newurl, untouchedA);
+ MultiByteToWideChar(CP_ACP, 0, newurl, -1, newurlW, len);
+ MultiByteToWideChar(CP_ACP, 0, TEST_APPLY[i].url, -1, urlW, len);
+
+ res = UrlApplySchemeW(urlW, newurlW, &len, TEST_APPLY[i].flags);
+ WideCharToMultiByte(CP_ACP, 0, newurlW, -1, newurl, TEST_APPLY_MAX_LENGTH, NULL,
NULL);
+ ok( res == TEST_APPLY[i].res,
+ "#%dW: got HRESULT 0x%x (expected 0x%x)\n", i, res,
TEST_APPLY[i].res);
+
+ ok( len == TEST_APPLY[i].newlen,
+ "#%dW: got len %d (expected %d)\n", i, len, TEST_APPLY[i].newlen);
+
+ ok( !lstrcmpA(newurl, TEST_APPLY[i].newurl),
+ "#%dW: got '%s' (expected '%s')\n", i, newurl,
TEST_APPLY[i].newurl);
+
+ }
+
+ /* buffer too small */
+ lstrcpyA(newurl, untouchedA);
+ len = lstrlenA(TEST_APPLY[0].newurl);
+ res = UrlApplySchemeA(TEST_APPLY[0].url, newurl, &len, TEST_APPLY[0].flags);
+ ok(res == E_POINTER, "got HRESULT 0x%x (expected E_POINTER)\n", res);
+ /* The returned length include the space for the terminating 0 */
+ i = lstrlenA(TEST_APPLY[0].newurl)+1;
+ ok(len == i, "got len %d (expected %d)\n", len, i);
+ ok(!lstrcmpA(newurl, untouchedA), "got '%s' (expected
'%s')\n", newurl, untouchedA);
+
+ /* NULL as parameter. The length and the buffer are not modified */
+ lstrcpyA(newurl, untouchedA);
+ len = TEST_APPLY_MAX_LENGTH;
+ res = UrlApplySchemeA(NULL, newurl, &len, TEST_APPLY[0].flags);
+ ok(res == E_INVALIDARG, "got HRESULT 0x%x (expected E_INVALIDARG)\n",
res);
+ ok(len == TEST_APPLY_MAX_LENGTH, "got len %d\n", len);
+ ok(!lstrcmpA(newurl, untouchedA), "got '%s' (expected
'%s')\n", newurl, untouchedA);
+
+ len = TEST_APPLY_MAX_LENGTH;
+ res = UrlApplySchemeA(TEST_APPLY[0].url, NULL, &len, TEST_APPLY[0].flags);
+ ok(res == E_INVALIDARG, "got HRESULT 0x%x (expected E_INVALIDARG)\n",
res);
+ ok(len == TEST_APPLY_MAX_LENGTH, "got len %d\n", len);
+
+ lstrcpyA(newurl, untouchedA);
+ res = UrlApplySchemeA(TEST_APPLY[0].url, newurl, NULL, TEST_APPLY[0].flags);
+ ok(res == E_INVALIDARG, "got HRESULT 0x%x (expected E_INVALIDARG)\n",
res);
+ ok(!lstrcmpA(newurl, untouchedA), "got '%s' (expected
'%s')\n", newurl, untouchedA);
+
+}
+
+/* ########################### */
+
static void hash_url(const char* szUrl)
{
LPCSTR szTestUrl = szUrl;
@@ -441,19 +546,23 @@
}
-static void test_url_canonicalize(int index, const char *szUrl, DWORD dwFlags, HRESULT
dwExpectReturn, const char *szExpectUrl, BOOL todo)
+static void test_url_canonicalize(int index, const char *szUrl, DWORD dwFlags, HRESULT
dwExpectReturn, HRESULT dwExpectReturnAlt, const char *szExpectUrl, BOOL todo)
{
CHAR szReturnUrl[INTERNET_MAX_URL_LENGTH];
WCHAR wszReturnUrl[INTERNET_MAX_URL_LENGTH];
LPWSTR wszUrl = GetWideString(szUrl);
LPWSTR wszExpectUrl = GetWideString(szExpectUrl);
LPWSTR wszConvertedUrl;
+ HRESULT ret;
DWORD dwSize;
dwSize = INTERNET_MAX_URL_LENGTH;
ok(UrlCanonicalizeA(szUrl, NULL, &dwSize, dwFlags) != dwExpectReturn,
"Unexpected return for NULL buffer, index %d\n", index);
- ok(UrlCanonicalizeA(szUrl, szReturnUrl, &dwSize, dwFlags) == dwExpectReturn,
"UrlCanonicalizeA didn't return 0x%08x, index %d\n", dwExpectReturn,
index);
+ ret = UrlCanonicalizeA(szUrl, szReturnUrl, &dwSize, dwFlags);
+ ok(ret == dwExpectReturn || ret == dwExpectReturnAlt,
+ "UrlCanonicalizeA failed: expected=0x%08x or 0x%08x, got=0x%08x, index
%d\n",
+ dwExpectReturn, dwExpectReturnAlt, ret, index);
if (todo)
todo_wine
ok(strcmp(szReturnUrl,szExpectUrl)==0, "UrlCanonicalizeA dwFlags 0x%08x url
'%s' Expected \"%s\", but got \"%s\", index %d\n",
dwFlags, szUrl, szExpectUrl, szReturnUrl, index);
@@ -562,11 +671,12 @@
"got 0x%x with %u and size %u for '%s' and %u (expected
'S_OK' and size %u)\n",
hr, GetLastError(), dwSize, szReturnUrl, lstrlenA(szReturnUrl), urllen);
+ test_url_canonicalize(-1, "", 0, S_OK, S_FALSE /* Vista/win2k8 */,
"", FALSE);
/* test url-modification */
for(i=0; i<sizeof(TEST_CANONICALIZE)/sizeof(TEST_CANONICALIZE[0]); i++) {
test_url_canonicalize(i, TEST_CANONICALIZE[i].url, TEST_CANONICALIZE[i].flags,
- TEST_CANONICALIZE[i].expectret,
TEST_CANONICALIZE[i].expecturl,
+ TEST_CANONICALIZE[i].expectret,
TEST_CANONICALIZE[i].expectret, TEST_CANONICALIZE[i].expecturl,
TEST_CANONICALIZE[i].todo);
}
}
@@ -636,7 +746,7 @@
BOOL choped;
int pos;
- MultiByteToWideChar(CP_UTF8, 0, "http://www.winehq.org/X", -1, szUrl,
128);
+ MultiByteToWideChar(CP_ACP, 0, "http://www.winehq.org/X", -1, szUrl,
128);
pos = lstrlenW(szUrl) - 1;
szUrl[pos] = i;
urllen = INTERNET_MAX_URL_LENGTH;
@@ -801,13 +911,20 @@
DWORD dwEscaped;
size_t i;
static char inplace[] = "file:///C:/Program%20Files";
+ static char another_inplace[] = "file:///C:/Program%20Files";
static const char expected[] = "file:///C:/Program Files";
static WCHAR inplaceW[] =
{'f','i','l','e',':','/','/','/','C',':','/','P','r','o','g','r','a','m','
','F','i','l','e','s',0};
+ static WCHAR another_inplaceW[] =
{'f','i','l','e',':','/','/','/','C',':','/','P','r','o','g','r','a','m','%','2','0','F','i','l','e','s',0};
for(i=0; i<sizeof(TEST_URL_UNESCAPE)/sizeof(TEST_URL_UNESCAPE[0]); i++) {
dwEscaped=INTERNET_MAX_URL_LENGTH;
ok(UrlUnescapeA(TEST_URL_UNESCAPE[i].url, szReturnUrl, &dwEscaped, 0) ==
S_OK, "UrlUnescapeA didn't return 0x%08x from \"%s\"\n", S_OK,
TEST_URL_UNESCAPE[i].url);
ok(strcmp(szReturnUrl,TEST_URL_UNESCAPE[i].expect)==0, "Expected
\"%s\", but got \"%s\" from \"%s\"\n",
TEST_URL_UNESCAPE[i].expect, szReturnUrl, TEST_URL_UNESCAPE[i].url);
+
+ ZeroMemory(szReturnUrl, sizeof(szReturnUrl));
+ /* if we set the bufferpointer to NULL here UrlUnescape fails and string gets
not converted */
+ ok(UrlUnescapeA(TEST_URL_UNESCAPE[i].url, szReturnUrl, NULL, 0) == E_INVALIDARG,
"UrlUnescapeA didn't return 0x%08x from \"%s\"\n", E_INVALIDARG
,TEST_URL_UNESCAPE[i].url);
+ ok(strcmp(szReturnUrl,"")==0, "Expected empty string\n");
dwEscaped = INTERNET_MAX_URL_LENGTH;
urlW = GetWideString(TEST_URL_UNESCAPE[i].url);
@@ -824,9 +941,18 @@
ok(!strcmp(inplace, expected), "got %s expected %s\n", inplace, expected);
ok(dwEscaped == 27, "got %d expected 27\n", dwEscaped);
+ /* if we set the bufferpointer to NULL, the string apparently still gets converted
(Google Lively does this)) */
+ ok(UrlUnescapeA(another_inplace, NULL, NULL, URL_UNESCAPE_INPLACE) == S_OK,
"UrlUnescapeA failed unexpectedly\n");
+ ok(!strcmp(another_inplace, expected), "got %s expected %s\n",
another_inplace, expected);
+
dwEscaped = sizeof(inplaceW);
ok(UrlUnescapeW(inplaceW, NULL, &dwEscaped, URL_UNESCAPE_INPLACE) == S_OK,
"UrlUnescapeW failed unexpectedly\n");
ok(dwEscaped == 50, "got %d expected 50\n", dwEscaped);
+
+ /* if we set the bufferpointer to NULL, the string apparently still gets converted
(Google Lively does this)) */
+ ok(UrlUnescapeW(another_inplaceW, NULL, NULL, URL_UNESCAPE_INPLACE) == S_OK,
"UrlUnescapeW failed unexpectedly\n");
+ ok(lstrlenW(another_inplaceW) == 24, "got %d expected 24\n",
lstrlenW(another_inplaceW));
+
}
/* ########################### */
@@ -837,6 +963,7 @@
hShlwapi = GetModuleHandleA("shlwapi.dll");
pUrlCanonicalizeW = (void *) GetProcAddress(hShlwapi, "UrlCanonicalizeW");
+ test_UrlApplyScheme();
test_UrlHash();
test_UrlGetPart();
test_UrlCanonicalizeA();