27#define NONAMELESSUNION
28#define NONAMELESSSTRUCT
38DEFINE_GUID( test_stg_cls, 0x88888888, 0x0425, 0x0000, 0,0,0,0,0,0,0,0);
40#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
45static const char file1_nameA[] = {
'c',
'o',
'p',
'y',
't',
'e',
's',
't',
'A',0};
47static const char file2_nameA[] = {
'c',
'o',
'p',
'y',
't',
'e',
's',
't',
'B',0};
58 CHAR stra1[512], stra2[512];
119 if (!pcbRead) pcbRead = &
dummy;
144 if (!pcbWritten) pcbWritten = &
dummy;
150 hr = ILockBytes_SetSize(iface, new_size);
170 if (
This->buffer_size <
cb.QuadPart)
177 This->contents = new_buffer;
180 if (
cb.QuadPart >
This->size)
193 return This->lock_hr;
200 return This->lock_hr;
204 STATSTG *pstatstg,
DWORD grfStatFlag)
207 static const WCHAR dummy_name[] = {
'd',
'u',
'm',
'm',
'y',0};
211 memset(pstatstg, 0,
sizeof(STATSTG));
213 if (!(grfStatFlag & STATFLAG_NONAME))
217 memcpy(pstatstg->pwcsName, dummy_name,
sizeof(dummy_name));
220 pstatstg->type = STGTY_LOCKBYTES;
221 pstatstg->cbSize.QuadPart =
This->size;
222 pstatstg->grfLocksSupported =
This->locks_supported;
254 ok(
This->ref == 1,
"test lock bytes %p deleted with %i references instead of 1\n",
This,
This->ref);
268 ok(
r ==
S_OK,
"CreateILockBytesOnHGlobal failed\n");
271 ok(
r ==
S_FALSE,
"StgIsStorageILockBytes should have failed\n");
275 ok(
r ==
S_OK,
"StgCreateDocfileOnILockBytes failed\n");
278 ok(
r ==
S_OK,
"WriteClassStg failed\n");
281 ok(
r ==
S_OK,
"StgIsStorageILockBytes failed\n");
284 r = IStorage_Stat( stg, &
stat, 0 );
286 ok(
stat.pwcsName ==
NULL,
"storage name not null\n");
287 ok(
stat.type == 1,
"type is wrong\n");
288 ok(
stat.grfMode == 0x12,
"grf mode is incorrect\n");
289 ok( !
memcmp(&
stat.clsid, &test_stg_cls,
sizeof test_stg_cls),
"CLSID is wrong\n");
291 refcount = IStorage_Release( stg );
292 ok( refcount == 0,
"IStorage refcount is wrong\n");
293 refcount = ILockBytes_Release( ilb );
294 ok( refcount == 0,
"ILockBytes refcount is wrong\n");
341 ok(stg ==
NULL,
"stg was set\n");
345 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
346 r = IStorage_Release(stg);
347 ok(
r == 0,
"storage not released\n");
373 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
374 r = IStorage_Release(stg);
375 ok(
r == 0,
"storage not released\n");
384 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
385 r = IStorage_Release(stg);
386 ok(
r == 0,
"storage not released\n");
390 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
391 r = IStorage_Release(stg);
392 ok(
r == 0,
"storage not released\n");
397 ok(
r==
S_OK,
"StgCreateDocfile the excel way failed\n");
400 r = IStorage_Release(stg);
401 ok(
r == 0,
"storage not released\n");
407 ok(
r==
S_OK,
"StgCreateDocfile the windows media way failed\n");
410 r = IStorage_Release(stg);
411 ok(
r == 0,
"storage not released\n");
417 ok(
r==
S_OK,
"StgCreateDocfile the excel way failed\n");
420 r = IStorage_Release(stg);
421 ok(
r == 0,
"storage not released\n");
426 ok(
r==
S_OK,
"StgCreateDocfile the excel way failed\n");
429 r = IStorage_Release(stg);
430 ok(
r == 0,
"storage not released\n");
435 ok(
r==
S_OK,
"StgCreateDocfile the powerpoint way failed\n");
438 r = IStorage_Release(stg);
439 ok(
r == 0,
"storage not released\n");
445 ok(
r==
S_OK,
"StgCreateDocFile failed\n");
446 r = IStorage_Release(stg);
447 ok(
r == 0,
"storage not released\n");
459 pStgCreateStorageEx = (
void *)
GetProcAddress(hOle32,
"StgCreateStorageEx");
460 if (!pStgCreateStorageEx)
481 win_skip(
"skipping test on win9x\n");
485 r = IStorage_Release(stg);
486 ok(
r == 0,
"storage not released\n");
498 ok(
r==
S_OK,
"StgCreateStorageEx with NULL options failed\n");
499 r = IStorage_Release(stg);
500 ok(
r == 0,
"storage not released\n");
506 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
507 static const WCHAR longname[] = {
508 'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
509 'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',
'a',0
518 unsigned char buffer[0x100];
525 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
538 "IStorage->CreateStream wrong error, got %d GetLastError()=%d\n",
r,
GetLastError());
541 r = IStorage_CreateStream(stg, stmname,
STGM_READ, 0, 0, &stm );
543 r = IStorage_CreateStream(stg, stmname,
STGM_WRITE, 0, 0, &stm );
552 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
555 r = IStream_QueryInterface(stm, &
IID_IPersist, (
void**)&unk);
560 r = IStream_Release(stm);
561 ok(
r == 0,
"wrong ref count\n");
564 r = IStorage_DestroyElement(stg,stmname);
565 ok(
r==
S_OK,
"IStorage->DestroyElement failed\n");
569 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
571 r = IStream_Clone(stm, &stm2);
572 ok(
r==
S_OK,
"failed to clone stream\n");
576 r = IStream_Write(stm,
"Hello\n", 0,
NULL );
577 ok(
r==
S_OK,
"failed to write stream\n");
578 r = IStream_Write(stm,
"Hello\n", 0, &
count );
579 ok(
r==
S_OK,
"failed to write stream\n");
580 r = IStream_Write(stm,
"Hello\n", 6, &
count );
581 ok(
r==
S_OK,
"failed to write stream\n");
582 r = IStream_Commit(stm, STGC_DEFAULT );
583 ok(
r==
S_OK,
"failed to commit stream\n");
584 r = IStream_Commit(stm, STGC_DEFAULT );
585 ok(
r==
S_OK,
"failed to commit stream\n");
589 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &
p );
590 ok(
r==
S_OK,
"failed to seek stream\n");
591 ok(
p.QuadPart == 3,
"at wrong place\n");
593 ok(
r==
S_OK,
"failed to read\n");
594 ok(
count == 3,
"read bytes past end of stream\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 == 10,
"at wrong place\n");
600 ok(
r==
S_OK,
"failed to read\n");
601 ok(
count == 0,
"read bytes past end of stream\n");
602 pos.QuadPart = 10000;
603 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &
p );
604 ok(
r==
S_OK,
"failed to seek stream\n");
605 ok(
p.QuadPart == 10000,
"at wrong place\n");
607 ok(
r==
S_OK,
"failed to read\n");
608 ok(
count == 0,
"read bytes past end of stream\n");
612 r = IStream_SetSize(stm,
p);
613 ok(
r==
S_OK,
"failed to set pos\n");
615 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &
p );
616 ok(
r==
S_OK,
"failed to seek stream\n");
617 ok(
p.QuadPart == 4997,
"at wrong place\n");
619 ok(
r==
S_OK,
"failed to read\n");
620 ok(
count == 3,
"read bytes past end of stream\n");
622 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &
p );
623 ok(
r==
S_OK,
"failed to seek stream\n");
624 ok(
p.QuadPart == 5001,
"at wrong place\n");
626 ok(
r==
S_OK,
"failed to read\n");
627 ok(
count == 0,
"read bytes past end of stream\n");
628 pos.QuadPart = 10000;
629 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &
p );
630 ok(
r==
S_OK,
"failed to seek stream\n");
631 ok(
p.QuadPart == 10000,
"at wrong place\n");
633 ok(
r==
S_OK,
"failed to read\n");
634 ok(
count == 0,
"read bytes past end of stream\n");
638 r = IStream_Seek(stm,
pos, 3, &
p );
640 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET,
NULL);
641 ok(
r==
S_OK,
"failed to seek stream\n");
642 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &
p );
643 ok(
r==
S_OK,
"failed to seek stream\n");
644 r = IStream_SetSize(stm,
p);
645 ok(
r==
S_OK,
"failed to set pos\n");
647 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &
p );
648 ok(
r==
S_OK,
"failed to seek stream\n");
649 ok(
p.QuadPart == 10,
"at wrong place\n");
651 ok(
r==
S_OK,
"failed to set pos\n");
652 ok(
count == 0,
"read bytes from empty stream\n");
653 pos.QuadPart = 10000;
654 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &
p );
655 ok(
r==
S_OK,
"failed to seek stream\n");
656 ok(
p.QuadPart == 10000,
"at wrong place\n");
658 ok(
r==
S_OK,
"failed to set pos\n");
659 ok(
count == 0,
"read bytes from empty stream\n");
661 r = IStream_Seek(stm,
pos, STREAM_SEEK_END, &
p );
662 ok(
r==
S_OK,
"failed to seek stream\n");
663 ok(
p.QuadPart == 0,
"at wrong place\n");
665 ok(
r==
S_OK,
"failed to set pos\n");
666 ok(
count == 0,
"read bytes from empty stream\n");
669 r = IStream_Release(stm2);
670 ok(
r == 0,
"wrong ref count\n");
674 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
676 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &
p);
677 ok(
r==
STG_E_REVERTED,
"overwritten stream should return STG_E_REVERTED instead of 0x%08x\n",
r);
679 r = IStream_Release(stm2);
680 ok(
r == 0,
"wrong ref count\n");
681 r = IStream_Release(stm);
682 ok(
r == 0,
"wrong ref count\n");
684 r = IStorage_Release(stg);
685 ok(
r == 0,
"wrong ref count\n");
691 ok(
r ==
S_OK,
"should succeed\n");
695 ok(
r ==
STG_E_INVALIDFLAG,
"IStorage->OpenStream should return STG_E_INVALIDFLAG instead of 0x%08x\n",
r);
696 IStorage_Release(stg);
700 ok(
ret,
"file should exist\n");
743 static const WCHAR szNonExist[] = {
'n',
'o',
'n',
'e',
'x',
'i',
's',
't',0 };
766 ok(
r!=
S_OK,
"StgOpenStorage failed: 0x%08x\n",
r);
767 if (
r==
S_OK) IStorage_Release(stg);
773 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
774 IStorage_Release(stg);
797 ok(
r==
S_OK,
"StgOpenStorage failed\n");
800 r = IStorage_Release(stg);
801 ok(
r == 0,
"wrong ref count\n");
805 ok(
r==
S_OK,
"StgOpenStorage failed\n");
808 r = IStorage_Release(stg);
809 ok(
r == 0,
"wrong ref count\n");
815 ok(
r==
S_OK,
"StgOpenStorage failed\n");
818 r = IStorage_Release(stg);
819 ok(
r == 0,
"wrong ref count\n");
823 ok(
r==
S_OK,
"StgOpenStorage failed\n");
828 r = IStorage_Release(stg);
829 ok(
r == 0,
"wrong ref count\n");
834 ok(
r==
S_OK,
"StgOpenStorage failed\n");
837 static const WCHAR stmname[] = {
'w',
'i',
'n',
'e',
't',
'e',
's',
't',0};
847 r = IStorage_Release(stg);
848 ok(
r == 0,
"wrong ref count\n");
854 ok(
r ==
S_OK,
"should succeed\n");
856 IStorage_Release(stg);
861 ok(
r ==
S_OK,
"should succeed\n");
863 IStorage_Release(stg);
867 ok(
r ==
S_OK,
"should succeed\n");
869 IStorage_Release(stg);
873 ok(
r ==
S_OK,
"should succeed\n");
875 IStorage_Release(stg);
880 ok(
r ==
S_OK,
"should succeed\n");
882 ok(
r ==
S_OK,
"should succeed\n");
884 IStorage_Release(stg2);
886 IStorage_Release(stg);
908 ok(
ret,
"file didn't exist\n");
923 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
925 r = IStorage_QueryInterface( stg, &IID_IPropertySetStorage, (
LPVOID) &propset );
926 ok(
r ==
S_OK,
"query interface failed\n");
958 ok(
r ==
S_OK,
"failed to create property set storage\n");
961 IPropertyStorage_Release(ps);
966 ok(
r ==
S_OK,
"failed to create property set storage\n");
968 IPropertyStorage_Release(ps);
973 ok(
r ==
S_OK,
"open failed\n");
975 IPropertyStorage_Release(ps);
979 ok(
r ==
S_OK,
"failed to delete property set storage\n");
982 r = IPropertySetStorage_Open( propset,
NULL,
986 IPropertyStorage_Release(ps);
989 r = IPropertySetStorage_Open( propset, &IID_IStorage,
993 IPropertyStorage_Release(ps);
1001 IPropertyStorage_Release(ps);
1008 IPropertyStorage_Release(ps);
1010 r = IPropertySetStorage_Release( propset );
1011 ok(
r == 1,
"ref count wrong\n");
1013 r = IStorage_Release(stg);
1014 ok(
r == 0,
"ref count wrong\n");
1025 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
1036 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
1039 ok(
r ==
S_OK,
"WriteClassStg failed\n");
1041 r = IStorage_Commit( stg, STGC_DEFAULT );
1042 ok(
r ==
S_OK,
"IStorage_Commit failed\n");
1046 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1048 r = IStorage_Release( stg );
1049 ok (
r == 0,
"storage not released\n");
1052 r = IStream_Seek( stm,
pos, 0, &upos );
1055 r = IStream_Stat( stm, &
stat, STATFLAG_DEFAULT );
1058 r = IStream_Write( stm,
"Test string",
strlen(
"Test string"),
NULL);
1059 ok (
r ==
STG_E_REVERTED,
"IStream_Write should return STG_E_REVERTED instead of 0x%08x\n",
r);
1062 ok (
r ==
STG_E_REVERTED,
"IStream_Read should return STG_E_REVERTED instead of 0x%08x\n",
r);
1064 r = IStream_Release(stm);
1065 ok (
r == 0,
"stream not released\n");
1070 ok(
r==
S_OK,
"StgOpenStorage failed with error 0x%08x\n",
r);
1078 ok(
r==
S_OK,
"StgOpenStorage failed with error 0x%08x\n",
r);
1079 IStorage_Release(stg);
1082 ok(
r==
S_OK,
"StgOpenStorage failed with error 0x%08x\n",
r);
1085 static const WCHAR stgname[] = {
' ',
' ',
' ',
'2',
'9',0 };
1086 static const WCHAR stgname2[] = {
'C',
'V',
'_',
'i',
'e',
'w',0 };
1087 static const WCHAR stmname2[] = {
'V',
'a',
'r',
'2',
'D',
'a',
't',
'a',0 };
1092 r = IStorage_Stat( stg, &statstg, STATFLAG_NONAME );
1093 ok(
r ==
S_OK,
"Stat should have succeeded instead of returning 0x%08x\n",
r);
1094 ok(statstg.type == STGTY_STORAGE,
"Statstg type should have been STGTY_STORAGE instead of %d\n", statstg.type);
1095 ok(
U(statstg.cbSize).LowPart == 0,
"Statstg cbSize.LowPart should have been 0 instead of %d\n",
U(statstg.cbSize).LowPart);
1096 ok(
U(statstg.cbSize).HighPart == 0,
"Statstg cbSize.HighPart should have been 0 instead of %d\n",
U(statstg.cbSize).HighPart);
1098 "Statstg grfMode should have been 0x10022 instead of 0x%x\n", statstg.grfMode);
1099 ok(statstg.grfLocksSupported == 0,
"Statstg grfLocksSupported should have been 0 instead of %d\n", statstg.grfLocksSupported);
1100 ok(
IsEqualCLSID(&statstg.clsid, &test_stg_cls),
"Statstg clsid is not test_stg_cls\n");
1101 ok(statstg.grfStateBits == 0,
"Statstg grfStateBits should have been 0 instead of %d\n", statstg.grfStateBits);
1102 ok(statstg.reserved == 0,
"Statstg reserved should have been 0 instead of %d\n", statstg.reserved);
1105 ok(
r ==
S_OK,
"CreateStorage should have succeeded instead of returning 0x%08x\n",
r);
1107 r = IStorage_Stat( stg2, &statstg, STATFLAG_DEFAULT );
1108 ok(
r ==
S_OK,
"Stat should have succeeded instead of returning 0x%08x\n",
r);
1109 ok(!
memcmp(statstg.pwcsName, stgname,
sizeof(stgname)),
1110 "Statstg pwcsName should have been the name the storage was created with\n");
1111 ok(statstg.type == STGTY_STORAGE,
"Statstg type should have been STGTY_STORAGE instead of %d\n", statstg.type);
1112 ok(
U(statstg.cbSize).LowPart == 0,
"Statstg cbSize.LowPart should have been 0 instead of %d\n",
U(statstg.cbSize).LowPart);
1113 ok(
U(statstg.cbSize).HighPart == 0,
"Statstg cbSize.HighPart should have been 0 instead of %d\n",
U(statstg.cbSize).HighPart);
1115 "Statstg grfMode should have been STGM_SHARE_EXCLUSIVE instead of 0x%x\n", statstg.grfMode);
1116 ok(statstg.grfLocksSupported == 0,
"Statstg grfLocksSupported should have been 0 instead of %d\n", statstg.grfLocksSupported);
1118 ok(statstg.grfStateBits == 0,
"Statstg grfStateBits should have been 0 instead of %d\n", statstg.grfStateBits);
1119 ok(statstg.reserved == 0,
"Statstg reserved should have been 0 instead of %d\n", statstg.reserved);
1123 ok(
r ==
STG_E_ACCESSDENIED,
"CreateStorage should have returned STG_E_ACCESSDENIED instead of 0x%08x\n",
r);
1126 ok(
r ==
STG_E_ACCESSDENIED,
"CreateStream should have returned STG_E_ACCESSDENIED instead of 0x%08x\n",
r);
1128 IStorage_Release(stg2);
1130 r = IStorage_Release(stg);
1131 ok(
r == 0,
"wrong ref count\n");
1136 ok(
r==
S_OK,
"StgOpenStorage failed with error 0x%08x\n",
r);
1139 r = IStorage_Release(stg);
1140 ok(
r == 0,
"wrong ref count\n");
1144 ok(
r==
S_OK,
"StgOpenStorage failed with error 0x%08x\n",
r);
1147 static const WCHAR stgname[] = {
' ',
' ',
' ',
'2',
'9',0 };
1151 r = IStorage_Stat( stg, &statstg, STATFLAG_NONAME );
1152 ok(
r ==
S_OK,
"Stat should have succeeded instead of returning 0x%08x\n",
r);
1153 ok(statstg.type == STGTY_STORAGE,
"Statstg type should have been STGTY_STORAGE instead of %d\n", statstg.type);
1154 ok(
U(statstg.cbSize).LowPart == 0,
"Statstg cbSize.LowPart should have been 0 instead of %d\n",
U(statstg.cbSize).LowPart);
1155 ok(
U(statstg.cbSize).HighPart == 0,
"Statstg cbSize.HighPart should have been 0 instead of %d\n",
U(statstg.cbSize).HighPart);
1157 "Statstg grfMode should have been 0x10022 instead of 0x%x\n", statstg.grfMode);
1158 ok(statstg.grfLocksSupported == 0,
"Statstg grfLocksSupported should have been 0 instead of %d\n", statstg.grfLocksSupported);
1159 ok(
IsEqualCLSID(&statstg.clsid, &test_stg_cls),
"Statstg clsid is not test_stg_cls\n");
1160 ok(statstg.grfStateBits == 0,
"Statstg grfStateBits should have been 0 instead of %d\n", statstg.grfStateBits);
1161 ok(statstg.reserved == 0,
"Statstg reserved should have been 0 instead of %d\n", statstg.reserved);
1164 ok(
r ==
S_OK,
"CreateStorage should have succeeded instead of returning 0x%08x\n",
r);
1166 IStorage_Release(stg2);
1168 r = IStorage_Commit( stg, 0 );
1169 ok(
r ==
S_OK,
"Commit should have succeeded instead of returning 0x%08x\n",
r);
1171 r = IStorage_Release(stg);
1172 ok(
r == 0,
"wrong ref count\n");
1183 CLSID temp_cls, cls2;
1190 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
1193 ok(
r ==
E_INVALIDARG,
"ReadClassStg should return E_INVALIDARG instead of 0x%08X\n",
r);
1195 memset(&temp_cls, 0xcc,
sizeof(temp_cls));
1196 memset(&cls2, 0xcc,
sizeof(cls2));
1202 ok(
r ==
E_INVALIDARG,
"ReadClassStg should return E_INVALIDARG instead of 0x%08X\n",
r);
1204 temp_cls.Data1 = 0xdeadbeef;
1206 ok(
r ==
S_OK,
"ReadClassStg failed with 0x%08X\n",
r);
1211 ok(
r ==
E_INVALIDARG,
"WriteClassStg should return E_INVALIDARG instead of 0x%08X\n",
r);
1217 ok(
r ==
S_OK,
"WriteClassStg failed with 0x%08X\n",
r);
1220 ok(
r ==
S_OK,
"ReadClassStg failed with 0x%08X\n",
r);
1221 ok(
IsEqualCLSID(&temp_cls, &test_stg_cls),
"ReadClassStg returned wrong clsid\n");
1223 r = IStorage_Release( stg );
1224 ok (
r == 0,
"storage not released\n");
1234 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
1235 static const WCHAR stmname2[] = {
'A',
'B',
'C',
'D',
'E',
'F',
'G',
'H',
'I',0 };
1236 static const WCHAR stmname3[] = {
'A',
'B',
'C',
'D',
'E',
'F',
'G',
'H',
'I',
'J',0 };
1237 static const STATSTG stat_null;
1247 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
1250 ok(
r ==
S_OK,
"WriteClassStg failed\n");
1252 r = IStorage_Commit( stg, STGC_DEFAULT );
1253 ok(
r ==
S_OK,
"IStorage_Commit failed\n");
1257 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1259 IStream_Release(stm);
1262 r = IStorage_EnumElements(stg, 0,
NULL, 0, &ee);
1263 ok(
r==
S_OK,
"IStorage->EnumElements failed\n");
1267 ok(
r==
S_OK,
"IEnumSTATSTG->Next failed\n");
1268 ok(
count == 1,
"count wrong\n");
1273 r = IEnumSTATSTG_Release(ee);
1274 ok(
r==
S_OK,
"EnumSTATSTG_Release failed with error 0x%08x\n",
r);
1277 r = IStorage_EnumElements(stg, 0,
NULL, 0, &ee);
1278 ok(
r==
S_OK,
"IStorage->EnumElements failed\n");
1280 r = IStorage_DestroyElement(stg, stmname);
1281 ok(
r==
S_OK,
"IStorage->DestroyElement failed\n");
1286 ok(
r==
S_FALSE,
"IEnumSTATSTG->Next failed\n");
1287 ok(
count == 0,
"count wrong\n");
1291 r = IEnumSTATSTG_Reset(ee);
1292 ok(
r==
S_OK,
"IEnumSTATSTG->Reset failed\n");
1296 ok(
r==
S_FALSE,
"IEnumSTATSTG->Next failed\n");
1297 ok(
count == 0,
"count wrong\n");
1300 r = IEnumSTATSTG_Reset(ee);
1301 ok(
r==
S_OK,
"IEnumSTATSTG->Reset failed\n");
1304 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1306 r = IStream_Release(stm);
1307 ok(
r==
S_OK,
"Stream_Release failed with error 0x%08x\n",
r);
1311 ok(
r==
S_OK,
"IEnumSTATSTG->Next failed\n");
1312 ok(
count == 1,
"count wrong\n");
1321 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1323 r = IStream_Release(stm);
1324 ok(
r==
S_OK,
"Stream_Release failed with error 0x%08x\n",
r);
1328 ok(
r==
S_OK,
"IEnumSTATSTG->Next failed\n");
1329 ok(
count == 1,
"count wrong\n");
1339 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1341 r = IStream_Release(stm);
1342 ok(
r==
S_OK,
"Stream_Release failed with error 0x%08x\n",
r);
1344 r = IEnumSTATSTG_Reset(ee);
1345 ok(
r==
S_OK,
"IEnumSTATSTG->Reset failed\n");
1349 ok(
r==
S_OK,
"IEnumSTATSTG->Next failed\n");
1350 ok(
count == 1,
"count wrong\n");
1358 r = IStorage_DestroyElement(stg, stmname);
1359 ok(
r==
S_OK,
"IStorage->DestroyElement failed\n");
1361 r = IStorage_DestroyElement(stg, stmname2);
1362 ok(
r==
S_OK,
"IStorage->DestroyElement failed\n");
1366 ok(
r==
S_OK,
"IEnumSTATSTG->Next failed\n");
1367 ok(
count == 1,
"count wrong\n");
1375 r = IStorage_Release( stg );
1379 r = IEnumSTATSTG_Reset(ee);
1380 ok(
r==
S_OK,
"IEnumSTATSTG->Reset failed\n");
1384 ok(
r==
S_OK,
"IEnumSTATSTG->Next failed\n");
1385 ok(
count == 1,
"count wrong\n");
1398 "StgCreateDocfile failed, res=%x\n",
r);
1400 r = IEnumSTATSTG_Release(ee);
1401 ok (
r == 0,
"enum not released\n");
1411 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
1412 static const WCHAR stmname2[] = {
'F',
'O',
'O',0 };
1413 static const WCHAR stgname[] = {
'P',
'E',
'R',
'M',
'S',
'T',
'G',0 };
1414 static const WCHAR stgname2[] = {
'T',
'E',
'M',
'P',
'S',
'T',
'G',0 };
1422 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
1426 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1428 r = IStream_Write(stm,
"this is stream 1\n", 16,
NULL);
1429 ok(
r==
S_OK,
"IStream->Write failed\n");
1431 IStream_Release(stm);
1434 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08x\n",
r);
1440 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08x\n",
r);
1443 IStorage_Release(stg3);
1445 r = IStorage_Commit(stg, 0);
1446 ok(
r==
S_OK,
"IStorage->Commit failed\n");
1449 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08x\n",
r);
1452 IStorage_Release(stg3);
1454 IStorage_Release(stg2);
1460 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1462 r = IStream_Write(stm,
"this is stream 2\n", 16,
NULL);
1463 ok(
r==
S_OK,
"IStream->Write failed\n");
1466 r = IStream_Commit(stm, STGC_ONLYIFCURRENT | STGC_DANGEROUSLYCOMMITMERELYTODISKCACHE);
1467 ok(
r==
S_OK,
"IStream->Commit failed\n");
1470 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08x\n",
r);
1473 IStorage_Release(stg2);
1475 IStream_Release(stm);
1477 IStorage_Release(stg);
1482 ok(
r==
S_OK,
"StgOpenStorage failed\n");
1502 IStream_Release(stm);
1507 IStorage_Release(stg2);
1513 ok(
r==
S_OK,
"IStorage->OpenStream should succeed %08x\n",
r);
1515 IStream_Release(stm);
1518 ok(
r==
S_OK,
"IStorage->OpenStorage should succeed %08x\n",
r);
1522 ok(
r==
S_OK,
"IStorage->OpenStorage should succeed %08x\n",
r);
1524 IStorage_Release(stg3);
1529 IStorage_Release(stg3);
1531 IStorage_Release(stg2);
1534 IStorage_Release(stg);
1537 ok(
ret,
"deleted file\n");
1545 static const WCHAR stgname[] = {
'P',
'E',
'R',
'M',
'S',
'T',
'G',0 };
1546 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
1547 static const WCHAR othername[] = {
'N',
'E',
'W',
'N',
'A',
'M',
'E',0 };
1555 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
1559 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08x\n",
r);
1567 IStorage_Release(stg3);
1573 IStorage_Release(stg3);
1576 r = IStorage_RenameElement(stg, stgname, othername);
1578 if (
SUCCEEDED(
r)) IStorage_RenameElement(stg, othername, stgname);
1581 r = IStorage_DestroyElement(stg, stgname);
1582 ok(
r==
S_OK,
"IStorage->DestroyElement failed, hr=%08x\n",
r);
1588 IStream_Release(stm);
1590 IStorage_Release(stg2);
1595 ok(
r==
S_OK,
"IStorage->CreateStream failed, hr=%08x\n",
r);
1603 IStream_Release(stm2);
1609 IStream_Release(stm2);
1612 r = IStorage_RenameElement(stg, stmname, othername);
1614 if (
SUCCEEDED(
r)) IStorage_RenameElement(stg, othername, stmname);
1617 r = IStorage_DestroyElement(stg, stmname);
1618 ok(
r==
S_OK,
"IStorage->DestroyElement failed, hr=%08x\n",
r);
1620 r = IStream_Write(stm,
"this shouldn't work\n", 20,
NULL);
1623 IStream_Release(stm);
1626 IStorage_Release(stg);
1629 ok(
ret,
"deleted file\n");
1637 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
1638 static const WCHAR stmname2[] = {
'F',
'O',
'O',0 };
1639 static const WCHAR stgname[] = {
'P',
'E',
'R',
'M',
'S',
'T',
'G',0 };
1640 static const WCHAR stgname2[] = {
'T',
'E',
'M',
'P',
'S',
'T',
'G',0 };
1649 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
1653 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1655 r = IStream_Write(stm,
"this is stream 1\n", 16,
NULL);
1656 ok(
r==
S_OK,
"IStream->Write failed\n");
1659 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08x\n",
r);
1665 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08x\n",
r);
1668 IStorage_Release(stg3);
1670 r = IStorage_Commit(stg, 0);
1671 ok(
r==
S_OK,
"IStorage->Commit failed\n");
1674 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08x\n",
r);
1677 IStorage_Release(stg3);
1682 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1684 r = IStream_Write(stm2,
"this is stream 2\n", 16,
NULL);
1685 ok(
r==
S_OK,
"IStream->Write failed\n");
1688 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08x\n",
r);
1690 r = IStorage_Revert(stg);
1691 ok(
r==
S_OK,
"Storage_Revert failed with error 0x%08x\n",
r);
1694 r = IStream_Write(stm,
"this shouldn't work\n", 20,
NULL);
1697 r = IStream_Write(stm2,
"this shouldn't work\n", 20,
NULL);
1700 r = IStorage_Stat(stg2, &statstg, STATFLAG_NONAME);
1703 r = IStorage_Stat(stg3, &statstg, STATFLAG_NONAME);
1706 IStream_Release(stm);
1707 IStream_Release(stm2);
1708 IStorage_Release(stg2);
1709 IStorage_Release(stg3);
1726 IStream_Release(stm);
1731 IStorage_Release(stg2);
1737 ok(
r==
S_OK,
"IStorage->OpenStream should succeed %08x\n",
r);
1739 IStream_Release(stm);
1742 ok(
r==
S_OK,
"IStorage->OpenStorage should succeed %08x\n",
r);
1746 ok(
r==
S_OK,
"IStorage->OpenStorage should succeed %08x\n",
r);
1748 IStorage_Release(stg3);
1753 IStorage_Release(stg3);
1755 IStorage_Release(stg2);
1758 IStorage_Release(stg);
1761 ok(
ret,
"deleted file\n");
1766 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
1769 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1771 r = IStorage_Revert(stg);
1772 ok(
r==
S_OK,
"IStorage->Revert failed %08x\n",
r);
1774 r = IStream_Write(stm,
"this works\n", 11,
NULL);
1775 ok(
r==
S_OK,
"IStream_Write should succeed %08x\n",
r);
1777 IStream_Release(stm);
1778 IStorage_Release(stg);
1781 ok(
ret,
"deleted file\n");
1789 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
1790 static const WCHAR stgname[] = {
'P',
'E',
'R',
'M',
'S',
'T',
'G',0 };
1800 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
1804 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08x\n",
r);
1810 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1816 ok(
r==
S_OK,
"IStorage->CreateStorage failed\n");
1820 ref = IStorage_Release(stg2);
1821 ok(
ref == 0,
"IStorage still has %u references\n",
ref);
1826 r = IStream_Write(stm,
"this should fail\n", 17,
NULL);
1829 IStream_Release(stm);
1831 r = IStorage_Stat(stg3, &statstg, STATFLAG_NONAME);
1834 r = IStorage_SetStateBits(stg3, 1, 1);
1837 IStorage_Release(stg3);
1841 IStorage_Release(stg);
1844 ok(
ret,
"deleted file\n");
1852 static const WCHAR stgname[] = {
'P',
'E',
'R',
'M',
'S',
'T',
'G',0 };
1853 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
1854 static const WCHAR stmname2[] = {
'F',
'O',
'O',0 };
1862 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
1866 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08x\n",
r);
1872 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1874 IStream_Release(stm);
1876 IStorage_Commit(stg2, 0);
1880 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1882 IStream_Release(stm);
1884 IStorage_Revert(stg2);
1888 ok(
r==
S_OK,
"IStorage->OpenStream should succeed %08x\n",
r);
1890 IStream_Release(stm);
1895 IStream_Release(stm);
1897 IStorage_Release(stg2);
1902 ok(
r==
S_OK,
"IStorage->OpenStorage failed, hr=%08x\n",
r);
1908 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08x\n",
r);
1910 IStorage_Release(stg3);
1913 r = IStorage_Commit(stg2, 0);
1916 IStorage_Release(stg2);
1919 IStorage_Release(stg);
1924 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
1928 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08x\n",
r);
1934 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1936 IStream_Release(stm);
1938 IStorage_Commit(stg2, 0);
1942 ok(
r==
S_OK,
"IStorage->CreateStream failed\n");
1944 IStream_Release(stm);
1946 IStorage_Revert(stg2);
1950 ok(
r==
S_OK,
"IStorage->OpenStream should succeed %08x\n",
r);
1952 IStream_Release(stm);
1957 IStream_Release(stm);
1959 IStorage_Release(stg2);
1962 IStorage_Release(stg);
1965 ok(
ret,
"deleted file\n");
1976 ok(
hr ==
E_INVALIDARG,
"ReadClassStm should have returned E_INVALIDARG instead of 0x%08x\n",
hr);
1984 ok(
hr ==
E_INVALIDARG,
"ReadClassStm should have returned E_INVALIDARG instead of 0x%08x\n",
hr);
1987 memset(&clsid2, 0xcc,
sizeof(clsid2));
1994 ok(
hr ==
STG_E_READFAULT,
"ReadClassStm should have returned STG_E_READFAULT instead of 0x%08x\n",
hr);
1997 hr = IStream_Seek(pStream,
llZero, STREAM_SEEK_SET,
NULL);
2001 ok(
IsEqualCLSID(&
clsid, &test_stg_cls),
"clsid should have been set to CLSID_WineTest\n");
2003 IStream_Release(pStream);
2107 "(%d, handle, %d): Expected %d, got %d\n",
2113 "(%d, lasterr, %d): Expected %d, got %d\n",
2122#define test_file_access(file, ares) _test_file_access(file, ares, __LINE__)
2126 static const WCHAR fileW[] = {
'w',
'i',
'n',
'e',
't',
'e',
's',
't',0};
2127 static const char fileA[] =
"winetest";
2134 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
2138 hr = IStorage_Commit(stg, STGC_DEFAULT);
2139 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
2143 IStorage_Release(stg);
2152 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
2156 hr = IStorage_Commit(stg, STGC_DEFAULT);
2157 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
2161 IStorage_Release(stg);
2170 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
2174 hr = IStorage_Commit(stg, STGC_DEFAULT);
2175 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
2179 IStorage_Release(stg);
2188 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
2192 hr = IStorage_Commit(stg, STGC_DEFAULT);
2193 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
2197 IStorage_Release(stg);
2206 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
2210 hr = IStorage_Commit(stg, STGC_DEFAULT);
2211 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
2215 IStorage_Release(stg);
2224 IStorage_Release(stg);
2233 IStorage_Release(stg);
2244 static const WCHAR fileW[] = {
'w',
'i',
'n',
'e',
't',
'e',
's',
't',0};
2245 static const WCHAR storageW[] = {
's',
't',
'o',
'r',
'a',
'g',
'e',0};
2246 static const WCHAR streamW[] = {
's',
't',
'r',
'e',
'a',
'm',0};
2249 ok(
hr ==
S_OK,
"should succeed, res=%x\n",
hr);
2253 ok(
hr ==
S_OK,
"should succeed, res=%x\n",
hr);
2257 ok(
hr ==
S_OK,
"should succeed, res=%x\n",
hr);
2260 IStorage_Release(stg2);
2262 IStorage_Release(stg);
2267 ok(
hr ==
S_OK,
"should succeed, res=%x\n",
hr);
2271 ok(
hr ==
S_OK,
"should succeed, res=%x\n",
hr);
2290 IStorage_Release(stg3);
2296 IStorage_Release(stg3);
2299 hr = IStorage_DestroyElement( stg2, streamW );
2303 hr = IStorage_DestroyElement( stg2, storageW );
2306 IStorage_Release(stg2);
2309 IStorage_Release(stg);
2322 static const WCHAR stgname[] = {
'S',
't',
'g',0 };
2323 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
2324 static const WCHAR stmname2[] = {
'S',
'm',
'a',
'l',
'l',0 };
2345 r = IStream_SetSize(stm, upos);
2348 r = IStream_Write(stm,
"foo", 3, &
count);
2353 r = IStream_Seek(stm,
pos, STREAM_SEEK_CUR, &upos);
2355 ok(upos.
QuadPart == 3,
"got %d\n", upos.
u.LowPart);
2357 r = IStream_Stat(stm, &
stat, STATFLAG_NONAME);
2362 ok(
stat.cbSize.QuadPart == 3,
"got %d\n",
stat.cbSize.u.LowPart);
2365 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &upos);
2367 ok(upos.
QuadPart == 1,
"got %d\n", upos.
u.LowPart);
2369 r = IStream_Stat(stm, &
stat, STATFLAG_NONAME);
2374 ok(
stat.cbSize.QuadPart == 1,
"got %d\n",
stat.cbSize.u.LowPart);
2376 IStream_Release(stm);
2382 r = IStream_SetSize(stm, upos);
2385 r = IStream_Write(stm,
"foo", 3, &
count);
2389 IStream_Release(stm);
2391 IStorage_Commit(stg, STGC_DEFAULT);
2392 IStorage_Release(stg);
2397 win_skip(
"Flag combination is not supported on NT4 and below\n");
2410 r = IStream_Stat(stm, &
stat, STATFLAG_NONAME);
2412 ok(
stat.cbSize.QuadPart == 6000,
"got %d\n",
stat.cbSize.u.LowPart);
2414 IStream_Release(stm);
2419 r = IStream_Stat(stm, &
stat, STATFLAG_NONAME);
2421 ok(
stat.cbSize.QuadPart == 4096,
"got %d\n",
stat.cbSize.u.LowPart);
2423 IStream_Release(stm);
2426 IStorage_Release(stg);
2436 static const char fileA[] = {
'f',
'm',
't',
't',
'e',
's',
't',0};
2437 static const WCHAR fileW[] = {
'f',
'm',
't',
't',
'e',
's',
't',0};
2438 static WCHAR userTypeW[] = {
'S',
't',
'g',
'U',
's',
'r',
'T',
'y',
'p',
'e',0};
2439 static const WCHAR strmNameW[] = {1,
'C',
'o',
'm',
'p',
'O',
'b',
'j',0};
2440 static const STATSTG statstg_null;
2443 ok(
hr ==
S_OK,
"should succeed, res=%x\n",
hr);
2449 ok(
hr ==
S_OK,
"should succeed, res=%x\n",
hr);
2452 hr = IStorage_EnumElements(stg, 0,
NULL, 0, &
stat);
2453 ok(
hr ==
S_OK,
"should succeed, res=%x\n",
hr);
2459 memset(&statstg, 0xad,
sizeof(statstg));
2460 while ((
hr = IEnumSTATSTG_Next(
stat, 1, &statstg, &got)) ==
S_OK && got == 1)
2462 if (
strcmp_ww(statstg.pwcsName, strmNameW) == 0)
2465 ok(0,
"found unexpected stream or storage\n");
2468 ok(
memcmp(&statstg, &statstg_null,
sizeof(statstg)) == 0,
"statstg is not zeroed\n");
2469 ok(found ==
TRUE,
"expected storage to contain stream \\0001CompObj\n");
2470 IEnumSTATSTG_Release(
stat);
2475 ok(
hr ==
S_OK,
"should succeed, res=%x\n",
hr);
2478 hr = IStorage_EnumElements(stg, 0,
NULL, 0, &
stat);
2479 ok(
hr ==
S_OK,
"should succeed, res=%x\n",
hr);
2485 memset(&statstg, 0xad,
sizeof(statstg));
2486 while ((
hr = IEnumSTATSTG_Next(
stat, 1, &statstg, &got)) ==
S_OK && got == 1)
2488 if (
strcmp_ww(statstg.pwcsName, strmNameW) == 0)
2491 ok(0,
"found unexpected stream or storage\n");
2494 ok(
memcmp(&statstg, &statstg_null,
sizeof(statstg)) == 0,
"statstg is not zeroed\n");
2495 ok(found ==
TRUE,
"expected storage to contain stream \\0001CompObj\n");
2496 IEnumSTATSTG_Release(
stat);
2499 IStorage_Release(stg);
2509 static const WCHAR StorName[] = {
'D',
'a',
't',
'a',
'S',
'p',
'a',
'c',
'e',
'I',
'n',
'f',
'o',0 };
2514 ok(
hr==
S_OK,
"StgCreateDocfile failed\n");
2518 IStorage_Release(stg);
2521 ok(
hr==
S_OK,
"StgOpenStorage failed (result=%x)\n",
hr);
2526 ok(
hr ==
S_OK,
"IStorage_CreateStorage failed (result=%x)\n",
hr);
2530 c1 = IStorage_AddRef(stg);
2531 ok(c1 == 2,
"creating internal storage added references to ancestor\n");
2532 c1 = IStorage_AddRef(stg);
2533 IStorage_Release(stg2);
2534 c2 = IStorage_AddRef(stg) - 1;
2535 ok(c1 == c2,
"releasing internal storage removed references to ancestor\n");
2537 c1 = IStorage_Release(stg);
2538 while ( c1 ) c1 = IStorage_Release(stg);
2563 ok(
hr ==
S_OK,
"IStorage_CreateStorage failed: 0x%08x\n",
hr);
2568 ok(
hr ==
S_OK,
"IStorage_CreateStream failed: 0x%08x\n",
hr);
2573 ok(
hr ==
S_OK &&
bytes == strmA_name_size,
"IStream_Write failed: 0x%08x, %d of %d bytes written\n",
hr,
bytes, strmA_name_size);
2576 ok(
hr ==
S_OK,
"IStorage_CreateStorage failed: 0x%08x\n",
hr);
2581 ok(
hr ==
S_OK,
"IStorage_CreateStream failed: 0x%08x\n",
hr);
2586 ok(
hr ==
S_OK &&
bytes == strmB_name_size,
"IStream_Write failed: 0x%08x, %d of %d bytes written\n",
hr,
bytes, strmB_name_size);
2589 ok(
hr ==
S_OK,
"IStorage_CreateStream failed: 0x%08x\n",
hr);
2594 ok(
hr ==
S_OK &&
bytes == strmC_name_size,
"IStream_Write failed: 0x%08x, %d of %d bytes written\n",
hr,
bytes, strmC_name_size);
2598 IStream_Release(strmC);
2600 IStream_Release(strmB);
2602 IStorage_Release(stgB);
2604 IStream_Release(strmA);
2606 IStorage_Release(stgA);
2620 ok(
hr ==
S_OK,
"StgCreateDocfile failed: 0x%08x\n",
hr);
2630 ok(
hr ==
S_OK,
"StgCreateDocfile failed: 0x%08x\n",
hr);
2638 hr = IStorage_CopyTo(file1, 0,
NULL,
NULL, file2);
2639 ok(
hr ==
S_OK,
"CopyTo failed: 0x%08x\n",
hr);
2646 ok(
hr ==
S_OK,
"OpenStorage failed: 0x%08x\n",
hr);
2651 ok(
hr ==
S_OK,
"OpenStream failed: 0x%08x\n",
hr);
2661 IStream_Release(strm_tmp);
2664 IStorage_Release(stg_tmp);
2669 ok(
hr ==
S_OK,
"OpenStorage failed: 0x%08x\n",
hr);
2674 ok(
hr ==
S_OK,
"OpenStream failed: 0x%08x\n",
hr);
2684 IStream_Release(strm_tmp);
2687 IStorage_Release(stg_tmp);
2692 ok(
hr ==
S_OK,
"OpenStream failed: 0x%08x\n",
hr);
2702 IStream_Release(strm_tmp);
2707 IStorage_Release(file1);
2709 IStorage_Release(file2);
2726 ok(
hr ==
S_OK,
"StgCreateDocfile failed: 0x%08x\n",
hr);
2736 ok(
hr ==
S_OK,
"StgCreateDocfile failed: 0x%08x\n",
hr);
2741 hr = IStorage_CopyTo(file1, 0,
NULL, (SNB)snb_exclude, file2);
2742 ok(
hr ==
S_OK,
"CopyTo failed: 0x%08x\n",
hr);
2751 IStorage_Release(stg_tmp);
2757 IStream_Release(strm_tmp);
2761 ok(
hr ==
S_OK,
"OpenStorage failed: 0x%08x\n",
hr);
2766 ok(
hr ==
S_OK,
"OpenStream failed: 0x%08x\n",
hr);
2776 IStream_Release(strm_tmp);
2779 IStorage_Release(stg_tmp);
2786 IStream_Release(strm_tmp);
2790 IStorage_Release(file1);
2792 IStorage_Release(file2);
2807 ok(
hr ==
S_OK,
"StgCreateDocfile failed: 0x%08x\n",
hr);
2817 ok(
hr ==
S_OK,
"StgCreateDocfile failed: 0x%08x\n",
hr);
2822 hr = IStorage_CopyTo(file1, 1, &IID_IStorage,
NULL, file2);
2823 ok(
hr ==
S_OK,
"CopyTo failed: 0x%08x\n",
hr);
2832 IStorage_Release(stg_tmp);
2838 IStream_Release(strm_tmp);
2844 IStorage_Release(stg_tmp);
2850 IStream_Release(strm_tmp);
2854 ok(
hr ==
S_OK,
"OpenStream failed: 0x%08x\n",
hr);
2864 IStream_Release(strm_tmp);
2869 IStorage_Release(file1);
2871 IStorage_Release(file2);
2885 ok(
hr ==
S_OK,
"StgCreateDocfile failed: 0x%08x\n",
hr);
2895 ok(
hr ==
S_OK,
"StgCreateDocfile failed: 0x%08x\n",
hr);
2900 hr = IStorage_CopyTo(file1, 1, &IID_IStream,
NULL, file2);
2901 ok(
hr ==
S_OK,
"CopyTo failed: 0x%08x\n",
hr);
2908 ok(
hr ==
S_OK,
"OpenStorage failed: 0x%08x\n",
hr);
2915 IStream_Release(strm_tmp);
2917 IStorage_Release(stg_tmp);
2922 ok(
hr ==
S_OK,
"OpenStorage failed: 0x%08x\n",
hr);
2929 IStream_Release(strm_tmp);
2931 IStorage_Release(stg_tmp);
2938 IStream_Release(strm_tmp);
2942 IStorage_Release(file1);
2944 IStorage_Release(file2);
2955 static const WCHAR stgname[] = {
'P',
'E',
'R',
'M',
'S',
'T',
'G',0 };
2956 static const WCHAR stgname2[] = {
'S',
'T',
'G',0 };
2957 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
2958 static const WCHAR stmname2[] = {
'E',
'N',
'T',
'S',0 };
2966 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
2970 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08x\n",
r);
2974 ok(
r==
S_OK,
"IStorage->CreateStream failed, hr=%08x\n",
r);
2975 IStream_Release(stm);
2978 r = IStorage_RenameElement(stg2, stmname, stmname2);
2979 ok(
r==
S_OK,
"IStorage->RenameElement failed, hr=%08x\n",
r);
2988 ok(
r==
S_OK,
"IStorage_OpenStream failed, hr=%08x\n",
r);
2991 IStorage_Release(stg2);
2994 IStorage_RenameElement(stg, stgname, stgname2);
3003 ok(
r==
S_OK,
"IStorage_OpenStream should fail, hr=%08x\n",
r);
3008 ok(
r==
S_OK,
"IStorage_OpenStream failed, hr=%08x\n",
r);
3011 IStorage_Release(stg2);
3014 IStorage_Release(stg);
3017 ok(
ret,
"deleted file\n");
3035 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
3037 r = IStorage_Stat( stg, &
stat, STATFLAG_DEFAULT );
3038 ok(
r==
S_OK,
"Storage_Stat failed with error 0x%08x\n",
r);
3043 IStorage_Release( stg );
3046 ok(
r==
S_OK,
"StgOpenStorage failed with error 0x%08x\n",
r);
3048 r = IStorage_Stat( stg, &
stat, STATFLAG_DEFAULT );
3049 ok(
r==
S_OK,
"Storage_Stat failed with error 0x%08x\n",
r);
3054 IStorage_Release( stg );
3070 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
3072 r = IStorage_Stat( stg, &
stat, STATFLAG_DEFAULT );
3073 ok(
r==
S_OK,
"Storage_Stat failed with error 0x%08x\n",
r);
3078 IStorage_Release( stg );
3081 ok(
r==
S_OK,
"StgOpenStorage failed with error 0x%08x\n",
r);
3083 r = IStorage_Stat( stg, &
stat, STATFLAG_DEFAULT );
3084 ok(
r==
S_OK,
"Storage_Stat failed with error 0x%08x\n",
r);
3089 IStorage_Release( stg );
3102 static const WCHAR stgname[] = {
'P',
'E',
'R',
'M',
'S',
'T',
'G',0 };
3110 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
3114 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08x\n",
r);
3117 r = IStorage_EnumElements(stg2, 0,
NULL, 0, &ee);
3118 ok(
r==
S_OK,
"IStorage->EnumElements failed, hr=%08x\n",
r);
3121 ref = IStorage_Release(stg2);
3129 r = IStorage_DestroyElement(stg, stgname);
3130 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08x\n",
r);
3132 r = IEnumSTATSTG_Reset(ee);
3135 IEnumSTATSTG_Release(ee);
3137 IStorage_Release(stg);
3140 ok(
ret,
"deleted file\n");
3145 IStorage *stg, *stg2, *stg3, *stg4;
3148 static const WCHAR stgname[] = {
'S',
'T',
'G',
'1',0 };
3149 static const WCHAR stgname2[] = {
'S',
'T',
'G',
'2',0 };
3150 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
3158 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
3162 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08x\n",
r);
3166 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08x\n",
r);
3170 ok(
r==
S_OK,
"IStorage->CreateStream failed, hr=%08x\n",
r);
3173 r = IStorage_CopyTo(stg2, 0,
NULL,
NULL, stg3);
3174 ok(
r==
S_OK,
"IStorage->CopyTo failed, hr=%08x\n",
r);
3176 IStream_Release(stm);
3180 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08x\n",
r);
3183 r = IStorage_CopyTo(stg2, 0,
NULL,
NULL, stg3);
3184 ok(
r==
S_OK,
"IStorage->CopyTo failed, hr=%08x\n",
r);
3186 IStorage_Release(stg4);
3187 IStorage_Release(stg3);
3188 IStorage_Release(stg2);
3189 IStorage_Release(stg);
3192 ok(
ret,
"deleted file\n");
3197 IStorage *stg, *stg2, *stg3, *stg4;
3199 static const WCHAR stgname[] = {
'S',
'T',
'G',
'1',0 };
3200 static const WCHAR stgname2[] = {
'S',
'T',
'G',
'2',0 };