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
6dd5dbef
Commit
6dd5dbef
authored
May 03, 2006
by
Robert Shearman
Committed by
Alexandre Julliard
May 05, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: STGM_PRIORITY allows other IStorage objects to be opened in transacted…
ole32: STGM_PRIORITY allows other IStorage objects to be opened in transacted mode with read/write access.
parent
6c6ce702
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
5 deletions
+27
-5
storage32.c
dlls/ole32/storage32.c
+9
-3
storage32.c
dlls/ole32/tests/storage32.c
+18
-2
No files found.
dlls/ole32/storage32.c
View file @
6dd5dbef
...
...
@@ -5914,7 +5914,6 @@ HRESULT WINAPI StgOpenStorage(
goto
end
;
}
/* STGM_PRIORITY implies exclusive access */
if
(
grfMode
&
STGM_PRIORITY
)
{
if
(
grfMode
&
(
STGM_TRANSACTED
|
STGM_SIMPLE
|
STGM_NOSCRATCH
|
STGM_NOSNAPSHOT
))
...
...
@@ -5924,13 +5923,20 @@ HRESULT WINAPI StgOpenStorage(
if
(
STGM_ACCESS_MODE
(
grfMode
)
!=
STGM_READ
)
return
STG_E_INVALIDFLAG
;
grfMode
&=
~
0xf0
;
/* remove the existing sharing mode */
grfMode
|=
STGM_SHARE_DENY_WRITE
;
grfMode
|=
STGM_SHARE_DENY_NONE
;
/* STGM_PRIORITY stops other IStorage objects on the same file from
* committing until the STGM_PRIORITY IStorage is closed. it also
* stops non-transacted mode StgOpenStorage calls with write access from
* succeeding. obviously, both of these cannot be achieved through just
* file share flags */
FIXME
(
"STGM_PRIORITY mode not implemented correctly
\n
"
);
}
/*
* Validate the sharing mode
*/
if
(
!
(
grfMode
&
STGM_TRANSACTED
))
if
(
!
(
grfMode
&
(
STGM_TRANSACTED
|
STGM_PRIORITY
)
))
switch
(
STGM_SHARE_MODE
(
grfMode
))
{
case
STGM_SHARE_EXCLUSIVE
:
...
...
dlls/ole32/tests/storage32.c
View file @
6dd5dbef
...
...
@@ -626,6 +626,7 @@ static void test_storage_refcount(void)
static
const
WCHAR
szDot
[]
=
{
'.'
,
0
};
WCHAR
filename
[
MAX_PATH
];
IStorage
*
stg
=
NULL
;
IStorage
*
stgprio
=
NULL
;
HRESULT
r
;
IStream
*
stm
=
NULL
;
static
const
WCHAR
stmname
[]
=
{
'C'
,
'O'
,
'N'
,
'T'
,
'E'
,
'N'
,
'T'
,
'S'
,
0
};
...
...
@@ -673,10 +674,24 @@ static void test_storage_refcount(void)
r
=
IStream_Release
(
stm
);
ok
(
r
==
0
,
"stream not released
\n
"
);
/* test for grfMode open issue */
/* tests that STGM_PRIORITY doesn't prevent readwrite access from other
* StgOpenStorage calls in transacted mode */
r
=
StgOpenStorage
(
filename
,
NULL
,
STGM_PRIORITY
,
NULL
,
0
,
&
stgprio
);
ok
(
r
==
S_OK
,
"StgOpenStorage failed with error 0x%08lx
\n
"
,
r
);
todo_wine
{
/* non-transacted mode read/write fails */
r
=
StgOpenStorage
(
filename
,
NULL
,
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
,
NULL
,
0
,
&
stg
);
ok
(
r
==
STG_E_LOCKVIOLATION
,
"StgOpenStorage should return STG_E_LOCKVIOLATION instead of 0x%08lx
\n
"
,
r
);
}
/* non-transacted mode read-only succeeds */
r
=
StgOpenStorage
(
filename
,
NULL
,
STGM_SHARE_DENY_WRITE
|
STGM_READ
,
NULL
,
0
,
&
stg
);
ok
(
r
==
S_OK
,
"StgOpenStorage failed with error 0x%08lx
\n
"
,
r
);
IStorage_Release
(
stg
);
r
=
StgOpenStorage
(
filename
,
NULL
,
STGM_TRANSACTED
|
STGM_SHARE_DENY_WRITE
|
STGM_READWRITE
,
NULL
,
0
,
&
stg
);
ok
(
r
==
S_OK
,
"StgOpenStorage failed
\n
"
);
ok
(
r
==
S_OK
,
"StgOpenStorage failed
with error 0x%08lx
\n
"
,
r
);
if
(
stg
)
{
static
const
WCHAR
stgname
[]
=
{
' '
,
' '
,
' '
,
'2'
,
'9'
,
0
};
...
...
@@ -727,6 +742,7 @@ static void test_storage_refcount(void)
r
=
IStorage_Release
(
stg
);
ok
(
r
==
0
,
"wrong ref count
\n
"
);
}
IStorage_Release
(
stgprio
);
DeleteFileW
(
filename
);
}
...
...
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