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
f9d8449d
Commit
f9d8449d
authored
Jan 01, 2007
by
Michael Gardiner
Committed by
Alexandre Julliard
Jan 04, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Stop StgOpenStorage from creating a file when it does not already exist.
parent
d6ea1bf1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
25 deletions
+13
-25
storage32.c
dlls/ole32/storage32.c
+10
-22
storage32.c
dlls/ole32/tests/storage32.c
+3
-3
No files found.
dlls/ole32/storage32.c
View file @
f9d8449d
...
...
@@ -5945,7 +5945,6 @@ HRESULT WINAPI StgOpenStorage(
DWORD
shareMode
;
DWORD
accessMode
;
WCHAR
fullname
[
MAX_PATH
];
BOOL
newFile
;
TRACE
(
"(%s, %p, %x, %p, %d, %p)
\n
"
,
debugstr_w
(
pwcsName
),
pstgPriority
,
grfMode
,
...
...
@@ -6035,24 +6034,13 @@ HRESULT WINAPI StgOpenStorage(
*/
*
ppstgOpen
=
0
;
if
((
accessMode
&
GENERIC_WRITE
)
&&
/* try to create a file if no yet exists */
((
hFile
=
CreateFileW
(
pwcsName
,
accessMode
,
shareMode
,
NULL
,
CREATE_NEW
,
FILE_ATTRIBUTE_NORMAL
|
FILE_FLAG_RANDOM_ACCESS
,
0
))
!=
INVALID_HANDLE_VALUE
))
{
newFile
=
TRUE
;
}
else
{
newFile
=
FALSE
;
hFile
=
CreateFileW
(
pwcsName
,
accessMode
,
shareMode
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
|
FILE_FLAG_RANDOM_ACCESS
,
0
);
}
hFile
=
CreateFileW
(
pwcsName
,
accessMode
,
shareMode
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
|
FILE_FLAG_RANDOM_ACCESS
,
0
);
if
(
hFile
==
INVALID_HANDLE_VALUE
)
{
...
...
@@ -6090,7 +6078,7 @@ HRESULT WINAPI StgOpenStorage(
* Refuse to open the file if it's too small to be a structured storage file
* FIXME: verify the file when reading instead of here
*/
if
(
!
newFile
&&
GetFileSize
(
hFile
,
NULL
)
<
0x100
)
if
(
GetFileSize
(
hFile
,
NULL
)
<
0x100
)
{
CloseHandle
(
hFile
);
hr
=
STG_E_FILEALREADYEXISTS
;
...
...
@@ -6108,7 +6096,7 @@ HRESULT WINAPI StgOpenStorage(
goto
end
;
}
/*
if we created new file, i
nitialize the storage */
/*
I
nitialize the storage */
hr
=
StorageImpl_Construct
(
newStorage
,
hFile
,
...
...
@@ -6116,7 +6104,7 @@ HRESULT WINAPI StgOpenStorage(
NULL
,
grfMode
,
TRUE
,
newFile
);
FALSE
);
if
(
FAILED
(
hr
))
{
...
...
dlls/ole32/tests/storage32.c
View file @
f9d8449d
...
...
@@ -388,12 +388,12 @@ static void test_open_storage(void)
DeleteFileW
(
filename
);
/* try opening a nonexistent file - it should create it */
/* try opening a nonexistent file - it should
not
create it */
stgm
=
STGM_DIRECT
|
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
;
r
=
StgOpenStorage
(
filename
,
NULL
,
stgm
,
NULL
,
0
,
&
stg
);
ok
(
r
=
=
S_OK
,
"StgOpenStorage failed: 0x%08x
\n
"
,
r
);
ok
(
r
!
=
S_OK
,
"StgOpenStorage failed: 0x%08x
\n
"
,
r
);
if
(
r
==
S_OK
)
IStorage_Release
(
stg
);
ok
(
is_existing_file
(
filename
),
"StgOpenStorage didn'
t create a file
\n
"
);
ok
(
!
is_existing_file
(
filename
),
"StgOpenStorage should no
t create a file
\n
"
);
DeleteFileW
(
filename
);
/* create the file */
...
...
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