[SHELL32_WINETEST]: Sync with Wine 1.5.19.

svn path=/trunk/; revision=57858
This commit is contained in:
Amine Khaldi 2012-12-09 22:05:54 +00:00
parent 6b1996b292
commit 2aac2655db
9 changed files with 1066 additions and 496 deletions

View file

@ -1,9 +1,7 @@
remove_definitions(-DWINVER=0x502 -D_WIN32_IE=0x600 -D_WIN32_WINNT=0x502)
add_definitions(
-D__ROS_LONG64__
-D_DLL -D__USE_CRTIMP)
add_definitions(-D__ROS_LONG64__)
list(APPEND SOURCE
appbar.c
@ -12,7 +10,7 @@ list(APPEND SOURCE
brsfolder.c
ebrowser.c
generated.c
#progman_dde.c FIXME: bug 7233
#progman_dde.c FIXME: CORE-6559
recyclebin.c
shelldispatch.c
shelllink.c

View file

@ -43,19 +43,19 @@ static void test_IQueryAssociations_QueryInterface(void)
return;
}
hr = IUnknown_QueryInterface(qa, &IID_IQueryAssociations, (void**)&qa2);
hr = IQueryAssociations_QueryInterface(qa, &IID_IQueryAssociations, (void**)&qa2);
ok(hr == S_OK, "QueryInterface (IQueryAssociations) returned 0x%x\n", hr);
if (SUCCEEDED(hr)) {
IUnknown_Release(qa2);
IQueryAssociations_Release(qa2);
}
hr = IUnknown_QueryInterface(qa, &IID_IUnknown, (void**)&unk);
hr = IQueryAssociations_QueryInterface(qa, &IID_IUnknown, (void**)&unk);
ok(hr == S_OK, "QueryInterface (IUnknown) returned 0x%x\n", hr);
if (SUCCEEDED(hr)) {
IUnknown_Release(unk);
}
hr = IUnknown_QueryInterface(qa, &IID_IUnknown, NULL);
hr = IQueryAssociations_QueryInterface(qa, &IID_IUnknown, NULL);
ok(hr == E_POINTER, "got 0x%x (expected E_POINTER)\n", hr);
IQueryAssociations_Release(qa);
@ -78,19 +78,20 @@ static void test_IApplicationAssociationRegistration_QueryInterface(void)
return;
}
hr = IUnknown_QueryInterface(appreg, &IID_IApplicationAssociationRegistration, (void**)&appreg2);
hr = IApplicationAssociationRegistration_QueryInterface(appreg, &IID_IApplicationAssociationRegistration,
(void**)&appreg2);
ok(hr == S_OK, "QueryInterface (IApplicationAssociationRegistration) returned 0x%x\n", hr);
if (SUCCEEDED(hr)) {
IUnknown_Release(appreg2);
IApplicationAssociationRegistration_Release(appreg2);
}
hr = IUnknown_QueryInterface(appreg, &IID_IUnknown, (void**)&unk);
hr = IApplicationAssociationRegistration_QueryInterface(appreg, &IID_IUnknown, (void**)&unk);
ok(hr == S_OK, "QueryInterface (IUnknown) returned 0x%x\n", hr);
if (SUCCEEDED(hr)) {
IUnknown_Release(unk);
}
hr = IUnknown_QueryInterface(appreg, &IID_IUnknown, NULL);
hr = IApplicationAssociationRegistration_QueryInterface(appreg, &IID_IUnknown, NULL);
ok(hr == E_POINTER, "got 0x%x (expected E_POINTER)\n", hr);
IApplicationAssociationRegistration_Release(appreg);

View file

