37static IFileSystem3 *
fs3;
42#define E_VAR_NOT_SET 0x800a005b
46 IUnknown_AddRef(iface);
47 return IUnknown_Release(iface);
53#define GET_REFCOUNT(iface) \
54 get_refcount((IUnknown*)iface)
65#define test_file_contents(a, b, c) _test_file_contents(a, b, c, __LINE__)
76 ok_(__FILE__,
line) (actual_size == expected_size,
"expected file %s size %ld, got %ld\n",
wine_dbgstr_w(
pathW), expected_size, actual_size);
78 if((expected_contents !=
NULL) && (actual_size > 0))
81 void *actual_contents =
malloc(actual_size);
84 ok_(__FILE__,
line) (!
memcmp(expected_contents, actual_contents, expected_size),
"expected file %s contents %s, got %s\n",
wine_dbgstr_w(
pathW),
wine_dbgstr_an(expected_contents,expected_size),
wine_dbgstr_an(actual_contents,
r));
85 free(actual_contents);
93 IDriveCollection *drives;
98 hr = IFileSystem3_get_Drives(
fs3, &drives);
101 hr = IDriveCollection_get__NewEnum(drives, (
IUnknown**)&iter);
103 IDriveCollection_Release(drives);
109 hr = IEnumVARIANT_Next(iter, 1, &
var,
NULL);
125 IDrive_Release(
drive);
128 IEnumVARIANT_Release(iter);
132#define test_provideclassinfo(a, b) _test_provideclassinfo((IDispatch*)a, b, __LINE__)
142 ok_(__FILE__,
line) (
hr ==
S_OK,
"Failed to get IProvideClassInfo, %#lx.\n",
hr);
144 hr = IProvideClassInfo_GetClassInfo(
classinfo, &ti);
147 hr = ITypeInfo_GetTypeAttr(ti, &
attr);
154 ok(
hr ==
S_OK,
"Failed to QI for IUnknown.\n");
155 ok(unk == (
IUnknown *)disp,
"Got unk %p, original %p.\n", unk, disp);
156 IUnknown_Release(unk);
159 ITypeInfo_ReleaseTypeAttr(ti,
attr);
160 ITypeInfo_Release(ti);
185 hr = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (
void**)&dispex);
191 ok(
b == VARIANT_FALSE,
"got %x\n",
b);
200 ok(
b == VARIANT_FALSE,
"got %x\n",
b);
207 ok(
b == VARIANT_TRUE,
"got %x\n",
b);
214 ok(
b == VARIANT_FALSE,
"got %x\n",
b);
222 hr = IFileSystem3_FolderExists(
fs3,
path, &
b);
224 ok(
b == VARIANT_TRUE,
"Folder doesn't exists\n");
228 hr = IFileSystem3_FolderExists(
fs3,
path, &
b);
230 ok(
b == VARIANT_FALSE,
"Folder exists\n");
234 hr = IFileSystem3_FolderExists(
fs3,
path, &
b);
236 ok(
b == VARIANT_FALSE,
"Folder exists\n");
239 IDispatch_Release(disp);
256 folder = (
void*)0xdeabeef;
282 ok(
b == VARIANT_TRUE,
"got %x\n",
b);
285 hr = IFileSystem3_OpenTextFile(
fs3,
name, ForWriting | ForAppending, VARIANT_FALSE, TristateFalse, &
stream);
288 hr = IFileSystem3_OpenTextFile(
fs3,
name, ForReading | ForAppending, VARIANT_FALSE, TristateFalse, &
stream);
291 hr = IFileSystem3_OpenTextFile(
fs3,
name, ForWriting | ForReading, VARIANT_FALSE, TristateFalse, &
stream);
294 hr = IFileSystem3_OpenTextFile(
fs3,
name, ForAppending, VARIANT_FALSE, TristateFalse, &
stream);
298 ITextStream_Release(
stream);
300 hr = IFileSystem3_OpenTextFile(
fs3,
name, ForWriting, VARIANT_FALSE, TristateFalse, &
stream);
304 ITextStream_Release(
stream);
306 hr = IFileSystem3_OpenTextFile(
fs3,
name, ForReading, VARIANT_FALSE, TristateFalse, &
stream);
320 hr = ITextStream_get_AtEndOfStream(
stream, &
b);
322 ok(
b == VARIANT_TRUE,
"got 0x%x\n",
b);
324 ITextStream_Release(
stream);
326 hr = IFileSystem3_OpenTextFile(
fs3,
name, ForWriting, VARIANT_FALSE, TristateFalse, &
stream);
330 hr = ITextStream_get_AtEndOfStream(
stream, &
b);
332 ok(
b == VARIANT_TRUE ||
broken(
b == 10),
"got 0x%x\n",
b);
335 hr = ITextStream_get_AtEndOfLine(
stream, &
b);
338 ok(
b == VARIANT_FALSE ||
broken(
b == 10),
"got 0x%x\n",
b);
349 ITextStream_Release(
stream);
351 hr = IFileSystem3_OpenTextFile(
fs3,
name, ForAppending, VARIANT_FALSE, TristateFalse, &
stream);
355 hr = ITextStream_get_AtEndOfStream(
stream, &
b);
357 ok(
b == VARIANT_TRUE ||
broken(
b == 10),
"got 0x%x\n",
b);
360 hr = ITextStream_get_AtEndOfLine(
stream, &
b);
363 ok(
b == VARIANT_FALSE ||
broken(
b == 10),
"got 0x%x\n",
b);
374 ITextStream_Release(
stream);
383 hr = IFileSystem3_OpenTextFile(
fs3,
name, ForWriting, VARIANT_FALSE, TristateFalse, &
stream);
385 ITextStream_Release(
stream);
390 hr = IFileSystem3_OpenTextFile(
fs3,
name, ForAppending, VARIANT_FALSE, TristateTrue, &
stream);
392 ITextStream_Release(
stream);
397 hr = IFileSystem3_OpenTextFile(
fs3,
name, ForAppending, VARIANT_FALSE, TristateUseDefault, &
stream);
401 ITextStream_Release(
stream);
407 hr = IFileSystem3_OpenTextFile(
fs3,
name, ForReading, VARIANT_FALSE, TristateFalse, &
stream);
410 hr = ITextStream_get_AtEndOfStream(
stream, &
b);
412 ok(
b == VARIANT_FALSE,
"got 0x%x\n",
b);
413 ITextStream_Release(
stream);
465 {
L"a/a/a",
L"a/a" },
466 {
L"a\\a\\a",
L"a\\a" },
467 {
L"a/a//\\\\",
L"a" },
468 {
L"c:\\\\a",
L"c:\\" },
469 {
L"ac:\\a",
L"ac:" }
483 ok(
hr ==
S_OK,
"%d: unexpected hr %#lx.\n",
i,
hr);
503 {
L"a/a.b",
L"a.b" },
520 ok(
hr ==
S_OK,
"%d: unexpected hr %#lx.\n",
i,
hr);
535 hr = IFileSystem3_GetTempName(
fs3,
NULL);
556 {
L"a/a.b.c",
L"a.b" },
574 ok(
hr ==
S_OK,
"%d, unexpected hr %#lx.\n",
i,
hr);
586 static const WCHAR dir1[] =
L"test_dir1";
587 static const WCHAR dir2[] =
L"test_dir2";
588 static const WCHAR dir_match1[] =
L"test_dir*";
589 static const WCHAR dir_match2[] =
L"test_di*";
608 skip(
"GetAbsolutePathName tests\n");
675 file = (IFile*)0xdeadbeef;
677 ok(!
file,
"file != NULL\n");
682 skip(
"Can't create temporary file\n");
715#define FILE_ATTR_MASK (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN | \
716 FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_ARCHIVE | \
717 FILE_ATTRIBUTE_REPARSE_POINT | FILE_ATTRIBUTE_COMPRESSED)
719 hr = IFile_get_Attributes(
file, &
fa);
722 ok(
fa == gfa,
"Unexpected flags %#x, expected %lx.\n",
fa, gfa);
729 hr = IFile_get_Attributes(
file, &
fa);
731 ok(
fa == new_gfa,
"Unexpected flags %#x, expected %lx.\n",
fa, new_gfa);
733 hr = IFile_put_Attributes(
file, gfa);
736 ok(new_gfa == gfa,
"Unexpected flags %#lx, expected %lx.\n", new_gfa, gfa);
738 hr = IFile_get_Attributes(
file, &
fa);
740 ok(
fa == gfa,
"Unexpected flags %#x, expected %lx.\n",
fa, gfa);
789 static const WCHAR filesystem3_dir[] =
L"filesystem3_test";
790 static const WCHAR src1W[] =
L"src1";
791 static const WCHAR dstW[] =
L"dst";
798 skip(
"can't create temporary directory\n");
806 hr = IFileSystem3_CopyFile(
fs3, bsrc, bdst, VARIANT_TRUE);
809 hr = IFileSystem3_CopyFolder(
fs3, bsrc, bdst, VARIANT_TRUE);
813 hr = IFileSystem3_CopyFile(
fs3, bsrc, bdst, VARIANT_TRUE);
816 hr = IFileSystem3_CopyFolder(
fs3, bsrc, bdst, VARIANT_TRUE);
819 hr = IFileSystem3_DeleteFile(
fs3, bsrc, VARIANT_FALSE);
823 hr = IFileSystem3_CopyFile(
fs3, bsrc, bdst, VARIANT_TRUE);
826 hr = IFileSystem3_CopyFolder(
fs3, bsrc, bdst, VARIANT_TRUE);
829 hr = IFileSystem3_DeleteFile(
fs3, bdst, VARIANT_TRUE);
832 hr = IFileSystem3_CopyFolder(
fs3, bsrc, bdst, VARIANT_TRUE);
835 hr = IFileSystem3_CopyFolder(
fs3, bsrc, bdst, VARIANT_TRUE);
845 hr = IFileSystem3_CopyFolder(
fs3, bsrc, bdst, VARIANT_TRUE);
858 hr = IFileSystem3_CopyFolder(
fs3, bsrc, bdst, VARIANT_TRUE);
865 hr = IFileSystem3_DeleteFolder(
fs3, bdst, VARIANT_FALSE);
868 hr = IFileSystem3_CopyFolder(
fs3, bsrc, bdst, VARIANT_TRUE);
876 hr = IFileSystem3_CopyFolder(
fs3, bsrc, bdst, VARIANT_FALSE);
879 hr = IFileSystem3_CopyFolder(
fs3, bsrc, bdst, VARIANT_FALSE);
882 hr = IFileSystem3_CopyFolder(
fs3, bsrc, bdst, VARIANT_TRUE);
888 hr = IFileSystem3_DeleteFolder(
fs3, bsrc, VARIANT_FALSE);
910 {
"C:\\path",
"..\\name.tmp",
"C:\\path\\..\\name.tmp" },
911 {
"C:\\path",
"\\name.tmp",
"C:\\path\\name.tmp" },
912 {
"C:\\path",
"name.tmp",
"C:\\path\\name.tmp" },
913 {
"C:\\path\\",
"name.tmp",
"C:\\path\\name.tmp" },
914 {
"C:\\path",
"\\\\name.tmp",
"C:\\path\\\\name.tmp" },
915 {
"C:\\path\\",
"\\name.tmp",
"C:\\path\\name.tmp" },
916 {
"C:\\path\\",
"\\\\name.tmp",
"C:\\path\\\\name.tmp" },
917 {
"C:\\path\\\\",
"\\\\name.tmp",
"C:\\path\\\\\\name.tmp" },
918 {
"C:\\\\",
"\\name.tmp",
"C:\\\\name.tmp" },
919 {
"C:",
"name.tmp",
"C:name.tmp" },
920 {
"C:",
"\\\\name.tmp",
"C:\\\\name.tmp" },
965 ok(
hr ==
S_OK,
"%d: Unexpected hr %#lx.\n",
i,
hr);
990 folder = (
void*)0xdeadbeef;
1004 folder = (
void*)0xdeadbeef;
1049 ok(fetched == 1,
"%d: unexpected value %lu.\n",
line, fetched);
1052 hr = IEnumVARIANT_Clone(
enumvar, &clone);
1059 hr = IEnumVARIANT_Next(clone, 1, &var2, &fetched);
1060 if (position_inherited &&
count == 1)
1063 ok(!fetched,
"%d: unexpected value %lu.\n",
line, fetched);
1068 ok(fetched == 1,
"%d: unexpected value %lu.\n",
line, fetched);
1069 if (!position_inherited)
1076 ok(fetched == 1,
"%d: unexpected value %lu.\n",
line, fetched);
1083 IEnumVARIANT_Release(clone);
1088#define test_clone(a, b, c) _test_clone(a, b, c, __LINE__)
1094 static const WCHAR bW[] =
L"\\b";
1095 static const WCHAR cW[] =
L"\\c";
1096 IFolderCollection *folders;
1106 int found_a = 0, found_b = 0, found_c = 0;
1136 hr = IFolder_get_SubFolders(
folder, &folders);
1142 hr = IFolderCollection_get_Count(folders, &
count);
1152 hr = IFolderCollection_get_Count(folders, &
count);
1156 hr = IFolderCollection_get__NewEnum(folders,
NULL);
1159 hr = IFolderCollection_QueryInterface(folders, &IID_IEnumVARIANT, (
void**)&unk);
1166 hr = IFolderCollection_get__NewEnum(folders, &unk);
1170 ok(ref2 ==
ref + 1,
"Unexpected value %ld, %ld.\n", ref2,
ref);
1173 hr = IFolderCollection_get__NewEnum(folders, &unk2);
1175 ok(unk != unk2,
"got %p, %p\n", unk2, unk);
1176 IUnknown_Release(unk2);
1180 hr = IUnknown_QueryInterface(unk, &IID_IEnumVARIANT, (
void**)&
enumvar);
1183 ok(ref2 ==
ref,
"Unexpected value %ld, %ld.\n", ref2,
ref);
1187 for (
i = 0;
i < 3;
i++)
1192 ok(
hr ==
S_OK,
"%d: Unexpected hr %#lx.\n",
i,
hr);
1193 ok(fetched == 1,
"%d: unexpected value %lu.\n",
i, fetched);
1216 ok(found_a == 1 && found_b == 1 && found_c == 1,
1217 "each folder should be found 1 time instead of %d/%d/%d\n",
1218 found_a, found_b, found_c);
1224 ok(!fetched,
"Unexpected value %lu.\n", fetched);
1236 hr = IEnumVARIANT_Next(
enumvar, 0, var2, &fetched);
1238 ok(!fetched,
"Unexpected value %lu.\n", fetched);
1240 hr = IEnumVARIANT_Next(
enumvar, 2, var2, &fetched);
1242 ok(fetched == 1,
"Unexpected value %lu.\n", fetched);
1247 IEnumVARIANT_Release(
enumvar);
1248 IUnknown_Release(unk);
1261 IFolderCollection_Release(folders);
1268 static const WCHAR bW[] =
L"\\b";
1269 static const WCHAR cW[] =
L"\\c";
1272 IFileCollection *files;
1281 HANDLE file_a, file_b, file_c;
1282 int found_a = 0, found_b = 0, found_c = 0;
1305 hr = IFolder_get_Files(
folder, &files);
1311 hr = IFileCollection_get_Count(files, &
count);
1322 hr = IFileCollection_get_Count(files, &
count);
1326 hr = IFileCollection_get__NewEnum(files,
NULL);
1329 hr = IFileCollection_QueryInterface(files, &IID_IEnumVARIANT, (
void**)&unk);
1336 hr = IFileCollection_get__NewEnum(files, &unk);
1340 ok(ref2 ==
ref + 1,
"Unexpected value %ld, %ld.\n", ref2,
ref);
1343 hr = IFileCollection_get__NewEnum(files, &unk2);
1345 ok(unk != unk2,
"got %p, %p\n", unk2, unk);
1346 IUnknown_Release(unk2);
1350 hr = IUnknown_QueryInterface(unk, &IID_IEnumVARIANT, (
void**)&
enumvar);
1353 ok(ref2 ==
ref,
"Unexpected value %ld, %ld.\n", ref2,
ref);
1357 for (
i = 0;
i < 3;
i++)
1362 ok(
hr ==
S_OK,
"%d: Unexpected hr %#lx.\n",
i,
hr);
1363 ok(fetched == 1,
"%d: unexpected value %lu.\n",
i, fetched);
1383 IFile_Release(
file);
1387 ok(found_a == 1 && found_b == 1 && found_c == 1,
1388 "each file should be found 1 time instead of %d/%d/%d\n",
1389 found_a, found_b, found_c);
1395 ok(!fetched,
"Unexpected value %lu.\n", fetched);
1407 hr = IEnumVARIANT_Next(
enumvar, 0, var2, &fetched);
1409 ok(!fetched,
"Unexpected value %lu.\n", fetched);
1411 hr = IEnumVARIANT_Next(
enumvar, 2, var2, &fetched);
1413 ok(fetched == 1,
"Unexpected value %lu.\n", fetched);
1418 IEnumVARIANT_Release(
enumvar);
1419 IUnknown_Release(unk);
1426 IFileCollection_Release(files);
1431 IDriveCollection *drives;
1438 hr = IFileSystem3_get_Drives(
fs3, &drives);
1446 hr = IDriveCollection_get_Count(drives,
NULL);
1450 hr = IDriveCollection_get_Count(drives, &
count);
1458 ok(!fetched,
"Unexpected value %lu.\n", fetched);
1473 DriveTypeConst
type;
1499 if (
type == Fixed) {
1503 hr = IDrive_get_IsReady(
drive, &ready);
1505 ok(ready == VARIANT_TRUE,
"got %x\n", ready);
1507 if (ready != VARIANT_TRUE) {
1548 IEnumVARIANT_Release(
enumvar);
1549 IDriveCollection_Release(drives);
1573 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_FALSE, VARIANT_FALSE, &
stream);
1579 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_FALSE, VARIANT_FALSE, &
stream);
1596 ITextStream_Release(
stream);
1604 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_FALSE, VARIANT_FALSE, &
stream);
1608 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_TRUE, VARIANT_FALSE, &
stream);
1610 ITextStream_Release(
stream);
1613 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_TRUE, VARIANT_TRUE, &
stream);
1615 ITextStream_Release(
stream);
1664 ITextStream_Release(
stream);
1678 ITextStream_Release(
stream);
1683 ITextStream_Release(
stream);
1710 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_FALSE, VARIANT_FALSE, &
stream);
1715 ITextStream_Release(
stream);
1724 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_FALSE, VARIANT_TRUE, &
stream);
1729 ITextStream_Release(
stream);
1743 static const WCHAR firstlineW[] =
L"first";
1744 static const WCHAR secondlineW[] =
L"second";
1761 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_FALSE, VARIANT_TRUE, &
stream);
1777 str = (
void*)0xdeadbeef;
1782 ITextStream_Release(
stream);
1784 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateFalse, &
stream);
1800 ITextStream_Release(
stream);
1803 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateTrue, &
stream);
1817 str = (
void*)0xdeadbeef;
1819 ok(
hr == CTL_E_ENDOFFILE,
"Unexpected hr %#lx.\n",
hr);
1823 str = (
void*)0xdeadbeef;
1825 ok(
hr == CTL_E_ENDOFFILE,
"Unexpected hr %#lx.\n",
hr);
1827 ITextStream_Release(
stream);
1830 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateTrue, &
stream);
1847 ITextStream_Release(
stream);
1851 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_TRUE, VARIANT_FALSE, &
stream);
1857 ITextStream_Release(
stream);
1859 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateTrue, &
stream);
1862 str = (
void*)0xdeadbeef;
1864 ok(
hr == CTL_E_ENDOFFILE,
"Unexpected hr %#lx.\n",
hr);
1867 ITextStream_Release(
stream);
1876 static const WCHAR firstlineW[] =
L"first";
1877 static const WCHAR secondlineW[] =
L"second";
1893 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_FALSE, VARIANT_TRUE, &
stream);
1915 str = (
void*)0xdeadbeef;
1920 ITextStream_Release(
stream);
1922 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateFalse, &
stream);
1928 str = (
void*)0xdeadbeef;
1933 str = (
void*)0xdeadbeef;
1950 ITextStream_Release(
stream);
1953 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateTrue, &
stream);
1967 str = (
void*)0xdeadbeef;
1969 ok(
hr == CTL_E_ENDOFFILE,
"Unexpected hr %#lx.\n",
hr);
1973 str = (
void*)0xdeadbeef;
1975 ok(
hr == CTL_E_ENDOFFILE,
"Unexpected hr %#lx.\n",
hr);
1977 ITextStream_Release(
stream);
1980 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateTrue, &
stream);
1996 ITextStream_Release(
stream);
1999 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateUseDefault, &
stream);
2012 ITextStream_Release(
stream);
2015 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForAppending, VARIANT_FALSE, TristateUseDefault, &
stream);
2023 ITextStream_Release(
stream);
2025 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateTrue, &
stream);
2035 ITextStream_Release(
stream);
2038 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForWriting, VARIANT_FALSE, TristateUseDefault, &
stream);
2046 ITextStream_Release(
stream);
2048 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateFalse, &
stream);
2051 str = (
void*)0xdeadbeef;
2056 ITextStream_Release(
stream);
2058 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_TRUE, VARIANT_FALSE, &
stream);
2064 ITextStream_Release(
stream);
2066 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateUseDefault, &
stream);
2069 str = (
void*)0xdeadbeef;
2074 ITextStream_Release(
stream);
2077 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForAppending, VARIANT_FALSE, TristateUseDefault, &
stream);
2085 ITextStream_Release(
stream);
2087 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateFalse, &
stream);
2096 ITextStream_Release(
stream);
2099 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForWriting, VARIANT_FALSE, TristateUseDefault, &
stream);
2107 ITextStream_Release(
stream);
2109 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateFalse, &
stream);
2112 str = (
void*)0xdeadbeef;
2117 ITextStream_Release(
stream);
2121 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_TRUE, VARIANT_FALSE, &
stream);
2127 ITextStream_Release(
stream);
2129 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateTrue, &
stream);
2132 str = (
void*)0xdeadbeef;
2134 ok(
hr == CTL_E_ENDOFFILE,
"Unexpected hr %#lx.\n",
hr);
2137 ITextStream_Release(
stream);
2141 hr = IFileSystem3_CreateTextFile(
fs3,
nameW, VARIANT_TRUE, VARIANT_FALSE, &
stream);
2147 ITextStream_Release(
stream);
2149 hr = IFileSystem3_OpenTextFile(
fs3,
nameW, ForReading, VARIANT_FALSE, TristateTrue, &
stream);
2158 str = (
void*)0xdeadbeef;
2160 ok(
hr == CTL_E_ENDOFFILE,
"Unexpected hr %#lx.\n",
hr);
2163 ITextStream_Release(
stream);
2181 const char data[] =
"first line\r\nsecond\n\n\rt\r\re \rst\n";
2192 for (
i = 0;
i < 1000;
i++)
2197 hr = IFileSystem3_OpenTextFile(
fs3,
str, ForReading, VARIANT_FALSE, TristateFalse, &
stream);
2201 for (
i = 0;
i < 1000;
i++)
2226 ok(
hr == CTL_E_ENDOFFILE,
"Unexpected hr %#lx.\n",
hr);
2230 ITextStream_Release(
stream);
2255 {
L"?", -1, VARIANT_FALSE },
2273 ok(
ret == VARIANT_FALSE,
"got %x\n",
ret);
2280 for (; *
ptr->drivespec;
ptr++) {
2282 if (
ptr->drivetype != -1) {
2286 if (
root[0] >
'Z') {
2287 skip(
"No drive with type 0x%x found, skipping test %s.\n",
2295 ret =
ptr->expected_ret == VARIANT_TRUE ? VARIANT_FALSE : VARIANT_TRUE;
2297 ok(
hr ==
S_OK,
"Unexpected hr %#lx. for drive spec %s (%s)\n",
2299 ok(
ret ==
ptr->expected_ret,
"got %d, expected %d for drive spec %s (%s)\n",
2305 ret =
ptr->expected_ret == VARIANT_TRUE ? VARIANT_FALSE : VARIANT_TRUE;
2307 ok(
hr ==
S_OK,
"Unexpected hr %#lx. for drive spec %s (%s)\n",
2309 ok(
ret ==
ptr->expected_ret,
"got %d, expected %d for drive spec %s (%s)\n",
2322 {
L"C:\\1.tst",
L"C:" },
2323 {
L"O:\\1.tst",
L"O:" },
2341 name = (
void*)0xdeadbeef;
2346 while (*
ptr->path) {
2348 name = (
void*)0xdeadbeef;
2370 IDrive *drive_fixed, *
drive;
2371 BSTR dl_fixed, drivespec;
2374 drive = (
void*)0xdeadbeef;
2384 skip(
"All drive letters are occupied, skipping test for nonexisting drive.\n");
2387 drive = (
void*)0xdeadbeef;
2388 hr = IFileSystem3_GetDrive(
fs3, drivespec, &
drive);
2396 skip(
"No fixed drive found, skipping test.\n");
2400 hr = IDrive_get_DriveLetter(drive_fixed, &dl_fixed);
2404 skip(
"Could not retrieve drive letter of fixed drive, skipping test.\n");
2409 { {dl_upper,0},
S_OK, {dl_upper,0} },
2410 { {dl_upper,
':',0},
S_OK, {dl_upper,0} },
2411 { {dl_upper,
':',
'\\',0},
S_OK, {dl_upper,0} },
2412 { {dl_lower,
':',
'\\',0},
S_OK, {dl_upper,0} },
2422 for (; *
ptr->drivespec;
ptr++) {
2424 drive = (
void*)0xdeadbeef;
2426 ok(
hr ==
ptr->res,
"Unexpected hr %#lx, expected %#lx for drive spec %s.\n",
2431 if (*
ptr->driveletter) {
2442 IDrive_Release(
drive);
2459 skip(
"No fixed drive found, skipping test.\n");
2489 IDrive_Release(
drive);
2497 {
L"n.o.ext",
L"ext" },
2498 {
L"n.o.eXt",
L"eXt" },
2518 ok(
ext ==
NULL,
"%d: path %s, got %s, expected %s\n",
i,
2534 hr = IFileSystem3_GetSpecialFolder(
fs3, WindowsFolder,
NULL);
2537 hr = IFileSystem3_GetSpecialFolder(
fs3, TemporaryFolder+1,
NULL);
2540 hr = IFileSystem3_GetSpecialFolder(
fs3, TemporaryFolder+1, &
folder);
2543 hr = IFileSystem3_GetSpecialFolder(
fs3, WindowsFolder, &
folder);
2552 hr = IFileSystem3_GetSpecialFolder(
fs3, SystemFolder, &
folder);
2561 hr = IFileSystem3_GetSpecialFolder(
fs3, TemporaryFolder, &
folder);
2581 hr = IFileSystem3_CreateTextFile(
fs3,
str, VARIANT_FALSE, VARIANT_FALSE, &
stream);
2590 ITextStream_Release(
stream);
2593 hr = IFileSystem3_CreateTextFile(
fs3,
str, VARIANT_FALSE, VARIANT_FALSE, &
stream);
2596 ITextStream_Release(
stream);
2606 hr = IFileSystem3_DeleteFile(
fs3,
str, VARIANT_TRUE);
2625 hr = IFileSystem3_DeleteFile(
fs3,
str, VARIANT_TRUE);
2630 hr = IFileSystem3_DeleteFile(
fs3,
str, VARIANT_TRUE);
2644 static const char testdata[] =
"test";
2647 HANDLE piperead, pipewrite;
2659 ok(
ret,
"Failed to create pipes.\n");
2668 ok(
ret,
"Failed to write to the pipe.\n");
2669 ok(written ==
sizeof(
testdata),
"Write to anonymous pipe wrote %ld bytes.\n", written);
2684 ok(
ret,
"Unexpected return value.\n");
2687 ok(!
ret,
"Unexpected return value.\n");
2691 ok(
ret,
"Failed to create pipes.\n");
2739 &IID_IFileSystem3, (
void**)&
fs3);
2742 win_skip(
"Could not create FileSystem object, hr %#lx.\n",
hr);
2777 IFileSystem3_Release(
fs3);
static const WCHAR nameW[]
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
const char * wine_dbgstr_an(const char *str, int n)
struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES
#define GetCurrentDirectoryW(x, y)
#define ReadFile(a, b, c, d, e)
#define GetProcAddress(x, y)
#define INVALID_HANDLE_VALUE
#define FILE_ATTRIBUTE_NORMAL
#define WideCharToMultiByte
#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)
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
BOOL WINAPI FindClose(HANDLE hFindFile)
BOOL WINAPI WriteFile(_In_ HANDLE hFile, _In_reads_bytes_opt_(nNumberOfBytesToWrite) LPCVOID lpBuffer, _In_ DWORD nNumberOfBytesToWrite, _Out_opt_ LPDWORD lpNumberOfBytesWritten, _Inout_opt_ LPOVERLAPPED lpOverlapped)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
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)
BOOL WINAPI PathIsRelativeW(const WCHAR *path)
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
_ACRTIMP wchar_t *__cdecl wcsstr(const wchar_t *, const wchar_t *)
_ACRTIMP size_t __cdecl strlen(const char *)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
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
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
int WINAPI lstrlenA(LPCSTR lpString)
#define memmove(s1, s2, n)
#define FILE_FLAG_DELETE_ON_CLOSE
#define ERROR_FILE_NOT_FOUND
static struct test_info tests[]
const IID IID_IObjectWithSite
#define create_file(name, size)
static const WCHAR pathW[]
static const WCHAR filenameW[]
static IActiveScriptSite * site
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_file_contents(LPCWSTR pathW, DWORD expected_size, const void *expected_contents, int line)
static void test_DriveCollection(void)
static void test_DoOpenPipeStream(void)
static void test_ReadLine(void)
#define GET_REFCOUNT(iface)
static void test_GetParentFolderName(void)
static void test_CopyFolder(void)
static void test_GetTempName(void)
static void test_FolderCreateTextFile(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)
#define test_file_contents(a, b, c)
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_MoveFile(void)
static void test_createfolder(void)
static void test_GetFolder(void)
static void test_FolderCollection(void)
static DWORD ITextStream ** stream
static IDrive * get_fixed_drive(void)
static const char utf16bom[]
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 IWbemPath * create_path(void)
BOOL WINAPI CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize)
#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)
static __inline const char * wine_dbgstr_guid(const GUID *id)
TCHAR file_path[MAX_PATH]
LPVOID lpSecurityDescriptor
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)
HRESULT CDECL stream_write(IStream *stream, const void *buffer, ULONG write, ULONG *bytes_written)
static HRESULT HRESULT_FROM_WIN32(unsigned int x)