36static IFileSystem3 *
fs3;
39#define E_VAR_NOT_SET 0x800a005b
43 IUnknown_AddRef(iface);
44 return IUnknown_Release(iface);
51#define GET_REFCOUNT(iface) \
52 get_refcount((IUnknown*)iface)
65 IDriveCollection *drives;
70 hr = IFileSystem3_get_Drives(
fs3, &drives);
73 hr = IDriveCollection_get__NewEnum(drives, (
IUnknown**)&iter);
75 IDriveCollection_Release(drives);
81 hr = IEnumVARIANT_Next(iter, 1, &
var,
NULL);
97 IDrive_Release(
drive);
100 IEnumVARIANT_Release(iter);
104#define test_provideclassinfo(a, b) _test_provideclassinfo((IDispatch*)a, b, __LINE__)
114 ok_(__FILE__,
line) (
hr ==
S_OK,
"Failed to get IProvideClassInfo, %#x.\n",
hr);
116 hr = IProvideClassInfo_GetClassInfo(
classinfo, &ti);
119 hr = ITypeInfo_GetTypeAttr(ti, &
attr);
126 ok(
hr ==
S_OK,
"Failed to QI for IUnknown.\n");
127 ok(unk == (
IUnknown *)disp,
"Got unk %p, original %p.\n", unk, disp);
128 IUnknown_Release(unk);
131 ITypeInfo_ReleaseTypeAttr(ti,
attr);
132 ITypeInfo_Release(ti);
137 static const WCHAR nonexistent_dirW[] = {
138 'c',
':',
'\\',
'N',
'o',
'n',
'e',
'x',
'i',
's',
't',
'e',
'n',
't', 0};
139 static const WCHAR pathW[] = {
'p',
'a',
't',
'h',0};
140 static const WCHAR file_kernel32W[] = {
141 '\\',
'k',
'e',
'r',
'n',
'e',
'l',
'3',
'2',
'.',
'd',
'l',
'l', 0};
162 hr = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (
void**)&dispex);
168 ok(
b == VARIANT_FALSE,
"got %x\n",
b);
177 ok(
b == VARIANT_FALSE,
"got %x\n",
b);
184 ok(
b == VARIANT_TRUE,
"got %x\n",
b);
191 ok(
b == VARIANT_FALSE,
"got %x\n",
b);
199 hr = IFileSystem3_FolderExists(
fs3,
path, &
b);
201 ok(
b == VARIANT_TRUE,
"Folder doesn't exists\n");
205 hr = IFileSystem3_FolderExists(
fs3,
path, &
b);
207 ok(
b == VARIANT_FALSE,
"Folder exists\n");
211 hr = IFileSystem3_FolderExists(
fs3,
path, &
b);
213 ok(
b == VARIANT_FALSE,
"Folder exists\n");
216 IDispatch_Release(disp);
233 folder = (
void*)0xdeabeef;
258 ok(
b == VARIANT_TRUE,
"got %x\n",
b);
261 hr = IFileSystem3_OpenTextFile(
fs3,
name, ForWriting | ForAppending, VARIANT_FALSE, TristateFalse, &
stream);
264 hr = IFileSystem3_OpenTextFile(
fs3,
name, ForReading | ForAppending, VARIANT_FALSE, TristateFalse, &
stream);
267 hr = IFileSystem3_OpenTextFile(
fs3,
name, ForWriting | ForReading, VARIANT_FALSE, TristateFalse, &
stream);
270 hr = IFileSystem3_OpenTextFile(
fs3,
name, ForAppending, VARIANT_FALSE, TristateFalse, &
stream);
274 ITextStream_Release(
stream);
276 hr = IFileSystem3_OpenTextFile(
fs3,
name, ForWriting, VARIANT_FALSE, TristateFalse, &
stream);
280 ITextStream_Release(
stream);
282 hr = IFileSystem3_OpenTextFile(
fs3,
name, ForReading, VARIANT_FALSE, TristateFalse, &
stream);
296 hr = ITextStream_get_AtEndOfStream(
stream, &
b);
298 ok(
b == VARIANT_TRUE,
"got 0x%x\n",
b);
300 ITextStream_Release(
stream);
302 hr = IFileSystem3_OpenTextFile(
fs3,
name, ForWriting, VARIANT_FALSE, TristateFalse, &
stream);
306 hr = ITextStream_get_AtEndOfStream(
stream, &
b);
308 ok(
b == VARIANT_TRUE ||
broken(
b == 10),
"got 0x%x\n",
b);
311 hr = ITextStream_get_AtEndOfLine(
stream, &
b);
314 ok(
b == VARIANT_FALSE ||
broken(
b == 10),
"got 0x%x\n",
b);
325 ITextStream_Release(
stream);
327 hr = IFileSystem3_OpenTextFile(
fs3,
name, ForAppending, VARIANT_FALSE, TristateFalse, &
stream);
331 hr = ITextStream_get_AtEndOfStream(
stream, &
b);
333 ok(
b == VARIANT_TRUE ||
broken(
b == 10),
"got 0x%x\n",
b);
336 hr = ITextStream_get_AtEndOfLine(
stream, &
b);
339 ok(
b == VARIANT_FALSE ||
broken(
b == 10),
"got 0x%x\n",
b);
350 ITextStream_Release(
stream);
358 hr = IFileSystem3_OpenTextFile(
fs3,
name, ForReading, VARIANT_FALSE, TristateFalse, &
stream);
361 hr = ITextStream_get_AtEndOfStream(
stream, &
b);
363 ok(
b == VARIANT_FALSE,
"got 0x%x\n",
b);
364 ITextStream_Release(
stream);
372 static const WCHAR k32W[] = {
'\\',
'k',
'e',
'r',
'n',
'e',
'l',
'3',
'2',
'.',
'd',
'l',
'l',0};
373 static const WCHAR k33W[] = {
'\\',
'k',
'e',
'r',
'n',
'e',
'l',
'3',
'3',
'.',
'd',
'l',
'l',0};
410 static const WCHAR path2[] = {
'a',
'/',
'a',
'/',
'a',0};
411 static const WCHAR path3[] = {
'a',
'\\',
'a',
'\\',
'a',0};
412 static const WCHAR path4[] = {
'a',
'/',
'a',
'/',
'/',
'\\',
'\\',0};
413 static const WCHAR path5[] = {
'c',
':',
'\\',
'\\',
'a',0};
414 static const WCHAR path6[] = {
'a',
'c',
':',
'\\',
'a',0};
415 static const WCHAR result2[] = {
'a',
'/',
'a',0};
416 static const WCHAR result3[] = {
'a',
'\\',
'a',0};
417 static const WCHAR result4[] = {
'a',0};
418 static const WCHAR result5[] = {
'c',
':',
'\\',0};
419 static const WCHAR result6[] = {
'a',
'c',
':',0};
421 static const struct {
439 ok(
hr ==
E_POINTER,
"GetParentFolderName returned %x, expected E_POINTER\n",
hr);
445 ok(
hr ==
S_OK,
"%d) GetParentFolderName returned %x, expected S_OK\n",
i,
hr);
458 static const WCHAR path2[] = {
'a',
'/',
'a',
'.',
'b',0};
462 static const WCHAR result2[] = {
'a',
'.',
'b',0};
463 static const WCHAR result3[] = {
'a',0};
465 static const struct {
482 ok(
hr ==
E_POINTER,
"GetFileName returned %x, expected E_POINTER\n",
hr);
488 ok(
hr ==
S_OK,
"%d) GetFileName returned %x, expected S_OK\n",
i,
hr);
501 static const WCHAR path2[] = {
'a',
'/',
'a',
'.',
'b',
'.',
'c',0};
502 static const WCHAR path3[] = {
'a',
'.',
'b',
'\\',0};
506 static const WCHAR result1[] = {
'a',0};
507 static const WCHAR result2[] = {
'a',
'.',
'b',0};
508 static const WCHAR result6[] = {0};
510 static const struct {
528 ok(
hr ==
E_POINTER,
"GetBaseName returned %x, expected E_POINTER\n",
hr);
534 ok(
hr ==
S_OK,
"%d) GetBaseName returned %x, expected S_OK\n",
i,
hr);
546 static const WCHAR dir1[] = {
't',
'e',
's',
't',
'_',
'd',
'i',
'r',
'1',0};
547 static const WCHAR dir2[] = {
't',
'e',
's',
't',
'_',
'd',
'i',
'r',
'2',0};
548 static const WCHAR dir_match1[] = {
't',
'e',
's',
't',
'_',
'd',
'i',
'r',
'*',0};
549 static const WCHAR dir_match2[] = {
't',
'e',
's',
't',
'_',
'd',
'i',
'*',0};
550 static const WCHAR cur_dir[] = {
'.',0};
559 ok(
hr ==
E_POINTER,
"GetAbsolutePathName returned %x, expected E_POINTER\n",
hr);
562 ok(
hr ==
S_OK,
"GetAbsolutePathName returned %x, expected S_OK\n",
hr);
569 skip(
"GetAbsolutePathName tests\n");
576 ok(
hr ==
S_OK,
"GetAbsolutePathName returned %x, expected S_OK\n",
hr);
583 ok(
hr ==
S_OK,
"GetAbsolutePathName returned %x, expected S_OK\n",
hr);
591 ok(
hr ==
S_OK,
"GetAbsolutePathName returned %x, expected S_OK\n",
hr);
605 ok(
hr ==
S_OK,
"GetAbsolutePathName returned %x, expected S_OK\n",
hr);
617 static const WCHAR slW[] = {
'\\',0};
637 file = (IFile*)0xdeadbeef;
639 ok(!
file,
"file != NULL\n");
644 skip(
"Can't create temporary file\n");
651 ok(
hr ==
S_OK,
"GetFile returned %x, expected S_OK\n",
hr);
669#define FILE_ATTR_MASK (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN | \
670 FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_ARCHIVE | \
671 FILE_ATTRIBUTE_REPARSE_POINT | FILE_ATTRIBUTE_COMPRESSED)
673 hr = IFile_get_Attributes(
file, &
fa);
675 ok(
hr ==
S_OK,
"get_Attributes returned %x, expected S_OK\n",
hr);
676 ok(
fa == gfa,
"fa = %x, expected %x\n",
fa, gfa);
679 ok(
hr ==
S_OK,
"put_Attributes failed: %08x\n",
hr);
683 hr = IFile_get_Attributes(
file, &
fa);
684 ok(
hr ==
S_OK,
"get_Attributes returned %x, expected S_OK\n",
hr);
685 ok(
fa == new_gfa,
"fa = %x, expected %x\n",
fa, new_gfa);
687 hr = IFile_put_Attributes(
file, gfa);
688 ok(
hr ==
S_OK,
"put_Attributes failed: %08x\n",
hr);
690 ok(new_gfa == gfa,
"new_gfa = %x, expected %x\n", new_gfa, gfa);
692 hr = IFile_get_Attributes(
file, &
fa);
693 ok(
hr ==
S_OK,
"get_Attributes returned %x, expected S_OK\n",
hr);
694 ok(
fa == gfa,
"fa = %x, expected %x\n",
fa, gfa);
697 ok(
hr ==
S_OK,
"get_Size returned %x, expected S_OK\n",
hr);
704 "DeleteFile returned %x, expected CTL_E_PERMISSIONDENIED\n",
hr);
707 ok(
hr ==
S_OK,
"DeleteFile returned %x, expected S_OK\n",
hr);
744 static const WCHAR filesystem3_dir[] = {
'f',
'i',
'l',
'e',
's',
'y',
's',
't',
'e',
'm',
'3',
'_',
't',
'e',
's',
't',0};
745 static const WCHAR s1[] = {
's',
'r',
'c',
'1',0};
746 static const WCHAR s[] = {
's',
'r',
'c',
'*',0};
747 static const WCHAR d[] = {
'd',
's',
't',0};
755 skip(
"can't create temporary directory\n");
763 hr = IFileSystem3_CopyFile(
fs3, bsrc, bdst, VARIANT_TRUE);
766 hr = IFileSystem3_CopyFolder(
fs3, bsrc, bdst, VARIANT_TRUE);
770 hr = IFileSystem3_CopyFile(
fs3, bsrc, bdst, VARIANT_TRUE);
771 ok(
hr ==
S_OK,
"CopyFile returned %x, expected S_OK\n",
hr);
773 hr = IFileSystem3_CopyFolder(
fs3, bsrc, bdst, VARIANT_TRUE);
776 hr = IFileSystem3_DeleteFile(
fs3, bsrc, VARIANT_FALSE);
777 ok(
hr ==
S_OK,
"DeleteFile returned %x, expected S_OK\n",
hr);
780 hr = IFileSystem3_CopyFile(
fs3, bsrc, bdst, VARIANT_TRUE);
783 hr = IFileSystem3_CopyFolder(
fs3, bsrc, bdst, VARIANT_TRUE);
786 hr = IFileSystem3_DeleteFile(
fs3, bdst, VARIANT_TRUE);
787 ok(
hr ==
S_OK,
"DeleteFile returned %x, expected S_OK\n",
hr);
789 hr = IFileSystem3_CopyFolder(
fs3, bsrc, bdst, VARIANT_TRUE);
790 ok(
hr ==
S_OK,
"CopyFolder returned %x, expected S_OK\n",
hr);
792 hr = IFileSystem3_CopyFolder(
fs3, bsrc, bdst, VARIANT_TRUE);
793 ok(
hr ==
S_OK,
"CopyFolder returned %x, expected S_OK\n",
hr);
802 hr = IFileSystem3_CopyFolder(
fs3, bsrc, bdst, VARIANT_TRUE);
803 ok(
hr ==
S_OK,
"CopyFolder returned %x, expected S_OK\n",
hr);
816 hr = IFileSystem3_CopyFolder(
fs3, bsrc, bdst, VARIANT_TRUE);
817 ok(
hr ==
S_OK,
"CopyFolder returned %x, expected S_OK\n",
hr);
823 hr = IFileSystem3_DeleteFolder(
fs3, bdst, VARIANT_FALSE);
824 ok(
hr ==
S_OK,
"DeleteFolder returned %x, expected S_OK\n",
hr);
826 hr = IFileSystem3_CopyFolder(
fs3, bsrc, bdst, VARIANT_TRUE);
834 hr = IFileSystem3_CopyFolder(
fs3, bsrc, bdst, VARIANT_FALSE);
835 ok(
hr ==
S_OK,
"CopyFolder returned %x, expected S_OK\n",
hr);
837 hr = IFileSystem3_CopyFolder(
fs3, bsrc, bdst, VARIANT_FALSE);
840 hr = IFileSystem3_CopyFolder(
fs3, bsrc, bdst, VARIANT_TRUE);
841 ok(
hr ==
S_OK,
"CopyFolder returned %x, expected S_OK\n",
hr);
846 hr = IFileSystem3_DeleteFolder(
fs3, bsrc, VARIANT_FALSE);
847 ok(
hr ==
S_OK,
"DeleteFolder returned %x, expected S_OK\n",
hr);
868 {
"C:\\path",
"..\\name.tmp",
"C:\\path\\..\\name.tmp" },
869 {
"C:\\path",
"\\name.tmp",
"C:\\path\\name.tmp" },
870 {
"C:\\path",
"name.tmp",
"C:\\path\\name.tmp" },
871 {
"C:\\path\\",
"name.tmp",
"C:\\path\\name.tmp" },
872 {
"C:\\path",
"\\\\name.tmp",
"C:\\path\\\\name.tmp" },
873 {
"C:\\path\\",
"\\name.tmp",
"C:\\path\\name.tmp" },
874 {
"C:\\path\\",
"\\\\name.tmp",
"C:\\path\\\\name.tmp" },
875 {
"C:\\path\\\\",
"\\\\name.tmp",
"C:\\path\\\\\\name.tmp" },
876 {
"C:\\\\",
"\\name.tmp",
"C:\\\\name.tmp" },
877 {
"C:",
"name.tmp",
"C:name.tmp" },
878 {
"C:",
"\\\\name.tmp",
"C:\\\\name.tmp" },
941 static const WCHAR dummyW[] = {
'd',
'u',
'm',
'm',
'y',0};
947 folder = (
void*)0xdeadbeef;
961 folder = (
void*)0xdeadbeef;
990 ok(fetched == 1,
"%d: got %d\n",
line, fetched);
993 hr = IEnumVARIANT_Clone(
enumvar, &clone);
1000 hr = IEnumVARIANT_Next(clone, 1, &var2, &fetched);
1001 if (position_inherited &&
count == 1)
1004 ok(fetched == 0,
"%d: got %d\n",
line, fetched);
1009 ok(fetched == 1,
"%d: got %d\n",
line, fetched);
1010 if (!position_inherited)
1017 ok(fetched == 1,
"%d: got %d\n",
line, fetched);
1024 IEnumVARIANT_Release(clone);
1029#define test_clone(a, b, c) _test_clone(a, b, c, __LINE__)
1034 static const WCHAR fooW[] = {
'f',
'o',
'o',0};
1035 static const WCHAR aW[] = {
'\\',
'a',0};
1036 static const WCHAR bW[] = {
'\\',
'b',0};
1037 static const WCHAR cW[] = {
'\\',
'c',0};
1038 IFolderCollection *folders;
1048 int found_a = 0, found_b = 0, found_c = 0;
1077 hr = IFolder_get_SubFolders(
folder, &folders);
1083 hr = IFolderCollection_get_Count(folders, &
count);
1093 hr = IFolderCollection_get_Count(folders, &
count);
1097 hr = IFolderCollection_get__NewEnum(folders,
NULL);
1100 hr = IFolderCollection_QueryInterface(folders, &IID_IEnumVARIANT, (
void**)&unk);
1107 hr = IFolderCollection_get__NewEnum(folders, &unk);
1111 ok(ref2 ==
ref + 1,
"got %d, %d\n", ref2,
ref);
1114 hr = IFolderCollection_get__NewEnum(folders, &unk2);
1116 ok(unk != unk2,
"got %p, %p\n", unk2, unk);
1117 IUnknown_Release(unk2);
1121 hr = IUnknown_QueryInterface(unk, &IID_IEnumVARIANT, (
void**)&
enumvar);
1124 ok(ref2 ==
ref,
"got %d, %d\n", ref2,
ref);
1128 for (
i = 0;
i < 3;
i++)
1134 ok(fetched == 1,
"%d: got %d\n",
i, fetched);
1157 ok(found_a == 1 && found_b == 1 && found_c == 1,
1158 "each folder should be found 1 time instead of %d/%d/%d\n",
1159 found_a, found_b, found_c);
1165 ok(fetched == 0,
"got %d\n", fetched);
1177 hr = IEnumVARIANT_Next(
enumvar, 0, var2, &fetched);
1179 ok(fetched == 0,
"got %d\n", fetched);
1181 hr = IEnumVARIANT_Next(
enumvar, 2, var2, &fetched);
1183 ok(fetched == 1,
"got %d\n", fetched);
1188 IEnumVARIANT_Release(
enumvar);
1189 IUnknown_Release(unk);
1202 IFolderCollection_Release(folders);
1208 static const WCHAR fooW[] = {
'\\',
'f',
'o',
'o',0};
1209 static const WCHAR aW[] = {
'\\',
'a',0};
1210 static const WCHAR bW[] = {
'\\',
'b',0};
1211 static const WCHAR cW[] = {
'\\',
'c',0};
1214 IFileCollection *files;
1223 HANDLE file_a, file_b, file_c;
1224 int found_a = 0, found_b = 0, found_c = 0;
1246 hr = IFolder_get_Files(
folder, &files);
1252 hr = IFileCollection_get_Count(files, &
count);
1263 hr = IFileCollection_get_Count(files, &
count);
1267 hr = IFileCollection_get__NewEnum(files,
NULL);
1270 hr = IFileCollection_QueryInterface(files, &IID_IEnumVARIANT, (
void**)&unk);
1277 hr = IFileCollection_get__NewEnum(files, &unk);
1281 ok(ref2 ==
ref + 1,
"got %d, %d\n", ref2,
ref);
1284 hr = IFileCollection_get__NewEnum(files, &unk2);
1286 ok(unk != unk2,
"got %p, %p\n", unk2, unk);
1287 IUnknown_Release(unk2);
1291 hr = IUnknown_QueryInterface(unk, &IID_IEnumVARIANT, (
void**)&
enumvar);
1294 ok(ref2 ==
ref,
"got %d, %d\n", ref2,
ref);
1298 for (
i = 0;
i < 3;
i++)
1304 ok(fetched == 1,
"%d: got %d\n",
i, fetched);
1324 IFile_Release(
file);
1328 ok(found_a == 1 && found_b == 1 && found_c == 1,
1329 "each file should be found 1 time instead of %d/%d/%d\n",
1330 found_a, found_b, found_c);
1336 ok(fetched == 0,
"got %d\n", fetched);
1348 hr = IEnumVARIANT_Next(
enumvar, 0, var2, &fetched);
1350 ok(fetched == 0,
"got %d\n", fetched);
1352 hr = IEnumVARIANT_Next(
enumvar, 2, var2, &fetched);
1354 ok(fetched == 1,
"got %d\n", fetched);
1359 IEnumVARIANT_Release(
enumvar);
1360 IUnknown_Release(unk);
1367 IFileCollection_Release(files);
1372 IDriveCollection *drives;
1379 hr = IFileSystem3_get_Drives(
fs3, &drives);
1387 hr = IDriveCollection_get_Count(drives,
NULL);
1391 hr = IDriveCollection_get_Count(drives, &
count);
1399 ok(fetched == 0,
"got %d\n", fetched);
1414 DriveTypeConst
type;
1440 if (
type == Fixed) {
1444 hr = IDrive_get_IsReady(
drive, &ready);
1446 ok(ready == VARIANT_TRUE,
"got %x\n", ready);
1448 if (ready != VARIANT_TRUE) {
1489 IEnumVARIANT_Release(
enumvar);
1490 IDriveCollection_Release(drives);
1495 static const WCHAR scrrunW[] = {
's',
'c',
'r',
'r',
'u',
'n',
'\\',0};
1516 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_FALSE, VARIANT_FALSE, &
stream);
1522 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_FALSE, VARIANT_FALSE, &
stream);
1539 ITextStream_Release(
stream);
1547 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_FALSE, VARIANT_FALSE, &
stream);
1551 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_TRUE, VARIANT_FALSE, &
stream);
1553 ITextStream_Release(
stream);
1556 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_TRUE, VARIANT_TRUE, &
stream);
1558 ITextStream_Release(
stream);
1565 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateFalse, &
stream);
1571 ITextStream_Release(
stream);
1597 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_FALSE, VARIANT_FALSE, &
stream);
1602 ITextStream_Release(
stream);
1620 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_FALSE, VARIANT_TRUE, &
stream);
1625 ITextStream_Release(
stream);
1633 buffW[
r/
sizeof(
WCHAR)] = 0;
1649 static const WCHAR secondlineW[] = {
's',
'e',
'c',
'o',
'n',
'd',0};
1650 static const WCHAR aW[] = {
'A',0};
1665 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_FALSE, VARIANT_TRUE, &
stream);
1679 str = (
void*)0xdeadbeef;
1684 ITextStream_Release(
stream);
1686 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateFalse, &
stream);
1700 ITextStream_Release(
stream);
1703 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateTrue, &
stream);
1717 str = (
void*)0xdeadbeef;
1719 ok(
hr == CTL_E_ENDOFFILE,
"got 0x%08x\n",
hr);
1723 str = (
void*)0xdeadbeef;
1725 ok(
hr == CTL_E_ENDOFFILE,
"got 0x%08x\n",
hr);
1727 ITextStream_Release(
stream);
1730 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateTrue, &
stream);
1749 ITextStream_Release(
stream);
1753 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_TRUE, VARIANT_FALSE, &
stream);
1759 ITextStream_Release(
stream);
1761 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateTrue, &
stream);
1764 str = (
void*)0xdeadbeef;
1766 ok(
hr == CTL_E_ENDOFFILE,
"got 0x%08x\n",
hr);
1769 ITextStream_Release(
stream);
1778 static const WCHAR secondlineW[] = {
's',
'e',
'c',
'o',
'n',
'd',0};
1779 static const WCHAR aW[] = {
'A',0};
1794 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_FALSE, VARIANT_TRUE, &
stream);
1814 str = (
void*)0xdeadbeef;
1819 ITextStream_Release(
stream);
1821 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateFalse, &
stream);
1827 str = (
void*)0xdeadbeef;
1832 str = (
void*)0xdeadbeef;
1848 ITextStream_Release(
stream);
1851 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateTrue, &
stream);
1865 str = (
void*)0xdeadbeef;
1867 ok(
hr == CTL_E_ENDOFFILE,
"got 0x%08x\n",
hr);
1871 str = (
void*)0xdeadbeef;
1873 ok(
hr == CTL_E_ENDOFFILE,
"got 0x%08x\n",
hr);
1875 ITextStream_Release(
stream);
1878 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateTrue, &
stream);
1897 ITextStream_Release(
stream);
1900 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateUseDefault, &
stream);
1913 ITextStream_Release(
stream);
1916 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForAppending, VARIANT_FALSE, TristateUseDefault, &
stream);
1924 ITextStream_Release(
stream);
1926 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateTrue, &
stream);
1936 ITextStream_Release(
stream);
1939 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForWriting, VARIANT_FALSE, TristateUseDefault, &
stream);
1947 ITextStream_Release(
stream);
1949 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateFalse, &
stream);
1952 str = (
void*)0xdeadbeef;
1957 ITextStream_Release(
stream);
1959 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_TRUE, VARIANT_FALSE, &
stream);
1965 ITextStream_Release(
stream);
1967 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateUseDefault, &
stream);
1970 str = (
void*)0xdeadbeef;
1975 ITextStream_Release(
stream);
1978 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForAppending, VARIANT_FALSE, TristateUseDefault, &
stream);
1986 ITextStream_Release(
stream);
1988 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateFalse, &
stream);
1997 ITextStream_Release(
stream);
2000 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForWriting, VARIANT_FALSE, TristateUseDefault, &
stream);
2008 ITextStream_Release(
stream);
2010 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateFalse, &
stream);
2013 str = (
void*)0xdeadbeef;
2018 ITextStream_Release(
stream);
2022 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_TRUE, VARIANT_FALSE, &
stream);
2028 ITextStream_Release(
stream);
2030 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateTrue, &
stream);
2033 str = (
void*)0xdeadbeef;
2035 ok(
hr == CTL_E_ENDOFFILE,
"got 0x%08x\n",
hr);
2038 ITextStream_Release(
stream);
2061 { {
'?',0}, -1, VARIANT_FALSE },
2079 ok(
ret == VARIANT_FALSE,
"got %x\n",
ret);
2086 for (; *
ptr->drivespec;
ptr++) {
2088 if (
ptr->drivetype != -1) {
2092 if (
root[0] >
'Z') {
2093 skip(
"No drive with type 0x%x found, skipping test %s.\n",
2101 ret =
ptr->expected_ret == VARIANT_TRUE ? VARIANT_FALSE : VARIANT_TRUE;
2103 ok(
hr ==
S_OK,
"got 0x%08x for drive spec %s (%s)\n",
2105 ok(
ret ==
ptr->expected_ret,
"got %d, expected %d for drive spec %s (%s)\n",
2111 ret =
ptr->expected_ret == VARIANT_TRUE ? VARIANT_FALSE : VARIANT_TRUE;
2113 ok(
hr ==
S_OK,
"got 0x%08x for drive spec %s (%s)\n",
2115 ok(
ret ==
ptr->expected_ret,
"got %d, expected %d for drive spec %s (%s)\n",
2128 { {
'C',
':',
'\\',
'1',
'.',
't',
's',
't',0}, {
'C',
':',0} },
2129 { {
'O',
':',
'\\',
'1',
'.',
't',
's',
't',0}, {
'O',
':',0} },
2130 { {
'O',
':',0}, {
'O',
':',0} },
2131 { {
'o',
':',0}, {
'o',
':',0} },
2132 { {
'O',
'O',
':',0} },
2147 name = (
void*)0xdeadbeef;
2152 while (*
ptr->path) {
2154 name = (
void*)0xdeadbeef;
2176 IDrive *drive_fixed, *
drive;
2177 BSTR dl_fixed, drivespec;
2180 drive = (
void*)0xdeadbeef;
2190 skip(
"All drive letters are occupied, skipping test for nonexisting drive.\n");
2193 drive = (
void*)0xdeadbeef;
2194 hr = IFileSystem3_GetDrive(
fs3, drivespec, &
drive);
2202 skip(
"No fixed drive found, skipping test.\n");
2206 hr = IDrive_get_DriveLetter(drive_fixed, &dl_fixed);
2210 skip(
"Could not retrieve drive letter of fixed drive, skipping test.\n");
2215 { {dl_upper,0},
S_OK, {dl_upper,0} },
2216 { {dl_upper,
':',0},
S_OK, {dl_upper,0} },
2217 { {dl_upper,
':',
'\\',0},
S_OK, {dl_upper,0} },
2218 { {dl_lower,
':',
'\\',0},
S_OK, {dl_upper,0} },
2222 { {
'\\',
'h',
'o',
's',
't',
'\\',
's',
'h',
'a',
'r',
'e',0},
E_INVALIDARG, { 0 } },
2223 { {
'h',
'o',
's',
't',
'\\',
's',
'h',
'a',
'r',
'e',0},
E_INVALIDARG, { 0 } },
2228 for (; *
ptr->drivespec;
ptr++) {
2230 drive = (
void*)0xdeadbeef;
2232 ok(
hr ==
ptr->res,
"got 0x%08x, expected 0x%08x for drive spec %s\n",
2237 if (*
ptr->driveletter) {
2248 IDrive_Release(
drive);
2265 skip(
"No fixed drive found, skipping test.\n");
2295 IDrive_Release(
drive);
2302 { {
'n',
'o',
'e',
'x',
't',0}, {0} },
2303 { {
'n',
'.',
'o',
'.',
'e',
'x',
't',0}, {
'e',
'x',
't',0} },
2304 { {
'n',
'.',
'o',
'.',
'e',
'X',
't',0}, {
'e',
'X',
't',0} },
2324 ok(
ext ==
NULL,
"%d: path %s, got %s, expected %s\n",
i,
2340 hr = IFileSystem3_GetSpecialFolder(
fs3, WindowsFolder,
NULL);
2343 hr = IFileSystem3_GetSpecialFolder(
fs3, TemporaryFolder+1,
NULL);
2346 hr = IFileSystem3_GetSpecialFolder(
fs3, TemporaryFolder+1, &
folder);
2349 hr = IFileSystem3_GetSpecialFolder(
fs3, WindowsFolder, &
folder);
2358 hr = IFileSystem3_GetSpecialFolder(
fs3, SystemFolder, &
folder);
2367 hr = IFileSystem3_GetSpecialFolder(
fs3, TemporaryFolder, &
folder);
2372 if (
ret && pathW[
ret-1] ==
'\\')
2387 &IID_IFileSystem3, (
void**)&
fs3);
2389 win_skip(
"Could not create FileSystem object: %08x\n",
hr);
2419 IFileSystem3_Release(
fs3);
static const WCHAR nameW[]
static const WCHAR empty[]
#define ReadFile(a, b, c, d, e)
#define INVALID_HANDLE_VALUE
#define FILE_ATTRIBUTE_NORMAL
#define MultiByteToWideChar
static const WCHAR *const ext[]
static const WCHAR version[]
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
BOOL WINAPI RemoveDirectoryW(IN LPCWSTR lpPathName)
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
BOOL WINAPI FindClose(HANDLE hFindFile)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
static const WCHAR utf16bom
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
GLuint GLuint GLsizei count
GLuint GLuint GLsizei GLenum type
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLdouble GLdouble GLdouble r
GLboolean GLboolean GLboolean b
GLenum GLuint GLenum GLsizei const GLchar * buf
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
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
#define memmove(s1, s2, n)
#define FILE_FLAG_DELETE_ON_CLOSE
#define ERROR_FILE_NOT_FOUND
static struct test_info tests[]
static const WCHAR filenameW[]
const IID IID_IObjectWithSite
#define create_file(name, size)
static const WCHAR fooW[]
static IActiveScriptSite * site
static const WCHAR dummyW[]
static const struct getdrivename_test getdrivenametestdata[]
static void get_temp_path(const WCHAR *prefix, WCHAR *path)
#define test_provideclassinfo(a, b)
static void test_BuildPath(void)
static void test_ReadAll(void)
static const WCHAR testfileW[]
static void test_DriveCollection(void)
#define GET_REFCOUNT(iface)
static void test_GetParentFolderName(void)
static void test_CopyFolder(void)
static void test_GetAbsolutePathName(void)
static void _test_clone(IEnumVARIANT *enumvar, BOOL position_inherited, LONG count, int line)
static struct buildpath_test buildpath_data[]
static IFileSystem3 * fs3
static const struct driveexists_test driveexiststestdata[]
static void test_GetFileName(void)
static void test_Read(void)
static void test_interfaces(void)
static const struct extension_test extension_tests[]
static void test_WriteLine(void)
static BSTR bstr_from_str(const char *str)
static void test_GetFile(void)
static void test_SerialNumber(void)
static void test_GetBaseName(void)
static void test_CreateTextFile(void)
static void test_GetDriveName(void)
static void test_FileCollection(void)
static void get_temp_filepath(const WCHAR *filename, WCHAR *path, WCHAR *dir)
static void test_DriveExists(void)
static void _test_provideclassinfo(IDispatch *disp, const GUID *guid, int line)
static void test_createfolder(void)
static void test_GetFolder(void)
static void test_FolderCollection(void)
static IDrive * get_fixed_drive(void)
static void test_textstream(void)
static void test_GetExtensionName(void)
#define test_clone(a, b, c)
static void test_GetDrive(void)
static ULONG get_refcount(IUnknown *iface)
static void test_GetSpecialFolder(void)
static void test_GetFileVersion(void)
static const WCHAR path3[]
static const WCHAR path4[]
static IWbemPath * create_path(void)
static const WCHAR path5[]
static const WCHAR path1[]
static const WCHAR path6[]
static const WCHAR path2[]
static const WCHAR crlfW[]
#define FILE_ATTRIBUTE_READONLY
BSTR WINAPI SysAllocString(LPCOLESTR str)
UINT WINAPI SysStringLen(BSTR str)
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
#define CTL_E_BADFILEMODE
#define CTL_E_PATHNOTFOUND
#define CTL_E_FILENOTFOUND
#define CTL_E_FILEALREADYEXISTS
#define CTL_E_DEVICEUNAVAILABLE
#define CTL_E_PERMISSIONDENIED
const GUID IID_IProvideClassInfo
#define IsEqualGUID(rguid1, rguid2)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
static __inline const char * wine_dbgstr_guid(const GUID *id)
TCHAR file_path[MAX_PATH]
const VARIANT_BOOL expected_ret
const WCHAR drivespec[10]
const WCHAR drivespec[12]
const WCHAR driveletter[2]
Character const *const prefix
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
void WINAPI VariantInit(VARIANTARG *pVarg)
#define INVALID_FILE_ATTRIBUTES
#define DRIVE_NO_ROOT_DIR
DWORD WINAPI GetLastError(void)
#define HRESULT_FROM_WIN32(x)