Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
23aa4607
Commit
23aa4607
authored
Nov 24, 2010
by
Andrew Bogott
Committed by
Alexandre Julliard
Dec 06, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shdocvw: Add tests for IPersistFile on an internet shortcut.
parent
3d5b3bef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
11 deletions
+56
-11
intshcut.c
dlls/shdocvw/tests/intshcut.c
+56
-11
No files found.
dlls/shdocvw/tests/intshcut.c
View file @
23aa4607
...
...
@@ -177,27 +177,28 @@ static void test_ReadAndWriteProperties(void)
{
HRESULT
hr
;
IUniformResourceLocatorA
*
urlA
;
IPropertySetStorage
*
pPropSetStg
;
IUniformResourceLocatorA
*
urlAFromFile
;
WCHAR
fileNameW
[]
=
{
'C'
,
':'
,
'/'
,
'w'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
'/'
,
't'
,
'e'
,
'm'
,
'p'
,
'/'
,
't'
,
'e'
,
's'
,
't'
,
's'
,
'h'
,
'o'
,
'r'
,
't'
,
'c'
,
'u'
,
't'
,
'.'
,
'u'
,
'r'
,
'l'
,
0
};
WCHAR
iconPath
[]
=
{
'f'
,
'i'
,
'l'
,
'e'
,
':'
,
'/'
,
'/'
,
'/'
,
'C'
,
':'
,
'/'
,
'a'
,
'r'
,
'b'
,
'i'
,
't'
,
'r'
,
'a'
,
'r'
,
'y'
,
'/'
,
'i'
,
'c'
,
'o'
,
'n'
,
'/'
,
'p'
,
'a'
,
't'
,
'h'
,
0
};
int
iconIndex
=
7
;
char
testurl
[]
=
"http://some/bogus/url.html"
;
PROPSPEC
ps
[
2
];
ps
[
0
].
ulKind
=
PRSPEC_PROPID
;
ps
[
0
].
propid
=
PID_IS_ICONFILE
;
ps
[
1
].
ulKind
=
PRSPEC_PROPID
;
ps
[
1
].
propid
=
PID_IS_ICONINDEX
;
hr
=
CoCreateInstance
(
&
CLSID_InternetShortcut
,
NULL
,
CLSCTX_ALL
,
&
IID_IUniformResourceLocatorA
,
(
void
**
)
&
urlA
);
if
(
hr
==
S_OK
)
{
WCHAR
iconPath
[]
=
{
'f'
,
'i'
,
'l'
,
'e'
,
':'
,
'/'
,
'/'
,
'/'
,
'C'
,
':'
,
'/'
,
'a'
,
'r'
,
'b'
,
'i'
,
't'
,
'r'
,
'a'
,
'r'
,
'y'
,
'/'
,
'i'
,
'c'
,
'o'
,
'n'
,
'/'
,
'p'
,
'a'
,
't'
,
'h'
,
0
};
int
iconIndex
=
7
;
IPersistFile
*
pf
;
IPropertyStorage
*
pPropStgWrite
;
IPropertyStorage
*
pPropStgRead
;
PROPSPEC
ps
[
2
];
IPropertySetStorage
*
pPropSetStg
;
PROPVARIANT
pv
[
2
];
PROPVARIANT
pvread
[
2
];
ps
[
0
].
ulKind
=
PRSPEC_PROPID
;
ps
[
0
].
propid
=
PID_IS_ICONFILE
;
ps
[
1
].
ulKind
=
PRSPEC_PROPID
;
ps
[
1
].
propid
=
PID_IS_ICONINDEX
;
pv
[
0
].
vt
=
VT_LPWSTR
;
pv
[
0
].
pwszVal
=
(
void
*
)
iconPath
;
pv
[
1
].
vt
=
VT_I4
;
pv
[
1
].
iVal
=
iconIndex
;
hr
=
urlA
->
lpVtbl
->
QueryInterface
(
urlA
,
&
IID_IPropertySetStorage
,
(
void
**
)
&
pPropSetStg
);
ok
(
hr
==
S_OK
,
"Unable to get an IPropertySetStorage, hr=0x%x
\n
"
,
hr
);
...
...
@@ -212,6 +213,49 @@ static void test_ReadAndWriteProperties(void)
pPropStgWrite
->
lpVtbl
->
Release
(
pPropStgWrite
);
/* We need to set a URL -- IPersistFile refuses to save without one. */
hr
=
urlA
->
lpVtbl
->
SetURL
(
urlA
,
testurl
,
0
);
ok
(
hr
==
S_OK
,
"Failed to set a URL. hr=0x%x
\n
"
,
hr
);
/* Write this shortcut out to a file so that we can test reading it in again. */
hr
=
urlA
->
lpVtbl
->
QueryInterface
(
urlA
,
&
IID_IPersistFile
,
(
void
**
)
&
pf
);
ok
(
hr
==
S_OK
,
"Failed to get the IPersistFile for writing. hr=0x%x
\n
"
,
hr
);
hr
=
IPersistFile_Save
(
pf
,
fileNameW
,
TRUE
);
ok
(
hr
==
S_OK
,
"Failed to save via IPersistFile. hr=0x%x
\n
"
,
hr
);
IPersistFile_Release
(
pf
);
urlA
->
lpVtbl
->
Release
(
urlA
);
IPropertySetStorage_Release
(
pPropSetStg
);
}
else
skip
(
"could not create a CLSID_InternetShortcut for property tests, hr=0x%x
\n
"
,
hr
);
hr
=
CoCreateInstance
(
&
CLSID_InternetShortcut
,
NULL
,
CLSCTX_ALL
,
&
IID_IUniformResourceLocatorA
,
(
void
**
)
&
urlAFromFile
);
if
(
hr
==
S_OK
)
{
IPropertySetStorage
*
pPropSetStg
;
IPropertyStorage
*
pPropStgRead
;
PROPVARIANT
pvread
[
2
];
IPersistFile
*
pf
;
LPSTR
url
=
NULL
;
/* Now read that .url file back in. */
hr
=
urlAFromFile
->
lpVtbl
->
QueryInterface
(
urlA
,
&
IID_IPersistFile
,
(
void
**
)
&
pf
);
ok
(
hr
==
S_OK
,
"Failed to get the IPersistFile for reading. hr=0x%x
\n
"
,
hr
);
hr
=
IPersistFile_Load
(
pf
,
fileNameW
,
0
);
ok
(
hr
==
S_OK
,
"Failed to load via IPersistFile. hr=0x%x
\n
"
,
hr
);
IPersistFile_Release
(
pf
);
hr
=
urlA
->
lpVtbl
->
GetURL
(
urlAFromFile
,
&
url
);
ok
(
lstrcmp
(
url
,
testurl
)
==
0
,
"Wrong url read from file: %s
\n
"
,
url
);
hr
=
urlA
->
lpVtbl
->
QueryInterface
(
urlAFromFile
,
&
IID_IPropertySetStorage
,
(
void
**
)
&
pPropSetStg
);
ok
(
hr
==
S_OK
,
"Unable to get an IPropertySetStorage, hr=0x%x
\n
"
,
hr
);
hr
=
IPropertySetStorage_Open
(
pPropSetStg
,
&
FMTID_Intshcut
,
STGM_READ
|
STGM_SHARE_EXCLUSIVE
,
&
pPropStgRead
);
ok
(
hr
==
S_OK
,
"Unable to get an IPropertyStorage for reading, hr=0x%x
\n
"
,
hr
);
...
...
@@ -227,6 +271,7 @@ static void test_ReadAndWriteProperties(void)
IPropertyStorage_Release
(
pPropStgRead
);
IPropertySetStorage_Release
(
pPropSetStg
);
urlA
->
lpVtbl
->
Release
(
urlA
);
DeleteFileW
(
fileNameW
);
}
else
skip
(
"could not create a CLSID_InternetShortcut for property tests, hr=0x%x
\n
"
,
hr
);
...
...
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