Author: cwittich
Date: Sun Jan 4 05:33:07 2009
New Revision: 38556
URL:
http://svn.reactos.org/svn/reactos?rev=38556&view=rev
Log:
sync hlink_winetest with wine 1.1.12
Modified:
trunk/rostests/winetests/hlink/hlink.c
Modified: trunk/rostests/winetests/hlink/hlink.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/hlink/hlink.c?r…
==============================================================================
--- trunk/rostests/winetests/hlink/hlink.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/hlink/hlink.c [iso-8859-1] Sun Jan 4 05:33:07 2009
@@ -23,6 +23,7 @@
#include <stdio.h>
+#include <initguid.h>
#include <hlink.h>
#include <hlguids.h>
@@ -157,6 +158,13 @@
ok(r == S_OK, "failed\n");
ok(str == NULL, "string should be null\n");
+ /* Unimplented functions checks */
+ r = IHlink_GetAdditionalParams(lnk, NULL);
+ ok(r == E_NOTIMPL, "failed\n");
+
+ r = IHlink_SetAdditionalParams(lnk, NULL);
+ ok(r == E_NOTIMPL, "failed\n");
+
IHlink_Release(lnk);
}
@@ -171,6 +179,23 @@
0x2f,0x00,0x77,0x00,0x69,0x00,0x6e,0x00,
0x65,0x00,0x68,0x00,0x71,0x00,0x2e,0x00,
0x6f,0x00,0x72,0x00,0x67,0x00,0x2f,0x00,
+ 0x00,0x00,
+};
+
+/* url only (IE7) */
+static const unsigned char expected_hlink_data_ie7[] =
+{
+ 0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
+ 0xe0,0xc9,0xea,0x79,0xf9,0xba,0xce,0x11,
+ 0x8c,0x82,0x00,0xaa,0x00,0x4b,0xa9,0x0b,
+ 0x3e,0x00,0x00,0x00,0x68,0x00,0x74,0x00,
+ 0x74,0x00,0x70,0x00,0x3a,0x00,0x2f,0x00,
+ 0x2f,0x00,0x77,0x00,0x69,0x00,0x6e,0x00,
+ 0x65,0x00,0x68,0x00,0x71,0x00,0x2e,0x00,
+ 0x6f,0x00,0x72,0x00,0x67,0x00,0x2f,0x00,
+ 0x00,0x00,0x79,0x58,0x81,0xf4,0x3b,0x1d,
+ 0x7f,0x48,0xaf,0x2c,0x82,0x5d,0xc4,0x85,
+ 0x27,0x63,0x00,0x00,0x00,0x00,0xa5,0xab,
0x00,0x00,
};
@@ -188,6 +213,25 @@
0x69,0x00,0x6e,0x00,0x65,0x00,0x68,0x00,
0x71,0x00,0x2e,0x00,0x6f,0x00,0x72,0x00,
0x67,0x00,0x2f,0x00,0x00,0x00,
+};
+
+/* url + friendly name (IE7) */
+static const unsigned char expected_hlink_data2_ie7[] =
+{
+ 0x02,0x00,0x00,0x00,0x17,0x00,0x00,0x00,
+ 0x08,0x00,0x00,0x00,0x57,0x00,0x69,0x00,
+ 0x6e,0x00,0x65,0x00,0x20,0x00,0x48,0x00,
+ 0x51,0x00,0x00,0x00,0xe0,0xc9,0xea,0x79,
+ 0xf9,0xba,0xce,0x11,0x8c,0x82,0x00,0xaa,
+ 0x00,0x4b,0xa9,0x0b,0x3e,0x00,0x00,0x00,
+ 0x68,0x00,0x74,0x00,0x74,0x00,0x70,0x00,
+ 0x3a,0x00,0x2f,0x00,0x2f,0x00,0x77,0x00,
+ 0x69,0x00,0x6e,0x00,0x65,0x00,0x68,0x00,
+ 0x71,0x00,0x2e,0x00,0x6f,0x00,0x72,0x00,
+ 0x67,0x00,0x2f,0x00,0x00,0x00,0x79,0x58,
+ 0x81,0xf4,0x3b,0x1d,0x7f,0x48,0xaf,0x2c,
+ 0x82,0x5d,0xc4,0x85,0x27,0x63,0x00,0x00,
+ 0x00,0x00,0xa5,0xab,0x00,0x00,
};
/* url + friendly name + location */
@@ -208,6 +252,27 @@
0x61,0x00,0x6e,0x00,0x6b,0x00,0x00,0x00,
};
+/* url + friendly name + location (IE7) */
+static const unsigned char expected_hlink_data3_ie7[] =
+{
+ 0x02,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,
+ 0x08,0x00,0x00,0x00,0x57,0x00,0x69,0x00,
+ 0x6e,0x00,0x65,0x00,0x20,0x00,0x48,0x00,
+ 0x51,0x00,0x00,0x00,0xe0,0xc9,0xea,0x79,
+ 0xf9,0xba,0xce,0x11,0x8c,0x82,0x00,0xaa,
+ 0x00,0x4b,0xa9,0x0b,0x3e,0x00,0x00,0x00,
+ 0x68,0x00,0x74,0x00,0x74,0x00,0x70,0x00,
+ 0x3a,0x00,0x2f,0x00,0x2f,0x00,0x77,0x00,
+ 0x69,0x00,0x6e,0x00,0x65,0x00,0x68,0x00,
+ 0x71,0x00,0x2e,0x00,0x6f,0x00,0x72,0x00,
+ 0x67,0x00,0x2f,0x00,0x00,0x00,0x79,0x58,
+ 0x81,0xf4,0x3b,0x1d,0x7f,0x48,0xaf,0x2c,
+ 0x82,0x5d,0xc4,0x85,0x27,0x63,0x00,0x00,
+ 0x00,0x00,0xa5,0xab,0x00,0x00,0x07,0x00,
+ 0x00,0x00,0x5f,0x00,0x62,0x00,0x6c,0x00,
+ 0x61,0x00,0x6e,0x00,0x6b,0x00,0x00,0x00,
+};
+
/* relative url */
static const unsigned char expected_hlink_data4[] =
{
@@ -238,6 +303,25 @@
0x2f,0x00,0x00,0x00,
};
+/* url + target frame name (IE7) */
+static const unsigned char expected_hlink_data5_ie7[] =
+{
+ 0x02,0x00,0x00,0x00,0x83,0x00,0x00,0x00,
+ 0x07,0x00,0x00,0x00,0x74,0x00,0x67,0x00,
+ 0x74,0x00,0x66,0x00,0x72,0x00,0x6d,0x00,
+ 0x00,0x00,0xe0,0xc9,0xea,0x79,0xf9,0xba,
+ 0xce,0x11,0x8c,0x82,0x00,0xaa,0x00,0x4b,
+ 0xa9,0x0b,0x3e,0x00,0x00,0x00,0x68,0x00,
+ 0x74,0x00,0x74,0x00,0x70,0x00,0x3a,0x00,
+ 0x2f,0x00,0x2f,0x00,0x77,0x00,0x69,0x00,
+ 0x6e,0x00,0x65,0x00,0x68,0x00,0x71,0x00,
+ 0x2e,0x00,0x6f,0x00,0x72,0x00,0x67,0x00,
+ 0x2f,0x00,0x00,0x00,0x79,0x58,0x81,0xf4,
+ 0x3b,0x1d,0x7f,0x48,0xaf,0x2c,0x82,0x5d,
+ 0xc4,0x85,0x27,0x63,0x00,0x00,0x00,0x00,
+ 0xa5,0xab,0x00,0x00,
+};
+
/* filename */
static const unsigned char expected_hlink_data6[] =
{
@@ -255,7 +339,9 @@
static void test_persist_save_data(const char *testname, IHlink *lnk,
const unsigned char *expected_data,
- unsigned int expected_data_size)
+ unsigned int expected_data_size,
+ const unsigned char *expected_data_alt,
+ unsigned int expected_data_alt_size)
{
HRESULT hr;
IStream *stream;
@@ -265,6 +351,7 @@
const unsigned char *data;
DWORD i;
BOOL same;
+ unsigned int expected_data_win9x_size = 0;
hr = IHlink_QueryInterface(lnk, &IID_IPersistStream, (void **)&ps);
ok(hr == S_OK, "IHlink_QueryInterface failed with error 0x%08x\n", hr);
@@ -282,10 +369,15 @@
data = GlobalLock(hglobal);
+ if (expected_data_size % 4)
+ expected_data_win9x_size = 4 * ((expected_data_size / 4) + 1);
+
/* first check we have the right amount of data */
- ok(data_size == expected_data_size,
- "%s: Size of saved data differs (expected %d, actual %d)\n",
- testname, expected_data_size, data_size);
+ ok((data_size == expected_data_size) ||
+ (data_size == expected_data_alt_size) ||
+ broken(data_size == expected_data_win9x_size), /* Win9x and WinMe */
+ "%s: Size of saved data differs (expected %d or %d, actual %d)\n",
+ testname, expected_data_size, expected_data_alt_size, data_size);
same = TRUE;
/* then do a byte-by-byte comparison */
@@ -301,6 +393,23 @@
}
}
+ if (!same && (expected_data_alt != expected_data))
+ {
+ /* then try the alternate data */
+ same = TRUE;
+ for (i = 0; i < min(data_size, expected_data_alt_size); i++)
+ {
+ if ((expected_data_alt[i] != data[i]) &&
+ (((expected_data_alt != expected_hlink_data2) &&
+ (expected_data_alt != expected_hlink_data3)) ||
+ ((i < 52 || i >= 56) && (i < 80 || i >= 84))))
+ {
+ same = FALSE;
+ break;
+ }
+ }
+ }
+
ok(same, "%s: Saved data differs\n", testname);
if (!same)
{
@@ -337,25 +446,33 @@
skip("Can't create lnk, skipping test_persist. Was wineprefixcreate run
properly?\n");
return;
}
- test_persist_save_data("url only", lnk, expected_hlink_data,
sizeof(expected_hlink_data));
+ test_persist_save_data("url only", lnk,
+ expected_hlink_data, sizeof(expected_hlink_data),
+ expected_hlink_data_ie7, sizeof(expected_hlink_data_ie7));
IHlink_Release(lnk);
hr = HlinkCreateFromString(url, NULL, friendly_name, NULL,
0, NULL, &IID_IHlink, (LPVOID*) &lnk);
ok(hr == S_OK, "IHlinCreateFromString failed with error 0x%08x\n", hr);
- test_persist_save_data("url + friendly name", lnk, expected_hlink_data2,
sizeof(expected_hlink_data2));
+ test_persist_save_data("url + friendly name", lnk,
+ expected_hlink_data2, sizeof(expected_hlink_data2),
+ expected_hlink_data2_ie7, sizeof(expected_hlink_data2_ie7));
IHlink_Release(lnk);
hr = HlinkCreateFromString(url, location, friendly_name, NULL,
0, NULL, &IID_IHlink, (LPVOID*) &lnk);
ok(hr == S_OK, "IHlinCreateFromString failed with error 0x%08x\n", hr);
- test_persist_save_data("url + friendly_name + location", lnk,
expected_hlink_data3, sizeof(expected_hlink_data3));
+ test_persist_save_data("url + friendly_name + location", lnk,
+ expected_hlink_data3, sizeof(expected_hlink_data3),
+ expected_hlink_data3_ie7, sizeof(expected_hlink_data3_ie7));
IHlink_Release(lnk);
hr = HlinkCreateFromString(rel_url, NULL, NULL, NULL,
0, NULL, &IID_IHlink, (LPVOID*) &lnk);
ok(hr == S_OK, "IHlinCreateFromString failed with error 0x%08x\n", hr);
- test_persist_save_data("relative url", lnk, expected_hlink_data4,
sizeof(expected_hlink_data4));
+ test_persist_save_data("relative url", lnk,
+ expected_hlink_data4, sizeof(expected_hlink_data4),
+ expected_hlink_data4, sizeof(expected_hlink_data4));
IHlink_Release(lnk);
hr = HlinkCreateFromString(url, NULL, NULL, NULL,
@@ -363,13 +480,17 @@
ok(hr == S_OK, "IHlinCreateFromString failed with error 0x%08x\n", hr);
hr = IHlink_SetTargetFrameName(lnk, target_frame_name);
ok(hr == S_OK, "IHlink_SetTargetFrameName failed with error 0x%08x\n",
hr);
- test_persist_save_data("url + target frame name", lnk,
expected_hlink_data5, sizeof(expected_hlink_data5));
+ test_persist_save_data("url + target frame name", lnk,
+ expected_hlink_data5, sizeof(expected_hlink_data5),
+ expected_hlink_data5_ie7, sizeof(expected_hlink_data5_ie7));
IHlink_Release(lnk);
hr = HlinkCreateFromString(filename, NULL, NULL, NULL,
0, NULL, &IID_IHlink, (LPVOID*) &lnk);
ok(hr == S_OK, "IHlinCreateFromString failed with error 0x%08x\n", hr);
- test_persist_save_data("filename", lnk, expected_hlink_data6,
sizeof(expected_hlink_data6));
+ test_persist_save_data("filename", lnk,
+ expected_hlink_data6, sizeof(expected_hlink_data6),
+ expected_hlink_data6, sizeof(expected_hlink_data6));
IHlink_Release(lnk);
}