2 * Implementation of hyperlinking (hlink.dll)
4 * Copyright 2006 Mike McCormack
5 * Copyright 2007-2008 Jacek Caban for CodeWeavers
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
30 #include "wine/test.h"
32 #define DEFINE_EXPECT(func) \
33 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
35 #define SET_EXPECT(func) \
36 expect_ ## func = TRUE
38 #define CHECK_EXPECT2(func) \
40 ok(expect_ ##func, "unexpected call " #func "\n"); \
41 called_ ## func = TRUE; \
44 #define CHECK_EXPECT(func) \
46 CHECK_EXPECT2(func); \
47 expect_ ## func = FALSE; \
50 #define CHECK_CALLED(func) \
52 ok(called_ ## func, "expected " #func "\n"); \
53 expect_ ## func = called_ ## func = FALSE; \
56 DEFINE_EXPECT(IsSystemMoniker
);
57 DEFINE_EXPECT(BindToStorage
);
58 DEFINE_EXPECT(GetDisplayName
);
60 static const char *debugstr_guid(REFIID riid
)
64 sprintf(buf
, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
65 riid
->Data1
, riid
->Data2
, riid
->Data3
, riid
->Data4
[0],
66 riid
->Data4
[1], riid
->Data4
[2], riid
->Data4
[3], riid
->Data4
[4],
67 riid
->Data4
[5], riid
->Data4
[6], riid
->Data4
[7]);
72 static void test_HlinkIsShortcut(void)
77 static const WCHAR file0
[] = {'f','i','l','e',0};
78 static const WCHAR file1
[] = {'f','i','l','e','.','u','r','l',0};
79 static const WCHAR file2
[] = {'f','i','l','e','.','l','n','k',0};
80 static const WCHAR file3
[] = {'f','i','l','e','.','u','R','l',0};
81 static const WCHAR file4
[] = {'f','i','l','e','u','r','l',0};
82 static const WCHAR file5
[] = {'c',':','\\','f','i','l','e','.','u','r','l',0};
83 static const WCHAR file6
[] = {'c',':','\\','f','i','l','e','.','l','n','k',0};
84 static const WCHAR file7
[] = {'.','u','r','l',0};
101 for(i
=0; i
<sizeof(shortcut_test
)/sizeof(shortcut_test
[0]); i
++) {
102 hres
= HlinkIsShortcut(shortcut_test
[i
].file
);
103 ok(hres
== shortcut_test
[i
].hres
, "[%d] HlinkIsShortcut returned %08x, expected %08x\n",
104 i
, hres
, shortcut_test
[i
].hres
);
108 static void test_reference(void)
113 const WCHAR url
[] = { 'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g',0 };
114 const WCHAR url2
[] = { 'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g','/',0 };
117 r
= HlinkCreateFromString(url
, NULL
, NULL
, NULL
,
118 0, NULL
, &IID_IHlink
, (LPVOID
*) &lnk
);
119 ok(r
== S_OK
, "failed to create link\n");
123 r
= IHlink_GetMonikerReference(lnk
, HLINKGETREF_DEFAULT
, NULL
, NULL
);
124 ok(r
== S_OK
, "failed\n");
126 r
= IHlink_GetMonikerReference(lnk
, HLINKGETREF_DEFAULT
, &mk
, &str
);
127 ok(r
== S_OK
, "failed\n");
128 ok(mk
!= NULL
, "no moniker\n");
129 ok(str
== NULL
, "string should be null\n");
131 r
= IMoniker_Release(mk
);
132 ok( r
== 1, "moniker refcount wrong\n");
134 r
= IHlink_GetStringReference(lnk
, -1, &str
, NULL
);
135 ok(r
== S_OK
, "failed\n");
138 r
= IHlink_GetStringReference(lnk
, HLINKGETREF_DEFAULT
, &str
, NULL
);
139 ok(r
== S_OK
, "failed\n");
141 ok(!lstrcmpW(str
, url2
), "url wrong\n");
145 r
= IHlink_GetStringReference(lnk
, HLINKGETREF_DEFAULT
, NULL
, NULL
);
146 ok(r
== S_OK
, "failed\n");
148 r
= IHlink_GetStringReference(lnk
, HLINKGETREF_DEFAULT
, NULL
, &str
);
149 ok(r
== S_OK
, "failed\n");
150 ok(str
== NULL
, "string should be null\n");
152 /* Unimplented functions checks */
153 r
= IHlink_GetAdditionalParams(lnk
, NULL
);
154 ok(r
== E_NOTIMPL
, "failed\n");
156 r
= IHlink_SetAdditionalParams(lnk
, NULL
);
157 ok(r
== E_NOTIMPL
, "failed\n");
163 static const unsigned char expected_hlink_data
[] =
165 0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
166 0xe0,0xc9,0xea,0x79,0xf9,0xba,0xce,0x11,
167 0x8c,0x82,0x00,0xaa,0x00,0x4b,0xa9,0x0b,
168 0x26,0x00,0x00,0x00,0x68,0x00,0x74,0x00,
169 0x74,0x00,0x70,0x00,0x3a,0x00,0x2f,0x00,
170 0x2f,0x00,0x77,0x00,0x69,0x00,0x6e,0x00,
171 0x65,0x00,0x68,0x00,0x71,0x00,0x2e,0x00,
172 0x6f,0x00,0x72,0x00,0x67,0x00,0x2f,0x00,
177 static const unsigned char expected_hlink_data_ie7
[] =
179 0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
180 0xe0,0xc9,0xea,0x79,0xf9,0xba,0xce,0x11,
181 0x8c,0x82,0x00,0xaa,0x00,0x4b,0xa9,0x0b,
182 0x3e,0x00,0x00,0x00,0x68,0x00,0x74,0x00,
183 0x74,0x00,0x70,0x00,0x3a,0x00,0x2f,0x00,
184 0x2f,0x00,0x77,0x00,0x69,0x00,0x6e,0x00,
185 0x65,0x00,0x68,0x00,0x71,0x00,0x2e,0x00,
186 0x6f,0x00,0x72,0x00,0x67,0x00,0x2f,0x00,
187 0x00,0x00,0x79,0x58,0x81,0xf4,0x3b,0x1d,
188 0x7f,0x48,0xaf,0x2c,0x82,0x5d,0xc4,0x85,
189 0x27,0x63,0x00,0x00,0x00,0x00,0xa5,0xab,
193 /* url + friendly name */
194 static const unsigned char expected_hlink_data2
[] =
196 0x02,0x00,0x00,0x00,0x17,0x00,0x00,0x00,
197 0x08,0x00,0x00,0x00,0x57,0x00,0x69,0x00,
198 0x6e,0x00,0x65,0x00,0x20,0x00,0x48,0x00,
199 0x51,0x00,0x00,0x00,0xe0,0xc9,0xea,0x79,
200 0xf9,0xba,0xce,0x11,0x8c,0x82,0x00,0xaa,
201 0x00,0x4b,0xa9,0x0b,0x26,0x00,0x00,0x00,
202 0x68,0x00,0x74,0x00,0x74,0x00,0x70,0x00,
203 0x3a,0x00,0x2f,0x00,0x2f,0x00,0x77,0x00,
204 0x69,0x00,0x6e,0x00,0x65,0x00,0x68,0x00,
205 0x71,0x00,0x2e,0x00,0x6f,0x00,0x72,0x00,
206 0x67,0x00,0x2f,0x00,0x00,0x00,
209 /* url + friendly name (IE7) */
210 static const unsigned char expected_hlink_data2_ie7
[] =
212 0x02,0x00,0x00,0x00,0x17,0x00,0x00,0x00,
213 0x08,0x00,0x00,0x00,0x57,0x00,0x69,0x00,
214 0x6e,0x00,0x65,0x00,0x20,0x00,0x48,0x00,
215 0x51,0x00,0x00,0x00,0xe0,0xc9,0xea,0x79,
216 0xf9,0xba,0xce,0x11,0x8c,0x82,0x00,0xaa,
217 0x00,0x4b,0xa9,0x0b,0x3e,0x00,0x00,0x00,
218 0x68,0x00,0x74,0x00,0x74,0x00,0x70,0x00,
219 0x3a,0x00,0x2f,0x00,0x2f,0x00,0x77,0x00,
220 0x69,0x00,0x6e,0x00,0x65,0x00,0x68,0x00,
221 0x71,0x00,0x2e,0x00,0x6f,0x00,0x72,0x00,
222 0x67,0x00,0x2f,0x00,0x00,0x00,0x79,0x58,
223 0x81,0xf4,0x3b,0x1d,0x7f,0x48,0xaf,0x2c,
224 0x82,0x5d,0xc4,0x85,0x27,0x63,0x00,0x00,
225 0x00,0x00,0xa5,0xab,0x00,0x00,
228 /* url + friendly name + location */
229 static const unsigned char expected_hlink_data3
[] =
231 0x02,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,
232 0x08,0x00,0x00,0x00,0x57,0x00,0x69,0x00,
233 0x6e,0x00,0x65,0x00,0x20,0x00,0x48,0x00,
234 0x51,0x00,0x00,0x00,0xe0,0xc9,0xea,0x79,
235 0xf9,0xba,0xce,0x11,0x8c,0x82,0x00,0xaa,
236 0x00,0x4b,0xa9,0x0b,0x26,0x00,0x00,0x00,
237 0x68,0x00,0x74,0x00,0x74,0x00,0x70,0x00,
238 0x3a,0x00,0x2f,0x00,0x2f,0x00,0x77,0x00,
239 0x69,0x00,0x6e,0x00,0x65,0x00,0x68,0x00,
240 0x71,0x00,0x2e,0x00,0x6f,0x00,0x72,0x00,
241 0x67,0x00,0x2f,0x00,0x00,0x00,0x07,0x00,
242 0x00,0x00,0x5f,0x00,0x62,0x00,0x6c,0x00,
243 0x61,0x00,0x6e,0x00,0x6b,0x00,0x00,0x00,
246 /* url + friendly name + location (IE7) */
247 static const unsigned char expected_hlink_data3_ie7
[] =
249 0x02,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,
250 0x08,0x00,0x00,0x00,0x57,0x00,0x69,0x00,
251 0x6e,0x00,0x65,0x00,0x20,0x00,0x48,0x00,
252 0x51,0x00,0x00,0x00,0xe0,0xc9,0xea,0x79,
253 0xf9,0xba,0xce,0x11,0x8c,0x82,0x00,0xaa,
254 0x00,0x4b,0xa9,0x0b,0x3e,0x00,0x00,0x00,
255 0x68,0x00,0x74,0x00,0x74,0x00,0x70,0x00,
256 0x3a,0x00,0x2f,0x00,0x2f,0x00,0x77,0x00,
257 0x69,0x00,0x6e,0x00,0x65,0x00,0x68,0x00,
258 0x71,0x00,0x2e,0x00,0x6f,0x00,0x72,0x00,
259 0x67,0x00,0x2f,0x00,0x00,0x00,0x79,0x58,
260 0x81,0xf4,0x3b,0x1d,0x7f,0x48,0xaf,0x2c,
261 0x82,0x5d,0xc4,0x85,0x27,0x63,0x00,0x00,
262 0x00,0x00,0xa5,0xab,0x00,0x00,0x07,0x00,
263 0x00,0x00,0x5f,0x00,0x62,0x00,0x6c,0x00,
264 0x61,0x00,0x6e,0x00,0x6b,0x00,0x00,0x00,
268 static const unsigned char expected_hlink_data4
[] =
270 0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
271 0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
272 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
273 0x00,0x00,0x0b,0x00,0x00,0x00,0x69,0x6e,
274 0x64,0x65,0x78,0x2e,0x68,0x74,0x6d,0x6c,
275 0x00,0xff,0xff,0xad,0xde,0x00,0x00,0x00,
276 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
277 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
278 0x00,0x00,0x00,0x00,0x00,
281 /* url + target frame name */
282 static const unsigned char expected_hlink_data5
[] =
284 0x02,0x00,0x00,0x00,0x83,0x00,0x00,0x00,
285 0x07,0x00,0x00,0x00,0x74,0x00,0x67,0x00,
286 0x74,0x00,0x66,0x00,0x72,0x00,0x6d,0x00,
287 0x00,0x00,0xe0,0xc9,0xea,0x79,0xf9,0xba,
288 0xce,0x11,0x8c,0x82,0x00,0xaa,0x00,0x4b,
289 0xa9,0x0b,0x26,0x00,0x00,0x00,0x68,0x00,
290 0x74,0x00,0x74,0x00,0x70,0x00,0x3a,0x00,
291 0x2f,0x00,0x2f,0x00,0x77,0x00,0x69,0x00,
292 0x6e,0x00,0x65,0x00,0x68,0x00,0x71,0x00,
293 0x2e,0x00,0x6f,0x00,0x72,0x00,0x67,0x00,
297 /* url + target frame name (IE7) */
298 static const unsigned char expected_hlink_data5_ie7
[] =
300 0x02,0x00,0x00,0x00,0x83,0x00,0x00,0x00,
301 0x07,0x00,0x00,0x00,0x74,0x00,0x67,0x00,
302 0x74,0x00,0x66,0x00,0x72,0x00,0x6d,0x00,
303 0x00,0x00,0xe0,0xc9,0xea,0x79,0xf9,0xba,
304 0xce,0x11,0x8c,0x82,0x00,0xaa,0x00,0x4b,
305 0xa9,0x0b,0x3e,0x00,0x00,0x00,0x68,0x00,
306 0x74,0x00,0x74,0x00,0x70,0x00,0x3a,0x00,
307 0x2f,0x00,0x2f,0x00,0x77,0x00,0x69,0x00,
308 0x6e,0x00,0x65,0x00,0x68,0x00,0x71,0x00,
309 0x2e,0x00,0x6f,0x00,0x72,0x00,0x67,0x00,
310 0x2f,0x00,0x00,0x00,0x79,0x58,0x81,0xf4,
311 0x3b,0x1d,0x7f,0x48,0xaf,0x2c,0x82,0x5d,
312 0xc4,0x85,0x27,0x63,0x00,0x00,0x00,0x00,
317 static const unsigned char expected_hlink_data6
[] =
319 0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
320 0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
321 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
322 0x00,0x00,0x04,0x00,0x00,0x00,0x63,0x3a,
323 0x5c,0x00,0xff,0xff,0xad,0xde,0x00,0x00,
324 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
325 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
326 0x00,0x00,0x0c,0x00,0x00,0x00,0x06,0x00,
327 0x00,0x00,0x03,0x00,0x63,0x00,0x3a,0x00,
331 static void test_persist_save_data(const char *testname
, IHlink
*lnk
,
332 const unsigned char *expected_data
,
333 unsigned int expected_data_size
,
334 const unsigned char *expected_data_alt
,
335 unsigned int expected_data_alt_size
)
342 const unsigned char *data
;
345 unsigned int expected_data_win9x_size
= 0;
347 hr
= IHlink_QueryInterface(lnk
, &IID_IPersistStream
, (void **)&ps
);
348 ok(hr
== S_OK
, "IHlink_QueryInterface failed with error 0x%08x\n", hr
);
350 hr
= CreateStreamOnHGlobal(NULL
, TRUE
, &stream
);
351 ok(hr
== S_OK
, "CreateStreamOnHGlobal failed with error 0x%08x\n", hr
);
353 hr
= IPersistStream_Save(ps
, stream
, TRUE
);
354 ok(hr
== S_OK
, "IPersistStream_Save failed with error 0x%08x\n", hr
);
356 hr
= GetHGlobalFromStream(stream
, &hglobal
);
357 ok(hr
== S_OK
, "GetHGlobalFromStream failed with error 0x%08x\n", hr
);
359 data_size
= GlobalSize(hglobal
);
361 data
= GlobalLock(hglobal
);
363 if (expected_data_size
% 4)
364 expected_data_win9x_size
= 4 * ((expected_data_size
/ 4) + 1);
366 /* first check we have the right amount of data */
367 ok((data_size
== expected_data_size
) ||
368 (data_size
== expected_data_alt_size
) ||
369 broken(data_size
== expected_data_win9x_size
), /* Win9x and WinMe */
370 "%s: Size of saved data differs (expected %d or %d, actual %d)\n",
371 testname
, expected_data_size
, expected_data_alt_size
, data_size
);
374 /* then do a byte-by-byte comparison */
375 for (i
= 0; i
< min(data_size
, expected_data_size
); i
++)
377 if ((expected_data
[i
] != data
[i
]) &&
378 (((expected_data
!= expected_hlink_data2
) &&
379 (expected_data
!= expected_hlink_data3
)) ||
380 ((i
< 52 || i
>= 56) && (i
< 80 || i
>= 84))))
387 if (!same
&& (expected_data_alt
!= expected_data
))
389 /* then try the alternate data */
391 for (i
= 0; i
< min(data_size
, expected_data_alt_size
); i
++)
393 if ((expected_data_alt
[i
] != data
[i
]) &&
394 (((expected_data_alt
!= expected_hlink_data2
) &&
395 (expected_data_alt
!= expected_hlink_data3
)) ||
396 ((i
< 52 || i
>= 56) && (i
< 80 || i
>= 84))))
404 ok(same
, "%s: Saved data differs\n", testname
);
407 for (i
= 0; i
< data_size
; i
++)
409 if (i
% 8 == 0) printf(" ");
410 printf("0x%02x,", data
[i
]);
411 if (i
% 8 == 7) printf("\n");
416 GlobalUnlock(hglobal
);
418 IStream_Release(stream
);
419 IPersistStream_Release(ps
);
422 static void test_persist(void)
424 static const WCHAR url
[] = { 'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g',0 };
425 static const WCHAR rel_url
[] = { 'i','n','d','e','x','.','h','t','m','l',0 };
426 static const WCHAR filename
[] = { 'c',':','\\',0 };
427 static const WCHAR friendly_name
[] = { 'W','i','n','e',' ','H','Q',0 };
428 static const WCHAR location
[] = { '_','b','l','a','n','k',0 };
429 static const WCHAR target_frame_name
[] = { 't','g','t','f','r','m',0 };
433 hr
= HlinkCreateFromString(url
, NULL
, NULL
, NULL
,
434 0, NULL
, &IID_IHlink
, (LPVOID
*) &lnk
);
435 ok(hr
== S_OK
, "IHlinkCreateFromString failed with error 0x%08x\n", hr
);
437 skip("Can't create lnk, skipping test_persist. Was wineprefixcreate run properly?\n");
440 test_persist_save_data("url only", lnk
,
441 expected_hlink_data
, sizeof(expected_hlink_data
),
442 expected_hlink_data_ie7
, sizeof(expected_hlink_data_ie7
));
445 hr
= HlinkCreateFromString(url
, NULL
, friendly_name
, NULL
,
446 0, NULL
, &IID_IHlink
, (LPVOID
*) &lnk
);
447 ok(hr
== S_OK
, "IHlinCreateFromString failed with error 0x%08x\n", hr
);
448 test_persist_save_data("url + friendly name", lnk
,
449 expected_hlink_data2
, sizeof(expected_hlink_data2
),
450 expected_hlink_data2_ie7
, sizeof(expected_hlink_data2_ie7
));
453 hr
= HlinkCreateFromString(url
, location
, friendly_name
, NULL
,
454 0, NULL
, &IID_IHlink
, (LPVOID
*) &lnk
);
455 ok(hr
== S_OK
, "IHlinCreateFromString failed with error 0x%08x\n", hr
);
456 test_persist_save_data("url + friendly_name + location", lnk
,
457 expected_hlink_data3
, sizeof(expected_hlink_data3
),
458 expected_hlink_data3_ie7
, sizeof(expected_hlink_data3_ie7
));
461 hr
= HlinkCreateFromString(rel_url
, NULL
, NULL
, NULL
,
462 0, NULL
, &IID_IHlink
, (LPVOID
*) &lnk
);
463 ok(hr
== S_OK
, "IHlinCreateFromString failed with error 0x%08x\n", hr
);
464 test_persist_save_data("relative url", lnk
,
465 expected_hlink_data4
, sizeof(expected_hlink_data4
),
466 expected_hlink_data4
, sizeof(expected_hlink_data4
));
469 hr
= HlinkCreateFromString(url
, NULL
, NULL
, NULL
,
470 0, NULL
, &IID_IHlink
, (LPVOID
*) &lnk
);
471 ok(hr
== S_OK
, "IHlinCreateFromString failed with error 0x%08x\n", hr
);
472 hr
= IHlink_SetTargetFrameName(lnk
, target_frame_name
);
473 ok(hr
== S_OK
, "IHlink_SetTargetFrameName failed with error 0x%08x\n", hr
);
474 test_persist_save_data("url + target frame name", lnk
,
475 expected_hlink_data5
, sizeof(expected_hlink_data5
),
476 expected_hlink_data5_ie7
, sizeof(expected_hlink_data5_ie7
));
479 hr
= HlinkCreateFromString(filename
, NULL
, NULL
, NULL
,
480 0, NULL
, &IID_IHlink
, (LPVOID
*) &lnk
);
481 ok(hr
== S_OK
, "IHlinCreateFromString failed with error 0x%08x\n", hr
);
482 test_persist_save_data("filename", lnk
,
483 expected_hlink_data6
, sizeof(expected_hlink_data6
),
484 expected_hlink_data6
, sizeof(expected_hlink_data6
));
488 static void test_special_reference(void)
493 hres
= HlinkGetSpecialReference(HLSR_HOME
, &ref
);
494 ok(hres
== S_OK
, "HlinkGetSpecialReference(HLSR_HOME) failed: %08x\n", hres
);
495 ok(ref
!= NULL
, "ref == NULL\n");
498 hres
= HlinkGetSpecialReference(HLSR_SEARCHPAGE
, &ref
);
499 ok(hres
== S_OK
, "HlinkGetSpecialReference(HLSR_SEARCHPAGE) failed: %08x\n", hres
);
500 ok(ref
!= NULL
, "ref == NULL\n");
503 ref
= (void*)0xdeadbeef;
504 hres
= HlinkGetSpecialReference(HLSR_HISTORYFOLDER
, &ref
);
505 ok(hres
== E_NOTIMPL
, "HlinkGetSpecialReference(HLSR_HISTORYFOLDER) failed: %08x\n", hres
);
506 ok(ref
== NULL
, "ref=%p\n", ref
);
508 ref
= (void*)0xdeadbeef;
509 hres
= HlinkGetSpecialReference(4, &ref
);
510 ok(hres
== E_INVALIDARG
, "HlinkGetSpecialReference(HLSR_HISTORYFOLDER) failed: %08x\n", hres
);
511 ok(ref
== NULL
, "ref=%p\n", ref
);
514 static void test_HlinkCreateExtensionServices(void)
516 IAuthenticate
*authenticate
;
517 IHttpNegotiate
*http_negotiate
;
518 LPWSTR password
, username
, headers
;
522 static const WCHAR usernameW
[] = {'u','s','e','r',0};
523 static const WCHAR passwordW
[] = {'p','a','s','s',0};
524 static const WCHAR headersW
[] = {'h','e','a','d','e','r','s',0};
525 static const WCHAR headersexW
[] = {'h','e','a','d','e','r','s','\r','\n',0};
527 hres
= HlinkCreateExtensionServices(NULL
, NULL
, NULL
, NULL
,
528 NULL
, &IID_IAuthenticate
, (void**)&authenticate
);
529 ok(hres
== S_OK
, "HlinkCreateExtensionServices failed: %08x\n", hres
);
530 ok(authenticate
!= NULL
, "HlinkCreateExtensionServices returned NULL\n");
532 password
= username
= (void*)0xdeadbeef;
533 hwnd
= (void*)0xdeadbeef;
534 hres
= IAuthenticate_Authenticate(authenticate
, &hwnd
, &username
, &password
);
535 ok(hres
== S_OK
, "Authenticate failed: %08x\n", hres
);
536 ok(!hwnd
, "hwnd != NULL\n");
537 ok(!username
, "username != NULL\n");
538 ok(!password
, "password != NULL\n");
540 hres
= IAuthenticate_QueryInterface(authenticate
, &IID_IHttpNegotiate
, (void**)&http_negotiate
);
541 ok(hres
== S_OK
, "Could not get IHttpNegotiate interface: %08x\n", hres
);
543 headers
= (void*)0xdeadbeef;
544 hres
= IHttpNegotiate_BeginningTransaction(http_negotiate
, (void*)0xdeadbeef, (void*)0xdeadbeef,
546 ok(hres
== S_OK
, "BeginningTransaction failed: %08x\n", hres
);
547 ok(headers
== NULL
, "headers != NULL\n");
549 hres
= IHttpNegotiate_BeginningTransaction(http_negotiate
, (void*)0xdeadbeef, (void*)0xdeadbeef,
551 ok(hres
== E_INVALIDARG
, "BeginningTransaction failed: %08x, expected E_INVALIDARG\n", hres
);
553 headers
= (void*)0xdeadbeef;
554 hres
= IHttpNegotiate_OnResponse(http_negotiate
, 200, (void*)0xdeadbeef, (void*)0xdeadbeef, &headers
);
555 ok(hres
== S_OK
, "OnResponse failed: %08x\n", hres
);
556 ok(headers
== NULL
, "headers != NULL\n");
558 IHttpNegotiate_Release(http_negotiate
);
559 IAuthenticate_Release(authenticate
);
562 hres
= HlinkCreateExtensionServices(headersW
, (HWND
)0xfefefefe, usernameW
, passwordW
,
563 NULL
, &IID_IAuthenticate
, (void**)&authenticate
);
564 ok(hres
== S_OK
, "HlinkCreateExtensionServices failed: %08x\n", hres
);
565 ok(authenticate
!= NULL
, "HlinkCreateExtensionServices returned NULL\n");
567 password
= username
= NULL
;
569 hres
= IAuthenticate_Authenticate(authenticate
, &hwnd
, &username
, &password
);
570 ok(hres
== S_OK
, "Authenticate failed: %08x\n", hres
);
571 ok(hwnd
== (HWND
)0xfefefefe, "hwnd=%p\n", hwnd
);
572 ok(!lstrcmpW(username
, usernameW
), "unexpected username\n");
573 ok(!lstrcmpW(password
, passwordW
), "unexpected password\n");
574 CoTaskMemFree(username
);
575 CoTaskMemFree(password
);
577 password
= username
= (void*)0xdeadbeef;
578 hwnd
= (void*)0xdeadbeef;
579 hres
= IAuthenticate_Authenticate(authenticate
, &hwnd
, NULL
, &password
);
580 ok(hres
== E_INVALIDARG
, "Authenticate failed: %08x\n", hres
);
581 ok(password
== (void*)0xdeadbeef, "password = %p\n", password
);
582 ok(hwnd
== (void*)0xdeadbeef, "hwnd = %p\n", hwnd
);
584 hres
= IAuthenticate_QueryInterface(authenticate
, &IID_IHttpNegotiate
, (void**)&http_negotiate
);
585 ok(hres
== S_OK
, "Could not get IHttpNegotiate interface: %08x\n", hres
);
587 headers
= (void*)0xdeadbeef;
588 hres
= IHttpNegotiate_BeginningTransaction(http_negotiate
, (void*)0xdeadbeef, (void*)0xdeadbeef,
590 ok(hres
== S_OK
, "BeginningTransaction failed: %08x\n", hres
);
591 ok(!lstrcmpW(headers
, headersexW
), "unexpected headers %s\n", wine_dbgstr_w(headers
));
592 CoTaskMemFree(headers
);
594 headers
= (void*)0xdeadbeef;
595 hres
= IHttpNegotiate_OnResponse(http_negotiate
, 200, (void*)0xdeadbeef, (void*)0xdeadbeef, &headers
);
596 ok(hres
== S_OK
, "OnResponse failed: %08x\n", hres
);
597 ok(headers
== NULL
, "unexpected headers %s\n", wine_dbgstr_w(headers
));
599 IHttpNegotiate_Release(http_negotiate
);
600 IAuthenticate_Release(authenticate
);
603 static void test_HlinkParseDisplayName(void)
605 IMoniker
*mon
= NULL
;
612 static const WCHAR winehq_urlW
[] =
613 {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',
614 '/','s','i','t','e','/','a','b','o','u','t',0};
615 static const WCHAR invalid_urlW
[] = {'t','e','s','t',':','1','2','3','a','b','c',0};
616 static const WCHAR clsid_nameW
[] = {'c','l','s','i','d',':',
617 '2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','8',
618 '-','0','8','0','0','2','B','3','0','3','0','9','D',':',0};
620 CreateBindCtx(0, &bctx
);
622 hres
= HlinkParseDisplayName(bctx
, winehq_urlW
, FALSE
, &eaten
, &mon
);
623 ok(hres
== S_OK
, "HlinkParseDisplayName failed: %08x\n", hres
);
624 ok(eaten
== sizeof(winehq_urlW
)/sizeof(WCHAR
)-1, "eaten=%d\n", eaten
);
625 ok(mon
!= NULL
, "mon == NULL\n");
627 hres
= IMoniker_GetDisplayName(mon
, bctx
, 0, &name
);
628 ok(hres
== S_OK
, "GetDiasplayName failed: %08x\n", hres
);
629 ok(!lstrcmpW(name
, winehq_urlW
), "wrong display name %s\n", wine_dbgstr_w(name
));
632 hres
= IMoniker_IsSystemMoniker(mon
, &issys
);
633 ok(hres
== S_OK
, "IsSystemMoniker failed: %08x\n", hres
);
634 ok(issys
== MKSYS_URLMONIKER
, "issys=%x\n", issys
);
636 IMoniker_Release(mon
);
638 hres
= HlinkParseDisplayName(bctx
, clsid_nameW
, FALSE
, &eaten
, &mon
);
639 ok(hres
== S_OK
, "HlinkParseDisplayName failed: %08x\n", hres
);
640 ok(eaten
== sizeof(clsid_nameW
)/sizeof(WCHAR
)-1, "eaten=%d\n", eaten
);
641 ok(mon
!= NULL
, "mon == NULL\n");
643 hres
= IMoniker_IsSystemMoniker(mon
, &issys
);
644 ok(hres
== S_OK
, "IsSystemMoniker failed: %08x\n", hres
);
645 ok(issys
== MKSYS_CLASSMONIKER
, "issys=%x\n", issys
);
647 IMoniker_Release(mon
);
649 hres
= HlinkParseDisplayName(bctx
, invalid_urlW
, FALSE
, &eaten
, &mon
);
650 ok(hres
== S_OK
, "HlinkParseDisplayName failed: %08x\n", hres
);
651 ok(eaten
== sizeof(invalid_urlW
)/sizeof(WCHAR
)-1, "eaten=%d\n", eaten
);
652 ok(mon
!= NULL
, "mon == NULL\n");
654 hres
= IMoniker_GetDisplayName(mon
, bctx
, 0, &name
);
655 ok(hres
== S_OK
, "GetDiasplayName failed: %08x\n", hres
);
656 ok(!lstrcmpW(name
, invalid_urlW
), "wrong display name %s\n", wine_dbgstr_w(name
));
659 hres
= IMoniker_IsSystemMoniker(mon
, &issys
);
660 ok(hres
== S_OK
, "IsSystemMoniker failed: %08x\n", hres
);
661 ok(issys
== MKSYS_FILEMONIKER
, "issys=%x\n", issys
);
663 IBindCtx_Release(bctx
);
666 static IBindCtx
*_bctx
;
668 static HRESULT WINAPI
ServiceProvider_QueryInterface(IServiceProvider
*iface
, REFIID riid
, void **ppv
)
670 ok(0, "unexpected call\n");
671 return E_NOINTERFACE
;
674 static ULONG WINAPI
ServiceProvider_AddRef(IServiceProvider
*iface
)
679 static ULONG WINAPI
ServiceProvider_Release(IServiceProvider
*iface
)
684 static HRESULT WINAPI
ServiceProvider_QueryService(IServiceProvider
*iface
,
685 REFGUID guidService
, REFIID riid
, void **ppv
)
687 ok(0, "unexpected service %s\n", debugstr_guid(guidService
));
688 return E_NOINTERFACE
;
691 static IServiceProviderVtbl ServiceProviderVtbl
= {
692 ServiceProvider_QueryInterface
,
693 ServiceProvider_AddRef
,
694 ServiceProvider_Release
,
695 ServiceProvider_QueryService
698 static IServiceProvider ServiceProvider
= { &ServiceProviderVtbl
};
700 static HRESULT WINAPI
BindStatusCallback_QueryInterface(IBindStatusCallback
*iface
, REFIID riid
, void **ppv
)
704 if(IsEqualGUID(riid
, &IID_IServiceProvider
)) {
705 *ppv
= &ServiceProvider
;
709 ok(0, "unexpected interface %s\n", debugstr_guid(riid
));
710 return E_NOINTERFACE
;
713 static ULONG WINAPI
BindStatusCallback_AddRef(IBindStatusCallback
*iface
)
718 static ULONG WINAPI
BindStatusCallback_Release(IBindStatusCallback
*iface
)
723 static HRESULT WINAPI
BindStatusCallback_OnStartBinding(IBindStatusCallback
*iface
, DWORD dwReserved
,
726 ok(0, "unexpected call\n");
730 static HRESULT WINAPI
BindStatusCallback_GetPriority(IBindStatusCallback
*iface
, LONG
*pnPriority
)
732 ok(0, "unexpected call\n");
736 static HRESULT WINAPI
BindStatusCallback_OnLowResource(IBindStatusCallback
*iface
, DWORD reserved
)
738 ok(0, "unexpected call\n");
742 static HRESULT WINAPI
BindStatusCallback_OnProgress(IBindStatusCallback
*iface
, ULONG ulProgress
,
743 ULONG ulProgressMax
, ULONG ulStatusCode
, LPCWSTR szStatusText
)
745 ok(0, "unexpected call\n");
749 static HRESULT WINAPI
BindStatusCallback_OnStopBinding(IBindStatusCallback
*iface
, HRESULT hresult
, LPCWSTR szError
)
751 ok(0, "unexpected call\n");
755 static HRESULT WINAPI
BindStatusCallback_GetBindInfo(IBindStatusCallback
*iface
, DWORD
*grfBINDF
, BINDINFO
*pbindinfo
)
757 ok(0, "unexpected call\n");
761 static HRESULT WINAPI
BindStatusCallback_OnDataAvailable(IBindStatusCallback
*iface
, DWORD grfBSCF
,
762 DWORD dwSize
, FORMATETC
* pformatetc
, STGMEDIUM
* pstgmed
)
764 ok(0, "unexpected call\n");
768 static HRESULT WINAPI
BindStatusCallback_OnObjectAvailable(IBindStatusCallback
*iface
, REFIID riid
, IUnknown
*punk
)
770 ok(0, "unexpected call\n");
774 static IBindStatusCallbackVtbl BindStatusCallbackVtbl
= {
775 BindStatusCallback_QueryInterface
,
776 BindStatusCallback_AddRef
,
777 BindStatusCallback_Release
,
778 BindStatusCallback_OnStartBinding
,
779 BindStatusCallback_GetPriority
,
780 BindStatusCallback_OnLowResource
,
781 BindStatusCallback_OnProgress
,
782 BindStatusCallback_OnStopBinding
,
783 BindStatusCallback_GetBindInfo
,
784 BindStatusCallback_OnDataAvailable
,
785 BindStatusCallback_OnObjectAvailable
788 static IBindStatusCallback BindStatusCallback
= { &BindStatusCallbackVtbl
};
790 static HRESULT WINAPI
Moniker_QueryInterface(IMoniker
*iface
, REFIID riid
, void **ppv
)
794 ok(0, "unexpected riid: %s\n", debugstr_guid(riid
));
795 return E_NOINTERFACE
;
798 static ULONG WINAPI
Moniker_AddRef(IMoniker
*iface
)
803 static ULONG WINAPI
Moniker_Release(IMoniker
*iface
)
808 static HRESULT WINAPI
Moniker_GetClassID(IMoniker
*iface
, CLSID
*pClassID
)
810 ok(0, "unexpected call\n");
814 static HRESULT WINAPI
Moniker_IsDirty(IMoniker
*iface
)
816 ok(0, "unexpected call\n");
820 static HRESULT WINAPI
Moniker_Load(IMoniker
*iface
, IStream
*pStm
)
822 ok(0, "unexpected call\n");
826 static HRESULT WINAPI
Moniker_Save(IMoniker
*iface
, IStream
*pStm
, BOOL fClearDirty
)
828 ok(0, "unexpected call\n");
832 static HRESULT WINAPI
Moniker_GetSizeMax(IMoniker
*iface
, ULARGE_INTEGER
*pcbSize
)
834 ok(0, "unexpected call\n");
838 static HRESULT WINAPI
Moniker_BindToObject(IMoniker
*iface
, IBindCtx
*pcb
, IMoniker
*pmkToLeft
,
839 REFIID riidResult
, void **ppvResult
)
841 ok(0, "unexpected call\n");
845 static HRESULT WINAPI
Moniker_BindToStorage(IMoniker
*iface
, IBindCtx
*pbc
, IMoniker
*pmkToLeft
,
846 REFIID riid
, void **ppv
)
851 static OLECHAR BSCBHolder
[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 };
853 CHECK_EXPECT(BindToStorage
);
855 ok(pbc
== _bctx
, "pbc != _bctx\n");
856 ok(pmkToLeft
== NULL
, "pmkToLeft=%p\n", pmkToLeft
);
857 ok(IsEqualGUID(&IID_IUnknown
, riid
), "unexpected riid %s\n", debugstr_guid(riid
));
858 ok(ppv
!= NULL
, "ppv == NULL\n");
859 ok(*ppv
== NULL
, "*ppv=%p\n", *ppv
);
861 hres
= IBindCtx_GetObjectParam(pbc
, BSCBHolder
, &unk
);
862 ok(hres
== S_OK
, "GetObjectParam failed: %08x\n", hres
);
863 ok(unk
!= NULL
, "unk == NULL\n");
865 IUnknown_Release(unk
);
870 static HRESULT WINAPI
Moniker_Reduce(IMoniker
*iface
, IBindCtx
*pbc
, DWORD dwReduceHowFar
,
871 IMoniker
**ppmkToLeft
, IMoniker
**ppmkReduced
)
873 ok(0, "unexpected call\n");
877 static HRESULT WINAPI
Moniker_ComposeWith(IMoniker
*iface
, IMoniker
*pmkRight
,
878 BOOL fOnlyIfNotGeneric
, IMoniker
**ppnkComposite
)
880 ok(0, "unexpected call\n");
884 static HRESULT WINAPI
Moniker_Enum(IMoniker
*iface
, BOOL fForwrd
, IEnumMoniker
**ppenumMoniker
)
886 ok(0, "unexpected call\n");
890 static HRESULT WINAPI
Moniker_IsEqual(IMoniker
*iface
, IMoniker
*pmkOtherMoniker
)
892 ok(0, "unexpected call\n");
896 static HRESULT WINAPI
Moniker_Hash(IMoniker
*iface
, DWORD
*pdwHash
)
898 ok(0, "unexpected call\n");
902 static HRESULT WINAPI
Moniker_IsRunning(IMoniker
*iface
, IBindCtx
*pbc
, IMoniker
*pmkToLeft
,
903 IMoniker
*pmkNewlyRunning
)
905 ok(0, "unexpected call\n");
909 static HRESULT WINAPI
Moniker_GetTimeOfLastChange(IMoniker
*iface
, IBindCtx
*pbc
,
910 IMoniker
*pmkToLeft
, FILETIME
*pFileTime
)
912 ok(0, "unexpected call\n");
916 static HRESULT WINAPI
Moniker_Inverse(IMoniker
*iface
, IMoniker
**ppmk
)
918 ok(0, "unexpected call\n");
922 static HRESULT WINAPI
Moniker_CommonPrefixWith(IMoniker
*iface
, IMoniker
*pmkOther
,
923 IMoniker
**ppmkPrefix
)
925 ok(0, "unexpected call\n");
929 static HRESULT WINAPI
Moniker_RelativePathTo(IMoniker
*iface
, IMoniker
*pmkOther
,
930 IMoniker
**pmkRelPath
)
932 ok(0, "unexpected call\n");
936 static HRESULT WINAPI
Moniker_GetDisplayName(IMoniker
*iface
, IBindCtx
*pbc
,
937 IMoniker
*pmkToLeft
, LPOLESTR
*ppszDisplayName
)
939 static const WCHAR winehq_urlW
[] =
940 {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',
941 '/','s','i','t','e','/','a','b','o','u','t',0};
943 CHECK_EXPECT(GetDisplayName
);
945 ok(pbc
!= NULL
, "pbc == NULL\n");
946 ok(pbc
!= _bctx
, "pbc == _bctx\n");
947 ok(pmkToLeft
== NULL
, "pmkToLeft=%p\n", pmkToLeft
);
949 *ppszDisplayName
= CoTaskMemAlloc(sizeof(winehq_urlW
));
950 memcpy(*ppszDisplayName
, winehq_urlW
, sizeof(winehq_urlW
));
954 static HRESULT WINAPI
Moniker_ParseDisplayName(IMoniker
*iface
, IBindCtx
*pbc
,
955 IMoniker
*pmkToLeft
, LPOLESTR pszDisplayName
, ULONG
*pchEaten
, IMoniker
**ppmkOut
)
957 ok(0, "unexpected call\n");
961 static HRESULT WINAPI
Moniker_IsSystemMoniker(IMoniker
*iface
, DWORD
*pdwMksys
)
963 CHECK_EXPECT2(IsSystemMoniker
);
965 *pdwMksys
= MKSYS_URLMONIKER
;
969 static IMonikerVtbl MonikerVtbl
= {
970 Moniker_QueryInterface
,
978 Moniker_BindToObject
,
979 Moniker_BindToStorage
,
986 Moniker_GetTimeOfLastChange
,
988 Moniker_CommonPrefixWith
,
989 Moniker_RelativePathTo
,
990 Moniker_GetDisplayName
,
991 Moniker_ParseDisplayName
,
992 Moniker_IsSystemMoniker
995 static IMoniker Moniker
= { &MonikerVtbl
};
997 static void test_HlinkResolveMonikerForData(void)
1002 CreateBindCtx(0, &bctx
);
1005 SET_EXPECT(IsSystemMoniker
);
1006 SET_EXPECT(GetDisplayName
);
1007 SET_EXPECT(BindToStorage
);
1009 hres
= HlinkResolveMonikerForData(&Moniker
, 0, bctx
, 0, NULL
, &BindStatusCallback
, NULL
);
1010 ok(hres
== S_OK
, "HlinkResolveMonikerForData failed: %08x\n", hres
);
1012 CHECK_CALLED(IsSystemMoniker
);
1013 CHECK_CALLED(GetDisplayName
);
1014 CHECK_CALLED(BindToStorage
);
1016 IBindCtx_Release(bctx
);
1019 static void test_HlinkGetSetMonikerReference(void)
1021 IMoniker
*found_trgt
, *dummy
, *dummy2
;
1024 const WCHAR one
[] = {'1',0};
1025 const WCHAR two
[] = {'2',0};
1026 const WCHAR name
[] = {'a',0};
1029 /* create two dummy monikers to use as targets */
1030 hres
= CreateItemMoniker(one
, one
, &dummy
);
1031 ok(hres
== S_OK
, "CreateItemMoniker failed: 0x%08x\n", hres
);
1033 hres
= CreateItemMoniker(two
, two
, &dummy2
);
1034 ok(hres
== S_OK
, "CreateItemMoniker failed: 0x%08x\n", hres
);
1036 /* create a new hlink: target => dummy, location => one */
1037 hres
= HlinkCreateFromMoniker(dummy
, one
, name
, NULL
, 0, NULL
, &IID_IHlink
, (void**)&hlink
);
1038 ok(hres
== S_OK
, "HlinkCreateFromMoniker failed: 0x%08x\n", hres
);
1040 /* validate the target and location */
1041 hres
= IHlink_GetMonikerReference(hlink
, HLINKGETREF_DEFAULT
, &found_trgt
, &found_loc
);
1042 ok(hres
== S_OK
, "IHlink_GetMonikerReference failed: 0x%08x\n", hres
);
1043 ok(found_trgt
== dummy
, "Found target should've been %p, was: %p\n", dummy
, found_trgt
);
1044 ok(lstrcmpW(found_loc
, one
) == 0, "Found location should've been %s, was: %s\n", wine_dbgstr_w(one
), wine_dbgstr_w(found_loc
));
1045 IMoniker_Release(found_trgt
);
1047 /* set location => two */
1048 hres
= IHlink_SetMonikerReference(hlink
, HLINKSETF_LOCATION
, dummy2
, two
);
1049 ok(hres
== S_OK
, "IHlink_SetMonikerReference failed: 0x%08x\n", hres
);
1051 hres
= IHlink_GetMonikerReference(hlink
, HLINKGETREF_DEFAULT
, &found_trgt
, &found_loc
);
1052 ok(found_trgt
== dummy
, "Found target should've been %p, was: %p\n", dummy
, found_trgt
);
1053 ok(lstrcmpW(found_loc
, two
) == 0, "Found location should've been %s, was: %s\n", wine_dbgstr_w(two
), wine_dbgstr_w(found_loc
));
1054 IMoniker_Release(found_trgt
);
1056 /* set target => dummy2 */
1057 hres
= IHlink_SetMonikerReference(hlink
, HLINKSETF_TARGET
, dummy2
, one
);
1058 ok(hres
== S_OK
, "IHlink_SetMonikerReference failed: 0x%08x\n", hres
);
1060 hres
= IHlink_GetMonikerReference(hlink
, HLINKGETREF_DEFAULT
, &found_trgt
, &found_loc
);
1061 ok(found_trgt
== dummy2
, "Found target should've been %p, was: %p\n", dummy2
, found_trgt
);
1062 ok(lstrcmpW(found_loc
, two
) == 0, "Found location should've been %s, was: %s\n", wine_dbgstr_w(two
), wine_dbgstr_w(found_loc
));
1063 IMoniker_Release(found_trgt
);
1065 /* set target => dummy, location => one */
1066 hres
= IHlink_SetMonikerReference(hlink
, HLINKSETF_TARGET
| HLINKSETF_LOCATION
, dummy
, one
);
1067 ok(hres
== S_OK
, "IHlink_SetMonikerReference failed: 0x%08x\n", hres
);
1069 hres
= IHlink_GetMonikerReference(hlink
, HLINKGETREF_DEFAULT
, &found_trgt
, &found_loc
);
1070 ok(found_trgt
== dummy
, "Found target should've been %p, was: %p\n", dummy
, found_trgt
);
1071 ok(lstrcmpW(found_loc
, one
) == 0, "Found location should've been %s, was: %s\n", wine_dbgstr_w(one
), wine_dbgstr_w(found_loc
));
1072 IMoniker_Release(found_trgt
);
1074 /* no HLINKSETF flags */
1075 hres
= IHlink_SetMonikerReference(hlink
, 0, dummy2
, two
);
1076 ok(hres
== E_INVALIDARG
, "IHlink_SetMonikerReference should've failed with E_INVALIDARG (0x%08x), failed with 0x%08x\n", E_INVALIDARG
, hres
);
1078 hres
= IHlink_GetMonikerReference(hlink
, HLINKGETREF_DEFAULT
, &found_trgt
, &found_loc
);
1079 ok(found_trgt
== dummy
, "Found target should've been %p, was: %p\n", dummy
, found_trgt
);
1080 ok(lstrcmpW(found_loc
, one
) == 0, "Found location should've been %s, was: %s\n", wine_dbgstr_w(one
), wine_dbgstr_w(found_loc
));
1081 IMoniker_Release(found_trgt
);
1083 /* invalid HLINKSETF flags */
1084 hres
= IHlink_SetMonikerReference(hlink
, 12, dummy2
, two
);
1085 ok(hres
== 12, "IHlink_SetMonikerReference should've failed with 0x%08x, failed with 0x%08x\n", 12, hres
);
1087 hres
= IHlink_GetMonikerReference(hlink
, HLINKGETREF_DEFAULT
, &found_trgt
, &found_loc
);
1088 ok(found_trgt
== dummy
, "Found target should've been %p, was: %p\n", dummy
, found_trgt
);
1089 ok(lstrcmpW(found_loc
, one
) == 0, "Found location should've been %s, was: %s\n", wine_dbgstr_w(one
), wine_dbgstr_w(found_loc
));
1090 IMoniker_Release(found_trgt
);
1092 /* valid & invalid HLINKSETF flags */
1093 hres
= IHlink_SetMonikerReference(hlink
, 12 | HLINKSETF_TARGET
, dummy2
, two
);
1094 ok(hres
== S_OK
, "IHlink_SetMonikerReference failed: 0x%08x\n", hres
);
1096 hres
= IHlink_GetMonikerReference(hlink
, HLINKGETREF_DEFAULT
, &found_trgt
, &found_loc
);
1097 ok(found_trgt
== dummy2
, "Found target should've been %p, was: %p\n", dummy2
, found_trgt
);
1098 ok(lstrcmpW(found_loc
, one
) == 0, "Found location should've been %s, was: %s\n", wine_dbgstr_w(one
), wine_dbgstr_w(found_loc
));
1099 IMoniker_Release(found_trgt
);
1102 hres
= IHlink_SetMonikerReference(hlink
, HLINKSETF_TARGET
| HLINKSETF_LOCATION
, NULL
, NULL
);
1103 ok(hres
== S_OK
, "IHlink_SetMonikerReference failed: 0x%08x\n", hres
);
1105 hres
= IHlink_GetMonikerReference(hlink
, HLINKGETREF_DEFAULT
, &found_trgt
, &found_loc
);
1106 ok(found_trgt
== NULL
, "Found target should've been %p, was: %p\n", NULL
, found_trgt
);
1107 ok(found_loc
== NULL
, "Found location should've been %s, was: %s\n", wine_dbgstr_w(NULL
), wine_dbgstr_w(found_loc
));
1109 IMoniker_Release(found_trgt
);
1111 IHlink_Release(hlink
);
1112 IMoniker_Release(dummy2
);
1113 IMoniker_Release(dummy
);
1120 test_HlinkIsShortcut();
1123 test_special_reference();
1124 test_HlinkCreateExtensionServices();
1125 test_HlinkParseDisplayName();
1126 test_HlinkResolveMonikerForData();
1127 test_HlinkGetSetMonikerReference();