~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/ole32/tests/hglobalstream.c

Version: ~ [ wine-1.1.41 ] ~ [ wine-1.1.40 ] ~ [ wine-1.1.39 ] ~ [ wine-1.1.38 ] ~ [ wine-1.1.37 ] ~ [ wine-1.1.36 ] ~ [ wine-1.1.35 ] ~ [ wine-1.1.34 ] ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * Stream on HGLOBAL Tests
  3  *
  4  * Copyright 2006 Robert Shearman (for CodeWeavers)
  5  *
  6  * This library is free software; you can redistribute it and/or
  7  * modify it under the terms of the GNU Lesser General Public
  8  * License as published by the Free Software Foundation; either
  9  * version 2.1 of the License, or (at your option) any later version.
 10  *
 11  * This library is distributed in the hope that it will be useful,
 12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14  * Lesser General Public License for more details.
 15  *
 16  * You should have received a copy of the GNU Lesser General Public
 17  * License along with this library; if not, write to the Free Software
 18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 19  */
 20 
 21 #define COBJMACROS
 22 
 23 #include <stdarg.h>
 24 
 25 #include "windef.h"
 26 #include "winbase.h"
 27 #include "objbase.h"
 28 
 29 #include "wine/test.h"
 30 
 31 #define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
 32 
 33 static char const * const *expected_method_list;
 34 
 35 #define CHECK_EXPECTED_METHOD(method_name) \
 36 do { \
 37     ok(*expected_method_list != NULL, "Extra method %s called\n", method_name); \
 38         if (*expected_method_list) \
 39         { \
 40             ok(!strcmp(*expected_method_list, method_name), "Expected %s to be called instead of %s\n", \
 41                *expected_method_list, method_name); \
 42                    expected_method_list++; \
 43         } \
 44 } while(0)
 45 
 46 static void test_streamonhglobal(IStream *pStream)
 47 {
 48     const char data[] = "Test String";
 49     ULARGE_INTEGER ull;
 50     LARGE_INTEGER ll;
 51     char buffer[128];
 52     ULONG read;
 53     STATSTG statstg;
 54     HRESULT hr;
 55 
 56     ull.QuadPart = sizeof(data);
 57     hr = IStream_SetSize(pStream, ull);
 58     ok_ole_success(hr, "IStream_SetSize");
 59 
 60     hr = IStream_Write(pStream, data, sizeof(data), NULL);
 61     ok_ole_success(hr, "IStream_Write");
 62 
 63     ll.QuadPart = 0;
 64     hr = IStream_Seek(pStream, ll, STREAM_SEEK_SET, NULL);
 65     ok_ole_success(hr, "IStream_Seek");
 66 
 67     /* should return S_OK, not S_FALSE */
 68     hr = IStream_Read(pStream, buffer, sizeof(buffer), &read);
 69     ok_ole_success(hr, "IStream_Read");
 70     ok(read == sizeof(data), "IStream_Read returned read %d\n", read);
 71 
 72     /* ignores HighPart */
 73     ull.u.HighPart = -1;
 74     ull.u.LowPart = 0;
 75     hr = IStream_SetSize(pStream, ull);
 76     ok_ole_success(hr, "IStream_SetSize");
 77 
 78     /* IStream_Seek -- NULL position argument */
 79     ll.u.HighPart = 0;
 80     ll.u.LowPart = 0;
 81     hr = IStream_Seek(pStream, ll, STREAM_SEEK_CUR, NULL);
 82     ok_ole_success(hr, "IStream_Seek");
 83 
 84     /* IStream_Seek -- valid position argument (seek from current position) */
 85     ull.u.HighPart = 0xCAFECAFE;
 86     ull.u.LowPart = 0xCAFECAFE;
 87     ll.u.HighPart = 0;
 88     ll.u.LowPart = 0;
 89     hr = IStream_Seek(pStream, ll, STREAM_SEEK_CUR, &ull);
 90     ok_ole_success(hr, "IStream_Seek");
 91     ok(ull.u.LowPart == sizeof(data), "LowPart set to %d\n", ull.u.LowPart);
 92     ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
 93 
 94     /* IStream_Seek -- invalid seek argument */
 95     ull.u.HighPart = 0xCAFECAFE;
 96     ull.u.LowPart = 0xCAFECAFE;
 97     ll.u.HighPart = 0;
 98     ll.u.LowPart = 123;
 99     hr = IStream_Seek(pStream, ll, STREAM_SEEK_END+1, &ull);
100     ok(hr == STG_E_SEEKERROR, "IStream_Seek should have returned STG_E_SEEKERROR instead of 0x%08x\n", hr);
101     ok(ull.u.LowPart == sizeof(data), "LowPart set to %d\n", ull.u.LowPart);
102     ok(ull.u.HighPart == 0, "should not have changed HighPart, got %d\n", ull.u.HighPart);
103 
104     /* IStream_Seek -- valid position argument (seek to beginning) */
105     ull.u.HighPart = 0xCAFECAFE;
106     ull.u.LowPart = 0xCAFECAFE;
107     ll.u.HighPart = 0;
108     ll.u.LowPart = 0;
109     hr = IStream_Seek(pStream, ll, STREAM_SEEK_SET, &ull);
110     ok_ole_success(hr, "IStream_Seek");
111     ok(ull.u.LowPart == 0, "should have set LowPart to 0 instead of %d\n", ull.u.LowPart);
112     ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
113 
114     /* IStream_Seek -- valid position argument (seek to end) */
115     ull.u.HighPart = 0xCAFECAFE;
116     ull.u.LowPart = 0xCAFECAFE;
117     ll.u.HighPart = 0;
118     ll.u.LowPart = 0;
119     hr = IStream_Seek(pStream, ll, STREAM_SEEK_END, &ull);
120     ok_ole_success(hr, "IStream_Seek");
121     ok(ull.u.LowPart == 0, "should have set LowPart to 0 instead of %d\n", ull.u.LowPart);
122     ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
123 
124     /* IStream_Seek -- ignore HighPart in the move value (seek from current position) */
125     ll.u.HighPart = 0;
126     ll.u.LowPart = sizeof(data);
127     hr = IStream_Seek(pStream, ll, STREAM_SEEK_SET, &ull);
128     ok_ole_success(hr, "IStream_Seek");
129 
130     ull.u.HighPart = 0xCAFECAFE;
131     ull.u.LowPart = 0xCAFECAFE;
132     ll.u.HighPart = -1;
133     ll.u.LowPart = 0;
134     hr = IStream_Seek(pStream, ll, STREAM_SEEK_CUR, &ull);
135     ok_ole_success(hr, "IStream_Seek");
136     ok(ull.u.LowPart == sizeof(data), "LowPart set to %d\n", ull.u.LowPart);
137     ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
138 
139     /* IStream_Seek -- ignore HighPart in the move value (seek to beginning) */
140     ll.u.HighPart = 0;
141     ll.u.LowPart = sizeof(data);
142     hr = IStream_Seek(pStream, ll, STREAM_SEEK_SET, &ull);
143     ok_ole_success(hr, "IStream_Seek");
144 
145     ull.u.HighPart = 0xCAFECAFE;
146     ull.u.LowPart = 0xCAFECAFE;
147     ll.u.HighPart = -1;
148     ll.u.LowPart = 0;
149     hr = IStream_Seek(pStream, ll, STREAM_SEEK_SET, &ull);
150     ok_ole_success(hr, "IStream_Seek");
151     ok(ull.u.LowPart == 0, "should have set LowPart to 0 instead of %d\n", ull.u.LowPart);
152     ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
153 
154     /* IStream_Seek -- invalid LowPart value (seek from current position) */
155     ll.u.HighPart = 0;
156     ll.u.LowPart = sizeof(data);
157     hr = IStream_Seek(pStream, ll, STREAM_SEEK_SET, &ull);
158     ok_ole_success(hr, "IStream_Seek");
159 
160     ull.u.HighPart = 0xCAFECAFE;
161     ull.u.LowPart = 0xCAFECAFE;
162     ll.u.HighPart = 0;
163     ll.u.LowPart = 0x80000000;
164     hr = IStream_Seek(pStream, ll, STREAM_SEEK_CUR, &ull);
165     ok(hr == STG_E_SEEKERROR, "IStream_Seek should have returned STG_E_SEEKERROR instead of 0x%08x\n", hr);
166     ok(ull.u.LowPart == sizeof(data), "LowPart set to %d\n", ull.u.LowPart);
167     ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
168 
169     /* IStream_Seek -- invalid LowPart value (seek to beginning) */
170     ll.u.HighPart = 0;
171     ll.u.LowPart = sizeof(data);
172     hr = IStream_Seek(pStream, ll, STREAM_SEEK_SET, &ull);
173     ok_ole_success(hr, "IStream_Seek");
174 
175     ull.u.HighPart = 0xCAFECAFE;
176     ull.u.LowPart = 0xCAFECAFE;
177     ll.u.HighPart = 0;
178     ll.u.LowPart = 0x80000000;
179     hr = IStream_Seek(pStream, ll, STREAM_SEEK_SET, &ull);
180     ok(hr == STG_E_SEEKERROR, "IStream_Seek should have returned STG_E_SEEKERROR instead of 0x%08x\n", hr);
181     ok(ull.u.LowPart == sizeof(data), "LowPart set to %d\n", ull.u.LowPart);
182     ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
183 
184     /* IStream_Seek -- valid LowPart value (seek to beginning) */
185     ull.u.HighPart = 0xCAFECAFE;
186     ull.u.LowPart = 0xCAFECAFE;
187     ll.u.HighPart = 0;
188     ll.u.LowPart = 0x7FFFFFFF;
189     hr = IStream_Seek(pStream, ll, STREAM_SEEK_SET, &ull);
190     ok_ole_success(hr, "IStream_Seek");
191     ok(ull.u.LowPart == 0x7FFFFFFF, "should have set LowPart to 0x7FFFFFFF instead of %08x\n", ull.u.LowPart);
192     ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
193 
194     /* IStream_Seek -- valid LowPart value (seek from current position) */
195     ll.u.HighPart = 0;
196     ll.u.LowPart = 0;
197     hr = IStream_Seek(pStream, ll, STREAM_SEEK_SET, &ull);
198     ok_ole_success(hr, "IStream_Seek");
199 
200     ull.u.HighPart = 0xCAFECAFE;
201     ull.u.LowPart = 0xCAFECAFE;
202     ll.u.HighPart = 0;
203     ll.u.LowPart = 0x7FFFFFFF;
204     hr = IStream_Seek(pStream, ll, STREAM_SEEK_CUR, &ull);
205     ok_ole_success(hr, "IStream_Seek");
206     ok(ull.u.LowPart == 0x7FFFFFFF, "should have set LowPart to 0x7FFFFFFF instead of %08x\n", ull.u.LowPart);
207     ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
208 
209     /* IStream_Seek -- second seek allows you to go past 0x7FFFFFFF size */
210     ull.u.HighPart = 0xCAFECAFE;
211     ull.u.LowPart = 0xCAFECAFE;
212     ll.u.HighPart = 0;
213     ll.u.LowPart = 9;
214     hr = IStream_Seek(pStream, ll, STREAM_SEEK_CUR, &ull);
215     ok_ole_success(hr, "IStream_Seek");
216     ok(ull.u.LowPart == 0x80000008, "should have set LowPart to 0x80000008 instead of %08x\n", ull.u.LowPart);
217     ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
218 
219     /* IStream_Seek -- seek wraps position/size on integer overflow */
220     ull.u.HighPart = 0xCAFECAFE;
221     ull.u.LowPart = 0xCAFECAFE;
222     ll.u.HighPart = 0;
223     ll.u.LowPart = 0x7FFFFFFF;
224     hr = IStream_Seek(pStream, ll, STREAM_SEEK_CUR, &ull);
225     ok_ole_success(hr, "IStream_Seek");
226     ok(ull.u.LowPart == 0x00000007, "should have set LowPart to 0x00000007 instead of %08x\n", ull.u.LowPart);
227     ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
228 
229     hr = IStream_Commit(pStream, STGC_DEFAULT);
230     ok_ole_success(hr, "IStream_Commit");
231 
232     hr = IStream_Revert(pStream);
233     ok_ole_success(hr, "IStream_Revert");
234 
235     hr = IStream_LockRegion(pStream, ull, ull, LOCK_WRITE);
236     ok(hr == STG_E_INVALIDFUNCTION, "IStream_LockRegion should have returned STG_E_INVALIDFUNCTION instead of 0x%08x\n", hr);
237 
238     hr = IStream_Stat(pStream, &statstg, STATFLAG_DEFAULT);
239     ok_ole_success(hr, "IStream_Stat");
240     ok(statstg.type == STGTY_STREAM, "statstg.type should have been STGTY_STREAM instead of %d\n", statstg.type);
241 
242     /* test OOM condition */
243     ull.u.HighPart = -1;
244     ull.u.LowPart = -1;
245     hr = IStream_SetSize(pStream, ull);
246     ok(hr == E_OUTOFMEMORY || broken(hr == S_OK), /* win9x */
247        "IStream_SetSize with large size should have returned E_OUTOFMEMORY instead of 0x%08x\n", hr);
248 }
249 
250 static HRESULT WINAPI TestStream_QueryInterface(IStream *iface, REFIID riid, void **ppv)
251 {
252     if (IsEqualIID(riid, &IID_IUnknown) ||
253         IsEqualIID(riid, &IID_ISequentialStream) ||
254         IsEqualIID(riid, &IID_IStream))
255     {
256         *ppv = iface;
257         IUnknown_AddRef(iface);
258         return S_OK;
259     }
260     *ppv = NULL;
261     return E_NOINTERFACE;
262 }
263 
264 static ULONG WINAPI TestStream_AddRef(IStream *iface)
265 {
266     return 2;
267 }
268 
269 static ULONG WINAPI TestStream_Release(IStream *iface)
270 {
271     return 1;
272 }
273 
274 static HRESULT WINAPI TestStream_Read(IStream *iface, void *pv, ULONG cb, ULONG *pcbRead)
275 {
276     CHECK_EXPECTED_METHOD("TestStream_Read");
277     return E_NOTIMPL;
278 }
279 
280 static HRESULT WINAPI TestStream_Write(IStream *iface, const void *pv, ULONG cb, ULONG *pcbWritten)
281 {
282     CHECK_EXPECTED_METHOD("TestStream_Write");
283     *pcbWritten = 5;
284     return S_OK;
285 }
286 
287 static HRESULT WINAPI TestStream_Seek(IStream *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
288 {
289     CHECK_EXPECTED_METHOD("TestStream_Seek");
290     return E_NOTIMPL;
291 }
292 
293 static HRESULT WINAPI TestStream_SetSize(IStream *iface, ULARGE_INTEGER libNewSize)
294 {
295     CHECK_EXPECTED_METHOD("TestStream_SetSize");
296     return E_NOTIMPL;
297 }
298 
299 static HRESULT WINAPI TestStream_CopyTo(IStream *iface, IStream *pStream, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
300 {
301     CHECK_EXPECTED_METHOD("TestStream_CopyTo");
302     return E_NOTIMPL;
303 }
304 
305 static HRESULT WINAPI TestStream_Commit(IStream *iface, DWORD grfCommitFlags)
306 {
307     CHECK_EXPECTED_METHOD("TestStream_Commit");
308     return E_NOTIMPL;
309 }
310 
311 static HRESULT WINAPI TestStream_Revert(IStream *iface)
312 {
313     CHECK_EXPECTED_METHOD("TestStream_Revert");
314     return E_NOTIMPL;
315 }
316 
317 static HRESULT WINAPI TestStream_LockRegion(IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
318 {
319     CHECK_EXPECTED_METHOD("TestStream_LockRegion");
320     return E_NOTIMPL;
321 }
322 
323 static HRESULT WINAPI TestStream_UnlockRegion(IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
324 {
325     CHECK_EXPECTED_METHOD("TestStream_UnlockRegion");
326     return E_NOTIMPL;
327 }
328 
329 static HRESULT WINAPI TestStream_Stat(IStream *iface, STATSTG *pstatstg, DWORD grfStatFlag)
330 {
331     CHECK_EXPECTED_METHOD("TestStream_Stat");
332     return E_NOTIMPL;
333 }
334 
335 static HRESULT WINAPI TestStream_Clone(IStream *iface, IStream **pStream)
336 {
337     CHECK_EXPECTED_METHOD("TestStream_Clone");
338     return E_NOTIMPL;
339 }
340 
341 static /*const*/ IStreamVtbl StreamVtbl =
342 {
343     TestStream_QueryInterface,
344     TestStream_AddRef,
345     TestStream_Release,
346     TestStream_Read,
347     TestStream_Write,
348     TestStream_Seek,
349     TestStream_SetSize,
350     TestStream_CopyTo,
351     TestStream_Commit,
352     TestStream_Revert,
353     TestStream_LockRegion,
354     TestStream_UnlockRegion,
355     TestStream_Stat,
356     TestStream_Clone
357 };
358 
359 static IStream Test_Stream = { &StreamVtbl };
360 
361 static void test_copyto(void)
362 {
363     IStream *pStream, *pStream2;
364     HRESULT hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
365     static const char szHello[] = "Hello";
366     ULARGE_INTEGER cb;
367     static const char *methods_copyto[] =
368     {
369         "TestStream_Write",
370         NULL
371     };
372     ULONG written;
373     ULARGE_INTEGER ullRead;
374     ULARGE_INTEGER ullWritten;
375     ULARGE_INTEGER libNewPosition;
376     static const LARGE_INTEGER llZero;
377     char buffer[15];
378 
379     expected_method_list = methods_copyto;
380 
381     hr = IStream_Write(pStream, szHello, sizeof(szHello), &written);
382     ok_ole_success(hr, "IStream_Write");
383     ok(written == sizeof(szHello), "only %d bytes written\n", written);
384 
385     hr = IStream_Seek(pStream, llZero, STREAM_SEEK_SET, NULL);
386     ok_ole_success(hr, "IStream_Seek");
387 
388     cb.QuadPart = sizeof(szHello);
389     hr = IStream_CopyTo(pStream, &Test_Stream, cb, &ullRead, &ullWritten);
390     ok(ullWritten.QuadPart == 5, "ullWritten was %d instead\n", (ULONG)ullWritten.QuadPart);
391     ok(ullRead.QuadPart == sizeof(szHello), "only %d bytes read\n", (ULONG)ullRead.QuadPart);
392     ok_ole_success(hr, "IStream_CopyTo");
393 
394     ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
395 
396     hr = IStream_Clone(pStream, &pStream2);
397     ok_ole_success(hr, "IStream_Clone");
398 
399     hr = IStream_Seek(pStream2, llZero, STREAM_SEEK_CUR, &libNewPosition);
400     ok_ole_success(hr, "IStream_Seek");
401     ok(libNewPosition.QuadPart == sizeof(szHello), "libNewPosition wasn't set correctly for the cloned stream\n");
402 
403     hr = IStream_Seek(pStream2, llZero, STREAM_SEEK_SET, NULL);
404     ok_ole_success(hr, "IStream_Seek");
405 
406     hr = IStream_Read(pStream2, buffer, sizeof(buffer), NULL);
407     ok_ole_success(hr, "IStream_Read");
408     ok(!strcmp(buffer, szHello), "read data \"%s\" didn't match originally written data\n", buffer);
409 
410     IStream_Release(pStream2);
411     IStream_Release(pStream);
412 }
413 
414 static void test_freed_hglobal(void)
415 {
416     static const char teststring[] = "this is a test string";
417     HRESULT hr;
418     IStream *pStream;
419     HGLOBAL hglobal;
420     char *p;
421     char buffer[sizeof(teststring) + 8];
422     ULARGE_INTEGER ull;
423     ULONG read, written;
424 
425     hglobal = GlobalAlloc(GMEM_DDESHARE|GMEM_NODISCARD|GMEM_MOVEABLE, strlen(teststring) + 1);
426     ok(hglobal != NULL, "GlobalAlloc failed with error %d\n", GetLastError());
427     p = GlobalLock(hglobal);
428     strcpy(p, teststring);
429     GlobalUnlock(hglobal);
430 
431     hr = CreateStreamOnHGlobal(hglobal, FALSE, &pStream);
432     ok_ole_success(hr, "CreateStreamOnHGlobal");
433 
434     hr = IStream_Read(pStream, buffer, sizeof(buffer), &read);
435     ok_ole_success(hr, "IStream_Read");
436     ok(!strcmp(buffer, teststring), "buffer data %s differs\n", buffer);
437     ok(read == sizeof(teststring) ||
438        broken(read == ((sizeof(teststring) + 3) & ~3)), /* win9x rounds the size */
439        "read should be sizeof(teststring) instead of %d\n", read);
440 
441     GlobalFree(hglobal);
442 
443     memset(buffer, 0, sizeof(buffer));
444     read = -1;
445     hr = IStream_Read(pStream, buffer, sizeof(buffer), &read);
446     ok_ole_success(hr, "IStream_Read");
447     ok(buffer[0] == 0, "buffer data should be untouched\n");
448     ok(read == 0, "read should be 0 instead of %d\n", read);
449 
450     ull.QuadPart = sizeof(buffer);
451     hr = IStream_SetSize(pStream, ull);
452     ok(hr == E_OUTOFMEMORY, "IStream_SetSize with invalid HGLOBAL should return E_OUTOFMEMORY instead of 0x%08x\n", hr);
453 
454     hr = IStream_Write(pStream, buffer, sizeof(buffer), &written);
455     ok(hr == E_OUTOFMEMORY, "IStream_Write with invalid HGLOBAL should return E_OUTOFMEMORY instead of 0x%08x\n", hr);
456     ok(written == 0, "written should be 0 instead of %d\n", written);
457 
458     IStream_Release(pStream);
459 }
460 
461 START_TEST(hglobalstream)
462 {
463     HRESULT hr;
464     IStream *pStream;
465 
466     hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
467     ok_ole_success(hr, "CreateStreamOnHGlobal");
468 
469     test_streamonhglobal(pStream);
470     IStream_Release(pStream);
471     test_copyto();
472     test_freed_hglobal();
473 }
474 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.