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
2010e0fb
Commit
2010e0fb
authored
Dec 18, 2009
by
Vincent Povirk
Committed by
Alexandre Julliard
Dec 21, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Add some tests for IEnumSTATSTG.
parent
0c9991c5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
148 additions
and
4 deletions
+148
-4
storage32.c
dlls/ole32/tests/storage32.c
+148
-4
No files found.
dlls/ole32/tests/storage32.c
View file @
2010e0fb
...
@@ -845,6 +845,8 @@ static void test_streamenum(void)
...
@@ -845,6 +845,8 @@ static void test_streamenum(void)
HRESULT
r
;
HRESULT
r
;
IStream
*
stm
=
NULL
;
IStream
*
stm
=
NULL
;
static
const
WCHAR
stmname
[]
=
{
'C'
,
'O'
,
'N'
,
'T'
,
'E'
,
'N'
,
'T'
,
'S'
,
0
};
static
const
WCHAR
stmname
[]
=
{
'C'
,
'O'
,
'N'
,
'T'
,
'E'
,
'N'
,
'T'
,
'S'
,
0
};
static
const
WCHAR
stmname2
[]
=
{
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
,
'G'
,
'H'
,
'I'
,
0
};
static
const
WCHAR
stmname3
[]
=
{
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
,
'G'
,
'H'
,
'I'
,
'J'
,
0
};
STATSTG
stat
;
STATSTG
stat
;
IEnumSTATSTG
*
ee
=
NULL
;
IEnumSTATSTG
*
ee
=
NULL
;
ULONG
count
;
ULONG
count
;
...
@@ -887,7 +889,7 @@ static void test_streamenum(void)
...
@@ -887,7 +889,7 @@ static void test_streamenum(void)
ok
(
r
==
S_OK
,
"IStorage->EnumElements failed
\n
"
);
ok
(
r
==
S_OK
,
"IStorage->EnumElements failed
\n
"
);
r
=
IStorage_DestroyElement
(
stg
,
stmname
);
r
=
IStorage_DestroyElement
(
stg
,
stmname
);
ok
(
r
==
S_OK
,
"IStorage->
EnumElements
failed
\n
"
);
ok
(
r
==
S_OK
,
"IStorage->
DestroyElement
failed
\n
"
);
todo_wine
{
todo_wine
{
count
=
0xf00
;
count
=
0xf00
;
...
@@ -905,11 +907,104 @@ static void test_streamenum(void)
...
@@ -905,11 +907,104 @@ static void test_streamenum(void)
ok
(
r
==
S_FALSE
,
"IEnumSTATSTG->Next failed
\n
"
);
ok
(
r
==
S_FALSE
,
"IEnumSTATSTG->Next failed
\n
"
);
ok
(
count
==
0
,
"count wrong
\n
"
);
ok
(
count
==
0
,
"count wrong
\n
"
);
r
=
IEnumSTATSTG_Release
(
ee
);
/* add a stream before reading */
ok
(
r
==
0
,
"enum not released
\n
"
);
r
=
IEnumSTATSTG_Reset
(
ee
);
ok
(
r
==
S_OK
,
"IEnumSTATSTG->Reset failed
\n
"
);
r
=
IStorage_CreateStream
(
stg
,
stmname
,
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
,
0
,
0
,
&
stm
);
ok
(
r
==
S_OK
,
"IStorage->CreateStream failed
\n
"
);
r
=
IStream_Release
(
stm
);
count
=
0xf00
;
r
=
IEnumSTATSTG_Next
(
ee
,
1
,
&
stat
,
&
count
);
todo_wine
ok
(
r
==
S_OK
,
"IEnumSTATSTG->Next failed
\n
"
);
todo_wine
ok
(
count
==
1
,
"count wrong
\n
"
);
if
(
r
==
S_OK
)
{
ok
(
lstrcmpiW
(
stat
.
pwcsName
,
stmname
)
==
0
,
"expected CONTENTS, got %s
\n
"
,
wine_dbgstr_w
(
stat
.
pwcsName
));
CoTaskMemFree
(
stat
.
pwcsName
);
}
r
=
IStorage_CreateStream
(
stg
,
stmname2
,
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
,
0
,
0
,
&
stm
);
ok
(
r
==
S_OK
,
"IStorage->CreateStream failed
\n
"
);
r
=
IStream_Release
(
stm
);
count
=
0xf00
;
r
=
IEnumSTATSTG_Next
(
ee
,
1
,
&
stat
,
&
count
);
todo_wine
ok
(
r
==
S_OK
,
"IEnumSTATSTG->Next failed
\n
"
);
todo_wine
ok
(
count
==
1
,
"count wrong
\n
"
);
if
(
r
==
S_OK
)
{
ok
(
lstrcmpiW
(
stat
.
pwcsName
,
stmname2
)
==
0
,
"expected ABCDEFGHI, got %s
\n
"
,
wine_dbgstr_w
(
stat
.
pwcsName
));
CoTaskMemFree
(
stat
.
pwcsName
);
}
/* delete previous and next stream after reading */
r
=
IStorage_CreateStream
(
stg
,
stmname3
,
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
,
0
,
0
,
&
stm
);
ok
(
r
==
S_OK
,
"IStorage->CreateStream failed
\n
"
);
r
=
IStream_Release
(
stm
);
r
=
IEnumSTATSTG_Reset
(
ee
);
ok
(
r
==
S_OK
,
"IEnumSTATSTG->Reset failed
\n
"
);
count
=
0xf00
;
r
=
IEnumSTATSTG_Next
(
ee
,
1
,
&
stat
,
&
count
);
ok
(
r
==
S_OK
,
"IEnumSTATSTG->Next failed
\n
"
);
ok
(
count
==
1
,
"count wrong
\n
"
);
if
(
r
==
S_OK
)
{
ok
(
lstrcmpiW
(
stat
.
pwcsName
,
stmname
)
==
0
,
"expected CONTENTS, got %s
\n
"
,
wine_dbgstr_w
(
stat
.
pwcsName
));
CoTaskMemFree
(
stat
.
pwcsName
);
}
r
=
IStorage_DestroyElement
(
stg
,
stmname
);
ok
(
r
==
S_OK
,
"IStorage->DestroyElement failed
\n
"
);
r
=
IStorage_DestroyElement
(
stg
,
stmname2
);
ok
(
r
==
S_OK
,
"IStorage->DestroyElement failed
\n
"
);
count
=
0xf00
;
r
=
IEnumSTATSTG_Next
(
ee
,
1
,
&
stat
,
&
count
);
ok
(
r
==
S_OK
,
"IEnumSTATSTG->Next failed
\n
"
);
ok
(
count
==
1
,
"count wrong
\n
"
);
if
(
r
==
S_OK
)
{
todo_wine
ok
(
lstrcmpiW
(
stat
.
pwcsName
,
stmname3
)
==
0
,
"expected ABCDEFGHIJ, got %s
\n
"
,
wine_dbgstr_w
(
stat
.
pwcsName
));
CoTaskMemFree
(
stat
.
pwcsName
);
}
r
=
IStorage_Release
(
stg
);
r
=
IStorage_Release
(
stg
);
ok
(
r
==
0
,
"storage not released
\n
"
);
todo_wine
ok
(
r
==
0
,
"storage not released
\n
"
);
/* enumerator is still valid and working after the storage is released */
r
=
IEnumSTATSTG_Reset
(
ee
);
ok
(
r
==
S_OK
,
"IEnumSTATSTG->Reset failed
\n
"
);
count
=
0xf00
;
r
=
IEnumSTATSTG_Next
(
ee
,
1
,
&
stat
,
&
count
);
ok
(
r
==
S_OK
,
"IEnumSTATSTG->Next failed
\n
"
);
ok
(
count
==
1
,
"count wrong
\n
"
);
if
(
r
==
S_OK
)
{
ok
(
lstrcmpiW
(
stat
.
pwcsName
,
stmname3
)
==
0
,
"expected ABCDEFGHIJ, got %s
\n
"
,
wine_dbgstr_w
(
stat
.
pwcsName
));
CoTaskMemFree
(
stat
.
pwcsName
);
}
/* the storage is left open until the enumerator is freed */
r
=
StgOpenStorage
(
filename
,
NULL
,
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
|
STGM_TRANSACTED
,
NULL
,
0
,
&
stg
);
ok
(
r
==
STG_E_SHAREVIOLATION
,
"StgCreateDocfile failed, res=%x
\n
"
,
r
);
r
=
IEnumSTATSTG_Release
(
ee
);
ok
(
r
==
0
,
"enum not released
\n
"
);
DeleteFileA
(
filenameA
);
DeleteFileA
(
filenameA
);
}
}
...
@@ -2564,6 +2659,54 @@ static void test_toplevel_stat(void)
...
@@ -2564,6 +2659,54 @@ static void test_toplevel_stat(void)
DeleteFileA
(
filenameA
);
DeleteFileA
(
filenameA
);
}
}
static
void
test_substorage_enum
(
void
)
{
IStorage
*
stg
,
*
stg2
;
IEnumSTATSTG
*
ee
;
HRESULT
r
;
ULONG
ref
;
static
const
WCHAR
stgname
[]
=
{
'P'
,
'E'
,
'R'
,
'M'
,
'S'
,
'T'
,
'G'
,
0
};
DeleteFileA
(
filenameA
);
/* create the file */
r
=
StgCreateDocfile
(
filename
,
STGM_CREATE
|
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
,
0
,
&
stg
);
ok
(
r
==
S_OK
,
"StgCreateDocfile failed
\n
"
);
/* create a substorage */
r
=
IStorage_CreateStorage
(
stg
,
stgname
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
0
,
0
,
&
stg2
);
ok
(
r
==
S_OK
,
"IStorage->CreateStorage failed, hr=%08x
\n
"
,
r
);
/* create an enumelements */
r
=
IStorage_EnumElements
(
stg2
,
0
,
NULL
,
0
,
&
ee
);
ok
(
r
==
S_OK
,
"IStorage->EnumElements failed, hr=%08x
\n
"
,
r
);
/* release the substorage */
ref
=
IStorage_Release
(
stg2
);
todo_wine
ok
(
ref
==
0
,
"storage not released
\n
"
);
/* reopening fails, because the substorage is really still open */
r
=
IStorage_OpenStorage
(
stg
,
stgname
,
NULL
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
,
0
,
0
,
&
stg2
);
ok
(
r
==
STG_E_ACCESSDENIED
,
"IStorage->OpenStorage failed, hr=%08x
\n
"
,
r
);
/* destroying the storage invalidates the enumerator */
r
=
IStorage_DestroyElement
(
stg
,
stgname
);
ok
(
r
==
S_OK
,
"IStorage->CreateStorage failed, hr=%08x
\n
"
,
r
);
if
(
0
)
{
/* crashes on wine */
r
=
IEnumSTATSTG_Reset
(
ee
);
ok
(
r
==
STG_E_REVERTED
,
"IEnumSTATSTG->Reset failed, hr=%08x
\n
"
,
r
);
}
IEnumSTATSTG_Release
(
ee
);
IStorage_Release
(
stg
);
r
=
DeleteFileA
(
filenameA
);
ok
(
r
==
TRUE
,
"deleted file
\n
"
);
}
START_TEST
(
storage32
)
START_TEST
(
storage32
)
{
{
CHAR
temp
[
MAX_PATH
];
CHAR
temp
[
MAX_PATH
];
...
@@ -2602,4 +2745,5 @@ START_TEST(storage32)
...
@@ -2602,4 +2745,5 @@ START_TEST(storage32)
test_copyto_iidexclusions_stream
();
test_copyto_iidexclusions_stream
();
test_rename
();
test_rename
();
test_toplevel_stat
();
test_toplevel_stat
();
test_substorage_enum
();
}
}
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