44DEFINE_GUID(IID_IParentAndItem, 0xB3A4B685, 0xB685, 0x4805, 0x99,0xD9, 0x5D,0xEA,0xD2,0x87,0x32,0x36);
45DEFINE_GUID(CLSID_ShellDocObjView, 0xe7e4bc40, 0xe76a, 0x11ce, 0xa9,0xbb, 0x00,0xaa,0x00,0x4a,0xe8,0x37);
106#define MAKEFUNC(f) (p##f = (void*)GetProcAddress(hmod, #f))
109 MAKEFUNC(SHCreateItemFromRelativeName);
110 MAKEFUNC(SHCreateItemInKnownFolder);
123 MAKEFUNC(SHGetSetFolderCustomSettings);
128 ok(
broken(
ptr == 0) ||
ptr != 0,
"expected named export for ILFree\n");
131#define TESTNAMED(f) \
132 ptr = (void*)GetProcAddress(hmod, #f); \
133 ok(ptr != 0, "expected named export for " #f "\n");
157 ok(
hr ==
S_OK,
"SHGetMalloc failed %08x\n",
hr);
171 if (lpszPath[-1] !=
'\\')
186 {{
'c',
':',
'\\',0},
S_OK},
188 {{
'c',
':',
'\\',
'f',
'a',
'k',
'e',0}, 0x80070002},
191 {{
'c',
':',
'\\',
'w',
'i',
'n',
'd',
'o',
'w',
's',0},
S_OK},
192 {{
'c',
':',
'\\',
'w',
'i',
'n',
'd',
'o',
'w',
's',
'\\',0},
S_OK},
193 {{
'c',
':',
'\\',
'w',
'i',
'n',
'd',
'o',
'w',
's',
'\\',
'.',0},
E_INVALIDARG, 1},
194 {{
'c',
':',
'\\',
'w',
'i',
'n',
'd',
'o',
'w',
's',
'\\',
'.',
'.',0},
E_INVALIDARG, 1},
197 {{
't',
'e',
's',
't',0}, 0x80070002},
198 {{
't',
'e',
's',
't',
'\\',0}, 0x80070002},
199 {{
's',
'u',
'b',
'\\',
'd',
'i',
'r',0}, 0x80070002},
200 {{
's',
'u',
'b',
'/',
'd',
'i',
'r',0},
E_INVALIDARG, 1},
201 {{
'h',
't',
't',
'p',
':',0},
S_OK, 1},
202 {{
'h',
't',
't',
'p',
':',
't',
'e',
's',
't',0},
S_OK, 1},
203 {{
'h',
't',
't',
'p',
':',
'\\',
't',
'e',
's',
't',0},
S_OK, 1},
204 {{
'x',
'x',
':',0},
S_OK, 1},
209 static WCHAR testdirW[] = {
'p',
'a',
'r',
's',
'e',
't',
'e',
's',
't',0};
219 ok(
hr ==
S_OK,
"Expected SHGetDesktopFolder to return S_OK, got 0x%08x\n",
hr);
239 ok(bRes,
"SHGetSpecialFolderPath(CSIDL_PERSONAL) failed! %u\n",
GetLastError());
242 ok(
hr ==
S_OK,
"DesktopFolder->ParseDisplayName failed. hr = %08x.\n",
hr);
245 "Last pidl should be of type PT_FOLDER, but is: %02x\n",
256 ok(
hr == 0x80070002,
"got %#x\n",
hr);
276 IShellFolder_Release(desktop);
329 static const WORD iResults [5][5] =
338#define SFGAO_testfor SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR | SFGAO_CAPABILITYMASK
340 static const ULONG attrs[5] =
342 SFGAO_CAPABILITYMASK | SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR,
343 SFGAO_CAPABILITYMASK | SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR,
344 SFGAO_CAPABILITYMASK | SFGAO_FILESYSTEM,
345 SFGAO_CAPABILITYMASK | SFGAO_FILESYSTEM,
346 SFGAO_CAPABILITYMASK | SFGAO_FILESYSTEM,
348 static const ULONG full_attrs[5] =
350 SFGAO_CAPABILITYMASK | SFGAO_STORAGE | SFGAO_STORAGEANCESTOR | SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR,
351 SFGAO_CAPABILITYMASK | SFGAO_STORAGE | SFGAO_STORAGEANCESTOR | SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR,
352 SFGAO_CAPABILITYMASK | SFGAO_STREAM | SFGAO_FILESYSTEM,
353 SFGAO_CAPABILITYMASK | SFGAO_STREAM | SFGAO_FILESYSTEM,
354 SFGAO_CAPABILITYMASK | SFGAO_STREAM | SFGAO_FILESYSTEM,
357 hr = IShellFolder_EnumObjects(iFolder,
NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN, &iEnumList);
358 ok(
hr ==
S_OK,
"EnumObjects failed %08x\n",
hr);
364 while (IEnumIDList_Next(iEnumList, 10-
i, &idlArr[
i], &NumPIDLs) ==
S_OK)
366 ok (
i == 5,
"i: %d\n",
i);
368 hr = IEnumIDList_Release(iEnumList);
369 ok(
hr ==
S_OK,
"IEnumIDList_Release failed %08x\n",
hr);
372 for (
i=0;
i<5;
i++)
for (
j=0;
j<5;
j++)
376 idlArr[
i] = idlArr[
j];
380 for (
i=0;
i<5;
i++)
for (
j=0;
j<5;
j++)
383 ok(
hr == iResults[
i][
j],
"Got %x expected [%d]-[%d]=%x\n",
hr,
i,
j, iResults[
i][
j]);
387 for (
i = 0;
i < 5;
i++)
390#define SFGAO_VISTA SFGAO_DROPTARGET | SFGAO_CANLINK | SFGAO_CANCOPY
392 flags = SFGAO_CANCOPY;
395 ok(
hr ==
S_OK,
"GetAttributesOf returns %08x\n",
hr);
398 "GetAttributesOf[%i] got %08x, expected %08x\n",
i,
flags, attrs[
i]);
403 ok(
hr ==
S_OK,
"GetAttributesOf returns %08x\n",
hr);
404 ok(
flags == attrs[
i],
"GetAttributesOf[%i] got %08x, expected %08x\n",
i,
flags, attrs[
i]);
408 ok(
hr ==
S_OK,
"GetAttributesOf returns %08x\n",
hr);
409 ok((
flags & ~(SFGAO_HASSUBFOLDER|SFGAO_COMPRESSED)) == full_attrs[
i],
"%d: got %08x expected %08x\n",
i,
flags, full_attrs[
i]);
413 IMalloc_Free(
ppM, idlArr[
i]);
420 IShellFolder *psfDesktop, *psfChild, *psfMyComputer, *psfSystemDir;
429 WCHAR wszMyComputer[] = {
430 ':',
':',
'{',
'2',
'0',
'D',
'0',
'4',
'F',
'E',
'0',
'-',
'3',
'A',
'E',
'A',
'-',
'1',
'0',
'6',
'9',
'-',
431 'A',
'2',
'D',
'8',
'-',
'0',
'8',
'0',
'0',
'2',
'B',
'3',
'0',
'3',
'0',
'9',
'D',
'}',0 };
432 static const CHAR filename_html[] =
"winetest.html";
433 static const CHAR filename_txt[] =
"winetest.txt";
434 static const CHAR filename_foo[] =
"winetest.foo";
440 ok (
hr ==
S_OK,
"SHGetDesktopFolder failed! hr = %08x\n",
hr);
443 hr = IShellFolder_BindToObject(psfDesktop, pidlEmpty,
NULL, &IID_IShellFolder, (
LPVOID*)&psfChild);
444 ok (
hr ==
E_INVALIDARG,
"Desktop's BindToObject should fail, when called with empty pidl! hr = %08x\n",
hr);
446 hr = IShellFolder_BindToObject(psfDesktop,
NULL,
NULL, &IID_IShellFolder, (
LPVOID*)&psfChild);
447 ok (
hr ==
E_INVALIDARG,
"Desktop's BindToObject should fail, when called with NULL pidl! hr = %08x\n",
hr);
450 ok (
hr ==
S_OK,
"Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08x\n",
hr);
452 IShellFolder_Release(psfDesktop);
456 hr = IShellFolder_BindToObject(psfDesktop, pidlMyComputer,
NULL, &IID_IShellFolder, (
LPVOID*)&psfMyComputer);
457 ok (
hr ==
S_OK,
"Desktop failed to bind to MyComputer object! hr = %08x\n",
hr);
458 IShellFolder_Release(psfDesktop);
459 IMalloc_Free(
ppM, pidlMyComputer);
462 hr = IShellFolder_BindToObject(psfMyComputer, pidlEmpty,
NULL, &IID_IShellFolder, (
LPVOID*)&psfChild);
463 ok (
hr ==
E_INVALIDARG,
"MyComputers's BindToObject should fail, when called with empty pidl! hr = %08x\n",
hr);
465 hr = IShellFolder_BindToObject(psfMyComputer,
NULL,
NULL, &IID_IShellFolder, (
LPVOID*)&psfChild);
466 ok (
hr ==
E_INVALIDARG,
"MyComputers's BindToObject should fail, when called with NULL pidl! hr = %08x\n",
hr);
471 IShellFolder_Release(psfMyComputer);
477 ok (
hr ==
S_OK,
"MyComputers's ParseDisplayName failed to parse the SystemDirectory! hr = %08x\n",
hr);
479 IShellFolder_Release(psfMyComputer);
483 hr = IShellFolder_BindToObject(psfMyComputer, pidlSystemDir,
NULL, &IID_IShellFolder, (
LPVOID*)&psfSystemDir);
484 ok (
hr ==
S_OK,
"MyComputer failed to bind to a FileSystem ShellFolder! hr = %08x\n",
hr);
485 IShellFolder_Release(psfMyComputer);
486 IMalloc_Free(
ppM, pidlSystemDir);
489 hr = IShellFolder_BindToObject(psfSystemDir, pidlEmpty,
NULL, &IID_IShellFolder, (
LPVOID*)&psfChild);
491 "FileSystem ShellFolder's BindToObject should fail, when called with empty pidl! hr = %08x\n",
hr);
493 hr = IShellFolder_BindToObject(psfSystemDir,
NULL,
NULL, &IID_IShellFolder, (
LPVOID*)&psfChild);
495 "FileSystem ShellFolder's BindToObject should fail, when called with NULL pidl! hr = %08x\n",
hr);
497 IShellFolder_Release(psfSystemDir);
502 skip(
"Failed to get current directory, skipping tests.\n");
523 hr = IShellFolder_BindToObject(psfDesktop, pidl,
NULL, &IID_IShellFolder, (
void**)&psfChild);
530 hr = IShellFolder_QueryInterface(psfChild, &
IID_IPersist, (
void**)&pp);
535 hr = IPersist_GetClassID(pp, &
id);
538 IPersist_Release(pp);
541 IShellFolder_Release(psfChild);
548 win_skip(
"Failed to create .html testfile.\n");
562 hr = IShellFolder_BindToObject(psfDesktop, pidl,
NULL, &IID_IShellFolder, (
void**)&psfChild);
572 win_skip(
"Failed to create .txt testfile.\n");
586 hr = IShellFolder_BindToObject(psfDesktop, pidl,
NULL, &IID_IShellFolder, (
void**)&psfChild);
596 win_skip(
"Failed to create .foo testfile.\n");
609 hr = IShellFolder_BindToObject(psfDesktop, pidl,
NULL, &IID_IShellFolder, (
void **)&psfChild);
628 hr = IShellFolder_BindToObject(psfDesktop, pidl,
NULL, &IID_IShellFolder, (
void **)&psfChild);
636 IShellFolder_Release(psfDesktop);
648 LPSHELLFOLDER psfDesktop, psfPersonal;
653 static const CHAR szFileName[] =
"winetest.foo";
654 static const WCHAR wszFileName[] = {
'w',
'i',
'n',
'e',
't',
'e',
's',
't',
'.',
'f',
'o',
'o',0 };
655 static const WCHAR wszDirName[] = {
'w',
'i',
'n',
'e',
't',
'e',
's',
't',0 };
658 WCHAR wszAbsoluteFilename[] = {
'C',
':',
'\\',
'w',
'i',
'n',
'e',
't',
'e',
's',
't', 0 };
680 ok(0,
"unable to create the '%s' directory\n", szTestDir);
694 ok(
hr ==
S_OK,
"SHGetDesktopFolder failed! hr = %08x\n",
hr);
700 ok(
hr ==
S_OK,
"Desktop->ParseDisplayName failed! hr = %08x\n",
hr);
702 IShellFolder_Release(psfDesktop);
707 ok(pidlLast->mkid.cb >= 76,
"Expected pidl length of at least 76, got %d.\n", pidlLast->mkid.cb);
708 if (pidlLast->mkid.cb >= 28) {
710 "Filename should be stored as ansi-string at this position!\n");
713 if (pidlLast->mkid.cb >= 76) {
718 "Filename should be stored as wchar-string at this position!\n");
728 IUnknown_Release(psfFile);
732 hr =
SHBindToParent(pidlTestFile, &IID_IShellFolder, (
void **)&psfPersonal, &pidlLast);
733 ok(
hr ==
S_OK,
"SHBindToParent failed! hr = %08x\n",
hr);
736 hr = IShellFolder_SetNameOf(psfPersonal,
NULL, pidlLast, wszDirName, SHGDN_NORMAL, &pidlNew);
737 ok (
hr ==
S_OK,
"SetNameOf failed! hr = %08x\n",
hr);
740 "pidl returned from SetNameOf should be simple!\n");
744 hr = IShellFolder_SetNameOf(psfPersonal,
NULL, pidlNew, wszAbsoluteFilename, SHGDN_FORPARSING,
NULL);
750 ok (
hr ==
S_OK,
"SetNameOf failed! hr = %08x\n",
hr);
753 IShellFolder_Release(psfPersonal);
762 ok (!
lstrcmpiW(wszTestFile, wszTestFile2),
"SHGetPathFromIDListW returns incorrect path!\n");
767 "SHBindToParent(NULL) should fail! hr = %08x\n",
hr);
770 hr =
SHBindToParent(pidlEmpty, &IID_IShellFolder, (
void **)&psfPersonal, &pidlLast);
771 ok (
hr ==
S_OK,
"SHBindToParent(empty PIDL) should succeed! hr = %08x\n",
hr);
772 ok (pidlLast == pidlEmpty,
"The last element of an empty PIDL should be the PIDL itself!\n");
774 IShellFolder_Release(psfPersonal);
777 hr =
SHBindToParent(pidlTestFile, &IID_IShellFolder, (
void **)&psfPersonal, &pidlLast);
778 ok (
hr ==
S_OK,
"SHBindToParent failed! hr = %08x\n",
hr);
780 IShellFolder_Release(psfDesktop);
787 "SHBindToParent doesn't return the last id of the pidl param!\n");
790 ok (
hr ==
S_OK,
"Personal->GetDisplayNameOf failed! hr = %08x\n",
hr);
792 IShellFolder_Release(psfDesktop);
793 IShellFolder_Release(psfPersonal);
798 ok (
hr ==
S_OK,
"StrRetToBufW failed! hr = %08x\n",
hr);
799 ok (!
lstrcmpiW(wszTestFile, wszTestFile2),
"GetDisplayNameOf returns incorrect path!\n");
802 IShellFolder_Release(psfDesktop);
803 IShellFolder_Release(psfPersonal);
812 LPSHELLFOLDER psfDesktop;
814 DWORD dwAttributes, dwCallForAttributes, dwOrigAttributes, dwOrigCallForAttributes;
815 static const WCHAR wszAttributes[] = {
'A',
't',
't',
'r',
'i',
'b',
'u',
't',
'e',
's',0 };
816 static const WCHAR wszCallForAttributes[] = {
817 'C',
'a',
'l',
'l',
'F',
'o',
'r',
'A',
't',
't',
'r',
'i',
'b',
'u',
't',
'e',
's',0 };
818 static const WCHAR wszMyDocumentsKey[] = {
819 'C',
'L',
'S',
'I',
'D',
'\\',
'{',
'4',
'5',
'0',
'D',
'8',
'F',
'B',
'A',
'-',
'A',
'D',
'2',
'5',
'-',
820 '1',
'1',
'D',
'0',
'-',
'9',
'8',
'A',
'8',
'-',
'0',
'8',
'0',
'0',
'3',
'6',
'1',
'B',
'1',
'1',
'0',
'3',
'}',
821 '\\',
'S',
'h',
'e',
'l',
'l',
'F',
'o',
'l',
'd',
'e',
'r',0 };
822 WCHAR wszMyDocuments[] = {
823 ':',
':',
'{',
'4',
'5',
'0',
'D',
'8',
'F',
'B',
'A',
'-',
'A',
'D',
'2',
'5',
'-',
'1',
'1',
'D',
'0',
'-',
824 '9',
'8',
'A',
'8',
'-',
'0',
'8',
'0',
'0',
'3',
'6',
'1',
'B',
'1',
'1',
'0',
'3',
'}',0 };
836 ok (
hr ==
S_OK,
"SHGetDesktopFolder failed! hr = %08x\n",
hr);
840 &pidlMyDocuments,
NULL);
842 "Desktop's ParseDisplayName failed to parse MyDocuments's CLSID! hr = %08x\n",
hr);
844 IShellFolder_Release(psfDesktop);
849 hr = IShellFolder_GetAttributesOf(psfDesktop, 1,
851 ok (
hr ==
S_OK,
"Desktop->GetAttributesOf(MyDocuments) failed! hr = %08x\n",
hr);
854 ok (
dwAttributes & SFGAO_FILESYSTEM,
"SFGAO_FILESYSTEM attribute is not set for MyDocuments!\n");
855 ok (!(
dwAttributes & SFGAO_ISSLOW),
"SFGAO_ISSLOW attribute is set for MyDocuments!\n");
856 ok (!(
dwAttributes & SFGAO_GHOSTED),
"SFGAO_GHOSTED attribute is set for MyDocuments!\n");
864 "RegOpenKeyEx failed! result: %08x\n", lResult);
867 skip(
"Not enough rights to open the registry key\n");
868 IMalloc_Free(
ppM, pidlMyDocuments);
869 IShellFolder_Release(psfDesktop);
876 ok (lResult ==
ERROR_SUCCESS,
"RegQueryValueEx failed! result: %08x\n", lResult);
879 IMalloc_Free(
ppM, pidlMyDocuments);
880 IShellFolder_Release(psfDesktop);
888 ok (lResult ==
ERROR_SUCCESS,
"RegQueryValueEx failed! result: %08x\n", lResult);
891 IMalloc_Free(
ppM, pidlMyDocuments);
892 IShellFolder_Release(psfDesktop);
901 dwCallForAttributes = SFGAO_ISSLOW|SFGAO_FILESYSTEM;
910 dwAttributes = SFGAO_ISSLOW|SFGAO_GHOSTED|SFGAO_FILESYSTEM;
911 hr = IShellFolder_GetAttributesOf(psfDesktop, 1,
913 ok (
hr ==
S_OK,
"Desktop->GetAttributesOf(MyDocuments) failed! hr = %08x\n",
hr);
916 "Desktop->GetAttributes(MyDocuments) returned unexpected attributes: %08x\n",
924 IMalloc_Free(
ppM, pidlMyDocuments);
925 IShellFolder_Release(psfDesktop);
931 LPSHELLFOLDER psfDesktop, psfMyComputer;
936 static const DWORD desktopFlags = SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR |
937 SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER;
938 static const DWORD myComputerFlags = SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET |
939 SFGAO_DROPTARGET | SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
940 WCHAR wszMyComputer[] = {
941 ':',
':',
'{',
'2',
'0',
'D',
'0',
'4',
'F',
'E',
'0',
'-',
'3',
'A',
'E',
'A',
'-',
'1',
'0',
'6',
'9',
'-',
942 'A',
'2',
'D',
'8',
'-',
'0',
'8',
'0',
'0',
'2',
'B',
'3',
'0',
'3',
'0',
'9',
'D',
'}',0 };
945 static WCHAR cTestDirW[] = {
't',
'e',
's',
't',
'd',
'i',
'r',0};
951 ok (
hr ==
S_OK,
"SHGetDesktopFolder failed! hr = %08x\n",
hr);
956 hr = IShellFolder_GetAttributesOf(psfDesktop, 1, &pidlEmpty, &
dwFlags);
957 ok (
hr ==
S_OK,
"Desktop->GetAttributesOf(empty pidl) failed! hr = %08x\n",
hr);
962 hr = IShellFolder_GetAttributesOf(psfDesktop, 0,
NULL, &
dwFlags);
963 ok (
hr ==
S_OK,
"Desktop->GetAttributesOf(NULL) failed! hr = %08x\n",
hr);
968 ok (
hr ==
S_OK,
"Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08x\n",
hr);
970 IShellFolder_Release(psfDesktop);
979 ok (
hr ==
S_OK,
"Desktop->GetAttributesOf(MyComputer) failed! hr = %08x\n",
hr);
981 ok (
dwFlags == (myComputerFlags | SFGAO_CANLINK),
"Wrong MyComputer attributes: %08x\n",
dwFlags);
983 hr = IShellFolder_BindToObject(psfDesktop, pidlMyComputer,
NULL, &IID_IShellFolder, (
LPVOID*)&psfMyComputer);
984 ok (
hr ==
S_OK,
"Desktop failed to bind to MyComputer object! hr = %08x\n",
hr);
985 IShellFolder_Release(psfDesktop);
986 IMalloc_Free(
ppM, pidlMyComputer);
989 hr = IShellFolder_GetAttributesOf(psfMyComputer, 1, &pidlEmpty, &
dwFlags);
991 ok (
hr ==
E_INVALIDARG,
"MyComputer->GetAttributesOf(empty pidl) should fail! hr = %08x\n",
hr);
994 hr = IShellFolder_GetAttributesOf(psfMyComputer, 0,
NULL, &
dwFlags);
995 ok (
hr ==
S_OK,
"MyComputer->GetAttributesOf(NULL) failed! hr = %08x\n",
hr);
997 ok (
dwFlags == myComputerFlags,
"Wrong MyComputer attributes: %08x\n",
dwFlags);
999 IShellFolder_Release(psfMyComputer);
1005 win_skip(
"GetCurrentDirectoryA returned empty string. Skipping test_GetAttributesOf\n");
1008 if (
len > 3 && cCurrDirA[
len-1] ==
'\\')
1009 cCurrDirA[
len-1] = 0;
1017 ok(
hr ==
S_OK,
"SHGetDesktopfolder failed %08x\n",
hr);
1020 ok(
hr ==
S_OK,
"ParseDisplayName failed %08x\n",
hr);
1022 hr = IShellFolder_BindToObject(IDesktopFolder, newPIDL,
NULL, (
REFIID)&IID_IShellFolder, (
LPVOID *)&testIShellFolder);
1023 ok(
hr ==
S_OK,
"BindToObject failed %08x\n",
hr);
1025 IMalloc_Free(
ppM, newPIDL);
1029 ok(
hr ==
S_OK,
"ParseDisplayName failed %08x\n",
hr);
1034 ok (
hr ==
S_OK,
"Desktop->GetAttributesOf() failed! hr = %08x\n",
hr);
1035 ok ((
dwFlags&SFGAO_FOLDER),
"Wrong directory attribute for relative PIDL: %08x\n",
dwFlags);
1038 IMalloc_Free(
ppM, newPIDL);
1041 if (cCurrDirA[
len-1] ==
'\\')
1042 cCurrDirA[
len-1] = 0;
1047 ok(
hr ==
S_OK,
"ParseDisplayName failed %08x\n",
hr);
1052 ok (
hr ==
S_OK,
"Desktop->GetAttributesOf() failed! hr = %08x\n",
hr);
1053 ok ((
dwFlags&SFGAO_FOLDER),
"Wrong directory attribute for absolute PIDL: %08x\n",
dwFlags);
1056 IMalloc_Free(
ppM, newPIDL);
1058 IShellFolder_Release(testIShellFolder);
1062 IShellFolder_Release(IDesktopFolder);
1073 LPSHELLFOLDER psfDesktop;
1074 WCHAR wszMyComputer[] = {
1075 ':',
':',
'{',
'2',
'0',
'D',
'0',
'4',
'F',
'E',
'0',
'-',
'3',
'A',
'E',
'A',
'-',
'1',
'0',
'6',
'9',
'-',
1076 'A',
'2',
'D',
'8',
'-',
'0',
'8',
'0',
'0',
'2',
'B',
'3',
'0',
'3',
'0',
'9',
'D',
'}',0 };
1081 static WCHAR wszTestFile[] = {
1082 'w',
'i',
'n',
'e',
't',
'e',
's',
't',
'.',
'f',
'o',
'o',0 };
1090 ok(!wszPath[0],
"Expected empty string\n");
1100 ok(!
lstrcmpiW(wszDesktop, wszPath),
"SHGetPathFromIDListW didn't return desktop path for empty pidl!\n");
1104 ok (
hr ==
S_OK,
"SHGetDesktopFolder failed! hr = %08x\n",
hr);
1108 ok (
hr ==
S_OK,
"Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08x\n",
hr);
1110 IShellFolder_Release(psfDesktop);
1118 ok (!
result,
"SHGetPathFromIDListW succeeded where it shouldn't!\n");
1121 "Unexpected last error from SHGetPathFromIDListW: %u\n",
GetLastError());
1122 ok (!wszPath[0],
"Expected empty path\n");
1124 IShellFolder_Release(psfDesktop);
1128 IMalloc_Free(
ppM, pidlMyComputer);
1133 IShellFolder_Release(psfDesktop);
1141 IShellFolder_Release(psfDesktop);
1147 ok (
hr ==
S_OK,
"Desktop's ParseDisplayName failed to parse filename hr = %08x\n",
hr);
1149 IShellFolder_Release(psfDesktop);
1151 IMalloc_Free(
ppM, pidlTestFile);
1158 ok (
hr ==
S_OK,
"Desktop's GetDisplayNamfOf failed! hr = %08x\n",
hr);
1159 IShellFolder_Release(psfDesktop);
1162 IMalloc_Free(
ppM, pidlTestFile);
1167 "Desktop->GetDisplayNameOf(pidlTestFile, SHGDN_FORPARSING) "
1168 "returned incorrect path for file placed on desktop\n");
1172 ok(0 ==
lstrcmpW(
wszFileName, wszPath),
"SHGetPathFromIDListW returned incorrect path for file placed on desktop\n");
1174 if (pSHGetPathFromIDListEx)
1176 result = pSHGetPathFromIDListEx(pidlEmpty, wszPath,
MAX_PATH, SFGAO_FILESYSTEM);
1178 ok(!
lstrcmpiW(wszDesktop, wszPath),
"Unexpected SHGetPathFromIDListEx result %s, expected %s\n",
1181 result = pSHGetPathFromIDListEx(pidlTestFile, wszPath,
MAX_PATH, SFGAO_FILESYSTEM);
1187 memset(wszPath, 0x55,
sizeof(wszPath));
1188 result = pSHGetPathFromIDListEx(pidlTestFile, wszPath, 5, SFGAO_FILESYSTEM);
1192 memset(wszPath, 0x55,
sizeof(wszPath));
1193 result = pSHGetPathFromIDListEx(pidlEmpty, wszPath, 5, SFGAO_FILESYSTEM);
1197 win_skip(
"SHGetPathFromIDListEx not available\n");
1199 IMalloc_Free(
ppM, pidlTestFile);
1203 ok(
hr ==
S_OK,
"SHGetFolderLocation failed: 0x%08x\n",
hr);
1207 IMalloc_Free(
ppM, pidlPrograms);
1208 ok(
result,
"SHGetPathFromIDListW failed\n");
1216 static const CHAR cTestDirA[] =
"\\testdir";
1225 win_skip(
"GetCurrentDirectoryA returned empty string. Skipping test_EnumObjects_and_CompareIDs\n");
1228 if(cCurrDirA[
len-1] ==
'\\')
1229 cCurrDirA[
len-1] = 0;
1235 ok(
hr ==
S_OK,
"SHGetDesktopfolder failed %08x\n",
hr);
1240 ok(
hr ==
S_OK,
"ParseDisplayName failed %08x\n",
hr);
1242 hr = IShellFolder_BindToObject(IDesktopFolder, newPIDL,
NULL, (
REFIID)&IID_IShellFolder, (
LPVOID *)&testIShellFolder);
1243 ok(
hr ==
S_OK,
"BindToObject failed %08x\n",
hr);
1247 IShellFolder_Release(testIShellFolder);
1251 IMalloc_Free(
ppM, newPIDL);
1253 IShellFolder_Release(IDesktopFolder);
1268 ok (
FALSE,
"InitPropertyBag asked for unknown interface!\n");
1272 IPropertyBag_AddRef(iface);
1287 static const WCHAR wszTargetSpecialFolder[] = {
1288 'T',
'a',
'r',
'g',
'e',
't',
'S',
'p',
'e',
'c',
'i',
'a',
'l',
'F',
'o',
'l',
'd',
'e',
'r',0 };
1289 static const WCHAR wszTarget[] = {
1290 'T',
'a',
'r',
'g',
'e',
't',0 };
1291 static const WCHAR wszAttributes[] = {
1292 'A',
't',
't',
'r',
'i',
'b',
'u',
't',
'e',
's',0 };
1293 static const WCHAR wszResolveLinkFlags[] = {
1294 'R',
'e',
's',
'o',
'l',
'v',
'e',
'L',
'i',
'n',
'k',
'F',
'l',
'a',
'g',
's',0 };
1295 static const WCHAR wszTargetKnownFolder[] = {
1296 'T',
'a',
'r',
'g',
'e',
't',
'K',
'n',
'o',
'w',
'n',
'F',
'o',
'l',
'd',
'e',
'r',0 };
1297 static const WCHAR wszCLSID[] = {
1298 'C',
'L',
'S',
'I',
'D',0 };
1300 if (!
lstrcmpW(pszPropName, wszTargetSpecialFolder)) {
1301 ok(
V_VT(pVar) ==
VT_I4,
"Wrong variant type for 'TargetSpecialFolder' property!\n");
1305 if (!
lstrcmpW(pszPropName, wszResolveLinkFlags))
1307 ok(
V_VT(pVar) ==
VT_UI4,
"Wrong variant type for 'ResolveLinkFlags' property!\n");
1311 if (!
lstrcmpW(pszPropName, wszTarget)) {
1315 ok(
V_VT(pVar) ==
VT_BSTR,
"Wrong variant type for 'Target' property!\n");
1326 if (!
lstrcmpW(pszPropName, wszAttributes)) {
1327 ok(
V_VT(pVar) ==
VT_UI4,
"Wrong variant type for 'Attributes' property!\n");
1329 V_UI4(pVar) = SFGAO_FOLDER|SFGAO_HASSUBFOLDER|SFGAO_FILESYSANCESTOR|
1330 SFGAO_CANRENAME|SFGAO_FILESYSTEM;
1334 if (!
lstrcmpW(pszPropName, wszTargetKnownFolder)) {
1335 ok(
V_VT(pVar) ==
VT_BSTR,
"Wrong variant type for 'TargetKnownFolder' property!\n");
1340 if (!
lstrcmpW(pszPropName, wszCLSID)) {
1341 ok(
V_VT(pVar) ==
VT_EMPTY,
"Wrong variant type for 'CLSID' property!\n");
1353 ok(
FALSE,
"Unexpected call to IPropertyBag_Write\n");
1378 LPITEMIDLIST pidlCurrentFolder, pidlWineTestFolder, pidlSubFolder;
1380 WCHAR wszWineTestFolder[] = {
1381 ':',
':',
'{',
'9',
'B',
'3',
'5',
'2',
'E',
'B',
'F',
'-',
'2',
'7',
'6',
'5',
'-',
'4',
'5',
'C',
'1',
'-',
1382 'B',
'4',
'C',
'6',
'-',
'8',
'5',
'C',
'C',
'7',
'F',
'7',
'A',
'B',
'C',
'6',
'4',
'}',0 };
1383 WCHAR wszShellExtKey[] = {
'S',
'o',
'f',
't',
'w',
'a',
'r',
'e',
'\\',
1384 'M',
'i',
'c',
'r',
'o',
's',
'o',
'f',
't',
'\\',
'W',
'i',
'n',
'd',
'o',
'w',
's',
'\\',
1385 'C',
'u',
'r',
'r',
'e',
'n',
't',
'V',
'e',
'r',
's',
'i',
'o',
'n',
'\\',
1386 'E',
'x',
'p',
'l',
'o',
'r',
'e',
'r',
'\\',
'D',
'e',
's',
'k',
't',
'o',
'p',
'\\',
1387 'N',
'a',
'm',
'e',
'S',
'p',
'a',
'c',
'e',
'\\',
1388 '{',
'9',
'b',
'3',
'5',
'2',
'e',
'b',
'f',
'-',
'2',
'7',
'6',
'5',
'-',
'4',
'5',
'c',
'1',
'-',
1389 'b',
'4',
'c',
'6',
'-',
'8',
'5',
'c',
'c',
'7',
'f',
'7',
'a',
'b',
'c',
'6',
'4',
'}',0 };
1391 WCHAR wszSomeSubFolder[] = {
'S',
'u',
'b',
'F',
'o',
'l',
'd',
'e',
'r', 0};
1393 {0x9d20aae8, 0x0625, 0x44b0, {0x9c, 0xa7, 0x71, 0x88, 0x9c, 0x22, 0x54, 0xd9}};
1402 win_skip(
"CLSID_FolderShortcut is not implemented\n");
1405 ok (
hr ==
S_OK,
"CoCreateInstance failed! hr = 0x%08x\n",
hr);
1409 ok(
hr ==
S_OK,
"IPersistPropertyBag_Load failed! hr = %08x\n",
hr);
1411 IPersistPropertyBag_Release(pPersistPropertyBag);
1415 hr = IPersistPropertyBag_QueryInterface(pPersistPropertyBag, &IID_IShellFolder,
1417 IPersistPropertyBag_Release(pPersistPropertyBag);
1418 ok(
hr ==
S_OK,
"IPersistPropertyBag_QueryInterface(IShellFolder) failed! hr = %08x\n",
hr);
1423 "IShellFolder_GetDisplayNameOf(NULL) failed! hr = %08x\n",
hr);
1425 IShellFolder_Release(pShellFolder);
1434 ok(!
lstrcmpiW(wszDesktopPath, wszBuffer),
"FolderShortcut returned incorrect folder!\n");
1436 hr = IShellFolder_QueryInterface(pShellFolder, &IID_IPersistFolder3, (
LPVOID*)&pPersistFolder3);
1437 IShellFolder_Release(pShellFolder);
1438 ok(
hr ==
S_OK,
"IShellFolder_QueryInterface(IID_IPersistFolder3 failed! hr = 0x%08x\n",
hr);
1441 hr = IPersistFolder3_GetClassID(pPersistFolder3, &
clsid);
1442 ok(
hr ==
S_OK,
"IPersistFolder3_GetClassID failed! hr=0x%08x\n",
hr);
1445 hr = IPersistFolder3_GetCurFolder(pPersistFolder3, &pidlCurrentFolder);
1447 ok(!pidlCurrentFolder,
"IPersistFolder3_GetCurFolder should return a NULL pidl!\n");
1456 ok (
hr ==
S_OK,
"SHGetDesktopFolder failed! hr = %08x\n",
hr);
1464 &pidlWineTestFolder,
NULL);
1466 IShellFolder_Release(pDesktopFolder);
1467 ok (
hr ==
S_OK,
"IShellFolder::ParseDisplayName failed! hr = %08x\n",
hr);
1470 hr = IPersistFolder3_Initialize(pPersistFolder3, pidlWineTestFolder);
1471 ok (
hr ==
S_OK,
"IPersistFolder3::Initialize failed! hr = %08x\n",
hr);
1473 IPersistFolder3_Release(pPersistFolder3);
1474 ILFree(pidlWineTestFolder);
1478 hr = IPersistFolder3_GetCurFolder(pPersistFolder3, &pidlCurrentFolder);
1479 ok(
hr ==
S_OK,
"IPersistFolder3_GetCurFolder failed! hr=0x%08x\n",
hr);
1480 ok(
ILIsEqual(pidlCurrentFolder, pidlWineTestFolder),
1481 "IPersistFolder3_GetCurFolder should return pidlWineTestFolder!\n");
1482 ILFree(pidlCurrentFolder);
1483 ILFree(pidlWineTestFolder);
1485 hr = IPersistFolder3_QueryInterface(pPersistFolder3, &IID_IShellFolder, (
LPVOID*)&pShellFolder);
1486 IPersistFolder3_Release(pPersistFolder3);
1487 ok(
hr ==
S_OK,
"IPersistFolder3_QueryInterface(IShellFolder) failed! hr = %08x\n",
hr);
1491 ok(
hr ==
S_OK,
"IShellFolder_GetDisplayNameOf(NULL) failed! hr = %08x\n",
hr);
1493 IShellFolder_Release(pShellFolder);
1498 ok(!
lstrcmpiW(wszDesktopPath, wszBuffer),
"FolderShortcut returned incorrect folder!\n");
1503 lstrcatW(wszDesktopPath, wszSomeSubFolder);
1505 IShellFolder_Release(pShellFolder);
1510 &pidlSubFolder,
NULL);
1512 ok (
hr ==
S_OK,
"IShellFolder::ParseDisplayName failed! hr = %08x\n",
hr);
1514 IShellFolder_Release(pShellFolder);
1518 hr = IShellFolder_BindToObject(pShellFolder, pidlSubFolder,
NULL, &IID_IPersistFolder3,
1519 (
LPVOID*)&pPersistFolder3);
1520 IShellFolder_Release(pShellFolder);
1522 ok (
hr ==
S_OK,
"IShellFolder::BindToObject failed! hr = %08x\n",
hr);
1528 hr = IPersistFolder3_GetClassID(pPersistFolder3, &
clsid);
1529 ok(
hr ==
S_OK,
"IPersistFolder3_GetClassID failed! hr=0x%08x\n",
hr);
1531 "IPersistFolder3::GetClassID returned unexpected CLSID!\n");
1533 IPersistFolder3_Release(pPersistFolder3);
1536#include "pshpack1.h"
1564 LPSHELLFOLDER psfDesktop, psfPersonal;
1569 WCHAR wszFile[3][17] = { {
'e',
'v',
'e',
'n',
'_',0 }, {
'o',
'd',
'd',
'_',0 },
1570 {
'l',
'o',
'n',
'g',
'e',
'r',
'_',
't',
'h',
'a',
'n',
'.',
'8',
'_',
'3',0 } };
1574 ok(bResult,
"SHGetSpecialFolderPathW failed! Last error: %u\n",
GetLastError());
1575 if (!bResult)
return;
1580 win_skip(
"Most W-calls are not implemented\n");
1583 ok(bResult,
"SetCurrentDirectory failed! Last error: %u\n",
GetLastError());
1584 if (!bResult)
return;
1587 ok(
hr ==
S_OK,
"SHGetDesktopFolder failed! hr: %08x\n",
hr);
1591 ok(
hr ==
S_OK,
"psfDesktop->ParseDisplayName failed! hr = %08x\n",
hr);
1593 IShellFolder_Release(psfDesktop);
1597 hr = IShellFolder_BindToObject(psfDesktop, pidlPersonal,
NULL, &IID_IShellFolder,
1599 IShellFolder_Release(psfDesktop);
1601 ok(
hr ==
S_OK,
"psfDesktop->BindToObject failed! hr = %08x\n",
hr);
1604 for (
i=0;
i<3;
i++) {
1614 IShellFolder_Release(psfPersonal);
1621 ok(
hr ==
S_OK,
"psfPersonal->ParseDisplayName failed! hr: %08x\n",
hr);
1623 IShellFolder_Release(psfPersonal);
1627 pFileStructA = (
struct FileStructA *)pidlFile->mkid.abID;
1628 ok(pFileStructA->
type == 0x32,
"PIDLTYPE should be 0x32!\n");
1629 ok(pFileStructA->
dummy == 0x00,
"Dummy Byte should be 0x00!\n");
1630 ok(pFileStructA->
dwFileSize == 0,
"Filesize should be zero!\n");
1633 ok(!
strcmp(szFile, (
CHAR*)&pidlFile->mkid.abID[12]),
"Wrong file name!\n");
1641 ok(pidlFile->mkid.abID[18] ==
'~',
"Should be derived 8.3 name!\n");
1644 ok(pidlFile->mkid.abID[12 +
strlen(szFile) + 1] !=
'\0',
1645 "Alignment byte, where there shouldn't be!\n");
1648 ok(pidlFile->mkid.abID[12 +
strlen(szFile) + 1] ==
'\0',
1649 "There should be an alignment byte, but isn't!\n");
1652 cbOffset = *(
WORD*)(((
LPBYTE)pidlFile)+pidlFile->mkid.cb-
sizeof(
WORD));
1654 cbOffset <= pidlFile->mkid.cb -
sizeof(
struct FileStructW)),
1655 "Wrong offset value (%d) stored at the end of the PIDL\n", cbOffset);
1658 cbOffset <= pidlFile->mkid.cb -
sizeof(
struct FileStructW))
1664 "FileStructW's offset and length should add up to the PIDL's length!\n");
1675 "Last write time should match creation time!\n");
1686 "Last write date and time should match last access date and time!\n");
1692 trace (
"Filesystem may be FAT. Performing less strict atime test.\n");
1693 ok ((pFileStructW->
uTime2 & 0x1F) == 0,
1694 "Last access time on FAT filesystems should have zero seconds.\n");
1702 "The filename should be stored in unicode at this position!\n");
1709 IShellFolder_Release(psfPersonal);
1714 static const BOOL is_win64 =
sizeof(
void *) >
sizeof(
int);
1725 ok(
hr ==
S_OK,
"SHGetFolderPathA failed %x\n",
hr );
1729 win_skip(
"Program Files (x86) not supported\n" );
1732 ok(
hr ==
S_OK,
"SHGetFolderPathA failed %x\n",
hr );
1737 ok(
strstr( path_x86,
"x86" ) !=
NULL,
"32-bit path '%s' doesn't contain x86\n", path_x86 );
1753 ok( !
lstrcmpiA( path_key, path_x86 ),
"paths differ '%s' != '%s'\n", path_key, path_x86 );
1755 else ok( !
is_win64 && !
is_wow64,
"ProgramFilesDir (x86) should exist on 64-bit setup\n" );
1760 ok(
hr ==
S_OK,
"SHGetFolderPathA failed %x\n",
hr );
1764 win_skip(
"Common Files (x86) not supported\n" );
1767 ok(
hr ==
S_OK,
"SHGetFolderPathA failed %x\n",
hr );
1772 ok(
strstr( path_x86,
"x86" ) !=
NULL,
"32-bit path '%s' doesn't contain x86\n", path_x86 );
1788 ok( !
lstrcmpiA( path_key, path_x86 ),
"paths differ '%s' != '%s'\n", path_key, path_x86 );
1790 else ok( !
is_win64 && !
is_wow64,
"CommonFilesDir (x86) should exist on 64-bit setup\n" );
1800 static const char wine[] =
"wine";
1801 static const char winetemp[] =
"wine\\temp";
1804 static char toolongpath[
MAX_PATH+1];
1808 win_skip(
"SHGetFolderPathA failed for CSIDL_LOCAL_APPDATA!\n");
1835 "expected %s to start with %s\n", testpath,
appdata);
1837 "expected %s to end with %s\n", testpath, winetemp);
1842 ok(0,
"expected S_OK or E_INVALIDARG, got %x\n",
ret);
1862 toolongpath[
i] =
'0' +
i % 10;
1883 "expected %s to start with %s\n", testpath,
appdata);
1885 "expected %s to end with %s\n", testpath, winetemp);
1904 static char resourcefile[
MAX_PATH];
1910 static const char desktopini_contents1[] =
1911 "[.ShellClassInfo]\r\n"
1912 "LocalizedResourceName=@";
1913 static const char desktopini_contents2[] =
1915 static WCHAR foldernameW[] = {
't',
'e',
's',
't',
'f',
'o',
'l',
'd',
'e',
'r',0};
1916 static const WCHAR folderdisplayW[] = {
'F',
'o',
'l',
'd',
'e',
'r',
' ',
'N',
'a',
'm',
'e',
' ',
'R',
'e',
's',
'o',
'u',
'r',
'c',
'e',0};
1939 win_skip(
"GetCurrentDirectoryA returned empty string. Skipping test_LocalizedNames\n");
1942 if(cCurrDirA[
len-1] ==
'\\')
1943 cCurrDirA[
len-1] = 0;
1948 ok(
hr ==
S_OK,
"SHGetDesktopfolder failed %08x\n",
hr);
1951 ok(
hr ==
S_OK,
"ParseDisplayName failed %08x\n",
hr);
1953 hr = IShellFolder_BindToObject(IDesktopFolder, newPIDL,
NULL, (
REFIID)&IID_IShellFolder, (
LPVOID *)&testIShellFolder);
1954 ok(
hr ==
S_OK,
"BindToObject failed %08x\n",
hr);
1956 IMalloc_Free(
ppM, newPIDL);
1960 ok(
hr ==
S_OK,
"ParseDisplayName failed %08x\n",
hr);
1963 ok(
hr ==
S_OK,
"GetDisplayNameOf failed %08x\n",
hr);
1966 ok (
hr ==
S_OK,
"StrRetToBufW failed! hr = %08x\n",
hr);
1972 ok(
hr ==
S_OK,
"GetDisplayNameOf failed %08x\n",
hr);
1975 ok (
hr ==
S_OK,
"StrRetToBufW failed! hr = %08x\n",
hr);
1981 ok(
hr ==
S_OK,
"GetDisplayNameOf failed %08x\n",
hr);
1984 ok (
hr ==
S_OK,
"StrRetToBufW failed! hr = %08x\n",
hr);
1987 IShellFolder_Release(IDesktopFolder);
1988 IShellFolder_Release(testIShellFolder);
1990 IMalloc_Free(
ppM, newPIDL);
2002 LPITEMIDLIST pidl_cwd=
NULL, pidl_testfile, pidl_abstestfile, pidl_test, pidl_desktop;
2012 if (!pSHCreateShellItem)
2014 win_skip(
"SHCreateShellItem isn't available\n");
2020 win_skip(
"GetCurrentDirectoryA returned empty string, skipping test_SHCreateShellItem\n");
2035 ret = IShellFolder_BindToObject(desktopfolder, pidl_cwd,
NULL, &IID_IShellFolder, (
void**)¤tfolder);
2043 pidl_abstestfile =
ILCombine(pidl_cwd, pidl_testfile);
2045 shellitem = (
void*)0xdeadbeef;
2048 ok(shellitem == 0,
"Got %p\n", shellitem);
2053 pSHCreateShellItem(pidl_cwd,
NULL,
NULL, &shellitem);
2054 pSHCreateShellItem(
NULL, currentfolder,
NULL, &shellitem);
2055 pSHCreateShellItem(pidl_cwd, currentfolder,
NULL, &shellitem);
2058 ret = pSHCreateShellItem(
NULL,
NULL, pidl_cwd, &shellitem);
2062 ret = IShellItem_QueryInterface(shellitem, &IID_IPersistIDList, (
void**)&persistidl);
2066 ret = IPersistIDList_GetIDList(persistidl, &pidl_test);
2070 ok(
ILIsEqual(pidl_cwd, pidl_test),
"id lists are not equal\n");
2073 IPersistIDList_Release(persistidl);
2075 IShellItem_Release(shellitem);
2078 ret = pSHCreateShellItem(pidl_cwd,
NULL, pidl_testfile, &shellitem);
2082 ret = IShellItem_QueryInterface(shellitem, &IID_IPersistIDList, (
void**)&persistidl);
2086 ret = IPersistIDList_GetIDList(persistidl, &pidl_test);
2090 ok(
ILIsEqual(pidl_abstestfile, pidl_test),
"id lists are not equal\n");
2093 IPersistIDList_Release(persistidl);
2096 ret = IShellItem_GetParent(shellitem, &shellitem2);
2100 ret = IShellItem_QueryInterface(shellitem2, &IID_IPersistIDList, (
void**)&persistidl);
2104 ret = IPersistIDList_GetIDList(persistidl, &pidl_test);
2108 ok(
ILIsEqual(pidl_cwd, pidl_test),
"id lists are not equal\n");
2111 IPersistIDList_Release(persistidl);
2113 IShellItem_Release(shellitem2);
2116 IShellItem_Release(shellitem);
2119 ret = pSHCreateShellItem(
NULL, currentfolder, pidl_testfile, &shellitem);
2123 ret = IShellItem_QueryInterface(shellitem, &IID_IPersistIDList, (
void**)&persistidl);
2127 ret = IPersistIDList_GetIDList(persistidl, &pidl_test);
2131 ok(
ILIsEqual(pidl_abstestfile, pidl_test),
"id lists are not equal\n");
2134 IPersistIDList_Release(persistidl);
2136 IShellItem_Release(shellitem);
2140 ret = pSHCreateShellItem(pidl_cwd, desktopfolder, pidl_testfile, &shellitem);
2144 ret = IShellItem_QueryInterface(shellitem, &IID_IPersistIDList, (
void**)&persistidl);
2148 ret = IPersistIDList_GetIDList(persistidl, &pidl_test);
2152 ok(
ILIsEqual(pidl_abstestfile, pidl_test),
"id lists are not equal\n");
2155 IPersistIDList_Release(persistidl);
2157 IShellItem_Release(shellitem);
2160 ret = pSHCreateShellItem(
NULL, desktopfolder, pidl_testfile, &shellitem);
2164 ret = IShellItem_QueryInterface(shellitem, &IID_IPersistIDList, (
void**)&persistidl);
2168 ret = IPersistIDList_GetIDList(persistidl, &pidl_test);
2172 ok(
ILIsEqual(pidl_testfile, pidl_test),
"id lists are not equal\n");
2175 IPersistIDList_Release(persistidl);
2178 IShellItem_Release(shellitem);
2181 ret = pSHCreateShellItem(
NULL,
NULL, pidl_desktop, &shellitem);
2185 ret = IShellItem_GetParent(shellitem, &shellitem2);
2188 IShellItem_Release(shellitem);
2192 if(pSHCreateItemFromParsingName)
2197 pSHCreateItemFromParsingName(
NULL,
NULL, &IID_IShellItem,
NULL);
2200 shellitem = (
void*)0xdeadbeef;
2201 ret = pSHCreateItemFromParsingName(
NULL,
NULL, &IID_IShellItem, (
void**)&shellitem);
2203 ok(shellitem ==
NULL,
"shellitem was %p.\n", shellitem);
2205 ret = pSHCreateItemFromParsingName(
testfileW,
NULL, &IID_IShellItem, (
void**)&shellitem);
2207 "SHCreateItemFromParsingName returned %x\n",
ret);
2214 ret = pSHCreateItemFromParsingName(fnbufW,
NULL, &IID_IShellItem, (
void**)&shellitem);
2215 ok(
ret ==
S_OK,
"SHCreateItemFromParsingName returned %x\n",
ret);
2219 ret = IShellItem_GetDisplayName(shellitem, SIGDN_FILESYSPATH, &tmp_fname);
2223 ok(!
lstrcmpW(fnbufW, tmp_fname),
"strings not equal\n");
2226 IShellItem_Release(shellitem);
2230 win_skip(
"No SHCreateItemFromParsingName\n");
2234 if(pSHCreateItemFromIDList)
2239 pSHCreateItemFromIDList(
NULL, &IID_IShellItem,
NULL);
2242 ret = pSHCreateItemFromIDList(
NULL, &IID_IShellItem, (
void**)&shellitem);
2245 ret = pSHCreateItemFromIDList(pidl_cwd, &IID_IShellItem, (
void**)&shellitem);
2246 ok(
ret ==
S_OK,
"SHCreateItemFromIDList returned %x\n",
ret);
2249 ret = IShellItem_QueryInterface(shellitem, &IID_IPersistIDList, (
void**)&persistidl);
2253 ret = IPersistIDList_GetIDList(persistidl, &pidl_test);
2257 ok(
ILIsEqual(pidl_cwd, pidl_test),
"id lists are not equal\n");
2260 IPersistIDList_Release(persistidl);
2262 IShellItem_Release(shellitem);
2265 ret = pSHCreateItemFromIDList(pidl_testfile, &IID_IShellItem, (
void**)&shellitem);
2266 ok(
ret ==
S_OK,
"SHCreateItemFromIDList returned %x\n",
ret);
2269 ret = IShellItem_QueryInterface(shellitem, &IID_IPersistIDList, (
void**)&persistidl);
2273 ret = IPersistIDList_GetIDList(persistidl, &pidl_test);
2277 ok(
ILIsEqual(pidl_testfile, pidl_test),
"id lists are not equal\n");
2280 IPersistIDList_Release(persistidl);
2282 IShellItem_Release(shellitem);
2286 win_skip(
"No SHCreateItemFromIDList\n");
2289 if(pSHCreateItemFromRelativeName && pSHGetKnownFolderPath)
2292 WCHAR *desktop_path, *displayname;
2298 ret = pSHCreateShellItem(
NULL,
NULL, pidl_desktop, &shellitem_desktop);
2299 ok(
ret ==
S_OK,
"SHCreateShellItem failed: 0x%08x.\n",
ret);
2301 shellitem = (
void*)0xdeadbeef;
2302 ret = pSHCreateItemFromRelativeName(shellitem_desktop,
NULL,
NULL, &IID_IShellItem,
2303 (
void**)&shellitem);
2304 ok(
ret ==
E_INVALIDARG,
"Expected 0x%08x but SHCreateItemFromRelativeName return: 0x%08x.\n",
2306 ok(shellitem ==
NULL,
"shellitem was %p.\n", shellitem);
2309 shellitem = (
void*)0xdeadbeef;
2310 ret = pSHCreateItemFromRelativeName(shellitem_desktop,
testfileW,
NULL, &IID_IShellItem,
2311 (
void**)&shellitem);
2313 "Expected 0x%08x but SHCreateItemFromRelativeName return: 0x%08x.\n",
2315 ok(shellitem ==
NULL,
"shellitem was %p.\n", shellitem);
2318 pSHGetKnownFolderPath(&FOLDERID_Desktop, 0,
NULL, &desktop_path);
2319 lstrcatW(testfile_path, desktop_path);
2326 shellitem = (
void*)0xdeadbeef;
2327 ret = pSHCreateItemFromRelativeName(shellitem_desktop,
testfileW,
NULL, &IID_IShellItem,
2328 (
void**)&shellitem);
2329 ok(
ret ==
S_OK,
"SHCreateItemFromRelativeName failed: 0x%08x.\n",
ret);
2330 ok(shellitem !=
NULL,
"shellitem was %p.\n", shellitem);
2333 ret = IShellItem_GetDisplayName(shellitem, 0, &displayname);
2334 ok(
ret ==
S_OK,
"IShellItem_GetDisplayName failed: 0x%08x.\n",
ret);
2338 shellitem2 = (
void*)0xdeadbeef;
2339 ret = pSHCreateItemFromRelativeName(shellitem_desktop,
testfileW,
NULL, &IID_IShellItem,
2340 (
void**)&shellitem2);
2341 ok(
ret ==
S_OK,
"SHCreateItemFromRelativeName failed: 0x%08x.\n",
ret);
2342 ret = IShellItem_Compare(shellitem, shellitem2, 0, &
order);
2343 ok(
ret ==
S_OK,
"IShellItem_Compare failed: 0x%08x.\n",
ret);
2345 IShellItem_Release(shellitem2);
2347 shellitem2 = (
void*)0xdeadbeef;
2349 &pidl_desktop_testfile,
NULL);
2350 ok(
ret ==
S_OK,
"ParseDisplayName failed 0x%08x.\n",
ret);
2351 ret = pSHCreateItemFromIDList(pidl_desktop_testfile, &IID_IShellItem, (
void**)&shellitem2);
2352 ret = IShellItem_Compare(shellitem, shellitem2, 0, &
order);
2353 ok(
ret ==
S_OK,
"IShellItem_Compare fail: 0x%08x.\n",
ret);
2355 ILFree(pidl_desktop_testfile);
2356 IShellItem_Release(shellitem2);
2358 IShellItem_Release(shellitem);
2363 IShellItem_Release(shellitem_desktop);
2366 win_skip(
"No SHCreateItemFromRelativeName or SHGetKnownFolderPath\n");
2369 if(pSHCreateItemInKnownFolder && pSHGetKnownFolderPath)
2371 WCHAR *desktop_path;
2378 shellitem = (
void*)0xdeadbeef;
2379 ret = pSHCreateItemInKnownFolder(&FOLDERID_Desktop, 0,
NULL, &IID_IShellItem,
2380 (
void**)&shellitem);
2381 ok(
ret ==
S_OK,
"SHCreateItemInKnownFolder failed: 0x%08x.\n",
ret);
2382 ok(shellitem !=
NULL,
"shellitem was %p.\n", shellitem);
2385 shellitem2 = (
void*)0xdeadbeef;
2386 ret = pSHCreateShellItem(
NULL,
NULL, pidl_desktop, &shellitem2);
2390 ret = IShellItem_Compare(shellitem, shellitem2, 0, &
order);
2391 ok(
ret ==
S_OK,
"IShellItem_Compare failed: 0x%08x.\n",
ret);
2393 IShellItem_Release(shellitem2);
2395 IShellItem_Release(shellitem);
2399 shellitem = (
void*)0xdeadbeef;
2400 ret = pSHCreateItemInKnownFolder(&FOLDERID_Desktop, 0,
testfileW, &IID_IShellItem,
2401 (
void**)&shellitem);
2403 "Expected 0x%08x but SHCreateItemInKnownFolder return: 0x%08x.\n",
2405 ok(shellitem ==
NULL,
"shellitem was %p.\n", shellitem);
2407 pSHGetKnownFolderPath(&FOLDERID_Desktop, 0,
NULL, &desktop_path);
2408 lstrcatW(testfile_path, desktop_path);
2415 shellitem = (
void*)0xdeadbeef;
2416 ret = pSHCreateItemInKnownFolder(&FOLDERID_Desktop, 0,
testfileW, &IID_IShellItem,
2417 (
void**)&shellitem);
2418 ok(
ret ==
S_OK,
"SHCreateItemInKnownFolder failed: 0x%08x.\n",
ret);
2419 ok(shellitem !=
NULL,
"shellitem was %p.\n", shellitem);
2422 ret = IShellItem_GetDisplayName(shellitem, 0, &displayname);
2423 ok(
ret ==
S_OK,
"IShellItem_GetDisplayName failed: 0x%08x.\n",
ret);
2428 shellitem2 = (
void*)0xdeadbeef;
2429 ret = pSHCreateItemInKnownFolder(&FOLDERID_Desktop, 0,
testfileW, &IID_IShellItem,
2430 (
void**)&shellitem2);
2431 ok(
ret ==
S_OK,
"SHCreateItemInKnownFolder failed: 0x%08x.\n",
ret);
2432 ok(shellitem2 !=
NULL,
"shellitem was %p.\n", shellitem);
2433 ret = IShellItem_Compare(shellitem, shellitem2, 0, &
order);
2434 ok(
ret ==
S_OK,
"IShellItem_Compare failed: 0x%08x.\n",
ret);
2436 IShellItem_Release(shellitem2);
2438 shellitem2 = (
void*)0xdeadbeef;
2440 &pidl_desktop_testfile,
NULL);
2442 ret = pSHCreateItemFromIDList(pidl_desktop_testfile, &IID_IShellItem, (
void**)&shellitem2);
2443 ret = IShellItem_Compare(shellitem, shellitem2, 0, &
order);
2444 ok(
ret ==
S_OK,
"IShellItem_Compare failed: 0x%08x.\n",
ret);
2446 ILFree(pidl_desktop_testfile);
2447 IShellItem_Release(shellitem2);
2449 IShellItem_Release(shellitem);
2452 shellitem = (
void*)0xdeadbeef;
2453 ret = pSHCreateItemInKnownFolder(&FOLDERID_Documents, 0,
NULL, &IID_IShellItem,
2454 (
void**)&shellitem);
2455 ok(
ret ==
S_OK,
"SHCreateItemInKnownFolder failed: 0x%08x.\n",
ret);
2456 ok(shellitem !=
NULL,
"shellitem was %p.\n", shellitem);
2459 shellitem2 = (
void*)0xdeadbeef;
2460 ret = pSHCreateItemInKnownFolder(&FOLDERID_Documents, 0,
NULL, &IID_IShellItem,
2461 (
void**)&shellitem2);
2462 ok(
ret ==
S_OK,
"SHCreateItemInKnownFolder failed: 0x%08x.\n",
ret);
2463 ok(shellitem2 !=
NULL,
"shellitem was %p.\n", shellitem);
2464 ret = IShellItem_Compare(shellitem, shellitem2, 0, &
order);
2465 ok(
ret ==
S_OK,
"IShellItem_Compare failed: 0x%08x.\n",
ret);
2467 IShellItem_Release(shellitem2);
2469 IShellItem_Release(shellitem);
2475 win_skip(
"No SHCreateItemInKnownFolder or SHGetKnownFolderPath\n");
2478 ILFree(pidl_abstestfile);
2482 IShellFolder_Release(currentfolder);
2483 IShellFolder_Release(desktopfolder);
2494 SIGDN_NORMALDISPLAY, SIGDN_PARENTRELATIVEPARSING,
2495 SIGDN_DESKTOPABSOLUTEPARSING,SIGDN_PARENTRELATIVEEDITING,
2496 SIGDN_DESKTOPABSOLUTEEDITING,
2497 SIGDN_PARENTRELATIVEFORADDRESSBAR,SIGDN_PARENTRELATIVE, -1234};
2499 if(!pSHGetNameFromIDList)
2501 win_skip(
"SHGetNameFromIDList missing.\n");
2506 ok(pSHCreateShellItem !=
NULL,
"SHCreateShellItem missing.\n");
2511 pSHGetNameFromIDList(
NULL, 0,
NULL);
2514 hres = pSHGetNameFromIDList(
NULL, 0, &name_string);
2520 hres = pSHCreateShellItem(
NULL,
NULL, pidl, &shellitem);
2524 WCHAR *nameSI, *nameSH;
2534 hrSI = IShellItem_GetDisplayName(shellitem,
flags[
i], &nameSI);
2535 ok(hrSI ==
S_OK,
"Got 0x%08x\n", hrSI);
2536 hrSH = pSHGetNameFromIDList(pidl,
flags[
i], &nameSH);
2537 ok(hrSH ==
S_OK,
"Got 0x%08x\n", hrSH);
2539 ok(hrSF ==
S_OK,
"Got 0x%08x\n", hrSF);
2542 ok(!
lstrcmpW(nameSI, nameSH),
"Strings differ.\n");
2555 IShellFolder_Release(psf);
2557 hrSI = pSHGetNameFromIDList(pidl, SIGDN_FILESYSPATH, &nameSI);
2558 ok(hrSI ==
S_OK,
"Got 0x%08x\n", hrSI);
2565 hres = pSHGetNameFromIDList(pidl, SIGDN_URL, &name_string);
2569 IShellItem_Release(shellitem);
2576 hres = pSHCreateShellItem(
NULL,
NULL, pidl, &shellitem);
2580 WCHAR *nameSI, *nameSH;
2590 hrSI = IShellItem_GetDisplayName(shellitem,
flags[
i], &nameSI);
2591 ok(hrSI ==
S_OK,
"Got 0x%08x\n", hrSI);
2592 hrSH = pSHGetNameFromIDList(pidl,
flags[
i], &nameSH);
2593 ok(hrSH ==
S_OK,
"Got 0x%08x\n", hrSH);
2595 ok(hrSF ==
S_OK,
"Got 0x%08x\n", hrSF);
2598 ok(!
lstrcmpW(nameSI, nameSH),
"Strings differ.\n");
2611 IShellFolder_Release(psf);
2613 hrSI = pSHGetNameFromIDList(pidl, SIGDN_FILESYSPATH, &nameSI);
2621 hres = pSHGetNameFromIDList(pidl, SIGDN_URL, &name_string);
2623 "Got 0x%08x\n",
hres);
2626 IShellItem_Release(shellitem);
2638 if(!pSHGetItemFromDataObject)
2640 win_skip(
"No SHGetItemFromDataObject.\n");
2647 pSHGetItemFromDataObject(
NULL, 0, &IID_IShellItem,
NULL);
2650 hres = pSHGetItemFromDataObject(
NULL, 0, &IID_IShellItem, (
void**)&psv);
2655 hres = IShellFolder_CreateViewObject(psfdesktop,
NULL, &IID_IShellView, (
void**)&psv);
2663 enum_flags = SHCONTF_NONFOLDERS | SHCONTF_FOLDERS | SHCONTF_INCLUDEHIDDEN;
2664 hres = IShellFolder_EnumObjects(psfdesktop,
NULL, enum_flags, &peidl);
2682 hres = pSHGetItemFromDataObject(pdo, DOGIF_DEFAULT, &IID_IShellItem, (
void**)&psi);
2691 hres = pSHGetItemFromDataObject(pdo,
DOGIF_NO_URL, &IID_IShellItem, (
void**)&psi);
2698 IDataObject_Release(pdo);
2702 skip(
"No file(s) found - skipping single-file test.\n");
2711 hres = pSHGetItemFromDataObject(pdo, DOGIF_DEFAULT, &IID_IShellItem, (
void**)&psi);
2720 hres = pSHGetItemFromDataObject(pdo,
DOGIF_NO_URL, &IID_IShellItem, (
void**)&psi);
2726 IDataObject_Release(pdo);
2730 skip(
"zero or one file found - skipping multi-file test.\n");
2735 IEnumIDList_Release(peidl);
2738 IShellView_Release(psv);
2741 IShellFolder_Release(psfdesktop);
2753 static const WCHAR filesW[][9] = {
2754 {
'a',
'\\',
'a',0}, {
'a',
'\\',
'b',0}, {
'a',
'\\',
'c',0},
2755 {
'b',
'\\',
'a',0}, {
'b',
'\\',
'b',0}, {
'b',
'\\',
'c',0},
2756 {
'c',
'\\',
'a',0}, {
'c',
'\\',
'b',0}, {
'c',
'\\',
'c',0} };
2760 if(!pSHCreateShellItem)
2762 win_skip(
"SHCreateShellItem missing.\n");
2769 skip(
"Failed to get current directory, skipping.\n");
2789 hr = IShellFolder_BindToObject(psf_desktop, pidl_cwd,
NULL, &IID_IShellFolder, (
void**)&psf_current);
2791 IShellFolder_Release(psf_desktop);
2795 memset(&psi, 0,
sizeof(psi));
2797 for(
i = 0;
i < 9;
i++)
2806 hr = pSHCreateShellItem(
NULL,
NULL, pidl_testfile, &psi[
i]);
2814 skip(
"Failed to create all shellitems.\n");
2819 hr = IShellItem_GetParent(psi[0], &psi_a);
2822 hr = IShellItem_GetParent(psi[3], &psi_b);
2825 hr = IShellItem_GetParent(psi[6], &psi_c);
2831 skip(
"Failed to create shellitems.\n");
2838 IShellItem_Compare(psi_a,
NULL, 0,
NULL);
2839 IShellItem_Compare(psi_a, psi_b, 0,
NULL);
2840 IShellItem_Compare(psi_a,
NULL, 0, &
order);
2844 for(
i = 0;
i < 9;
i++)
2846 hr = IShellItem_Compare(psi[
i], psi[
i], SICHINT_DISPLAY, &
order);
2849 hr = IShellItem_Compare(psi[
i], psi[
i], SICHINT_CANONICAL, &
order);
2852 hr = IShellItem_Compare(psi[
i], psi[
i], SICHINT_ALLFIELDS, &
order);
2859 hr = IShellItem_Compare(psi[1], psi[0], SICHINT_DISPLAY, &
order);
2862 hr = IShellItem_Compare(psi[1], psi[2], SICHINT_DISPLAY, &
order);
2865 hr = IShellItem_Compare(psi[1], psi[1], SICHINT_DISPLAY, &
order);
2870 hr = IShellItem_Compare(psi[4], psi[1], SICHINT_DISPLAY, &
order);
2873 hr = IShellItem_Compare(psi[4], psi[7], SICHINT_DISPLAY, &
order);
2876 hr = IShellItem_Compare(psi[4], psi[4], SICHINT_DISPLAY, &
order);
2881 hr = IShellItem_Compare(psi_b, psi[0], SICHINT_DISPLAY, &
order);
2884 hr = IShellItem_Compare(psi_b, psi[2], SICHINT_DISPLAY, &
order);
2887 hr = IShellItem_Compare(psi_b, psi[1], SICHINT_DISPLAY, &
order);
2892 hr = IShellItem_Compare(psi_b, psi[6], SICHINT_DISPLAY, &
order);
2895 hr = IShellItem_Compare(psi_b, psi[8], SICHINT_DISPLAY, &
order);
2898 hr = IShellItem_Compare(psi_b, psi[7], SICHINT_DISPLAY, &
order);
2903 hr = IShellItem_Compare(psi[1], psi[0], SICHINT_CANONICAL, &
order);
2906 hr = IShellItem_Compare(psi[1], psi[2], SICHINT_CANONICAL, &
order);
2909 hr = IShellItem_Compare(psi[1], psi[1], SICHINT_CANONICAL, &
order);
2914 hr = IShellItem_Compare(psi[4], psi[1], SICHINT_CANONICAL, &
order);
2917 hr = IShellItem_Compare(psi[4], psi[7], SICHINT_CANONICAL, &
order);
2920 hr = IShellItem_Compare(psi[4], psi[4], SICHINT_CANONICAL, &
order);
2925 hr = IShellItem_Compare(psi_b, psi[0], SICHINT_CANONICAL, &
order);
2928 hr = IShellItem_Compare(psi_b, psi[2], SICHINT_CANONICAL, &
order);
2931 hr = IShellItem_Compare(psi_b, psi[1], SICHINT_CANONICAL, &
order);
2936 hr = IShellItem_Compare(psi_b, psi[6], SICHINT_CANONICAL, &
order);
2939 hr = IShellItem_Compare(psi_b, psi[8], SICHINT_CANONICAL, &
order);
2942 hr = IShellItem_Compare(psi_b, psi[7], SICHINT_CANONICAL, &
order);
2947 IShellFolder_Release(psf_current);
2962 if(psi_a) IShellItem_Release(psi_a);
2963 if(psi_b) IShellItem_Release(psi_b);
2964 if(psi_c) IShellItem_Release(psi_c);
2966 for(
i = 0;
i < 9;
i++)
2967 if(psi[
i]) IShellItem_Release(psi[
i]);
2995 This->ifaces[
i].count++;
3029 struct if_count ifaces[] =
3030 { {&IID_IPersistIDList, 0},
3031 {&IID_IPersistFolder2, 0},
3033 {&IID_IParentAndItem, 0},
3034 {&IID_IFolderView, 0},
3037 if(!pSHGetIDListFromObject)
3039 win_skip(
"SHGetIDListFromObject missing.\n");
3046 pSHGetIDListFromObject(
NULL,
NULL);
3047 pSHGetIDListFromObject((
void*)0xDEADBEEF,
NULL);
3050 hres = pSHGetIDListFromObject(
NULL, &pidl);
3055 punkimpl->
ifaces = ifaces;
3060 ok(ifaces[0].
count,
"interface not requested.\n");
3061 ok(ifaces[1].
count,
"interface not requested.\n");
3062 ok(ifaces[2].
count,
"interface not requested.\n");
3065 "interface not requested.\n");
3067 "interface not requested.\n");
3072 pidl_desktop =
NULL;
3074 ok(pidl_desktop !=
NULL,
"Failed to get desktop pidl.\n");
3079 if(pSHCreateShellItem)
3082 hres = pSHCreateShellItem(
NULL,
NULL, pidl_desktop, &shellitem);
3086 hres = pSHGetIDListFromObject((
IUnknown*)shellitem, &pidl);
3090 ok(
ILIsEqual(pidl_desktop, pidl),
"pidl not equal.\n");
3093 IShellItem_Release(shellitem);
3097 skip(
"no SHCreateShellItem.\n");
3100 hres = pSHGetIDListFromObject((
IUnknown*)psfdesktop, &pidl);
3104 ok(
ILIsEqual(pidl_desktop, pidl),
"pidl not equal.\n");
3108 hres = IShellFolder_CreateViewObject(psfdesktop,
NULL, &IID_IShellView, (
void**)&psv);
3121 ok(
ILIsEqual(pidl_desktop, pidl),
"pidl not equal.\n");
3126 enum_flags = SHCONTF_NONFOLDERS | SHCONTF_FOLDERS | SHCONTF_INCLUDEHIDDEN;
3127 hres = IShellFolder_EnumObjects(psfdesktop,
NULL, enum_flags, &peidl);
3144 pidl = (
void*)0xDEADBEEF;
3147 ok(pidl !=
NULL,
"pidl is NULL.\n");
3148 ok(
ILIsEqual(pidl, apidl[0]),
"pidl not equal.\n");
3151 IDataObject_Release(pdo);
3155 skip(
"No files found - skipping single-file test.\n");
3164 pidl = (
void*)0xDEADBEEF;
3167 "got 0x%08x\n",
hres);
3168 ok(pidl ==
NULL,
"pidl is not NULL.\n");
3170 IDataObject_Release(pdo);
3174 skip(
"zero or one file found - skipping multi-file test.\n");
3179 IEnumIDList_Release(peidl);
3182 IShellView_Release(psv);
3185 IShellFolder_Release(psfdesktop);
3197 struct if_count ifaces[] =
3198 { {&IID_IPersistIDList, 0},
3199 {&IID_IPersistFolder2, 0},
3201 {&IID_IParentAndItem, 0},
3202 {&IID_IFolderView, 0},
3205 if(!pSHGetItemFromObject)
3207 skip(
"No SHGetItemFromObject.\n");
3218 pSHGetItemFromObject((
IUnknown*)psfdesktop,
NULL, (
void**)&punk);
3226 punkimpl->
ifaces = ifaces;
3232 ok(ifaces[0].
count,
"interface not requested.\n");
3233 ok(ifaces[1].
count,
"interface not requested.\n");
3234 ok(ifaces[2].
count,
"interface not requested.\n");
3237 "interface not requested.\n");
3239 "interface not requested.\n");
3245 hres = pSHGetItemFromObject((
IUnknown*)psfdesktop, &IID_IShellItem, (
void**)&psi);
3250 hres = pSHGetItemFromObject((
IUnknown*)psi, &IID_IShellItem, (
void**)&psi2);
3255 ok(psi == psi2,
"Different instances (%p != %p).\n", psi, psi2);
3256 IShellItem_Release(psi2);
3258 IShellItem_Release(psi);
3261 IShellFolder_Release(psfdesktop);
3267 IShellItemArray *psia;
3272 static const WCHAR testdirW[] = {
't',
'e',
's',
't',
'd',
'i',
'r',0};
3274 if(!pSHCreateShellItemArray) {
3275 skip(
"No pSHCreateShellItemArray!\n");
3284 pSHCreateShellItemArray(
NULL, pdesktopsf, 0,
NULL,
NULL);
3292 hr = pSHCreateShellItemArray(
NULL, pdesktopsf, 0,
NULL, &psia);
3295 hr = pSHCreateShellItemArray(
NULL, pdesktopsf, 1,
NULL, &psia);
3299 hr = pSHCreateShellItemArray(pidl,
NULL, 0,
NULL, &psia);
3313 hr = IShellFolder_BindToObject(pdesktopsf, pidl_testdir,
NULL, (
REFIID)&IID_IShellFolder,
3317 IShellFolder_Release(pdesktopsf);
3321 skip(
"Failed to set up environment for SHCreateShellItemArray tests.\n");
3327 hr = IShellFolder_EnumObjects(psf,
NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, &peidl);
3332 UINT done, numitems,
i;
3334 for(done = 0; done < 5; done++)
3335 if(IEnumIDList_Next(peidl, 1, &apidl[done],
NULL) !=
S_OK)
3337 ok(done == 5,
"Got %d pidls\n", done);
3338 IEnumIDList_Release(peidl);
3350 IShellItemArray_GetCount(psia,
NULL);
3353 IShellItemArray_GetCount(psia, &numitems);
3354 ok(numitems == done,
"Got %d, expected %d\n", numitems, done);
3356 hr = IShellItemArray_GetItemAt(psia, numitems, &psi);
3360 for(
i = 0;
i < numitems;
i++)
3363 pidl_abs =
ILCombine(pidl_testdir, apidl[
i]);
3365 hr = IShellItemArray_GetItemAt(psia,
i, &psi);
3366 ok(
hr ==
S_OK,
"(%d) Failed with 0x%08x\n",
i,
hr);
3369 hr = pSHGetIDListFromObject((
IUnknown*)psi, &pidl);
3373 ok(
ILIsEqual(pidl_abs, pidl),
"Pidl not equal.\n");
3376 IShellItem_Release(psi);