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
6e012b52
Commit
6e012b52
authored
Apr 10, 2016
by
Alex Henrie
Committed by
Alexandre Julliard
Apr 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32/tests: Add tests for StgCreatePropStg and StgOpenPropStg.
Signed-off-by:
Alex Henrie
<
alexhenrie24@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
37097ce9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
103 additions
and
23 deletions
+103
-23
stg_prop.c
dlls/ole32/tests/stg_prop.c
+103
-23
No files found.
dlls/ole32/tests/stg_prop.c
View file @
6e012b52
...
...
@@ -33,6 +33,8 @@ DEFINE_GUID(FMTID_UserDefinedProperties,0xD5CDD505,0x2E9C,0x101B,0x93,0x97,0x08,
static
HRESULT
(
WINAPI
*
pFmtIdToPropStgName
)(
const
FMTID
*
,
LPOLESTR
);
static
HRESULT
(
WINAPI
*
pPropStgNameToFmtId
)(
const
LPOLESTR
,
FMTID
*
);
static
HRESULT
(
WINAPI
*
pStgCreatePropSetStg
)(
IStorage
*
,
DWORD
,
IPropertySetStorage
**
);
static
HRESULT
(
WINAPI
*
pStgCreatePropStg
)(
IUnknown
*
,
REFFMTID
,
const
CLSID
*
,
DWORD
,
DWORD
,
IPropertyStorage
**
);
static
HRESULT
(
WINAPI
*
pStgOpenPropStg
)(
IUnknown
*
,
REFFMTID
,
DWORD
,
DWORD
,
IPropertyStorage
**
);
static
void
init_function_pointers
(
void
)
{
...
...
@@ -40,20 +42,25 @@ static void init_function_pointers(void)
pFmtIdToPropStgName
=
(
void
*
)
GetProcAddress
(
hmod
,
"FmtIdToPropStgName"
);
pPropStgNameToFmtId
=
(
void
*
)
GetProcAddress
(
hmod
,
"PropStgNameToFmtId"
);
pStgCreatePropSetStg
=
(
void
*
)
GetProcAddress
(
hmod
,
"StgCreatePropSetStg"
);
pStgCreatePropStg
=
(
void
*
)
GetProcAddress
(
hmod
,
"StgCreatePropStg"
);
pStgOpenPropStg
=
(
void
*
)
GetProcAddress
(
hmod
,
"StgOpenPropStg"
);
}
/* FIXME: this creates an ANSI storage, try to find conditions under which
* Unicode translation fails
*/
static
void
testProps
(
void
)
static
void
testProps
Helper
(
IPropertySetStorage
**
propSetStorage
)
{
static
const
WCHAR
szDot
[]
=
{
'.'
,
0
};
static
const
WCHAR
szPrefix
[]
=
{
's'
,
't'
,
'g'
,
0
};
static
const
WCHAR
szSummaryInfo
[]
=
{
5
,
'S'
,
'u'
,
'm'
,
'm'
,
'a'
,
'r'
,
'y'
,
'I'
,
'n'
,
'f'
,
'o'
,
'r'
,
'm'
,
'a'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
static
WCHAR
propName
[]
=
{
'p'
,
'r'
,
'o'
,
'p'
,
0
};
static
char
val
[]
=
"l33t auth0r"
;
WCHAR
filename
[
MAX_PATH
];
HRESULT
hr
;
IStorage
*
storage
=
NULL
;
I
PropertySetStorage
*
propSetStorage
=
NULL
;
I
Stream
*
stream
=
NULL
;
IPropertyStorage
*
propertyStorage
=
NULL
;
PROPSPEC
spec
;
PROPVARIANT
var
;
...
...
@@ -62,6 +69,11 @@ static void testProps(void)
GUID
anyOldGuid
=
{
0x12345678
,
0xdead
,
0xbeef
,
{
0x00
,
0x01
,
0x02
,
0x03
,
0x04
,
0x05
,
0x06
,
0x07
}
};
if
(
propSetStorage
)
trace
(
"Testing property storage with a set...
\n
"
);
else
trace
(
"Testing property storage without a set...
\n
"
);
if
(
!
GetTempFileNameW
(
szDot
,
szPrefix
,
0
,
filename
))
return
;
...
...
@@ -71,20 +83,40 @@ static void testProps(void)
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
|
STGM_CREATE
,
0
,
&
storage
);
ok
(
hr
==
S_OK
,
"StgCreateDocfile failed: 0x%08x
\n
"
,
hr
);
if
(
propSetStorage
)
{
if
(
!
pStgCreatePropSetStg
)
{
IStorage_Release
(
storage
);
DeleteFileW
(
filename
);
return
;
}
hr
=
pStgCreatePropSetStg
(
storage
,
0
,
&
propSetStorage
);
hr
=
pStgCreatePropSetStg
(
storage
,
0
,
propSetStorage
);
ok
(
hr
==
S_OK
,
"StgCreatePropSetStg failed: 0x%08x
\n
"
,
hr
);
hr
=
IPropertySetStorage_Create
(
propSetStorage
,
hr
=
IPropertySetStorage_Create
(
*
propSetStorage
,
&
FMTID_SummaryInformation
,
NULL
,
PROPSETFLAG_ANSI
,
STGM_READWRITE
|
STGM_CREATE
|
STGM_SHARE_EXCLUSIVE
,
&
propertyStorage
);
ok
(
hr
==
S_OK
,
"IPropertySetStorage_Create failed: 0x%08x
\n
"
,
hr
);
}
else
{
hr
=
IStorage_CreateStream
(
storage
,
szSummaryInfo
,
STGM_CREATE
|
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
0
,
0
,
&
stream
);
ok
(
hr
==
S_OK
,
"IStorage_CreateStream failed: 0x%08x
\n
"
,
hr
);
if
(
!
pStgCreatePropStg
)
{
IStorage_Release
(
storage
);
IUnknown_Release
(
stream
);
DeleteFileW
(
filename
);
return
;
}
hr
=
pStgCreatePropStg
((
IUnknown
*
)
stream
,
&
FMTID_SummaryInformation
,
NULL
,
PROPSETFLAG_ANSI
,
0
,
&
propertyStorage
);
ok
(
hr
==
S_OK
,
"StgCreatePropStg failed: 0x%08x
\n
"
,
hr
);
}
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
0
,
NULL
,
NULL
,
0
);
ok
(
hr
==
S_OK
,
"WriteMultiple with 0 args failed: 0x%08x
\n
"
,
hr
);
...
...
@@ -252,23 +284,41 @@ static void testProps(void)
*/
IPropertyStorage_Release
(
propertyStorage
);
propertyStorage
=
NULL
;
IPropertySetStorage_Release
(
propSetStorage
);
propSetStorage
=
NULL
;
if
(
propSetStorage
)
IPropertySetStorage_Release
(
*
propSetStorage
);
IStorage_Release
(
storage
);
storage
=
NULL
;
if
(
stream
)
IUnknown_Release
(
stream
)
;
/* now open it again */
hr
=
StgOpenStorage
(
filename
,
NULL
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
NULL
,
0
,
&
storage
);
ok
(
hr
==
S_OK
,
"StgOpenStorage failed: 0x%08x
\n
"
,
hr
);
hr
=
pStgCreatePropSetStg
(
storage
,
0
,
&
propSetStorage
);
if
(
propSetStorage
)
{
hr
=
pStgCreatePropSetStg
(
storage
,
0
,
propSetStorage
);
ok
(
hr
==
S_OK
,
"StgCreatePropSetStg failed: 0x%08x
\n
"
,
hr
);
hr
=
IPropertySetStorage_Open
(
propSetStorage
,
&
FMTID_SummaryInformation
,
hr
=
IPropertySetStorage_Open
(
*
propSetStorage
,
&
FMTID_SummaryInformation
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
&
propertyStorage
);
ok
(
hr
==
S_OK
,
"IPropertySetStorage_Open failed: 0x%08x
\n
"
,
hr
);
}
else
{
hr
=
IStorage_OpenStream
(
storage
,
szSummaryInfo
,
0
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
0
,
&
stream
);
ok
(
hr
==
S_OK
,
"IStorage_OpenStream failed: 0x%08x
\n
"
,
hr
);
if
(
!
pStgOpenPropStg
)
{
IStorage_Release
(
storage
);
IUnknown_Release
(
stream
);
DeleteFileW
(
filename
);
return
;
}
hr
=
pStgOpenPropStg
((
IUnknown
*
)
stream
,
&
FMTID_SummaryInformation
,
PROPSETFLAG_DEFAULT
,
0
,
&
propertyStorage
);
ok
(
hr
==
S_OK
,
"StgOpenPropStg failed: 0x%08x
\n
"
,
hr
);
}
/* check properties again */
spec
.
ulKind
=
PRSPEC_LPWSTR
;
...
...
@@ -288,8 +338,9 @@ static void testProps(void)
PropVariantClear
(
&
var
);
IPropertyStorage_Release
(
propertyStorage
);
IPropertySetStorage_Release
(
propSetStorage
);
if
(
propSetStorage
)
IPropertySetStorage_Release
(
*
propSetStorage
);
IStorage_Release
(
storage
);
if
(
stream
)
IUnknown_Release
(
stream
);
DeleteFileW
(
filename
);
...
...
@@ -298,20 +349,27 @@ static void testProps(void)
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
|
STGM_CREATE
,
0
,
&
storage
);
ok
(
hr
==
S_OK
,
"StgCreateDocfile failed: 0x%08x
\n
"
,
hr
);
if
(
!
pStgCreatePropSetStg
)
if
(
propSetStorage
)
{
IStorage_Release
(
storage
);
DeleteFileW
(
filename
);
return
;
}
hr
=
pStgCreatePropSetStg
(
storage
,
0
,
&
propSetStorage
);
hr
=
pStgCreatePropSetStg
(
storage
,
0
,
propSetStorage
);
ok
(
hr
==
S_OK
,
"StgCreatePropSetStg failed: 0x%08x
\n
"
,
hr
);
hr
=
IPropertySetStorage_Create
(
propSetStorage
,
hr
=
IPropertySetStorage_Create
(
*
propSetStorage
,
&
anyOldGuid
,
NULL
,
PROPSETFLAG_ANSI
,
STGM_READWRITE
|
STGM_CREATE
|
STGM_SHARE_EXCLUSIVE
,
&
propertyStorage
);
ok
(
hr
==
S_OK
,
"IPropertySetStorage_Create failed: 0x%08x
\n
"
,
hr
);
}
else
{
hr
=
IStorage_CreateStream
(
storage
,
szSummaryInfo
,
STGM_CREATE
|
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
0
,
0
,
&
stream
);
ok
(
hr
==
S_OK
,
"IStorage_CreateStream failed: 0x%08x
\n
"
,
hr
);
hr
=
pStgCreatePropStg
((
IUnknown
*
)
stream
,
&
anyOldGuid
,
NULL
,
PROPSETFLAG_DEFAULT
,
0
,
&
propertyStorage
);
ok
(
hr
==
S_OK
,
"StgCreatePropStg failed: 0x%08x
\n
"
,
hr
);
}
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
).
propid
=
PID_FIRST_USABLE
;
...
...
@@ -324,21 +382,34 @@ static void testProps(void)
ok
(
hr
==
S_OK
,
"Commit failed: 0x%08x
\n
"
,
hr
);
IPropertyStorage_Release
(
propertyStorage
);
IPropertySetStorage_Release
(
propSetStorage
);
if
(
propSetStorage
)
IPropertySetStorage_Release
(
*
propSetStorage
);
IStorage_Release
(
storage
);
propertyStorage
=
NULL
;
if
(
stream
)
IUnknown_Release
(
stream
)
;
/* now open it again */
hr
=
StgOpenStorage
(
filename
,
NULL
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
NULL
,
0
,
&
storage
);
ok
(
hr
==
S_OK
,
"StgOpenStorage failed: 0x%08x
\n
"
,
hr
);
hr
=
pStgCreatePropSetStg
(
storage
,
0
,
&
propSetStorage
);
if
(
propSetStorage
)
{
hr
=
pStgCreatePropSetStg
(
storage
,
0
,
propSetStorage
);
ok
(
hr
==
S_OK
,
"StgCreatePropSetStg failed: 0x%08x
\n
"
,
hr
);
hr
=
IPropertySetStorage_Open
(
propSetStorage
,
&
anyOldGuid
,
hr
=
IPropertySetStorage_Open
(
*
propSetStorage
,
&
anyOldGuid
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
&
propertyStorage
);
ok
(
hr
==
S_OK
,
"IPropertySetStorage_Open failed: 0x%08x
\n
"
,
hr
);
}
else
{
hr
=
IStorage_OpenStream
(
storage
,
szSummaryInfo
,
0
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
0
,
&
stream
);
ok
(
hr
==
S_OK
,
"IStorage_OpenStream failed: 0x%08x
\n
"
,
hr
);
hr
=
pStgOpenPropStg
((
IUnknown
*
)
stream
,
&
anyOldGuid
,
PROPSETFLAG_DEFAULT
,
0
,
&
propertyStorage
);
ok
(
hr
==
S_OK
,
"StgOpenPropStg failed: 0x%08x
\n
"
,
hr
);
}
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
).
propid
=
PID_FIRST_USABLE
;
...
...
@@ -350,12 +421,21 @@ static void testProps(void)
var
.
vt
,
U
(
var
).
lVal
);
IPropertyStorage_Release
(
propertyStorage
);
IPropertySetStorage_Release
(
propSetStorage
);
if
(
propSetStorage
)
IPropertySetStorage_Release
(
*
propSetStorage
);
IStorage_Release
(
storage
);
if
(
stream
)
IUnknown_Release
(
stream
);
DeleteFileW
(
filename
);
}
static
void
testProps
(
void
)
{
IPropertySetStorage
*
propSetStorage
=
NULL
;
testPropsHelper
(
&
propSetStorage
);
testPropsHelper
(
NULL
);
}
static
void
testCodepage
(
void
)
{
static
const
WCHAR
szDot
[]
=
{
'.'
,
0
};
...
...
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