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
b146b75c
Commit
b146b75c
authored
Jan 10, 2005
by
Mike McCormack
Committed by
Alexandre Julliard
Jan 10, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test and fix StgCreateDocFile grfModes.
parent
202c28f8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
0 deletions
+97
-0
storage32.c
dlls/ole32/storage32.c
+12
-0
storage32.c
dlls/ole32/tests/storage32.c
+85
-0
No files found.
dlls/ole32/storage32.c
View file @
b146b75c
...
...
@@ -5425,6 +5425,8 @@ HRESULT WINAPI StgCreateDocfile(
*/
if
(
ppstgOpen
==
0
)
return
STG_E_INVALIDPOINTER
;
if
(
reserved
!=
0
)
return
STG_E_INVALIDPARAMETER
;
/*
* Validate the STGM flags
...
...
@@ -5432,6 +5434,14 @@ HRESULT WINAPI StgCreateDocfile(
if
(
FAILED
(
validateSTGM
(
grfMode
)
))
return
STG_E_INVALIDFLAG
;
/* StgCreateDocFile always opens for write */
if
(
!
(
grfMode
&
(
STGM_WRITE
|
STGM_READWRITE
)))
return
STG_E_INVALIDFLAG
;
/* always opens non-shared */
if
(
!
(
grfMode
&
STGM_SHARE_EXCLUSIVE
))
return
STG_E_INVALIDFLAG
;
/*
* Generate a unique name.
*/
...
...
@@ -5492,6 +5502,8 @@ HRESULT WINAPI StgCreateDocfile(
if
(
hFile
==
INVALID_HANDLE_VALUE
)
{
if
(
GetLastError
()
==
ERROR_FILE_EXISTS
)
return
STG_E_FILEALREADYEXISTS
;
return
E_FAIL
;
}
...
...
dlls/ole32/tests/storage32.c
View file @
b146b75c
...
...
@@ -66,7 +66,92 @@ void test_hglobal_storage_stat(void)
ok
(
refcount
==
0
,
"ILockBytes refcount is wrong
\n
"
);
}
void
test_create_storage_modes
(
void
)
{
static
const
WCHAR
szPrefix
[]
=
{
's'
,
't'
,
'g'
,
0
};
static
const
WCHAR
szDot
[]
=
{
'.'
,
0
};
WCHAR
filename
[
MAX_PATH
];
IStorage
*
stg
=
NULL
;
HRESULT
r
;
if
(
!
GetTempFileNameW
(
szDot
,
szPrefix
,
0
,
filename
))
return
;
DeleteFileW
(
filename
);
/* test with some invalid parameters */
r
=
StgCreateDocfile
(
NULL
,
0
,
0
,
&
stg
);
ok
(
r
==
STG_E_INVALIDFLAG
,
"StgCreateDocfile succeeded
\n
"
);
r
=
StgCreateDocfile
(
filename
,
0
,
0
,
&
stg
);
ok
(
r
==
STG_E_INVALIDFLAG
,
"StgCreateDocfile succeeded
\n
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_CREATE
,
0
,
&
stg
);
ok
(
r
==
STG_E_INVALIDFLAG
,
"StgCreateDocfile succeeded
\n
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_CREATE
|
STGM_READWRITE
,
0
,
&
stg
);
ok
(
r
==
STG_E_INVALIDFLAG
,
"StgCreateDocfile succeeded
\n
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_CREATE
|
STGM_SHARE_EXCLUSIVE
,
0
,
&
stg
);
ok
(
r
==
STG_E_INVALIDFLAG
,
"StgCreateDocfile succeeded
\n
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_CREATE
|
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
,
0
,
NULL
);
ok
(
r
==
STG_E_INVALIDPOINTER
,
"StgCreateDocfile succeeded
\n
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_CREATE
|
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
,
1
,
&
stg
);
ok
(
r
==
STG_E_INVALIDPARAMETER
,
"StgCreateDocfile succeeded
\n
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_SHARE_EXCLUSIVE
|
STGM_READ
,
0
,
&
stg
);
ok
(
r
==
STG_E_INVALIDFLAG
,
"StgCreateDocfile succeeded
\n
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_PRIORITY
,
0
,
&
stg
);
ok
(
r
==
STG_E_INVALIDFLAG
,
"StgCreateDocfile succeeded
\n
"
);
ok
(
stg
==
NULL
,
"stg was set
\n
"
);
/* check what happens if the file already exists */
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
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_READ
,
0
,
&
stg
);
ok
(
r
==
STG_E_INVALIDFLAG
,
"StgCreateDocfile succeeded
\n
"
);
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
);
ok
(
r
==
STG_E_INVALIDFLAG
,
"StgCreateDocfile succeeded
\n
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_SHARE_DENY_NONE
,
0
,
&
stg
);
ok
(
r
==
STG_E_INVALIDFLAG
,
"StgCreateDocfile failed
\n
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_SHARE_DENY_NONE
|
STGM_TRANSACTED
,
0
,
&
stg
);
ok
(
r
==
STG_E_INVALIDFLAG
,
"StgCreateDocfile failed
\n
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_SHARE_DENY_NONE
|
STGM_READWRITE
,
0
,
&
stg
);
ok
(
r
==
STG_E_INVALIDFLAG
,
"StgCreateDocfile failed
\n
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_SHARE_DENY_NONE
|
STGM_WRITE
,
0
,
&
stg
);
ok
(
r
==
STG_E_INVALIDFLAG
,
"StgCreateDocfile failed
\n
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_SHARE_DENY_WRITE
|
STGM_WRITE
,
0
,
&
stg
);
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
"
);
ok
(
DeleteFileW
(
filename
),
"failed to delete file
\n
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
|
STGM_TRANSACTED
,
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
|
STGM_FAILIFTHERE
,
0
,
&
stg
);
ok
(
r
==
STG_E_FILEALREADYEXISTS
,
"StgCreateDocfile wrong error
\n
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_SHARE_EXCLUSIVE
|
STGM_WRITE
,
0
,
&
stg
);
ok
(
r
==
STG_E_FILEALREADYEXISTS
,
"StgCreateDocfile wrong error
\n
"
);
r
=
StgCreateDocfile
(
filename
,
STGM_CREATE
|
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
|
STGM_TRANSACTED
,
0
,
&
stg
);
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
"
);
}
START_TEST
(
storage32
)
{
test_hglobal_storage_stat
();
test_create_storage_modes
();
}
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