@ -140,7 +140,7 @@ static void test_namespace(void)
p = path + lstrlenW(path);
while (path < p && *(p - 1) != '\\')
p--;
ok(!lstrcmpW(title, p), "expected %s, got %s\n",
ok(!lstrcmpiW(title, p), "expected %s, got %s\n",
wine_dbgstr_w(p), wine_dbgstr_w(title));
}
else skip("skipping Folder::get_Title test\n");
@ -157,7 +157,7 @@ static void test_namespace(void)
r = FolderItem_get_Path(item, &item_path);
ok(r == S_OK, "FolderItem::get_Path failed: %08x\n", r);
if (pSHGetFolderPathW)
ok(!lstrcmpW(item_path, path), "expected %s, got %s\n",
ok(!lstrcmpiW(item_path, path), "expected %s, got %s\n",
wine_dbgstr_w(path), wine_dbgstr_w(item_path));
SysFreeString(item_path);
FolderItem_Release(item);
@ -360,7 +360,7 @@ static void test_service(void)
ok(V_BOOL(&v) == VARIANT_FALSE, "got %d\n", V_BOOL(&v));
SysFreeString(name);
IShellDispatch_Release(sd);
IShellDispatch2_Release(sd);
}
START_TEST(shelldispatch)

View file

@ -16,9 +16,6 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
* This is a test program for the SHGet{Special}Folder{Path|Location} functions
* of shell32, that get either a filesystem path or a LPITEMIDLIST (shell
* namespace) path for a given folder (CSIDL value).
*
*/
@ -37,15 +34,10 @@
# define SLDF_HAS_LOGO3ID 0x00000800 /* not available in the Vista SDK */
#endif
typedef void (WINAPI *fnILFree)(LPITEMIDLIST);
typedef BOOL (WINAPI *fnILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST);
typedef HRESULT (WINAPI *fnSHILCreateFromPath)(LPCWSTR, LPITEMIDLIST *,DWORD*);
typedef HRESULT (WINAPI *fnSHDefExtractIconA)(LPCSTR, int, UINT, HICON*, HICON*, UINT);
static fnILFree pILFree;
static fnILIsEqual pILIsEqual;
static fnSHILCreateFromPath pSHILCreateFromPath;
static fnSHDefExtractIconA pSHDefExtractIconA;
static void (WINAPI *pILFree)(LPITEMIDLIST);
static BOOL (WINAPI *pILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST);
static HRESULT (WINAPI *pSHILCreateFromPath)(LPCWSTR, LPITEMIDLIST *,DWORD*);
static HRESULT (WINAPI *pSHDefExtractIconA)(LPCSTR, int, UINT, HICON*, HICON*, UINT);
static DWORD (WINAPI *pGetLongPathNameA)(LPCSTR, LPSTR, DWORD);
static DWORD (WINAPI *pGetShortPathNameA)(LPCSTR, LPSTR, DWORD);
@ -422,7 +414,7 @@ void create_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int save_fails)
lok(r == S_OK, "SetHotkey failed (0x%08x)\n", r);
}
r = IShellLinkW_QueryInterface(sl, &IID_IPersistFile, (LPVOID*)&pf);
r = IShellLinkA_QueryInterface(sl, &IID_IPersistFile, (void**)&pf);
lok(r == S_OK, "no IID_IPersistFile (0x%08x)\n", r);
if (r == S_OK)
{
@ -907,7 +899,7 @@ if (0)
LocalFree( dar );
IUnknown_Release( dl );
IShellLinkDataList_Release( dl );
IShellLinkW_Release( sl );
}
@ -1005,10 +997,10 @@ START_TEST(shelllink)
HMODULE hmod = GetModuleHandleA("shell32.dll");
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
pILFree = (fnILFree) GetProcAddress(hmod, (LPSTR)155);
pILIsEqual = (fnILIsEqual) GetProcAddress(hmod, (LPSTR)21);
pSHILCreateFromPath = (fnSHILCreateFromPath) GetProcAddress(hmod, (LPSTR)28);
pSHDefExtractIconA = (fnSHDefExtractIconA) GetProcAddress(hmod, "SHDefExtractIconA");
pILFree = (void *)GetProcAddress(hmod, (LPSTR)155);
pILIsEqual = (void *)GetProcAddress(hmod, (LPSTR)21);
pSHILCreateFromPath = (void *)GetProcAddress(hmod, (LPSTR)28);
pSHDefExtractIconA = (void *)GetProcAddress(hmod, "SHDefExtractIconA");
pGetLongPathNameA = (void *)GetProcAddress(hkernel32, "GetLongPathNameA");
pGetShortPathNameA = (void *)GetProcAddress(hkernel32, "GetShortPathNameA");

View file

