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
d20ab01e
Commit
d20ab01e
authored
Jan 14, 2009
by
Andrey Turkin
Committed by
Alexandre Julliard
Jan 15, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Do not crash in WriteClassStg if passed NULL pointer.
parent
37d27c38
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
0 deletions
+54
-0
storage32.c
dlls/ole32/storage32.c
+3
-0
storage32.c
dlls/ole32/tests/storage32.c
+51
-0
No files found.
dlls/ole32/storage32.c
View file @
d20ab01e
...
...
@@ -6281,6 +6281,9 @@ HRESULT WINAPI WriteClassStg(IStorage* pStg, REFCLSID rclsid)
if
(
!
pStg
)
return
E_INVALIDARG
;
if
(
!
rclsid
)
return
STG_E_INVALIDPOINTER
;
hRes
=
IStorage_SetClass
(
pStg
,
rclsid
);
return
hRes
;
...
...
dlls/ole32/tests/storage32.c
View file @
d20ab01e
...
...
@@ -803,6 +803,56 @@ static void test_storage_refcount(void)
DeleteFileW
(
filename
);
}
static
void
test_writeclassstg
(
void
)
{
static
const
WCHAR
szPrefix
[]
=
{
's'
,
't'
,
'g'
,
0
};
static
const
WCHAR
szDot
[]
=
{
'.'
,
0
};
WCHAR
filename
[
MAX_PATH
];
IStorage
*
stg
=
NULL
;
HRESULT
r
;
CLSID
temp_cls
;
if
(
!
GetTempFileNameW
(
szDot
,
szPrefix
,
0
,
filename
))
return
;
DeleteFileW
(
filename
);
/* create the file */
r
=
StgCreateDocfile
(
filename
,
STGM_CREATE
|
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
,
0
,
&
stg
);
ok
(
r
==
S_OK
,
"StgCreateDocfile failed
\n
"
);
r
=
ReadClassStg
(
NULL
,
NULL
);
ok
(
r
==
E_INVALIDARG
,
"ReadClassStg should return E_INVALIDARG instead of 0x%08X
\n
"
,
r
);
r
=
ReadClassStg
(
stg
,
NULL
);
ok
(
r
==
E_INVALIDARG
,
"ReadClassStg should return E_INVALIDARG instead of 0x%08X
\n
"
,
r
);
temp_cls
.
Data1
=
0xdeadbeef
;
r
=
ReadClassStg
(
stg
,
&
temp_cls
);
ok
(
r
==
S_OK
,
"ReadClassStg failed with 0x%08X
\n
"
,
r
);
ok
(
IsEqualCLSID
(
&
temp_cls
,
&
CLSID_NULL
),
"ReadClassStg returned wrong clsid
\n
"
);
r
=
WriteClassStg
(
NULL
,
NULL
);
ok
(
r
==
E_INVALIDARG
,
"WriteClassStg should return E_INVALIDARG instead of 0x%08X
\n
"
,
r
);
r
=
WriteClassStg
(
stg
,
NULL
);
ok
(
r
==
STG_E_INVALIDPOINTER
,
"WriteClassStg should return STG_E_INVALIDPOINTER instead of 0x%08X
\n
"
,
r
);
r
=
WriteClassStg
(
stg
,
&
test_stg_cls
);
ok
(
r
==
S_OK
,
"WriteClassStg failed with 0x%08X
\n
"
,
r
);
r
=
ReadClassStg
(
stg
,
&
temp_cls
);
ok
(
r
==
S_OK
,
"ReadClassStg failed with 0x%08X
\n
"
,
r
);
ok
(
IsEqualCLSID
(
&
temp_cls
,
&
test_stg_cls
),
"ReadClassStg returned wrong clsid
\n
"
);
r
=
IStorage_Release
(
stg
);
ok
(
r
==
0
,
"storage not released
\n
"
);
DeleteFileW
(
filename
);
}
static
void
test_streamenum
(
void
)
{
static
const
WCHAR
szPrefix
[]
=
{
's'
,
't'
,
'g'
,
0
};
...
...
@@ -1229,4 +1279,5 @@ START_TEST(storage32)
test_transact
();
test_ReadClassStm
();
test_access
();
test_writeclassstg
();
}
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