Commit 506e0930 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

hlink: Added HlinkIsShortcut implementation.

parent 3cf1e46d
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
22 stub HlinkGetSpecialReference 22 stub HlinkGetSpecialReference
23 stub HlinkCreateShortcut 23 stub HlinkCreateShortcut
24 stub HlinkResolveShortcut 24 stub HlinkResolveShortcut
25 stub HlinkIsShortcut 25 stdcall HlinkIsShortcut(wstr)
26 stub HlinkResolveShortcutToString 26 stub HlinkResolveShortcutToString
27 stub HlinkCreateShortcutFromString 27 stub HlinkCreateShortcutFromString
28 stub HlinkGetValueFromParams 28 stub HlinkGetValueFromParams
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "unknwn.h" #include "unknwn.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
#include "hlink.h" #include "hlink.h"
#include "initguid.h" #include "initguid.h"
...@@ -254,6 +255,24 @@ HRESULT WINAPI HlinkNavigateToStringReference( LPCWSTR pwzTarget, ...@@ -254,6 +255,24 @@ HRESULT WINAPI HlinkNavigateToStringReference( LPCWSTR pwzTarget,
return r; 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, static HRESULT WINAPI HLinkCF_fnQueryInterface ( LPCLASSFACTORY iface,
REFIID riid, LPVOID *ppvObj) REFIID riid, LPVOID *ppvObj)
{ {
......
...@@ -25,6 +25,42 @@ ...@@ -25,6 +25,42 @@
#include "wine/test.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) START_TEST(hlink)
{ {
HRESULT r; HRESULT r;
...@@ -69,4 +105,6 @@ START_TEST(hlink) ...@@ -69,4 +105,6 @@ START_TEST(hlink)
r = IHlink_GetStringReference(lnk, HLINKGETREF_DEFAULT, NULL, &str); r = IHlink_GetStringReference(lnk, HLINKGETREF_DEFAULT, NULL, &str);
ok(r == S_OK, "failed\n"); ok(r == S_OK, "failed\n");
ok(str == NULL, "string should be null\n"); ok(str == NULL, "string should be null\n");
test_HlinkIsShortcut();
} }
...@@ -32,6 +32,7 @@ cpp_quote("HRESULT WINAPI HlinkCreateBrowseContext(IUnknown*, REFIID, void **);" ...@@ -32,6 +32,7 @@ cpp_quote("HRESULT WINAPI HlinkCreateBrowseContext(IUnknown*, REFIID, void **);"
cpp_quote("HRESULT WINAPI HlinkNavigateToStringReference(LPCWSTR, LPCWSTR, IHlinkSite*, DWORD, IHlinkFrame*, DWORD, LPBC, IBindStatusCallback*, IHlinkBrowseContext*);") 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 HlinkNavigate(IHlink*, IHlinkFrame*, DWORD, LPBC, IBindStatusCallback*, IHlinkBrowseContext*);")
cpp_quote("HRESULT WINAPI HlinkOnNavigate(IHlinkFrame*, IHlinkBrowseContext*, DWORD, IMoniker*, LPCWSTR, LPCWSTR, ULONG*);") cpp_quote("HRESULT WINAPI HlinkOnNavigate(IHlinkFrame*, IHlinkBrowseContext*, DWORD, IMoniker*, LPCWSTR, LPCWSTR, ULONG*);")
cpp_quote("HRESULT WINAPI HlinkIsShortcut(LPCWSTR);")
/***************************************************************************** /*****************************************************************************
* IHlink interface * IHlink interface
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment