Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
ad886d66
Commit
ad886d66
authored
Aug 03, 2008
by
Damjan Jovanovic
Committed by
Alexandre Julliard
Aug 04, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shdocvw: Rudimentary implementation of CLSID_InternetShortcut.
parent
da0604be
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
263 additions
and
0 deletions
+263
-0
Makefile.in
dlls/shdocvw/Makefile.in
+1
-0
factory.c
dlls/shdocvw/factory.c
+4
-0
intshcut.c
dlls/shdocvw/intshcut.c
+0
-0
shdocvw.h
dlls/shdocvw/shdocvw.h
+32
-0
Makefile.in
dlls/shdocvw/tests/Makefile.in
+1
-0
intshcut.c
dlls/shdocvw/tests/intshcut.c
+225
-0
No files found.
dlls/shdocvw/Makefile.in
View file @
ad886d66
...
...
@@ -17,6 +17,7 @@ C_SRCS = \
frame.c
\
ie.c
\
iexplore.c
\
intshcut.c
\
navigate.c
\
oleobject.c
\
persist.c
\
...
...
dlls/shdocvw/factory.c
View file @
ad886d66
...
...
@@ -134,6 +134,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
static
IClassFactoryImpl
WB1ClassFactory
=
{
&
WBCF_Vtbl
,
WebBrowserV1_Create
};
static
IClassFactoryImpl
WB2ClassFactory
=
{
&
WBCF_Vtbl
,
WebBrowserV2_Create
};
static
IClassFactoryImpl
CUHClassFactory
=
{
&
WBCF_Vtbl
,
CUrlHistory_Create
};
static
IClassFactoryImpl
ISCClassFactory
=
{
&
WBCF_Vtbl
,
InternetShortcut_Create
};
TRACE
(
"
\n
"
);
...
...
@@ -146,6 +147,9 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
if
(
IsEqualGUID
(
&
CLSID_CUrlHistory
,
rclsid
))
return
IClassFactory_QueryInterface
(
FACTORY
(
&
CUHClassFactory
),
riid
,
ppv
);
if
(
IsEqualGUID
(
&
CLSID_InternetShortcut
,
rclsid
))
return
IClassFactory_QueryInterface
(
FACTORY
(
&
ISCClassFactory
),
riid
,
ppv
);
/* As a last resort, figure if the CLSID belongs to a 'Shell Instance Object' */
return
SHDOCVW_GetShellInstanceObjectClassObject
(
rclsid
,
riid
,
ppv
);
}
...
...
dlls/shdocvw/intshcut.c
0 → 100644
View file @
ad886d66
This diff is collapsed.
Click to expand it.
dlls/shdocvw/shdocvw.h
View file @
ad886d66
...
...
@@ -224,6 +224,8 @@ void InternetExplorer_WebBrowser_Init(InternetExplorer*);
HRESULT
CUrlHistory_Create
(
IUnknown
*
,
REFIID
,
void
**
);
HRESULT
InternetShortcut_Create
(
IUnknown
*
,
REFIID
,
void
**
);
#define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
/**********************************************************************
...
...
@@ -273,4 +275,34 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
return
ret
;
}
static
inline
LPWSTR
co_strdupW
(
LPCWSTR
str
)
{
WCHAR
*
ret
=
CoTaskMemAlloc
((
strlenW
(
str
)
+
1
)
*
sizeof
(
WCHAR
));
if
(
ret
)
lstrcpyW
(
ret
,
str
);
return
ret
;
}
static
inline
LPWSTR
co_strdupAtoW
(
LPCSTR
str
)
{
INT
len
;
WCHAR
*
ret
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
);
ret
=
CoTaskMemAlloc
(
len
*
sizeof
(
WCHAR
));
if
(
ret
)
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
ret
,
len
);
return
ret
;
}
static
inline
LPSTR
co_strdupWtoA
(
LPCWSTR
str
)
{
INT
len
;
CHAR
*
ret
;
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
,
0
,
0
);
ret
=
CoTaskMemAlloc
(
len
);
if
(
ret
)
WideCharToMultiByte
(
CP_ACP
,
0
,
str
,
-
1
,
ret
,
len
,
0
,
0
);
return
ret
;
}
#endif
/* __WINE_SHDOCVW_H */
dlls/shdocvw/tests/Makefile.in
View file @
ad886d66
...
...
@@ -6,6 +6,7 @@ TESTDLL = shdocvw.dll
IMPORTS
=
shell32 ole32 oleaut32 user32 advapi32 kernel32
CTESTS
=
\
intshcut.c
\
shortcut.c
\
webbrowser.c
...
...
dlls/shdocvw/tests/intshcut.c
0 → 100644
View file @
ad886d66
/*
* Unit tests to document InternetShortcut's behaviour
*
* Copyright 2008 Damjan Jovanovic
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include <stdio.h>
#include <wine/test.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winerror.h"
#include "shlobj.h"
#include "shobjidl.h"
#include "shlguid.h"
#include "ole2.h"
#include "initguid.h"
#include "isguids.h"
#include "intshcut.h"
#include "wine/test.h"
static
WINAPI
HRESULT
Unknown_QueryInterface
(
IUnknown
*
pUnknown
,
REFIID
riid
,
void
**
ppvObject
)
{
if
(
IsEqualGUID
(
&
IID_IUnknown
,
riid
))
{
*
ppvObject
=
pUnknown
;
return
S_OK
;
}
return
E_NOINTERFACE
;
}
static
WINAPI
ULONG
Unknown_AddRef
(
IUnknown
*
pUnknown
)
{
return
2
;
}
static
WINAPI
ULONG
Unknown_Release
(
IUnknown
*
pUnknown
)
{
return
1
;
}
static
IUnknownVtbl
unknownVtbl
=
{
Unknown_QueryInterface
,
Unknown_AddRef
,
Unknown_Release
};
static
IUnknown
unknown
=
{
&
unknownVtbl
};
static
const
char
*
printGUID
(
const
GUID
*
guid
)
{
static
char
guidSTR
[
39
];
if
(
!
guid
)
return
NULL
;
sprintf
(
guidSTR
,
"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}"
,
guid
->
Data1
,
guid
->
Data2
,
guid
->
Data3
,
guid
->
Data4
[
0
],
guid
->
Data4
[
1
],
guid
->
Data4
[
2
],
guid
->
Data4
[
3
],
guid
->
Data4
[
4
],
guid
->
Data4
[
5
],
guid
->
Data4
[
6
],
guid
->
Data4
[
7
]);
return
guidSTR
;
}
static
void
test_Aggregability
(
void
)
{
HRESULT
hr
;
IUnknown
*
pUnknown
=
NULL
;
hr
=
CoCreateInstance
(
&
CLSID_InternetShortcut
,
NULL
,
CLSCTX_ALL
,
&
IID_IUnknown
,
(
void
**
)
&
pUnknown
);
ok
(
SUCCEEDED
(
hr
),
"could not create instance of CLSID_InternetShortcut with IID_IUnknown, hr = 0x%x
\n
"
,
hr
);
if
(
pUnknown
)
IUnknown_Release
(
pUnknown
);
hr
=
CoCreateInstance
(
&
CLSID_InternetShortcut
,
NULL
,
CLSCTX_ALL
,
&
IID_IUniformResourceLocatorA
,
(
void
**
)
&
pUnknown
);
ok
(
SUCCEEDED
(
hr
),
"could not create instance of CLSID_InternetShortcut with IID_IUniformResourceLocatorA, hr = 0x%x
\n
"
,
hr
);
if
(
pUnknown
)
IUnknown_Release
(
pUnknown
);
hr
=
CoCreateInstance
(
&
CLSID_InternetShortcut
,
&
unknown
,
CLSCTX_ALL
,
&
IID_IUnknown
,
(
void
**
)
&
pUnknown
);
ok
(
FAILED
(
hr
),
"aggregation didn't fail like it should, hr = 0x%x
\n
"
,
hr
);
if
(
pUnknown
)
IUnknown_Release
(
pUnknown
);
}
static
void
can_query_interface
(
IUnknown
*
pUnknown
,
REFIID
riid
)
{
HRESULT
hr
;
IUnknown
*
newInterface
;
hr
=
IUnknown_QueryInterface
(
pUnknown
,
riid
,
(
void
**
)
&
newInterface
);
ok
(
SUCCEEDED
(
hr
),
"interface %s could not be queried
\n
"
,
printGUID
(
riid
));
if
(
SUCCEEDED
(
hr
))
IUnknown_Release
(
newInterface
);
}
static
void
test_QueryInterface
(
void
)
{
HRESULT
hr
;
IUnknown
*
pUnknown
;
hr
=
CoCreateInstance
(
&
CLSID_InternetShortcut
,
NULL
,
CLSCTX_ALL
,
&
IID_IUnknown
,
(
void
**
)
&
pUnknown
);
if
(
SUCCEEDED
(
hr
))
{
can_query_interface
(
pUnknown
,
&
IID_IUniformResourceLocatorA
);
can_query_interface
(
pUnknown
,
&
IID_IUniformResourceLocatorW
);
can_query_interface
(
pUnknown
,
&
IID_IPersistFile
);
IUnknown_Release
(
pUnknown
);
}
else
skip
(
"could not create a CLSID_InternetShortcut for QueryInterface tests, hr=0x%x
\n
"
,
hr
);
}
static
CHAR
*
set_and_get_url
(
IUniformResourceLocatorA
*
urlA
,
LPCSTR
input
,
DWORD
flags
)
{
HRESULT
hr
;
hr
=
urlA
->
lpVtbl
->
SetURL
(
urlA
,
input
,
flags
);
if
(
SUCCEEDED
(
hr
))
{
CHAR
*
output
;
hr
=
urlA
->
lpVtbl
->
GetURL
(
urlA
,
&
output
);
if
(
SUCCEEDED
(
hr
))
return
output
;
else
skip
(
"GetUrl failed, hr=0x%x
\n
"
,
hr
);
}
else
skip
(
"SetUrl (%s, 0x%x) failed, hr=0x%x
\n
"
,
input
,
flags
,
hr
);
return
NULL
;
}
static
void
check_string_transform
(
IUniformResourceLocatorA
*
urlA
,
LPCSTR
input
,
DWORD
flags
,
LPCSTR
expectedOutput
)
{
CHAR
*
output
=
set_and_get_url
(
urlA
,
input
,
flags
);
if
(
output
!=
NULL
)
{
ok
(
lstrcmpA
(
output
,
expectedOutput
)
==
0
,
"unexpected URL change %s -> %s (expected %s)
\n
"
,
input
,
output
,
expectedOutput
);
CoTaskMemFree
(
output
);
}
}
static
void
test_NullURLs
(
void
)
{
HRESULT
hr
;
IUniformResourceLocatorA
*
urlA
;
hr
=
CoCreateInstance
(
&
CLSID_InternetShortcut
,
NULL
,
CLSCTX_ALL
,
&
IID_IUniformResourceLocatorA
,
(
void
**
)
&
urlA
);
if
(
SUCCEEDED
(
hr
))
{
LPSTR
url
=
NULL
;
hr
=
urlA
->
lpVtbl
->
GetURL
(
urlA
,
&
url
);
ok
(
SUCCEEDED
(
hr
),
"getting uninitialized URL unexpectedly failed, hr=0x%x
\n
"
,
hr
);
ok
(
url
==
NULL
,
"unitialized URL is not NULL but %s
\n
"
,
url
);
hr
=
urlA
->
lpVtbl
->
SetURL
(
urlA
,
NULL
,
0
);
ok
(
SUCCEEDED
(
hr
),
"setting NULL URL unexpectedly failed, hr=0x%x
\n
"
,
hr
);
hr
=
urlA
->
lpVtbl
->
GetURL
(
urlA
,
&
url
);
ok
(
SUCCEEDED
(
hr
),
"getting NULL URL unexpectedly failed, hr=0x%x
\n
"
,
hr
);
ok
(
url
==
NULL
,
"URL unexpectedly not NULL but %s
\n
"
,
url
);
urlA
->
lpVtbl
->
Release
(
urlA
);
}
else
skip
(
"could not create a CLSID_InternetShortcut for NullURL tests, hr=0x%x
\n
"
,
hr
);
}
static
void
test_SetURLFlags
(
void
)
{
HRESULT
hr
;
IUniformResourceLocatorA
*
urlA
;
hr
=
CoCreateInstance
(
&
CLSID_InternetShortcut
,
NULL
,
CLSCTX_ALL
,
&
IID_IUniformResourceLocatorA
,
(
void
**
)
&
urlA
);
if
(
SUCCEEDED
(
hr
))
{
check_string_transform
(
urlA
,
"somerandomstring"
,
0
,
"somerandomstring"
);
check_string_transform
(
urlA
,
"www.winehq.org"
,
0
,
"www.winehq.org"
);
todo_wine
{
check_string_transform
(
urlA
,
"www.winehq.org"
,
IURL_SETURL_FL_GUESS_PROTOCOL
,
"http://www.winehq.org/"
);
check_string_transform
(
urlA
,
"ftp.winehq.org"
,
IURL_SETURL_FL_GUESS_PROTOCOL
,
"ftp://ftp.winehq.org/"
);
}
urlA
->
lpVtbl
->
Release
(
urlA
);
}
else
skip
(
"could not create a CLSID_InternetShortcut for SetUrl tests, hr=0x%x
\n
"
,
hr
);
}
static
void
test_InternetShortcut
(
void
)
{
test_Aggregability
();
test_QueryInterface
();
test_NullURLs
();
test_SetURLFlags
();
}
START_TEST
(
intshcut
)
{
OleInitialize
(
NULL
);
test_InternetShortcut
();
OleUninitialize
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment