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;
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 };
3208 ok(
r==
S_OK,
"StgCreateDocfile failed\n");
3212 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08x\n",
r);
3215 r = IStorage_CopyTo(stg, 0,
NULL,
NULL, stg2);
3220 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08x\n",
r);
3223 r = IStorage_CopyTo(stg, 0,
NULL,
NULL, stg2);
3228 ok(
r==
S_OK,
"IStorage->CreateStorage failed, hr=%08x\n",
r);
3231 r = IStorage_CopyTo(stg, 0,
NULL,
NULL, stg4);
3235 r = IStorage_CopyTo(stg, 1, &IID_IStorage,
NULL, stg4);
3236 ok(
r==
S_OK,
"IStorage->CopyTo failed, hr=%08x\n",
r);
3238 IStorage_Release(stg4);
3239 IStorage_Release(stg3);
3240 IStorage_Release(stg2);
3241 IStorage_Release(stg);
3244 ok(
ret,
"deleted file\n");
3257 ok(
r ==
S_OK,
"CreateILockBytesOnHGlobal failed, hr=%x\n",
r);
3262 ok(
r ==
S_OK,
"ILockBytes_WriteAt failed, hr=%x\n",
r);
3266 ok(
r ==
S_OK,
"ILockBytes_WriteAt failed, hr=%x\n",
r);
3269 ok(
r ==
S_OK,
"StgCreateDocfileOnILockBytes failed, hr=%x\n",
r);
3271 IStorage_Release(stg);
3275 ok(
r ==
S_OK,
"StgOpenStorageOnILockBytes failed, hr=%x\n",
r);
3279 r = IStorage_Stat(stg, &
stat, STATFLAG_NONAME);
3280 ok(
r ==
S_OK,
"StgOpenStorageOnILockBytes failed, hr=%x\n",
r);
3283 IStorage_Release(stg);
3286 r = ILockBytes_Stat(ilb, &
stat, STATFLAG_NONAME);
3287 ok(
r ==
S_OK,
"ILockBytes_Stat failed, hr=%x\n",
r);
3288 ok(
stat.cbSize.u.LowPart < 2512,
"expected truncated size, got %d\n",
stat.cbSize.u.LowPart);
3290 ILockBytes_Release(ilb);
3295 static const WCHAR filename[] = {
's',
't',
'o',
'r',
'a',
'g',
'e',
'.',
's',
't',
'g',0};
3303 ok(
hr ==
S_OK,
"StgCreateDocfile failed\n");
3317 IStorage_Release(stg);
3324 static const WCHAR fileW[] = {
'w',
'i',
'n',
'e',
't',
'e',
's',
't',0};
3335 IStorage_Release(stg);
3341 IStorage_Release(stg);
3348 hr = IStorage_QueryInterface(stg, &IID_IDirectWriterLock, (
void**)&dwlock);
3350 IStorage_Release(stg);
3358 ref = IStorage_AddRef(stg);
3359 IStorage_Release(stg);
3361 hr = IStorage_QueryInterface(stg, &IID_IDirectWriterLock, (
void**)&dwlock);
3364 ref2 = IStorage_AddRef(stg);
3365 IStorage_Release(stg);
3366 ok(ref2 ==
ref + 1,
"got %u\n", ref2);
3368 IDirectWriterLock_Release(dwlock);
3369 IStorage_Release(stg);
3444 "file with mode %x should not be openable with %s permission\n",
current->stg_mode,
desc);
3449 "file with mode %x should not be openable with %s permission\n",
current->stg_mode,
desc);
3450 *any_failure =
TRUE;
3460 *any_failure =
TRUE;
3475 *any_failure =
TRUE;
3485 *any_failure =
TRUE;
3492 static const WCHAR filename[] = {
'w',
'i',
'n',
'e',
't',
'e',
's',
't',0};
3501 DWORD open_mode = 0;
3514 IStorage_Release(stg);
3532 BOOL locked, expect_locked;
3534 const int* next_lock =
current->locked_bytes;
3558 if ((ol.
Offset&0x1ff) == *next_lock)
3560 expect_locked =
TRUE;
3564 expect_locked =
FALSE;
3566 if (!
current->todo || locked == expect_locked)
3567 ok(locked == expect_locked,
"byte %x of file with mode %x is %slocked but should %sbe\n",
3568 ol.
Offset,
current->stg_mode, locked?
"":
"not ", expect_locked?
"":
"not ");
3572 todo_wine ok(locked == expect_locked,
"byte %x of file with mode %x is %slocked but should %sbe\n",
3573 ol.
Offset,
current->stg_mode, locked?
"":
"not ", expect_locked?
"":
"not ");
3580 IStorage_Release( stg );
3587 const int* next_range =
current->fail_ranges;
3597 if (ol.
Offset == 0x7fffff92 ||
3602 if (ol.
Offset < 0x7fffff00)
3615 if (!expect_failed && (ol.
Offset&0x1ff) == next_range[0])
3617 expect_failed =
TRUE;
3619 else if (expect_failed && (ol.
Offset&0x1ff) == next_range[1])
3621 expect_failed =
FALSE;
3625 if (!
current->todo || failed == expect_failed)
3626 ok(failed == expect_failed,
"open with byte %x locked, mode %x %s but should %s\n",
3627 ol.
Offset,
current->stg_mode, failed?
"failed":
"succeeded", expect_failed?
"fail":
"succeed");
3631 todo_wine ok(failed == expect_failed,
"open with byte %x locked, mode %x %s but should %s\n",
3632 ol.
Offset,
current->stg_mode, failed?
"failed":
"succeeded", expect_failed?
"fail":
"succeed");
3641 if (
current->todo && !any_failure)
3652 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
3663 ok(
r==
S_OK,
"StgCreateDocfile failed %x\n",
r);
3666 ok(
r ==
S_OK,
"WriteClassStg failed %x\n",
r);
3669 ok(
r==
S_OK,
"IStorage->CreateStream failed %x\n",
r);
3672 r = IStream_Seek(stm,
pos, 0, &upos);
3673 ok(
r==
S_OK,
"IStream->Seek failed %x\n",
r);
3675 r = IStream_Write(stm,
"aaa", 3,
NULL);
3676 ok(
r==
S_OK,
"IStream->Write failed %x\n",
r);
3678 r = IStorage_Commit(stg, STGC_ONLYIFCURRENT);
3679 ok(
r==
S_OK,
"IStorage->Commit failed %x\n",
r);
3683 ok(
r==
S_OK,
"StgOpenStorage failed %x\n",
r);
3687 r = IStream_Seek(stm,
pos, 0, &upos);
3688 ok(
r==
S_OK,
"IStream->Seek failed %x\n",
r);
3690 r = IStream_Write(stm,
"ccc", 3,
NULL);
3691 ok(
r==
S_OK,
"IStream->Write failed %x\n",
r);
3693 r = IStorage_Commit(stg, STGC_ONLYIFCURRENT);
3694 ok(
r==
S_OK,
"IStorage->Commit failed %x\n",
r);
3698 r = IStream_Seek(stm,
pos, 0, &upos);
3699 ok(
r==
S_OK,
"IStream->Seek failed %x\n",
r);
3701 r = IStream_Write(stm,
"ddd", 3,
NULL);
3702 ok(
r==
S_OK,
"IStream->Write failed %x\n",
r);
3704 IStream_Release(stm);
3708 ok(
r==
S_OK,
"IStorage->OpenStream failed %x\n",
r);
3711 r = IStream_Seek(stm,
pos, 0, &upos);
3712 ok(
r==
S_OK,
"IStream->Seek failed %x\n",
r);
3715 ok(
r==
S_OK,
"IStream->Read failed %x\n",
r);
3716 ok(bytesread == 3,
"read wrong number of bytes %i\n", bytesread);
3721 r = IStream_Seek(stm,
pos, 0, &upos);
3722 ok(
r==
S_OK,
"IStream->Seek failed %x\n",
r);
3724 r = IStream_Write(stm,
"bbb", 3,
NULL);
3725 ok(
r==
S_OK,
"IStream->Write failed %x\n",
r);
3727 IStream_Release(stm);
3730 r = IStorage_Commit(stgrw, STGC_ONLYIFCURRENT);
3734 r = IStorage_Commit(stgrw, STGC_DEFAULT);
3735 ok(
r==
S_OK,
"IStorage->Commit failed %x\n",
r);
3738 r = IStorage_Revert(stg);
3739 ok(
r==
S_OK,
"IStorage->Revert failed %x\n",
r);
3742 ok(
r==
S_OK,
"IStorage->CreateStream failed %x\n",
r);
3745 r = IStream_Seek(stm,
pos, 0, &upos);
3746 ok(
r==
S_OK,
"IStream->Seek failed %x\n",
r);
3749 ok(
r==
S_OK,
"IStream->Read failed %x\n",
r);
3750 ok(bytesread == 3,
"read wrong number of bytes %i\n", bytesread);
3754 r = IStorage_Commit(stg, STGC_ONLYIFCURRENT);
3757 IStream_Release(stm);
3759 IStorage_Release(stg);
3760 IStorage_Release(stgrw);
3770 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
3771 static const WCHAR stmname2[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'2',0 };
3783 ok(
r==
S_OK,
"StgCreateDocfile failed %x\n",
r);
3786 ok(
r ==
S_OK,
"WriteClassStg failed %x\n",
r);
3789 ok(
r==
S_OK,
"IStorage->CreateStream failed %x\n",
r);
3792 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &upos);
3793 ok(
r==
S_OK,
"IStream->Seek failed %x\n",
r);
3800 ok(
r==
S_OK,
"IStream->Write failed %x\n",
r);
3803 r = IStorage_Commit(stg, STGC_DEFAULT);
3804 ok(
r==
S_OK,
"IStorage->Commit failed %x\n",
r);
3813 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &upos);
3814 ok(
r==
S_OK,
"IStream->Seek failed %x\n",
r);
3816 r = IStream_Write(stm,
"b", 1,
NULL);
3817 ok(
r==
S_OK,
"IStream->Write failed %x\n",
r);
3819 r = IStorage_Commit(stg, STGC_OVERWRITE);
3820 ok(
r==
S_OK,
"IStorage->Commit failed %x\n",
r);
3826 IStream_Release(stm);
3828 IStorage_RenameElement(stg, stmname, stmname2);
3830 r = IStorage_Commit(stg, STGC_OVERWRITE);
3831 ok(
r==
S_OK,
"IStorage->Commit failed %x\n",
r);
3837 IStorage_Release(stg);
3840 ok(
r==
S_OK,
"StgOpenStorage failed %x\n",
r);
3843 ok(
r==
S_OK,
"IStorage->CreateStream failed %x\n",
r);
3846 ok(
r==
S_OK,
"IStream->Write failed %x\n",
r);
3847 ok(bytesread ==
sizeof(
buffer),
"only read %d bytes\n", bytesread);
3848 ok(
buffer[0] ==
'b',
"unexpected data at byte 0\n");
3853 ok(
i ==
sizeof(
buffer),
"unexpected data at byte %i\n",
i);
3856 r = IStream_Seek(stm,
pos, STREAM_SEEK_SET, &upos);
3857 ok(
r==
S_OK,
"IStream->Seek failed %x\n",
r);
3859 r = IStream_Write(stm,
"c", 1,
NULL);
3860 ok(
r==
S_OK,
"IStream->Write failed %x\n",
r);
3862 r = IStorage_Commit(stg, STGC_OVERWRITE);
3863 ok(
r==
S_OK,
"IStorage->Commit failed %x\n",
r);
3869 IStream_Release(stm);
3871 IStorage_Release(stg);
3880 static const WCHAR stmname[] = {
'C',
'O',
'N',
'T',
'E',
'N',
'T',
'S',0 };
3889 ok(
hr==
S_OK,
"StgCreateDocfileOnILockBytes failed %x\n",
hr);
3892 ok(
hr==
S_OK,
"IStorage_CreateStream failed %x\n",
hr);
3894 IStream_Release(stm);
3896 hr = IStorage_Commit(stg, 0);
3898 IStorage_Release(stg);
3900 ok(!lockbytes->
lock_called,
"unexpected call to LockRegion\n");
3905 ok(
hr==
S_OK,
"StgCreateDocfileOnILockBytes failed %x\n",
hr);
3908 ok(
hr==
S_OK,
"IStorage_CreateStream failed %x\n",
hr);
3910 IStream_Release(stm);
3912 hr = IStorage_Commit(stg, 0);
3914 IStorage_Release(stg);
3916 ok(lockbytes->
lock_called,
"expected LockRegion to be called\n");
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
ACPI_SIZE strlen(const char *String)
static unsigned char bytes[4]
#define InterlockedIncrement
#define InterlockedDecrement
#define GetProcAddress(x, y)
#define INVALID_HANDLE_VALUE
#define CreateFileA(a, b, c, d, e, f, g)
#define HeapFree(x, y, z)
#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)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
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)
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
HRESULT WINAPI StgOpenStorage(const OLECHAR *pwcsName, IStorage *pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstgOpen)
HRESULT WINAPI ReadClassStg(IStorage *pstg, CLSID *pclsid)
HRESULT WINAPI WriteClassStm(IStream *pStm, REFCLSID rclsid)
HRESULT WINAPI StgCreateDocfileOnILockBytes(ILockBytes *plkbyt, DWORD grfMode, DWORD reserved, IStorage **ppstgOpen)
HRESULT WINAPI StgCreateDocfile(LPCOLESTR pwcsName, DWORD grfMode, DWORD reserved, IStorage **ppstgOpen)
HRESULT WINAPI ReadClassStm(IStream *pStm, CLSID *pclsid)
HRESULT WINAPI GetConvertStg(IStorage *stg)
HRESULT WINAPI StgIsStorageILockBytes(ILockBytes *plkbyt)
HRESULT WINAPI WriteClassStg(IStorage *pStg, REFCLSID rclsid)
HRESULT WINAPI WriteFmtUserTypeStg(LPSTORAGE pstg, CLIPFORMAT cf, LPOLESTR lpszUserType)
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 CoTaskMemFree(LPVOID ptr)
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
HRESULT WINAPI CreateILockBytesOnHGlobal(HGLOBAL global, BOOL delete_on_release, ILockBytes **ret)
#define memcpy(s1, s2, n)
struct task_struct * current
static const WCHAR desc[]
static HMODULE MODULEINFO DWORD cb
static const struct access_res create[16]
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK ULONG sharing
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 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 check_sharing(LPCWSTR filename, const struct lock_test *current, DWORD access, DWORD sharing, const char *desc, DWORD *open_mode, BOOL *any_failure)
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 const DWORD access_modes[4]
static void test_nonroot_transacted(void)
static const WCHAR stgB_name[]
static void check_access(LPCWSTR filename, const struct lock_test *current, DWORD access, DWORD sharing, const char *desc, DWORD open_mode, BOOL *any_failure)
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
#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
struct _ULARGE_INTEGER::@4266 u
#define CONTAINING_RECORD(address, type, field)
#define LOCKFILE_FAIL_IMMEDIATELY
DWORD WINAPI GetLastError(void)
#define LOCKFILE_EXCLUSIVE_LOCK
#define STG_E_SHAREVIOLATION
#define STG_E_INVALIDPOINTER
#define ERROR_SHARING_VIOLATION
#define STG_E_LOCKVIOLATION
#define STG_E_INVALIDNAME
#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