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
c1fe67bc
Commit
c1fe67bc
authored
Apr 11, 2005
by
Juan Lang
Committed by
Alexandre Julliard
Apr 11, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- add write support to IPropertyStorage, with tests
- misc. cleanups the tests turned up
parent
ad5ec783
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
93 additions
and
3 deletions
+93
-3
stg_prop.c
dlls/ole32/stg_prop.c
+0
-0
stg_prop.c
dlls/ole32/tests/stg_prop.c
+93
-3
No files found.
dlls/ole32/stg_prop.c
View file @
c1fe67bc
This diff is collapsed.
Click to expand it.
dlls/ole32/tests/stg_prop.c
View file @
c1fe67bc
...
...
@@ -26,7 +26,7 @@
# define U(x) (x)
#endif
/* FIXME: this creates an ANSI storage,
need
try to find conditions under which
/* FIXME: this creates an ANSI storage, try to find conditions under which
* Unicode translation fails
*/
static
void
testProps
(
void
)
...
...
@@ -34,6 +34,7 @@ static void testProps(void)
static
const
WCHAR
szDot
[]
=
{
'.'
,
0
};
static
const
WCHAR
szPrefix
[]
=
{
's'
,
't'
,
'g'
,
0
};
static
const
WCHAR
propName
[]
=
{
'p'
,
'r'
,
'o'
,
'p'
,
0
};
static
const
char
val
[]
=
"l33t auth0r"
;
WCHAR
filename
[
MAX_PATH
];
HRESULT
hr
;
IStorage
*
storage
=
NULL
;
...
...
@@ -58,7 +59,7 @@ static void testProps(void)
&
FMTID_SummaryInformation
,
NULL
,
PROPSETFLAG_ANSI
,
STGM_READWRITE
|
STGM_CREATE
|
STGM_SHARE_EXCLUSIVE
,
&
propertyStorage
);
ok
(
SUCCEEDED
(
hr
),
"
QI -> IPropertyStorag
e failed: 0x%08lx
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"
IPropertySetStorage_Creat
e failed: 0x%08lx
\n
"
,
hr
);
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
0
,
NULL
,
NULL
,
0
);
ok
(
SUCCEEDED
(
hr
),
"WriteMultiple with 0 args failed: 0x%08lx
\n
"
,
hr
);
...
...
@@ -98,7 +99,7 @@ static void testProps(void)
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
SUCCEEDED
(
hr
),
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
/*
finally,
set one by name */
/* set one by name */
spec
.
ulKind
=
PRSPEC_LPWSTR
;
U
(
spec
).
lpwstr
=
(
LPOLESTR
)
propName
;
U
(
var
).
lVal
=
2
;
...
...
@@ -106,6 +107,14 @@ static void testProps(void)
PID_FIRST_USABLE
);
ok
(
SUCCEEDED
(
hr
),
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
/* set a string value */
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
).
propid
=
PIDSI_AUTHOR
;
var
.
vt
=
VT_LPSTR
;
U
(
var
).
pszVal
=
(
LPSTR
)
val
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
SUCCEEDED
(
hr
),
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
/* check reading */
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
0
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"ReadMultiple with 0 args failed: 0x%08lx
\n
"
,
hr
);
...
...
@@ -127,6 +136,14 @@ static void testProps(void)
ok
(
var
.
vt
==
VT_I4
&&
U
(
var
).
lVal
==
2
,
"Didn't get expected type or value for property (got type %d, value %ld)
\n
"
,
var
.
vt
,
U
(
var
).
lVal
);
/* read string value */
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
).
propid
=
PIDSI_AUTHOR
;
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
);
ok
(
SUCCEEDED
(
hr
),
"ReadMultiple failed: 0x%08lx
\n
"
,
hr
);
ok
(
var
.
vt
==
VT_LPSTR
&&
!
lstrcmpA
(
U
(
var
).
pszVal
,
val
),
"Didn't get expected type or value for property (got type %d, value %s)
\n
"
,
var
.
vt
,
U
(
var
).
pszVal
);
/* check deleting */
hr
=
IPropertyStorage_DeleteMultiple
(
propertyStorage
,
0
,
NULL
);
...
...
@@ -147,6 +164,79 @@ static void testProps(void)
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
);
ok
(
hr
==
S_FALSE
,
"Expected S_FALSE, got 0x%08lx
\n
"
,
hr
);
hr
=
IPropertyStorage_Commit
(
propertyStorage
,
STGC_DEFAULT
);
ok
(
SUCCEEDED
(
hr
),
"Commit failed: 0x%08lx
\n
"
,
hr
);
/* check reverting */
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
).
propid
=
PID_FIRST_USABLE
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
SUCCEEDED
(
hr
),
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
hr
=
IPropertyStorage_Revert
(
propertyStorage
);
ok
(
SUCCEEDED
(
hr
),
"Revert failed: 0x%08lx
\n
"
,
hr
);
/* now check that it's still not there */
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
);
ok
(
hr
==
S_FALSE
,
"Expected S_FALSE, got 0x%08lx
\n
"
,
hr
);
/* set an integer value again */
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
).
propid
=
PID_FIRST_USABLE
;
var
.
vt
=
VT_I4
;
U
(
var
).
lVal
=
1
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
SUCCEEDED
(
hr
),
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
/* commit it */
hr
=
IPropertyStorage_Commit
(
propertyStorage
,
STGC_DEFAULT
);
ok
(
SUCCEEDED
(
hr
),
"Commit failed: 0x%08lx
\n
"
,
hr
);
/* set it to a string value */
var
.
vt
=
VT_LPSTR
;
U
(
var
).
pszVal
=
(
LPSTR
)
val
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
SUCCEEDED
(
hr
),
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
/* revert it */
hr
=
IPropertyStorage_Revert
(
propertyStorage
);
ok
(
SUCCEEDED
(
hr
),
"Revert failed: 0x%08lx
\n
"
,
hr
);
/* and make sure it's still an integer */
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
);
ok
(
SUCCEEDED
(
hr
),
"ReadMultiple failed: 0x%08lx
\n
"
,
hr
);
ok
(
var
.
vt
==
VT_I4
&&
U
(
var
).
lVal
==
1
,
"Didn't get expected type or value for property (got type %d, value %ld)
\n
"
,
var
.
vt
,
U
(
var
).
lVal
);
IPropertyStorage_Release
(
propertyStorage
);
propertyStorage
=
NULL
;
IPropertySetStorage_Release
(
propSetStorage
);
propSetStorage
=
NULL
;
IStorage_Release
(
storage
);
storage
=
NULL
;
/* now open it again */
hr
=
StgOpenStorage
(
filename
,
NULL
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
NULL
,
0
,
&
storage
);
ok
(
SUCCEEDED
(
hr
),
"StgOpenStorage failed: 0x%08lx
\n
"
,
hr
);
hr
=
StgCreatePropSetStg
(
storage
,
0
,
&
propSetStorage
);
ok
(
SUCCEEDED
(
hr
),
"StgCreatePropSetStg failed: 0x%08lx
\n
"
,
hr
);
hr
=
IPropertySetStorage_Open
(
propSetStorage
,
&
FMTID_SummaryInformation
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
&
propertyStorage
);
ok
(
SUCCEEDED
(
hr
),
"IPropertySetStorage_Open failed: 0x%08lx
\n
"
,
hr
);
/* check properties again */
spec
.
ulKind
=
PRSPEC_LPWSTR
;
U
(
spec
).
lpwstr
=
(
LPOLESTR
)
propName
;
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
);
ok
(
SUCCEEDED
(
hr
),
"ReadMultiple failed: 0x%08lx
\n
"
,
hr
);
ok
(
var
.
vt
==
VT_I4
&&
U
(
var
).
lVal
==
2
,
"Didn't get expected type or value for property (got type %d, value %ld)
\n
"
,
var
.
vt
,
U
(
var
).
lVal
);
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
).
propid
=
PIDSI_AUTHOR
;
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
);
ok
(
SUCCEEDED
(
hr
),
"ReadMultiple failed: 0x%08lx
\n
"
,
hr
);
ok
(
var
.
vt
==
VT_LPSTR
&&
!
lstrcmpA
(
U
(
var
).
pszVal
,
val
),
"Didn't get expected type or value for property (got type %d, value %s)
\n
"
,
var
.
vt
,
U
(
var
).
pszVal
);
IPropertyStorage_Release
(
propertyStorage
);
IPropertySetStorage_Release
(
propSetStorage
);
IStorage_Release
(
storage
);
...
...
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