shell32/tests: Use more A-functions to fix Win95 and actually test correctly on Win9x.
This commit is contained in:
parent
cb0d7276c1
commit
5680cf6293
|
@ -440,15 +440,15 @@ static void test_BindToObject(void)
|
||||||
WCHAR wszSystemDir[MAX_PATH];
|
WCHAR wszSystemDir[MAX_PATH];
|
||||||
char szSystemDir[MAX_PATH];
|
char szSystemDir[MAX_PATH];
|
||||||
char buf[MAX_PATH];
|
char buf[MAX_PATH];
|
||||||
WCHAR cwd[MAX_PATH];
|
|
||||||
WCHAR path[MAX_PATH];
|
WCHAR path[MAX_PATH];
|
||||||
|
CHAR pathA[MAX_PATH];
|
||||||
HANDLE hfile;
|
HANDLE hfile;
|
||||||
WCHAR wszMyComputer[] = {
|
WCHAR wszMyComputer[] = {
|
||||||
':',':','{','2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-',
|
':',':','{','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 };
|
'A','2','D','8','-','0','8','0','0','2','B','3','0','3','0','9','D','}',0 };
|
||||||
static const WCHAR filename_html[] = {'w','i','n','e','t','e','s','t','.','h','t','m','l',0};
|
static const CHAR filename_html[] = "winetest.html";
|
||||||
static const WCHAR filename_txt[] = {'w','i','n','e','t','e','s','t','.','t','x','t',0};
|
static const CHAR filename_txt[] = "winetest.txt";
|
||||||
static const WCHAR filename_foo[] = {'w','i','n','e','t','e','s','t','.','f','o','o',0};
|
static const CHAR filename_foo[] = "winetest.foo";
|
||||||
|
|
||||||
/* The following tests shows that BindToObject should fail with E_INVALIDARG if called
|
/* The following tests shows that BindToObject should fail with E_INVALIDARG if called
|
||||||
* with an empty pidl. This is tested for Desktop, MyComputer and the FS ShellFolder
|
* with an empty pidl. This is tested for Desktop, MyComputer and the FS ShellFolder
|
||||||
|
@ -527,35 +527,35 @@ if (0)
|
||||||
skip("Failed to get current directory, skipping tests.\n");
|
skip("Failed to get current directory, skipping tests.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MultiByteToWideChar(CP_ACP, 0, buf, -1, cwd, MAX_PATH);
|
|
||||||
|
|
||||||
SHGetDesktopFolder(&psfDesktop);
|
SHGetDesktopFolder(&psfDesktop);
|
||||||
|
|
||||||
/* Attempt BindToObject on files. */
|
/* Attempt BindToObject on files. */
|
||||||
|
|
||||||
/* .html */
|
/* .html */
|
||||||
lstrcpyW(path, cwd);
|
lstrcpyA(pathA, buf);
|
||||||
myPathAddBackslashW(path);
|
lstrcatA(pathA, "\\");
|
||||||
lstrcatW(path, filename_html);
|
lstrcatA(pathA, filename_html);
|
||||||
hfile = CreateFileW(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
hfile = CreateFileA(pathA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
||||||
if(hfile != (HANDLE)INVALID_FILE_ATTRIBUTES)
|
if(hfile != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
CloseHandle(hfile);
|
CloseHandle(hfile);
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH);
|
||||||
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL);
|
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL);
|
||||||
ok(hr == S_OK ||
|
ok(hr == S_OK, "Got 0x%08x\n", hr);
|
||||||
broken(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) /* Win98SE */ ||
|
|
||||||
broken(hr == E_FAIL) /* Win95 */,
|
|
||||||
"Got 0x%08x\n", hr);
|
|
||||||
if(SUCCEEDED(hr))
|
if(SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild);
|
hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild);
|
||||||
ok(hr == S_OK /* Win 7 */ || hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) /* WinXP */,
|
ok(hr == S_OK ||
|
||||||
|
hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP, W2K3 */
|
||||||
"Got 0x%08x\n", hr);
|
"Got 0x%08x\n", hr);
|
||||||
if(SUCCEEDED(hr))
|
if(SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
IPersist *pp;
|
IPersist *pp;
|
||||||
hr = IShellFolder_QueryInterface(psfChild, &IID_IPersist, (void**)&pp);
|
hr = IShellFolder_QueryInterface(psfChild, &IID_IPersist, (void**)&pp);
|
||||||
ok(hr == S_OK || broken(hr == E_NOINTERFACE) /* W2K */, "Got 0x%08x\n", hr);
|
ok(hr == S_OK ||
|
||||||
|
broken(hr == E_NOINTERFACE), /* Win9x, NT4, W2K */
|
||||||
|
"Got 0x%08x\n", hr);
|
||||||
if(SUCCEEDED(hr))
|
if(SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
CLSID id;
|
CLSID id;
|
||||||
|
@ -569,114 +569,113 @@ if (0)
|
||||||
}
|
}
|
||||||
pILFree(pidl);
|
pILFree(pidl);
|
||||||
}
|
}
|
||||||
DeleteFileW(path);
|
DeleteFileA(pathA);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
win_skip("Failed to create .html testfile.\n");
|
win_skip("Failed to create .html testfile.\n");
|
||||||
|
|
||||||
/* .txt */
|
/* .txt */
|
||||||
lstrcpyW(path, cwd);
|
lstrcpyA(pathA, buf);
|
||||||
myPathAddBackslashW(path);
|
lstrcatA(pathA, "\\");
|
||||||
lstrcatW(path, filename_txt);
|
lstrcatA(pathA, filename_txt);
|
||||||
hfile = CreateFileW(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
hfile = CreateFileA(pathA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
||||||
if(hfile != (HANDLE)INVALID_FILE_ATTRIBUTES)
|
if(hfile != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
CloseHandle(hfile);
|
CloseHandle(hfile);
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH);
|
||||||
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL);
|
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL);
|
||||||
ok(hr == S_OK ||
|
ok(hr == S_OK, "Got 0x%08x\n", hr);
|
||||||
broken(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) /* Win98SE */ ||
|
|
||||||
broken(hr == E_FAIL) /* Win95 */,
|
|
||||||
"Got 0x%08x\n", hr);
|
|
||||||
if(SUCCEEDED(hr))
|
if(SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild);
|
hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild);
|
||||||
ok(hr == E_FAIL || hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)
|
ok(hr == E_FAIL || /* Vista+ */
|
||||||
|| broken(hr == S_OK) /* W2K */,
|
hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || /* XP, W2K3 */
|
||||||
|
broken(hr == S_OK), /* Win9x, NT4, W2K */
|
||||||
"Got 0x%08x\n", hr);
|
"Got 0x%08x\n", hr);
|
||||||
if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
|
if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
|
||||||
pILFree(pidl);
|
pILFree(pidl);
|
||||||
}
|
}
|
||||||
DeleteFileW(path);
|
DeleteFileA(pathA);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
win_skip("Failed to create .txt testfile.\n");
|
win_skip("Failed to create .txt testfile.\n");
|
||||||
|
|
||||||
/* .foo */
|
/* .foo */
|
||||||
lstrcpyW(path, cwd);
|
lstrcpyA(pathA, buf);
|
||||||
myPathAddBackslashW(path);
|
lstrcatA(pathA, "\\");
|
||||||
lstrcatW(path, filename_foo);
|
lstrcatA(pathA, filename_foo);
|
||||||
hfile = CreateFileW(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
hfile = CreateFileA(pathA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
||||||
if(hfile != (HANDLE)INVALID_FILE_ATTRIBUTES)
|
if(hfile != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
CloseHandle(hfile);
|
CloseHandle(hfile);
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH);
|
||||||
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL);
|
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL);
|
||||||
ok(hr == S_OK ||
|
ok(hr == S_OK, "Got 0x%08x\n", hr);
|
||||||
broken(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) /* Win98SE */ ||
|
|
||||||
broken(hr == E_FAIL) /* Win95 */,
|
|
||||||
"Got 0x%08x\n", hr);
|
|
||||||
if(SUCCEEDED(hr))
|
if(SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild);
|
hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild);
|
||||||
ok(hr == E_FAIL || hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)
|
ok(hr == E_FAIL || /* Vista+ */
|
||||||
|| broken(hr == S_OK) /* W2K */,
|
hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || /* XP, W2K3 */
|
||||||
|
broken(hr == S_OK), /* Win9x, NT4, W2K */
|
||||||
"Got 0x%08x\n", hr);
|
"Got 0x%08x\n", hr);
|
||||||
if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
|
if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
|
||||||
pILFree(pidl);
|
pILFree(pidl);
|
||||||
}
|
}
|
||||||
DeleteFileW(path);
|
DeleteFileA(pathA);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
win_skip("Failed to create .foo testfile.\n");
|
win_skip("Failed to create .foo testfile.\n");
|
||||||
|
|
||||||
/* And on the desktop */
|
/* And on the desktop */
|
||||||
if(pSHGetSpecialFolderPathW)
|
if(pSHGetSpecialFolderPathA)
|
||||||
{
|
{
|
||||||
|
pSHGetSpecialFolderPathA(NULL, pathA, CSIDL_DESKTOP, FALSE);
|
||||||
pSHGetSpecialFolderPathW(NULL, path, CSIDL_DESKTOP, FALSE);
|
lstrcatA(pathA, "\\");
|
||||||
myPathAddBackslashW(path);
|
lstrcatA(pathA, filename_html);
|
||||||
lstrcatW(path, filename_html);
|
hfile = CreateFileA(pathA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
||||||
hfile = CreateFileW(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
if(hfile != INVALID_HANDLE_VALUE)
|
||||||
if(hfile != (HANDLE)INVALID_FILE_ATTRIBUTES)
|
|
||||||
{
|
{
|
||||||
CloseHandle(hfile);
|
CloseHandle(hfile);
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH);
|
||||||
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL);
|
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL);
|
||||||
ok(hr == S_OK || broken(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) /* Win98SE */,
|
ok(hr == S_OK, "Got 0x%08x\n", hr);
|
||||||
"Got 0x%08x\n", hr);
|
|
||||||
if(SUCCEEDED(hr))
|
if(SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild);
|
hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild);
|
||||||
ok(hr == S_OK || hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
|
ok(hr == S_OK ||
|
||||||
|
hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP, W2K3 */
|
||||||
"Got 0x%08x\n", hr);
|
"Got 0x%08x\n", hr);
|
||||||
if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
|
if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
|
||||||
pILFree(pidl);
|
pILFree(pidl);
|
||||||
}
|
}
|
||||||
if(!DeleteFileW(path))
|
if(!DeleteFileA(pathA))
|
||||||
trace("Failed to delete: %d\n", GetLastError());
|
trace("Failed to delete: %d\n", GetLastError());
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
win_skip("Failed to create .html testfile.\n");
|
win_skip("Failed to create .html testfile.\n");
|
||||||
|
|
||||||
pSHGetSpecialFolderPathW(NULL, path, CSIDL_DESKTOP, FALSE);
|
pSHGetSpecialFolderPathA(NULL, pathA, CSIDL_DESKTOP, FALSE);
|
||||||
myPathAddBackslashW(path);
|
lstrcatA(pathA, "\\");
|
||||||
lstrcatW(path, filename_foo);
|
lstrcatA(pathA, filename_foo);
|
||||||
hfile = CreateFileW(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
hfile = CreateFileA(pathA, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
||||||
if(hfile != (HANDLE)INVALID_FILE_ATTRIBUTES)
|
if(hfile != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
CloseHandle(hfile);
|
CloseHandle(hfile);
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, pathA, -1, path, MAX_PATH);
|
||||||
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL);
|
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, path, NULL, &pidl, NULL);
|
||||||
ok(hr == S_OK || broken(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) /* Win98SE */,
|
ok(hr == S_OK, "Got 0x%08x\n", hr);
|
||||||
"Got 0x%08x\n", hr);
|
|
||||||
if(SUCCEEDED(hr))
|
if(SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild);
|
hr = IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (void**)&psfChild);
|
||||||
ok(hr == E_FAIL || hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)
|
ok(hr == E_FAIL || /* Vista+ */
|
||||||
|| broken(hr == S_OK) /* W2K */,
|
hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || /* XP, W2K3 */
|
||||||
|
broken(hr == S_OK), /* Win9x, NT4, W2K */
|
||||||
"Got 0x%08x\n", hr);
|
"Got 0x%08x\n", hr);
|
||||||
if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
|
if(SUCCEEDED(hr)) IShellFolder_Release(psfChild);
|
||||||
pILFree(pidl);
|
pILFree(pidl);
|
||||||
}
|
}
|
||||||
DeleteFileW(path);
|
DeleteFileA(pathA);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
win_skip("Failed to create .foo testfile.\n");
|
win_skip("Failed to create .foo testfile.\n");
|
||||||
|
|
Loading…
Reference in New Issue