Jacek Caban : hlink: Added HlinkIsShortcut implementation.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Aug 2 15:21:44 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: 506e09308ace691f5fdbab4619e67ca0349bc66b
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=506e09308ace691f5fdbab4619e67ca0349bc66b
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Aug 2 21:29:58 2006 +0200
hlink: Added HlinkIsShortcut implementation.
---
dlls/hlink/hlink.spec | 2 +-
dlls/hlink/hlink_main.c | 19 +++++++++++++++++++
dlls/hlink/tests/hlink.c | 38 ++++++++++++++++++++++++++++++++++++++
include/hlink.idl | 1 +
4 files changed, 59 insertions(+), 1 deletions(-)
diff --git a/dlls/hlink/hlink.spec b/dlls/hlink/hlink.spec
index 0d9a2c9..c0386b5 100644
--- a/dlls/hlink/hlink.spec
+++ b/dlls/hlink/hlink.spec
@@ -17,7 +17,7 @@
22 stub HlinkGetSpecialReference
23 stub HlinkCreateShortcut
24 stub HlinkResolveShortcut
-25 stub HlinkIsShortcut
+25 stdcall HlinkIsShortcut(wstr)
26 stub HlinkResolveShortcutToString
27 stub HlinkCreateShortcutFromString
28 stub HlinkGetValueFromParams
diff --git a/dlls/hlink/hlink_main.c b/dlls/hlink/hlink_main.c
index dfa4464..bd1ed6e 100644
--- a/dlls/hlink/hlink_main.c
+++ b/dlls/hlink/hlink_main.c
@@ -31,6 +31,7 @@ #include "ole2.h"
#include "unknwn.h"
#include "wine/debug.h"
+#include "wine/unicode.h"
#include "hlink.h"
#include "initguid.h"
@@ -254,6 +255,24 @@ HRESULT WINAPI HlinkNavigateToStringRefe
return r;
}
+HRESULT WINAPI HlinkIsShortcut(LPCWSTR pwzFileName)
+{
+ int len;
+
+ static const WCHAR url_ext[] = {'.','u','r','l',0};
+
+ TRACE("(%s)\n", debugstr_w(pwzFileName));
+
+ if(!pwzFileName)
+ return E_INVALIDARG;
+
+ len = strlenW(pwzFileName)-4;
+ if(len < 0)
+ return S_FALSE;
+
+ return strcmpiW(pwzFileName+len, url_ext) ? S_FALSE : S_OK;
+}
+
static HRESULT WINAPI HLinkCF_fnQueryInterface ( LPCLASSFACTORY iface,
REFIID riid, LPVOID *ppvObj)
{
diff --git a/dlls/hlink/tests/hlink.c b/dlls/hlink/tests/hlink.c
index 47bf80f..e44a799 100644
--- a/dlls/hlink/tests/hlink.c
+++ b/dlls/hlink/tests/hlink.c
@@ -25,6 +25,42 @@ #include <hlguids.h>
#include "wine/test.h"
+static void test_HlinkIsShortcut(void)
+{
+ int i;
+ HRESULT hres;
+
+ static const WCHAR file0[] = {'f','i','l','e',0};
+ static const WCHAR file1[] = {'f','i','l','e','.','u','r','l',0};
+ static const WCHAR file2[] = {'f','i','l','e','.','l','n','k',0};
+ static const WCHAR file3[] = {'f','i','l','e','.','u','R','l',0};
+ static const WCHAR file4[] = {'f','i','l','e','u','r','l',0};
+ static const WCHAR file5[] = {'c',':','\\','f','i','l','e','.','u','r','l',0};
+ static const WCHAR file6[] = {'c',':','\\','f','i','l','e','.','l','n','k',0};
+ static const WCHAR file7[] = {'.','u','r','l',0};
+
+ static struct {
+ LPCWSTR file;
+ HRESULT hres;
+ } shortcut_test[] = {
+ {file0, S_FALSE},
+ {file1, S_OK},
+ {file2, S_FALSE},
+ {file3, S_OK},
+ {file4, S_FALSE},
+ {file5, S_OK},
+ {file6, S_FALSE},
+ {file7, S_OK},
+ {NULL, E_INVALIDARG}
+ };
+
+ for(i=0; i<sizeof(shortcut_test)/sizeof(shortcut_test[0]); i++) {
+ hres = HlinkIsShortcut(shortcut_test[i].file);
+ ok(hres == shortcut_test[i].hres, "[%d] HlinkIsShortcut returned %08lx, expected %08lx\n",
+ i, hres, shortcut_test[i].hres);
+ }
+}
+
START_TEST(hlink)
{
HRESULT r;
@@ -69,4 +105,6 @@ START_TEST(hlink)
r = IHlink_GetStringReference(lnk, HLINKGETREF_DEFAULT, NULL, &str);
ok(r == S_OK, "failed\n");
ok(str == NULL, "string should be null\n");
+
+ test_HlinkIsShortcut();
}
diff --git a/include/hlink.idl b/include/hlink.idl
index b737e9c..23873eb 100644
--- a/include/hlink.idl
+++ b/include/hlink.idl
@@ -32,6 +32,7 @@ cpp_quote("HRESULT WINAPI HlinkCreateBro
cpp_quote("HRESULT WINAPI HlinkNavigateToStringReference(LPCWSTR, LPCWSTR, IHlinkSite*, DWORD, IHlinkFrame*, DWORD, LPBC, IBindStatusCallback*, IHlinkBrowseContext*);")
cpp_quote("HRESULT WINAPI HlinkNavigate(IHlink*, IHlinkFrame*, DWORD, LPBC, IBindStatusCallback*, IHlinkBrowseContext*);")
cpp_quote("HRESULT WINAPI HlinkOnNavigate(IHlinkFrame*, IHlinkBrowseContext*, DWORD, IMoniker*, LPCWSTR, LPCWSTR, ULONG*);")
+cpp_quote("HRESULT WINAPI HlinkIsShortcut(LPCWSTR);")
/*****************************************************************************
* IHlink interface
More information about the wine-cvs
mailing list