#include <stdarg.h>
#include <stdio.h>
#include "wine/test.h"
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "shlwapi.h"
Go to the source code of this file.
◆ COBJMACROS
◆ START_TEST()
Definition at line 774 of file istream.c.
775{
776 static const DWORD stgm_access[] = {
780 };
781
782 static const DWORD stgm_sharing[] = {
783 0,
788 };
789
790 static const DWORD stgm_flags[] = {
791 0,
798 };
799
801
806
809 }
810 }
811
814}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
static void test_SHCreateStreamOnFileEx_CopyTo(void)
static void test_SHCreateStreamOnFileW(DWORD mode, DWORD stgm)
static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
static void test_SHCreateMemStream(void)
static void test_SHCreateStreamOnFileA(DWORD mode, DWORD stgm)
#define STGM_SHARE_DENY_NONE
#define STGM_SHARE_EXCLUSIVE
#define STGM_DELETEONRELEASE
#define STGM_SHARE_DENY_WRITE
#define STGM_SHARE_DENY_READ
◆ test_IStream_invalid_operations()
Definition at line 31 of file istream.c.
32{
41
42 U(uzero).HighPart = 0;
48
49
50
51
52
55
58
61
64
65
66
67
68
71 {
73 "expected STG_E_ACCESSDENIED, got 0x%08x\n",
ret);
74 }
75 else
77
82 "expected STG_E_ACCESSDENIED, got 0x%08x\n",
ret);
83 else
85
90 "expected STG_E_ACCESSDENIED, got 0x%08x\n",
ret);
91 else
93
98 "expected STG_E_ACCESSDENIED, got 0x%08x\n",
ret);
99 else
101
106 "expected STG_E_ACCESSDENIED, got 0x%08x\n",
ret);
107 else
109
110
111
114
117 "expected E_INVALIDARG, got 0x%08x\n",
ret);
118
119
120
123
125 ret = IStream_CopyTo(
stream, clone, uzero, &uret, &uret);
127
130
133
136
137
138
139 ret = IStream_Commit(
stream, STGC_DEFAULT);
141
142
143
146
147
148
149 ret = IStream_LockRegion(
stream, uzero, uzero, 0);
151 "expected E_NOTIMPL or S_OK, got 0x%08x\n",
ret);
152
153
154
156 ret = IStream_UnlockRegion(
stream, uzero, uzero, 0);
158 } else {
159 ret = IStream_UnlockRegion(
stream, uzero, uzero, 0);
161
162 ret = IStream_UnlockRegion(
stream, uzero, uzero, 0);
164 }
165
166
167
170 "expected STG_E_INVALIDPOINTER or E_NOTIMPL, got 0x%08x\n",
ret);
171
172
173
174
175
179 ok(clone ==
NULL,
"expected a NULL IStream object, got %p\n",
stream);
180
181 if (clone) {
182 refcount = IStream_Release(clone);
183 ok(refcount == 0,
"expected 0, got %d\n", refcount);
184 }
185}
char * strcpy(char *DstString, const char *SrcString)
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
#define STG_E_INVALIDPOINTER
#define STG_E_LOCKVIOLATION
#define STG_E_ACCESSDENIED
Referenced by test_SHCreateStreamOnFileA(), test_SHCreateStreamOnFileEx(), and test_SHCreateStreamOnFileW().
◆ test_SHCreateMemStream()
static void test_SHCreateMemStream |
( |
void |
| ) |
|
|
static |
Definition at line 736 of file istream.c.
737{
738 static const BYTE initial[10];
743
747
751
754
755 hr = IStream_QueryInterface(
stream, &IID_ISequentialStream, (
void **)&unk);
758 if (unk)
759 IUnknown_Release(unk);
760
764
765 hr = IStream_Clone(
stream, &stream2);
769 IStream_Release(stream2);
770
772}
static unsigned char buff[32768]
IStream *WINAPI SHCreateMemStream(const BYTE *lpbData, UINT dwDataLen)
Referenced by START_TEST().
◆ test_SHCreateStreamOnFileA()
Definition at line 283 of file istream.c.
284{
289 static const CHAR testA_txt[] =
"\\testA.txt";
290
291 trace(
"SHCreateStreamOnFileA: testing mode %d, STGM flags %08x\n",
mode, stgm);
292
293
296
297
298
303 return;
304 }
305
308 "SHCreateStreamOnFileA: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) "
309 "or HRESULT_FROM_WIN32(ERROR_BAD_PATHNAME), got 0x%08x\n",
ret);
310 ok(
stream ==
NULL,
"SHCreateStreamOnFileA: expected a NULL IStream object, got %p\n",
stream);
311
312if (0)
313{
316}
317
321 ok(
stream ==
NULL,
"SHCreateStreamOnFileA: expected a NULL IStream object, got %p\n",
stream);
322
326 ok(
stream ==
NULL,
"SHCreateStreamOnFileA: expected a NULL IStream object, got %p\n",
stream);
327
331 ok(
stream ==
NULL,
"SHCreateStreamOnFileA: expected a NULL IStream object, got %p\n",
stream);
332
333
334
338 ok(
stream ==
NULL,
"SHCreateStreamOnFileA: expected a NULL IStream object, got %p\n",
stream);
339
342 ok(
ret ==
S_OK,
"SHCreateStreamOnFileA: expected S_OK, got 0x%08x\n",
ret);
343 ok(
stream !=
NULL,
"SHCreateStreamOnFileA: expected a valid IStream object, got NULL\n");
344
348
349 refcount = IStream_Release(
stream);
350 ok(refcount == 0,
"SHCreateStreamOnFileA: expected 0, got %d\n", refcount);
351 }
352
353
354
355
356
359 ok(
ret ==
S_OK,
"SHCreateStreamOnFileA: expected S_OK, got 0x%08x\n",
ret);
360 ok(
stream !=
NULL,
"SHCreateStreamOnFileA: expected a valid IStream object, got NULL\n");
361
364
365 refcount = IStream_Release(
stream);
366 ok(refcount == 0,
"SHCreateStreamOnFileA: expected 0, got %d\n", refcount);
367 }
368
371 ok(
ret ==
S_OK,
"SHCreateStreamOnFileA: expected S_OK, got 0x%08x\n",
ret);
372 ok(
stream !=
NULL,
"SHCreateStreamOnFileA: expected a valid IStream object, got NULL\n");
373
376
379
380 refcount = IStream_Release(
stream);
381 ok(refcount == 0,
"SHCreateStreamOnFileA: expected 0, got %d\n", refcount);
382
384 ok(delret,
"SHCreateStreamOnFileA: could not delete file '%s', got error %d\n",
386 }
387}
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
HRESULT WINAPI SHCreateStreamOnFileA(LPCSTR lpszPath, DWORD dwMode, IStream **lppStream)
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
#define ERROR_FILE_NOT_FOUND
static IBackgroundCopyFile * test_file
static void test_stream_qi(IStream *stream)
static void test_stream_read_write(IStream *stream, DWORD mode)
static void test_IStream_invalid_operations(IStream *stream, DWORD mode)
DWORD WINAPI GetLastError(void)
#define ERROR_PATH_NOT_FOUND
#define ERROR_BAD_PATHNAME
#define HRESULT_FROM_WIN32(x)
Referenced by START_TEST().
◆ test_SHCreateStreamOnFileEx()
Definition at line 503 of file istream.c.
504{
511 static const CHAR testEx_txt[] =
"\\testEx.txt";
513
515 trace(
"SHCreateStreamOnFileEx: testing mode %d, STGM flags %08x\n",
mode, stgm);
516
517
521
522
523
524 if (0)
525 {
526
531 "SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) or E_INVALIDARG, got 0x%08x\n",
ret);
532 ok(
stream ==
NULL,
"SHCreateStreamOnFileEx: expected a NULL IStream object, got %p\n",
stream);
533 }
534
538 win_skip(
"File probably locked by Anti-Virus/Spam software, trying again\n");
541 }
544 "SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) or "
545 "HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got 0x%08x\n",
ret);
546
547 ok(
stream ==
NULL,
"SHCreateStreamOnFileEx: expected a NULL IStream object, got %p\n",
stream);
548
549 if (0)
550 {
551
554 }
555
556
557
562 "SHCreateStreamOnFileEx: expected E_INVALIDARG or HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got 0x%08x\n",
ret);
563
565 skip(
"SHCreateStreamOnFileEx: STGM_TRANSACTED not supported in this configuration.\n");
566 return;
567 }
568 } else {
571 "SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) or "
572 "HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got 0x%08x\n",
ret);
573 }
574 ok(
stream ==
NULL,
"SHCreateStreamOnFileEx: expected a NULL IStream object, got %p\n",
stream);
575
578
580 skip(
"Not supported\n");
582 return;
583 }
584
585 ok(
ret ==
S_OK,
"SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n",
ret);
586 ok(
stream !=
NULL,
"SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
587
591
592 refcount = IStream_Release(
stream);
593 ok(refcount == 0,
"SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
594
596 ok(delret,
"SHCreateStreamOnFileEx: could not delete the test file, got error %d\n",
598 }
599
603 win_skip(
"File probably locked by Anti-Virus/Spam software, trying again\n");
606 }
607 ok(
ret ==
S_OK,
"SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n",
ret);
608 ok(
stream !=
NULL,
"SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
609
612
613 refcount = IStream_Release(
stream);
614 ok(refcount == 0,
"SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
615
617 ok(delret,
"SHCreateStreamOnFileEx: could not delete the test file, got error %d\n",
619 }
620
624 win_skip(
"File probably locked by Anti-Virus/Spam software, trying again\n");
627 }
628 ok(
ret ==
S_OK,
"SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n",
ret);
629 ok(
stream !=
NULL,
"SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
630
633
634 refcount = IStream_Release(
stream);
635 ok(refcount == 0,
"SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
636 }
637
638
639
640
641
644 ok(
ret ==
S_OK,
"SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n",
ret);
645 ok(
stream !=
NULL,
"SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
646
649
650 refcount = IStream_Release(
stream);
651 ok(refcount == 0,
"SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
652 }
653
657 ok(
stream ==
NULL,
"SHCreateStreamOnFileEx: expected a NULL IStream object, got %p\n",
stream);
658
661 ok(
ret ==
S_OK,
"SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n",
ret);
662 ok(
stream !=
NULL,
"SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
663
666
667 refcount = IStream_Release(
stream);
668 ok(refcount == 0,
"SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
669 }
670
673 ok(
ret ==
S_OK,
"SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n",
ret);
674 ok(
stream !=
NULL,
"SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
675
678
679 refcount = IStream_Release(
stream);
680 ok(refcount == 0,
"SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
681 }
682
684 ok(delret,
"SHCreateStreamOnFileEx: could not delete the test file, got error %d\n",
686}
#define ERROR_INVALID_PARAMETER
#define MultiByteToWideChar
#define ERROR_ACCESS_DENIED
HRESULT WINAPI SHCreateStreamOnFileEx(LPCWSTR lpszPath, DWORD dwMode, DWORD dwAttributes, BOOL bCreate, IStream *lpTemplate, IStream **lppStream)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
#define ERROR_FILE_EXISTS
Referenced by START_TEST().
◆ test_SHCreateStreamOnFileEx_CopyTo()
static void test_SHCreateStreamOnFileEx_CopyTo |
( |
void |
| ) |
|
|
static |
Definition at line 689 of file istream.c.
690{
698 static const char srcContents[1];
699 static const WCHAR prefix[] = {
'T',
'S',
'T', 0 };
700
706
709
711 ret = IStream_Write(
src, srcContents,
sizeof(srcContents), &
U(written).LowPart);
713
717
720
721
723
726
727 ok(
read.QuadPart == 1,
"read does not match size: %d != 1\n",
U(
read).LowPart);
728 ok(written.
QuadPart == 1,
"written does not match size: %d != 1\n",
U(written).LowPart);
729
730 IStream_Release(
dst);
731 IStream_Release(
src);
734}
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
GLsizei GLsizei GLfloat distance
#define FILE_ATTRIBUTE_TEMPORARY
Referenced by START_TEST().
◆ test_SHCreateStreamOnFileW()
Definition at line 390 of file istream.c.
391{
397 static const CHAR testW_txt[] =
"\\testW.txt";
398
399 trace(
"SHCreateStreamOnFileW: testing mode %d, STGM flags %08x\n",
mode, stgm);
400
401
405
406
407
408 if (0)
409 {
410
415 "SHCreateStreamOnFileW: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) or E_INVALIDARG, got 0x%08x\n",
ret);
416 ok(
stream ==
NULL,
"SHCreateStreamOnFileW: expected a NULL IStream object, got %p\n",
stream);
417 }
418
419 if (0)
420 {
421
424 }
425
429 ok(
stream ==
NULL,
"SHCreateStreamOnFileW: expected a NULL IStream object, got %p\n",
stream);
430
434 ok(
stream ==
NULL,
"SHCreateStreamOnFileW: expected a NULL IStream object, got %p\n",
stream);
435
439 ok(
stream ==
NULL,
"SHCreateStreamOnFileW: expected a NULL IStream object, got %p\n",
stream);
440
441
442
447 return;
448 }
449
451 ok(
stream ==
NULL,
"SHCreateStreamOnFileW: expected a NULL IStream object, got %p\n",
stream);
452
455 ok(
ret ==
S_OK,
"SHCreateStreamOnFileW: expected S_OK, got 0x%08x\n",
ret);
456 ok(
stream !=
NULL,
"SHCreateStreamOnFileW: expected a valid IStream object, got NULL\n");
457
461
462 refcount = IStream_Release(
stream);
463 ok(refcount == 0,
"SHCreateStreamOnFileW: expected 0, got %d\n", refcount);
464 }
465
466
467
468
469
472 ok(
ret ==
S_OK,
"SHCreateStreamOnFileW: expected S_OK, got 0x%08x\n",
ret);
473 ok(
stream !=
NULL,
"SHCreateStreamOnFileW: expected a valid IStream object, got NULL\n");
474
477
478 refcount = IStream_Release(
stream);
479 ok(refcount == 0,
"SHCreateStreamOnFileW: expected 0, got %d\n", refcount);
480 }
481
484 ok(
ret ==
S_OK,
"SHCreateStreamOnFileW: expected S_OK, got 0x%08x\n",
ret);
485 ok(
stream !=
NULL,
"SHCreateStreamOnFileW: expected a valid IStream object, got NULL\n");
486
489
492
493 refcount = IStream_Release(
stream);
494 ok(refcount == 0,
"SHCreateStreamOnFileW: expected 0, got %d\n", refcount);
495
497 ok(delret,
"SHCreateStreamOnFileW: could not delete the test file, got error %d\n",
499 }
500}
HRESULT WINAPI SHCreateStreamOnFileW(LPCWSTR lpszPath, DWORD dwMode, IStream **lppStream)
Referenced by START_TEST().
◆ test_stream_qi()
◆ test_stream_read_write()
Definition at line 188 of file istream.c.
189{
192 unsigned char buf[16];
194 STATSTG statstg;
195
196
197
198 written = 0xdeadbeaf;
201 {
203 ok(written == 2,
"expected 2, got %u\n", written);
204 }
205 else
206 {
208 ok(written == 0xdeadbeaf ||
broken(written == 2) ,
"expected 0xdeadbeaf, got %#x\n", written);
209 written = 0;
211 }
212
215
218 if (written != 0)
219 {
222 {
224 ok(
buf[0] == 0x5e &&
buf[1] == 0xa7,
"expected 5ea7, got %02x%02x\n",
buf[0],
buf[1]);
225 }
226 else
228 }
229 else
230 {
231 ok(
ret ==
S_FALSE,
"expected S_FALSE, got %#x (access %#x, written %u)\n",
ret,
mode, written);
233 }
234
237
240 ok(
ret ==
S_OK,
"IStream_Read error %#x (access %#x, written %u)\n",
ret,
mode, written);
242
245 ok(
ret ==
S_FALSE,
"expected S_FALSE, got %#x (access %#x, written %u)\n",
ret,
mode, written);
246 ok(
count == written,
"expected %u, got %u\n", written,
count);
248 ok(
buf[0] == 0x5e &&
buf[1] == 0xa7,
"expected 5ea7, got %02x%02x\n",
buf[0],
buf[1]);
249
250 memset(&statstg, 0xff,
sizeof(statstg));
255
256 memset(&statstg, 0xff,
sizeof(statstg));
257 ret = IStream_Stat(
stream, &statstg, STATFLAG_NONAME);
260}
GLenum GLuint GLenum GLsizei const GLchar * buf
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Referenced by test_SHCreateStreamOnFileA(), and test_SHCreateStreamOnFileW().