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
27800ef4
Commit
27800ef4
authored
May 01, 2006
by
Mike Hearn
Committed by
Alexandre Julliard
May 08, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Add StgCreateFile test and conformance fix.
parent
fec050c8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
17 deletions
+27
-17
storage32.c
dlls/ole32/storage32.c
+12
-13
storage32.c
dlls/ole32/tests/storage32.c
+15
-4
No files found.
dlls/ole32/storage32.c
View file @
27800ef4
...
...
@@ -5646,7 +5646,7 @@ HRESULT WINAPI StgCreateDocfile(
if
(
FAILED
(
validateSTGM
(
grfMode
)
))
goto
end
;
/* StgCreateDocFile
always opens for write
*/
/* StgCreateDocFile
seems to refuse readonly access, despite MSDN
*/
switch
(
STGM_ACCESS_MODE
(
grfMode
))
{
case
STGM_WRITE
:
...
...
@@ -5656,21 +5656,20 @@ HRESULT WINAPI StgCreateDocfile(
goto
end
;
}
/* can't share write */
switch
(
STGM_SHARE_MODE
(
grfMode
))
{
case
STGM_SHARE_EXCLUSIVE
:
case
STGM_SHARE_DENY_WRITE
:
break
;
default:
goto
end
;
}
/* if no share mode given then DENY_NONE is the default */
if
(
STGM_SHARE_MODE
(
grfMode
)
==
0
)
grfMode
|=
STGM_SHARE_DENY_NONE
;
/* shared reading requires transacted mode */
if
(
STGM_SHARE_MODE
(
grfMode
)
==
STGM_SHARE_DENY_WRITE
&&
!
(
grfMode
&
STGM_TRANSACTED
)
)
/* must have at least one access mode */
if
(
STGM_ACCESS_MODE
(
grfMode
)
==
0
)
goto
end
;
/* in direct mode, can only use SHARE_EXCLUSIVE */
if
(
!
(
grfMode
&
STGM_TRANSACTED
)
&&
(
STGM_SHARE_MODE
(
grfMode
)
!=
STGM_SHARE_EXCLUSIVE
))
goto
end
;
/* but in transacted mode, any share mode is valid */
/*
* Generate a unique name.
*/
...
...
dlls/ole32/tests/storage32.c
View file @
27800ef4
...
...
@@ -116,15 +116,15 @@ static void test_create_storage_modes(void)
ok
(
r
==
STG_E_INVALIDFLAG
,
"StgCreateDocfile succeeded
\n
"
);
ok
(
stg
==
NULL
,
"stg was set
\n
"
);
/* check what happens if the file already exists */
/* check what happens if the file already exists
(which is how it's meant to be used)
*/
r
=
StgCreateDocfile
(
filename
,
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
,
0
,
&
stg
);
ok
(
r
==
S_OK
,
"StgCreateDocfile failed
\n
"
);
r
=
IStorage_Release
(
stg
);
ok
(
r
==
0
,
"storage not released
\n
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
|
STGM_TRANSACTED
,
0
,
&
stg
);
ok
(
r
==
STG_E_FILEALREADYEXISTS
,
"StgCreateDocfile wrong error
\n
"
);
ok
(
r
==
STG_E_FILEALREADYEXISTS
,
"StgCreateDocfile wrong error
\n
"
);
/* FAILIFTHERE is default */
r
=
StgCreateDocfile
(
filename
,
STGM_READ
,
0
,
&
stg
);
ok
(
r
==
STG_E_INVALIDFLAG
,
"StgCreateDocfile succeeded
\n
"
);
ok
(
r
==
STG_E_INVALIDFLAG
,
"StgCreateDocfile succeeded
\n
"
);
/* need at least readmode and sharemode */
r
=
StgCreateDocfile
(
filename
,
STGM_SHARE_EXCLUSIVE
,
0
,
&
stg
);
ok
(
r
==
STG_E_INVALIDFLAG
,
"StgCreateDocfile succeeded
\n
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_SHARE_DENY_WRITE
,
0
,
&
stg
);
...
...
@@ -141,6 +141,8 @@ static void test_create_storage_modes(void)
ok
(
r
==
STG_E_INVALIDFLAG
,
"StgCreateDocfile failed
\n
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_SHARE_DENY_WRITE
|
STGM_READ
,
0
,
&
stg
);
ok
(
r
==
STG_E_INVALIDFLAG
,
"StgCreateDocfile wrong error
\n
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_TRANSACTED
|
STGM_SHARE_DENY_WRITE
|
STGM_READ
,
0
,
&
stg
);
ok
(
r
==
STG_E_INVALIDFLAG
,
"StgCreateDocfile wrong error
\n
"
);
ok
(
DeleteFileW
(
filename
),
"failed to delete file
\n
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
|
STGM_TRANSACTED
,
0
,
&
stg
);
...
...
@@ -158,7 +160,6 @@ static void test_create_storage_modes(void)
ok
(
r
==
S_OK
,
"StgCreateDocfile failed
\n
"
);
r
=
IStorage_Release
(
stg
);
ok
(
r
==
0
,
"storage not released
\n
"
);
ok
(
DeleteFileW
(
filename
),
"failed to delete file
\n
"
);
/* test the way excel uses StgCreateDocFile */
...
...
@@ -171,6 +172,16 @@ static void test_create_storage_modes(void)
ok
(
DeleteFileW
(
filename
),
"failed to delete file
\n
"
);
}
/* and the way windows media uses it ... */
r
=
StgCreateDocfile
(
filename
,
STGM_CREATE
|
STGM_SHARE_DENY_NONE
|
STGM_READWRITE
|
STGM_TRANSACTED
,
0
,
&
stg
);
ok
(
r
==
S_OK
,
"StgCreateDocfile the windows media way failed
\n
"
);
if
(
r
==
S_OK
)
{
r
=
IStorage_Release
(
stg
);
ok
(
r
==
0
,
"storage not released
\n
"
);
ok
(
DeleteFileW
(
filename
),
"failed to delete file
\n
"
);
}
/* looks like we need STGM_TRANSACTED or STGM_CREATE */
r
=
StgCreateDocfile
(
filename
,
STGM_TRANSACTED
|
STGM_SHARE_DENY_WRITE
|
STGM_READWRITE
,
0
,
&
stg
);
ok
(
r
==
S_OK
,
"StgCreateDocfile the excel way failed
\n
"
);
...
...
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