2 * Implementation of hyperlinking (hlink.dll)
4 * Copyright 2006 Mike McCormack
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #include "wine/test.h"
28 static void test_HlinkIsShortcut(void)
33 static const WCHAR file0
[] = {'f','i','l','e',0};
34 static const WCHAR file1
[] = {'f','i','l','e','.','u','r','l',0};
35 static const WCHAR file2
[] = {'f','i','l','e','.','l','n','k',0};
36 static const WCHAR file3
[] = {'f','i','l','e','.','u','R','l',0};
37 static const WCHAR file4
[] = {'f','i','l','e','u','r','l',0};
38 static const WCHAR file5
[] = {'c',':','\\','f','i','l','e','.','u','r','l',0};
39 static const WCHAR file6
[] = {'c',':','\\','f','i','l','e','.','l','n','k',0};
40 static const WCHAR file7
[] = {'.','u','r','l',0};
57 for(i
=0; i
<sizeof(shortcut_test
)/sizeof(shortcut_test
[0]); i
++) {
58 hres
= HlinkIsShortcut(shortcut_test
[i
].file
);
59 ok(hres
== shortcut_test
[i
].hres
, "[%d] HlinkIsShortcut returned %08lx, expected %08lx\n",
60 i
, hres
, shortcut_test
[i
].hres
);
69 const WCHAR url
[] = { 'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g',0 };
70 const WCHAR url2
[] = { 'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g','/',0 };
75 r
= HlinkCreateFromString(url
, NULL
, NULL
, NULL
,
76 0, NULL
, &IID_IHlink
, (LPVOID
*) &lnk
);
77 ok(r
== S_OK
, "failed to create link\n");
81 r
= IHlink_GetMonikerReference(lnk
, HLINKGETREF_DEFAULT
, NULL
, NULL
);
82 ok(r
== S_OK
, "failed\n");
84 r
= IHlink_GetMonikerReference(lnk
, HLINKGETREF_DEFAULT
, &mk
, &str
);
85 ok(r
== S_OK
, "failed\n");
86 ok(mk
!= NULL
, "no moniker\n");
87 ok(str
== NULL
, "string should be null\n");
89 r
= IMoniker_Release(mk
);
90 ok( r
== 1, "moniker refcount wrong\n");
92 r
= IHlink_GetStringReference(lnk
, -1, &str
, NULL
);
93 ok(r
== S_OK
, "failed\n");
95 r
= IHlink_GetStringReference(lnk
, HLINKGETREF_DEFAULT
, &str
, NULL
);
96 ok(r
== S_OK
, "failed\n");
98 ok(!lstrcmpW(str
, url2
), "url wrong\n");
102 r
= IHlink_GetStringReference(lnk
, HLINKGETREF_DEFAULT
, NULL
, NULL
);
103 ok(r
== S_OK
, "failed\n");
105 r
= IHlink_GetStringReference(lnk
, HLINKGETREF_DEFAULT
, NULL
, &str
);
106 ok(r
== S_OK
, "failed\n");
107 ok(str
== NULL
, "string should be null\n");
109 test_HlinkIsShortcut();