Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
e10103e3
Commit
e10103e3
authored
Sep 11, 2006
by
Robert Shearman
Committed by
Alexandre Julliard
Sep 11, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Add tests for the stream object returned by CreateStreamOnHGlobal.
parent
944a7788
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
103 additions
and
0 deletions
+103
-0
Makefile.in
dlls/ole32/tests/Makefile.in
+1
-0
hglobalstream.c
dlls/ole32/tests/hglobalstream.c
+102
-0
No files found.
dlls/ole32/tests/Makefile.in
View file @
e10103e3
...
...
@@ -9,6 +9,7 @@ EXTRALIBS = -luuid
CTESTS
=
\
clipboard.c
\
compobj.c
\
hglobalstream.c
\
marshal.c
\
moniker.c
\
ole2.c
\
...
...
dlls/ole32/tests/hglobalstream.c
0 → 100644
View file @
e10103e3
/*
* Stream on HGLOBAL Tests
*
* Copyright 2006 Robert Shearman (for CodeWeavers)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wine/test.h"
#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08lx\n", hr)
static
void
test_streamonhglobal
(
IStream
*
pStream
)
{
const
char
data
[]
=
"Test String"
;
ULARGE_INTEGER
ull
;
LARGE_INTEGER
ll
;
char
buffer
[
128
];
ULONG
read
;
STATSTG
statstg
;
HRESULT
hr
;
ull
.
QuadPart
=
sizeof
(
data
);
hr
=
IStream_SetSize
(
pStream
,
ull
);
ok_ole_success
(
hr
,
"IStream_SetSize"
);
hr
=
IStream_Write
(
pStream
,
data
,
sizeof
(
data
),
NULL
);
ok_ole_success
(
hr
,
"IStream_Write"
);
ll
.
QuadPart
=
0
;
hr
=
IStream_Seek
(
pStream
,
ll
,
STREAM_SEEK_SET
,
NULL
);
ok_ole_success
(
hr
,
"IStream_Seek"
);
/* should return S_OK, not S_FALSE */
hr
=
IStream_Read
(
pStream
,
buffer
,
sizeof
(
buffer
),
&
read
);
todo_wine
{
ok_ole_success
(
hr
,
"IStream_Read"
);
}
ok
(
read
==
sizeof
(
data
),
"IStream_Read returned read %ld instead of %d
\n
"
,
read
,
sizeof
(
data
));
/* ignores HighPart */
ull
.
HighPart
=
-
1
;
ull
.
LowPart
=
0
;
hr
=
IStream_SetSize
(
pStream
,
ull
);
todo_wine
{
ok_ole_success
(
hr
,
"IStream_SetSize"
);
}
hr
=
IStream_Commit
(
pStream
,
STGC_DEFAULT
);
ok_ole_success
(
hr
,
"IStream_Commit"
);
hr
=
IStream_Revert
(
pStream
);
ok_ole_success
(
hr
,
"IStream_Revert"
);
hr
=
IStream_LockRegion
(
pStream
,
ull
,
ull
,
LOCK_WRITE
);
todo_wine
{
ok
(
hr
==
STG_E_INVALIDFUNCTION
,
"IStream_LockRegion should have returned STG_E_INVALIDFUNCTION instead of 0x%08lx
\n
"
,
hr
);
}
hr
=
IStream_Stat
(
pStream
,
&
statstg
,
STATFLAG_DEFAULT
);
ok_ole_success
(
hr
,
"IStream_Stat"
);
ok
(
statstg
.
type
==
STGTY_STREAM
,
"statstg.type should have been STGTY_STREAM instead of %ld
\n
"
,
statstg
.
type
);
/* test OOM condition */
ull
.
HighPart
=
-
1
;
ull
.
LowPart
=
-
1
;
hr
=
IStream_SetSize
(
pStream
,
ull
);
todo_wine
{
ok
(
hr
==
E_OUTOFMEMORY
,
"IStream_SetSize with large size should have returned E_OUTOFMEMORY instead of 0x%08lx
\n
"
,
hr
);
}
}
START_TEST
(
hglobalstream
)
{
HRESULT
hr
;
IStream
*
pStream
;
hr
=
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
pStream
);
ok_ole_success
(
hr
,
"CreateStreamOnHGlobal"
);
test_streamonhglobal
(
pStream
);
}
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