49 const char data[] =
"Test String";
59 ok(
hr ==
S_OK,
"Failed to create a stream, hr %#x.\n",
hr);
62 hr = IStream_SetSize(pStream, ull);
69 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_SET,
NULL);
80 hr = IStream_SetSize(pStream, ull);
86 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_CUR,
NULL);
90 ull.
u.HighPart = 0xCAFECAFE;
91 ull.
u.LowPart = 0xCAFECAFE;
94 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_CUR, &ull);
96 ok(ull.
u.LowPart ==
sizeof(
data),
"LowPart set to %d\n", ull.
u.LowPart);
97 ok(ull.
u.HighPart == 0,
"should have set HighPart to 0 instead of %d\n", ull.
u.HighPart);
100 ull.
u.HighPart = 0xCAFECAFE;
101 ull.
u.LowPart = 0xCAFECAFE;
104 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_END+1, &ull);
105 ok(
hr ==
STG_E_SEEKERROR,
"IStream_Seek should have returned STG_E_SEEKERROR instead of 0x%08x\n",
hr);
106 ok(ull.
u.LowPart ==
sizeof(
data),
"LowPart set to %d\n", ull.
u.LowPart);
107 ok(ull.
u.HighPart == 0,
"should not have changed HighPart, got %d\n", ull.
u.HighPart);
110 ull.
u.HighPart = 0xCAFECAFE;
111 ull.
u.LowPart = 0xCAFECAFE;
114 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_SET, &ull);
116 ok(ull.
u.LowPart == 0,
"should have set LowPart to 0 instead of %d\n", ull.
u.LowPart);
117 ok(ull.
u.HighPart == 0,
"should have set HighPart to 0 instead of %d\n", ull.
u.HighPart);
120 ull.
u.HighPart = 0xCAFECAFE;
121 ull.
u.LowPart = 0xCAFECAFE;
124 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_END, &ull);
126 ok(ull.
u.LowPart == 0,
"should have set LowPart to 0 instead of %d\n", ull.
u.LowPart);
127 ok(ull.
u.HighPart == 0,
"should have set HighPart to 0 instead of %d\n", ull.
u.HighPart);
131 ll.u.LowPart =
sizeof(
data);
132 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_SET, &ull);
135 ull.
u.HighPart = 0xCAFECAFE;
136 ull.
u.LowPart = 0xCAFECAFE;
139 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_CUR, &ull);
141 ok(ull.
u.LowPart ==
sizeof(
data),
"LowPart set to %d\n", ull.
u.LowPart);
142 ok(ull.
u.HighPart == 0,
"should have set HighPart to 0 instead of %d\n", ull.
u.HighPart);
146 ll.u.LowPart =
sizeof(
data);
147 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_SET, &ull);
150 ull.
u.HighPart = 0xCAFECAFE;
151 ull.
u.LowPart = 0xCAFECAFE;
154 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_SET, &ull);
156 ok(ull.
u.LowPart == 0,
"should have set LowPart to 0 instead of %d\n", ull.
u.LowPart);
157 ok(ull.
u.HighPart == 0,
"should have set HighPart to 0 instead of %d\n", ull.
u.HighPart);
161 ll.u.LowPart =
sizeof(
data);
162 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_SET, &ull);
165 ull.
u.HighPart = 0xCAFECAFE;
166 ull.
u.LowPart = 0xCAFECAFE;
168 ll.u.LowPart = 0x80000000;
169 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_CUR, &ull);
170 ok(
hr ==
STG_E_SEEKERROR,
"IStream_Seek should have returned STG_E_SEEKERROR instead of 0x%08x\n",
hr);
171 ok(ull.
u.LowPart ==
sizeof(
data),
"LowPart set to %d\n", ull.
u.LowPart);
172 ok(ull.
u.HighPart == 0,
"should have set HighPart to 0 instead of %d\n", ull.
u.HighPart);
176 ll.u.LowPart =
sizeof(
data);
177 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_SET, &ull);
180 ull.
u.HighPart = 0xCAFECAFE;
181 ull.
u.LowPart = 0xCAFECAFE;
184 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_CUR, &ull);
186 ok(ull.
u.LowPart == 0,
"LowPart set to %d\n", ull.
u.LowPart);
187 ok(ull.
u.HighPart == 0,
"should have set HighPart to 0 instead of %d\n", ull.
u.HighPart);
191 ll.u.LowPart =
sizeof(
data);
192 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_SET, &ull);
195 ull.
u.HighPart = 0xCAFECAFE;
196 ull.
u.LowPart = 0xCAFECAFE;
199 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_CUR, &ull);
200 ok(
hr ==
STG_E_SEEKERROR,
"IStream_Seek should have returned STG_E_SEEKERROR instead of 0x%08x\n",
hr);
201 ok(ull.
u.LowPart ==
sizeof(
data),
"LowPart set to %d\n", ull.
u.LowPart);
202 ok(ull.
u.HighPart == 0,
"should have set HighPart to 0 instead of %d\n", ull.
u.HighPart);
206 ll.u.LowPart =
sizeof(
data);
207 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_SET, &ull);
210 ull.
u.HighPart = 0xCAFECAFE;
211 ull.
u.LowPart = 0xCAFECAFE;
213 ll.u.LowPart = 0x80000000 -
sizeof(
data);
214 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_CUR, &ull);
216 ok(ull.
u.LowPart == 0x80000000,
"LowPart set to %d\n", ull.
u.LowPart);
217 ok(ull.
u.HighPart == 0,
"should have set HighPart to 0 instead of %d\n", ull.
u.HighPart);
221 ll.u.LowPart =
sizeof(
data);
222 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_SET, &ull);
225 ull.
u.HighPart = 0xCAFECAFE;
226 ull.
u.LowPart = 0xCAFECAFE;
228 ll.u.LowPart = 0x80000000;
229 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_SET, &ull);
230 ok(
hr ==
STG_E_SEEKERROR,
"IStream_Seek should have returned STG_E_SEEKERROR instead of 0x%08x\n",
hr);
231 ok(ull.
u.LowPart ==
sizeof(
data),
"LowPart set to %d\n", ull.
u.LowPart);
232 ok(ull.
u.HighPart == 0,
"should have set HighPart to 0 instead of %d\n", ull.
u.HighPart);
235 ull.
u.HighPart = 0xCAFECAFE;
236 ull.
u.LowPart = 0xCAFECAFE;
238 ll.u.LowPart = 0x7FFFFFFF;
239 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_SET, &ull);
241 ok(ull.
u.LowPart == 0x7FFFFFFF,
"should have set LowPart to 0x7FFFFFFF instead of %08x\n", ull.
u.LowPart);
242 ok(ull.
u.HighPart == 0,
"should have set HighPart to 0 instead of %d\n", ull.
u.HighPart);
247 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_SET, &ull);
250 ull.
u.HighPart = 0xCAFECAFE;
251 ull.
u.LowPart = 0xCAFECAFE;
253 ll.u.LowPart = 0x7FFFFFFF;
254 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_CUR, &ull);
256 ok(ull.
u.LowPart == 0x7FFFFFFF,
"should have set LowPart to 0x7FFFFFFF instead of %08x\n", ull.
u.LowPart);
257 ok(ull.
u.HighPart == 0,
"should have set HighPart to 0 instead of %d\n", ull.
u.HighPart);
260 ull.
u.HighPart = 0xCAFECAFE;
261 ull.
u.LowPart = 0xCAFECAFE;
264 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_CUR, &ull);
266 ok(ull.
u.LowPart == 0x80000008,
"should have set LowPart to 0x80000008 instead of %08x\n", ull.
u.LowPart);
267 ok(ull.
u.HighPart == 0,
"should have set HighPart to 0 instead of %d\n", ull.
u.HighPart);
270 ull.
u.HighPart = 0xCAFECAFE;
271 ull.
u.LowPart = 0xCAFECAFE;
273 ll.u.LowPart = 0x7FFFFFFF;
274 hr = IStream_Seek(pStream,
ll, STREAM_SEEK_CUR, &ull);
277 ok(ull.
u.LowPart == 0x00000007,
"should have set LowPart to 0x00000007 instead of %08x\n", ull.
u.LowPart);
279 ok(ull.
u.LowPart == 0x80000008,
"should have set LowPart to 0x80000008 instead of %08x\n", ull.
u.LowPart);
280 ok(ull.
u.HighPart == 0,
"should have set HighPart to 0 instead of %d\n", ull.
u.HighPart);
282 hr = IStream_Commit(pStream, STGC_DEFAULT);
285 hr = IStream_Revert(pStream);
288 hr = IStream_LockRegion(pStream, ull, ull, LOCK_WRITE);
291 hr = IStream_Stat(pStream, &statstg, STATFLAG_DEFAULT);
293 ok(statstg.type == STGTY_STREAM,
"statstg.type should have been STGTY_STREAM instead of %d\n", statstg.type);
298 hr = IStream_SetSize(pStream, ull);
300 "IStream_SetSize with large size should have returned E_OUTOFMEMORY instead of 0x%08x\n",
hr);
302 IStream_Release(pStream);
struct _ULARGE_INTEGER::@3916 u
#define ok_ole_success(hr, func)
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
#define STG_E_INVALIDFUNCTION
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)