31DEFINE_GUID( test_stg_cls, 0x88888888, 0x0425, 0x0000, 0,0,0,0,0,0,0,0);
33#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error %#08lx\n", hr)
38static const char file1_nameA[] = {
'c',
'o',
'p',
'y',
't',
'e',
's',
't',
'A',0};
40static const char file2_nameA[] = {
'c',
'o',
'p',
'y',
't',
'e',
's',
't',
'B',0};
51 CHAR stra1[512], stra2[512];
112 if (!pcbRead) pcbRead = &
dummy;
137 if (!pcbWritten) pcbWritten = &
dummy;
163 if (
This->buffer_size <
cb.QuadPart)
170 This->contents = new_buffer;
173 if (
cb.QuadPart >
This->size)
186 return This->lock_hr;
193 return This->lock_hr;
197 STATSTG *pstatstg,
DWORD grfStatFlag)
200 static const WCHAR dummy_name[] = {
'd',
'u',
'm',
'm',
'y',0};
204 memset(pstatstg, 0,
sizeof(STATSTG));
206 if (!(grfStatFlag & STATFLAG_NONAME))
210 memcpy(pstatstg->pwcsName, dummy_name,
sizeof(dummy_name));
213 pstatstg->type = STGTY_LOCKBYTES;
214 pstatstg->cbSize.QuadPart =
This->size;
215 pstatstg->grfLocksSupported =
This->locks_supported;
242 (*This)->buffer_size = 1024;
243 (*This)->contents =
malloc((*This)->buffer_size);
250 ok(
This->ref == 1,
"test lock bytes %p deleted with %li references instead of 1\n",
This,
This->ref);
264 ok(
r ==
S_OK,
"CreateILockBytesOnHGlobal failed\n");
267 ok(
r ==
S_FALSE,
"StgIsStorageILockBytes should have failed\n");
271 ok(
r ==
S_OK,
"StgCreateDocfileOnILockBytes failed\n");
274 ok(
r ==
S_OK,
"WriteClassStg failed\n");
277 ok(
r ==
S_OK,
"StgIsStorageILockBytes failed\n");
280 r = IStorage_Stat( stg, &
stat, 0 );
282 ok(
stat.pwcsName ==
NULL,
"storage name not null\n");
283 ok(
stat.type == 1,
"type is wrong\n");
284 ok(
stat.grfMode == 0x12,
"grf mode is incorrect\n");
285 ok( !
memcmp(&
stat.clsid, &test_stg_cls,
sizeof test_stg_cls),
"CLSID is wrong\n");
287 refcount = IStorage_Release( stg );
288 ok( refcount == 0,
"IStorage refcount is wrong\n");
289 refcount = ILockBytes_Release( ilb );
290 ok( refcount == 0,
"ILockBytes refcount is wrong\n");
337 ok(stg ==
NULL,
"stg was set\n");
341 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
342 r = IStorage_Release(stg);
343 ok(
r == 0,
"storage not released\n");
369 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
370 r = IStorage_Release(stg);
371 ok(
r == 0,
"storage not released\n");
380 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
381 r = IStorage_Release(stg);
382 ok(
r == 0,
"storage not released\n");
386 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
387 r = IStorage_Release(stg);
388 ok(
r == 0,
"storage not released\n");
393 ok(
r==
S_OK,
"StgCreateDocfile the excel way failed\n");
396 r = IStorage_Release(stg);
397 ok(
r == 0,
"storage not released\n");
403 ok(
r==
S_OK,
"StgCreateDocfile the windows media way failed\n");
406 r = IStorage_Release(stg);
407 ok(
r == 0,
"storage not released\n");
413 ok(
r==
S_OK,
"StgCreateDocfile the excel way failed\n");
416 r = IStorage_Release(stg);
417 ok(
r == 0,
"storage not released\n");
422 ok(
r==
S_OK,
"StgCreateDocfile the excel way failed\n");
425 r = IStorage_Release(stg);
426 ok(
r == 0,
"storage not released\n");
431 ok(
r==
S_OK,
"StgCreateDocfile the powerpoint way failed\n");
434 r = IStorage_Release(stg);
435 ok(
r == 0,
"storage not released\n");
441 ok(
r==
S_OK,
"StgCreateDocFile failed\n");
442 r = IStorage_Release(stg);
443 ok(
r == 0,
"storage not released\n");
466 r = IStorage_Release(stg);
467 ok(
r == 0,
"storage not released\n");
479 ok(
r==
S_OK,
"StgCreateStorageEx with NULL options failed\n");
480 r = IStorage_Release(stg);
481 ok(
r == 0,
"storage not released\n");
487 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
488 static const WCHAR longname[] = {
489 'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
490 'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',0
499 unsigned char buffer[0x100];
506 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
519 "IStorage->CreateStream wrong error, got %ld GetLastError()=%ld\n",
r,
GetLastError());
522 r = IStorage_CreateStream(stg, stmname,
STGM_READ, 0, 0, &stm );
524 r = IStorage_CreateStream(stg, stmname,
STGM_WRITE, 0, 0, &stm );
533 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
536 r = IStream_QueryInterface(stm, &
IID_IPersist, (
void**)&unk);
541 r = IStream_Release(stm);
542 ok(
r == 0,
"wrong ref count\n");
545 r = IStorage_DestroyElement(stg,stmname);
546 ok(
r==
S_OK,
"IStorage->DestroyElement failed\n");
550 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
552 r = IStream_Clone(stm, &stm2);
553 ok(
r==
S_OK,
"failed to clone stream\n");
557 r = IStream_Write(stm,
"Hello\n", 0,
NULL );
558 ok(
r==
S_OK,
"failed to write stream\n");
559 r = IStream_Write(stm,
"Hello\n", 0, &
count );
560 ok(
r==
S_OK,
"failed to write stream\n");
561 r = IStream_Write(stm,
"Hello\n", 6, &
count );
562 ok(
r==
S_OK,
"failed to write stream\n");
563 r = IStream_Commit(stm, STGC_DEFAULT );
564 ok(
r==
S_OK,
"failed to commit stream\n");
565 r = IStream_Commit(stm, STGC_DEFAULT );
566 ok(
r==
S_OK,
"failed to commit stream\n");
570 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &
p );
571 ok(
r==
S_OK,
"failed to seek stream\n");
572 ok(
p.QuadPart == 3,
"at wrong place\n");
574 ok(
r==
S_OK,
"failed to read\n");
575 ok(
count == 3,
"read bytes past end of stream\n");
577 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &
p );
578 ok(
r==
S_OK,
"failed to seek stream\n");
579 ok(
p.QuadPart == 10,
"at wrong place\n");
581 ok(
r==
S_OK,
"failed to read\n");
582 ok(
count == 0,
"read bytes past end of stream\n");
583 pos.QuadPart = 10000;
584 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &
p );
585 ok(
r==
S_OK,
"failed to seek stream\n");
586 ok(
p.QuadPart == 10000,
"at wrong place\n");
588 ok(
r==
S_OK,
"failed to read\n");
589 ok(
count == 0,
"read bytes past end of stream\n");
593 r = IStream_SetSize(stm,
p);
594 ok(
r==
S_OK,
"failed to set pos\n");
596 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &
p );
597 ok(
r==
S_OK,
"failed to seek stream\n");
598 ok(
p.QuadPart == 4997,
"at wrong place\n");
600 ok(
r==
S_OK,
"failed to read\n");
601 ok(
count == 3,
"read bytes past end of stream\n");
603 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &
p );
604 ok(
r==
S_OK,
"failed to seek stream\n");
605 ok(
p.QuadPart == 5001,
"at wrong place\n");
607 ok(
r==
S_OK,
"failed to read\n");
608 ok(
count == 0,
"read bytes past end of stream\n");
609 pos.QuadPart = 10000;
610 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &
p );
611 ok(
r==
S_OK,
"failed to seek stream\n");
612 ok(
p.QuadPart == 10000,
"at wrong place\n");
614 ok(
r==
S_OK,
"failed to read\n");
615 ok(
count == 0,
"read bytes past end of stream\n");
619 r = IStream_Seek(stm,
pos, 3, &
p );
621 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET,
NULL);
622 ok(
r==
S_OK,
"failed to seek stream\n");
623 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &
p );
624 ok(
r==
S_OK,
"failed to seek stream\n");
625 r = IStream_SetSize(stm,
p);
626 ok(
r==
S_OK,
"failed to set pos\n");
628 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &
p );
629 ok(
r==
S_OK,
"failed to seek stream\n");
630 ok(
p.QuadPart == 10,
"at wrong place\n");
632 ok(
r==
S_OK,
"failed to set pos\n");
633 ok(
count == 0,
"read bytes from empty stream\n");
634 pos.QuadPart = 10000;
635 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &
p );
636 ok(
r==
S_OK,
"failed to seek stream\n");
637 ok(
p.QuadPart == 10000,
"at wrong place\n");
639 ok(
r==
S_OK,
"failed to set pos\n");
640 ok(
count == 0,
"read bytes from empty stream\n");
642 r = IStream_Seek(stm,
pos, STREAM_SEEK_END, &
p );
643 ok(
r==
S_OK,
"failed to seek stream\n");
644 ok(
p.QuadPart == 0,
"at wrong place\n");
646 ok(
r==
S_OK,
"failed to set pos\n");
647 ok(
count == 0,
"read bytes from empty stream\n");
650 r = IStream_Release(stm2);
651 ok(
r == 0,
"wrong ref count\n");
655 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
657 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &
p);
658 ok(
r==
STG_E_REVERTED,
"overwritten stream should return STG_E_REVERTED instead of 0x%08lx\n",
r);
660 r = IStream_Release(stm2);
661 ok(
r == 0,
"wrong ref count\n");
662 r = IStream_Release(stm);
663 ok(
r == 0,
"wrong ref count\n");
665 r = IStorage_Release(stg);
666 ok(
r == 0,
"wrong ref count\n");
672 ok(
r ==
S_OK,
"should succeed\n");
676 ok(
r ==
STG_E_INVALIDFLAG,
"IStorage->OpenStream should return STG_E_INVALIDFLAG instead of 0x%08lx\n",
r);
677 IStorage_Release(stg);
681 ok(
ret,
"file should exist\n");
724 static const WCHAR szNonExist[] = {
'n',
'o',
'n',
'e',
'x',
'i',
's',
't',0 };
747 ok(
r!=
S_OK,
"StgOpenStorage failed: 0x%08lx\n",
r);
748 if (
r==
S_OK) IStorage_Release(stg);
754 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
755 IStorage_Release(stg);
778 ok(
r==
S_OK,
"StgOpenStorage failed\n");
781 r = IStorage_Release(stg);
782 ok(
r == 0,
"wrong ref count\n");
786 ok(
r==
S_OK,
"StgOpenStorage failed\n");
789 r = IStorage_Release(stg);
790 ok(
r == 0,
"wrong ref count\n");
796 ok(
r==
S_OK,
"StgOpenStorage failed\n");
799 r = IStorage_Release(stg);
800 ok(
r == 0,
"wrong ref count\n");
804 ok(
r==
S_OK,
"StgOpenStorage failed\n");
809 r = IStorage_Release(stg);
810 ok(
r == 0,
"wrong ref count\n");
815 ok(
r==
S_OK,
"StgOpenStorage failed\n");
818 static const WCHAR stmname[] = {
'w',
'i',
'n',
'e',
't',
'e',
's',
't',0};
828 r = IStorage_Release(stg);
829 ok(
r == 0,
"wrong ref count\n");
835 ok(
r ==
S_OK,
"should succeed\n");
837 IStorage_Release(stg);
842 ok(
r ==
S_OK,
"should succeed\n");
844 IStorage_Release(stg);
848 ok(
r ==
S_OK,
"should succeed\n");
850 IStorage_Release(stg);
854 ok(
r ==
S_OK,
"should succeed\n");
856 IStorage_Release(stg);
861 ok(
r ==
S_OK,
"should succeed\n");
863 ok(
r ==
S_OK,
"should succeed\n");
865 IStorage_Release(stg2);
867 IStorage_Release(stg);
889 ok(
ret,
"file didn't exist\n");
904 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
906 r = IStorage_QueryInterface( stg, &IID_IPropertySetStorage, (
LPVOID) &propset );
907 ok(
r ==
S_OK,
"query interface failed\n");
939 ok(
r ==
S_OK,
"failed to create property set storage\n");
942 IPropertyStorage_Release(ps);
947 ok(
r ==
S_OK,
"failed to create property set storage\n");
949 IPropertyStorage_Release(ps);
954 ok(
r ==
S_OK,
"open failed\n");
956 IPropertyStorage_Release(ps);
960 ok(
r ==
S_OK,
"failed to delete property set storage\n");
963 r = IPropertySetStorage_Open( propset,
NULL,
967 IPropertyStorage_Release(ps);
970 r = IPropertySetStorage_Open( propset, &IID_IStorage,
974 IPropertyStorage_Release(ps);
982 IPropertyStorage_Release(ps);
989 IPropertyStorage_Release(ps);
991 r = IPropertySetStorage_Release( propset );
992 ok(
r == 1,
"ref count wrong\n");
994 r = IStorage_Release(stg);
995 ok(
r == 0,
"ref count wrong\n");
1006 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
1017 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
1020 ok(
r ==
S_OK,
"WriteClassStg failed\n");
1022 r = IStorage_Commit( stg, STGC_DEFAULT );
1023 ok(
r ==
S_OK,
"IStorage_Commit failed\n");
1027 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1029 r = IStorage_Release( stg );
1030 ok (
r == 0,
"storage not released\n");
1033 r = IStream_Seek( stm,
pos, 0, &upos );
1036 r = IStream_Stat( stm, &
stat, STATFLAG_DEFAULT );
1039 r = IStream_Write( stm,
"Test string",
strlen(
"Test string"),
NULL);
1040 ok (
r ==
STG_E_REVERTED,
"IStream_Write should return STG_E_REVERTED instead of 0x%08lx\n",
r);
1043 ok (
r ==
STG_E_REVERTED,
"IStream_Read should return STG_E_REVERTED instead of 0x%08lx\n",
r);
1045 r = IStream_Release(stm);
1046 ok (
r == 0,
"stream not released\n");
1051 ok(
r==
S_OK,
"StgOpenStorage failed with error 0x%08lx\n",
r);
1059 ok(
r==
S_OK,
"StgOpenStorage failed with error 0x%08lx\n",
r);
1060 IStorage_Release(stg);
1063 ok(
r==
S_OK,
"StgOpenStorage failed with error 0x%08lx\n",
r);
1066 static const WCHAR stgname[] = {
' ',
' ',
' ',
'2',
'9',0 };
1067 static const WCHAR stgname2[] = {
'C',
'V',
'_',
'i',
'e',
'w',0 };
1068 static const WCHAR stmname2[] = {
'V',
'a',
'r',
'2',
'D',
'a',
't',
'a',0 };
1073 r = IStorage_Stat( stg, &statstg, STATFLAG_NONAME );
1074 ok(
r ==
S_OK,
"Stat should have succeeded instead of returning 0x%08lx\n",
r);
1075 ok(statstg.type == STGTY_STORAGE,
"Statstg type should have been STGTY_STORAGE instead of %ld\n", statstg.type);
1076 ok(statstg.cbSize.LowPart == 0,
"Statstg cbSize.LowPart should have been 0 instead of %ld\n", statstg.cbSize.LowPart);
1077 ok(statstg.cbSize.HighPart == 0,
"Statstg cbSize.HighPart should have been 0 instead of %ld\n", statstg.cbSize.HighPart);
1079 "Statstg grfMode should have been 0x10022 instead of 0x%lx\n", statstg.grfMode);
1080 ok(statstg.grfLocksSupported == 0,
"Statstg grfLocksSupported should have been 0 instead of %ld\n", statstg.grfLocksSupported);
1081 ok(
IsEqualCLSID(&statstg.clsid, &test_stg_cls),
"Statstg clsid is not test_stg_cls\n");
1082 ok(statstg.grfStateBits == 0,
"Statstg grfStateBits should have been 0 instead of %ld\n", statstg.grfStateBits);
1083 ok(statstg.reserved == 0,
"Statstg reserved should have been 0 instead of %ld\n", statstg.reserved);
1086 ok(
r ==
S_OK,
"CreateStorage should have succeeded instead of returning 0x%08lx\n",
r);
1088 r = IStorage_Stat( stg2, &statstg, STATFLAG_DEFAULT );
1089 ok(
r ==
S_OK,
"Stat should have succeeded instead of returning 0x%08lx\n",
r);
1090 ok(!
memcmp(statstg.pwcsName, stgname,
sizeof(stgname)),
1091 "Statstg pwcsName should have been the name the storage was created with\n");
1092 ok(statstg.type == STGTY_STORAGE,
"Statstg type should have been STGTY_STORAGE instead of %ld\n", statstg.type);
1093 ok(statstg.cbSize.LowPart == 0,
"Statstg cbSize.LowPart should have been 0 instead of %ld\n", statstg.cbSize.LowPart);
1094 ok(statstg.cbSize.HighPart == 0,
"Statstg cbSize.HighPart should have been 0 instead of %ld\n", statstg.cbSize.HighPart);
1096 "Statstg grfMode should have been STGM_SHARE_EXCLUSIVE instead of 0x%lx\n", statstg.grfMode);
1097 ok(statstg.grfLocksSupported == 0,
"Statstg grfLocksSupported should have been 0 instead of %ld\n", statstg.grfLocksSupported);
1099 ok(statstg.grfStateBits == 0,
"Statstg grfStateBits should have been 0 instead of %ld\n", statstg.grfStateBits);
1100 ok(statstg.reserved == 0,
"Statstg reserved should have been 0 instead of %ld\n", statstg.reserved);
1104 ok(
r ==
STG_E_ACCESSDENIED,
"CreateStorage should have returned STG_E_ACCESSDENIED instead of 0x%08lx\n",
r);
1107 ok(
r ==
STG_E_ACCESSDENIED,
"CreateStream should have returned STG_E_ACCESSDENIED instead of 0x%08lx\n",
r);
1109 IStorage_Release(stg2);
1111 r = IStorage_Release(stg);
1112 ok(
r == 0,
"wrong ref count\n");
1117 ok(
r==
S_OK,
"StgOpenStorage failed with error 0x%08lx\n",
r);
1120 r = IStorage_Release(stg);
1121 ok(
r == 0,
"wrong ref count\n");
1125 ok(
r==
S_OK,
"StgOpenStorage failed with error 0x%08lx\n",
r);
1128 static const WCHAR stgname[] = {
' ',
' ',
' ',
'2',
'9',0 };
1132 r = IStorage_Stat( stg, &statstg, STATFLAG_NONAME );
1133 ok(
r ==
S_OK,
"Stat should have succeeded instead of returning 0x%08lx\n",
r);
1134 ok(statstg.type == STGTY_STORAGE,
"Statstg type should have been STGTY_STORAGE instead of %ld\n", statstg.type);
1135 ok(statstg.cbSize.LowPart == 0,
"Statstg cbSize.LowPart should have been 0 instead of %ld\n", statstg.cbSize.LowPart);
1136 ok(statstg.cbSize.HighPart == 0,
"Statstg cbSize.HighPart should have been 0 instead of %ld\n", statstg.cbSize.HighPart);
1138 "Statstg grfMode should have been 0x10022 instead of 0x%lx\n", statstg.grfMode);
1139 ok(statstg.grfLocksSupported == 0,
"Statstg grfLocksSupported should have been 0 instead of %ld\n", statstg.grfLocksSupported);
1140 ok(
IsEqualCLSID(&statstg.clsid, &test_stg_cls),
"Statstg clsid is not test_stg_cls\n");
1141 ok(statstg.grfStateBits == 0,
"Statstg grfStateBits should have been 0 instead of %ld\n", statstg.grfStateBits);
1142 ok(statstg.reserved == 0,
"Statstg reserved should have been 0 instead of %ld\n", statstg.reserved);
1145 ok(
r ==
S_OK,
"CreateStorage should have succeeded instead of returning 0x%08lx\n",
r);
1147 IStorage_Release(stg2);
1149 r = IStorage_Commit( stg, 0 );
1150 ok(
r ==
S_OK,
"Commit should have succeeded instead of returning 0x%08lx\n",
r);
1152 r = IStorage_Release(stg);
1153 ok(
r == 0,
"wrong ref count\n");
1164 CLSID temp_cls, cls2;
1171 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
1174 ok(
r ==
E_INVALIDARG,
"ReadClassStg should return E_INVALIDARG instead of 0x%08lX\n",
r);
1176 memset(&temp_cls, 0xcc,
sizeof(temp_cls));
1177 memset(&cls2, 0xcc,
sizeof(cls2));
1183 ok(
r ==
E_INVALIDARG,
"ReadClassStg should return E_INVALIDARG instead of 0x%08lX\n",
r);
1185 temp_cls.Data1 = 0xdeadbeef;
1187 ok(
r ==
S_OK,
"ReadClassStg failed with 0x%08lX\n",
r);
1192 ok(
r ==
E_INVALIDARG,
"WriteClassStg should return E_INVALIDARG instead of 0x%08lX\n",
r);
1198 ok(
r ==
S_OK,
"WriteClassStg failed with 0x%08lX\n",
r);
1201 ok(
r ==
S_OK,
"ReadClassStg failed with 0x%08lX\n",
r);
1202 ok(
IsEqualCLSID(&temp_cls, &test_stg_cls),
"ReadClassStg returned wrong clsid\n");
1204 r = IStorage_Release( stg );
1205 ok (
r == 0,
"storage not released\n");
1215 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
1216 static const WCHAR stmname2[] = {
'A',
'B',
'C',
'D',
'E',
'F',
'G',
'H',
'I',0 };
1217 static const WCHAR stmname3[] = {
'A',
'B',
'C',
'D',
'E',
'F',
'G',
'H',
'I',
'J',0 };
1218 static const STATSTG stat_null;
1228 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
1231 ok(
r ==
S_OK,
"WriteClassStg failed\n");
1233 r = IStorage_Commit( stg, STGC_DEFAULT );
1234 ok(
r ==
S_OK,
"IStorage_Commit failed\n");
1238 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1240 IStream_Release(stm);
1243 r = IStorage_EnumElements(stg, 0,
NULL, 0, &ee);
1244 ok(
r==
S_OK,
"IStorage->EnumElements failed\n");
1248 ok(
r==
S_OK,
"IEnumSTATSTG->Next failed\n");
1249 ok(
count == 1,
"count wrong\n");
1254 r = IEnumSTATSTG_Release(ee);
1255 ok(
r==
S_OK,
"EnumSTATSTG_Release failed with error 0x%08lx\n",
r);
1258 r = IStorage_EnumElements(stg, 0,
NULL, 0, &ee);
1259 ok(
r==
S_OK,
"IStorage->EnumElements failed\n");
1261 r = IStorage_DestroyElement(stg, stmname);
1262 ok(
r==
S_OK,
"IStorage->DestroyElement failed\n");
1267 ok(
r==
S_FALSE,
"IEnumSTATSTG->Next failed\n");
1268 ok(
count == 0,
"count wrong\n");
1272 r = IEnumSTATSTG_Reset(ee);
1273 ok(
r==
S_OK,
"IEnumSTATSTG->Reset failed\n");
1277 ok(
r==
S_FALSE,
"IEnumSTATSTG->Next failed\n");
1278 ok(
count == 0,
"count wrong\n");
1281 r = IEnumSTATSTG_Reset(ee);
1282 ok(
r==
S_OK,
"IEnumSTATSTG->Reset failed\n");
1285 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1287 r = IStream_Release(stm);
1288 ok(
r==
S_OK,
"Stream_Release failed with error 0x%08lx\n",
r);
1292 ok(
r==
S_OK,
"IEnumSTATSTG->Next failed\n");
1293 ok(
count == 1,
"count wrong\n");
1302 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1304 r = IStream_Release(stm);
1305 ok(
r==
S_OK,
"Stream_Release failed with error 0x%08lx\n",
r);
1309 ok(
r==
S_OK,
"IEnumSTATSTG->Next failed\n");
1310 ok(
count == 1,
"count wrong\n");
1320 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1322 r = IStream_Release(stm);
1323 ok(
r==
S_OK,
"Stream_Release failed with error 0x%08lx\n",
r);
1325 r = IEnumSTATSTG_Reset(ee);
1326 ok(
r==
S_OK,
"IEnumSTATSTG->Reset failed\n");
1330 ok(
r==
S_OK,
"IEnumSTATSTG->Next failed\n");
1331 ok(
count == 1,
"count wrong\n");
1339 r = IStorage_DestroyElement(stg, stmname);
1340 ok(
r==
S_OK,
"IStorage->DestroyElement failed\n");
1342 r = IStorage_DestroyElement(stg, stmname2);
1343 ok(
r==
S_OK,
"IStorage->DestroyElement failed\n");
1347 ok(
r==
S_OK,
"IEnumSTATSTG->Next failed\n");
1348 ok(
count == 1,
"count wrong\n");
1356 r = IStorage_Release( stg );
1360 r = IEnumSTATSTG_Reset(ee);
1361 ok(
r==
S_OK,
"IEnumSTATSTG->Reset failed\n");
1365 ok(
r==
S_OK,
"IEnumSTATSTG->Next failed\n");
1366 ok(
count == 1,
"count wrong\n");
1379 "StgCreateDocfile failed, res=%lx\n",
r);
1381 r = IEnumSTATSTG_Release(ee);
1382 ok (
r == 0,
"enum not released\n");
1392 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
1393 static const WCHAR stmname2[] = {
'F',
'O',
'O',0 };
1394 static const WCHAR stgname[] = {
'P',
'E',
'R',
'M',
'S',
'T',
'G',0 };
1395 static const WCHAR stgname2[] = {
'T',
'E',
'M',
'P',
'S',
'T',
'G',0 };
1403 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
1407 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1409 r = IStream_Write(stm,
"this is stream 1\n", 16,
NULL);
1410 ok(
r==
S_OK,
"IStream->Write failed\n");
1412 IStream_Release(stm);
1415 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08lx\n",
r);
1421 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08lx\n",
r);
1424 IStorage_Release(stg3);
1426 r = IStorage_Commit(stg, 0);
1427 ok(
r==
S_OK,
"IStorage->Commit failed\n");
1430 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08lx\n",
r);
1433 IStorage_Release(stg3);
1435 IStorage_Release(stg2);
1441 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1443 r = IStream_Write(stm,
"this is stream 2\n", 16,
NULL);
1444 ok(
r==
S_OK,
"IStream->Write failed\n");
1447 r = IStream_Commit(stm, STGC_ONLYIFCURRENT | STGC_DANGEROUSLYCOMMITMERELYTODISKCACHE);
1448 ok(
r==
S_OK,
"IStream->Commit failed\n");
1451 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08lx\n",
r);
1454 IStorage_Release(stg2);
1456 IStream_Release(stm);
1458 IStorage_Release(stg);
1463 ok(
r==
S_OK,
"StgOpenStorage failed\n");
1483 IStream_Release(stm);
1488 IStorage_Release(stg2);
1494 ok(
r==
S_OK,
"IStorage->OpenStream should succeed %08lx\n",
r);
1496 IStream_Release(stm);
1499 ok(
r==
S_OK,
"IStorage->OpenStorage should succeed %08lx\n",
r);
1503 ok(
r==
S_OK,
"IStorage->OpenStorage should succeed %08lx\n",
r);
1505 IStorage_Release(stg3);
1510 IStorage_Release(stg3);
1512 IStorage_Release(stg2);
1515 IStorage_Release(stg);
1518 ok(
ret,
"deleted file\n");
1526 static const WCHAR stgname[] = {
'P',
'E',
'R',
'M',
'S',
'T',
'G',0 };
1527 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
1528 static const WCHAR othername[] = {
'N',
'E',
'W',
'N',
'A',
'M',
'E',0 };
1536 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
1540 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08lx\n",
r);
1548 IStorage_Release(stg3);
1554 IStorage_Release(stg3);
1557 r = IStorage_RenameElement(stg, stgname, othername);
1559 if (
SUCCEEDED(
r)) IStorage_RenameElement(stg, othername, stgname);
1562 r = IStorage_DestroyElement(stg, stgname);
1563 ok(
r==
S_OK,
"IStorage->DestroyElement failed, hr=%08lx\n",
r);
1569 IStream_Release(stm);
1571 IStorage_Release(stg2);
1576 ok(
r==
S_OK,
"IStorage->CreateStream failed, hr=%08lx\n",
r);
1584 IStream_Release(stm2);
1590 IStream_Release(stm2);
1593 r = IStorage_RenameElement(stg, stmname, othername);
1595 if (
SUCCEEDED(
r)) IStorage_RenameElement(stg, othername, stmname);
1598 r = IStorage_DestroyElement(stg, stmname);
1599 ok(
r==
S_OK,
"IStorage->DestroyElement failed, hr=%08lx\n",
r);
1601 r = IStream_Write(stm,
"this shouldn't work\n", 20,
NULL);
1604 IStream_Release(stm);
1607 IStorage_Release(stg);
1610 ok(
ret,
"deleted file\n");
1618 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
1619 static const WCHAR stmname2[] = {
'F',
'O',
'O',0 };
1620 static const WCHAR stgname[] = {
'P',
'E',
'R',
'M',
'S',
'T',
'G',0 };
1621 static const WCHAR stgname2[] = {
'T',
'E',
'M',
'P',
'S',
'T',
'G',0 };
1630 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
1634 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1636 r = IStream_Write(stm,
"this is stream 1\n", 16,
NULL);
1637 ok(
r==
S_OK,
"IStream->Write failed\n");
1640 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08lx\n",
r);
1646 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08lx\n",
r);
1649 IStorage_Release(stg3);
1651 r = IStorage_Commit(stg, 0);
1652 ok(
r==
S_OK,
"IStorage->Commit failed\n");
1655 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08lx\n",
r);
1658 IStorage_Release(stg3);
1663 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1665 r = IStream_Write(stm2,
"this is stream 2\n", 16,
NULL);
1666 ok(
r==
S_OK,
"IStream->Write failed\n");
1669 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08lx\n",
r);
1671 r = IStorage_Revert(stg);
1672 ok(
r==
S_OK,
"Storage_Revert failed with error 0x%08lx\n",
r);
1675 r = IStream_Write(stm,
"this shouldn't work\n", 20,
NULL);
1678 r = IStream_Write(stm2,
"this shouldn't work\n", 20,
NULL);
1681 r = IStorage_Stat(stg2, &statstg, STATFLAG_NONAME);
1684 r = IStorage_Stat(stg3, &statstg, STATFLAG_NONAME);
1687 IStream_Release(stm);
1688 IStream_Release(stm2);
1689 IStorage_Release(stg2);
1690 IStorage_Release(stg3);
1707 IStream_Release(stm);
1712 IStorage_Release(stg2);
1718 ok(
r==
S_OK,
"IStorage->OpenStream should succeed %08lx\n",
r);
1720 IStream_Release(stm);
1723 ok(
r==
S_OK,
"IStorage->OpenStorage should succeed %08lx\n",
r);
1727 ok(
r==
S_OK,
"IStorage->OpenStorage should succeed %08lx\n",
r);
1729 IStorage_Release(stg3);
1734 IStorage_Release(stg3);
1736 IStorage_Release(stg2);
1739 IStorage_Release(stg);
1742 ok(
ret,
"deleted file\n");
1747 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
1750 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1752 r = IStorage_Revert(stg);
1753 ok(
r==
S_OK,
"IStorage->Revert failed %08lx\n",
r);
1755 r = IStream_Write(stm,
"this works\n", 11,
NULL);
1756 ok(
r==
S_OK,
"IStream_Write should succeed %08lx\n",
r);
1758 IStream_Release(stm);
1759 IStorage_Release(stg);
1762 ok(
ret,
"deleted file\n");
1770 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
1771 static const WCHAR stgname[] = {
'P',
'E',
'R',
'M',
'S',
'T',
'G',0 };
1781 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
1785 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08lx\n",
r);
1791 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1797 ok(
r==
S_OK,
"IStorage->CreateStorage failed\n");
1801 ref = IStorage_Release(stg2);
1802 ok(
ref == 0,
"IStorage still has %lu references\n",
ref);
1807 r = IStream_Write(stm,
"this should fail\n", 17,
NULL);
1810 IStream_Release(stm);
1812 r = IStorage_Stat(stg3, &statstg, STATFLAG_NONAME);
1815 r = IStorage_SetStateBits(stg3, 1, 1);
1818 IStorage_Release(stg3);
1822 IStorage_Release(stg);
1825 ok(
ret,
"deleted file\n");
1833 static const WCHAR stgname[] = {
'P',
'E',
'R',
'M',
'S',
'T',
'G',0 };
1834 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
1835 static const WCHAR stmname2[] = {
'F',
'O',
'O',0 };
1843 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
1847 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08lx\n",
r);
1853 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1855 IStream_Release(stm);
1857 IStorage_Commit(stg2, 0);
1861 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1863 IStream_Release(stm);
1865 IStorage_Revert(stg2);
1869 ok(
r==
S_OK,
"IStorage->OpenStream should succeed %08lx\n",
r);
1871 IStream_Release(stm);
1876 IStream_Release(stm);
1878 IStorage_Release(stg2);
1883 ok(
r==
S_OK,
"IStorage->OpenStorage failed, hr=%08lx\n",
r);
1889 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08lx\n",
r);
1891 IStorage_Release(stg3);
1894 r = IStorage_Commit(stg2, 0);
1897 IStorage_Release(stg2);
1900 IStorage_Release(stg);
1905 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
1909 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08lx\n",
r);
1915 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1917 IStream_Release(stm);
1919 IStorage_Commit(stg2, 0);
1923 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1925 IStream_Release(stm);
1927 IStorage_Revert(stg2);
1931 ok(
r==
S_OK,
"IStorage->OpenStream should succeed %08lx\n",
r);
1933 IStream_Release(stm);
1938 IStream_Release(stm);
1940 IStorage_Release(stg2);
1943 IStorage_Release(stg);
1946 ok(
ret,
"deleted file\n");
1957 ok(
hr ==
E_INVALIDARG,
"ReadClassStm should have returned E_INVALIDARG instead of 0x%08lx\n",
hr);
1965 ok(
hr ==
E_INVALIDARG,
"ReadClassStm should have returned E_INVALIDARG instead of 0x%08lx\n",
hr);
1968 memset(&clsid2, 0xcc,
sizeof(clsid2));
1975 ok(
hr ==
STG_E_READFAULT,
"ReadClassStm should have returned STG_E_READFAULT instead of 0x%08lx\n",
hr);
1978 hr = IStream_Seek(pStream,
llZero, STREAM_SEEK_SET,
NULL);
1982 ok(
IsEqualCLSID(&
clsid, &test_stg_cls),
"clsid should have been set to CLSID_WineTest\n");
1984 IStream_Release(pStream);
2088 "(%ld, handle, %d): Expected %d, got %d\n",
2094 "(%ld, lasterr, %d): Expected %ld, got %ld\n",
2103#define test_file_access(file, ares) _test_file_access(file, ares, __LINE__)
2107 static const WCHAR fileW[] = {
'w',
'i',
'n',
'e',
't',
'e',
's',
't',0};
2108 static const char fileA[] =
"winetest";
2115 ok(
hr ==
S_OK,
"Expected S_OK, got %08lx\n",
hr);
2119 hr = IStorage_Commit(stg, STGC_DEFAULT);
2120 ok(
hr ==
S_OK,
"Expected S_OK, got %08lx\n",
hr);
2124 IStorage_Release(stg);
2133 ok(
hr ==
S_OK,
"Expected S_OK, got %08lx\n",
hr);
2137 hr = IStorage_Commit(stg, STGC_DEFAULT);
2138 ok(
hr ==
S_OK,
"Expected S_OK, got %08lx\n",
hr);
2142 IStorage_Release(stg);
2151 ok(
hr ==
S_OK,
"Expected S_OK, got %08lx\n",
hr);
2155 hr = IStorage_Commit(stg, STGC_DEFAULT);
2156 ok(
hr ==
S_OK,
"Expected S_OK, got %08lx\n",
hr);
2160 IStorage_Release(stg);
2169 ok(
hr ==
S_OK,
"Expected S_OK, got %08lx\n",
hr);
2173 hr = IStorage_Commit(stg, STGC_DEFAULT);
2174 ok(
hr ==
S_OK,
"Expected S_OK, got %08lx\n",
hr);
2178 IStorage_Release(stg);
2187 ok(
hr ==
S_OK,
"Expected S_OK, got %08lx\n",
hr);
2191 hr = IStorage_Commit(stg, STGC_DEFAULT);
2192 ok(
hr ==
S_OK,
"Expected S_OK, got %08lx\n",
hr);
2196 IStorage_Release(stg);
2205 IStorage_Release(stg);
2214 IStorage_Release(stg);
2225 static const WCHAR fileW[] = {
'w',
'i',
'n',
'e',
't',
'e',
's',
't',0};
2226 static const WCHAR storageW[] = {
's',
't',
'o',
'r',
'a',
'g',
'e',0};
2227 static const WCHAR streamW[] = {
's',
't',
'r',
'e',
'a',
'm',0};
2230 ok(
hr ==
S_OK,
"should succeed, res=%lx\n",
hr);
2234 ok(
hr ==
S_OK,
"should succeed, res=%lx\n",
hr);
2238 ok(
hr ==
S_OK,
"should succeed, res=%lx\n",
hr);
2241 IStorage_Release(stg2);
2243 IStorage_Release(stg);
2248 ok(
hr ==
S_OK,
"should succeed, res=%lx\n",
hr);
2252 ok(
hr ==
S_OK,
"should succeed, res=%lx\n",
hr);
2271 IStorage_Release(stg3);
2277 IStorage_Release(stg3);
2280 hr = IStorage_DestroyElement( stg2, streamW );
2284 hr = IStorage_DestroyElement( stg2, storageW );
2287 IStorage_Release(stg2);
2290 IStorage_Release(stg);
2303 static const WCHAR stgname[] = {
'S',
't',
'g',0 };
2304 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
2305 static const WCHAR stmname2[] = {
'S',
'm',
'a',
'l',
'l',0 };
2326 r = IStream_SetSize(stm, upos);
2329 r = IStream_Write(stm,
"foo", 3, &
count);
2334 r = IStream_Seek(stm,
pos, STREAM_SEEK_CUR, &upos);
2338 r = IStream_Stat(stm, &
stat, STATFLAG_NONAME);
2343 ok(
stat.cbSize.QuadPart == 3,
"got %ld\n",
stat.cbSize.LowPart);
2346 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &upos);
2350 r = IStream_Stat(stm, &
stat, STATFLAG_NONAME);
2355 ok(
stat.cbSize.QuadPart == 1,
"got %ld\n",
stat.cbSize.LowPart);
2357 IStream_Release(stm);
2363 r = IStream_SetSize(stm, upos);
2366 r = IStream_Write(stm,
"foo", 3, &
count);
2370 IStream_Release(stm);
2372 IStorage_Commit(stg, STGC_DEFAULT);
2373 IStorage_Release(stg);
2378 win_skip(
"Flag combination is not supported on NT4 and below\n");
2391 r = IStream_Stat(stm, &
stat, STATFLAG_NONAME);
2393 ok(
stat.cbSize.QuadPart == 6000,
"got %ld\n",
stat.cbSize.LowPart);
2395 IStream_Release(stm);
2400 r = IStream_Stat(stm, &
stat, STATFLAG_NONAME);
2402 ok(
stat.cbSize.QuadPart == 4096,
"got %ld\n",
stat.cbSize.LowPart);
2404 IStream_Release(stm);
2407 IStorage_Release(stg);
2417 static const char fileA[] = {
'f',
'm',
't',
't',
'e',
's',
't',0};
2418 static const WCHAR fileW[] = {
'f',
'm',
't',
't',
'e',
's',
't',0};
2419 static WCHAR userTypeW[] = {
'S',
't',
'g',
'U',
's',
'r',
'T',
'y',
'p',
'e',0};
2420 static const WCHAR strmNameW[] = {1,
'C',
'o',
'm',
'p',
'O',
'b',
'j',0};
2421 static const STATSTG statstg_null;
2424 ok(
hr ==
S_OK,
"should succeed, res=%lx\n",
hr);
2430 ok(
hr ==
S_OK,
"should succeed, res=%lx\n",
hr);
2433 hr = IStorage_EnumElements(stg, 0,
NULL, 0, &
stat);
2434 ok(
hr ==
S_OK,
"should succeed, res=%lx\n",
hr);
2440 memset(&statstg, 0xad,
sizeof(statstg));
2441 while ((
hr = IEnumSTATSTG_Next(
stat, 1, &statstg, &got)) ==
S_OK && got == 1)
2443 if (
strcmp_ww(statstg.pwcsName, strmNameW) == 0)
2446 ok(0,
"found unexpected stream or storage\n");
2449 ok(
memcmp(&statstg, &statstg_null,
sizeof(statstg)) == 0,
"statstg is not zeroed\n");
2450 ok(found ==
TRUE,
"expected storage to contain stream \\0001CompObj\n");
2451 IEnumSTATSTG_Release(
stat);
2456 ok(
hr ==
S_OK,
"should succeed, res=%lx\n",
hr);
2459 hr = IStorage_EnumElements(stg, 0,
NULL, 0, &
stat);
2460 ok(
hr ==
S_OK,
"should succeed, res=%lx\n",
hr);
2466 memset(&statstg, 0xad,
sizeof(statstg));
2467 while ((
hr = IEnumSTATSTG_Next(
stat, 1, &statstg, &got)) ==
S_OK && got == 1)
2469 if (
strcmp_ww(statstg.pwcsName, strmNameW) == 0)
2472 ok(0,
"found unexpected stream or storage\n");
2475 ok(
memcmp(&statstg, &statstg_null,
sizeof(statstg)) == 0,
"statstg is not zeroed\n");
2476 ok(found ==
TRUE,
"expected storage to contain stream \\0001CompObj\n");
2477 IEnumSTATSTG_Release(
stat);
2480 IStorage_Release(stg);
2490 static const WCHAR StorName[] = {
'D',
'a',
't',
'a',
'S',
'p',
'a',
'c',
'e',
'I',
'n',
'f',
'o',0 };
2495 ok(
hr==
S_OK,
"StgCreateDocfile failed\n");
2499 IStorage_Release(stg);
2502 ok(
hr==
S_OK,
"StgOpenStorage failed (result=%lx)\n",
hr);
2507 ok(
hr ==
S_OK,
"IStorage_CreateStorage failed (result=%lx)\n",
hr);
2511 c1 = IStorage_AddRef(stg);
2512 ok(c1 == 2,
"creating internal storage added references to ancestor\n");
2513 c1 = IStorage_AddRef(stg);
2514 IStorage_Release(stg2);
2515 c2 = IStorage_AddRef(stg) - 1;
2516 ok(c1 == c2,
"releasing internal storage removed references to ancestor\n");
2518 c1 = IStorage_Release(stg);
2519 while ( c1 ) c1 = IStorage_Release(stg);
2544 ok(
hr ==
S_OK,
"IStorage_CreateStorage failed: 0x%08lx\n",
hr);
2549 ok(
hr ==
S_OK,
"IStorage_CreateStream failed: 0x%08lx\n",
hr);
2554 ok(
hr ==
S_OK &&
bytes == strmA_name_size,
"IStream_Write failed: 0x%08lx, %ld of %ld bytes written\n",
hr,
bytes, strmA_name_size);
2557 ok(
hr ==
S_OK,
"IStorage_CreateStorage failed: 0x%08lx\n",
hr);
2562 ok(
hr ==
S_OK,
"IStorage_CreateStream failed: 0x%08lx\n",
hr);
2567 ok(
hr ==
S_OK &&
bytes == strmB_name_size,
"IStream_Write failed: 0x%08lx, %ld of %ld bytes written\n",
hr,
bytes, strmB_name_size);
2570 ok(
hr ==
S_OK,
"IStorage_CreateStream failed: 0x%08lx\n",
hr);
2575 ok(
hr ==
S_OK &&
bytes == strmC_name_size,
"IStream_Write failed: 0x%08lx, %ld of %ld bytes written\n",
hr,
bytes, strmC_name_size);
2579 IStream_Release(strmC);
2581 IStream_Release(strmB);
2583 IStorage_Release(stgB);
2585 IStream_Release(strmA);
2587 IStorage_Release(stgA);
2601 ok(
hr ==
S_OK,
"StgCreateDocfile failed: 0x%08lx\n",
hr);
2611 ok(
hr ==
S_OK,
"StgCreateDocfile failed: 0x%08lx\n",
hr);
2619 hr = IStorage_CopyTo(file1, 0,
NULL,
NULL, file2);
2620 ok(
hr ==
S_OK,
"CopyTo failed: 0x%08lx\n",
hr);
2627 ok(
hr ==
S_OK,
"OpenStorage failed: 0x%08lx\n",
hr);
2632 ok(
hr ==
S_OK,
"OpenStream failed: 0x%08lx\n",
hr);
2637 ok(
hr ==
S_OK,
"Read failed: 0x%08lx\n",
hr);
2642 IStream_Release(strm_tmp);
2645 IStorage_Release(stg_tmp);
2650 ok(
hr ==
S_OK,
"OpenStorage failed: 0x%08lx\n",
hr);
2655 ok(
hr ==
S_OK,
"OpenStream failed: 0x%08lx\n",
hr);
2660 ok(
hr ==
S_OK,
"Read failed: 0x%08lx\n",
hr);
2665 IStream_Release(strm_tmp);
2668 IStorage_Release(stg_tmp);
2673 ok(
hr ==
S_OK,
"OpenStream failed: 0x%08lx\n",
hr);
2678 ok(
hr ==
S_OK,
"Read failed: 0x%08lx\n",
hr);
2683 IStream_Release(strm_tmp);
2688 IStorage_Release(file1);
2690 IStorage_Release(file2);
2707 ok(
hr ==
S_OK,
"StgCreateDocfile failed: 0x%08lx\n",
hr);
2717 ok(
hr ==
S_OK,
"StgCreateDocfile failed: 0x%08lx\n",
hr);
2722 hr = IStorage_CopyTo(file1, 0,
NULL, (SNB)snb_exclude, file2);
2723 ok(
hr ==
S_OK,
"CopyTo failed: 0x%08lx\n",
hr);
2732 IStorage_Release(stg_tmp);
2738 IStream_Release(strm_tmp);
2742 ok(
hr ==
S_OK,
"OpenStorage failed: 0x%08lx\n",
hr);
2747 ok(
hr ==
S_OK,
"OpenStream failed: 0x%08lx\n",
hr);
2752 ok(
hr ==
S_OK,
"Read failed: 0x%08lx\n",
hr);
2757 IStream_Release(strm_tmp);
2760 IStorage_Release(stg_tmp);
2767 IStream_Release(strm_tmp);
2771 IStorage_Release(file1);
2773 IStorage_Release(file2);
2788 ok(
hr ==
S_OK,
"StgCreateDocfile failed: 0x%08lx\n",
hr);
2798 ok(
hr ==
S_OK,
"StgCreateDocfile failed: 0x%08lx\n",
hr);
2803 hr = IStorage_CopyTo(file1, 1, &IID_IStorage,
NULL, file2);
2804 ok(
hr ==
S_OK,
"CopyTo failed: 0x%08lx\n",
hr);
2813 IStorage_Release(stg_tmp);
2819 IStream_Release(strm_tmp);
2825 IStorage_Release(stg_tmp);
2831 IStream_Release(strm_tmp);
2835 ok(
hr ==
S_OK,
"OpenStream failed: 0x%08lx\n",
hr);
2840 ok(
hr ==
S_OK,
"Read failed: 0x%08lx\n",
hr);
2845 IStream_Release(strm_tmp);
2850 IStorage_Release(file1);
2852 IStorage_Release(file2);
2866 ok(
hr ==
S_OK,
"StgCreateDocfile failed: 0x%08lx\n",
hr);
2876 ok(
hr ==
S_OK,
"StgCreateDocfile failed: 0x%08lx\n",
hr);
2881 hr = IStorage_CopyTo(file1, 1, &IID_IStream,
NULL, file2);
2882 ok(
hr ==
S_OK,
"CopyTo failed: 0x%08lx\n",
hr);
2889 ok(
hr ==
S_OK,
"OpenStorage failed: 0x%08lx\n",
hr);
2896 IStream_Release(strm_tmp);
2898 IStorage_Release(stg_tmp);
2903 ok(
hr ==
S_OK,
"OpenStorage failed: 0x%08lx\n",
hr);
2910 IStream_Release(strm_tmp);
2912 IStorage_Release(stg_tmp);
2919 IStream_Release(strm_tmp);
2923 IStorage_Release(file1);
2925 IStorage_Release(file2);
2936 static const WCHAR stgname[] = {
'P',
'E',
'R',
'M',
'S',
'T',
'G',0 };
2937 static const WCHAR stgname2[] = {
'S',
'T',
'G',0 };
2938 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
2939 static const WCHAR stmname2[] = {
'E',
'N',
'T',
'S',0 };
2947 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
2951 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08lx\n",
r);
2955 ok(
r==
S_OK,
"IStorage->CreateStream failed, hr=%08lx\n",
r);
2956 IStream_Release(stm);
2959 r = IStorage_RenameElement(stg2, stmname, stmname2);
2960 ok(
r==
S_OK,
"IStorage->RenameElement failed, hr=%08lx\n",
r);
2969 ok(
r==
S_OK,
"IStorage_OpenStream failed, hr=%08lx\n",
r);
2972 IStorage_Release(stg2);
2975 IStorage_RenameElement(stg, stgname, stgname2);
2984 ok(
r==
S_OK,
"IStorage_OpenStream should fail, hr=%08lx\n",
r);
2989 ok(
r==
S_OK,
"IStorage_OpenStream failed, hr=%08lx\n",
r);
2992 IStorage_Release(stg2);
2995 IStorage_Release(stg);
2998 ok(
ret,
"deleted file\n");
3016 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
3018 r = IStorage_Stat( stg, &
stat, STATFLAG_DEFAULT );
3019 ok(
r==
S_OK,
"Storage_Stat failed with error 0x%08lx\n",
r);
3024 IStorage_Release( stg );
3027 ok(
r==
S_OK,
"StgOpenStorage failed with error 0x%08lx\n",
r);
3029 r = IStorage_Stat( stg, &
stat, STATFLAG_DEFAULT );
3030 ok(
r==
S_OK,
"Storage_Stat failed with error 0x%08lx\n",
r);
3035 IStorage_Release( stg );
3051 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
3053 r = IStorage_Stat( stg, &
stat, STATFLAG_DEFAULT );
3054 ok(
r==
S_OK,
"Storage_Stat failed with error 0x%08lx\n",
r);
3059 IStorage_Release( stg );
3062 ok(
r==
S_OK,
"StgOpenStorage failed with error 0x%08lx\n",
r);
3064 r = IStorage_Stat( stg, &
stat, STATFLAG_DEFAULT );
3065 ok(
r==
S_OK,
"Storage_Stat failed with error 0x%08lx\n",
r);
3070 IStorage_Release( stg );
3083 static const WCHAR stgname[] = {
'P',
'E',
'R',
'M',
'S',
'T',
'G',0 };
3091 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
3095 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08lx\n",
r);
3098 r = IStorage_EnumElements(stg2, 0,
NULL, 0, &ee);
3099 ok(
r==
S_OK,
"IStorage->EnumElements failed, hr=%08lx\n",
r);
3102 ref = IStorage_Release(stg2);
3110 r = IStorage_DestroyElement(stg, stgname);
3111 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08lx\n",
r);
3113 r = IEnumSTATSTG_Reset(ee);
3116 IEnumSTATSTG_Release(ee);
3118 IStorage_Release(stg);
3121 ok(
ret,
"deleted file\n");
3126 IStorage *stg, *stg2, *stg3, *stg4;
3129 static const WCHAR stgname[] = {
'S',
'T',
'G',
'1',0 };
3130 static const WCHAR stgname2[] = {
'S',
'T',
'G',
'2',0 };
3131 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
3139 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
3143 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08lx\n",
r);
3147 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08lx\n",
r);
3151 ok(
r==
S_OK,
"IStorage->CreateStream failed, hr=%08lx\n",
r);
3154 r = IStorage_CopyTo(stg2, 0,
NULL,
NULL, stg3);
3155 ok(
r==
S_OK,
"IStorage->CopyTo failed, hr=%08lx\n",
r);
3157 IStream_Release(stm);
3161 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08lx\n",
r);
3164 r = IStorage_CopyTo(stg2, 0,
NULL,
NULL, stg3);
3165 ok(
r==
S_OK,
"IStorage->CopyTo failed, hr=%08lx\n",
r);
3167 IStorage_Release(stg4);
3168 IStorage_Release(stg3);
3169 IStorage_Release(stg2);
3170 IStorage_Release(stg);
3173 ok(
ret,
"deleted file\n");
3178 IStorage *stg, *stg2, *stg3, *stg4;
3180 static const WCHAR stgname[] = {
'S',
'T',
'G',
'1',0 };
3181 static const WCHAR stgname2[] = {
'S',
'T',
'G',
'2',0 };
3189 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
3193 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08lx\n",
r);
3196 r = IStorage_CopyTo(stg, 0,
NULL,
NULL, stg2);
3201 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08lx\n",
r);
3204 r = IStorage_CopyTo(stg, 0,
NULL,
NULL, stg2);
3209 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08lx\n",
r);
3212 r = IStorage_CopyTo(stg, 0,
NULL,
NULL, stg4);
3216 r = IStorage_CopyTo(stg, 1, &IID_IStorage,
NULL, stg4);
3217 ok(
r==
S_OK,
"IStorage->CopyTo failed, hr=%08lx\n",
r);
3219 IStorage_Release(stg4);
3220 IStorage_Release(stg3);
3221 IStorage_Release(stg2);
3222 IStorage_Release(stg);
3225 ok(
ret,
"deleted file\n");
3238 ok(
r ==
S_OK,
"CreateILockBytesOnHGlobal failed, hr=%lx\n",
r);
3243 ok(
r ==
S_OK,
"ILockBytes_WriteAt failed, hr=%lx\n",
r);
3247 ok(
r ==
S_OK,
"ILockBytes_WriteAt failed, hr=%lx\n",
r);
3250 ok(
r ==
S_OK,
"StgCreateDocfileOnILockBytes failed, hr=%lx\n",
r);
3252 IStorage_Release(stg);
3256 ok(
r ==
S_OK,
"StgOpenStorageOnILockBytes failed, hr=%lx\n",
r);
3260 r = IStorage_Stat(stg, &
stat, STATFLAG_NONAME);
3261 ok(
r ==
S_OK,
"StgOpenStorageOnILockBytes failed, hr=%lx\n",
r);
3264 IStorage_Release(stg);
3267 r = ILockBytes_Stat(ilb, &
stat, STATFLAG_NONAME);
3268 ok(
r ==
S_OK,
"ILockBytes_Stat failed, hr=%lx\n",
r);
3269 ok(
stat.cbSize.LowPart < 2512,
"expected truncated size, got %ld\n",
stat.cbSize.LowPart);
3271 ILockBytes_Release(ilb);
3276 static const WCHAR filename[] = {
's',
't',
'o',
'r',
'a',
'g',
'e',
'.',
's',
't',
'g',0};
3284 ok(
hr ==
S_OK,
"StgCreateDocfile failed\n");
3298 IStorage_Release(stg);
3305 static const WCHAR fileW[] = {
'w',
'i',
'n',
'e',
't',
'e',
's',
't',0};
3316 IStorage_Release(stg);
3322 IStorage_Release(stg);
3329 hr = IStorage_QueryInterface(stg, &IID_IDirectWriterLock, (
void**)&dwlock);
3331 IStorage_Release(stg);
3339 ref = IStorage_AddRef(stg);
3340 IStorage_Release(stg);
3342 hr = IStorage_QueryInterface(stg, &IID_IDirectWriterLock, (
void**)&dwlock);
3345 ref2 = IStorage_AddRef(stg);
3346 IStorage_Release(stg);
3347 ok(ref2 ==
ref + 1,
"got %lu\n", ref2);
3349 IDirectWriterLock_Release(dwlock);
3350 IStorage_Release(stg);
3423 "file with mode %lx should not be openable with %s permission\n",
current->stg_mode,
desc);
3442 static const WCHAR filename[] = {
'w',
'i',
'n',
'e',
't',
'e',
's',
't',0};
3450 DWORD open_mode = 0;
3463 IStorage_Release(stg);
3481 BOOL locked, expect_locked;
3483 const int* next_lock =
current->locked_bytes;
3507 if ((ol.
Offset&0x1ff) == *next_lock)
3509 expect_locked =
TRUE;
3513 expect_locked =
FALSE;
3515 ok(locked == expect_locked,
"byte %lx of file with mode %lx is %slocked but should %sbe\n",
3516 ol.
Offset,
current->stg_mode, locked?
"":
"not ", expect_locked?
"":
"not ");
3522 IStorage_Release( stg );
3529 const int* next_range =
current->fail_ranges;
3539 if (ol.
Offset == 0x7fffff92 ||
3544 if (ol.
Offset < 0x7fffff00)
3557 if (!expect_failed && (ol.
Offset&0x1ff) == next_range[0])
3559 expect_failed =
TRUE;
3561 else if (expect_failed && (ol.
Offset&0x1ff) == next_range[1])
3563 expect_failed =
FALSE;
3567 ok(failed == expect_failed,
"open with byte %lx locked, mode %lx %s but should %s\n",
3568 ol.
Offset,
current->stg_mode, failed?
"failed":
"succeeded", expect_failed?
"fail":
"succeed");
3584 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
3595 ok(
r==
S_OK,
"StgCreateDocfile failed %lx\n",
r);
3598 ok(
r ==
S_OK,
"WriteClassStg failed %lx\n",
r);
3601 ok(
r==
S_OK,
"IStorage->CreateStream failed %lx\n",
r);
3604 r = IStream_Seek(stm,
pos, 0, &upos);
3605 ok(
r==
S_OK,
"IStream->Seek failed %lx\n",
r);
3607 r = IStream_Write(stm,
"aaa", 3,
NULL);
3608 ok(
r==
S_OK,
"IStream->Write failed %lx\n",
r);
3610 r = IStorage_Commit(stg, STGC_ONLYIFCURRENT);
3611 ok(
r==
S_OK,
"IStorage->Commit failed %lx\n",
r);
3615 ok(
r==
S_OK,
"StgOpenStorage failed %lx\n",
r);
3619 r = IStream_Seek(stm,
pos, 0, &upos);
3620 ok(
r==
S_OK,
"IStream->Seek failed %lx\n",
r);
3622 r = IStream_Write(stm,
"ccc", 3,
NULL);
3623 ok(
r==
S_OK,
"IStream->Write failed %lx\n",
r);
3625 r = IStorage_Commit(stg, STGC_ONLYIFCURRENT);
3626 ok(
r==
S_OK,
"IStorage->Commit failed %lx\n",
r);
3630 r = IStream_Seek(stm,
pos, 0, &upos);
3631 ok(
r==
S_OK,
"IStream->Seek failed %lx\n",
r);
3633 r = IStream_Write(stm,
"ddd", 3,
NULL);
3634 ok(
r==
S_OK,
"IStream->Write failed %lx\n",
r);
3636 IStream_Release(stm);
3640 ok(
r==
S_OK,
"IStorage->OpenStream failed %lx\n",
r);
3643 r = IStream_Seek(stm,
pos, 0, &upos);
3644 ok(
r==
S_OK,
"IStream->Seek failed %lx\n",
r);
3647 ok(
r==
S_OK,
"IStream->Read failed %lx\n",
r);
3648 ok(bytesread == 3,
"read wrong number of bytes %li\n", bytesread);
3653 r = IStream_Seek(stm,
pos, 0, &upos);
3654 ok(
r==
S_OK,
"IStream->Seek failed %lx\n",
r);
3656 r = IStream_Write(stm,
"bbb", 3,
NULL);
3657 ok(
r==
S_OK,
"IStream->Write failed %lx\n",
r);
3659 IStream_Release(stm);
3662 r = IStorage_Commit(stgrw, STGC_ONLYIFCURRENT);
3666 r = IStorage_Commit(stgrw, STGC_DEFAULT);
3667 ok(
r==
S_OK,
"IStorage->Commit failed %lx\n",
r);
3670 r = IStorage_Revert(stg);
3671 ok(
r==
S_OK,
"IStorage->Revert failed %lx\n",
r);
3674 ok(
r==
S_OK,
"IStorage->CreateStream failed %lx\n",
r);
3677 r = IStream_Seek(stm,
pos, 0, &upos);
3678 ok(
r==
S_OK,
"IStream->Seek failed %lx\n",
r);
3681 ok(
r==
S_OK,
"IStream->Read failed %lx\n",
r);
3682 ok(bytesread == 3,
"read wrong number of bytes %li\n", bytesread);
3686 r = IStorage_Commit(stg, STGC_ONLYIFCURRENT);
3689 IStream_Release(stm);
3691 IStorage_Release(stg);
3692 IStorage_Release(stgrw);
3702 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
3703 static const WCHAR stmname2[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'2',0 };
3715 ok(
r==
S_OK,
"StgCreateDocfile failed %lx\n",
r);
3718 ok(
r ==
S_OK,
"WriteClassStg failed %lx\n",
r);
3721 ok(
r==
S_OK,
"IStorage->CreateStream failed %lx\n",
r);
3724 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &upos);
3725 ok(
r==
S_OK,
"IStream->Seek failed %lx\n",
r);
3732 ok(
r==
S_OK,
"IStream->Write failed %lx\n",
r);
3735 r = IStorage_Commit(stg, STGC_DEFAULT);
3736 ok(
r==
S_OK,
"IStorage->Commit failed %lx\n",
r);
3745 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &upos);
3746 ok(
r==
S_OK,
"IStream->Seek failed %lx\n",
r);
3748 r = IStream_Write(stm,
"b", 1,
NULL);
3749 ok(
r==
S_OK,
"IStream->Write failed %lx\n",
r);
3751 r = IStorage_Commit(stg, STGC_OVERWRITE);
3752 ok(
r==
S_OK,
"IStorage->Commit failed %lx\n",
r);
3758 IStream_Release(stm);
3760 IStorage_RenameElement(stg, stmname, stmname2);
3762 r = IStorage_Commit(stg, STGC_OVERWRITE);
3763 ok(
r==
S_OK,
"IStorage->Commit failed %lx\n",
r);
3769 IStorage_Release(stg);
3772 ok(
r==
S_OK,
"StgOpenStorage failed %lx\n",
r);
3775 ok(
r==
S_OK,
"IStorage->CreateStream failed %lx\n",
r);
3778 ok(
r==
S_OK,
"IStream->Write failed %lx\n",
r);
3779 ok(bytesread ==
sizeof(
buffer),
"only read %ld bytes\n", bytesread);
3780 ok(
buffer[0] ==
'b',
"unexpected data at byte 0\n");
3785 ok(
i ==
sizeof(
buffer),
"unexpected data at byte %i\n",
i);
3788 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &upos);
3789 ok(
r==
S_OK,
"IStream->Seek failed %lx\n",
r);
3791 r = IStream_Write(stm,
"c", 1,
NULL);
3792 ok(
r==
S_OK,
"IStream->Write failed %lx\n",
r);
3794 r = IStorage_Commit(stg, STGC_OVERWRITE);
3795 ok(
r==
S_OK,
"IStorage->Commit failed %lx\n",
r);
3801 IStream_Release(stm);
3803 IStorage_Release(stg);
3812 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
3821 ok(
hr==
S_OK,
"StgCreateDocfileOnILockBytes failed %lx\n",
hr);
3824 ok(
hr==
S_OK,
"IStorage_CreateStream failed %lx\n",
hr);
3826 IStream_Write(stm,
"Hello World!", 12,
NULL);
3827 IStream_Release(stm);
3831 hr = IStorage_Commit(stg, 0);
3832 ok(
hr==
S_OK,
"IStorage_Commit failed %lx\n",
hr);
3836 IStorage_Release(stg);
3838 ok(!lockbytes->
lock_called,
"unexpected call to LockRegion\n");
3843 ok(
hr==
S_OK,
"StgCreateDocfileOnILockBytes failed %lx\n",
hr);
3846 ok(
hr==
S_OK,
"IStorage_CreateStream failed %lx\n",
hr);
3848 IStream_Write(stm,
"Hello World!", 12,
NULL);
3849 IStream_Release(stm);
3851 hr = IStorage_Commit(stg, 0);
3852 ok(
hr==
S_OK,
"IStorage_Commit failed %lx\n",
hr);
3854 ok(lockbytes->
lock_called,
"expected LockRegion to be called\n");
3860 hr = IStorage_Commit(stg, 0);
3865 IStorage_Release(stg);
static unsigned char bytes[4]
#define InterlockedIncrement
#define InterlockedDecrement
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL delete_on_release, IStream **stream)
HRESULT WINAPI ReadClassStg(IStorage *pstg, CLSID *pclsid)
HRESULT WINAPI WriteClassStm(IStream *pStm, REFCLSID rclsid)
HRESULT WINAPI ReadClassStm(IStream *pStm, CLSID *pclsid)
HRESULT WINAPI GetConvertStg(IStorage *stg)
HRESULT WINAPI StgIsStorageILockBytes(ILockBytes *plkbyt)
HRESULT WINAPI WriteClassStg(IStorage *pStg, REFCLSID rclsid)
#define INVALID_HANDLE_VALUE
#define CreateFileA(a, b, c, d, e, f, g)
#define FILE_ATTRIBUTE_NORMAL
#define WideCharToMultiByte
#define MultiByteToWideChar
static void cleanup(void)
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
BOOL WINAPI UnlockFileEx(IN HANDLE hFile, IN DWORD dwReserved, IN DWORD nNumberOfBytesToUnLockLow, IN DWORD nNumberOfBytesToUnLockHigh, IN LPOVERLAPPED lpOverlapped)
BOOL WINAPI LockFileEx(IN HANDLE hFile, IN DWORD dwFlags, IN DWORD dwReserved, IN DWORD nNumberOfBytesToLockLow, IN DWORD nNumberOfBytesToLockHigh, IN LPOVERLAPPED lpOverlapped)
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
DWORD WINAPI GetFullPathNameA(IN LPCSTR lpFileName, IN DWORD nBufferLength, OUT LPSTR lpBuffer, OUT LPSTR *lpFilePart)
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
_ACRTIMP size_t __cdecl strlen(const char *)
HRESULT WINAPI StgOpenStorage(const OLECHAR *pwcsName, IStorage *pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstgOpen)
HRESULT WINAPI StgCreateDocfileOnILockBytes(ILockBytes *plkbyt, DWORD grfMode, DWORD reserved, IStorage **ppstgOpen)
HRESULT WINAPI StgCreateDocfile(LPCOLESTR pwcsName, DWORD grfMode, DWORD reserved, IStorage **ppstgOpen)
HRESULT WINAPI WriteFmtUserTypeStg(LPSTORAGE pstg, CLIPFORMAT cf, LPOLESTR lpszUserType)
HRESULT WINAPI StgCreateStorageEx(const WCHAR *pwcsName, DWORD grfMode, DWORD stgfmt, DWORD grfAttrs, STGOPTIONS *pStgOptions, void *reserved, REFIID riid, void **ppObjectOpen)
HRESULT WINAPI SetConvertStg(IStorage *storage, BOOL convert)
HRESULT WINAPI StgOpenStorageOnILockBytes(ILockBytes *plkbyt, IStorage *pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstgOpen)
static const WCHAR fileW[]
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
GLuint GLuint GLsizei count
GLdouble GLdouble GLdouble r
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint GLint GLboolean GLint GLenum access
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
void *WINAPI CoTaskMemAlloc(SIZE_T size)
void WINAPI CoTaskMemFree(void *ptr)
HRESULT WINAPI CreateILockBytesOnHGlobal(HGLOBAL global, BOOL delete_on_release, ILockBytes **ret)
#define LOCKFILE_FAIL_IMMEDIATELY
#define LOCKFILE_EXCLUSIVE_LOCK
#define memcpy(s1, s2, n)
struct task_struct * current
D3D11_SHADER_VARIABLE_DESC desc
static const struct access_res create[16]
static const LARGE_INTEGER llZero
static void test_direct_swmr(void)
static const int rw_fail_ranges[]
static BOOL can_open(LPCWSTR filename, DWORD access, DWORD sharing)
static HRESULT create_test_file(IStorage *dest)
static void test_create_storage_modes(void)
static const char file1_nameA[]
static void test_substorage_share(void)
static const WCHAR stgA_name[]
static void test_access(void)
static const int priority_locked_bytes[]
static void DeleteTestLockBytes(TestLockBytes *This)
static const int tr_fail_ranges[]
static const int wodw_locked_bytes[]
static const WCHAR strmA_name[]
static void test_overwrite(void)
static BOOL is_zero_length(LPCSTR filename)
static TestLockBytes * impl_from_ILockBytes(ILockBytes *iface)
static void test_copyto_recursive(void)
static void test_streamenum(void)
static void test_toplevel_stat(void)
static const int rwex_locked_bytes[]
static void test_copyto(void)
static HRESULT WINAPI TestLockBytes_ReadAt(ILockBytes *iface, ULARGE_INTEGER ulOffset, void *pv, ULONG cb, ULONG *pcbRead)
static const int roex_locked_bytes[]
static void test_simple(void)
static void test_rename(void)
static void check_access(LPCWSTR filename, const struct lock_test *current, DWORD access, DWORD sharing, const char *desc, DWORD open_mode)
static void test_custom_lockbytes(void)
static void test_writeclassstg(void)
static int strcmp_ww(LPCWSTR strw1, LPCWSTR strw2)
static void test_copyto_iidexclusions_stream(void)
#define ok_ole_success(hr, func)
static const WCHAR file2_name[]
static void test_transact(void)
static void test_references(void)
static HRESULT WINAPI TestLockBytes_LockRegion(ILockBytes *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
static void test_readonly(void)
static BOOL touch_file(LPCSTR filename)
static const int pr_fail_ranges[]
static const ILockBytesVtbl TestLockBytes_Vtbl
static const int dw_fail_ranges[]
static void test_substorage_enum(void)
static const char file2_nameA[]
static const WCHAR strmB_name[]
static const int rwdw_fail_ranges[]
static const DWORD share_modes[4]
static void test_ReadClassStm(void)
static HRESULT WINAPI TestLockBytes_Flush(ILockBytes *iface)
static void test_fmtusertypestg(void)
static void test_revert(void)
static void test_copyto_snbexclusions(void)
static const int tr_locked_bytes[]
static HRESULT WINAPI TestLockBytes_Stat(ILockBytes *iface, STATSTG *pstatstg, DWORD grfStatFlag)
static void test_convert(void)
static const struct access_res create_close[16]
static void test_copyto_iidexclusions_storage(void)
static void test_parent_free(void)
static const int rw_locked_bytes[]
static void _test_file_access(LPCSTR file, const struct access_res *ares, DWORD line)
static void test_open_storage(void)
static BOOL is_existing_file(LPCSTR filename)
static void test_stgcreatestorageex(void)
static HRESULT WINAPI TestLockBytes_WriteAt(ILockBytes *iface, ULARGE_INTEGER ulOffset, const void *pv, ULONG cb, ULONG *pcbWritten)
static void check_sharing(LPCWSTR filename, const struct lock_test *current, DWORD access, DWORD sharing, const char *desc, DWORD *open_mode)
static const DWORD access_modes[4]
static void test_nonroot_transacted(void)
static const WCHAR stgB_name[]
static const int rwex_fail_ranges[]
static const int rwdw_locked_bytes[]
static const struct access_res create_commit[16]
static CHAR filenameA[MAX_PATH]
static void test_hglobal_storage_stat(void)
static void test_transacted_shared(void)
static void test_locking(void)
static void test_storage_suminfo(void)
static ULONG WINAPI TestLockBytes_Release(ILockBytes *iface)
static const WCHAR file1_name[]
static const struct lock_test lock_tests[]
#define test_file_access(file, ares)
static void CreateTestLockBytes(TestLockBytes **This)
static HRESULT WINAPI TestLockBytes_UnlockRegion(ILockBytes *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
static const int roex_fail_ranges[]
static const int no_locked_bytes[]
static const WCHAR strmC_name[]
static const int nosn_locked_bytes[]
static void test_copyto_locking(void)
static void test_storage_refcount(void)
static ULONG WINAPI TestLockBytes_AddRef(ILockBytes *iface)
static void test_hglobal_storage_creation(void)
static HRESULT WINAPI TestLockBytes_SetSize(ILockBytes *iface, ULARGE_INTEGER cb)
static void test_storage_stream(void)
static HRESULT WINAPI TestLockBytes_QueryInterface(ILockBytes *iface, REFIID iid, void **ppv)
#define FILE_SHARE_DELETE
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK ULONG sharing
#define STGM_SHARE_DENY_NONE
#define STGM_SHARE_EXCLUSIVE
#define STGM_DELETEONRELEASE
#define STGM_SHARE_DENY_WRITE
#define STGM_SHARE_DENY_READ
const FMTID FMTID_SummaryInformation
const GUID IID_IPersistStream
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
#define IsEqualIID(riid1, riid2)
#define IsEqualCLSID(rclsid1, rclsid2)
ILockBytes ILockBytes_iface
#define CONTAINING_RECORD(address, type, field)
DWORD WINAPI GetLastError(void)
#define STG_E_SHAREVIOLATION
#define STG_E_INVALIDPOINTER
#define ERROR_SHARING_VIOLATION
#define STG_E_LOCKVIOLATION
#define STG_E_INVALIDNAME
#define STG_E_INVALIDHEADER
#define STG_E_FILEALREADYEXISTS
#define STG_E_FILENOTFOUND
#define STG_E_ACCESSDENIED
#define STG_E_INVALIDPARAMETER
#define STG_E_INVALIDFLAG
#define STG_E_UNIMPLEMENTEDFUNCTION
#define STG_E_INVALIDFUNCTION