@ -30,10 +30,11 @@
#include "shlguid.h"
#include "shlobj.h"
#include "shlwapi.h"
#include "initguid.h"
#include "knownfolders.h"
#include "wine/test.h"
#include "initguid.h"
/* CSIDL_MYDOCUMENTS is now the same as CSIDL_PERSONAL, but what we want
* here is its original value.
*/
@ -2494,6 +2495,157 @@ static void test_knownFolders(void)
CoUninitialize();
}
static void test_DoEnvironmentSubst(void)
{
WCHAR expectedW[MAX_PATH];
WCHAR bufferW[MAX_PATH];
CHAR expectedA[MAX_PATH];
CHAR bufferA[MAX_PATH];
DWORD res;
DWORD res2;
DWORD len;
INT i;
static const WCHAR does_not_existW[] = {'%','D','O','E','S','_','N','O','T','_','E','X','I','S','T','%',0};
static const CHAR does_not_existA[] = "%DOES_NOT_EXIST%";
static const CHAR *names[] = {
/* interactive apps and services (works on all windows versions) */
"%ALLUSERSPROFILE%", "%APPDATA%", "%LOCALAPPDATA%",
"%NUMBER_OF_PROCESSORS%", "%OS%", "%PROCESSOR_ARCHITECTURE%",
"%PROCESSOR_IDENTIFIER%", "%PROCESSOR_LEVEL%", "%PROCESSOR_REVISION%",
"%ProgramFiles%", "%SystemDrive%",
"%SystemRoot%", "%USERPROFILE%", "%windir%",
/* todo_wine: "%COMPUTERNAME%", "%ProgramData%", "%PUBLIC%", */
/* replace more than one var is allowed */
"%HOMEDRIVE%%HOMEPATH%",
"%OS% %windir%"}; /* always the last entry in the table */
for (i = 0; i < (sizeof(names)/sizeof(LPSTR)); i++)
{
memset(bufferA, '#', MAX_PATH - 1);
bufferA[MAX_PATH - 1] = 0;
lstrcpyA(bufferA, names[i]);
MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR));
res2 = ExpandEnvironmentStringsA(names[i], expectedA, MAX_PATH);
res = DoEnvironmentSubstA(bufferA, MAX_PATH);
/* is the space for the terminating 0 included? */
if (!i && HIWORD(res) && (LOWORD(res) == (lstrlenA(bufferA))))
{
win_skip("DoEnvironmentSubstA/W are broken on NT 4\n");
return;
}
ok(HIWORD(res) && (LOWORD(res) == res2),
"%d: got %d/%d (expected TRUE/%d)\n", i, HIWORD(res), LOWORD(res), res2);
ok(!lstrcmpA(bufferA, expectedA),
"%d: got %s (expected %s)\n", i, bufferA, expectedA);
res2 = ExpandEnvironmentStringsW(bufferW, expectedW, MAX_PATH);
res = DoEnvironmentSubstW(bufferW, MAX_PATH);
ok(HIWORD(res) && (LOWORD(res) == res2),
"%d: got %d/%d (expected TRUE/%d)\n", i, HIWORD(res), LOWORD(res), res2);
ok(!lstrcmpW(bufferW, expectedW),
"%d: got %s (expected %s)\n", i, wine_dbgstr_w(bufferW), wine_dbgstr_w(expectedW));
}
i--; /* reuse data in the last table entry */
len = LOWORD(res); /* needed length */
/* one character extra is fine */
memset(bufferA, '#', MAX_PATH - 1);
bufferA[len + 2] = 0;
lstrcpyA(bufferA, names[i]);
MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR));
res2 = ExpandEnvironmentStringsA(bufferA, expectedA, MAX_PATH);
res = DoEnvironmentSubstA(bufferA, len + 1);
ok(HIWORD(res) && (LOWORD(res) == res2),
"+1: got %d/%d (expected TRUE/%d)\n", HIWORD(res), LOWORD(res), res2);
ok(!lstrcmpA(bufferA, expectedA),
"+1: got %s (expected %s)\n", bufferA, expectedA);
res2 = ExpandEnvironmentStringsW(bufferW, expectedW, MAX_PATH);
res = DoEnvironmentSubstW(bufferW, len + 1);
ok(HIWORD(res) && (LOWORD(res) == res2),
"+1: got %d/%d (expected TRUE/%d)\n", HIWORD(res), LOWORD(res), res2);
ok(!lstrcmpW(bufferW, expectedW),
"+1: got %s (expected %s)\n", wine_dbgstr_w(bufferW), wine_dbgstr_w(expectedW));
/* minimal buffer length (result string and terminating 0) */
memset(bufferA, '#', MAX_PATH - 1);
bufferA[len + 2] = 0;
lstrcpyA(bufferA, names[i]);
MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR));
/* ANSI version failed without an extra byte, as documented on msdn */
res = DoEnvironmentSubstA(bufferA, len);
ok(!HIWORD(res) && (LOWORD(res) == len),
" 0: got %d/%d (expected FALSE/%d)\n", HIWORD(res), LOWORD(res), len);
ok(!lstrcmpA(bufferA, names[i]),
" 0: got %s (expected %s)\n", bufferA, names[i]);
/* DoEnvironmentSubstW works as expected */
res2 = ExpandEnvironmentStringsW(bufferW, expectedW, MAX_PATH);
res = DoEnvironmentSubstW(bufferW, len);
ok(HIWORD(res) && (LOWORD(res) == res2),
" 0: got %d/%d (expected TRUE/%d)\n", HIWORD(res), LOWORD(res), res2);
ok(!lstrcmpW(bufferW, expectedW),
" 0: got %s (expected %s)\n", wine_dbgstr_w(bufferW), wine_dbgstr_w(expectedW));
/* buffer to small */
/* result: FALSE / provided buffer length / the buffer is untouched */
memset(bufferA, '#', MAX_PATH - 1);
bufferA[len + 2] = 0;
lstrcpyA(bufferA, names[i]);
MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR));
res = DoEnvironmentSubstA(bufferA, len - 1);
ok(!HIWORD(res) && (LOWORD(res) == (len - 1)),
"-1: got %d/%d (expected FALSE/%d)\n", HIWORD(res), LOWORD(res), len - 1);
ok(!lstrcmpA(bufferA, names[i]),
"-1: got %s (expected %s)\n", bufferA, names[i]);
lstrcpyW(expectedW, bufferW);
res = DoEnvironmentSubstW(bufferW, len - 1);
ok(!HIWORD(res) && (LOWORD(res) == (len - 1)),
"-1: got %d/%d (expected FALSE/%d)\n", HIWORD(res), LOWORD(res), len - 1);
ok(!lstrcmpW(bufferW, expectedW),
"-1: got %s (expected %s)\n", wine_dbgstr_w(bufferW), wine_dbgstr_w(expectedW));
/* unknown variable */
/* result: TRUE / string length including terminating 0 / the buffer is untouched */
memset(bufferA, '#', MAX_PATH - 1);
bufferA[MAX_PATH - 1] = 0;
lstrcpyA(bufferA, does_not_existA);
MultiByteToWideChar(CP_ACP, 0, bufferA, MAX_PATH, bufferW, sizeof(bufferW)/sizeof(WCHAR));
res2 = lstrlenA(does_not_existA) + 1;
res = DoEnvironmentSubstA(bufferA, MAX_PATH);
ok(HIWORD(res) && (LOWORD(res) == res2),
"%d: got %d/%d (expected TRUE/%d)\n", i, HIWORD(res), LOWORD(res), res2);
ok(!lstrcmpA(bufferA, does_not_existA),
"%d: got %s (expected %s)\n", i, bufferA, does_not_existA);
res = DoEnvironmentSubstW(bufferW, MAX_PATH);
ok(HIWORD(res) && (LOWORD(res) == res2),
"%d: got %d/%d (expected TRUE/%d)\n", i, HIWORD(res), LOWORD(res), res2);
ok(!lstrcmpW(bufferW, does_not_existW),
"%d: got %s (expected %s)\n", i, wine_dbgstr_w(bufferW), wine_dbgstr_w(does_not_existW));
if (0)
{
/* NULL crashes on windows */
res = DoEnvironmentSubstA(NULL, MAX_PATH);
res = DoEnvironmentSubstW(NULL, MAX_PATH);
}
}
START_TEST(shellpath)
{
if (!init()) return;
@ -2521,5 +2673,6 @@ START_TEST(shellpath)
test_NonExistentPath();
test_SHGetFolderPathEx();
test_knownFolders();
test_DoEnvironmentSubst();
}
}

