hlink: Added HlinkIsShortcut implementation.

This commit is contained in:
Jacek Caban 2006-08-02 21:29:58 +02:00 committed by Alexandre Julliard
parent 3cf1e46d95
commit 506e09308a
4 changed files with 59 additions and 1 deletions

View File

@ -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

View File

@ -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,
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)
{ {

View File

@ -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)
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();
} }

View File

@ -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