#include "ocidl.h"
#include "oleauto.h"
+#include "wine/heap.h"
#include "wine/test.h"
#include <initguid.h>
static IMalloc *ppM;
-static HRESULT (WINAPI *pSHBindToParent)(LPCITEMIDLIST, REFIID, LPVOID*, LPCITEMIDLIST*);
-static HRESULT (WINAPI *pSHGetFolderPathA)(HWND, int, HANDLE, DWORD, LPSTR);
-static HRESULT (WINAPI *pSHGetFolderPathAndSubDirA)(HWND, int, HANDLE, DWORD, LPCSTR, LPSTR);
-static BOOL (WINAPI *pSHGetPathFromIDListW)(LPCITEMIDLIST,LPWSTR);
-static HRESULT (WINAPI *pSHGetSpecialFolderLocation)(HWND, int, LPITEMIDLIST *);
-static BOOL (WINAPI *pSHGetSpecialFolderPathA)(HWND, LPSTR, int, BOOL);
-static BOOL (WINAPI *pSHGetSpecialFolderPathW)(HWND, LPWSTR, int, BOOL);
-static HRESULT (WINAPI *pStrRetToBufW)(STRRET*,LPCITEMIDLIST,LPWSTR,UINT);
-static LPITEMIDLIST (WINAPI *pILFindLastID)(LPCITEMIDLIST);
-static void (WINAPI *pILFree)(LPITEMIDLIST);
-static BOOL (WINAPI *pILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST);
static HRESULT (WINAPI *pSHCreateItemFromIDList)(PCIDLIST_ABSOLUTE pidl, REFIID riid, void **ppv);
static HRESULT (WINAPI *pSHCreateItemFromParsingName)(PCWSTR,IBindCtx*,REFIID,void**);
+static HRESULT (WINAPI *pSHCreateItemFromRelativeName)(IShellItem*,PCWSTR,IBindCtx*,REFIID,void**);
+static HRESULT (WINAPI *pSHCreateItemInKnownFolder)(REFKNOWNFOLDERID,DWORD,PCWSTR,REFIID,void **);
static HRESULT (WINAPI *pSHCreateShellItem)(LPCITEMIDLIST,IShellFolder*,LPCITEMIDLIST,IShellItem**);
static HRESULT (WINAPI *pSHCreateShellItemArray)(LPCITEMIDLIST,IShellFolder*,UINT,LPCITEMIDLIST*,IShellItemArray**);
static HRESULT (WINAPI *pSHCreateShellItemArrayFromIDLists)(UINT, PCIDLIST_ABSOLUTE*, IShellItemArray**);
static HRESULT (WINAPI *pSHCreateShellItemArrayFromDataObject)(IDataObject*, REFIID, void **);
static HRESULT (WINAPI *pSHCreateShellItemArrayFromShellItem)(IShellItem*, REFIID, void **);
-static LPITEMIDLIST (WINAPI *pILCombine)(LPCITEMIDLIST,LPCITEMIDLIST);
-static HRESULT (WINAPI *pSHParseDisplayName)(LPCWSTR,IBindCtx*,LPITEMIDLIST*,SFGAOF,SFGAOF*);
-static LPITEMIDLIST (WINAPI *pSHSimpleIDListFromPathAW)(LPCVOID);
+static HRESULT (WINAPI *pSHGetKnownFolderPath)(REFKNOWNFOLDERID,DWORD,HANDLE,PWSTR*);
static HRESULT (WINAPI *pSHGetNameFromIDList)(PCIDLIST_ABSOLUTE,SIGDN,PWSTR*);
static HRESULT (WINAPI *pSHGetItemFromDataObject)(IDataObject*,DATAOBJ_GET_ITEM_FLAGS,REFIID,void**);
static HRESULT (WINAPI *pSHGetIDListFromObject)(IUnknown*, PIDLIST_ABSOLUTE*);
static HRESULT (WINAPI *pSHGetItemFromObject)(IUnknown*,REFIID,void**);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
-static UINT (WINAPI *pGetSystemWow64DirectoryW)(LPWSTR, UINT);
static HRESULT (WINAPI *pSHCreateDefaultContextMenu)(const DEFCONTEXTMENU*,REFIID,void**);
-static HRESULT (WINAPI *pSHILCreateFromPath)(LPCWSTR, LPITEMIDLIST *,DWORD*);
static BOOL (WINAPI *pSHGetPathFromIDListEx)(PCIDLIST_ABSOLUTE,WCHAR*,DWORD,GPFIDL_FLAGS);
+#ifdef __REACTOS__
+typedef SHFOLDERCUSTOMSETTINGSW SHFOLDERCUSTOMSETTINGS, *LPSHFOLDERCUSTOMSETTINGS;
+#endif
+static HRESULT (WINAPI *pSHGetSetFolderCustomSettings)(LPSHFOLDERCUSTOMSETTINGS,PCWSTR,DWORD);
static WCHAR *make_wstr(const char *str)
{
if(!len || len < 0)
return NULL;
- ret = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+ ret = heap_alloc(len * sizeof(WCHAR));
if(!ret)
return NULL;
hmod = GetModuleHandleA("shell32.dll");
#define MAKEFUNC(f) (p##f = (void*)GetProcAddress(hmod, #f))
- MAKEFUNC(SHBindToParent);
MAKEFUNC(SHCreateItemFromIDList);
MAKEFUNC(SHCreateItemFromParsingName);
+ MAKEFUNC(SHCreateItemFromRelativeName);
+ MAKEFUNC(SHCreateItemInKnownFolder);
MAKEFUNC(SHCreateShellItem);
MAKEFUNC(SHCreateShellItemArray);
MAKEFUNC(SHCreateShellItemArrayFromIDLists);
MAKEFUNC(SHCreateShellItemArrayFromDataObject);
MAKEFUNC(SHCreateShellItemArrayFromShellItem);
- MAKEFUNC(SHGetFolderPathA);
- MAKEFUNC(SHGetFolderPathAndSubDirA);
- MAKEFUNC(SHGetPathFromIDListW);
- MAKEFUNC(SHGetSpecialFolderPathA);
- MAKEFUNC(SHGetSpecialFolderPathW);
- MAKEFUNC(SHGetSpecialFolderLocation);
- MAKEFUNC(SHParseDisplayName);
+ MAKEFUNC(SHGetKnownFolderPath);
MAKEFUNC(SHGetNameFromIDList);
MAKEFUNC(SHGetItemFromDataObject);
MAKEFUNC(SHGetIDListFromObject);
MAKEFUNC(SHGetItemFromObject);
MAKEFUNC(SHCreateDefaultContextMenu);
MAKEFUNC(SHGetPathFromIDListEx);
+ MAKEFUNC(SHGetSetFolderCustomSettings);
#undef MAKEFUNC
-#define MAKEFUNC_ORD(f, ord) (p##f = (void*)GetProcAddress(hmod, (LPSTR)(ord)))
- MAKEFUNC_ORD(ILFindLastID, 16);
- MAKEFUNC_ORD(ILIsEqual, 21);
- MAKEFUNC_ORD(ILCombine, 25);
- MAKEFUNC_ORD(SHILCreateFromPath, 28);
- MAKEFUNC_ORD(ILFree, 155);
- MAKEFUNC_ORD(SHSimpleIDListFromPathAW, 162);
-#undef MAKEFUNC_ORD
-
/* test named exports */
ptr = GetProcAddress(hmod, "ILFree");
ok(broken(ptr == 0) || ptr != 0, "expected named export for ILFree\n");
#undef TESTNAMED
}
- hmod = GetModuleHandleA("shlwapi.dll");
- pStrRetToBufW = (void*)GetProcAddress(hmod, "StrRetToBufW");
-
hmod = GetModuleHandleA("kernel32.dll");
pIsWow64Process = (void*)GetProcAddress(hmod, "IsWow64Process");
- pGetSystemWow64DirectoryW = (void*)GetProcAddress(hmod, "GetSystemWow64DirectoryW");
hr = SHGetMalloc(&ppM);
ok(hr == S_OK, "SHGetMalloc failed %08x\n", hr);
return lpszPath;
}
+static struct
+{
+ WCHAR path[MAX_PATH];
+ HRESULT hr;
+ int todo;
+} parse_tests[] = {
+ {{'c',':','\\',0}, S_OK},
+ {{'c',':','\\','\\',0}, E_INVALIDARG, 1},
+ {{'c',':','\\','f','a','k','e',0}, 0x80070002}, /* ERROR_FILE_NOT_FOUND */
+ {{'c',':','f','a','k','e',0}, E_INVALIDARG, 1},
+ {{'c',':','/',0}, E_INVALIDARG, 1},
+ {{'c',':','\\','w','i','n','d','o','w','s',0}, S_OK},
+ {{'c',':','\\','w','i','n','d','o','w','s','\\',0}, S_OK},
+ {{'c',':','\\','w','i','n','d','o','w','s','\\','.',0}, E_INVALIDARG, 1},
+ {{'c',':','\\','w','i','n','d','o','w','s','\\','.','.',0}, E_INVALIDARG, 1},
+ {{'.',0}, E_INVALIDARG, 1},
+ {{'.','.',0}, E_INVALIDARG, 1},
+ {{'t','e','s','t',0}, 0x80070002},
+ {{'t','e','s','t','\\',0}, 0x80070002},
+ {{'s','u','b','\\','d','i','r',0}, 0x80070002},
+ {{'s','u','b','/','d','i','r',0}, E_INVALIDARG, 1},
+ {{'h','t','t','p',':',0}, S_OK, 1},
+ {{'h','t','t','p',':','t','e','s','t',0}, S_OK, 1},
+ {{'h','t','t','p',':','\\','t','e','s','t',0}, S_OK, 1},
+ {{'x','x',':',0}, S_OK, 1},
+};
+
static void test_ParseDisplayName(void)
{
+ static WCHAR testdirW[] = {'p','a','r','s','e','t','e','s','t',0};
+ static WCHAR backslashW[] = {'\\',0};
+ WCHAR buffer[MAX_PATH], buffer2[MAX_PATH];
+ IShellFolder *desktop;
+ ITEMIDLIST *pidl;
HRESULT hr;
- IShellFolder *IDesktopFolder;
- static const char *cNonExistDir1A = "c:\\nonexist_subdir";
- static const char *cNonExistDir2A = "c:\\\\nonexist_subdir";
- static const char *cInetTestA = "http:\\yyy";
- static const char *cInetTest2A = "xx:yyy";
- DWORD res;
- WCHAR cTestDirW [MAX_PATH] = {0};
- ITEMIDLIST *newPIDL;
BOOL bRes;
+ int i;
- hr = SHGetDesktopFolder(&IDesktopFolder);
+ hr = SHGetDesktopFolder(&desktop);
ok(hr == S_OK, "Expected SHGetDesktopFolder to return S_OK, got 0x%08x\n", hr);
- if(hr != S_OK) return;
-
- /* Tests crash on W2K and below (SHCreateShellItem available as of XP) */
- if (pSHCreateShellItem)
- {
- if (0)
- {
- /* null name and pidl, also crashes on Windows 8 */
- hr = IShellFolder_ParseDisplayName(IDesktopFolder, NULL, NULL,
- NULL, NULL, NULL, 0);
- ok(hr == E_INVALIDARG, "returned %08x, expected E_INVALIDARG\n", hr);
- }
-
- /* null name */
- newPIDL = (ITEMIDLIST*)0xdeadbeef;
- hr = IShellFolder_ParseDisplayName(IDesktopFolder,
- NULL, NULL, NULL, NULL, &newPIDL, 0);
- ok(newPIDL == 0, "expected null, got %p\n", newPIDL);
- ok(hr == E_INVALIDARG, "returned %08x, expected E_INVALIDARG\n", hr);
- }
- else
- win_skip("Tests would crash on W2K and below\n");
-
- MultiByteToWideChar(CP_ACP, 0, cInetTestA, -1, cTestDirW, MAX_PATH);
- hr = IShellFolder_ParseDisplayName(IDesktopFolder,
- NULL, NULL, cTestDirW, NULL, &newPIDL, 0);
- todo_wine ok(hr == S_OK || broken(hr == E_FAIL) /* NT4 */,
- "ParseDisplayName returned %08x, expected SUCCESS or E_FAIL\n", hr);
- if (hr == S_OK)
- {
- ok(pILFindLastID(newPIDL)->mkid.abID[0] == 0x61, "Last pidl should be of type "
- "PT_IESPECIAL1, but is: %02x\n", pILFindLastID(newPIDL)->mkid.abID[0]);
- IMalloc_Free(ppM, newPIDL);
- }
- MultiByteToWideChar(CP_ACP, 0, cInetTest2A, -1, cTestDirW, MAX_PATH);
- hr = IShellFolder_ParseDisplayName(IDesktopFolder,
- NULL, NULL, cTestDirW, NULL, &newPIDL, 0);
- todo_wine ok(hr == S_OK || broken(hr == E_FAIL) /* NT4 */,
- "ParseDisplayName returned %08x, expected SUCCESS or E_FAIL\n", hr);
- if (hr == S_OK)
- {
- ok(pILFindLastID(newPIDL)->mkid.abID[0] == 0x61, "Last pidl should be of type "
- "PT_IESPECIAL1, but is: %02x\n", pILFindLastID(newPIDL)->mkid.abID[0]);
- IMalloc_Free(ppM, newPIDL);
- }
+ hr = IShellFolder_ParseDisplayName(desktop, NULL, NULL, NULL, NULL, &pidl, NULL);
+ ok(hr == E_INVALIDARG, "got %#x\n", hr);
- res = GetFileAttributesA(cNonExistDir1A);
- if(res != INVALID_FILE_ATTRIBUTES)
+ for (i = 0; i < ARRAY_SIZE(parse_tests); i++)
{
- skip("Test directory unexpectedly exists\n");
- goto finished;
+ hr = IShellFolder_ParseDisplayName(desktop, NULL, NULL, parse_tests[i].path, NULL, &pidl, NULL);
+todo_wine_if(parse_tests[i].todo)
+ ok(hr == parse_tests[i].hr, "%s: expected %#x, got %#x\n",
+ wine_dbgstr_w(parse_tests[i].path), parse_tests[i].hr, hr);
+ if (SUCCEEDED(hr))
+ CoTaskMemFree(pidl);
}
- MultiByteToWideChar(CP_ACP, 0, cNonExistDir1A, -1, cTestDirW, MAX_PATH);
- hr = IShellFolder_ParseDisplayName(IDesktopFolder,
- NULL, NULL, cTestDirW, NULL, &newPIDL, 0);
- ok((hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) || (hr == E_FAIL),
- "ParseDisplayName returned %08x, expected 80070002 or E_FAIL\n", hr);
-
- res = GetFileAttributesA(cNonExistDir2A);
- if(res != INVALID_FILE_ATTRIBUTES)
- {
- skip("Test directory unexpectedly exists\n");
- goto finished;
- }
-
- MultiByteToWideChar(CP_ACP, 0, cNonExistDir2A, -1, cTestDirW, MAX_PATH);
- hr = IShellFolder_ParseDisplayName(IDesktopFolder,
- NULL, NULL, cTestDirW, NULL, &newPIDL, 0);
- ok((hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) || (hr == E_FAIL) || (hr == E_INVALIDARG),
- "ParseDisplayName returned %08x, expected 80070002, E_FAIL or E_INVALIDARG\n", hr);
-
/* I thought that perhaps the DesktopFolder's ParseDisplayName would recognize the
* path corresponding to CSIDL_PERSONAL and return a CLSID_MyDocuments PIDL. Turns
* out it doesn't. The magic seems to happen in the file dialogs, then. */
- if (!pSHGetSpecialFolderPathW || !pILFindLastID)
- {
- win_skip("SHGetSpecialFolderPathW and/or ILFindLastID are not available\n");
- goto finished;
- }
- bRes = pSHGetSpecialFolderPathW(NULL, cTestDirW, CSIDL_PERSONAL, FALSE);
+ bRes = SHGetSpecialFolderPathW(NULL, buffer, CSIDL_PERSONAL, FALSE);
ok(bRes, "SHGetSpecialFolderPath(CSIDL_PERSONAL) failed! %u\n", GetLastError());
- if (!bRes) goto finished;
- hr = IShellFolder_ParseDisplayName(IDesktopFolder, NULL, NULL, cTestDirW, NULL, &newPIDL, 0);
+ hr = IShellFolder_ParseDisplayName(desktop, NULL, NULL, buffer, NULL, &pidl, 0);
ok(hr == S_OK, "DesktopFolder->ParseDisplayName failed. hr = %08x.\n", hr);
- if (hr != S_OK) goto finished;
- ok(pILFindLastID(newPIDL)->mkid.abID[0] == 0x31 ||
- pILFindLastID(newPIDL)->mkid.abID[0] == 0xb1, /* Win98 */
- "Last pidl should be of type PT_FOLDER or PT_IESPECIAL2, but is: %02x\n",
- pILFindLastID(newPIDL)->mkid.abID[0]);
- IMalloc_Free(ppM, newPIDL);
-
-finished:
- IShellFolder_Release(IDesktopFolder);
+ ok(ILFindLastID(pidl)->mkid.abID[0] == 0x31,
+ "Last pidl should be of type PT_FOLDER, but is: %02x\n",
+ ILFindLastID(pidl)->mkid.abID[0]);
+ CoTaskMemFree(pidl);
+
+ /* Relative paths are interpreted relative to the desktop. */
+ GetTempPathW(ARRAY_SIZE(buffer), buffer);
+ GetLongPathNameW(buffer, buffer, ARRAY_SIZE(buffer));
+ SetCurrentDirectoryW(buffer);
+ CreateDirectoryW(testdirW, NULL);
+
+ hr = IShellFolder_ParseDisplayName(desktop, NULL, NULL, testdirW, NULL, &pidl, NULL);
+ ok(hr == 0x80070002, "got %#x\n", hr);
+
+ RemoveDirectoryW(testdirW);
+
+ hr = SHGetSpecialFolderPathW(NULL, buffer, CSIDL_DESKTOP, FALSE);
+ ok(hr == S_FALSE, "got %#x\n", hr);
+ SetCurrentDirectoryW(buffer);
+ CreateDirectoryW(testdirW, NULL);
+
+ hr = IShellFolder_ParseDisplayName(desktop, NULL, NULL, testdirW, NULL, &pidl, NULL);
+ ok(hr == S_OK, "got %#x\n", hr);
+
+ ok(SHGetPathFromIDListW(pidl, buffer2), "SHGetPathFromIDList failed\n");
+ lstrcatW(buffer, backslashW);
+ lstrcatW(buffer, testdirW);
+ ok(!lstrcmpW(buffer, buffer2), "expected %s, got %s\n", wine_dbgstr_w(buffer), wine_dbgstr_w(buffer2));
+
+ RemoveDirectoryW(testdirW);
+ CoTaskMemFree(pidl);
+
+ IShellFolder_Release(desktop);
}
/* creates a file with the specified name for tests */
flags &= SFGAO_testfor;
ok(hr == S_OK, "GetAttributesOf returns %08x\n", hr);
ok(flags == (attrs[i]) ||
- flags == (attrs[i] & ~SFGAO_FILESYSANCESTOR) || /* Win9x, NT4 */
flags == ((attrs[i] & ~SFGAO_CAPABILITYMASK) | SFGAO_VISTA), /* Vista and higher */
"GetAttributesOf[%i] got %08x, expected %08x\n", i, flags, attrs[i]);
hr = IShellFolder_GetAttributesOf(iFolder, 1, (LPCITEMIDLIST*)(idlArr + i), &flags);
flags &= SFGAO_testfor;
ok(hr == S_OK, "GetAttributesOf returns %08x\n", hr);
- ok(flags == attrs[i] ||
- flags == (attrs[i] & ~SFGAO_FILESYSANCESTOR), /* Win9x, NT4 */
- "GetAttributesOf[%i] got %08x, expected %08x\n", i, flags, attrs[i]);
+ ok(flags == attrs[i], "GetAttributesOf[%i] got %08x, expected %08x\n", i, flags, attrs[i]);
flags = ~0u;
hr = IShellFolder_GetAttributesOf(iFolder, 1, (LPCITEMIDLIST*)(idlArr + i), &flags);
hr = IShellFolder_BindToObject(psfMyComputer, pidlEmpty, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
ok (hr == E_INVALIDARG, "MyComputers's BindToObject should fail, when called with empty pidl! hr = %08x\n", hr);
-if (0)
-{
- /* this call segfaults on 98SE */
hr = IShellFolder_BindToObject(psfMyComputer, NULL, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
ok (hr == E_INVALIDARG, "MyComputers's BindToObject should fail, when called with NULL pidl! hr = %08x\n", hr);
-}
cChars = GetSystemDirectoryA(szSystemDir, MAX_PATH);
ok (cChars > 0 && cChars < MAX_PATH, "GetSystemDirectoryA failed! LastError: %u\n", GetLastError());
ok (hr == E_INVALIDARG,
"FileSystem ShellFolder's BindToObject should fail, when called with empty pidl! hr = %08x\n", hr);
-if (0)
-{
- /* this call segfaults on 98SE */
hr = IShellFolder_BindToObject(psfSystemDir, NULL, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
ok (hr == E_INVALIDARG,
"FileSystem ShellFolder's BindToObject should fail, when called with NULL pidl! hr = %08x\n", hr);
-}
IShellFolder_Release(psfSystemDir);
{
IPersist *pp;
hr = IShellFolder_QueryInterface(psfChild, &IID_IPersist, (void**)&pp);
- ok(hr == S_OK ||
- broken(hr == E_NOINTERFACE), /* Win9x, NT4, W2K */
- "Got 0x%08x\n", hr);
+ ok(hr == S_OK, "Got 0x%08x\n", hr);
if(SUCCEEDED(hr))
{
CLSID id;
hr = IPersist_GetClassID(pp, &id);
ok(hr == S_OK, "Got 0x%08x\n", hr);
- /* CLSID_ShellFSFolder on some w2k systems */
- ok(IsEqualIID(&id, &CLSID_ShellDocObjView) || broken(IsEqualIID(&id, &CLSID_ShellFSFolder)),
- "Unexpected classid %s\n", wine_dbgstr_guid(&id));
+ ok(IsEqualIID(&id, &CLSID_ShellDocObjView), "Unexpected classid %s\n", wine_dbgstr_guid(&id));
IPersist_Release(pp);
}
IShellFolder_Release(psfChild);
}
- pILFree(pidl);
+ ILFree(pidl);
}
DeleteFileA(pathA);
}
{
hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild);
ok(hr == E_FAIL || /* Vista+ */
- hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || /* XP, W2K3 */
- hr == E_INVALIDARG || /* W2K item in top dir */
- broken(hr == S_OK), /* Win9x, NT4, W2K */
+ hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP, W2K3 */
"Got 0x%08x\n", hr);
if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
- pILFree(pidl);
+ ILFree(pidl);
}
DeleteFileA(pathA);
}
{
hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild);
ok(hr == E_FAIL || /* Vista+ */
- hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || /* XP, W2K3 */
- hr == E_INVALIDARG || /* W2K item in top dir */
- broken(hr == S_OK), /* Win9x, NT4, W2K */
+ hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP, W2K3 */
"Got 0x%08x\n", hr);
if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
- pILFree(pidl);
+ ILFree(pidl);
}
DeleteFileA(pathA);
}
win_skip("Failed to create .foo testfile.\n");
/* And on the desktop */
- if(pSHGetSpecialFolderPathA)
- {
- pSHGetSpecialFolderPathA(NULL, pathA, CSIDL_DESKTOP, FALSE);
- lstrcatA(pathA, "\\");
- lstrcatA(pathA, filename_html);
- hfile = CreateFileA(pathA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
- if(hfile != INVALID_HANDLE_VALUE)
- {
- CloseHandle(hfile);
- MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH);
- hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL);
- ok(hr == S_OK, "Got 0x%08x\n", hr);
- if(SUCCEEDED(hr))
- {
- hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild);
- ok(hr == S_OK ||
- hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP, W2K3 */
- "Got 0x%08x\n", hr);
- if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
- pILFree(pidl);
- }
- if(!DeleteFileA(pathA))
- trace("Failed to delete: %d\n", GetLastError());
+ SHGetSpecialFolderPathA(NULL, pathA, CSIDL_DESKTOP, FALSE);
+ lstrcatA(pathA, "\\");
+ lstrcatA(pathA, filename_html);
+ hfile = CreateFileA(pathA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
- }
- else
- win_skip("Failed to create .html testfile.\n");
+ CloseHandle(hfile);
+ MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH);
+ hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL);
+ ok(hr == S_OK, "Got 0x%08x\n", hr);
- pSHGetSpecialFolderPathA(NULL, pathA, CSIDL_DESKTOP, FALSE);
- lstrcatA(pathA, "\\");
- lstrcatA(pathA, filename_foo);
- hfile = CreateFileA(pathA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
- if(hfile != INVALID_HANDLE_VALUE)
- {
- CloseHandle(hfile);
- MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH);
- hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL);
- ok(hr == S_OK, "Got 0x%08x\n", hr);
- if(SUCCEEDED(hr))
- {
- hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild);
- ok(hr == E_FAIL || /* Vista+ */
- hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || /* XP, W2K3 */
- broken(hr == S_OK), /* Win9x, NT4, W2K */
- "Got 0x%08x\n", hr);
- if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
- pILFree(pidl);
- }
- DeleteFileA(pathA);
- }
- else
- win_skip("Failed to create .foo testfile.\n");
- }
+ hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void **)&psfChild);
+ ok(hr == S_OK ||
+ hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP, W2K3 */
+ "Got 0x%08x\n", hr);
+ if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
+ ILFree(pidl);
+ if(!DeleteFileA(pathA))
+ trace("Failed to delete: %d\n", GetLastError());
+
+ SHGetSpecialFolderPathA(NULL, pathA, CSIDL_DESKTOP, FALSE);
+ lstrcatA(pathA, "\\");
+ lstrcatA(pathA, filename_foo);
+ hfile = CreateFileA(pathA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
+
+ CloseHandle(hfile);
+ MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH);
+ hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL);
+ ok(hr == S_OK, "Got 0x%08x\n", hr);
+
+ hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void **)&psfChild);
+ ok(hr == E_FAIL || /* Vista+ */
+ hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP, W2K3 */
+ "Got 0x%08x\n", hr);
+ if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
+ ILFree(pidl);
+ DeleteFileA(pathA);
IShellFolder_Release(psfDesktop);
}
static const WCHAR wszFileName[] = { 'w','i','n','e','t','e','s','t','.','f','o','o',0 };
static const WCHAR wszDirName[] = { 'w','i','n','e','t','e','s','t',0 };
+ /* It's ok to use this fixed path. Call will fail anyway. */
+ WCHAR wszAbsoluteFilename[] = { 'C',':','\\','w','i','n','e','t','e','s','t', 0 };
+ LPITEMIDLIST pidlNew;
+
/* I'm trying to figure if there is a functional difference between calling
* SHGetPathFromIDListW and calling GetDisplayNameOf(SHGDN_FORPARSING) after
* binding to the shellfolder. One thing I thought of was that perhaps
* no functional difference in this respect.
*/
- if(!pSHGetSpecialFolderPathA) {
- win_skip("SHGetSpecialFolderPathA is not available\n");
- return;
- }
-
/* First creating a directory in MyDocuments and a file in this directory. */
- result = pSHGetSpecialFolderPathA(NULL, szTestDir, CSIDL_PERSONAL, FALSE);
+ result = SHGetSpecialFolderPathA(NULL, szTestDir, CSIDL_PERSONAL, FALSE);
ok(result, "SHGetSpecialFolderPathA failed! Last error: %u\n", GetLastError());
if (!result) return;
return;
}
- pidlLast = pILFindLastID(pidlTestFile);
- ok(pidlLast->mkid.cb >=76 ||
- broken(pidlLast->mkid.cb == 28) || /* W2K */
- broken(pidlLast->mkid.cb == 40), /* Win9x, WinME */
- "Expected pidl length of at least 76, got %d.\n", pidlLast->mkid.cb);
+ pidlLast = ILFindLastID(pidlTestFile);
+ ok(pidlLast->mkid.cb >= 76, "Expected pidl length of at least 76, got %d.\n", pidlLast->mkid.cb);
if (pidlLast->mkid.cb >= 28) {
ok(!lstrcmpA((CHAR*)&pidlLast->mkid.abID[12], szFileName),
"Filename should be stored as ansi-string at this position!\n");
*/
hr = IShellFolder_BindToObject(psfDesktop, pidlTestFile, NULL, &IID_IUnknown, (VOID**)&psfFile);
ok (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
- hr == E_NOTIMPL || /* Vista */
- broken(hr == S_OK), /* Win9x, W2K */
+ hr == E_NOTIMPL, /* Vista */
"hr = %08x\n", hr);
if (hr == S_OK) {
IUnknown_Release(psfFile);
}
- if (!pSHBindToParent)
- {
- win_skip("SHBindToParent is missing\n");
- DeleteFileA(szTestFile);
- RemoveDirectoryA(szTestDir);
- return;
- }
-
/* Some tests for IShellFolder::SetNameOf */
- if (pSHGetFolderPathAndSubDirA)
- {
- hr = pSHBindToParent(pidlTestFile, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast);
- ok(hr == S_OK, "SHBindToParent failed! hr = %08x\n", hr);
- if (hr == S_OK) {
- /* It's ok to use this fixed path. Call will fail anyway. */
- WCHAR wszAbsoluteFilename[] = { 'C',':','\\','w','i','n','e','t','e','s','t', 0 };
- LPITEMIDLIST pidlNew;
-
- /* The pidl returned through the last parameter of SetNameOf is a simple one. */
- hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlLast, wszDirName, SHGDN_NORMAL, &pidlNew);
- ok (hr == S_OK, "SetNameOf failed! hr = %08x\n", hr);
- if (hr == S_OK)
- {
- ok (((LPITEMIDLIST)((LPBYTE)pidlNew+pidlNew->mkid.cb))->mkid.cb == 0,
- "pidl returned from SetNameOf should be simple!\n");
+ hr = SHBindToParent(pidlTestFile, &IID_IShellFolder, (void **)&psfPersonal, &pidlLast);
+ ok(hr == S_OK, "SHBindToParent failed! hr = %08x\n", hr);
- /* Passing an absolute path to SetNameOf fails. The HRESULT code indicates that SetNameOf
- * is implemented on top of SHFileOperation in WinXP. */
- hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszAbsoluteFilename,
- SHGDN_FORPARSING, NULL);
- ok (hr == HRESULT_FROM_WIN32(ERROR_CANCELLED), "SetNameOf succeeded! hr = %08x\n", hr);
+ /* The pidl returned through the last parameter of SetNameOf is a simple one. */
+ hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlLast, wszDirName, SHGDN_NORMAL, &pidlNew);
+ ok (hr == S_OK, "SetNameOf failed! hr = %08x\n", hr);
- /* Rename the file back to its original name. SetNameOf ignores the fact, that the
- * SHGDN flags specify an absolute path. */
- hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszFileName, SHGDN_FORPARSING, NULL);
- ok (hr == S_OK, "SetNameOf failed! hr = %08x\n", hr);
+ ok (((ITEMIDLIST *)((BYTE *)pidlNew + pidlNew->mkid.cb))->mkid.cb == 0,
+ "pidl returned from SetNameOf should be simple!\n");
- pILFree(pidlNew);
- }
+ /* Passing an absolute path to SetNameOf fails. The HRESULT code indicates that SetNameOf
+ * is implemented on top of SHFileOperation in WinXP. */
+ hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszAbsoluteFilename, SHGDN_FORPARSING, NULL);
+ ok (hr == HRESULT_FROM_WIN32(ERROR_CANCELLED), "SetNameOf succeeded! hr = %08x\n", hr);
- IShellFolder_Release(psfPersonal);
- }
- }
- else
- win_skip("Avoid needs of interaction on Win2k\n");
+ /* Rename the file back to its original name. SetNameOf ignores the fact, that the
+ * SHGDN flags specify an absolute path. */
+ hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszFileName, SHGDN_FORPARSING, NULL);
+ ok (hr == S_OK, "SetNameOf failed! hr = %08x\n", hr);
+
+ ILFree(pidlNew);
+ IShellFolder_Release(psfPersonal);
/* Deleting the file and the directory */
DeleteFileA(szTestFile);
RemoveDirectoryA(szTestDir);
/* SHGetPathFromIDListW still works, although the file is not present anymore. */
- if (pSHGetPathFromIDListW)
- {
- result = pSHGetPathFromIDListW(pidlTestFile, wszTestFile2);
- ok (result, "SHGetPathFromIDListW failed! Last error: %u\n", GetLastError());
- ok (!lstrcmpiW(wszTestFile, wszTestFile2), "SHGetPathFromIDListW returns incorrect path!\n");
- }
+ result = SHGetPathFromIDListW(pidlTestFile, wszTestFile2);
+ ok (result, "SHGetPathFromIDListW failed! Last error: %u\n", GetLastError());
+ ok (!lstrcmpiW(wszTestFile, wszTestFile2), "SHGetPathFromIDListW returns incorrect path!\n");
/* SHBindToParent fails, if called with a NULL PIDL. */
- hr = pSHBindToParent(NULL, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast);
- ok (hr != S_OK, "SHBindToParent(NULL) should fail!\n");
+ hr = SHBindToParent(NULL, &IID_IShellFolder, (void **)&psfPersonal, &pidlLast);
+ ok (hr == E_INVALIDARG || broken(hr == E_OUTOFMEMORY) /* XP */,
+ "SHBindToParent(NULL) should fail! hr = %08x\n", hr);
/* But it succeeds with an empty PIDL. */
- hr = pSHBindToParent(pidlEmpty, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast);
+ hr = SHBindToParent(pidlEmpty, &IID_IShellFolder, (void **)&psfPersonal, &pidlLast);
ok (hr == S_OK, "SHBindToParent(empty PIDL) should succeed! hr = %08x\n", hr);
ok (pidlLast == pidlEmpty, "The last element of an empty PIDL should be the PIDL itself!\n");
if (hr == S_OK)
IShellFolder_Release(psfPersonal);
-
+
/* Binding to the folder and querying the display name of the file also works. */
- hr = pSHBindToParent(pidlTestFile, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast);
+ hr = SHBindToParent(pidlTestFile, &IID_IShellFolder, (void **)&psfPersonal, &pidlLast);
ok (hr == S_OK, "SHBindToParent failed! hr = %08x\n", hr);
if (hr != S_OK) {
IShellFolder_Release(psfDesktop);
return;
}
- /* This test shows that Windows doesn't allocate a new pidlLast, but returns a pointer into
+ /* This test shows that Windows doesn't allocate a new pidlLast, but returns a pointer into
* pidlTestFile (In accordance with MSDN). */
- ok (pILFindLastID(pidlTestFile) == pidlLast,
+ ok (ILFindLastID(pidlTestFile) == pidlLast,
"SHBindToParent doesn't return the last id of the pidl param!\n");
-
+
hr = IShellFolder_GetDisplayNameOf(psfPersonal, pidlLast, SHGDN_FORPARSING, &strret);
ok (hr == S_OK, "Personal->GetDisplayNameOf failed! hr = %08x\n", hr);
if (hr != S_OK) {
return;
}
- if (pStrRetToBufW)
- {
- hr = pStrRetToBufW(&strret, pidlLast, wszTestFile2, MAX_PATH);
- ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
- ok (!lstrcmpiW(wszTestFile, wszTestFile2), "GetDisplayNameOf returns incorrect path!\n");
- }
-
+ hr = StrRetToBufW(&strret, pidlLast, wszTestFile2, MAX_PATH);
+ ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
+ ok (!lstrcmpiW(wszTestFile, wszTestFile2), "GetDisplayNameOf returns incorrect path!\n");
+
ILFree(pidlTestFile);
IShellFolder_Release(psfDesktop);
IShellFolder_Release(psfPersonal);
hr = SHGetDesktopFolder(&psfDesktop);
ok (hr == S_OK, "SHGetDesktopFolder failed! hr = %08x\n", hr);
if (hr != S_OK) return;
-
- hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszMyDocuments, NULL,
+
+ hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszMyDocuments, NULL,
&pidlMyDocuments, NULL);
- ok (hr == S_OK ||
- broken(hr == E_INVALIDARG), /* Win95, NT4 */
+ ok (hr == S_OK,
"Desktop's ParseDisplayName failed to parse MyDocuments's CLSID! hr = %08x\n", hr);
if (hr != S_OK) {
IShellFolder_Release(psfDesktop);
LPCITEMIDLIST pidlEmpty = (LPCITEMIDLIST)&emptyitem;
LPITEMIDLIST pidlMyComputer;
DWORD dwFlags;
- static const DWORD desktopFlags[] = {
- /* WinXP */
- SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR | SFGAO_FILESYSANCESTOR |
- SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER,
- /* Win2k */
- SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_STREAM | SFGAO_FILESYSANCESTOR |
- SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER,
- /* WinMe, Win9x, WinNT*/
- SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_FILESYSANCESTOR |
- SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER
- };
- static const DWORD myComputerFlags[] = {
- /* WinXP */
- SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET |
- SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER,
- /* Win2k */
- SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | SFGAO_STREAM |
- SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER,
- /* WinMe, Win9x, WinNT */
- SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | SFGAO_FILESYSANCESTOR |
- SFGAO_FOLDER | SFGAO_HASSUBFOLDER,
- /* Win95, WinNT when queried directly */
- SFGAO_CANLINK | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | SFGAO_FILESYSANCESTOR |
- SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER
- };
- WCHAR wszMyComputer[] = {
+ static const DWORD desktopFlags = SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR |
+ SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER;
+ static const DWORD myComputerFlags = SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET |
+ SFGAO_DROPTARGET | SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
+ WCHAR wszMyComputer[] = {
':',':','{','2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-',
'A','2','D','8','-','0','8','0','0','2','B','3','0','3','0','9','D','}',0 };
char cCurrDirA [MAX_PATH] = {0};
static WCHAR cTestDirW[] = {'t','e','s','t','d','i','r',0};
IShellFolder *IDesktopFolder, *testIShellFolder;
ITEMIDLIST *newPIDL;
- int len, i;
- BOOL foundFlagsMatch;
+ int len;
hr = SHGetDesktopFolder(&psfDesktop);
ok (hr == S_OK, "SHGetDesktopFolder failed! hr = %08x\n", hr);
dwFlags = 0xffffffff;
hr = IShellFolder_GetAttributesOf(psfDesktop, 1, &pidlEmpty, &dwFlags);
ok (hr == S_OK, "Desktop->GetAttributesOf(empty pidl) failed! hr = %08x\n", hr);
- for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch &&
- i < sizeof(desktopFlags) / sizeof(desktopFlags[0]); i++)
- {
- if (desktopFlags[i] == dwFlags)
- foundFlagsMatch = TRUE;
- }
- ok (foundFlagsMatch, "Wrong Desktop attributes: %08x\n", dwFlags);
+ ok (dwFlags == desktopFlags, "Wrong Desktop attributes: %08x\n", dwFlags);
/* .. or with no itemidlist at all. */
dwFlags = 0xffffffff;
hr = IShellFolder_GetAttributesOf(psfDesktop, 0, NULL, &dwFlags);
ok (hr == S_OK, "Desktop->GetAttributesOf(NULL) failed! hr = %08x\n", hr);
- for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch &&
- i < sizeof(desktopFlags) / sizeof(desktopFlags[0]); i++)
- {
- if (desktopFlags[i] == dwFlags)
- foundFlagsMatch = TRUE;
- }
- ok (foundFlagsMatch, "Wrong Desktop attributes: %08x\n", dwFlags);
-
+ ok (dwFlags == desktopFlags, "Wrong Desktop attributes: %08x\n", dwFlags);
+
/* Testing the attributes of the MyComputer shellfolder */
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszMyComputer, NULL, &pidlMyComputer, NULL);
ok (hr == S_OK, "Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08x\n", hr);
dwFlags = 0xffffffff;
hr = IShellFolder_GetAttributesOf(psfDesktop, 1, (LPCITEMIDLIST*)&pidlMyComputer, &dwFlags);
ok (hr == S_OK, "Desktop->GetAttributesOf(MyComputer) failed! hr = %08x\n", hr);
- for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch &&
- i < sizeof(myComputerFlags) / sizeof(myComputerFlags[0]); i++)
- {
- if ((myComputerFlags[i] | SFGAO_CANLINK) == dwFlags)
- foundFlagsMatch = TRUE;
- }
todo_wine
- ok (foundFlagsMatch, "Wrong MyComputer attributes: %08x\n", dwFlags);
+ ok (dwFlags == (myComputerFlags | SFGAO_CANLINK), "Wrong MyComputer attributes: %08x\n", dwFlags);
hr = IShellFolder_BindToObject(psfDesktop, pidlMyComputer, NULL, &IID_IShellFolder, (LPVOID*)&psfMyComputer);
ok (hr == S_OK, "Desktop failed to bind to MyComputer object! hr = %08x\n", hr);
hr = IShellFolder_GetAttributesOf(psfMyComputer, 1, &pidlEmpty, &dwFlags);
todo_wine
- ok (hr == E_INVALIDARG ||
- broken(hr == S_OK), /* W2K and earlier */
- "MyComputer->GetAttributesOf(empty pidl) should fail! hr = %08x\n", hr);
+ ok (hr == E_INVALIDARG, "MyComputer->GetAttributesOf(empty pidl) should fail! hr = %08x\n", hr);
dwFlags = 0xffffffff;
hr = IShellFolder_GetAttributesOf(psfMyComputer, 0, NULL, &dwFlags);
ok (hr == S_OK, "MyComputer->GetAttributesOf(NULL) failed! hr = %08x\n", hr);
- for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch &&
- i < sizeof(myComputerFlags) / sizeof(myComputerFlags[0]); i++)
- {
- if (myComputerFlags[i] == dwFlags)
- foundFlagsMatch = TRUE;
- }
todo_wine
- ok (foundFlagsMatch, "Wrong MyComputer attributes: %08x\n", dwFlags);
+ ok (dwFlags == myComputerFlags, "Wrong MyComputer attributes: %08x\n", dwFlags);
IShellFolder_Release(psfMyComputer);
'w','i','n','e','t','e','s','t','.','f','o','o',0 };
LPITEMIDLIST pidlPrograms;
- if(!pSHGetPathFromIDListW || !pSHGetSpecialFolderPathW)
- {
- win_skip("SHGetPathFromIDListW() or SHGetSpecialFolderPathW() is missing\n");
- return;
- }
-
/* Calling SHGetPathFromIDListW with no pidl should return the empty string */
wszPath[0] = 'a';
wszPath[1] = '\0';
- result = pSHGetPathFromIDListW(NULL, wszPath);
+ result = SHGetPathFromIDListW(NULL, wszPath);
ok(!result, "Expected failure\n");
ok(!wszPath[0], "Expected empty string\n");
/* Calling SHGetPathFromIDListW with an empty pidl should return the desktop folder's path. */
- result = pSHGetSpecialFolderPathW(NULL, wszDesktop, CSIDL_DESKTOP, FALSE);
+ result = SHGetSpecialFolderPathW(NULL, wszDesktop, CSIDL_DESKTOP, FALSE);
ok(result, "SHGetSpecialFolderPathW(CSIDL_DESKTOP) failed! Last error: %u\n", GetLastError());
if (!result) return;
- /* Check if we are on Win9x */
- SetLastError(0xdeadbeef);
- lstrcmpiW(wszDesktop, wszDesktop);
- if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
- {
- win_skip("Most W-calls are not implemented\n");
- return;
- }
-
- result = pSHGetPathFromIDListW(pidlEmpty, wszPath);
+ result = SHGetPathFromIDListW(pidlEmpty, wszPath);
ok(result, "SHGetPathFromIDListW failed! Last error: %u\n", GetLastError());
if (!result) return;
ok(!lstrcmpiW(wszDesktop, wszPath), "SHGetPathFromIDListW didn't return desktop path for empty pidl!\n");
SetLastError(0xdeadbeef);
wszPath[0] = 'a';
wszPath[1] = '\0';
- result = pSHGetPathFromIDListW(pidlMyComputer, wszPath);
+ result = SHGetPathFromIDListW(pidlMyComputer, wszPath);
ok (!result, "SHGetPathFromIDListW succeeded where it shouldn't!\n");
ok (GetLastError()==0xdeadbeef ||
GetLastError()==ERROR_SUCCESS, /* Vista and higher */
IMalloc_Free(ppM, pidlMyComputer);
- result = pSHGetSpecialFolderPathW(NULL, wszFileName, CSIDL_DESKTOPDIRECTORY, FALSE);
+ result = SHGetSpecialFolderPathW(NULL, wszFileName, CSIDL_DESKTOPDIRECTORY, FALSE);
ok(result, "SHGetSpecialFolderPathW failed! Last error: %u\n", GetLastError());
if (!result) {
IShellFolder_Release(psfDesktop);
IMalloc_Free(ppM, pidlTestFile);
return;
}
- if (pStrRetToBufW)
- {
- pStrRetToBufW(&strret, pidlTestFile, wszPath, MAX_PATH);
- ok(0 == lstrcmpW(wszFileName, wszPath),
- "Desktop->GetDisplayNameOf(pidlTestFile, SHGDN_FORPARSING) "
- "returned incorrect path for file placed on desktop\n");
- }
+ StrRetToBufW(&strret, pidlTestFile, wszPath, MAX_PATH);
+ ok(0 == lstrcmpW(wszFileName, wszPath),
+ "Desktop->GetDisplayNameOf(pidlTestFile, SHGDN_FORPARSING) "
+ "returned incorrect path for file placed on desktop\n");
- result = pSHGetPathFromIDListW(pidlTestFile, wszPath);
+ result = SHGetPathFromIDListW(pidlTestFile, wszPath);
ok(result, "SHGetPathFromIDListW failed! Last error: %u\n", GetLastError());
ok(0 == lstrcmpW(wszFileName, wszPath), "SHGetPathFromIDListW returned incorrect path for file placed on desktop\n");
IMalloc_Free(ppM, pidlTestFile);
/* Test if we can get the path from the start menu "program files" PIDL. */
- hr = pSHGetSpecialFolderLocation(NULL, CSIDL_PROGRAM_FILES, &pidlPrograms);
+ hr = SHGetSpecialFolderLocation(NULL, CSIDL_PROGRAM_FILES, &pidlPrograms);
ok(hr == S_OK, "SHGetFolderLocation failed: 0x%08x\n", hr);
SetLastError(0xdeadbeef);
- result = pSHGetPathFromIDListW(pidlPrograms, wszPath);
+ result = SHGetPathFromIDListW(pidlPrograms, wszPath);
IMalloc_Free(ppM, pidlPrograms);
ok(result, "SHGetPathFromIDListW failed\n");
}
'T','a','r','g','e','t','K','n','o','w','n','F','o','l','d','e','r',0 };
static const WCHAR wszCLSID[] = {
'C','L','S','I','D',0 };
-
+
if (!lstrcmpW(pszPropName, wszTargetSpecialFolder)) {
- ok(V_VT(pVar) == VT_I4 ||
- broken(V_VT(pVar) == VT_BSTR), /* Win2k */
- "Wrong variant type for 'TargetSpecialFolder' property!\n");
+ ok(V_VT(pVar) == VT_I4, "Wrong variant type for 'TargetSpecialFolder' property!\n");
return E_INVALIDARG;
}
if (!lstrcmpW(pszPropName, wszTarget)) {
WCHAR wszPath[MAX_PATH];
BOOL result;
-
- ok(V_VT(pVar) == VT_BSTR ||
- broken(V_VT(pVar) == VT_EMPTY), /* Win2k */
- "Wrong variant type for 'Target' property!\n");
+
+ ok(V_VT(pVar) == VT_BSTR, "Wrong variant type for 'Target' property!\n");
if (V_VT(pVar) != VT_BSTR) return E_INVALIDARG;
- result = pSHGetSpecialFolderPathW(NULL, wszPath, CSIDL_DESKTOPDIRECTORY, FALSE);
+ result = SHGetSpecialFolderPathW(NULL, wszPath, CSIDL_DESKTOPDIRECTORY, FALSE);
ok(result, "SHGetSpecialFolderPathW(DESKTOPDIRECTORY) failed! %u\n", GetLastError());
if (!result) return E_INVALIDARG;
static const GUID CLSID_UnixDosFolder =
{0x9d20aae8, 0x0625, 0x44b0, {0x9c, 0xa7, 0x71, 0x88, 0x9c, 0x22, 0x54, 0xd9}};
- if (!pSHGetSpecialFolderPathW || !pStrRetToBufW) {
- win_skip("SHGetSpecialFolderPathW and/or StrRetToBufW are not available\n");
- return;
- }
-
- if (!pSHGetFolderPathAndSubDirA)
- {
- win_skip("FolderShortcut test doesn't work on Win2k\n");
- return;
- }
-
/* These tests basically show, that CLSID_FolderShortcuts are initialized
* via their IPersistPropertyBag interface. And that the target folder
* is taken from the IPropertyBag's 'Target' property.
return;
}
- result = pSHGetSpecialFolderPathW(NULL, wszDesktopPath, CSIDL_DESKTOPDIRECTORY, FALSE);
+ result = SHGetSpecialFolderPathW(NULL, wszDesktopPath, CSIDL_DESKTOPDIRECTORY, FALSE);
ok(result, "SHGetSpecialFolderPathW(CSIDL_DESKTOPDIRECTORY) failed! %u\n", GetLastError());
if (!result) return;
- pStrRetToBufW(&strret, NULL, wszBuffer, MAX_PATH);
+ StrRetToBufW(&strret, NULL, wszBuffer, MAX_PATH);
ok(!lstrcmpiW(wszDesktopPath, wszBuffer), "FolderShortcut returned incorrect folder!\n");
hr = IShellFolder_QueryInterface(pShellFolder, &IID_IPersistFolder3, (LPVOID*)&pPersistFolder3);
ok (hr == S_OK, "IPersistFolder3::Initialize failed! hr = %08x\n", hr);
if (hr != S_OK) {
IPersistFolder3_Release(pPersistFolder3);
- pILFree(pidlWineTestFolder);
+ ILFree(pidlWineTestFolder);
return;
}
hr = IPersistFolder3_GetCurFolder(pPersistFolder3, &pidlCurrentFolder);
ok(hr == S_OK, "IPersistFolder3_GetCurFolder failed! hr=0x%08x\n", hr);
- ok(pILIsEqual(pidlCurrentFolder, pidlWineTestFolder),
+ ok(ILIsEqual(pidlCurrentFolder, pidlWineTestFolder),
"IPersistFolder3_GetCurFolder should return pidlWineTestFolder!\n");
- pILFree(pidlCurrentFolder);
- pILFree(pidlWineTestFolder);
+ ILFree(pidlCurrentFolder);
+ ILFree(pidlWineTestFolder);
hr = IPersistFolder3_QueryInterface(pPersistFolder3, &IID_IShellFolder, (LPVOID*)&pShellFolder);
IPersistFolder3_Release(pPersistFolder3);
return;
}
- pStrRetToBufW(&strret, NULL, wszBuffer, MAX_PATH);
+ StrRetToBufW(&strret, NULL, wszBuffer, MAX_PATH);
ok(!lstrcmpiW(wszDesktopPath, wszBuffer), "FolderShortcut returned incorrect folder!\n");
/* Next few lines are meant to show that children of FolderShortcuts are not FolderShortcuts,
hr = IShellFolder_BindToObject(pShellFolder, pidlSubFolder, NULL, &IID_IPersistFolder3,
(LPVOID*)&pPersistFolder3);
IShellFolder_Release(pShellFolder);
- pILFree(pidlSubFolder);
+ ILFree(pidlSubFolder);
ok (hr == S_OK, "IShellFolder::BindToObject failed! hr = %08x\n", hr);
if (hr != S_OK)
return;
{ 'l','o','n','g','e','r','_','t','h','a','n','.','8','_','3',0 } };
int i;
- if (!pSHGetSpecialFolderPathW) return;
-
- bResult = pSHGetSpecialFolderPathW(NULL, wszPersonal, CSIDL_PERSONAL, FALSE);
+ bResult = SHGetSpecialFolderPathW(NULL, wszPersonal, CSIDL_PERSONAL, FALSE);
ok(bResult, "SHGetSpecialFolderPathW failed! Last error: %u\n", GetLastError());
if (!bResult) return;
hr = IShellFolder_BindToObject(psfDesktop, pidlPersonal, NULL, &IID_IShellFolder,
(LPVOID*)&psfPersonal);
IShellFolder_Release(psfDesktop);
- pILFree(pidlPersonal);
+ ILFree(pidlPersonal);
ok(hr == S_OK, "psfDesktop->BindToObject failed! hr = %08x\n", hr);
if (hr != S_OK) return;
* current habit of storing the long filename here, which seems to work
* just fine. */
todo_wine
- ok(pidlFile->mkid.abID[18] == '~' ||
- broken(pidlFile->mkid.abID[34] == '~'), /* Win2k */
- "Should be derived 8.3 name!\n");
+ ok(pidlFile->mkid.abID[18] == '~', "Should be derived 8.3 name!\n");
if (i == 0) /* First file name has an even number of chars. No need for alignment. */
- ok(pidlFile->mkid.abID[12 + strlen(szFile) + 1] != '\0' ||
- broken(pidlFile->mkid.cb == 2 + 12 + strlen(szFile) + 1 + 1), /* Win2k */
+ ok(pidlFile->mkid.abID[12 + strlen(szFile) + 1] != '\0',
"Alignment byte, where there shouldn't be!\n");
if (i == 1) /* Second file name has an uneven number of chars => alignment byte */
/* The offset of the FileStructW member is stored as a WORD at the end of the pidl. */
cbOffset = *(WORD*)(((LPBYTE)pidlFile)+pidlFile->mkid.cb-sizeof(WORD));
ok ((cbOffset >= sizeof(struct FileStructA) &&
- cbOffset <= pidlFile->mkid.cb - sizeof(struct FileStructW)) ||
- broken(pidlFile->mkid.cb == 2 + 12 + strlen(szFile) + 1 + 1) || /* Win2k on short names */
- broken(pidlFile->mkid.cb == 2 + 12 + strlen(szFile) + 1 + 12 + 1), /* Win2k on long names */
+ cbOffset <= pidlFile->mkid.cb - sizeof(struct FileStructW)),
"Wrong offset value (%d) stored at the end of the PIDL\n", cbOffset);
if (cbOffset >= sizeof(struct FileStructA) &&
}
}
- pILFree(pidlFile);
+ ILFree(pidlFile);
}
IShellFolder_Release(psfPersonal);
HRESULT hr;
HKEY key;
- if (!pSHGetFolderPathA)
- {
- win_skip("SHGetFolderPathA not present\n");
- return;
- }
if (!pIsWow64Process || !pIsWow64Process( GetCurrentProcess(), &is_wow64 )) is_wow64 = FALSE;
- hr = pSHGetFolderPathA( 0, CSIDL_PROGRAM_FILES, 0, SHGFP_TYPE_CURRENT, path );
+ hr = SHGetFolderPathA( 0, CSIDL_PROGRAM_FILES, 0, SHGFP_TYPE_CURRENT, path );
ok( hr == S_OK, "SHGetFolderPathA failed %x\n", hr );
- hr = pSHGetFolderPathA( 0, CSIDL_PROGRAM_FILESX86, 0, SHGFP_TYPE_CURRENT, path_x86 );
+ hr = SHGetFolderPathA( 0, CSIDL_PROGRAM_FILESX86, 0, SHGFP_TYPE_CURRENT, path_x86 );
if (hr == E_FAIL)
{
win_skip( "Program Files (x86) not supported\n" );
RegCloseKey( key );
}
- hr = pSHGetFolderPathA( 0, CSIDL_PROGRAM_FILES_COMMON, 0, SHGFP_TYPE_CURRENT, path );
+ hr = SHGetFolderPathA( 0, CSIDL_PROGRAM_FILES_COMMON, 0, SHGFP_TYPE_CURRENT, path );
ok( hr == S_OK, "SHGetFolderPathA failed %x\n", hr );
- hr = pSHGetFolderPathA( 0, CSIDL_PROGRAM_FILES_COMMONX86, 0, SHGFP_TYPE_CURRENT, path_x86 );
+ hr = SHGetFolderPathA( 0, CSIDL_PROGRAM_FILES_COMMONX86, 0, SHGFP_TYPE_CURRENT, path_x86 );
if (hr == E_FAIL)
{
win_skip( "Common Files (x86) not supported\n" );
static char testpath[MAX_PATH];
static char toolongpath[MAX_PATH+1];
- if(!pSHGetFolderPathAndSubDirA)
- {
- win_skip("SHGetFolderPathAndSubDirA not present!\n");
- return;
- }
-
- if(!pSHGetFolderPathA) {
- win_skip("SHGetFolderPathA not present!\n");
- return;
- }
- if(FAILED(pSHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appdata)))
+ if(FAILED(SHGetFolderPathA(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appdata)))
{
win_skip("SHGetFolderPathA failed for CSIDL_LOCAL_APPDATA!\n");
return;
}
/* test invalid second parameter */
- ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | 0xff, NULL, SHGFP_TYPE_CURRENT, wine, testpath);
+ ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | 0xff, NULL, SHGFP_TYPE_CURRENT, wine, testpath);
ok(E_INVALIDARG == ret, "expected E_INVALIDARG, got %x\n", ret);
/* test fourth parameter */
- ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, 2, winetemp, testpath);
+ ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, 2, winetemp, testpath);
switch(ret) {
case S_OK: /* winvista */
ok(!strncmp(appdata, testpath, strlen(appdata)),
/* test fifth parameter */
testpath[0] = '\0';
- ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, NULL, testpath);
+ ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, NULL, testpath);
ok(S_OK == ret, "expected S_OK, got %x\n", ret);
ok(!lstrcmpA(appdata, testpath), "expected %s, got %s\n", appdata, testpath);
testpath[0] = '\0';
- ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, "", testpath);
+ ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, "", testpath);
ok(S_OK == ret, "expected S_OK, got %x\n", ret);
ok(!lstrcmpA(appdata, testpath), "expected %s, got %s\n", appdata, testpath);
testpath[0] = '\0';
- ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, "\\", testpath);
+ ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, "\\", testpath);
ok(S_OK == ret, "expected S_OK, got %x\n", ret);
ok(!lstrcmpA(appdata, testpath), "expected %s, got %s\n", appdata, testpath);
for(i=0; i< MAX_PATH; i++)
toolongpath[i] = '0' + i % 10;
toolongpath[MAX_PATH] = '\0';
- ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, toolongpath, testpath);
+ ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, toolongpath, testpath);
ok(HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE) == ret,
"expected %x, got %x\n", HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE), ret);
testpath[0] = '\0';
- ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, wine, NULL);
+ ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_DONT_VERIFY | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, wine, NULL);
ok((S_OK == ret) || (E_INVALIDARG == ret), "expected S_OK or E_INVALIDARG, got %x\n", ret);
/* test a not existing path */
testpath[0] = '\0';
- ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, winetemp, testpath);
+ ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, winetemp, testpath);
ok(HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) == ret,
"expected %x, got %x\n", HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), ret);
/* create a directory inside a not existing directory */
testpath[0] = '\0';
- ret = pSHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_CREATE | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, winetemp, testpath);
+ ret = SHGetFolderPathAndSubDirA(NULL, CSIDL_FLAG_CREATE | CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, winetemp, testpath);
ok(S_OK == ret, "expected S_OK, got %x\n", ret);
ok(!strncmp(appdata, testpath, strlen(appdata)),
"expected %s to start with %s\n", testpath, appdata);
hr = IShellFolder_GetDisplayNameOf(testIShellFolder, newPIDL, SHGDN_INFOLDER, &strret);
ok(hr == S_OK, "GetDisplayNameOf failed %08x\n", hr);
- if (hr == S_OK && pStrRetToBufW)
- {
- hr = pStrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR));
- ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
- todo_wine
- ok (!lstrcmpiW(tempbufW, folderdisplayW) ||
- broken(!lstrcmpiW(tempbufW, foldernameW)), /* W2K */
- "GetDisplayNameOf returned %s\n", wine_dbgstr_w(tempbufW));
- }
+ hr = StrRetToBufW(&strret, newPIDL, tempbufW, ARRAY_SIZE(tempbufW));
+ ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
+ todo_wine
+ ok (!lstrcmpiW(tempbufW, folderdisplayW), "GetDisplayNameOf returned %s\n", wine_dbgstr_w(tempbufW));
/* editing name is also read from the resource */
hr = IShellFolder_GetDisplayNameOf(testIShellFolder, newPIDL, SHGDN_INFOLDER|SHGDN_FOREDITING, &strret);
ok(hr == S_OK, "GetDisplayNameOf failed %08x\n", hr);
- if (hr == S_OK && pStrRetToBufW)
- {
- hr = pStrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR));
- ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
- todo_wine
- ok (!lstrcmpiW(tempbufW, folderdisplayW) ||
- broken(!lstrcmpiW(tempbufW, foldernameW)), /* W2K */
- "GetDisplayNameOf returned %s\n", wine_dbgstr_w(tempbufW));
- }
+ hr = StrRetToBufW(&strret, newPIDL, tempbufW, ARRAY_SIZE(tempbufW));
+ ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
+ todo_wine
+ ok (!lstrcmpiW(tempbufW, folderdisplayW), "GetDisplayNameOf returned %s\n", wine_dbgstr_w(tempbufW));
/* parsing name is unchanged */
hr = IShellFolder_GetDisplayNameOf(testIShellFolder, newPIDL, SHGDN_INFOLDER|SHGDN_FORPARSING, &strret);
ok(hr == S_OK, "GetDisplayNameOf failed %08x\n", hr);
- if (hr == S_OK && pStrRetToBufW)
- {
- hr = pStrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR));
- ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
- ok (!lstrcmpiW(tempbufW, foldernameW), "GetDisplayNameOf returned %s\n", wine_dbgstr_w(tempbufW));
- }
+ hr = StrRetToBufW(&strret, newPIDL, tempbufW, ARRAY_SIZE(tempbufW));
+ ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
+ ok (!lstrcmpiW(tempbufW, foldernameW), "GetDisplayNameOf returned %s\n", wine_dbgstr_w(tempbufW));
IShellFolder_Release(IDesktopFolder);
IShellFolder_Release(testIShellFolder);
return;
}
- if(pSHGetSpecialFolderLocation)
- {
- ret = pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
- ok(ret == S_OK, "Got 0x%08x\n", ret);
- }
- else
- {
- win_skip("pSHGetSpecialFolderLocation missing.\n");
- pidl_desktop = NULL;
- }
+ ret = SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
+ ok(ret == S_OK, "Got 0x%08x\n", ret);
MultiByteToWideChar(CP_ACP, 0, curdirA, -1, curdirW, MAX_PATH);
ret = IShellFolder_ParseDisplayName(currentfolder, NULL, NULL, testfileW, NULL, &pidl_testfile, NULL);
ok(SUCCEEDED(ret), "ParseDisplayName returned %x\n", ret);
- pidl_abstestfile = pILCombine(pidl_cwd, pidl_testfile);
+ pidl_abstestfile = ILCombine(pidl_cwd, pidl_testfile);
shellitem = (void*)0xdeadbeef;
ret = pSHCreateShellItem(NULL, NULL, NULL, &shellitem);
if (SUCCEEDED(ret))
{
ok(ILIsEqual(pidl_cwd, pidl_test), "id lists are not equal\n");
- pILFree(pidl_test);
+ ILFree(pidl_test);
}
IPersistIDList_Release(persistidl);
}
if (SUCCEEDED(ret))
{
ok(ILIsEqual(pidl_abstestfile, pidl_test), "id lists are not equal\n");
- pILFree(pidl_test);
+ ILFree(pidl_test);
}
IPersistIDList_Release(persistidl);
}
if (SUCCEEDED(ret))
{
ok(ILIsEqual(pidl_cwd, pidl_test), "id lists are not equal\n");
- pILFree(pidl_test);
+ ILFree(pidl_test);
}
IPersistIDList_Release(persistidl);
}
if (SUCCEEDED(ret))
{
ok(ILIsEqual(pidl_abstestfile, pidl_test), "id lists are not equal\n");
- pILFree(pidl_test);
+ ILFree(pidl_test);
}
IPersistIDList_Release(persistidl);
}
if (SUCCEEDED(ret))
{
ok(ILIsEqual(pidl_abstestfile, pidl_test), "id lists are not equal\n");
- pILFree(pidl_test);
+ ILFree(pidl_test);
}
IPersistIDList_Release(persistidl);
}
if (SUCCEEDED(ret))
{
ok(ILIsEqual(pidl_testfile, pidl_test), "id lists are not equal\n");
- pILFree(pidl_test);
+ ILFree(pidl_test);
}
IPersistIDList_Release(persistidl);
}
if (SUCCEEDED(ret))
{
ok(ILIsEqual(pidl_cwd, pidl_test), "id lists are not equal\n");
- pILFree(pidl_test);
+ ILFree(pidl_test);
}
IPersistIDList_Release(persistidl);
}
if (SUCCEEDED(ret))
{
ok(ILIsEqual(pidl_testfile, pidl_test), "id lists are not equal\n");
- pILFree(pidl_test);
+ ILFree(pidl_test);
}
IPersistIDList_Release(persistidl);
}
else
win_skip("No SHCreateItemFromIDList\n");
+ /* SHCreateItemFromRelativeName */
+ if(pSHCreateItemFromRelativeName && pSHGetKnownFolderPath)
+ {
+ IShellItem *shellitem_desktop = NULL;
+ WCHAR *desktop_path, *displayname;
+ WCHAR testfile_path[MAX_PATH] = {0};
+ HANDLE file;
+ LPITEMIDLIST pidl_desktop_testfile = NULL;
+ int order;
+
+ ret = pSHCreateShellItem(NULL, NULL, pidl_desktop, &shellitem_desktop);
+ ok(ret == S_OK, "SHCreateShellItem failed: 0x%08x.\n", ret);
+
+ shellitem = (void*)0xdeadbeef;
+ ret = pSHCreateItemFromRelativeName(shellitem_desktop, NULL, NULL, &IID_IShellItem,
+ (void**)&shellitem);
+ ok(ret == E_INVALIDARG, "Expected 0x%08x but SHCreateItemFromRelativeName return: 0x%08x.\n",
+ E_INVALIDARG, ret);
+ ok(shellitem == NULL, "shellitem was %p.\n", shellitem);
+
+ /* Test with a non-existent file */
+ shellitem = (void*)0xdeadbeef;
+ ret = pSHCreateItemFromRelativeName(shellitem_desktop, testfileW, NULL, &IID_IShellItem,
+ (void**)&shellitem);
+ ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
+ "Expected 0x%08x but SHCreateItemFromRelativeName return: 0x%08x.\n",
+ HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), ret);
+ ok(shellitem == NULL, "shellitem was %p.\n", shellitem);
+
+ /* Create a file for testing in desktop folder */
+ pSHGetKnownFolderPath(&FOLDERID_Desktop, 0, NULL, &desktop_path);
+ lstrcatW(testfile_path, desktop_path);
+ myPathAddBackslashW(testfile_path);
+ lstrcatW(testfile_path, testfileW);
+ file = CreateFileW(testfile_path, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL);
+ ok(file != INVALID_HANDLE_VALUE, "CreateFileW failed! Last error: 0x%08x.\n", GetLastError());
+ CloseHandle(file);
+
+ shellitem = (void*)0xdeadbeef;
+ ret = pSHCreateItemFromRelativeName(shellitem_desktop, testfileW, NULL, &IID_IShellItem,
+ (void**)&shellitem);
+ ok(ret == S_OK, "SHCreateItemFromRelativeName failed: 0x%08x.\n", ret);
+ ok(shellitem != NULL, "shellitem was %p.\n", shellitem);
+ if(SUCCEEDED(ret))
+ {
+ ret = IShellItem_GetDisplayName(shellitem, 0, &displayname);
+ ok(ret == S_OK, "IShellItem_GetDisplayName failed: 0x%08x.\n", ret);
+ ok(!lstrcmpW(displayname, testfileW), "got wrong display name: %s.\n", wine_dbgstr_w(displayname));
+ CoTaskMemFree(displayname);
+
+ shellitem2 = (void*)0xdeadbeef;
+ ret = pSHCreateItemFromRelativeName(shellitem_desktop, testfileW, NULL, &IID_IShellItem,
+ (void**)&shellitem2);
+ ok(ret == S_OK, "SHCreateItemFromRelativeName failed: 0x%08x.\n", ret);
+ ret = IShellItem_Compare(shellitem, shellitem2, 0, &order);
+ ok(ret == S_OK, "IShellItem_Compare failed: 0x%08x.\n", ret);
+ ok(!order, "order got wrong value: %d.\n", order);
+ IShellItem_Release(shellitem2);
+
+ shellitem2 = (void*)0xdeadbeef;
+ ret = IShellFolder_ParseDisplayName(desktopfolder, NULL, NULL, testfileW, NULL,
+ &pidl_desktop_testfile, NULL);
+ ok(ret == S_OK, "ParseDisplayName failed 0x%08x.\n", ret);
+ ret = pSHCreateItemFromIDList(pidl_desktop_testfile, &IID_IShellItem, (void**)&shellitem2);
+ ret = IShellItem_Compare(shellitem, shellitem2, 0, &order);
+ ok(ret == S_OK, "IShellItem_Compare fail: 0x%08x.\n", ret);
+ ok(!order, "order got wrong value: %d.\n", order);
+ ILFree(pidl_desktop_testfile);
+ IShellItem_Release(shellitem2);
+
+ IShellItem_Release(shellitem);
+ }
+
+ DeleteFileW(testfile_path);
+ CoTaskMemFree(desktop_path);
+ IShellItem_Release(shellitem_desktop);
+ }
+ else
+ win_skip("No SHCreateItemFromRelativeName or SHGetKnownFolderPath\n");
+
+ /* SHCreateItemInKnownFolder */
+ if(pSHCreateItemInKnownFolder && pSHGetKnownFolderPath)
+ {
+ WCHAR *desktop_path;
+ WCHAR testfile_path[MAX_PATH] = {0};
+ HANDLE file;
+ WCHAR *displayname = NULL;
+ int order;
+ LPITEMIDLIST pidl_desktop_testfile = NULL;
+
+ shellitem = (void*)0xdeadbeef;
+ ret = pSHCreateItemInKnownFolder(&FOLDERID_Desktop, 0, NULL, &IID_IShellItem,
+ (void**)&shellitem);
+ ok(ret == S_OK, "SHCreateItemInKnownFolder failed: 0x%08x.\n", ret);
+ ok(shellitem != NULL, "shellitem was %p.\n", shellitem);
+ if(SUCCEEDED(ret))
+ {
+ shellitem2 = (void*)0xdeadbeef;
+ ret = pSHCreateShellItem(NULL, NULL, pidl_desktop, &shellitem2);
+ ok(SUCCEEDED(ret), "SHCreateShellItem returned %x\n", ret);
+ if(SUCCEEDED(ret))
+ {
+ ret = IShellItem_Compare(shellitem, shellitem2, 0, &order);
+ ok(ret == S_OK, "IShellItem_Compare failed: 0x%08x.\n", ret);
+ ok(!order, "order got wrong value: %d.\n", order);
+ IShellItem_Release(shellitem2);
+ }
+ IShellItem_Release(shellitem);
+ }
+
+ /* Test with a non-existent file */
+ shellitem = (void*)0xdeadbeef;
+ ret = pSHCreateItemInKnownFolder(&FOLDERID_Desktop, 0, testfileW, &IID_IShellItem,
+ (void**)&shellitem);
+ ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
+ "Expected 0x%08x but SHCreateItemInKnownFolder return: 0x%08x.\n",
+ HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), ret);
+ ok(shellitem == NULL, "shellitem was %p.\n", shellitem);
+
+ pSHGetKnownFolderPath(&FOLDERID_Desktop, 0, NULL, &desktop_path);
+ lstrcatW(testfile_path, desktop_path);
+ myPathAddBackslashW(testfile_path);
+ lstrcatW(testfile_path, testfileW);
+ file = CreateFileW(testfile_path, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL);
+ ok(file != INVALID_HANDLE_VALUE, "CreateFileW failed! Last error: 0x%08x.\n", GetLastError());
+ CloseHandle(file);
+
+ shellitem = (void*)0xdeadbeef;
+ ret = pSHCreateItemInKnownFolder(&FOLDERID_Desktop, 0, testfileW, &IID_IShellItem,
+ (void**)&shellitem);
+ ok(ret == S_OK, "SHCreateItemInKnownFolder failed: 0x%08x.\n", ret);
+ ok(shellitem != NULL, "shellitem was %p.\n", shellitem);
+ if(SUCCEEDED(ret))
+ {
+ ret = IShellItem_GetDisplayName(shellitem, 0, &displayname);
+ ok(ret == S_OK, "IShellItem_GetDisplayName failed: 0x%08x.\n", ret);
+ ok(!lstrcmpW(displayname, testfileW), "got wrong display name: %s.\n",
+ wine_dbgstr_w(displayname));
+ CoTaskMemFree(displayname);
+
+ shellitem2 = (void*)0xdeadbeef;
+ ret = pSHCreateItemInKnownFolder(&FOLDERID_Desktop, 0, testfileW, &IID_IShellItem,
+ (void**)&shellitem2);
+ ok(ret == S_OK, "SHCreateItemInKnownFolder failed: 0x%08x.\n", ret);
+ ok(shellitem2 != NULL, "shellitem was %p.\n", shellitem);
+ ret = IShellItem_Compare(shellitem, shellitem2, 0, &order);
+ ok(ret == S_OK, "IShellItem_Compare failed: 0x%08x.\n", ret);
+ ok(!order, "order got wrong value: %d.\n", order);
+ IShellItem_Release(shellitem2);
+
+ shellitem2 = (void*)0xdeadbeef;
+ ret = IShellFolder_ParseDisplayName(desktopfolder, NULL, NULL, testfileW, NULL,
+ &pidl_desktop_testfile, NULL);
+ ok(SUCCEEDED(ret), "ParseDisplayName returned %x.\n", ret);
+ ret = pSHCreateItemFromIDList(pidl_desktop_testfile, &IID_IShellItem, (void**)&shellitem2);
+ ret = IShellItem_Compare(shellitem, shellitem2, 0, &order);
+ ok(ret == S_OK, "IShellItem_Compare failed: 0x%08x.\n", ret);
+ ok(!order, "order got wrong value: %d.\n", order);
+ ILFree(pidl_desktop_testfile);
+ IShellItem_Release(shellitem2);
+
+ IShellItem_Release(shellitem);
+ }
+
+ shellitem = (void*)0xdeadbeef;
+ ret = pSHCreateItemInKnownFolder(&FOLDERID_Documents, 0, NULL, &IID_IShellItem,
+ (void**)&shellitem);
+ ok(ret == S_OK, "SHCreateItemInKnownFolder failed: 0x%08x.\n", ret);
+ ok(shellitem != NULL, "shellitem was %p.\n", shellitem);
+ if(SUCCEEDED(ret))
+ {
+ shellitem2 = (void*)0xdeadbeef;
+ ret = pSHCreateItemInKnownFolder(&FOLDERID_Documents, 0, NULL, &IID_IShellItem,
+ (void**)&shellitem2);
+ ok(ret == S_OK, "SHCreateItemInKnownFolder failed: 0x%08x.\n", ret);
+ ok(shellitem2 != NULL, "shellitem was %p.\n", shellitem);
+ ret = IShellItem_Compare(shellitem, shellitem2, 0, &order);
+ ok(ret == S_OK, "IShellItem_Compare failed: 0x%08x.\n", ret);
+ ok(!order, "order got wrong value: %d.\n", order);
+ IShellItem_Release(shellitem2);
+
+ IShellItem_Release(shellitem);
+ }
+ DeleteFileW(testfile_path);
+ CoTaskMemFree(desktop_path);
+ }
+ else
+ win_skip("No SHCreateItemInKnownFolder or SHGetKnownFolderPath\n");
+
DeleteFileA(".\\testfile");
- pILFree(pidl_abstestfile);
- pILFree(pidl_testfile);
- pILFree(pidl_desktop);
- pILFree(pidl_cwd);
+ ILFree(pidl_abstestfile);
+ ILFree(pidl_testfile);
+ ILFree(pidl_desktop);
+ ILFree(pidl_cwd);
IShellFolder_Release(currentfolder);
IShellFolder_Release(desktopfolder);
}
return;
}
- /* These should be available on any platform that passed the above test. */
+ /* This should be available on any platform that passed the above test. */
ok(pSHCreateShellItem != NULL, "SHCreateShellItem missing.\n");
- ok(pSHBindToParent != NULL, "SHBindToParent missing.\n");
- ok(pSHGetSpecialFolderLocation != NULL, "SHGetSpecialFolderLocation missing.\n");
- ok(pStrRetToBufW != NULL, "StrRetToBufW missing.\n");
if(0)
{
ok(hres == E_INVALIDARG, "Got 0x%08x\n", hres);
/* Test the desktop */
- hres = pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl);
+ hres = SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl);
ok(hres == S_OK, "Got 0x%08x\n", hres);
hres = pSHCreateShellItem(NULL, NULL, pidl, &shellitem);
ok(hres == S_OK, "Got 0x%08x\n", hres);
if(SUCCEEDED(hrSF))
{
- pStrRetToBufW(&strret, NULL, buf, MAX_PATH);
+ StrRetToBufW(&strret, NULL, buf, MAX_PATH);
if(SUCCEEDED(hrSI))
ok(!lstrcmpW(nameSI, buf), "Strings differ.\n");
if(SUCCEEDED(hrSF))
}
IShellFolder_Release(psf);
- if(pSHGetPathFromIDListW){
- hrSI = pSHGetNameFromIDList(pidl, SIGDN_FILESYSPATH, &nameSI);
- ok(hrSI == S_OK, "Got 0x%08x\n", hrSI);
- res = pSHGetPathFromIDListW(pidl, buf);
- ok(res == TRUE, "Got %d\n", res);
- if(SUCCEEDED(hrSI) && res)
- ok(!lstrcmpW(nameSI, buf), "Strings differ.\n");
- if(SUCCEEDED(hrSI)) CoTaskMemFree(nameSI);
- }else
- win_skip("pSHGetPathFromIDListW not available\n");
+ hrSI = pSHGetNameFromIDList(pidl, SIGDN_FILESYSPATH, &nameSI);
+ ok(hrSI == S_OK, "Got 0x%08x\n", hrSI);
+ res = SHGetPathFromIDListW(pidl, buf);
+ ok(res == TRUE, "Got %d\n", res);
+ if(SUCCEEDED(hrSI) && res)
+ ok(!lstrcmpW(nameSI, buf), "Strings differ.\n");
+ if(SUCCEEDED(hrSI)) CoTaskMemFree(nameSI);
hres = pSHGetNameFromIDList(pidl, SIGDN_URL, &name_string);
todo_wine ok(hres == S_OK, "Got 0x%08x\n", hres);
IShellItem_Release(shellitem);
}
- pILFree(pidl);
+ ILFree(pidl);
/* Test the control panel */
- hres = pSHGetSpecialFolderLocation(NULL, CSIDL_CONTROLS, &pidl);
+ hres = SHGetSpecialFolderLocation(NULL, CSIDL_CONTROLS, &pidl);
ok(hres == S_OK, "Got 0x%08x\n", hres);
hres = pSHCreateShellItem(NULL, NULL, pidl, &shellitem);
ok(hres == S_OK, "Got 0x%08x\n", hres);
if(SUCCEEDED(hrSF))
{
- pStrRetToBufW(&strret, NULL, buf, MAX_PATH);
+ StrRetToBufW(&strret, NULL, buf, MAX_PATH);
if(SUCCEEDED(hrSI))
ok(!lstrcmpW(nameSI, buf), "Strings differ.\n");
if(SUCCEEDED(hrSF))
}
IShellFolder_Release(psf);
- if(pSHGetPathFromIDListW){
- hrSI = pSHGetNameFromIDList(pidl, SIGDN_FILESYSPATH, &nameSI);
- ok(hrSI == E_INVALIDARG, "Got 0x%08x\n", hrSI);
- res = pSHGetPathFromIDListW(pidl, buf);
- ok(res == FALSE, "Got %d\n", res);
- if(SUCCEEDED(hrSI) && res)
- ok(!lstrcmpW(nameSI, buf), "Strings differ.\n");
- if(SUCCEEDED(hrSI)) CoTaskMemFree(nameSI);
- }else
- win_skip("pSHGetPathFromIDListW not available\n");
+ hrSI = pSHGetNameFromIDList(pidl, SIGDN_FILESYSPATH, &nameSI);
+ ok(hrSI == E_INVALIDARG, "Got 0x%08x\n", hrSI);
+ res = SHGetPathFromIDListW(pidl, buf);
+ ok(res == FALSE, "Got %d\n", res);
+ if(SUCCEEDED(hrSI) && res)
+ ok(!lstrcmpW(nameSI, buf), "Strings differ.\n");
+ if(SUCCEEDED(hrSI)) CoTaskMemFree(nameSI);
hres = pSHGetNameFromIDList(pidl, SIGDN_URL, &name_string);
todo_wine ok(hres == E_NOTIMPL /* Win7 */ || hres == S_OK /* Vista */,
IShellItem_Release(shellitem);
}
- pILFree(pidl);
+ ILFree(pidl);
}
static void test_SHGetItemFromDataObject(void)
skip("zero or one file found - skipping multi-file test.\n");
for(i = 0; i < count; i++)
- pILFree(apidl[i]);
+ ILFree(apidl[i]);
IEnumIDList_Release(peidl);
}
{
hr = pSHCreateShellItem(NULL, NULL, pidl_testfile, &psi[i]);
ok(hr == S_OK, "Got 0x%08x\n", hr);
- pILFree(pidl_testfile);
+ ILFree(pidl_testfile);
}
if(FAILED(hr)) failed = TRUE;
}
return;
}
- ok(pSHGetSpecialFolderLocation != NULL, "SHGetSpecialFolderLocation missing.\n");
-
if(0)
{
/* Crashes native */
hres = pSHGetIDListFromObject(NULL, &pidl);
ok(hres == E_NOINTERFACE, "Got %x\n", hres);
- punkimpl = HeapAlloc(GetProcessHeap(), 0, sizeof(IUnknownImpl));
+ punkimpl = heap_alloc(sizeof(*punkimpl));
punkimpl->IUnknown_iface.lpVtbl = &vt_IUnknown;
punkimpl->ifaces = ifaces;
punkimpl->unknown = 0;
"interface not requested.\n");
ok(!punkimpl->unknown, "Got %d unknown.\n", punkimpl->unknown);
- HeapFree(GetProcessHeap(), 0, punkimpl);
+ heap_free(punkimpl);
pidl_desktop = NULL;
- pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
+ SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
ok(pidl_desktop != NULL, "Failed to get desktop pidl.\n");
SHGetDesktopFolder(&psfdesktop);
if(SUCCEEDED(hres))
{
ok(ILIsEqual(pidl_desktop, pidl), "pidl not equal.\n");
- pILFree(pidl);
+ ILFree(pidl);
}
IShellItem_Release(shellitem);
}
if(SUCCEEDED(hres))
{
ok(ILIsEqual(pidl_desktop, pidl), "pidl not equal.\n");
- pILFree(pidl);
+ ILFree(pidl);
}
hres = IShellFolder_CreateViewObject(psfdesktop, NULL, &IID_IShellView, (void**)&psv);
if(SUCCEEDED(hres))
{
ok(ILIsEqual(pidl_desktop, pidl), "pidl not equal.\n");
- pILFree(pidl);
+ ILFree(pidl);
}
/* Test IDataObject */
ok(hres == S_OK, "got 0x%08x\n", hres);
ok(pidl != NULL, "pidl is NULL.\n");
ok(ILIsEqual(pidl, apidl[0]), "pidl not equal.\n");
- pILFree(pidl);
+ ILFree(pidl);
IDataObject_Release(pdo);
}
skip("zero or one file found - skipping multi-file test.\n");
for(i = 0; i < count; i++)
- pILFree(apidl[i]);
+ ILFree(apidl[i]);
IEnumIDList_Release(peidl);
}
}
IShellFolder_Release(psfdesktop);
- pILFree(pidl_desktop);
+ ILFree(pidl_desktop);
}
static void test_SHGetItemFromObject(void)
hres = pSHGetItemFromObject(NULL, &IID_IUnknown, (void**)&punk);
ok(hres == E_NOINTERFACE, "Got 0x%08x\n", hres);
- punkimpl = HeapAlloc(GetProcessHeap(), 0, sizeof(IUnknownImpl));
+ punkimpl = heap_alloc(sizeof(*punkimpl));
punkimpl->IUnknown_iface.lpVtbl = &vt_IUnknown;
punkimpl->ifaces = ifaces;
punkimpl->unknown = 0;
"interface not requested.\n");
ok(!punkimpl->unknown, "Got %d unknown.\n", punkimpl->unknown);
- HeapFree(GetProcessHeap(), 0, punkimpl);
+ heap_free(punkimpl);
/* Test IShellItem */
hres = pSHGetItemFromObject((IUnknown*)psfdesktop, &IID_IShellItem, (void**)&psi);
return;
}
- ok(pSHGetSpecialFolderLocation != NULL, "SHGetSpecialFolderLocation missing.\n");
-
if(0)
{
/* Crashes under native */
hr = pSHCreateShellItemArray(NULL, pdesktopsf, 1, NULL, &psia);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
- pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl);
+ SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl);
hr = pSHCreateShellItemArray(pidl, NULL, 0, NULL, &psia);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
- pILFree(pidl);
+ ILFree(pidl);
GetCurrentDirectoryW(MAX_PATH, cTestDirW);
myPathAddBackslashW(cTestDirW);
if(FAILED(hr))
{
skip("Failed to set up environment for SHCreateShellItemArray tests.\n");
- pILFree(pidl_testdir);
+ ILFree(pidl_testdir);
Cleanup();
return;
}
if(SUCCEEDED(hr))
{
ok(ILIsEqual(pidl_abs, pidl), "Pidl not equal.\n");
- pILFree(pidl);
+ ILFree(pidl);
}
IShellItem_Release(psi);
}
- pILFree(pidl_abs);
+ ILFree(pidl_abs);
}
for(i = 0; i < done; i++)
- pILFree(apidl[i]);
+ ILFree(apidl[i]);
IShellItemArray_Release(psia);
}
}
ok(hr == S_OK, "Got 0x%08x\n", hr);
ok(pidl2 != NULL, "pidl2 was null.\n");
ok(ILIsEqual(pidl1, pidl2), "pidls not equal.\n");
- pILFree(pidl1);
- pILFree(pidl2);
+ ILFree(pidl1);
+ ILFree(pidl2);
IShellItem_Release(psi2);
}
hr = IShellItemArray_GetItemAt(psia, 1, &psi2);
ok(hr == S_OK, "Got 0x%08x\n", hr);
ok(pidl != NULL, "pidl as NULL.\n");
ok(ILIsEqual(pidl, pidl_abs), "pidls differ.\n");
- pILFree(pidl);
+ ILFree(pidl);
IShellItem_Release(psi);
}
- pILFree(pidl_abs);
+ ILFree(pidl_abs);
}
IShellItemArray_Release(psia);
IDataObject_Release(pdo);
}
for(i = 0; i < count; i++)
- pILFree(apidl[i]);
+ ILFree(apidl[i]);
}
else
skip("No files found - skipping test.\n");
WCHAR desktoppath[MAX_PATH];
BOOL result;
- result = pSHGetSpecialFolderPathW(NULL, desktoppath, CSIDL_DESKTOPDIRECTORY, FALSE);
+ result = SHGetSpecialFolderPathW(NULL, desktoppath, CSIDL_DESKTOPDIRECTORY, FALSE);
ok(result, "SHGetSpecialFolderPathW(CSIDL_DESKTOPDIRECTORY) failed! %u\n", GetLastError());
hr = IShellItem_GetDisplayName(psi, SIGDN_DESKTOPABSOLUTEPARSING, &path);
IShellItemArray_Release(psia);
}
- pILFree(pidltest1);
+ ILFree(pidltest1);
}
IShellFolder_Release(pdesktopsf);
skip("No SHCreateShellItemArrayFromIDLists.\n");
IShellFolder_Release(psf);
- pILFree(pidl_testdir);
+ ILFree(pidl_testdir);
Cleanup();
}
hr = IShellFolder_BindToObject(pdesktopsf, pidl_testdir, NULL, (REFIID)&IID_IShellFolder,
(void**)&psf);
ok(hr == S_OK, "Got 0x%08x\n", hr);
- pILFree(pidl_testdir);
+ ILFree(pidl_testdir);
}
IShellFolder_Release(pdesktopsf);
if (FAILED(hr)) return;
}
for(i = 0; i < done; i++)
- pILFree(apidl[i]);
+ ILFree(apidl[i]);
}
+
+ IShellFolder_Release(psf);
}
return;
}
- hr = pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
+ hr = SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
ok(hr == S_OK, "Got 0x%08x\n", hr);
if(SUCCEEDED(hr))
{
if(SUCCEEDED(hr))
{
ok(ILIsEqual(pidl_desktop, pidl_tmp), "Pidl not equal (%p, %p)\n", pidl_desktop, pidl_tmp);
- pILFree(pidl_tmp);
+ ILFree(pidl_tmp);
}
IPersistFolder2_Release(ppf2);
}
else
skip("Failed to create ShellItem.\n");
- pILFree(pidl_desktop);
+ ILFree(pidl_desktop);
}
static void test_ShellItemGetAttributes(void)
return;
}
- hr = pSHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
+ hr = SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl_desktop);
ok(hr == S_OK, "Got 0x%08x\n", hr);
if(SUCCEEDED(hr))
{
hr = pSHCreateShellItem(NULL, NULL, pidl_desktop, &psi);
ok(hr == S_OK, "Got 0x%08x\n", hr);
- pILFree(pidl_desktop);
+ ILFree(pidl_desktop);
}
if(FAILED(hr))
{
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = pSHCreateShellItem(NULL, NULL, pidl, &psi_folder1);
ok(hr == S_OK, "Got 0x%08x\n", sfgao);
- pILFree(pidl);
+ ILFree(pidl);
lstrcpyW(buf, curdirW);
lstrcatW(buf, testfile1W);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = pSHCreateShellItem(NULL, NULL, pidl, &psi_file1);
ok(hr == S_OK, "Got 0x%08x\n", sfgao);
- pILFree(pidl);
+ ILFree(pidl);
IShellFolder_Release(pdesktopsf);
ok(hr == S_OK, "got 0x%08x\n", hr);
for(i = 0; i < 5; i++)
- pILFree((LPITEMIDLIST)pidl_array[i]);
+ ILFree((LPITEMIDLIST)pidl_array[i]);
/* [testfolder/, testfolder/testfolder2] seems to break in Vista */
attr = 0xdeadbeef;
HRESULT hr;
BOOL ret, is_wow64;
- if (!pSHParseDisplayName)
- {
- win_skip("SHParseDisplayName isn't available\n");
- return;
- }
-
if (0)
{
/* crashes on native */
- pSHParseDisplayName(NULL, NULL, NULL, 0, NULL);
+ SHParseDisplayName(NULL, NULL, NULL, 0, NULL);
nameW[0] = 0;
- pSHParseDisplayName(nameW, NULL, NULL, 0, NULL);
+ SHParseDisplayName(nameW, NULL, NULL, 0, NULL);
}
pidl1 = (LPITEMIDLIST)0xdeadbeef;
- hr = pSHParseDisplayName(NULL, NULL, &pidl1, 0, NULL);
+ hr = SHParseDisplayName(NULL, NULL, &pidl1, 0, NULL);
ok(broken(hr == E_OUTOFMEMORY) /* < Vista */ ||
hr == E_INVALIDARG, "failed %08x\n", hr);
ok(pidl1 == 0, "expected null ptr, got %p\n", pidl1);
/* dummy name */
nameW[0] = 0;
- hr = pSHParseDisplayName(nameW, NULL, &pidl1, 0, NULL);
+ hr = SHParseDisplayName(nameW, NULL, &pidl1, 0, NULL);
ok(hr == S_OK, "failed %08x\n", hr);
hr = SHGetDesktopFolder(&desktop);
ok(hr == S_OK, "failed %08x\n", hr);
hr = IShellFolder_ParseDisplayName(desktop, NULL, NULL, nameW, NULL, &pidl2, NULL);
ok(hr == S_OK, "failed %08x\n", hr);
- ret = pILIsEqual(pidl1, pidl2);
+ ret = ILIsEqual(pidl1, pidl2);
ok(ret == TRUE, "expected equal idls\n");
- pILFree(pidl1);
- pILFree(pidl2);
+ ILFree(pidl1);
+ ILFree(pidl2);
/* with path */
GetWindowsDirectoryW( dirW, MAX_PATH );
- hr = pSHParseDisplayName(dirW, NULL, &pidl1, 0, NULL);
+ hr = SHParseDisplayName(dirW, NULL, &pidl1, 0, NULL);
ok(hr == S_OK, "failed %08x\n", hr);
hr = IShellFolder_ParseDisplayName(desktop, NULL, NULL, dirW, NULL, &pidl2, NULL);
ok(hr == S_OK, "failed %08x\n", hr);
- ret = pILIsEqual(pidl1, pidl2);
+ ret = ILIsEqual(pidl1, pidl2);
ok(ret == TRUE, "expected equal idls\n");
- pILFree(pidl1);
- pILFree(pidl2);
+ ILFree(pidl1);
+ ILFree(pidl2);
/* system32 is not redirected to syswow64 on WOW64 */
if (!pIsWow64Process || !pIsWow64Process( GetCurrentProcess(), &is_wow64 )) is_wow64 = FALSE;
- if (is_wow64 && pGetSystemWow64DirectoryW)
+ if (is_wow64)
{
UINT len;
*dirW = 0;
len = GetSystemDirectoryW(dirW, MAX_PATH);
ok(len > 0, "GetSystemDirectoryW failed: %u\n", GetLastError());
- hr = pSHParseDisplayName(dirW, NULL, &pidl1, 0, NULL);
+ hr = SHParseDisplayName(dirW, NULL, &pidl1, 0, NULL);
ok(hr == S_OK, "failed %08x\n", hr);
*dirW = 0;
- len = pGetSystemWow64DirectoryW(dirW, MAX_PATH);
+ len = GetSystemWow64DirectoryW(dirW, MAX_PATH);
ok(len > 0, "GetSystemWow64DirectoryW failed: %u\n", GetLastError());
- hr = pSHParseDisplayName(dirW, NULL, &pidl2, 0, NULL);
+ hr = SHParseDisplayName(dirW, NULL, &pidl2, 0, NULL);
ok(hr == S_OK, "failed %08x\n", hr);
- ret = pILIsEqual(pidl1, pidl2);
+ ret = ILIsEqual(pidl1, pidl2);
ok(ret == FALSE, "expected different idls\n");
- pILFree(pidl1);
- pILFree(pidl2);
+ ILFree(pidl1);
+ ILFree(pidl2);
}
IShellFolder_Release(desktop);
skip("No empty cdrom drive found, skipping test\n");
else
{
- hr = pSHParseDisplayName(cdrom, NULL, &pidl1, 0, NULL);
+ hr = SHParseDisplayName(cdrom, NULL, &pidl1, 0, NULL);
ok(hr == S_OK, "failed %08x\n", hr);
- if (SUCCEEDED(hr)) pILFree(pidl1);
+ if (SUCCEEDED(hr)) ILFree(pidl1);
}
}
ok(hr == S_OK, "failed %08x\n", hr);
hr = IShellFolder_QueryInterface(desktop, &IID_IPersist, (void**)&persist);
- ok(hr == S_OK || broken(hr == E_NOINTERFACE) /* NT4, W9X */, "failed %08x\n", hr);
+ ok(hr == S_OK, "failed %08x\n", hr);
if (hr == S_OK)
{
hr = IPersistFolder2_GetCurFolder(ppf2, &pidl);
ok(hr == S_OK, "got %08x\n", hr);
ok(pidl != NULL, "pidl was NULL.\n");
- if(SUCCEEDED(hr)) pILFree(pidl);
+ if(SUCCEEDED(hr)) ILFree(pidl);
IPersistFolder2_Release(ppf2);
}
IShellFolder_Release(desktop);
}
+static void test_contextmenu_qi(IContextMenu *menu, BOOL todo)
+{
+ IUnknown *unk;
+ HRESULT hr;
+
+ hr = IContextMenu_QueryInterface(menu, &IID_IShellExtInit, (void **)&unk);
+todo_wine_if(todo)
+ ok(hr == S_OK, "Failed to get IShellExtInit, hr %#x.\n", hr);
+if (hr == S_OK)
+ IUnknown_Release(unk);
+
+ hr = IContextMenu_QueryInterface(menu, &IID_IObjectWithSite, (void **)&unk);
+todo_wine_if(todo)
+ ok(hr == S_OK, "Failed to get IShellExtInit, hr %#x.\n", hr);
+if (hr == S_OK)
+ IUnknown_Release(unk);
+}
+
+static void test_contextmenu(IContextMenu *menu, BOOL background)
+{
+ HMENU hmenu = CreatePopupMenu();
+ const int id_upper_limit = 32767;
+ const int baseItem = 0x40;
+ INT max_id, max_id_check;
+ UINT count, i;
+ HRESULT hr;
+
+ test_contextmenu_qi(menu, FALSE);
+
+ hr = IContextMenu_QueryContextMenu(menu, hmenu, 0, baseItem, id_upper_limit, CMF_NORMAL);
+ ok(SUCCEEDED(hr), "Failed to query the menu, hr %#x.\n", hr);
+
+ max_id = HRESULT_CODE(hr) - 1; /* returns max_id + 1 */
+ ok(max_id <= id_upper_limit, "Got %d\n", max_id);
+ count = GetMenuItemCount(hmenu);
+ ok(count, "Got %d\n", count);
+
+ max_id_check = 0;
+ for (i = 0; i < count; i++)
+ {
+ MENUITEMINFOA mii;
+ INT res;
+ char buf[255], buf2[255];
+ ZeroMemory(&mii, sizeof(MENUITEMINFOA));
+ mii.cbSize = sizeof(MENUITEMINFOA);
+ mii.fMask = MIIM_ID | MIIM_FTYPE | MIIM_STRING;
+ mii.dwTypeData = buf2;
+ mii.cch = sizeof(buf2);
+
+ res = GetMenuItemInfoA(hmenu, i, TRUE, &mii);
+ ok(res, "Failed to get menu item info, error %d.\n", GetLastError());
+
+ ok((mii.wID <= id_upper_limit) || (mii.fType & MFT_SEPARATOR),
+ "Got non-separator ID out of range: %d (type: %x)\n", mii.wID, mii.fType);
+ if (!(mii.fType & MFT_SEPARATOR))
+ {
+ max_id_check = (mii.wID > max_id_check) ? mii.wID : max_id_check;
+ hr = IContextMenu_GetCommandString(menu, mii.wID - baseItem, GCS_VERBA, 0, buf, sizeof(buf));
+ todo_wine_if(background)
+ ok(SUCCEEDED(hr) || hr == E_NOTIMPL, "for id 0x%x got 0x%08x (menustr: %s)\n", mii.wID - baseItem, hr, mii.dwTypeData);
+ if (SUCCEEDED(hr))
+ trace("for id 0x%x got string %s (menu string: %s)\n", mii.wID - baseItem, buf, mii.dwTypeData);
+ else if (hr == E_NOTIMPL)
+ trace("for id 0x%x got E_NOTIMPL (menu string: %s)\n", mii.wID - baseItem, mii.dwTypeData);
+ }
+ }
+ max_id_check -= baseItem;
+ ok((max_id_check == max_id) ||
+ (max_id_check == max_id-1) || /* Win 7 */
+ (max_id_check == max_id-2) || /* Win 8 */
+ (max_id_check == max_id-3),
+ "Not equal (or near equal), got %d and %d\n", max_id_check, max_id);
+
+ if (count)
+ {
+ CMINVOKECOMMANDINFO cmi;
+
+ memset(&cmi, 0, sizeof(CMINVOKECOMMANDINFO));
+ cmi.cbSize = sizeof(CMINVOKECOMMANDINFO);
+
+ /* Attempt to execute a nonexistent command */
+ cmi.lpVerb = MAKEINTRESOURCEA(9999);
+ hr = IContextMenu_InvokeCommand(menu, &cmi);
+ todo_wine_if(background)
+ ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr);
+
+ cmi.lpVerb = "foobar_wine_test";
+ hr = IContextMenu_InvokeCommand(menu, &cmi);
+ todo_wine_if(background)
+ ok((hr == E_INVALIDARG) || (hr == E_FAIL /* Win7 */) ||
+ (hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) /* Vista */),
+ "Unexpected hr %#x.\n", hr);
+ }
+
+ DestroyMenu(hmenu);
+}
+
static void test_GetUIObject(void)
{
IShellFolder *psf_desktop;
WCHAR path[MAX_PATH];
const WCHAR filename[] =
{'\\','t','e','s','t','d','i','r','\\','t','e','s','t','1','.','t','x','t',0};
-
- if(!pSHBindToParent)
- {
- win_skip("SHBindToParent missing.\n");
- return;
- }
+ LPCITEMIDLIST pidl_child;
+ IShellFolder *psf;
GetCurrentDirectoryW(MAX_PATH, path);
if (!path[0])
CreateFilesFolders();
hr = IShellFolder_ParseDisplayName(psf_desktop, NULL, NULL, path, NULL, &pidl, 0);
- ok(hr == S_OK || broken(hr == E_FAIL) /* WinME */, "Got 0x%08x\n", hr);
- if(SUCCEEDED(hr))
- {
- IShellFolder *psf;
- LPCITEMIDLIST pidl_child;
- hr = pSHBindToParent(pidl, &IID_IShellFolder, (void**)&psf, &pidl_child);
- ok(hr == S_OK, "Got 0x%08x\n", hr);
- if(SUCCEEDED(hr))
- {
- hr = IShellFolder_GetUIObjectOf(psf, NULL, 1, &pidl_child, &IID_IContextMenu, NULL,
- (void**)&pcm);
- ok(hr == S_OK, "Got 0x%08x\n", hr);
- if(SUCCEEDED(hr))
- {
- const int baseItem = 0x40;
- HMENU hmenu = CreatePopupMenu();
- INT max_id, max_id_check;
- UINT count, i;
- const int id_upper_limit = 32767;
- hr = IContextMenu_QueryContextMenu(pcm, hmenu, 0, baseItem, id_upper_limit, CMF_NORMAL);
- ok(SUCCEEDED(hr), "Got 0x%08x\n", hr);
- max_id = HRESULT_CODE(hr) - 1; /* returns max_id + 1 */
- ok(max_id <= id_upper_limit, "Got %d\n", max_id);
- count = GetMenuItemCount(hmenu);
- ok(count, "Got %d\n", count);
-
- max_id_check = 0;
- for(i = 0; i < count; i++)
- {
- MENUITEMINFOA mii;
- INT res;
- char buf[255], buf2[255];
- ZeroMemory(&mii, sizeof(MENUITEMINFOA));
- mii.cbSize = sizeof(MENUITEMINFOA);
- mii.fMask = MIIM_ID | MIIM_FTYPE | MIIM_STRING;
- mii.dwTypeData = buf2;
- mii.cch = sizeof(buf2);
-
- SetLastError(0);
- res = GetMenuItemInfoA(hmenu, i, TRUE, &mii);
- ok(res, "Failed (last error: %d).\n", GetLastError());
-
- ok( (mii.wID <= id_upper_limit) || (mii.fType & MFT_SEPARATOR),
- "Got non-separator ID out of range: %d (type: %x)\n", mii.wID, mii.fType);
- if(!(mii.fType & MFT_SEPARATOR))
- {
- max_id_check = (mii.wID>max_id_check)?mii.wID:max_id_check;
- hr = IContextMenu_GetCommandString(pcm, mii.wID - baseItem, GCS_VERBA, 0, buf, sizeof(buf));
- ok(SUCCEEDED(hr) || hr == E_NOTIMPL, "for id 0x%x got 0x%08x (menustr: %s)\n", mii.wID - baseItem, hr, mii.dwTypeData);
- if (SUCCEEDED(hr))
- trace("for id 0x%x got string %s (menu string: %s)\n", mii.wID - baseItem, buf, mii.dwTypeData);
- else if (hr == E_NOTIMPL)
- trace("for id 0x%x got E_NOTIMPL (menu string: %s)\n", mii.wID - baseItem, mii.dwTypeData);
- }
- }
- max_id_check -= baseItem;
- ok((max_id_check == max_id) ||
- (max_id_check == max_id-1) || /* Win 7 */
- (max_id_check == max_id-2), /* Win 8 */
- "Not equal (or near equal), got %d and %d\n", max_id_check, max_id);
+ ok(hr == S_OK, "Got 0x%08x\n", hr);
-#define is_win2k() (pSHGetFolderPathA && !pSHGetFolderPathAndSubDirA)
+ hr = SHBindToParent(pidl, &IID_IShellFolder, (void **)&psf, &pidl_child);
+ ok(hr == S_OK, "Failed to bind to folder, hr %#x.\n", hr);
- if(count && !is_win2k()) /* Test is interactive on w2k, so skip */
- {
- CMINVOKECOMMANDINFO cmi;
- ZeroMemory(&cmi, sizeof(CMINVOKECOMMANDINFO));
- cmi.cbSize = sizeof(CMINVOKECOMMANDINFO);
-
- /* Attempt to execute a nonexistent command */
- cmi.lpVerb = MAKEINTRESOURCEA(9999);
- hr = IContextMenu_InvokeCommand(pcm, &cmi);
- ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr);
-
- cmi.lpVerb = "foobar_wine_test";
- hr = IContextMenu_InvokeCommand(pcm, &cmi);
- ok( (hr == E_INVALIDARG) || (hr == E_FAIL /* Win7 */) ||
- (hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) /* Vista */),
- "Got 0x%08x\n", hr);
- }
-#undef is_win2k
+ /* Item menu */
+ hr = IShellFolder_GetUIObjectOf(psf, NULL, 1, &pidl_child, &IID_IContextMenu, NULL, (void **)&pcm);
+ ok(hr == S_OK, "GetUIObjectOf() failed, hr %#x.\n", hr);
+ test_contextmenu(pcm, FALSE);
+ IContextMenu_Release(pcm);
- DestroyMenu(hmenu);
- IContextMenu_Release(pcm);
- }
- IShellFolder_Release(psf);
- }
- if(pILFree) pILFree(pidl);
- }
+ /* Background menu */
+ hr = IShellFolder_GetUIObjectOf(psf_desktop, NULL, 0, NULL, &IID_IContextMenu, NULL, (void **)&pcm);
+ ok(hr == S_OK, "GetUIObjectOf() failed, hr %#x.\n", hr);
+ test_contextmenu(pcm, TRUE);
+ IContextMenu_Release(pcm);
+
+ IShellFolder_Release(psf);
+ ILFree(pidl);
IShellFolder_Release(psf_desktop);
Cleanup();
STRRET filename;
HRESULT hr;
- if(!pSHBindToParent){
- win_skip("SHBindToParent is not available, not performing full PIDL verification\n");
- if(path)
- ok_(__FILE__,l)(pidl != NULL, "Expected PIDL to be non-NULL\n");
- else
- ok_(__FILE__,l)(pidl == NULL, "Expected PIDL to be NULL\n");
- return;
- }
-
if(path){
if(!pidl){
ok_(__FILE__,l)(0, "didn't get expected path (%s), instead: NULL\n", wine_dbgstr_w(path));
return;
}
- hr = pSHBindToParent(pidl, &IID_IShellFolder, (LPVOID*)&parent, &child);
+ hr = SHBindToParent(pidl, &IID_IShellFolder, (void **)&parent, &child);
ok_(__FILE__,l)(hr == S_OK, "SHBindToParent failed: 0x%08x\n", hr);
if(FAILED(hr))
return;
LPITEMIDLIST pidl = NULL;
- if(!pSHSimpleIDListFromPathAW){
- win_skip("SHSimpleIDListFromPathAW not available\n");
- return;
- }
-
br = CreateDirectoryA(adirA, NULL);
ok(br == TRUE, "CreateDirectory failed: %d\n", GetLastError());
if(is_unicode)
- pidl = pSHSimpleIDListFromPathAW(adirW);
+ pidl = SHSimpleIDListFromPath(adirW);
else
- pidl = pSHSimpleIDListFromPathAW(adirA);
+ pidl = SHSimpleIDListFromPath((const WCHAR *)adirA);
verify_pidl(pidl, adirW);
- pILFree(pidl);
+ ILFree(pidl);
br = RemoveDirectoryA(adirA);
ok(br == TRUE, "RemoveDirectory failed: %d\n", GetLastError());
if(is_unicode)
- pidl = pSHSimpleIDListFromPathAW(adirW);
+ pidl = SHSimpleIDListFromPath(adirW);
else
- pidl = pSHSimpleIDListFromPathAW(adirA);
+ pidl = SHSimpleIDListFromPath((const WCHAR *)adirA);
verify_pidl(pidl, adirW);
- pILFree(pidl);
+ ILFree(pidl);
}
/* IFileSystemBindData impl */
/* fails on unknown dir with no IBindCtx */
hres = IShellFolder_ParseDisplayName(psf, NULL, NULL, adirW, NULL, &pidl, NULL);
- ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */,
- "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
+ ok(hres == exp_err, "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
hres = IShellFolder_ParseDisplayName(psf, NULL, NULL, afileW, NULL, &pidl, NULL);
- ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */,
- "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
+ ok(hres == exp_err, "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
hres = IShellFolder_ParseDisplayName(psf, NULL, NULL, afile2W, NULL, &pidl, NULL);
- ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */,
- "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
+ ok(hres == exp_err, "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
/* fails on unknown dir with IBindCtx with no IFileSystemBindData */
hres = CreateBindCtx(0, &pbc);
ok(hres == S_OK, "CreateBindCtx failed: 0x%08x\n", hres);
hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, adirW, NULL, &pidl, NULL);
- ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */,
- "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
+ ok(hres == exp_err, "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afileW, NULL, &pidl, NULL);
- ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */,
- "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
+ ok(hres == exp_err, "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afile2W, NULL, &pidl, NULL);
- ok(hres == exp_err || broken(hres == E_FAIL) /* NT4 */,
- "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
+ ok(hres == exp_err, "ParseDisplayName failed with wrong error: 0x%08x\n", hres);
/* unknown dir with IBindCtx with IFileSystemBindData */
hres = IBindCtx_RegisterObjectParam(pbc, wFileSystemBindData, (IUnknown*)&fsbd);
pidl = (ITEMIDLIST*)0xdeadbeef;
fsbdVtbl.GetFindData = fsbd_GetFindData_fail;
hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, adirW, NULL, &pidl, NULL);
- ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
- "ParseDisplayName failed: 0x%08x\n", hres);
+ ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
if(SUCCEEDED(hres)){
verify_pidl(pidl, adirW);
ILFree(pidl);
}
hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afileW, NULL, &pidl, NULL);
- ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
- "ParseDisplayName failed: 0x%08x\n", hres);
+ ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
if(SUCCEEDED(hres)){
verify_pidl(pidl, afileW);
ILFree(pidl);
}
hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afile2W, NULL, &pidl, NULL);
- ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
- "ParseDisplayName failed: 0x%08x\n", hres);
+ ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
if(SUCCEEDED(hres)){
verify_pidl(pidl, afile2W);
ILFree(pidl);
pidl = (ITEMIDLIST*)0xdeadbeef;
fsbdVtbl.GetFindData = fsbd_GetFindData_nul;
hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, adirW, NULL, &pidl, NULL);
- ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
- "ParseDisplayName failed: 0x%08x\n", hres);
+ ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
if(SUCCEEDED(hres)){
verify_pidl(pidl, adirW);
ILFree(pidl);
}
hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afileW, NULL, &pidl, NULL);
- ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
- "ParseDisplayName failed: 0x%08x\n", hres);
+ ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
if(SUCCEEDED(hres)){
verify_pidl(pidl, afileW);
ILFree(pidl);
}
hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afile2W, NULL, &pidl, NULL);
- ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
- "ParseDisplayName failed: 0x%08x\n", hres);
+ ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
if(SUCCEEDED(hres)){
verify_pidl(pidl, afile2W);
ILFree(pidl);
pidl = (ITEMIDLIST*)0xdeadbeef;
fsbdVtbl.GetFindData = fsbd_GetFindData_junk;
hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, adirW, NULL, &pidl, NULL);
- ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
- "ParseDisplayName failed: 0x%08x\n", hres);
+ ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
if(SUCCEEDED(hres)){
verify_pidl(pidl, adirW);
ILFree(pidl);
}
hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afileW, NULL, &pidl, NULL);
- ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
- "ParseDisplayName failed: 0x%08x\n", hres);
+ ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
if(SUCCEEDED(hres)){
verify_pidl(pidl, afileW);
ILFree(pidl);
}
hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afile2W, NULL, &pidl, NULL);
- ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
- "ParseDisplayName failed: 0x%08x\n", hres);
+ ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
if(SUCCEEDED(hres)){
verify_pidl(pidl, afile2W);
ILFree(pidl);
pidl = (ITEMIDLIST*)0xdeadbeef;
fsbdVtbl.GetFindData = fsbd_GetFindData_invalid;
hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, adirW, NULL, &pidl, NULL);
- ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
- "ParseDisplayName failed: 0x%08x\n", hres);
+ ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
if(SUCCEEDED(hres)){
verify_pidl(pidl, adirW);
ILFree(pidl);
}
hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afileW, NULL, &pidl, NULL);
- ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
- "ParseDisplayName failed: 0x%08x\n", hres);
+ ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
if(SUCCEEDED(hres)){
verify_pidl(pidl, afileW);
ILFree(pidl);
}
hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afile2W, NULL, &pidl, NULL);
- ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
- "ParseDisplayName failed: 0x%08x\n", hres);
+ ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
if(SUCCEEDED(hres)){
verify_pidl(pidl, afile2W);
ILFree(pidl);
pidl = (ITEMIDLIST*)0xdeadbeef;
fsbdVtbl.GetFindData = fsbd_GetFindData_valid;
hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, adirW, NULL, &pidl, NULL);
- ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
- "ParseDisplayName failed: 0x%08x\n", hres);
+ ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
if(SUCCEEDED(hres)){
verify_pidl(pidl, adirW);
ILFree(pidl);
}
hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afileW, NULL, &pidl, NULL);
- ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
- "ParseDisplayName failed: 0x%08x\n", hres);
+ ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
if(SUCCEEDED(hres)){
verify_pidl(pidl, afileW);
ILFree(pidl);
}
hres = IShellFolder_ParseDisplayName(psf, NULL, pbc, afile2W, NULL, &pidl, NULL);
- ok(hres == S_OK || broken(hres == E_FAIL) /* NT4 */,
- "ParseDisplayName failed: 0x%08x\n", hres);
+ ok(hres == S_OK, "ParseDisplayName failed: 0x%08x\n", hres);
if(SUCCEEDED(hres)){
verify_pidl(pidl, afile2W);
ILFree(pidl);
path2 = make_wstr(exp_data->path_2);
verify_pidl(pidls[0], path1);
verify_pidl(pidls[1], path2);
- HeapFree(GetProcessHeap(), 0, path1);
- HeapFree(GetProcessHeap(), 0, path2);
+ heap_free(path1);
+ heap_free(path2);
exp_data->missing_events--;
entries[0].pidl = NULL;
if(has_unicode)
- hr = pSHILCreateFromPath(root_dirW, (LPITEMIDLIST*)&entries[0].pidl, 0);
+ hr = SHILCreateFromPath(root_dirW, (LPITEMIDLIST*)&entries[0].pidl, 0);
else
- hr = pSHILCreateFromPath((LPCVOID)root_dirA, (LPITEMIDLIST*)&entries[0].pidl, 0);
+ hr = SHILCreateFromPath((const void *)root_dirA, (LPITEMIDLIST*)&entries[0].pidl, 0);
ok(hr == S_OK, "SHILCreateFromPath failed: 0x%08x\n", hr);
entries[0].fRecursive = TRUE;
SHCNE_ALLEVENTS, WM_USER_NOTIFY, 1, entries);
ok(notifyID != 0, "Failed to register a window for change notifications\n");
- for(i = 0; i < sizeof(chnotify_tests) / sizeof(*chnotify_tests); ++i){
+ for (i = 0; i < ARRAY_SIZE(chnotify_tests); ++i)
+ {
exp_data = chnotify_tests + i;
exp_data->missing_events = exp_data->notify_count;
do_events();
ok(exp_data->missing_events == 0, "%s: Expected wndproc to be called\n", exp_data->id);
- HeapFree(GetProcessHeap(), 0, path1);
- HeapFree(GetProcessHeap(), 0, path2);
+ heap_free(path1);
+ heap_free(path2);
}
}
return;
}
- if(!pSHBindToParent)
- {
- skip("SHBindToParent missing.\n");
- return;
- }
-
GetCurrentDirectoryW(MAX_PATH, path);
if (!path[0])
{
CreateFilesFolders();
hr = IShellFolder_ParseDisplayName(desktop, NULL, NULL, path, NULL, &pidl, 0);
- ok(hr == S_OK || broken(hr == E_FAIL) /* WinME */, "Got 0x%08x\n", hr);
+ ok(hr == S_OK, "Got 0x%08x\n", hr);
if(SUCCEEDED(hr))
{
-
- hr = pSHBindToParent(pidl, &IID_IShellFolder, (void**)&folder, (LPCITEMIDLIST*)&pidl_child);
+ hr = SHBindToParent(pidl, &IID_IShellFolder, (void **)&folder, (const ITEMIDLIST **)&pidl_child);
ok(hr == S_OK, "Got 0x%08x\n", hr);
IShellFolder_QueryInterface(folder,&IID_IPersistFolder2,(void**)&persist);
IPersistFolder2_Release(persist);
if(SUCCEEDED(hr))
{
-
cminfo.hwnd=NULL;
cminfo.pcmcb=NULL;
cminfo.psf=folder;
cminfo.aKeys=NULL;
cminfo.cKeys=0;
cminfo.punkAssociationInfo=NULL;
+
hr = pSHCreateDefaultContextMenu(&cminfo,&IID_IContextMenu,(void**)&cmenu);
ok(hr==S_OK,"Got 0x%08x\n", hr);
+ test_contextmenu_qi(cmenu, TRUE);
IContextMenu_Release(cmenu);
+
cminfo.pidlFolder=pidlFolder;
hr = pSHCreateDefaultContextMenu(&cminfo,&IID_IContextMenu,(void**)&cmenu);
ok(hr==S_OK,"Got 0x%08x\n", hr);
+ test_contextmenu_qi(cmenu, TRUE);
IContextMenu_Release(cmenu);
+
status = RegOpenKeyExA(HKEY_CLASSES_ROOT,"*",0,KEY_READ,keys);
if(status==ERROR_SUCCESS){
for(i=1;i<16;i++)
hres = IShellFolder_GetUIObjectOf(desktop, NULL, 1, (LPCITEMIDLIST*)&apidl,
&IID_IDataObject, NULL, (void**)&data_obj);
ok(hres == S_OK, "got %x\n", hres);
- pILFree(apidl);
+ ILFree(apidl);
IShellFolder_Release(desktop);
cf_shellidlist = RegisterClipboardFormatW(CFSTR_SHELLIDLISTW);
IDataObject_Release(data_obj);
}
+static void test_GetDefaultColumn(void)
+{
+ static const CLSID *folders[] =
+ {
+ &CLSID_MyComputer,
+ &CLSID_MyDocuments,
+ &CLSID_ControlPanel,
+ &CLSID_NetworkPlaces,
+ &CLSID_Printers,
+ &CLSID_RecycleBin,
+ &CLSID_ShellDesktop,
+ };
+ HRESULT hr;
+ int i;
+
+ CoInitialize(NULL);
+
+ for (i = 0; i < ARRAY_SIZE(folders); i++)
+ {
+ IShellFolder2 *folder;
+ ULONG sort, display;
+
+ hr = CoCreateInstance(folders[i], NULL, CLSCTX_INPROC_SERVER, &IID_IShellFolder2, (void **)&folder);
+ if (hr != S_OK)
+ {
+ win_skip("Failed to create folder %s, hr %#x.\n", wine_dbgstr_guid(folders[i]), hr);
+ continue;
+ }
+
+ hr = IShellFolder2_GetDefaultColumn(folder, 0, NULL, NULL);
+ ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+
+ sort = display = 123;
+ hr = IShellFolder2_GetDefaultColumn(folder, 0, &sort, &display);
+ ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+ ok(sort == 123 && display == 123, "Unexpected default column.\n");
+
+ display = 123;
+ hr = IShellFolder2_GetDefaultColumn(folder, 0, NULL, &display);
+ ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+ ok(display == 123, "Unexpected default column.\n");
+
+ sort = 123;
+ hr = IShellFolder2_GetDefaultColumn(folder, 0, &sort, NULL);
+ ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+ ok(sort == 123, "Unexpected default column.\n");
+
+ IShellFolder2_Release(folder);
+ }
+
+ CoUninitialize();
+}
+
+static void test_GetDefaultSearchGUID(void)
+{
+ static const CLSID *folders[] =
+ {
+ &CLSID_MyComputer,
+ &CLSID_MyDocuments,
+ &CLSID_ControlPanel,
+ &CLSID_NetworkPlaces,
+ &CLSID_Printers,
+ &CLSID_RecycleBin,
+ &CLSID_ShellDesktop,
+ };
+ HRESULT hr;
+ int i;
+
+ CoInitialize(NULL);
+
+ for (i = 0; i < ARRAY_SIZE(folders); i++)
+ {
+ IShellFolder2 *folder;
+ GUID guid;
+
+ hr = CoCreateInstance(folders[i], NULL, CLSCTX_INPROC_SERVER, &IID_IShellFolder2, (void **)&folder);
+ if (hr != S_OK)
+ {
+ win_skip("Failed to create folder %s, hr %#x.\n", wine_dbgstr_guid(folders[i]), hr);
+ continue;
+ }
+
+ if (0)
+ {
+ /* crashes on XP */
+ hr = IShellFolder2_GetDefaultSearchGUID(folder, NULL);
+ ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+ }
+
+ memcpy(&guid, &CLSID_MyComputer, sizeof(guid));
+ hr = IShellFolder2_GetDefaultSearchGUID(folder, &guid);
+ ok(hr == E_NOTIMPL || broken(hr == S_OK) /* Method was last supported on XP */, "Unexpected hr %#x.\n", hr);
+ if (hr == E_NOTIMPL)
+ ok(IsEqualGUID(&guid, &CLSID_MyComputer), "Unexpected guid %s.\n", wine_dbgstr_guid(&guid));
+
+ IShellFolder2_Release(folder);
+ }
+
+ CoUninitialize();
+}
+
+static void test_SHLimitInputEdit(void)
+{
+ IShellFolder *desktop;
+ HRESULT hr;
+ HWND hwnd;
+
+ hr = SHGetDesktopFolder(&desktop);
+ ok(hr == S_OK, "Failed to get desktop folder, hr %#x.\n", hr);
+
+ hr = SHLimitInputEdit(NULL, desktop);
+todo_wine
+ ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr);
+
+ hwnd = CreateWindowA("EDIT", NULL, WS_VISIBLE, 0, 0, 100, 30, NULL, NULL, NULL, NULL);
+ ok(hwnd != NULL, "Failed to create Edit control.\n");
+
+ hr = SHLimitInputEdit(hwnd, desktop);
+todo_wine
+ ok(hr == S_OK, "Failed to set input limits, hr %#x.\n", hr);
+
+ hr = SHLimitInputEdit(hwnd, desktop);
+todo_wine
+ ok(hr == S_OK, "Failed to set input limits, hr %#x.\n", hr);
+
+ DestroyWindow(hwnd);
+ IShellFolder_Release(desktop);
+}
+
+static void test_SHGetSetFolderCustomSettings(void)
+{
+ HRESULT hr;
+ SHFOLDERCUSTOMSETTINGS fcs;
+ WCHAR pathW[MAX_PATH];
+ WCHAR bufferW[MAX_PATH];
+ WCHAR iconpathW[MAX_PATH];
+ static const WCHAR somedirW[] = {'s','o','m','e','_','d','i','r',0};
+ static const WCHAR iconW[] = {'\\','s','o','m','e','_','i','c','o','n','.','i','c','o',0};
+ static const WCHAR desktop_iniW[] = {'\\','D','e','s','k','t','o','p','.','i','n','i',0};
+
+ if (!pSHGetSetFolderCustomSettings)
+ {
+ win_skip("SHGetSetFolderCustomSetting not exported by name (only by ordinal) for version XP/win2003\n");
+ return;
+ }
+
+ GetTempPathW(MAX_PATH, pathW);
+ lstrcatW(pathW, somedirW);
+ CreateDirectoryW(pathW, NULL);
+
+ lstrcpyW(iconpathW, pathW);
+ lstrcatW(iconpathW, iconW);
+
+ memset(&fcs, 0, sizeof(fcs));
+ fcs.dwSize = sizeof(fcs);
+ fcs.dwMask = FCSM_ICONFILE;
+ fcs.pszIconFile = iconpathW;
+
+ hr = pSHGetSetFolderCustomSettings(&fcs, pathW, FCS_FORCEWRITE); /*creates and writes to a Desktop.ini*/
+ ok(hr == S_OK, "Expected S_OK, got %#x\n", hr);
+
+ memset(&fcs, 0, sizeof(fcs));
+ fcs.dwSize = sizeof(fcs);
+ fcs.dwMask = FCSM_ICONFILE;
+ fcs.cchIconFile = MAX_PATH;
+ fcs.pszIconFile = bufferW;
+ bufferW[0] = 0;
+
+ hr = pSHGetSetFolderCustomSettings(&fcs, pathW, FCS_READ);
+ todo_wine ok(hr == S_OK, "Expected S_OK, got %#x\n", hr);
+ todo_wine ok(!lstrcmpiW(iconpathW, fcs.pszIconFile), "Expected %s, got %s\n", wine_dbgstr_w(iconpathW), wine_dbgstr_w(fcs.pszIconFile));
+
+ hr = pSHGetSetFolderCustomSettings(&fcs, NULL, FCS_READ);
+ ok(hr == E_FAIL, "Expected E_FAIL, got %#x\n", hr);
+
+ lstrcpyW(bufferW, pathW);
+ lstrcatW(bufferW, desktop_iniW);
+ DeleteFileW(bufferW);
+ RemoveDirectoryW(pathW);
+}
+
START_TEST(shlfolder)
{
init_function_pointers();
/* if OleInitialize doesn't get called, ParseDisplayName returns
- CO_E_NOTINITIALIZED for malformed directory names on win2k. */
+ CO_E_NOTINITIALIZED for malformed directory names */
OleInitialize(NULL);
test_ParseDisplayName();
test_ShellItemArrayGetAttributes();
test_SHCreateDefaultContextMenu();
test_DataObject();
+ test_GetDefaultColumn();
+ test_GetDefaultSearchGUID();
+ test_SHLimitInputEdit();
+ test_SHGetSetFolderCustomSettings();
OleUninitialize();
}