File diff suppressed because it is too large Load diff

View file

@ -995,7 +995,11 @@ static void test_copy(void)
shfo.fFlags |= FOF_NOERRORUI;
set_curr_dir_path(from, "test1.txt\0test2.txt\0");
set_curr_dir_path(to, "test3.txt\0");
shfo.fAnyOperationsAborted = 0xdeadbeef;
retval = SHFileOperation(&shfo);
ok(shfo.fAnyOperationsAborted != 0xdeadbeef ||
broken(shfo.fAnyOperationsAborted == 0xdeadbeef), /* NT4 */
"Expected TRUE/FALSE fAnyOperationsAborted not 0xdeadbeef\n");
if (retval == DE_FLDDESTISFILE || /* Vista and W2K8 */
retval == DE_INVALIDFILES) /* Win7 */
{
@ -1012,8 +1016,11 @@ static void test_copy(void)
/* try to copy many files to nonexistent directory */
DeleteFile(to);
shfo.fFlags &= ~FOF_NOERRORUI;
shfo.fAnyOperationsAborted = FALSE;
shfo.fAnyOperationsAborted = 0xdeadbeef;
retval = SHFileOperation(&shfo);
ok(!shfo.fAnyOperationsAborted ||
broken(shfo.fAnyOperationsAborted == 0xdeadbeef), /* NT4 */
"Didn't expect aborted operations\n");
ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
ok(DeleteFile("test3.txt\\test1.txt"), "Expected test3.txt\\test1.txt to exist\n");
ok(DeleteFile("test3.txt\\test2.txt"), "Expected test3.txt\\test1.txt to exist\n");
@ -1024,11 +1031,16 @@ static void test_copy(void)
shfo.pFrom = "test1.txt\0test2.txt\0test3.txt\0";
shfo.pTo = "testdir2\\a.txt\0testdir2\\b.txt\0testdir2\\c.txt\0testdir2\\d.txt\0";
shfo.fFlags |= FOF_NOERRORUI | FOF_MULTIDESTFILES;
shfo.fAnyOperationsAborted = 0xdeadbeef;
retval = SHFileOperation(&shfo);
ok(shfo.fAnyOperationsAborted != 0xdeadbeef ||
broken(shfo.fAnyOperationsAborted == 0xdeadbeef), /* NT4 */
"Expected TRUE/FALSE fAnyOperationsAborted not 0xdeadbeef\n");
if (dir_exists("testdir2\\a.txt"))
{
/* Vista and W2K8 (broken or new behavior ?) */
ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
ok(!shfo.fAnyOperationsAborted, "Didn't expect aborted operations\n");
ok(DeleteFile("testdir2\\a.txt\\test1.txt"), "Expected testdir2\\a.txt\\test1.txt to exist\n");
RemoveDirectory("testdir2\\a.txt");
ok(DeleteFile("testdir2\\b.txt\\test2.txt"), "Expected testdir2\\b.txt\\test2.txt to exist\n");
@ -1049,11 +1061,15 @@ static void test_copy(void)
/* send in FOF_MULTIDESTFILES with too many destination files */
shfo.pFrom = "test1.txt\0test2.txt\0test3.txt\0";
shfo.pTo = "e.txt\0f.txt\0";
shfo.fAnyOperationsAborted = FALSE;
shfo.fAnyOperationsAborted = 0xdeadbeef;
retval = SHFileOperation(&shfo);
ok(shfo.fAnyOperationsAborted != 0xdeadbeef ||
broken(shfo.fAnyOperationsAborted == 0xdeadbeef), /* NT4 */
"Expected TRUE/FALSE fAnyOperationsAborted not 0xdeadbeef\n");
if (dir_exists("e.txt"))
{
/* Vista and W2K8 (broken or new behavior ?) */
ok(!shfo.fAnyOperationsAborted, "Didn't expect aborted operations\n");
ok(retval == DE_SAMEFILE, "Expected DE_SAMEFILE, got %d\n", retval);
ok(DeleteFile("e.txt\\test1.txt"), "Expected e.txt\\test1.txt to exist\n");
RemoveDirectory("e.txt");
@ -1072,8 +1088,11 @@ static void test_copy(void)
/* use FOF_MULTIDESTFILES with files and a source directory */
shfo.pFrom = "test1.txt\0test2.txt\0test4.txt\0";
shfo.pTo = "testdir2\\a.txt\0testdir2\\b.txt\0testdir2\\c.txt\0";
shfo.fAnyOperationsAborted = FALSE;
shfo.fAnyOperationsAborted = 0xdeadbeef;
retval = SHFileOperation(&shfo);
ok(!shfo.fAnyOperationsAborted ||
broken(shfo.fAnyOperationsAborted == 0xdeadbeef), /* NT4 */
"Didn't expect aborted operations\n");
ok(retval == ERROR_SUCCESS ||
broken(retval == 0x100a1), /* WinMe */
"Expected ERROR_SUCCESS, got %d\n", retval);
@ -1085,13 +1104,17 @@ static void test_copy(void)
/* try many dest files without FOF_MULTIDESTFILES flag */
shfo.pFrom = "test1.txt\0test2.txt\0test3.txt\0";
shfo.pTo = "a.txt\0b.txt\0c.txt\0";
shfo.fAnyOperationsAborted = FALSE;
shfo.fAnyOperationsAborted = 0xdeadbeef;
shfo.fFlags &= ~FOF_MULTIDESTFILES;
retval = SHFileOperation(&shfo);
ok(shfo.fAnyOperationsAborted != 0xdeadbeef ||
broken(shfo.fAnyOperationsAborted == 0xdeadbeef), /* NT4 */
"Expected TRUE/FALSE fAnyOperationsAborted not 0xdeadbeef\n");
if (dir_exists("a.txt"))
{
/* Vista and W2K8 (broken or new behavior ?) */
ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
ok(!shfo.fAnyOperationsAborted, "Didn't expect aborted operations\n");
ok(DeleteFile("a.txt\\test1.txt"), "Expected a.txt\\test1.txt to exist\n");
ok(DeleteFile("a.txt\\test2.txt"), "Expected a.txt\\test2.txt to exist\n");
ok(DeleteFile("a.txt\\test3.txt"), "Expected a.txt\\test3.txt to exist\n");
@ -1099,7 +1122,11 @@ static void test_copy(void)
}
else
{
expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* Win9x, NT4 */);
ok(shfo.fAnyOperationsAborted ||
broken(!shfo.fAnyOperationsAborted), /* NT4 */
"Expected aborted operations\n");
ok(!file_exists("a.txt"), "Expected a.txt to not exist\n");
}
@ -1157,8 +1184,11 @@ static void test_copy(void)
init_shfo_tests();
shfo.pFrom = "test1.txt\0";
shfo.pTo = "b.txt\0c.txt\0";
shfo.fAnyOperationsAborted = FALSE;
shfo.fAnyOperationsAborted = 0xdeadbeef;
retval = SHFileOperation(&shfo);
ok(!shfo.fAnyOperationsAborted ||
broken(shfo.fAnyOperationsAborted == 0xdeadbeef), /* NT4 */
"Didn't expect aborted operations\n");
if (retval == DE_OPCANCELLED)
{
/* NT4 fails and doesn't copy any files */
@ -1177,11 +1207,13 @@ static void test_copy(void)
/* copy two file to three others, all fail */
shfo.pFrom = "test1.txt\0test2.txt\0";
shfo.pTo = "b.txt\0c.txt\0d.txt\0";
shfo.fAnyOperationsAborted = 0xdeadbeef;
retval = SHFileOperation(&shfo);
if (dir_exists("b.txt"))
{
/* Vista and W2K8 (broken or new behavior ?) */
ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
ok(!shfo.fAnyOperationsAborted, "Didn't expect aborted operations\n");
ok(DeleteFile("b.txt\\test1.txt"), "Expected b.txt\\test1.txt to exist\n");
RemoveDirectory("b.txt");
ok(DeleteFile("c.txt\\test2.txt"), "Expected c.txt\\test2.txt to exist\n");
@ -1191,7 +1223,7 @@ static void test_copy(void)
{
expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* Win9x, NT4 */);
ok(shfo.fAnyOperationsAborted ||
broken(!shfo.fAnyOperationsAborted), /* NT4 */
broken(shfo.fAnyOperationsAborted == 0xdeadbeef), /* NT4 */
"Expected aborted operations\n");
ok(!DeleteFile("b.txt"), "Expected b.txt to not exist\n");
}
@ -1199,12 +1231,13 @@ static void test_copy(void)
/* copy one file and one directory to three others */
shfo.pFrom = "test1.txt\0test4.txt\0";
shfo.pTo = "b.txt\0c.txt\0d.txt\0";
shfo.fAnyOperationsAborted = FALSE;
shfo.fAnyOperationsAborted = 0xdeadbeef;
retval = SHFileOperation(&shfo);
if (dir_exists("b.txt"))
{
/* Vista and W2K8 (broken or new behavior ?) */
ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
ok(!shfo.fAnyOperationsAborted, "Didn't expect aborted operations\n");
ok(DeleteFile("b.txt\\test1.txt"), "Expected b.txt\\test1.txt to exist\n");
RemoveDirectory("b.txt");
ok(RemoveDirectory("c.txt\\test4.txt"), "Expected c.txt\\test4.txt to exist\n");
@ -1214,7 +1247,7 @@ static void test_copy(void)
{
expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* Win9x, NT4 */);
ok(shfo.fAnyOperationsAborted ||
broken(!shfo.fAnyOperationsAborted), /* NT4 */
broken(shfo.fAnyOperationsAborted == 0xdeadbeef), /* NT4 */
"Expected aborted operations\n");
ok(!DeleteFile("b.txt"), "Expected b.txt to not exist\n");
ok(!DeleteFile("c.txt"), "Expected c.txt to not exist\n");
@ -1383,10 +1416,11 @@ static void test_copy(void)
shfo.fFlags = FOF_NOCONFIRMATION;
shfo.pFrom = "test1.txt\0";
shfo.pTo = "test2.txt\0";
shfo.fAnyOperationsAborted = FALSE;
shfo.fAnyOperationsAborted = 0xdeadbeef;
/* without FOF_NOCONFIRMATION the confirmation is Yes/No */
retval = SHFileOperation(&shfo);
ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
ok(!shfo.fAnyOperationsAborted, "Didn't expect aborted operations\n");
ok(file_has_content("test2.txt", "test1.txt\n"), "The file was not copied\n");
shfo.pFrom = "test3.txt\0test1.txt\0";

View file

@ -73,6 +73,18 @@ static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
static UINT (WINAPI *pGetSystemWow64DirectoryW)(LPWSTR, UINT);
static HRESULT (WINAPI *pSHCreateDefaultContextMenu)(const DEFCONTEXTMENU*,REFIID,void**);
static const char *debugstr_guid(REFIID riid)
{
static char buf[50];
sprintf(buf, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
riid->Data4[5], riid->Data4[6], riid->Data4[7]);
return buf;
}
static WCHAR *make_wstr(const char *str)
{
WCHAR *ret;
@ -566,7 +578,9 @@ if (0)
CLSID id;
hr = IPersist_GetClassID(pp, &id);
ok(hr == S_OK, "Got 0x%08x\n", hr);
ok(IsEqualIID(&id, &CLSID_ShellDocObjView), "Unexpected classid\n");
/* CLSID_ShellFSFolder on some w2k systems */
ok(IsEqualIID(&id, &CLSID_ShellDocObjView) || broken(IsEqualIID(&id, &CLSID_ShellFSFolder)),
"Unexpected classid %s\n", debugstr_guid(&id));
IPersist_Release(pp);
}
@ -782,7 +796,7 @@ static void test_GetDisplayName(void)
broken(hr == S_OK), /* Win9x, W2K */
"hr = %08x\n", hr);
if (hr == S_OK) {
IShellFolder_Release(psfFile);
IUnknown_Release(psfFile);
}
if (!pSHBindToParent)

View file

@ -170,7 +170,7 @@ static HRESULT WINAPI IDataObjectImpl_QueryInterface(IDataObject *iface, REFIID
if(*ppvObj)
{
IUnknown_AddRef(iface);
IDataObject_AddRef(iface);
return S_OK;
}
@ -302,7 +302,7 @@ static HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
if(*ppvObj)
{
IUnknown_AddRef(iface);
IShellBrowser_AddRef(iface);
return S_OK;
}