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
24e69d54
Commit
24e69d54
authored
Aug 01, 2006
by
Mike McCormack
Committed by
Alexandre Julliard
Jul 31, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Add a test showing what STGM_TRANSACTED does for streams.
parent
6add05d3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
4 deletions
+62
-4
storage32.c
dlls/ole32/storage32.c
+3
-4
storage32.c
dlls/ole32/tests/storage32.c
+59
-0
No files found.
dlls/ole32/storage32.c
View file @
24e69d54
...
...
@@ -323,7 +323,8 @@ static HRESULT WINAPI StorageBaseImpl_OpenStream(
/*
* Validate the STGM flags
*/
if
(
FAILED
(
validateSTGM
(
grfMode
)
))
if
(
FAILED
(
validateSTGM
(
grfMode
)
)
||
STGM_SHARE_MODE
(
grfMode
)
!=
STGM_SHARE_EXCLUSIVE
)
{
res
=
STG_E_INVALIDFLAG
;
goto
end
;
...
...
@@ -332,9 +333,7 @@ static HRESULT WINAPI StorageBaseImpl_OpenStream(
/*
* As documented.
*/
if
(
STGM_SHARE_MODE
(
grfMode
)
!=
STGM_SHARE_EXCLUSIVE
||
(
grfMode
&
STGM_DELETEONRELEASE
)
||
(
grfMode
&
STGM_TRANSACTED
)
)
if
(
(
grfMode
&
STGM_DELETEONRELEASE
)
||
(
grfMode
&
STGM_TRANSACTED
)
)
{
res
=
STG_E_INVALIDFUNCTION
;
goto
end
;
...
...
dlls/ole32/tests/storage32.c
View file @
24e69d54
...
...
@@ -835,6 +835,64 @@ static void test_streamenum(void)
DeleteFileW
(
filename
);
}
static
void
test_transact
(
void
)
{
static
const
WCHAR
szPrefix
[]
=
{
's'
,
't'
,
'g'
,
0
};
static
const
WCHAR
szDot
[]
=
{
'.'
,
0
};
WCHAR
filename
[
MAX_PATH
];
IStorage
*
stg
=
NULL
;
HRESULT
r
;
IStream
*
stm
=
NULL
;
static
const
WCHAR
stmname
[]
=
{
'C'
,
'O'
,
'N'
,
'T'
,
'E'
,
'N'
,
'T'
,
'S'
,
0
};
if
(
!
GetTempFileNameW
(
szDot
,
szPrefix
,
0
,
filename
))
return
;
DeleteFileW
(
filename
);
/* create the file */
r
=
StgCreateDocfile
(
filename
,
STGM_CREATE
|
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
|
STGM_TRANSACTED
,
0
,
&
stg
);
ok
(
r
==
S_OK
,
"StgCreateDocfile failed
\n
"
);
/* now create a stream, but don't commit it */
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
);
IStorage_Release
(
stg
);
stm
=
NULL
;
stg
=
NULL
;
r
=
StgOpenStorage
(
filename
,
NULL
,
STGM_SHARE_DENY_NONE
|
STGM_READ
|
STGM_TRANSACTED
,
NULL
,
0
,
&
stg
);
ok
(
r
==
S_OK
,
"StgOpenStorage failed
\n
"
);
if
(
!
stg
)
return
;
r
=
IStorage_OpenStream
(
stg
,
stmname
,
NULL
,
STGM_SHARE_DENY_NONE
|
STGM_READ
,
0
,
&
stm
);
ok
(
r
==
STG_E_INVALIDFLAG
,
"IStorage->OpenStream failed %08lx
\n
"
,
r
);
r
=
IStorage_OpenStream
(
stg
,
stmname
,
NULL
,
STGM_DELETEONRELEASE
|
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
,
0
,
&
stm
);
ok
(
r
==
STG_E_INVALIDFUNCTION
,
"IStorage->OpenStream failed %08lx
\n
"
,
r
);
r
=
IStorage_OpenStream
(
stg
,
stmname
,
NULL
,
STGM_TRANSACTED
|
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
,
0
,
&
stm
);
ok
(
r
==
STG_E_INVALIDFUNCTION
,
"IStorage->OpenStream failed %08lx
\n
"
,
r
);
todo_wine
{
r
=
IStorage_OpenStream
(
stg
,
stmname
,
NULL
,
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
,
0
,
&
stm
);
ok
(
r
==
STG_E_FILENOTFOUND
,
"IStorage->OpenStream should fail %08lx
\n
"
,
r
);
}
if
(
stm
)
r
=
IStream_Release
(
stm
);
IStorage_Release
(
stg
);
r
=
DeleteFileW
(
filename
);
ok
(
r
==
TRUE
,
"deleted file
\n
"
);
}
START_TEST
(
storage32
)
{
test_hglobal_storage_stat
();
...
...
@@ -844,4 +902,5 @@ START_TEST(storage32)
test_storage_suminfo
();
test_storage_refcount
();
test_streamenum
();
test_transact
();
}
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