[SHELL32_WINETEST]
authorAmine Khaldi <amine.khaldi@reactos.org>
Sun, 20 Apr 2014 13:19:24 +0000 (13:19 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sun, 20 Apr 2014 13:19:24 +0000 (13:19 +0000)
* Sync with Wine 1.7.17.
* Speedup build.
CORE-8080

svn path=/trunk/; revision=62838

17 files changed:
rostests/winetests/shell32/CMakeLists.txt
rostests/winetests/shell32/appbar.c
rostests/winetests/shell32/assoc.c
rostests/winetests/shell32/autocomplete.c
rostests/winetests/shell32/brsfolder.c
rostests/winetests/shell32/ebrowser.c
rostests/winetests/shell32/msg.h
rostests/winetests/shell32/progman_dde.c
rostests/winetests/shell32/shelllink.c
rostests/winetests/shell32/shellole.c
rostests/winetests/shell32/shellpath.c
rostests/winetests/shell32/shlexec.c
rostests/winetests/shell32/shlfileop.c
rostests/winetests/shell32/shlfolder.c
rostests/winetests/shell32/string.c
rostests/winetests/shell32/systray.c
rostests/winetests/shell32/testlist.c

index 6f2663f..e42a50c 100644 (file)
@@ -1,8 +1,6 @@
 
 remove_definitions(-DWINVER=0x502 -D_WIN32_IE=0x600 -D_WIN32_WINNT=0x502)
 
-add_definitions(-D__ROS_LONG64__)
-
 list(APPEND SOURCE
     appbar.c
     assoc.c
@@ -27,7 +25,10 @@ list(APPEND SOURCE
     rsrc.rc)
 
 add_executable(shell32_winetest ${SOURCE})
-target_link_libraries(shell32_winetest wine uuid)
+target_link_libraries(shell32_winetest uuid)
 set_module_type(shell32_winetest win32cui)
-add_importlibs(shell32_winetest shell32 ole32 oleaut32 user32 advapi32 msvcrt kernel32 ntdll)
+add_importlibs(shell32_winetest shell32 ole32 oleaut32 user32 advapi32 msvcrt kernel32)
+if(MSVC)
+    add_importlibs(shell32_winetest ntdll)
+endif()
 add_cd_file(TARGET shell32_winetest DESTINATION reactos/bin FOR all)
index 2bba332..7675493 100644 (file)
@@ -20,6 +20,7 @@
 #include <stdarg.h>
 
 #include <windows.h>
+#include "shellapi.h"
 
 #include "wine/test.h"
 
@@ -47,7 +48,7 @@ static int expected_bottom;
 
 static void testwindow_setpos(HWND hwnd)
 {
-    struct testwindow_info* info = (struct testwindow_info*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+    struct testwindow_info* info = (struct testwindow_info*)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
     APPBARDATA abd;
     BOOL ret;
 
@@ -113,7 +114,7 @@ static LRESULT CALLBACK testwindow_wndproc(HWND hwnd, UINT msg, WPARAM wparam, L
         }
     }
 
-    return DefWindowProc(hwnd, msg, wparam, lparam);
+    return DefWindowProcA(hwnd, msg, wparam, lparam);
 }
 
 /* process pending messages until a condition is true or 3 seconds pass */
@@ -185,7 +186,7 @@ static void register_testwindow_class(void)
     cls.style = 0;
     cls.lpfnWndProc = testwindow_wndproc;
     cls.hInstance = NULL;
-    cls.hCursor = LoadCursor(0, IDC_ARROW);
+    cls.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
     cls.hbrBackground = (HBRUSH) COLOR_WINDOW;
     cls.lpszClassName = testwindow_class;
 
@@ -234,7 +235,7 @@ static void test_setpos(void)
     windows[0].desired_rect.right = screen_width;
     windows[0].desired_rect.top = screen_height - 15;
     windows[0].desired_rect.bottom = screen_height;
-    SetWindowLongPtr(windows[0].hwnd, GWLP_USERDATA, (LONG_PTR)&windows[0]);
+    SetWindowLongPtrA(windows[0].hwnd, GWLP_USERDATA, (LONG_PTR)&windows[0]);
     testwindow_setpos(windows[0].hwnd);
     do_events();
 
@@ -255,7 +256,7 @@ static void test_setpos(void)
     windows[1].desired_rect.right = screen_width;
     windows[1].desired_rect.top = screen_height - 10;
     windows[1].desired_rect.bottom = screen_height;
-    SetWindowLongPtr(windows[1].hwnd, GWLP_USERDATA, (LONG_PTR)&windows[1]);
+    SetWindowLongPtrA(windows[1].hwnd, GWLP_USERDATA, (LONG_PTR)&windows[1]);
     testwindow_setpos(windows[1].hwnd);
 
     /* the windows are adjusted to they don't overlap */
@@ -287,7 +288,7 @@ static void test_setpos(void)
     windows[2].desired_rect.right = screen_width;
     windows[2].desired_rect.top = screen_height - 10;
     windows[2].desired_rect.bottom = screen_height;
-    SetWindowLongPtr(windows[2].hwnd, GWLP_USERDATA, (LONG_PTR)&windows[2]);
+    SetWindowLongPtrA(windows[2].hwnd, GWLP_USERDATA, (LONG_PTR)&windows[2]);
     testwindow_setpos(windows[2].hwnd);
 
     do_events_until(no_appbars_intersect);
index 29524dc..ff999e9 100644 (file)
@@ -35,13 +35,8 @@ static void test_IQueryAssociations_QueryInterface(void)
     IUnknown *unk;
     HRESULT hr;
 
-    /* this works since XP */
     hr = CoCreateInstance(&CLSID_QueryAssociations, NULL, CLSCTX_INPROC_SERVER, &IID_IQueryAssociations, (void*)&qa);
-
-    if (FAILED(hr)) {
-        win_skip("CoCreateInstance for IQueryAssociations returned 0x%x\n", hr);
-        return;
-    }
+    ok(hr == S_OK, "got 0x%08x\n", hr);
 
     hr = IQueryAssociations_QueryInterface(qa, &IID_IQueryAssociations, (void**)&qa2);
     ok(hr == S_OK, "QueryInterface (IQueryAssociations) returned 0x%x\n", hr);
@@ -97,12 +92,124 @@ static void test_IApplicationAssociationRegistration_QueryInterface(void)
     IApplicationAssociationRegistration_Release(appreg);
 }
 
+struct assoc_getstring_test
+{
+    const WCHAR *key;
+    ASSOCF       flags;
+    ASSOCSTR     str;
+    DWORD        len;
+    HRESULT      hr;
+    HRESULT      brokenhr;
+};
+
+static const WCHAR httpW[] = {'h','t','t','p',0};
+static const WCHAR httpsW[] = {'h','t','t','p','s',0};
+static const WCHAR badW[] = {'b','a','d','b','a','d',0};
+
+static struct assoc_getstring_test getstring_tests[] =
+{
+    { httpW, 0, ASSOCSTR_EXECUTABLE, 2, 0x8007007a /* E_NOT_SUFFICIENT_BUFFER */, S_OK },
+    { httpW, ASSOCF_NOTRUNCATE, ASSOCSTR_EXECUTABLE, 2, E_POINTER },
+    { NULL }
+};
+
+static void test_IQueryAssociations_GetString(void)
+{
+    struct assoc_getstring_test *ptr = getstring_tests;
+    IQueryAssociations *assoc;
+    HRESULT hr;
+    DWORD len;
+    int i = 0;
+
+    hr = CoCreateInstance(&CLSID_QueryAssociations, NULL, CLSCTX_INPROC_SERVER, &IID_IQueryAssociations, (void*)&assoc);
+    ok(hr == S_OK, "failed to create object, 0x%x\n", hr);
+
+    hr = IQueryAssociations_Init(assoc, 0, httpW, NULL, NULL);
+    ok(hr == S_OK, "Init failed, 0x%x\n", hr);
+
+    len = 0;
+    hr = IQueryAssociations_GetString(assoc, 0, ASSOCSTR_EXECUTABLE, NULL, NULL, &len);
+    ok(hr == S_FALSE, "got 0x%08x\n", hr);
+    ok(len > 0, "got wrong needed length, %d\n", len);
+
+    while (ptr->key)
+    {
+        WCHAR buffW[MAX_PATH];
+        DWORD len;
+
+        hr = IQueryAssociations_Init(assoc, 0, ptr->key, NULL, NULL);
+        ok(hr == S_OK, "%d: Init failed, 0x%x\n", i, hr);
+
+        len = ptr->len;
+        buffW[0] = ptr->flags & ASSOCF_NOTRUNCATE ? 0x1 : 0;
+        hr = IQueryAssociations_GetString(assoc, ptr->flags, ptr->str, NULL, buffW, &len);
+        if (hr != ptr->hr)
+            ok(broken(hr == ptr->brokenhr), "%d: GetString failed, 0x%08x\n", i, hr);
+        else
+        {
+            ok(hr == ptr->hr, "%d: GetString failed, 0x%08x\n", i, hr);
+            ok(len > ptr->len, "%d: got needed length %d\n", i, len);
+        }
+
+        /* even with ASSOCF_NOTRUNCATE it's null terminated */
+        if ((ptr->flags & ASSOCF_NOTRUNCATE) && (ptr->len > 0))
+            ok(buffW[0] == 0 || broken(buffW[0] == 0x1) /* pre win7 */, "%d: got %x\n", i, buffW[0]);
+
+        if (!(ptr->flags & ASSOCF_NOTRUNCATE) && ptr->len && FAILED(ptr->hr))
+            ok(buffW[0] != 0, "%d: got %x\n", i, buffW[0]);
+
+        i++;
+        ptr++;
+    }
+
+    IQueryAssociations_Release(assoc);
+}
+
+static void test_IQueryAssociations_Init(void)
+{
+    IQueryAssociations *assoc;
+    HRESULT hr;
+    DWORD len;
+
+    hr = CoCreateInstance(&CLSID_QueryAssociations, NULL, CLSCTX_INPROC_SERVER, &IID_IQueryAssociations, (void*)&assoc);
+    ok(hr == S_OK, "failed to create object, 0x%x\n", hr);
+
+    hr = IQueryAssociations_Init(assoc, 0, NULL, NULL, NULL);
+    ok(hr == E_INVALIDARG, "Init failed, 0x%08x\n", hr);
+
+    hr = IQueryAssociations_Init(assoc, 0, httpW, NULL, NULL);
+    ok(hr == S_OK, "Init failed, 0x%08x\n", hr);
+
+    hr = IQueryAssociations_Init(assoc, 0, badW, NULL, NULL);
+    ok(hr == S_OK || broken(hr == S_FALSE) /* pre-vista */, "Init failed, 0x%08x\n", hr);
+
+    len = 0;
+    hr = IQueryAssociations_GetString(assoc, 0, ASSOCSTR_EXECUTABLE, NULL, NULL, &len);
+    ok(hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) || broken(hr == E_FAIL) /* pre-vista */, "got 0x%08x\n", hr);
+
+    IQueryAssociations_Release(assoc);
+}
 
 START_TEST(assoc)
 {
+    IQueryAssociations *qa;
+    HRESULT hr;
+
     CoInitialize(NULL);
 
-    test_IQueryAssociations_QueryInterface();
+    /* this works since XP */
+    hr = CoCreateInstance(&CLSID_QueryAssociations, NULL, CLSCTX_INPROC_SERVER, &IID_IQueryAssociations, (void*)&qa);
+    if (hr == S_OK)
+    {
+        test_IQueryAssociations_QueryInterface();
+        test_IQueryAssociations_GetString();
+        test_IQueryAssociations_Init();
+
+        IQueryAssociations_Release(qa);
+    }
+    else
+        win_skip("IQueryAssociations not supported, 0x%x\n", hr);
+
     test_IApplicationAssociationRegistration_QueryInterface();
 
     CoUninitialize();
index 5ff8847..63a2eb2 100644 (file)
@@ -194,7 +194,7 @@ static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
     switch(msg) {
     case WM_CREATE:
         /* create edit control */
-        hEdit = CreateWindowEx(0, "EDIT", "Some text", 0, 10, 10, 300, 300,
+        hEdit = CreateWindowExA(0, "EDIT", "Some text", 0, 10, 10, 300, 300,
                     hWnd, NULL, hinst, NULL);
         ok(hEdit != NULL, "Can't create edit control\n");
         break;
@@ -214,7 +214,7 @@ static void createMainWnd(void)
     wc.cbWndExtra = 0;
     wc.hInstance = GetModuleHandleA(NULL);
     wc.hIcon = NULL;
-    wc.hCursor = LoadCursorA(NULL, IDC_IBEAM);
+    wc.hCursor = LoadCursorA(NULL, (LPSTR)IDC_IBEAM);
     wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);
     wc.lpszMenuName = NULL;
     wc.lpszClassName = "MyTestWnd";
index f8e8e16..0ef5bb1 100644 (file)
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
+
+#define COBJMACROS
+
 #include <windows.h>
 #include <shlobj.h>
 #include <shobjidl.h>
 #include <string.h>
+#include "shellapi.h"
 
 #include "wine/test.h"
 #define IDD_MAKENEWFOLDER 0x3746 /* From "../shresdef.h" */
@@ -37,13 +41,13 @@ static int get_number_of_folders(LPCSTR path)
 {
     int number_of_folders = 0;
     char path_search_string[MAX_PATH];
-    WIN32_FIND_DATA find_data;
+    WIN32_FIND_DATAA find_data;
     HANDLE find_handle;
 
-    strncpy(path_search_string, path, MAX_PATH);
+    lstrcpynA(path_search_string, path, MAX_PATH);
     strncat(path_search_string, "*", 1);
 
-    find_handle = FindFirstFile(path_search_string, &find_data);
+    find_handle = FindFirstFileA(path_search_string, &find_data);
     if (find_handle == INVALID_HANDLE_VALUE)
         return -1;
 
@@ -56,7 +60,7 @@ static int get_number_of_folders(LPCSTR path)
             number_of_folders++;
         }
     }
-    while (FindNextFile(find_handle, &find_data) != 0);
+    while (FindNextFileA(find_handle, &find_data) != 0);
 
     FindClose(find_handle);
     return number_of_folders;
@@ -81,11 +85,11 @@ static void CALLBACK make_new_folder_timer_callback(HWND hwnd, UINT uMsg,
     {
     case 0:
         /* Click "Make New Folder" button */
-        PostMessage(hwnd, WM_COMMAND, IDD_MAKENEWFOLDER, 0);
+        PostMessageA(hwnd, WM_COMMAND, IDD_MAKENEWFOLDER, 0);
         break;
     case 1:
         /* Set the new folder name to foo by replacing text in edit control */
-        SendMessage(GetFocus(), EM_REPLACESEL, 0, (LPARAM) new_folder_name);
+        SendMessageA(GetFocus(), EM_REPLACESEL, 0, (LPARAM) new_folder_name);
         SetFocus(hwnd);
         break;
     case 2:
@@ -104,7 +108,7 @@ static void CALLBACK make_new_folder_timer_callback(HWND hwnd, UINT uMsg,
     case 4:
         KillTimer(hwnd, idEvent);
         /* Close dialog box */
-        SendMessage(hwnd, WM_COMMAND, IDOK, 0);
+        SendMessageA(hwnd, WM_COMMAND, IDOK, 0);
         break;
     default:
         break;
@@ -150,7 +154,7 @@ static int CALLBACK create_new_folder_callback(HWND hwnd, UINT uMsg,
 static void test_click_make_new_folder_button(void)
 {
     HRESULT resCoInit, hr;
-    BROWSEINFO bi;
+    BROWSEINFOA bi;
     LPITEMIDLIST pidl = NULL;
     LPITEMIDLIST test_folder_pidl;
     IShellFolder *test_folder_object;
@@ -161,7 +165,7 @@ static void test_click_make_new_folder_button(void)
     char selected_folder[MAX_PATH];
     const CHAR title[] = "test_click_make_new_folder_button";
     int number_of_folders = -1;
-    SHFILEOPSTRUCT shfileop;
+    SHFILEOPSTRUCTA shfileop;
 
     if (does_folder_or_file_exist(title))
     {
@@ -195,8 +199,8 @@ static void test_click_make_new_folder_button(void)
 
     /* Initialize browse info struct for SHBrowseForFolder */
     bi.hwndOwner = NULL;
-    bi.pszDisplayName = (LPTSTR) &selected_folder;
-    bi.lpszTitle = (LPTSTR) title;
+    bi.pszDisplayName = selected_folder;
+    bi.lpszTitle = title;
     bi.ulFlags = BIF_NEWDIALOGSTYLE;
     bi.lpfn = create_new_folder_callback;
     /* Use test folder as the root folder for dialog box */
@@ -213,7 +217,7 @@ static void test_click_make_new_folder_button(void)
     bi.pidlRoot = test_folder_pidl;
 
     /* Display dialog box and let callback click the buttons */
-    pidl = SHBrowseForFolder(&bi);
+    pidl = SHBrowseForFolderA(&bi);
 
     number_of_folders = get_number_of_folders(test_folder_path);
     ok(number_of_folders == 1 || broken(number_of_folders == 0) /* W95, W98 */,
@@ -242,7 +246,7 @@ static void test_click_make_new_folder_button(void)
     shfileop.pFrom = test_folder_path;
     shfileop.pTo = NULL;
     shfileop.fFlags = FOF_NOCONFIRMATION|FOF_NOERRORUI|FOF_SILENT;
-    SHFileOperation(&shfileop);
+    SHFileOperationA(&shfileop);
 
     if (pidl)
         CoTaskMemFree(pidl);
@@ -265,47 +269,47 @@ static int CALLBACK selection_callback(HWND hwnd, UINT uMsg, LPARAM lParam, LPAR
     {
     case BFFM_INITIALIZED:
         /* test with zero values */
-        ret = SendMessage(hwnd, BFFM_SETSELECTIONA, 0, 0);
+        ret = SendMessageA(hwnd, BFFM_SETSELECTIONA, 0, 0);
         ok(!ret, "SendMessage returned: %u\n", ret);
-        ret = SendMessage(hwnd, BFFM_SETSELECTIONW, 0, 0);
+        ret = SendMessageA(hwnd, BFFM_SETSELECTIONW, 0, 0);
         ok(!ret, "SendMessage returned: %u\n", ret);
 
-        ret = SendMessage(hwnd, BFFM_SETSELECTIONA, 1, 0);
+        ret = SendMessageA(hwnd, BFFM_SETSELECTIONA, 1, 0);
         ok(!ret, "SendMessage returned: %u\n", ret);
 
         if(0)
         {
             /* Crashes on NT4 */
-            ret = SendMessage(hwnd, BFFM_SETSELECTIONW, 1, 0);
+            ret = SendMessageA(hwnd, BFFM_SETSELECTIONW, 1, 0);
             ok(!ret, "SendMessage returned: %u\n", ret);
         }
 
-        ret = SendMessage(hwnd, BFFM_SETSELECTIONA, 0, (LPARAM)selected_folder_pidl);
+        ret = SendMessageA(hwnd, BFFM_SETSELECTIONA, 0, (LPARAM)selected_folder_pidl);
         ok(!ret, "SendMessage returned: %u\n", ret);
-        ret = SendMessage(hwnd, BFFM_SETSELECTIONW, 0, (LPARAM)selected_folder_pidl);
+        ret = SendMessageW(hwnd, BFFM_SETSELECTIONW, 0, (LPARAM)selected_folder_pidl);
         ok(!ret, "SendMessage returned: %u\n", ret);
 
-        ret = SendMessage(hwnd, BFFM_SETSELECTIONA, 1, (LPARAM)selected_folder_pidl);
+        ret = SendMessageA(hwnd, BFFM_SETSELECTIONA, 1, (LPARAM)selected_folder_pidl);
         ok(!ret, "SendMessage returned: %u\n", ret);
-        ret = SendMessage(hwnd, BFFM_SETSELECTIONW, 1, (LPARAM)selected_folder_pidl);
+        ret = SendMessageW(hwnd, BFFM_SETSELECTIONW, 1, (LPARAM)selected_folder_pidl);
         ok(!ret, "SendMessage returned: %u\n", ret);
 
-        ret = SendMessage(hwnd, BFFM_SETSELECTIONA, 1, (LPARAM)new_folder_name);
+        ret = SendMessageA(hwnd, BFFM_SETSELECTIONA, 1, (LPARAM)new_folder_name);
         ok(!ret, "SendMessage returned: %u\n", ret);
-        ret = SendMessage(hwnd, BFFM_SETSELECTIONW, 1, (LPARAM)new_folder_name);
+        ret = SendMessageW(hwnd, BFFM_SETSELECTIONW, 1, (LPARAM)new_folder_name);
         ok(!ret, "SendMessage returned: %u\n", ret);
 
-        SendMessage(hwnd, WM_COMMAND, IDOK, 0);
-        return TRUE;
+        SendMessageA(hwnd, WM_COMMAND, IDOK, 0);
+        return 1;
     default:
-        return FALSE;
+        return 0;
     }
 }
 
 static void test_selection(void)
 {
     HRESULT resCoInit, hr;
-    BROWSEINFO bi;
+    BROWSEINFOA bi;
     LPITEMIDLIST pidl = NULL;
     IShellFolder *desktop_object;
     WCHAR selected_folderW[MAX_PATH];
@@ -326,7 +330,7 @@ static void test_selection(void)
     /* Initialize browse info struct for SHBrowseForFolder */
     bi.hwndOwner = NULL;
     bi.pszDisplayName = NULL;
-    bi.lpszTitle = (LPTSTR) title;
+    bi.lpszTitle = title;
     bi.lpfn = selection_callback;
 
     hr = SHGetDesktopFolder(&desktop_object);
@@ -341,19 +345,19 @@ static void test_selection(void)
 
     /* test without flags */
     bi.ulFlags = 0;
-    pidl = SHBrowseForFolder(&bi);
+    pidl = SHBrowseForFolderA(&bi);
 
     if (pidl)
         CoTaskMemFree(pidl);
 
     /* test with flag */
     bi.ulFlags = BIF_NEWDIALOGSTYLE;
-    pidl = SHBrowseForFolder(&bi);
+    pidl = SHBrowseForFolderA(&bi);
 
     if (pidl)
         CoTaskMemFree(pidl);
 
-    desktop_object->lpVtbl->Release(desktop_object);
+    IShellFolder_Release(desktop_object);
 
     CoUninitialize();
 }
index 8149f8f..1936cf9 100644 (file)
@@ -61,6 +61,16 @@ DEFINE_GUID(IID_UnknownInterface7,    0x68A4FDBA, 0xA48A, 0x4A86, 0xA3,0x29, 0x1
 DEFINE_GUID(IID_UnknownInterface8,    0xD3B1CAF5, 0xEC4F, 0x4B2E, 0xBC,0xB0, 0x60,0xD7,0x15,0xC9,0x3C,0xB2);
 DEFINE_GUID(IID_UnknownInterface9,    0x9536CA39, 0x1ACB, 0x4AE6, 0xAD,0x27, 0x24,0x03,0xD0,0x4C,0xA2,0x8F);
 DEFINE_GUID(IID_UnknownInterface10,   0xB722BE00, 0x4E68, 0x101B, 0xA2,0xBC, 0x00,0xAA,0x00,0x40,0x47,0x70);
+DEFINE_GUID(IID_UnknownInterface11,   0x691ecf9f, 0x6b9c, 0x4311, 0xa1,0x7b, 0xad,0x15,0x4c,0x30,0xe9,0x1f);
+DEFINE_GUID(IID_UnknownInterface12,   0x7e3159f5, 0x21ca, 0x4ec2, 0x8f,0xbe, 0x66,0x2d,0x08,0x2c,0xa3,0xeb);
+DEFINE_GUID(IID_UnknownInterface13,   0xa36a3ace, 0x8332, 0x45ce, 0xaa,0x29, 0x50,0x3c,0xb7,0x6b,0x25,0x87);
+DEFINE_GUID(IID_UnknownInterface14,   0x16770868, 0x239c, 0x445b, 0xa0,0x1d, 0xf2,0x6c,0x7f,0xbb,0xf2,0x6c);
+DEFINE_GUID(IID_UnknownInterface15,   0x05a89298, 0x6246, 0x4c63, 0xbb,0x0d, 0x9b,0xda,0xf1,0x40,0xbf,0x3b);
+DEFINE_GUID(IID_UnknownInterface16,   0x35094a87, 0x8bb1, 0x4237, 0x96,0xc6, 0xc4,0x17,0xee,0xbd,0xb0,0x78);
+DEFINE_GUID(IID_UnknownInterface17,   0x3d5d8c60, 0x21e4, 0x4b03, 0x83,0xb8, 0xc7,0x3f,0x8c,0x94,0x00,0x78);
+DEFINE_GUID(IID_UnknownInterface18,   0x1fc45c07, 0x9e35, 0x4276, 0xad,0x7f, 0x08,0x60,0x3a,0xa0,0xf6,0x0f);
+DEFINE_GUID(IID_UnknownInterface19,   0xacd9b67a, 0xceab, 0x4c6c, 0x90,0xa1, 0xe8,0x57,0xc6,0x59,0xe3,0x9d);
+DEFINE_GUID(IID_UnknownInterface20,   0xd0fe6f62, 0xdea4, 0x46c9, 0x9d,0xae, 0x36,0xcb,0x13,0x99,0x78,0xfa);
 
 static HWND hwnd;
 
@@ -106,20 +116,13 @@ static HRESULT ebrowser_browse_to_desktop(IExplorerBrowser *peb)
 static void process_msgs(void)
 {
     MSG msg;
-    while(PeekMessage( &msg, NULL, 0, 0, PM_REMOVE))
+    while(PeekMessageA( &msg, NULL, 0, 0, PM_REMOVE))
     {
         TranslateMessage(&msg);
-        DispatchMessage(&msg);
+        DispatchMessageA(&msg);
     }
 }
 
-static void dbg_print_guid(const GUID *guid) {
-    WCHAR buf[MAX_PATH];
-
-    StringFromGUID2(guid, buf, MAX_PATH);
-    printf("guid:[%s]\n", wine_dbgstr_wn(buf, lstrlenW(buf)));
-}
-
 /*********************************************************************
  * IExplorerBrowserEvents implementation
  */
@@ -215,8 +218,7 @@ static inline IExplorerPaneVisibilityImpl *impl_from_IExplorerPaneVisibility(IEx
 static HRESULT WINAPI IExplorerPaneVisibility_fnQueryInterface(IExplorerPaneVisibility *iface,
                                                                REFIID riid, LPVOID *ppvObj)
 {
-    ok(0, "Not called.\n");
-    trace("REFIID:"); dbg_print_guid(riid);
+    ok(0, "unexpected, %s\n", wine_dbgstr_guid(riid));
     *ppvObj = NULL;
     return E_NOINTERFACE;
 }
@@ -260,7 +262,7 @@ static HRESULT WINAPI IExplorerPaneVisibility_fnGetPaneState(IExplorerPaneVisibi
     else if(IsEqualGUID(&EP_AdvQueryPane, ep))       This->aqp++;
     else
     {
-        trace("Unknown explorer pane: "); dbg_print_guid(ep);
+        trace("Unknown explorer pane: %s\n", wine_dbgstr_guid(ep));
         This->unk++;
     }
 
@@ -305,8 +307,7 @@ static inline ICommDlgBrowser3Impl *impl_from_ICommDlgBrowser3(ICommDlgBrowser3
 
 static HRESULT WINAPI ICommDlgBrowser3_fnQueryInterface(ICommDlgBrowser3 *iface, REFIID riid, LPVOID *ppvObj)
 {
-    ok(0, "Not called.\n");
-    trace("riid:");    dbg_print_guid(riid);
+    ok(0, "unexpected %s\n", wine_dbgstr_guid(riid));
     *ppvObj = NULL;
     return E_NOINTERFACE;
 }
@@ -476,8 +477,7 @@ static HRESULT WINAPI IServiceProvider_fnQueryInterface(IServiceProvider *iface,
         return E_NOINTERFACE;
     }
 
-    ok(0, "Unexpected interface requested.\n");
-    trace("riid: "); dbg_print_guid(riid);
+    ok(0, "Unexpected interface requested, %s\n", wine_dbgstr_guid(riid));
     return E_NOINTERFACE;
 }
 
@@ -521,12 +521,7 @@ static HRESULT WINAPI IServiceProvider_fnQueryService(IServiceProvider *iface,
         }
     }
 
-    ok(was_in_list, "-- Unknown service requested --\n");
-    if(!was_in_list)
-    {
-        trace("guidService: "); dbg_print_guid(guidService);
-        trace("riid: "); dbg_print_guid(riid);
-    }
+    ok(was_in_list, "unknown service, serviceID: %s, riid: %s\n", wine_dbgstr_guid(guidService), wine_dbgstr_guid(riid));
 
     /* Give back an interface, if any. */
     if(punk)
@@ -617,22 +612,25 @@ static void test_SB_misc(void)
     }
 
     /* Some unimplemented methods */
-    retHwnd = (HWND)0xDEADBEEF;
+    retHwnd = (HWND)0xdeadbeef;
     hr = IShellBrowser_GetControlWindow(psb, FCW_TOOLBAR, &retHwnd);
     ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr);
-    ok(retHwnd == (HWND)0xDEADBEEF, "HWND overwritten\n");
+    ok(retHwnd == NULL || broken(retHwnd == (HWND)0xdeadbeef), "got %p\n", retHwnd);
 
+    retHwnd = (HWND)0xdeadbeef;
     hr = IShellBrowser_GetControlWindow(psb, FCW_STATUS, &retHwnd);
     ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr);
-    ok(retHwnd == (HWND)0xDEADBEEF, "HWND overwritten\n");
+    ok(retHwnd == NULL || broken(retHwnd == (HWND)0xdeadbeef), "got %p\n", retHwnd);
 
+    retHwnd = (HWND)0xdeadbeef;
     hr = IShellBrowser_GetControlWindow(psb, FCW_TREE, &retHwnd);
     ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr);
-    ok(retHwnd == (HWND)0xDEADBEEF, "HWND overwritten\n");
+    ok(retHwnd == NULL || broken(retHwnd == (HWND)0xdeadbeef), "got %p\n", retHwnd);
 
+    retHwnd = (HWND)0xdeadbeef;
     hr = IShellBrowser_GetControlWindow(psb, FCW_PROGRESS, &retHwnd);
     ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr);
-    ok(retHwnd == (HWND)0xDEADBEEF, "HWND overwritten\n");
+    ok(retHwnd == NULL || broken(retHwnd == (HWND)0xdeadbeef), "got %p\n", retHwnd);
 
     /* ::InsertMenuSB */
     hr = IShellBrowser_InsertMenusSB(psb, NULL, NULL);
@@ -927,6 +925,18 @@ static void test_SetSite(void)
         { &IID_UnknownInterface4,       &IID_IUnknown, 0, NULL },
         { &IID_UnknownInterface6,       &IID_UnknownInterface7, 0, NULL },
         { &IID_IBrowserWithActivationNotification, &IID_IBrowserWithActivationNotification, 0, NULL },
+        /* Win 8 */
+        { &IID_ICommDlgBrowser,         &IID_UnknownInterface11, 0, NULL },
+        { &IID_ICommDlgBrowser,         &IID_UnknownInterface12, 0, NULL },
+        { &IID_ICommDlgBrowser,         &IID_UnknownInterface20, 0, NULL },
+        { &IID_UnknownInterface13,      &IID_IUnknown, 0, NULL },
+        { &IID_UnknownInterface13,      &IID_UnknownInterface13, 0, NULL },
+        { &IID_UnknownInterface13,      &IID_UnknownInterface18, 0, NULL },
+        { &IID_UnknownInterface14,      &IID_UnknownInterface14, 0, NULL },
+        { &IID_UnknownInterface15,      &IID_UnknownInterface15, 0, NULL },
+        { &IID_UnknownInterface16,      &IID_UnknownInterface16, 0, NULL },
+        { &IID_UnknownInterface17,      &IID_UnknownInterface17, 0, NULL },
+        { &IID_UnknownInterface17,      &IID_UnknownInterface19, 0, NULL },
 
         /* Other services requested in Vista, Windows 2008 but not in Windows 7 */
         { &IID_IBrowserSettings_Vista,  &IID_IBrowserSettings_Vista, 0, NULL },
index 361ccdb..a457fd4 100644 (file)
@@ -106,7 +106,7 @@ static void flush_sequences(struct msg_sequence **seq, int n)
 }
 
 static void ok_sequence_(struct msg_sequence **seq, int sequence_index,
-    const struct message *expected, const char *context, int todo,
+    const struct message *expected, const char *context, BOOL todo,
     const char *file, int line)
 {
     struct msg_sequence *msg_seq = seq[sequence_index];
index f94c783..540c6d4 100644 (file)
@@ -363,7 +363,7 @@ static void DdeExecuteCommand(DWORD instance, HCONV hConv, const char *strCmd, H
  * window creation happened were not encouraging (not including
  * SetWindowsHookEx).
  */
-static void CheckWindowCreated(const char *winName, int closeWindow, int testParams)
+static void CheckWindowCreated(const char *winName, BOOL closeWindow, int testParams)
 {
     HWND window = NULL;
     int i;
@@ -387,7 +387,7 @@ static void CheckWindowCreated(const char *winName, int closeWindow, int testPar
 /* Check for Existence (or non-existence) of a file or group
  *   When testing for existence of a group, groupName is not needed
  */
-static void CheckFileExistsInProgramGroups(const char *nameToCheck, int shouldExist, int isGroup,
+static void CheckFileExistsInProgramGroups(const char *nameToCheck, BOOL shouldExist, BOOL isGroup,
                                            const char *groupName, int testParams)
 {
     char path[MAX_PATH];
@@ -411,7 +411,7 @@ static void CheckFileExistsInProgramGroups(const char *nameToCheck, int shouldEx
         }
         strcat(path, "\\");
         strcat(path, nameToCheck);
-        attributes = GetFileAttributes(path);
+        attributes = GetFileAttributesA(path);
         if (!shouldExist)
         {
             ok (attributes == INVALID_FILE_ATTRIBUTES , "File exists and shouldn't %s.%s\n",
@@ -469,7 +469,7 @@ static void CreateGroupTest(DWORD instance, HCONV hConv, const char *command, UI
  *        1. window is open
  */
 static void ShowGroupTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
-                          const char *groupName, const char *windowTitle, int closeAfterShowing, int testParams)
+                          const char *groupName, const char *windowTitle, BOOL closeAfterShowing, int testParams)
 {
     HDDEDATA hData;
     UINT error;
@@ -711,11 +711,11 @@ START_TEST(progman_dde)
     init_strings();
 
     /* Initialize DDE Instance */
-    err = DdeInitialize(&instance, DdeCallback, APPCMD_CLIENTONLY, 0);
+    err = DdeInitializeA(&instance, DdeCallback, APPCMD_CLIENTONLY, 0);
     ok (err == DMLERR_NO_ERROR, "DdeInitialize Error %s\n", GetStringFromError(err));
 
     /* Create Connection */
-    hszProgman = DdeCreateStringHandle(instance, "PROGMAN", CP_WINANSI);
+    hszProgman = DdeCreateStringHandleA(instance, "PROGMAN", CP_WINANSI);
     ok (hszProgman != NULL, "DdeCreateStringHandle Error %s\n", GetDdeLastErrorStr(instance));
     hConv = DdeConnect(instance, hszProgman, hszProgman, NULL);
     ok (DdeFreeStringHandle(instance, hszProgman), "DdeFreeStringHandle failure\n");
@@ -736,11 +736,11 @@ START_TEST(progman_dde)
     /* 2nd Instance (Followup Tests) */
     /* Initialize DDE Instance */
     instance = 0;
-    err = DdeInitialize(&instance, DdeCallback, APPCMD_CLIENTONLY, 0);
+    err = DdeInitializeA(&instance, DdeCallback, APPCMD_CLIENTONLY, 0);
     ok (err == DMLERR_NO_ERROR, "DdeInitialize Error %s\n", GetStringFromError(err));
 
     /* Create Connection */
-    hszProgman = DdeCreateStringHandle(instance, "PROGMAN", CP_WINANSI);
+    hszProgman = DdeCreateStringHandleA(instance, "PROGMAN", CP_WINANSI);
     ok (hszProgman != NULL, "DdeCreateStringHandle Error %s\n", GetDdeLastErrorStr(instance));
     hConv = DdeConnect(instance, hszProgman, hszProgman, NULL);
     ok (hConv != NULL, "DdeConnect Error %s\n", GetDdeLastErrorStr(instance));
index b22079c..0b2b7be 100755 (executable)
@@ -26,6 +26,7 @@
 #include "shlguid.h"
 #include "shobjidl.h"
 #include "shlobj.h"
+#include "shellapi.h"
 #include "wine/test.h"
 
 #include "shell32_test.h"
@@ -38,9 +39,10 @@ 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 HRESULT (WINAPI *pSHGetStockIconInfo)(SHSTOCKICONID, UINT, SHSTOCKICONINFO *);
 static DWORD (WINAPI *pGetLongPathNameA)(LPCSTR, LPSTR, DWORD);
 static DWORD (WINAPI *pGetShortPathNameA)(LPCSTR, LPSTR, DWORD);
+static UINT (WINAPI *pSHExtractIconsW)(LPCWSTR, int, int, int, HICON *, UINT *, UINT, UINT);
 
 static const GUID _IID_IShellLinkDataList = {
     0x45e2b4ae, 0xb1c3, 0x11d0,
@@ -126,7 +128,7 @@ static void test_get_set(void)
     strcpy(buffer,"garbage");
     r = IShellLinkA_GetDescription(sl, buffer, sizeof(buffer));
     ok(r == S_OK, "GetDescription failed (0x%08x)\n", r);
-    ok(lstrcmp(buffer,str)==0, "GetDescription returned '%s'\n", buffer);
+    ok(strcmp(buffer,str)==0, "GetDescription returned '%s'\n", buffer);
 
     r = IShellLinkA_SetDescription(sl, NULL);
     ok(r == S_OK, "SetDescription failed (0x%08x)\n", r);
@@ -134,8 +136,7 @@ static void test_get_set(void)
     strcpy(buffer,"garbage");
     r = IShellLinkA_GetDescription(sl, buffer, sizeof(buffer));
     ok(r == S_OK, "GetDescription failed (0x%08x)\n", r);
-    ok(*buffer=='\0' || broken(lstrcmp(buffer,str)==0), "GetDescription returned '%s'\n", buffer); /* NT4 */
-
+    ok(*buffer=='\0' || broken(strcmp(buffer,str)==0), "GetDescription returned '%s'\n", buffer); /* NT4 */
 
     /* Test Getting / Setting the work directory */
     strcpy(buffer,"garbage");
@@ -150,7 +151,7 @@ static void test_get_set(void)
     strcpy(buffer,"garbage");
     r = IShellLinkA_GetWorkingDirectory(sl, buffer, sizeof(buffer));
     ok(r == S_OK, "GetWorkingDirectory failed (0x%08x)\n", r);
-    ok(lstrcmpi(buffer,str)==0, "GetWorkingDirectory returned '%s'\n", buffer);
+    ok(lstrcmpiA(buffer,str)==0, "GetWorkingDirectory returned '%s'\n", buffer);
 
     /* Test Getting / Setting the path */
     strcpy(buffer,"garbage");
@@ -187,7 +188,7 @@ static void test_get_set(void)
     strcpy(buffer,"garbage");
     r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH);
     ok(r == S_OK, "GetPath failed (0x%08x)\n", r);
-    ok(lstrcmpi(buffer,str)==0, "GetPath returned '%s'\n", buffer);
+    ok(lstrcmpiA(buffer,str)==0, "GetPath returned '%s'\n", buffer);
 
     /* Get some real path to play with */
     GetWindowsDirectoryA( mypath, sizeof(mypath)-12 );
@@ -205,7 +206,7 @@ static void test_get_set(void)
         ret = SHGetPathFromIDListA(tmp_pidl, buffer);
         ok(ret, "SHGetPathFromIDListA failed\n");
         if (ret)
-            ok(lstrcmpi(buffer,str)==0, "GetIDList returned '%s'\n", buffer);
+            ok(lstrcmpiA(buffer,str)==0, "GetIDList returned '%s'\n", buffer);
         pILFree(tmp_pidl);
     }
 
@@ -239,8 +240,7 @@ static void test_get_set(void)
         r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH);
         ok(r == S_OK, "GetPath failed (0x%08x)\n", r);
         todo_wine
-        ok(lstrcmpi(buffer, mypath)==0, "GetPath returned '%s'\n", buffer);
-
+        ok(lstrcmpiA(buffer, mypath)==0, "GetPath returned '%s'\n", buffer);
     }
 
     /* test path with quotes (IShellLinkA_SetPath returns S_FALSE on W2K and below and S_OK on XP and above */
@@ -250,8 +250,8 @@ static void test_get_set(void)
     strcpy(buffer,"garbage");
     r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH);
     ok(r==S_OK, "GetPath failed (0x%08x)\n", r);
-    ok(!lstrcmp(buffer, "C:\\nonexistent\\file") ||
-       broken(!lstrcmp(buffer, "C:\\\"c:\\nonexistent\\file\"")), /* NT4 */
+    ok(!strcmp(buffer, "C:\\nonexistent\\file") ||
+       broken(!strcmp(buffer, "C:\\\"c:\\nonexistent\\file\"")), /* NT4 */
        "case doesn't match\n");
 
     r = IShellLinkA_SetPath(sl, "\"c:\\foo");
@@ -282,14 +282,14 @@ static void test_get_set(void)
     strcpy(buffer,"garbage");
     r = IShellLinkA_GetArguments(sl, buffer, sizeof(buffer));
     ok(r == S_OK, "GetArguments failed (0x%08x)\n", r);
-    ok(lstrcmp(buffer,str)==0, "GetArguments returned '%s'\n", buffer);
+    ok(strcmp(buffer,str)==0, "GetArguments returned '%s'\n", buffer);
 
     strcpy(buffer,"garbage");
     r = IShellLinkA_SetArguments(sl, NULL);
     ok(r == S_OK, "SetArguments failed (0x%08x)\n", r);
     r = IShellLinkA_GetArguments(sl, buffer, sizeof(buffer));
     ok(r == S_OK, "GetArguments failed (0x%08x)\n", r);
-    ok(!buffer[0] || lstrcmp(buffer,str)==0, "GetArguments returned '%s'\n", buffer);
+    ok(!buffer[0] || strcmp(buffer,str)==0, "GetArguments returned '%s'\n", buffer);
 
     strcpy(buffer,"garbage");
     r = IShellLinkA_SetArguments(sl, "");
@@ -327,7 +327,7 @@ static void test_get_set(void)
     i=0xdeadbeef;
     r = IShellLinkA_GetIconLocation(sl, buffer, sizeof(buffer), &i);
     ok(r == S_OK, "GetIconLocation failed (0x%08x)\n", r);
-    ok(lstrcmpi(buffer,str)==0, "GetIconLocation returned '%s'\n", buffer);
+    ok(lstrcmpiA(buffer,str)==0, "GetIconLocation returned '%s'\n", buffer);
     ok(i==0xbabecafe, "GetIconLocation returned %d'\n", i);
 
     /* Test Getting / Setting the hot key */
@@ -535,7 +535,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int todo)
         strcpy(buffer,"garbage");
         r = IShellLinkA_GetDescription(sl, buffer, sizeof(buffer));
         lok(r == S_OK, "GetDescription failed (0x%08x)\n", r);
-        lok_todo_4(0x1, lstrcmp(buffer, desc->description)==0,
+        lok_todo_4(0x1, strcmp(buffer, desc->description)==0,
            "GetDescription returned '%s' instead of '%s'\n",
            buffer, desc->description);
     }
@@ -544,7 +544,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int todo)
         strcpy(buffer,"garbage");
         r = IShellLinkA_GetWorkingDirectory(sl, buffer, sizeof(buffer));
         lok(r == S_OK, "GetWorkingDirectory failed (0x%08x)\n", r);
-        lok_todo_4(0x2, lstrcmpi(buffer, desc->workdir)==0,
+        lok_todo_4(0x2, lstrcmpiA(buffer, desc->workdir)==0,
            "GetWorkingDirectory returned '%s' instead of '%s'\n",
            buffer, desc->workdir);
     }
@@ -553,7 +553,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int todo)
         strcpy(buffer,"garbage");
         r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH);
         lok(SUCCEEDED(r), "GetPath failed (0x%08x)\n", r);
-        lok_todo_4(0x4, lstrcmpi(buffer, desc->path)==0,
+        lok_todo_4(0x4, lstrcmpiA(buffer, desc->path)==0,
            "GetPath returned '%s' instead of '%s'\n",
            buffer, desc->path);
     }
@@ -580,7 +580,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int todo)
         strcpy(buffer,"garbage");
         r = IShellLinkA_GetIconLocation(sl, buffer, sizeof(buffer), &i);
         lok(r == S_OK, "GetIconLocation failed (0x%08x)\n", r);
-        lok_todo_4(0x20, lstrcmpi(buffer, desc->icon)==0,
+        lok_todo_4(0x20, lstrcmpiA(buffer, desc->icon)==0,
            "GetIconLocation returned '%s' instead of '%s'\n",
            buffer, desc->icon);
         lok_todo_4(0x20, i==desc->icon_id,
@@ -650,7 +650,7 @@ static void test_load_save(void)
     create_lnk(lnkfile, &desc, 0);
     check_lnk(lnkfile, &desc, 0x0);
 
-    r=GetModuleFileName(NULL, mypath, sizeof(mypath));
+    r=GetModuleFileNameA(NULL, mypath, sizeof(mypath));
     ok(r<sizeof(mypath), "GetModuleFileName failed (%d)\n", r);
     strcpy(mydir, mypath);
     p=strrchr(mydir, '\\');
@@ -724,7 +724,7 @@ static void test_load_save(void)
     check_lnk(lnkfile, &desc, 0x4);
 
     /* Create a temporary non-executable file */
-    r=GetTempPath(sizeof(mypath), mypath);
+    r=GetTempPathA(sizeof(mypath), mypath);
     ok(r<sizeof(mypath), "GetTempPath failed (%d), err %d\n", r, GetLastError());
     r=pGetLongPathNameA(mypath, mydir, sizeof(mydir));
     ok(r<sizeof(mydir), "GetLongPathName failed (%d), err %d\n", r, GetLastError());
@@ -734,8 +734,8 @@ static void test_load_save(void)
 
     strcpy(mypath, mydir);
     strcat(mypath, "\\test.txt");
-    hf = CreateFile(mypath, GENERIC_WRITE, 0, NULL,
-                    CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+    hf = CreateFileA(mypath, GENERIC_WRITE, 0, NULL,
+                     CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
     CloseHandle(hf);
 
     /* Overwrite the existing lnk file and test link to an existing non-executable file */
@@ -778,8 +778,8 @@ static void test_load_save(void)
     /* Create a temporary .bat file */
     strcpy(mypath, mydir);
     strcat(mypath, "\\test.bat");
-    hf = CreateFile(mypath, GENERIC_WRITE, 0, NULL,
-                    CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+    hf = CreateFileA(mypath, GENERIC_WRITE, 0, NULL,
+                     CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
     CloseHandle(hf);
 
     strcpy(realpath, mypath);
@@ -985,12 +985,174 @@ static void test_GetIconLocation(void)
     i = 0xdeadbeef;
     r = IShellLinkA_GetIconLocation(sl, buffer, sizeof(buffer), &i);
     ok(r == S_OK, "GetIconLocation failed (0x%08x)\n", r);
-    ok(lstrcmpi(buffer,str) == 0, "GetIconLocation returned '%s'\n", buffer);
+    ok(lstrcmpiA(buffer,str) == 0, "GetIconLocation returned '%s'\n", buffer);
     ok(i == 0xbabecafe, "GetIconLocation returned %d'\n", i);
 
     IShellLinkA_Release(sl);
 }
 
+static void test_SHGetStockIconInfo(void)
+{
+    BYTE buffer[sizeof(SHSTOCKICONINFO) + 16];
+    SHSTOCKICONINFO *sii = (SHSTOCKICONINFO *) buffer;
+    BOOL atleast_win7;
+    HRESULT hr;
+    INT i;
+
+    /* not present before vista */
+    if (!pSHGetStockIconInfo)
+    {
+        win_skip("SHGetStockIconInfo not available\n");
+        return;
+    }
+
+    /* negative values are handled */
+    memset(buffer, '#', sizeof(buffer));
+    sii->cbSize = sizeof(SHSTOCKICONINFO);
+    hr = pSHGetStockIconInfo(-1, SHGSI_ICONLOCATION, sii);
+    ok(hr == E_INVALIDARG, "-1: got 0x%x (expected E_INVALIDARG)\n", hr);
+
+    /* max. id for vista is 140 (no definition exists for this value) */
+    for (i = 0; i <= 140; i++)
+    {
+        memset(buffer, '#', sizeof(buffer));
+        sii->cbSize = sizeof(SHSTOCKICONINFO);
+        hr = pSHGetStockIconInfo(i, SHGSI_ICONLOCATION, sii);
+
+        ok(hr == S_OK,
+            "%3d: got 0x%x, iSysImageIndex: 0x%x, iIcon: 0x%x (expected S_OK)\n",
+            i, hr, sii->iSysImageIndex, sii->iIcon);
+
+        if ((hr == S_OK) && (winetest_debug > 1))
+            trace("%3d: got iSysImageIndex %3d, iIcon %3d and %s\n", i, sii->iSysImageIndex,
+                  sii->iIcon, wine_dbgstr_w(sii->szPath));
+    }
+
+    /* there are more icons since win7 */
+    memset(buffer, '#', sizeof(buffer));
+    sii->cbSize = sizeof(SHSTOCKICONINFO);
+    hr = pSHGetStockIconInfo(i, SHGSI_ICONLOCATION, sii);
+    atleast_win7 = (!hr);
+
+    for (; i < (SIID_MAX_ICONS + 25) ; i++)
+    {
+        memset(buffer, '#', sizeof(buffer));
+        sii->cbSize = sizeof(SHSTOCKICONINFO);
+        hr = pSHGetStockIconInfo(i, SHGSI_ICONLOCATION, sii);
+
+        if (atleast_win7 && (i == (SIID_MAX_ICONS - 1)) && broken(hr == E_INVALIDARG))
+        {
+            /* Off by one windows bug: there are SIID_MAX_ICONS icons from 0
+             * up to SIID_MAX_ICONS-1 on Windows 8, but the last one is missing
+             * on Windows 7.
+             */
+            trace("%3d: got E_INVALIDARG (windows bug: off by one)\n", i);
+        }
+        else if (atleast_win7 && (i < (SIID_MAX_ICONS)))
+        {
+            ok(hr == S_OK,
+                "%3d: got 0x%x, iSysImageIndex: 0x%x, iIcon: 0x%x (expected S_OK)\n",
+                i, hr, sii->iSysImageIndex, sii->iIcon);
+
+            if ((hr == S_OK) && (winetest_debug > 1))
+                trace("%3d: got iSysImageIndex %3d, iIcon %3d and %s\n", i, sii->iSysImageIndex,
+                      sii->iIcon, wine_dbgstr_w(sii->szPath));
+        }
+        else
+            ok(hr == E_INVALIDARG, "%3d: got 0x%x (expected E_INVALIDARG)\n", i, hr);
+    }
+
+    /* test more returned SHSTOCKICONINFO elements without extra flags */
+    memset(buffer, '#', sizeof(buffer));
+    sii->cbSize = sizeof(SHSTOCKICONINFO);
+    hr = pSHGetStockIconInfo(SIID_FOLDER, SHGSI_ICONLOCATION, sii);
+    ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+    ok(!sii->hIcon, "got %p (expected NULL)\n", sii->hIcon);
+    ok(sii->iSysImageIndex == -1, "got %d (expected -1)\n", sii->iSysImageIndex);
+
+    /* the exact size is required of the struct */
+    memset(buffer, '#', sizeof(buffer));
+    sii->cbSize = sizeof(SHSTOCKICONINFO) + 2;
+    hr = pSHGetStockIconInfo(SIID_FOLDER, SHGSI_ICONLOCATION, sii);
+    ok(hr == E_INVALIDARG, "+2: got 0x%x, iSysImageIndex: 0x%x, iIcon: 0x%x\n", hr, sii->iSysImageIndex, sii->iIcon);
+
+    memset(buffer, '#', sizeof(buffer));
+    sii->cbSize = sizeof(SHSTOCKICONINFO) + 1;
+    hr = pSHGetStockIconInfo(SIID_FOLDER, SHGSI_ICONLOCATION, sii);
+    ok(hr == E_INVALIDARG, "+1: got 0x%x, iSysImageIndex: 0x%x, iIcon: 0x%x\n", hr, sii->iSysImageIndex, sii->iIcon);
+
+    memset(buffer, '#', sizeof(buffer));
+    sii->cbSize = sizeof(SHSTOCKICONINFO) - 1;
+    hr = pSHGetStockIconInfo(SIID_FOLDER, SHGSI_ICONLOCATION, sii);
+    ok(hr == E_INVALIDARG, "-1: got 0x%x, iSysImageIndex: 0x%x, iIcon: 0x%x\n", hr, sii->iSysImageIndex, sii->iIcon);
+
+    memset(buffer, '#', sizeof(buffer));
+    sii->cbSize = sizeof(SHSTOCKICONINFO) - 2;
+    hr = pSHGetStockIconInfo(SIID_FOLDER, SHGSI_ICONLOCATION, sii);
+    ok(hr == E_INVALIDARG, "-2: got 0x%x, iSysImageIndex: 0x%x, iIcon: 0x%x\n", hr, sii->iSysImageIndex, sii->iIcon);
+
+    /* there is a NULL check for the struct  */
+    hr = pSHGetStockIconInfo(SIID_FOLDER, SHGSI_ICONLOCATION, NULL);
+    ok(hr == E_INVALIDARG, "NULL: got 0x%x\n", hr);
+}
+
+static void test_SHExtractIcons(void)
+{
+    static const WCHAR notepadW[] = {'n','o','t','e','p','a','d','.','e','x','e',0};
+    static const WCHAR shell32W[] = {'s','h','e','l','l','3','2','.','d','l','l',0};
+    static const WCHAR emptyW[] = {0};
+    UINT ret, ret2;
+    HICON icons[256];
+    UINT ids[256], i;
+
+    if (!pSHExtractIconsW)
+    {
+        win_skip("SHExtractIconsW not available\n");
+        return;
+    }
+
+    ret = pSHExtractIconsW(emptyW, 0, 16, 16, icons, ids, 1, 0);
+    ok(ret == ~0u, "got %u\n", ret);
+
+    ret = pSHExtractIconsW(notepadW, 0, 16, 16, NULL, NULL, 1, 0);
+    ok(ret == 1 || broken(ret == 2) /* win2k */, "got %u\n", ret);
+
+    icons[0] = (HICON)0xdeadbeef;
+    ret = pSHExtractIconsW(notepadW, 0, 16, 16, icons, NULL, 1, 0);
+    ok(ret == 1, "got %u\n", ret);
+    ok(icons[0] != (HICON)0xdeadbeef, "icon not set\n");
+    DestroyIcon(icons[0]);
+
+    icons[0] = (HICON)0xdeadbeef;
+    ids[0] = 0xdeadbeef;
+    ret = pSHExtractIconsW(notepadW, 0, 16, 16, icons, ids, 1, 0);
+    ok(ret == 1, "got %u\n", ret);
+    ok(icons[0] != (HICON)0xdeadbeef, "icon not set\n");
+    ok(ids[0] != 0xdeadbeef, "id not set\n");
+    DestroyIcon(icons[0]);
+
+    ret = pSHExtractIconsW(shell32W, 0, 16, 16, NULL, NULL, 0, 0);
+    ret2 = pSHExtractIconsW(shell32W, 4, MAKELONG(32,16), MAKELONG(32,16), NULL, NULL, 256, 0);
+    ok(ret && ret == ret2,
+       "icon count should be independent of requested icon sizes and base icon index\n");
+
+    ret = pSHExtractIconsW(shell32W, 0, 16, 16, icons, ids, 0, 0);
+    ok(ret == ~0u || !ret /* < vista */, "got %u\n", ret);
+
+    ret = pSHExtractIconsW(shell32W, 0, 16, 16, icons, ids, 3, 0);
+    ok(ret == 3, "got %u\n", ret);
+    for (i = 0; i < ret; i++) DestroyIcon(icons[i]);
+
+    /* count must be a multiple of two when getting two sizes */
+    ret = pSHExtractIconsW(shell32W, 0, MAKELONG(16,32), MAKELONG(16,32), icons, ids, 3, 0);
+    ok(!ret /* vista */ || ret == 4, "got %u\n", ret);
+    for (i = 0; i < ret; i++) DestroyIcon(icons[i]);
+
+    ret = pSHExtractIconsW(shell32W, 0, MAKELONG(16,32), MAKELONG(16,32), icons, ids, 4, 0);
+    ok(ret == 4, "got %u\n", ret);
+    for (i = 0; i < ret; i++) DestroyIcon(icons[i]);
+}
+
 START_TEST(shelllink)
 {
     HRESULT r;
@@ -1001,9 +1163,10 @@ START_TEST(shelllink)
     pILIsEqual = (void *)GetProcAddress(hmod, (LPSTR)21);
     pSHILCreateFromPath = (void *)GetProcAddress(hmod, (LPSTR)28);
     pSHDefExtractIconA = (void *)GetProcAddress(hmod, "SHDefExtractIconA");
-
+    pSHGetStockIconInfo = (void *)GetProcAddress(hmod, "SHGetStockIconInfo");
     pGetLongPathNameA = (void *)GetProcAddress(hkernel32, "GetLongPathNameA");
     pGetShortPathNameA = (void *)GetProcAddress(hkernel32, "GetShortPathNameA");
+    pSHExtractIconsW = (void *)GetProcAddress(hmod, "SHExtractIconsW");
 
     r = CoInitialize(NULL);
     ok(r == S_OK, "CoInitialize failed (0x%08x)\n", r);
@@ -1015,6 +1178,8 @@ START_TEST(shelllink)
     test_datalink();
     test_shdefextracticon();
     test_GetIconLocation();
+    test_SHGetStockIconInfo();
+    test_SHExtractIcons();
 
     CoUninitialize();
 }
index da1f667..3f0b490 100644 (file)
@@ -29,6 +29,7 @@
 
 DEFINE_GUID(FMTID_Test,0x12345678,0x1234,0x1234,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12);
 DEFINE_GUID(FMTID_NotExisting, 0x12345678,0x1234,0x1234,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x13);
+DEFINE_GUID(CLSID_ClassMoniker, 0x0000031a,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
 
 #define DEFINE_EXPECT(func) \
     static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
@@ -63,12 +64,16 @@ DEFINE_EXPECT(Release);
 DEFINE_EXPECT(Stat);
 DEFINE_EXPECT(WriteMultiple);
 
+DEFINE_EXPECT(autoplay_BindToObject);
+DEFINE_EXPECT(autoplay_GetClassObject);
+
 static HRESULT (WINAPI *pSHPropStgCreate)(IPropertySetStorage*, REFFMTID, const CLSID*,
         DWORD, DWORD, DWORD, IPropertyStorage**, UINT*);
 static HRESULT (WINAPI *pSHPropStgReadMultiple)(IPropertyStorage*, UINT,
         ULONG, const PROPSPEC*, PROPVARIANT*);
 static HRESULT (WINAPI *pSHPropStgWriteMultiple)(IPropertyStorage*, UINT*,
         ULONG, const PROPSPEC*, PROPVARIANT*, PROPID);
+static HRESULT (WINAPI *pSHCreateQueryCancelAutoPlayMoniker)(IMoniker**);
 
 static void init(void)
 {
@@ -77,6 +82,7 @@ static void init(void)
     pSHPropStgCreate = (void*)GetProcAddress(hmod, "SHPropStgCreate");
     pSHPropStgReadMultiple = (void*)GetProcAddress(hmod, "SHPropStgReadMultiple");
     pSHPropStgWriteMultiple = (void*)GetProcAddress(hmod, "SHPropStgWriteMultiple");
+    pSHCreateQueryCancelAutoPlayMoniker = (void*)GetProcAddress(hmod, "SHCreateQueryCancelAutoPlayMoniker");
 }
 
 static HRESULT WINAPI PropertyStorage_QueryInterface(IPropertyStorage *This,
@@ -429,9 +435,317 @@ static void test_SHPropStg_functions(void)
     CHECK_CALLED(Stat);
 }
 
+static HRESULT WINAPI test_activator_QI(IClassActivator *iface, REFIID riid, void **ppv)
+{
+    *ppv = NULL;
+
+    if (IsEqualIID(riid, &IID_IUnknown) ||
+        IsEqualIID(riid, &IID_IClassActivator))
+    {
+        *ppv = iface;
+    }
+
+    if (!*ppv) return E_NOINTERFACE;
+
+    IClassActivator_AddRef(iface);
+
+    return S_OK;
+}
+
+static ULONG WINAPI test_activator_AddRef(IClassActivator *iface)
+{
+    return 2;
+}
+
+static ULONG WINAPI test_activator_Release(IClassActivator *iface)
+{
+    return 1;
+}
+
+static HRESULT WINAPI test_activator_GetClassObject(IClassActivator *iface, REFCLSID clsid,
+    DWORD context, LCID locale, REFIID riid, void **ppv)
+{
+    CHECK_EXPECT(autoplay_GetClassObject);
+    ok(IsEqualGUID(clsid, &CLSID_QueryCancelAutoPlay), "clsid %s\n", wine_dbgstr_guid(clsid));
+    ok(IsEqualIID(riid, &IID_IQueryCancelAutoPlay), "riid %s\n", wine_dbgstr_guid(riid));
+    return E_NOTIMPL;
+}
+
+static const IClassActivatorVtbl test_activator_vtbl = {
+    test_activator_QI,
+    test_activator_AddRef,
+    test_activator_Release,
+    test_activator_GetClassObject
+};
+
+static IClassActivator test_activator = { &test_activator_vtbl };
+
+static HRESULT WINAPI test_moniker_QueryInterface(IMoniker* iface, REFIID riid, void **ppvObject)
+{
+    *ppvObject = 0;
+
+    if (IsEqualIID(&IID_IUnknown, riid) ||
+        IsEqualIID(&IID_IPersist, riid) ||
+        IsEqualIID(&IID_IPersistStream, riid) ||
+        IsEqualIID(&IID_IMoniker, riid))
+    {
+        *ppvObject = iface;
+    }
+
+    if (!*ppvObject)
+        return E_NOINTERFACE;
+
+    return S_OK;
+}
+
+static ULONG WINAPI test_moniker_AddRef(IMoniker* iface)
+{
+    return 2;
+}
+
+static ULONG WINAPI test_moniker_Release(IMoniker* iface)
+{
+    return 1;
+}
+
+static HRESULT WINAPI test_moniker_GetClassID(IMoniker* iface, CLSID *pClassID)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_moniker_IsDirty(IMoniker* iface)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_moniker_Load(IMoniker* iface, IStream* pStm)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_moniker_Save(IMoniker* iface, IStream* pStm, BOOL fClearDirty)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_moniker_GetSizeMax(IMoniker* iface, ULARGE_INTEGER* pcbSize)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_moniker_BindToObject(IMoniker* iface,
+                                                IBindCtx* pbc,
+                                                IMoniker* moniker_to_left,
+                                                REFIID riid,
+                                                void** ppv)
+{
+    CHECK_EXPECT(autoplay_BindToObject);
+    ok(pbc != NULL, "got %p\n", pbc);
+    ok(moniker_to_left == NULL, "got %p\n", moniker_to_left);
+    ok(IsEqualIID(riid, &IID_IClassActivator), "got riid %s\n", wine_dbgstr_guid(riid));
+
+    if (IsEqualIID(riid, &IID_IClassActivator))
+    {
+        *ppv = &test_activator;
+        return S_OK;
+    }
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_moniker_BindToStorage(IMoniker* iface,
+                                             IBindCtx* pbc,
+                                             IMoniker* pmkToLeft,
+                                             REFIID riid,
+                                             VOID** ppvResult)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_moniker_Reduce(IMoniker* iface,
+                                      IBindCtx* pbc,
+                                      DWORD dwReduceHowFar,
+                                      IMoniker** ppmkToLeft,
+                                      IMoniker** ppmkReduced)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_moniker_ComposeWith(IMoniker* iface,
+                                           IMoniker* pmkRight,
+                                           BOOL fOnlyIfNotGeneric,
+                                           IMoniker** ppmkComposite)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_moniker_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_moniker_IsEqual(IMoniker* iface, IMoniker* pmkOtherMoniker)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_moniker_Hash(IMoniker* iface, DWORD* pdwHash)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_moniker_IsRunning(IMoniker* iface,
+                                         IBindCtx* pbc,
+                                         IMoniker* pmkToLeft,
+                                         IMoniker* pmkNewlyRunning)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_moniker_GetTimeOfLastChange(IMoniker* iface,
+                                                   IBindCtx* pbc,
+                                                   IMoniker* pmkToLeft,
+                                                   FILETIME* pItemTime)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_moniker_Inverse(IMoniker* iface, IMoniker** ppmk)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_moniker_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** ppmkPrefix)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_moniker_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_moniker_GetDisplayName(IMoniker* iface,
+                                              IBindCtx* pbc,
+                                              IMoniker* pmkToLeft,
+                                              LPOLESTR *ppszDisplayName)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_moniker_ParseDisplayName(IMoniker* iface,
+                                                IBindCtx* pbc,
+                                                IMoniker* pmkToLeft,
+                                                LPOLESTR pszDisplayName,
+                                                ULONG* pchEaten,
+                                                IMoniker** ppmkOut)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_moniker_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static const IMonikerVtbl test_moniker_vtbl =
+{
+    test_moniker_QueryInterface,
+    test_moniker_AddRef,
+    test_moniker_Release,
+    test_moniker_GetClassID,
+    test_moniker_IsDirty,
+    test_moniker_Load,
+    test_moniker_Save,
+    test_moniker_GetSizeMax,
+    test_moniker_BindToObject,
+    test_moniker_BindToStorage,
+    test_moniker_Reduce,
+    test_moniker_ComposeWith,
+    test_moniker_Enum,
+    test_moniker_IsEqual,
+    test_moniker_Hash,
+    test_moniker_IsRunning,
+    test_moniker_GetTimeOfLastChange,
+    test_moniker_Inverse,
+    test_moniker_CommonPrefixWith,
+    test_moniker_RelativePathTo,
+    test_moniker_GetDisplayName,
+    test_moniker_ParseDisplayName,
+    test_moniker_IsSystemMoniker
+};
+
+static IMoniker test_moniker = { &test_moniker_vtbl };
+
+static void test_SHCreateQueryCancelAutoPlayMoniker(void)
+{
+    IBindCtx *ctxt;
+    IMoniker *mon;
+    IUnknown *unk;
+    CLSID clsid;
+    HRESULT hr;
+    DWORD sys;
+
+    if (!pSHCreateQueryCancelAutoPlayMoniker)
+    {
+        win_skip("SHCreateQueryCancelAutoPlayMoniker is not available, skipping tests.\n");
+        return;
+    }
+
+    hr = pSHCreateQueryCancelAutoPlayMoniker(NULL);
+    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+
+    hr = pSHCreateQueryCancelAutoPlayMoniker(&mon);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+
+    sys = -1;
+    hr = IMoniker_IsSystemMoniker(mon, &sys);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(sys == MKSYS_CLASSMONIKER, "got %d\n", sys);
+
+    memset(&clsid, 0, sizeof(clsid));
+    hr = IMoniker_GetClassID(mon, &clsid);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(IsEqualGUID(&clsid, &CLSID_ClassMoniker), "got %s\n", wine_dbgstr_guid(&clsid));
+
+    /* extract used CLSID that implements this hook */
+    SET_EXPECT(autoplay_BindToObject);
+    SET_EXPECT(autoplay_GetClassObject);
+
+    CreateBindCtx(0, &ctxt);
+    hr = IMoniker_BindToObject(mon, ctxt, &test_moniker, &IID_IQueryCancelAutoPlay, (void**)&unk);
+    ok(hr == E_NOTIMPL, "got 0x%08x\n", hr);
+    IBindCtx_Release(ctxt);
+
+    CHECK_CALLED(autoplay_BindToObject);
+    CHECK_CALLED(autoplay_GetClassObject);
+
+    IMoniker_Release(mon);
+}
+
 START_TEST(shellole)
 {
     init();
 
     test_SHPropStg_functions();
+    test_SHCreateQueryCancelAutoPlayMoniker();
 }
index e6b70d0..7486fac 100644 (file)
@@ -29,9 +29,9 @@
 #include "winbase.h"
 #include "shlguid.h"
 #include "shlobj.h"
-#include "shellapi.h"
 #include "shlwapi.h"
 #include "knownfolders.h"
+#include "shellapi.h"
 #include "wine/test.h"
 
 #include "initguid.h"
@@ -304,17 +304,6 @@ static const char *getFolderName(int folder)
     }
 }
 
-static const char *printGUID(const GUID *guid, char * guidSTR)
-{
-    if (!guid) return NULL;
-
-    sprintf(guidSTR, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
-     guid->Data1, guid->Data2, guid->Data3,
-     guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
-     guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
-    return guidSTR;
-}
-
 static void test_parameters(void)
 {
     LPITEMIDLIST pidl = NULL;
@@ -549,18 +538,16 @@ static void matchGUID(int folder, const GUID *guid, const GUID *guid_alt)
          pidlLast->mkid.abID[0] == PT_GUID))
         {
             GUID *shellGuid = (GUID *)(pidlLast->mkid.abID + 2);
-            char shellGuidStr[39], guidStr[39], guid_altStr[39];
 
             if (!guid_alt)
              ok(IsEqualIID(shellGuid, guid),
               "%s: got GUID %s, expected %s\n", getFolderName(folder),
-              printGUID(shellGuid, shellGuidStr), printGUID(guid, guidStr));
+              wine_dbgstr_guid(shellGuid), wine_dbgstr_guid(guid));
             else
              ok(IsEqualIID(shellGuid, guid) ||
               IsEqualIID(shellGuid, guid_alt),
               "%s: got GUID %s, expected %s or %s\n", getFolderName(folder),
-              printGUID(shellGuid, shellGuidStr), printGUID(guid, guidStr),
-              printGUID(guid_alt, guid_altStr));
+              wine_dbgstr_guid(shellGuid), wine_dbgstr_guid(guid), wine_dbgstr_guid(guid_alt));
         }
         IMalloc_Free(pMalloc, pidl);
     }
@@ -688,12 +675,12 @@ static char **myARGV;
 static char   base[MAX_PATH];
 static char   selfname[MAX_PATH];
 
-static int init(void)
+static BOOL init(void)
 {
     myARGC = winetest_get_mainargs(&myARGV);
-    if (!GetCurrentDirectoryA(sizeof(base), base)) return 0;
+    if (!GetCurrentDirectoryA(sizeof(base), base)) return FALSE;
     strcpy(selfname, myARGV[0]);
-    return 1;
+    return TRUE;
 }
 
 static void doChild(const char *arg)
@@ -1911,7 +1898,6 @@ static void check_known_folder(IKnownFolderManager *mgr, KNOWNFOLDERID *folderId
     IKnownFolder *folder;
     WCHAR sName[1024], sRelativePath[MAX_PATH], sParsingName[MAX_PATH];
     BOOL validPath;
-    char sParentGuid[39];
     BOOL *current_known_folder_found = &known_folder_found[0];
     BOOL found = FALSE;
     const char *srcParsingName;
@@ -1953,8 +1939,9 @@ static void check_known_folder(IKnownFolderManager *mgr, KNOWNFOLDERID *folderId
 
                     ok_(__FILE__, known_folder->line)(kfd.category == known_folder->category, "invalid known folder category for %s: %d expected, but %d retrieved\n", known_folder->sFolderId, known_folder->category, kfd.category);
 
-                    printGUID(&kfd.fidParent, sParentGuid);
-                    ok_(__FILE__, known_folder->line)(IsEqualGUID(known_folder->fidParent, &kfd.fidParent), "invalid known folder parent for %s: %s expected, but %s retrieved\n", known_folder->sFolderId, known_folder->sParent, sParentGuid);
+                    ok_(__FILE__, known_folder->line)(IsEqualGUID(known_folder->fidParent, &kfd.fidParent),
+                                                      "invalid known folder parent for %s: %s expected, but %s retrieved\n",
+                                                      known_folder->sFolderId, known_folder->sParent, wine_dbgstr_guid(&kfd.fidParent));
 
                     if(!known_folder->sRelativePath)
                         validPath = (kfd.pszRelativePath==NULL);
@@ -2012,23 +1999,21 @@ static void check_known_folder(IKnownFolderManager *mgr, KNOWNFOLDERID *folderId
 
     if(!found)
     {
-        printGUID(folderId, sParentGuid);
-        trace("unknown known folder found: %s\n", sParentGuid);
+        trace("unknown known folder found: %s\n", wine_dbgstr_guid(folderId));
 
         hr = IKnownFolderManager_GetFolder(mgr, folderId, &folder);
-        ok(hr == S_OK, "cannot get known folder for %s\n", sParentGuid);
+        ok(hr == S_OK, "cannot get known folder for %s\n", wine_dbgstr_guid(folderId));
         if(SUCCEEDED(hr))
         {
             hr = IKnownFolder_GetFolderDefinition(folder, &kfd);
             todo_wine
-            ok(hr == S_OK, "cannot get known folder definition for %s\n", sParentGuid);
+            ok(hr == S_OK, "cannot get known folder definition for %s\n", wine_dbgstr_guid(folderId));
             if(SUCCEEDED(hr))
             {
                 trace("  category: %d\n", kfd.category);
                 trace("  name: %s\n", wine_dbgstr_w(kfd.pszName));
                 trace("  description: %s\n", wine_dbgstr_w(kfd.pszDescription));
-                printGUID(&kfd.fidParent, sParentGuid);
-                trace("  parent: %s\n", sParentGuid);
+                trace("  parent: %s\n", wine_dbgstr_guid(&kfd.fidParent));
                 trace("  relative path: %s\n", wine_dbgstr_w(kfd.pszRelativePath));
                 trace("  parsing name: %s\n", wine_dbgstr_w(kfd.pszParsingName));
                 trace("  tooltip: %s\n", wine_dbgstr_w(kfd.pszTooltip));
@@ -2037,8 +2022,7 @@ static void check_known_folder(IKnownFolderManager *mgr, KNOWNFOLDERID *folderId
                 trace("  security: %s\n", wine_dbgstr_w(kfd.pszSecurity));
                 trace("  attributes: 0x%08x\n", kfd.dwAttributes);
                 trace("  flags: 0x%08x\n", kfd.kfdFlags);
-                printGUID(&kfd.ftidType, sParentGuid);
-                trace("  type: %s\n", sParentGuid);
+                trace("  type: %s\n", wine_dbgstr_guid(&kfd.ftidType));
                 FreeKnownFolderDefinitionFields(&kfd);
             }
 
@@ -2259,7 +2243,7 @@ static void test_knownFolders(void)
                             ok(lstrcmpiW(folderPath, sExample2Path)==0, "invalid known folder path retrieved: \"%s\" when \"%s\" was expected\n", wine_dbgstr_w(folderPath), wine_dbgstr_w(sExample2Path));
                             CoTaskMemFree(folderPath);
 
-                            /* verify sub folder - it should fail now, as we redirected it's parent folder, but we have no sub folder in new location */
+                            /* verify sub folder - it should fail now, as we redirected its parent folder, but we have no sub folder in new location */
                             hr = IKnownFolder_GetPath(subFolder, 0, &folderPath);
                             ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "unexpected value from GetPath(): 0x%08x\n", hr);
                             ok(folderPath==NULL, "invalid known folder path retrieved: \"%s\" when NULL pointer was expected\n", wine_dbgstr_w(folderPath));
@@ -2597,7 +2581,7 @@ static void test_DoEnvironmentSubst(void)
         " 0: got %s (expected %s)\n", wine_dbgstr_w(bufferW), wine_dbgstr_w(expectedW));
 
 
-    /* buffer to small */
+    /* Buffer too small */
     /* result: FALSE / provided buffer length / the buffer is untouched */
     memset(bufferA, '#', MAX_PATH - 1);
     bufferA[len + 2] = 0;
index db6f25d..597b38c 100755 (executable)
@@ -43,9 +43,9 @@
 #include "wtypes.h"
 #include "winbase.h"
 #include "windef.h"
-#include "ddeml.h"
 #include "shellapi.h"
 #include "shlwapi.h"
+#include "ddeml.h"
 #include "wine/test.h"
 
 #include "shell32_test.h"
@@ -57,6 +57,7 @@ static char** myARGV;
 static char tmpdir[MAX_PATH];
 static char child_file[MAX_PATH];
 static DLLVERSIONINFO dllver;
+static BOOL skip_shlexec_tests = FALSE;
 static BOOL skip_noassoc_tests = FALSE;
 static HANDLE dde_ready_event;
 
@@ -73,7 +74,7 @@ static void init_event(const char* child_file)
 {
     char* event_name;
     event_name=strrchr(child_file, '\\')+1;
-    hEvent=CreateEvent(NULL, FALSE, FALSE, event_name);
+    hEvent=CreateEventA(NULL, FALSE, FALSE, event_name);
 }
 
 static void strcat_param(char* str, const char* name, const char* param)
@@ -110,14 +111,14 @@ static INT_PTR shell_execute(LPCSTR verb, LPCSTR file, LPCSTR parameters, LPCSTR
     if (winetest_debug > 1)
         trace("%s\n", shell_call);
 
-    DeleteFile(child_file);
+    DeleteFileA(child_file);
     SetLastError(0xcafebabe);
 
     /* FIXME: We cannot use ShellExecuteEx() here because if there is no
      * association it displays the 'Open With' dialog and I could not find
      * a flag to prevent this.
      */
-    rc=(INT_PTR)ShellExecute(NULL, verb, file, parameters, directory, SW_SHOWNORMAL);
+    rc=(INT_PTR)ShellExecuteA(NULL, verb, file, parameters, directory, SW_SHOWNORMAL);
 
     if (rc > 32)
     {
@@ -128,7 +129,7 @@ static INT_PTR shell_execute(LPCSTR verb, LPCSTR file, LPCSTR parameters, LPCSTR
             HWND wnd = FindWindowA("#32770", "Windows");
             if (wnd != NULL)
             {
-                SendMessage(wnd, WM_CLOSE, 0, 0);
+                SendMessageA(wnd, WM_CLOSE, 0, 0);
                 win_skip("Skipping shellexecute of file with unassociated extension\n");
                 skip_noassoc_tests = TRUE;
                 rc = SE_ERR_NOASSOC;
@@ -161,7 +162,7 @@ static INT_PTR shell_execute_ex(DWORD mask, LPCSTR verb, LPCSTR file,
                                 LPCSTR parameters, LPCSTR directory,
                                 LPCSTR class)
 {
-    SHELLEXECUTEINFO sei;
+    SHELLEXECUTEINFOA sei;
     BOOL success;
     INT_PTR rc;
 
@@ -197,9 +198,9 @@ static INT_PTR shell_execute_ex(DWORD mask, LPCSTR verb, LPCSTR file,
     U(sei).hIcon=NULL;
     sei.hProcess=NULL; /* Out */
 
-    DeleteFile(child_file);
+    DeleteFileA(child_file);
     SetLastError(0xcafebabe);
-    success=ShellExecuteEx(&sei);
+    success=ShellExecuteExA(&sei);
     rc=(INT_PTR)sei.hInstApp;
     ok((success && rc > 32) || (!success && rc <= 32),
        "%s rc=%d and hInstApp=%ld is not allowed\n", shell_call, success, rc);
@@ -243,21 +244,21 @@ static BOOL create_test_association(const char* extension)
     LONG rc;
 
     sprintf(class, "shlexec%s", extension);
-    rc=RegCreateKeyEx(HKEY_CLASSES_ROOT, extension, 0, NULL, 0, KEY_SET_VALUE,
-                      NULL, &hkey, NULL);
+    rc=RegCreateKeyExA(HKEY_CLASSES_ROOT, extension, 0, NULL, 0, KEY_SET_VALUE,
+                       NULL, &hkey, NULL);
     if (rc != ERROR_SUCCESS)
         return FALSE;
 
-    rc=RegSetValueEx(hkey, NULL, 0, REG_SZ, (LPBYTE) class, strlen(class)+1);
+    rc=RegSetValueExA(hkey, NULL, 0, REG_SZ, (LPBYTE) class, strlen(class)+1);
     ok(rc==ERROR_SUCCESS, "RegSetValueEx '%s' failed, expected ERROR_SUCCESS, got %d\n", class, rc);
     CloseHandle(hkey);
 
-    rc=RegCreateKeyEx(HKEY_CLASSES_ROOT, class, 0, NULL, 0,
-                      KEY_CREATE_SUB_KEY | KEY_ENUMERATE_SUB_KEYS, NULL, &hkey, NULL);
+    rc=RegCreateKeyExA(HKEY_CLASSES_ROOT, class, 0, NULL, 0,
+                       KEY_CREATE_SUB_KEY | KEY_ENUMERATE_SUB_KEYS, NULL, &hkey, NULL);
     ok(rc==ERROR_SUCCESS, "RegCreateKeyEx '%s' failed, expected ERROR_SUCCESS, got %d\n", class, rc);
 
-    rc=RegCreateKeyEx(hkey, "shell", 0, NULL, 0,
-                      KEY_CREATE_SUB_KEY, NULL, &hkey_shell, NULL);
+    rc=RegCreateKeyExA(hkey, "shell", 0, NULL, 0,
+                       KEY_CREATE_SUB_KEY, NULL, &hkey_shell, NULL);
     ok(rc==ERROR_SUCCESS, "RegCreateKeyEx 'shell' failed, expected ERROR_SUCCESS, got %d\n", rc);
 
     CloseHandle(hkey);
@@ -353,26 +354,28 @@ static void create_test_verb_dde(const char* extension, const char* verb,
     LONG rc;
 
     sprintf(shell, "shlexec%s\\shell", extension);
-    rc=RegOpenKeyEx(HKEY_CLASSES_ROOT, shell, 0,
-                    KEY_CREATE_SUB_KEY, &hkey_shell);
-    assert(rc==ERROR_SUCCESS);
-    rc=RegCreateKeyEx(hkey_shell, verb, 0, NULL, 0, KEY_CREATE_SUB_KEY,
-                      NULL, &hkey_verb, NULL);
-    assert(rc==ERROR_SUCCESS);
-    rc=RegCreateKeyEx(hkey_verb, "command", 0, NULL, 0, KEY_SET_VALUE,
-                      NULL, &hkey_cmd, NULL);
-    assert(rc==ERROR_SUCCESS);
+    rc=RegOpenKeyExA(HKEY_CLASSES_ROOT, shell, 0,
+                     KEY_CREATE_SUB_KEY, &hkey_shell);
+    ok(rc == ERROR_SUCCESS, "%s key creation failed with %d\n", shell, rc);
+
+    rc=RegCreateKeyExA(hkey_shell, verb, 0, NULL, 0, KEY_CREATE_SUB_KEY,
+                       NULL, &hkey_verb, NULL);
+    ok(rc == ERROR_SUCCESS, "%s verb key creation failed with %d\n", verb, rc);
+
+    rc=RegCreateKeyExA(hkey_verb, "command", 0, NULL, 0, KEY_SET_VALUE,
+                       NULL, &hkey_cmd, NULL);
+    ok(rc == ERROR_SUCCESS, "\'command\' key creation failed with %d\n", rc);
 
     if (rawcmd)
     {
-        rc=RegSetValueEx(hkey_cmd, NULL, 0, REG_SZ, (LPBYTE)cmdtail, strlen(cmdtail)+1);
+        rc=RegSetValueExA(hkey_cmd, NULL, 0, REG_SZ, (LPBYTE)cmdtail, strlen(cmdtail)+1);
     }
     else
     {
         cmd=HeapAlloc(GetProcessHeap(), 0, strlen(argv0)+10+strlen(child_file)+2+strlen(cmdtail)+1);
         sprintf(cmd,"%s shlexec \"%s\" %s", argv0, child_file, cmdtail);
-        rc=RegSetValueEx(hkey_cmd, NULL, 0, REG_SZ, (LPBYTE)cmd, strlen(cmd)+1);
-        assert(rc==ERROR_SUCCESS);
+        rc=RegSetValueExA(hkey_cmd, NULL, 0, REG_SZ, (LPBYTE)cmd, strlen(cmd)+1);
+        ok(rc == ERROR_SUCCESS, "setting command failed with %d\n", rc);
         HeapFree(GetProcessHeap(), 0, cmd);
     }
 
@@ -380,40 +383,42 @@ static void create_test_verb_dde(const char* extension, const char* verb,
     {
         HKEY hkey_ddeexec, hkey_application, hkey_topic, hkey_ifexec;
 
-        rc=RegCreateKeyEx(hkey_verb, "ddeexec", 0, NULL, 0, KEY_SET_VALUE |
-                          KEY_CREATE_SUB_KEY, NULL, &hkey_ddeexec, NULL);
-        assert(rc==ERROR_SUCCESS);
-        rc=RegSetValueEx(hkey_ddeexec, NULL, 0, REG_SZ, (LPBYTE)ddeexec,
-                         strlen(ddeexec)+1);
-        assert(rc==ERROR_SUCCESS);
+        rc=RegCreateKeyExA(hkey_verb, "ddeexec", 0, NULL, 0, KEY_SET_VALUE |
+                           KEY_CREATE_SUB_KEY, NULL, &hkey_ddeexec, NULL);
+        ok(rc == ERROR_SUCCESS, "\'ddeexec\' key creation failed with %d\n", rc);
+        rc=RegSetValueExA(hkey_ddeexec, NULL, 0, REG_SZ, (LPBYTE)ddeexec,
+                          strlen(ddeexec)+1);
+        ok(rc == ERROR_SUCCESS, "set value failed with %d\n", rc);
+
         if (application)
         {
-            rc=RegCreateKeyEx(hkey_ddeexec, "application", 0, NULL, 0, KEY_SET_VALUE,
-                              NULL, &hkey_application, NULL);
-            assert(rc==ERROR_SUCCESS);
-            rc=RegSetValueEx(hkey_application, NULL, 0, REG_SZ, (LPBYTE)application,
-                             strlen(application)+1);
-            assert(rc==ERROR_SUCCESS);
+            rc=RegCreateKeyExA(hkey_ddeexec, "application", 0, NULL, 0, KEY_SET_VALUE,
+                               NULL, &hkey_application, NULL);
+            ok(rc == ERROR_SUCCESS, "\'application\' key creation failed with %d\n", rc);
+
+            rc=RegSetValueExA(hkey_application, NULL, 0, REG_SZ, (LPBYTE)application,
+                              strlen(application)+1);
+            ok(rc == ERROR_SUCCESS, "set value failed with %d\n", rc);
             CloseHandle(hkey_application);
         }
         if (topic)
         {
-            rc=RegCreateKeyEx(hkey_ddeexec, "topic", 0, NULL, 0, KEY_SET_VALUE,
-                              NULL, &hkey_topic, NULL);
-            assert(rc==ERROR_SUCCESS);
-            rc=RegSetValueEx(hkey_topic, NULL, 0, REG_SZ, (LPBYTE)topic,
-                             strlen(topic)+1);
-            assert(rc==ERROR_SUCCESS);
+            rc=RegCreateKeyExA(hkey_ddeexec, "topic", 0, NULL, 0, KEY_SET_VALUE,
+                               NULL, &hkey_topic, NULL);
+            ok(rc == ERROR_SUCCESS, "\'topic\' key creation failed with %d\n", rc);
+            rc=RegSetValueExA(hkey_topic, NULL, 0, REG_SZ, (LPBYTE)topic,
+                              strlen(topic)+1);
+            ok(rc == ERROR_SUCCESS, "set value failed with %d\n", rc);
             CloseHandle(hkey_topic);
         }
         if (ifexec)
         {
-            rc=RegCreateKeyEx(hkey_ddeexec, "ifexec", 0, NULL, 0, KEY_SET_VALUE,
-                              NULL, &hkey_ifexec, NULL);
-            assert(rc==ERROR_SUCCESS);
-            rc=RegSetValueEx(hkey_ifexec, NULL, 0, REG_SZ, (LPBYTE)ifexec,
-                             strlen(ifexec)+1);
-            assert(rc==ERROR_SUCCESS);
+            rc=RegCreateKeyExA(hkey_ddeexec, "ifexec", 0, NULL, 0, KEY_SET_VALUE,
+                               NULL, &hkey_ifexec, NULL);
+            ok(rc == ERROR_SUCCESS, "\'ifexec\' key creation failed with %d\n", rc);
+            rc=RegSetValueExA(hkey_ifexec, NULL, 0, REG_SZ, (LPBYTE)ifexec,
+                              strlen(ifexec)+1);
+            ok(rc == ERROR_SUCCESS, "set value failed with %d\n", rc);
             CloseHandle(hkey_ifexec);
         }
         CloseHandle(hkey_ddeexec);
@@ -518,14 +523,16 @@ static HDDEDATA CALLBACK ddeCb(UINT uType, UINT uFmt, HCONV hConv,
         case XTYP_CONNECT:
             if (!DdeCmpStringHandles(hsz1, hszTopic))
             {
-                size = DdeQueryString(ddeInst, hsz2, ddeApplication, MAX_PATH, CP_WINANSI);
+                size = DdeQueryStringA(ddeInst, hsz2, ddeApplication, MAX_PATH, CP_WINANSI);
+                ok(size < MAX_PATH, "got size %d\n", size);
                 assert(size < MAX_PATH);
                 return (HDDEDATA)TRUE;
             }
             return (HDDEDATA)FALSE;
 
         case XTYP_EXECUTE:
-            size = DdeGetData(hData, (LPBYTE)ddeExec, MAX_PATH, 0L);
+            size = DdeGetData(hData, (LPBYTE)ddeExec, MAX_PATH, 0);
+            ok(size < MAX_PATH, "got size %d\n", size);
             assert(size < MAX_PATH);
             DdeFreeDataHandle(hData);
             if (post_quit_on_execute)
@@ -593,32 +600,32 @@ static void doChild(int argc, char** argv)
             post_quit_on_execute = TRUE;
             ddeInst = 0;
             rc = DdeInitializeA(&ddeInst, ddeCb, CBF_SKIP_ALLNOTIFICATIONS | CBF_FAIL_ADVISES |
-                                CBF_FAIL_POKES | CBF_FAIL_REQUESTS, 0L);
-            assert(rc == DMLERR_NO_ERROR);
+                                CBF_FAIL_POKES | CBF_FAIL_REQUESTS, 0);
+            ok(rc == DMLERR_NO_ERROR, "got %d\n", rc);
             hszApplication = DdeCreateStringHandleA(ddeInst, shared_block, CP_WINANSI);
             hszTopic = DdeCreateStringHandleA(ddeInst, shared_block + strlen(shared_block) + 1, CP_WINANSI);
             assert(hszApplication && hszTopic);
-            assert(DdeNameService(ddeInst, hszApplication, 0L, DNS_REGISTER | DNS_FILTEROFF));
+            assert(DdeNameService(ddeInst, hszApplication, 0, DNS_REGISTER | DNS_FILTEROFF));
 
             timer = SetTimer(NULL, 0, 2500, childTimeout);
 
-            dde_ready = OpenEvent(EVENT_MODIFY_STATE, FALSE, "winetest_shlexec_dde_ready");
+            dde_ready = OpenEventA(EVENT_MODIFY_STATE, FALSE, "winetest_shlexec_dde_ready");
             SetEvent(dde_ready);
             CloseHandle(dde_ready);
 
-            while (GetMessage(&msg, NULL, 0, 0))
-                DispatchMessage(&msg);
+            while (GetMessageA(&msg, NULL, 0, 0))
+                DispatchMessageA(&msg);
 
             Sleep(500);
             KillTimer(NULL, timer);
-            assert(DdeNameService(ddeInst, hszApplication, 0L, DNS_UNREGISTER));
+            assert(DdeNameService(ddeInst, hszApplication, 0, DNS_UNREGISTER));
             assert(DdeFreeStringHandle(ddeInst, hszTopic));
             assert(DdeFreeStringHandle(ddeInst, hszApplication));
             assert(DdeUninitialize(ddeInst));
         }
         else
         {
-            dde_ready = OpenEvent(EVENT_MODIFY_STATE, FALSE, "winetest_shlexec_dde_ready");
+            dde_ready = OpenEventA(EVENT_MODIFY_STATE, FALSE, "winetest_shlexec_dde_ready");
             SetEvent(dde_ready);
             CloseHandle(dde_ready);
         }
@@ -740,10 +747,19 @@ static void _okChildInt(const char* file, int line, const char* key, int expecte
                     "%s expected %d, but got %d\n", key, expected, result);
 }
 
+static void _okChildIntBroken(const char* file, int line, const char* key, int expected)
+{
+    INT result;
+    result=GetPrivateProfileIntA("Arguments", key, expected, child_file);
+    ok_(file, line)(result == expected || broken(result != expected),
+                    "%s expected %d, but got %d\n", key, expected, result);
+}
+
 #define okChildString(key, expected) _okChildString(__FILE__, __LINE__, (key), (expected), (expected))
 #define okChildStringBroken(key, expected, broken) _okChildString(__FILE__, __LINE__, (key), (expected), (broken))
 #define okChildPath(key, expected) _okChildPath(__FILE__, __LINE__, (key), (expected))
-#define okChildInt(key, expected)    _okChildInt(__FILE__, __LINE__, (key), (expected))
+#define okChildInt(key, expected) _okChildInt(__FILE__, __LINE__, (key), (expected))
+#define okChildIntBroken(key, expected) _okChildIntBroken(__FILE__, __LINE__, (key), (expected))
 
 /***
  *
@@ -793,7 +809,7 @@ static DWORD get_long_path_name(const char* shortpath, char* longpath, DWORD lon
         }
         for (; *p && *p != '/' && *p != '\\'; p++);
         tmplen = p - (shortpath + sp);
-        lstrcpyn(tmplongpath + lp, shortpath + sp, tmplen + 1);
+        lstrcpynA(tmplongpath + lp, shortpath + sp, tmplen + 1);
         /* Check if the file exists and use the existing file name */
         goit = FindFirstFileA(tmplongpath, &wfd);
         if (goit == INVALID_HANDLE_VALUE)
@@ -906,6 +922,12 @@ static void test_lpFile_parsed(void)
     char fileA[MAX_PATH];
     INT_PTR rc;
 
+    if (skip_shlexec_tests)
+    {
+        skip("No filename parsing tests due to lack of .shlexec association\n");
+        return;
+    }
+
     /* existing "drawback_file.noassoc" prevents finding "drawback_file.noassoc foo.shlexec" on wine */
     sprintf(fileA, "%s\\drawback_file.noassoc foo.shlexec", tmpdir);
     rc=shell_execute(NULL, fileA, NULL, NULL);
@@ -1386,6 +1408,12 @@ static void test_argify(void)
     const char* cmd;
     unsigned i, count;
 
+    if (skip_shlexec_tests)
+    {
+        skip("No argify tests due to lack of .shlexec association\n");
+        return;
+    }
+
     create_test_verb(".shlexec", "Params232S", 0, "Params232S %2 %3 \"%2\" \"%*\"");
     create_test_verb(".shlexec", "Params23456", 0, "Params23456 \"%2\" \"%3\" \"%4\" \"%5\" \"%6\"");
     create_test_verb(".shlexec", "Params23456789", 0, "Params23456789 \"%2\" \"%3\" \"%4\" \"%5\" \"%6\" \"%7\" \"%8\" \"%9\"");
@@ -1465,6 +1493,12 @@ static void test_filename(void)
     char* c;
     INT_PTR rc;
 
+    if (skip_shlexec_tests)
+    {
+        skip("No ShellExecute/filename tests due to lack of .shlexec association\n");
+        return;
+    }
+
     test=filename_tests;
     while (test->basename)
     {
@@ -1686,7 +1720,13 @@ static void test_fileurls(void)
     char *s;
     INT_PTR rc;
 
-    rc = (INT_PTR)ShellExecute(NULL, NULL, "file:///nosuchfile.shlexec", NULL, NULL, SW_SHOWNORMAL);
+    if (skip_shlexec_tests)
+    {
+        skip("No file URL tests due to lack of .shlexec association\n");
+        return;
+    }
+
+    rc = (INT_PTR)ShellExecuteA(NULL, NULL, "file:///nosuchfile.shlexec", NULL, NULL, SW_SHOWNORMAL);
     if (rc > 32)
     {
         win_skip("shell32 is too old (likely < 4.72). Skipping the file URL tests\n");
@@ -1694,7 +1734,7 @@ static void test_fileurls(void)
     }
 
     get_long_path_name(tmpdir, longtmpdir, sizeof(longtmpdir)/sizeof(*longtmpdir));
-    SetEnvironmentVariable("urlprefix", "file:///");
+    SetEnvironmentVariableA("urlprefix", "file:///");
 
     test=fileurl_tests;
     while (test->basename)
@@ -1765,7 +1805,7 @@ static void test_fileurls(void)
         test++;
     }
 
-    SetEnvironmentVariable("urlprefix", NULL);
+    SetEnvironmentVariableA("urlprefix", NULL);
 }
 
 static void test_find_executable(void)
@@ -1856,6 +1896,12 @@ static void test_find_executable(void)
         return;
     }
 
+    if (skip_shlexec_tests)
+    {
+        skip("No FindExecutable/filename tests due to lack of .shlexec association\n");
+        return;
+    }
+
     test=filename_tests;
     while (test->basename)
     {
@@ -1886,7 +1932,7 @@ static void test_find_executable(void)
         }
         if (rc > 32)
         {
-            int equal;
+            BOOL equal;
             equal=strcmp(command, argv0) == 0 ||
                 /* NT4 returns an extra 0x8 character! */
                 (strlen(command) == strlen(argv0)+1 && strncmp(command, argv0, strlen(argv0)) == 0);
@@ -1929,23 +1975,28 @@ static void test_lnks(void)
     const filename_tests_t* test;
     INT_PTR rc;
 
-    /* Should open through our association */
-    sprintf(filename, "%s\\test_shortcut_shlexec.lnk", tmpdir);
-    rc=shell_execute_ex(SEE_MASK_NOZONECHECKS, NULL, filename, NULL, NULL, NULL);
-    ok(rc > 32, "%s failed: rc=%lu err=%u\n", shell_call, rc, GetLastError());
-    okChildInt("argcA", 5);
-    okChildString("argvA3", "Open");
-    sprintf(params, "%s\\test file.shlexec", tmpdir);
-    get_long_path_name(params, filename, sizeof(filename));
-    okChildPath("argvA4", filename);
+    if (skip_shlexec_tests)
+        skip("No FindExecutable/filename tests due to lack of .shlexec association\n");
+    else
+    {
+        /* Should open through our association */
+        sprintf(filename, "%s\\test_shortcut_shlexec.lnk", tmpdir);
+        rc=shell_execute_ex(SEE_MASK_NOZONECHECKS, NULL, filename, NULL, NULL, NULL);
+        ok(rc > 32, "%s failed: rc=%lu err=%u\n", shell_call, rc, GetLastError());
+        okChildInt("argcA", 5);
+        okChildString("argvA3", "Open");
+        sprintf(params, "%s\\test file.shlexec", tmpdir);
+        get_long_path_name(params, filename, sizeof(filename));
+        okChildPath("argvA4", filename);
 
-    todo_wait rc=shell_execute_ex(SEE_MASK_NOZONECHECKS|SEE_MASK_DOENVSUBST, NULL, "%TMPDIR%\\test_shortcut_shlexec.lnk", NULL, NULL, NULL);
-    ok(rc > 32, "%s failed: rc=%lu err=%u\n", shell_call, rc, GetLastError());
-    okChildInt("argcA", 5);
-    todo_wine okChildString("argvA3", "Open");
-    sprintf(params, "%s\\test file.shlexec", tmpdir);
-    get_long_path_name(params, filename, sizeof(filename));
-    todo_wine okChildPath("argvA4", filename);
+        todo_wait rc=shell_execute_ex(SEE_MASK_NOZONECHECKS|SEE_MASK_DOENVSUBST, NULL, "%TMPDIR%\\test_shortcut_shlexec.lnk", NULL, NULL, NULL);
+        ok(rc > 32, "%s failed: rc=%lu err=%u\n", shell_call, rc, GetLastError());
+        okChildInt("argcA", 5);
+        todo_wine okChildString("argvA3", "Open");
+        sprintf(params, "%s\\test file.shlexec", tmpdir);
+        get_long_path_name(params, filename, sizeof(filename));
+        todo_wine okChildPath("argvA4", filename);
+    }
 
     /* Should just run our executable */
     sprintf(filename, "%s\\test_shortcut_exe.lnk", tmpdir);
@@ -2053,7 +2104,7 @@ static void test_exes(void)
     if (! skip_noassoc_tests)
     {
         sprintf(filename, "%s\\test file.noassoc", tmpdir);
-        if (CopyFile(argv0, filename, FALSE))
+        if (CopyFileA(argv0, filename, FALSE))
         {
             rc=shell_execute(NULL, filename, params, NULL);
             todo_wine {
@@ -2076,35 +2127,35 @@ typedef struct
     const char* ifexec;
     int expectedArgs;
     const char* expectedDdeExec;
-    int todo;
+    BOOL broken;
 } dde_tests_t;
 
 static dde_tests_t dde_tests[] =
 {
     /* Test passing and not passing command-line
      * argument, no DDE */
-    {"", NULL, NULL, NULL, NULL, FALSE, "", 0x0},
-    {"\"%1\"", NULL, NULL, NULL, NULL, TRUE, "", 0x0},
+    {"", NULL, NULL, NULL, NULL, FALSE, ""},
+    {"\"%1\"", NULL, NULL, NULL, NULL, TRUE, ""},
 
     /* Test passing and not passing command-line
      * argument, with DDE */
-    {"", "[open(\"%1\")]", "shlexec", "dde", NULL, FALSE, "[open(\"%s\")]", 0x0},
-    {"\"%1\"", "[open(\"%1\")]", "shlexec", "dde", NULL, TRUE, "[open(\"%s\")]", 0x0},
+    {"", "[open(\"%1\")]", "shlexec", "dde", NULL, FALSE, "[open(\"%s\")]"},
+    {"\"%1\"", "[open(\"%1\")]", "shlexec", "dde", NULL, TRUE, "[open(\"%s\")]"},
 
     /* Test unquoted %1 in command and ddeexec
      * (test filename has space) */
-    {"%1", "[open(%1)]", "shlexec", "dde", NULL, 2, "[open(%s)]", 0x0},
+    {"%1", "[open(%1)]", "shlexec", "dde", NULL, 2, "[open(%s)]", TRUE /* before vista */},
 
     /* Test ifexec precedence over ddeexec */
-    {"", "[open(\"%1\")]", "shlexec", "dde", "[ifexec(\"%1\")]", FALSE, "[ifexec(\"%s\")]", 0x0},
+    {"", "[open(\"%1\")]", "shlexec", "dde", "[ifexec(\"%1\")]", FALSE, "[ifexec(\"%s\")]"},
 
     /* Test default DDE topic */
-    {"", "[open(\"%1\")]", "shlexec", NULL, NULL, FALSE, "[open(\"%s\")]", 0x0},
+    {"", "[open(\"%1\")]", "shlexec", NULL, NULL, FALSE, "[open(\"%s\")]"},
 
     /* Test default DDE application */
-    {"", "[open(\"%1\")]", NULL, "dde", NULL, FALSE, "[open(\"%s\")]", 0x0},
+    {"", "[open(\"%1\")]", NULL, "dde", NULL, FALSE, "[open(\"%s\")]"},
 
-    {NULL, NULL, NULL, NULL, NULL, 0, 0x0}
+    {NULL}
 };
 
 static DWORD WINAPI hooked_WaitForInputIdle(HANDLE process, DWORD timeout)
@@ -2224,47 +2275,19 @@ static void test_dde(void)
         dde_ready_event = CreateEventA(NULL, FALSE, FALSE, "winetest_shlexec_dde_ready");
         rc = shell_execute_ex(SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI, NULL, filename, NULL, NULL, NULL);
         CloseHandle(dde_ready_event);
-        if ((test->todo & 0x1)==0)
-        {
-            ok(32 < rc, "%s failed: rc=%lu err=%u\n", shell_call,
-               rc, GetLastError());
-        }
-        else todo_wine
-        {
-            ok(32 < rc, "%s failed: rc=%lu err=%u\n", shell_call,
-               rc, GetLastError());
-        }
+        ok(32 < rc, "%s failed: rc=%lu err=%u\n", shell_call, rc, GetLastError());
+
         if (32 < rc)
         {
-            if ((test->todo & 0x2)==0)
-            {
-                okChildInt("argcA", test->expectedArgs + 3);
-            }
-            else todo_wine
-            {
+            if (test->broken)
+                okChildIntBroken("argcA", test->expectedArgs + 3);
+            else
                 okChildInt("argcA", test->expectedArgs + 3);
-            }
-            if (test->expectedArgs == 1)
-            {
-                if ((test->todo & 0x4) == 0)
-                {
-                    okChildPath("argvA3", filename);
-                }
-                else todo_wine
-                {
-                    okChildPath("argvA3", filename);
-                }
-            }
-            if ((test->todo & 0x8) == 0)
-            {
-                sprintf(params, test->expectedDdeExec, filename);
-                okChildPath("ddeExec", params);
-            }
-            else todo_wine
-            {
-                sprintf(params, test->expectedDdeExec, filename);
-                okChildPath("ddeExec", params);
-            }
+
+            if (test->expectedArgs == 1) okChildPath("argvA3", filename);
+
+            sprintf(params, test->expectedDdeExec, filename);
+            okChildPath("ddeExec", params);
         }
 
         delete_test_association(".sde");
@@ -2337,10 +2360,10 @@ static DWORD CALLBACK ddeThread(LPVOID arg)
 {
     dde_thread_info_t *info = arg;
     assert(info && info->filename);
-    PostThreadMessage(info->threadIdParent,
-                      WM_QUIT,
-                      shell_execute_ex(SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI, NULL, info->filename, NULL, NULL, NULL),
-                      0L);
+    PostThreadMessageA(info->threadIdParent,
+                       WM_QUIT,
+                       shell_execute_ex(SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI, NULL, info->filename, NULL, NULL, NULL),
+                       0);
     ExitThread(0);
 }
 
@@ -2355,26 +2378,31 @@ static void test_dde_default_app(void)
     MSG msg;
     INT_PTR rc;
     int which = 0;
+    HDDEDATA ret;
+    BOOL b;
 
     post_quit_on_execute = FALSE;
     ddeInst = 0;
     rc = DdeInitializeA(&ddeInst, ddeCb, CBF_SKIP_ALLNOTIFICATIONS | CBF_FAIL_ADVISES |
-                        CBF_FAIL_POKES | CBF_FAIL_REQUESTS, 0L);
-    assert(rc == DMLERR_NO_ERROR);
+                        CBF_FAIL_POKES | CBF_FAIL_REQUESTS, 0);
+    ok(rc == DMLERR_NO_ERROR, "got %lx\n", rc);
 
     sprintf(filename, "%s\\test file.sde", tmpdir);
 
     /* It is strictly not necessary to register an application name here, but wine's
-     * DdeNameService implementation complains if 0L is passed instead of
+     * DdeNameService implementation complains if 0 is passed instead of
      * hszApplication with DNS_FILTEROFF */
     hszApplication = DdeCreateStringHandleA(ddeInst, "shlexec", CP_WINANSI);
     hszTopic = DdeCreateStringHandleA(ddeInst, "shlexec", CP_WINANSI);
-    assert(hszApplication && hszTopic);
-    assert(DdeNameService(ddeInst, hszApplication, 0L, DNS_REGISTER | DNS_FILTEROFF));
+    ok(hszApplication && hszTopic, "got %p and %p\n", hszApplication, hszTopic);
+    ret = DdeNameService(ddeInst, hszApplication, 0, DNS_REGISTER | DNS_FILTEROFF);
+    ok(ret != 0, "got %p\n", ret);
 
     test = dde_default_app_tests;
     while (test->command)
     {
+        HANDLE thread;
+
         if (!create_test_association(".sde"))
         {
             skip("Unable to create association for '.sde'\n");
@@ -2389,8 +2417,9 @@ static void test_dde_default_app(void)
          * so don't wait for it */
         SetEvent(hEvent);
 
-        assert(CreateThread(NULL, 0, ddeThread, &info, 0, &threadId));
-        while (GetMessage(&msg, NULL, 0, 0)) DispatchMessage(&msg);
+        thread = CreateThread(NULL, 0, ddeThread, &info, 0, &threadId);
+        ok(thread != NULL, "got %p\n", thread);
+        while (GetMessageA(&msg, NULL, 0, 0)) DispatchMessageA(&msg);
         rc = msg.wParam > 32 ? 33 : msg.wParam;
 
         /* First test, find which set of test data we expect to see */
@@ -2439,10 +2468,14 @@ static void test_dde_default_app(void)
         test++;
     }
 
-    assert(DdeNameService(ddeInst, hszApplication, 0L, DNS_UNREGISTER));
-    assert(DdeFreeStringHandle(ddeInst, hszTopic));
-    assert(DdeFreeStringHandle(ddeInst, hszApplication));
-    assert(DdeUninitialize(ddeInst));
+    ret = DdeNameService(ddeInst, hszApplication, 0, DNS_UNREGISTER);
+    ok(ret != 0, "got %p\n", ret);
+    b = DdeFreeStringHandle(ddeInst, hszTopic);
+    ok(b, "got %d\n", b);
+    b = DdeFreeStringHandle(ddeInst, hszApplication);
+    ok(b, "got %d\n", b);
+    b = DdeUninitialize(ddeInst);
+    ok(b, "got %d\n", b);
 }
 
 static void init_test(void)
@@ -2477,17 +2510,18 @@ static void init_test(void)
     if (FAILED(r))
         exit(1);
 
-    rc=GetModuleFileName(NULL, argv0, sizeof(argv0));
-    assert(rc!=0 && rc<sizeof(argv0));
-    if (GetFileAttributes(argv0)==INVALID_FILE_ATTRIBUTES)
+    rc=GetModuleFileNameA(NULL, argv0, sizeof(argv0));
+    ok(rc != 0 && rc < sizeof(argv0), "got %d\n", rc);
+    if (GetFileAttributesA(argv0)==INVALID_FILE_ATTRIBUTES)
     {
         strcat(argv0, ".so");
-        ok(GetFileAttributes(argv0)!=INVALID_FILE_ATTRIBUTES,
+        ok(GetFileAttributesA(argv0)!=INVALID_FILE_ATTRIBUTES,
            "unable to find argv0!\n");
     }
 
     GetTempPathA(sizeof(filename), filename);
     GetTempFileNameA(filename, "wt", 0, tmpdir);
+    GetLongPathNameA(tmpdir, tmpdir, sizeof(tmpdir));
     DeleteFileA( tmpdir );
     rc = CreateDirectoryA( tmpdir, NULL );
     ok( rc, "failed to create %s err %u\n", tmpdir, GetLastError() );
@@ -2495,7 +2529,7 @@ static void init_test(void)
     SetEnvironmentVariableA("TMPDIR", tmpdir);
 
     rc = GetTempFileNameA(tmpdir, "wt", 0, child_file);
-    assert(rc != 0);
+    ok(rc != 0, "got %d\n", rc);
     init_event(child_file);
 
     /* Set up the test files */
@@ -2505,7 +2539,7 @@ static void init_test(void)
         HANDLE hfile;
 
         sprintf(filename, *testfile, tmpdir);
-        hfile=CreateFile(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
+        hfile=CreateFileA(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
                      FILE_ATTRIBUTE_NORMAL, NULL);
         if (hfile==INVALID_HANDLE_VALUE)
         {
@@ -2548,6 +2582,7 @@ static void init_test(void)
     /* Create a basic association suitable for most tests */
     if (!create_test_association(".shlexec"))
     {
+        skip_shlexec_tests = TRUE;
         skip("Unable to create association for '.shlexec'\n");
         return;
     }
@@ -2570,11 +2605,11 @@ static void cleanup_test(void)
     {
         sprintf(filename, *testfile, tmpdir);
         /* Make sure we can delete the files ('test file.noassoc' is read-only now) */
-        SetFileAttributes(filename, FILE_ATTRIBUTE_NORMAL);
-        DeleteFile(filename);
+        SetFileAttributesA(filename, FILE_ATTRIBUTE_NORMAL);
+        DeleteFileA(filename);
         testfile++;
     }
-    DeleteFile(child_file);
+    DeleteFileA(child_file);
     RemoveDirectoryA(tmpdir);
 
     /* Delete the test association */
index 9bf1e73..64d0fbc 100644 (file)
@@ -258,11 +258,11 @@ static void test_get_file_info(void)
     /* Wine does not have a default icon for text files, and Windows 98 fails
      * if we give it an empty executable. So use notepad.exe as the test
      */
-    if (SearchPath(NULL, "notepad.exe", NULL, sizeof(notepad), notepad, NULL))
+    if (SearchPathA(NULL, "notepad.exe", NULL, sizeof(notepad), notepad, NULL))
     {
         strcpy(shfi.szDisplayName, "dummy");
         shfi.iIcon=0xdeadbeef;
-        rc=SHGetFileInfoA(notepad, GetFileAttributes(notepad),
+        rc=SHGetFileInfoA(notepad, GetFileAttributesA(notepad),
                           &shfi, sizeof(shfi),
                           SHGFI_ICONLOCATION | SHGFI_USEFILEATTRIBUTES);
         ok(rc == 1, "SHGetFileInfoA(%s, SHGFI_USEFILEATTRIBUTES) should return 1, got 0x%x\n", notepad, rc);
@@ -274,7 +274,7 @@ static void test_get_file_info(void)
         ok(rc2 == 1, "SHGetFileInfoA(%s) failed %x\n", notepad, rc2);
         if (rc && rc2)
         {
-            ok(lstrcmpi(shfi2.szDisplayName, shfi.szDisplayName) == 0, "wrong display name %s != %s\n", shfi.szDisplayName, shfi2.szDisplayName);
+            ok(lstrcmpiA(shfi2.szDisplayName, shfi.szDisplayName) == 0, "wrong display name %s != %s\n", shfi.szDisplayName, shfi2.szDisplayName);
             ok(shfi2.iIcon == shfi.iIcon, "wrong icon index %d != %d\n", shfi.iIcon, shfi2.iIcon);
         }
     }
@@ -282,7 +282,7 @@ static void test_get_file_info(void)
     /* with a directory now */
     strcpy(shfi.szDisplayName, "dummy");
     shfi.iIcon=0xdeadbeef;
-    rc=SHGetFileInfoA("test4.txt", GetFileAttributes("test4.txt"),
+    rc=SHGetFileInfoA("test4.txt", GetFileAttributesA("test4.txt"),
                       &shfi, sizeof(shfi),
                       SHGFI_ICONLOCATION | SHGFI_USEFILEATTRIBUTES);
     ok(rc == 1, "SHGetFileInfoA(test4.txt/, SHGFI_USEFILEATTRIBUTES) should return 1, got 0x%x\n", rc);
@@ -294,7 +294,7 @@ static void test_get_file_info(void)
     ok(rc2 == 1, "SHGetFileInfoA(test4.txt/) should return 1, got 0x%x\n", rc2);
     if (rc && rc2)
     {
-        ok(lstrcmpi(shfi2.szDisplayName, shfi.szDisplayName) == 0, "wrong display name %s != %s\n", shfi.szDisplayName, shfi2.szDisplayName);
+        ok(lstrcmpiA(shfi2.szDisplayName, shfi.szDisplayName) == 0, "wrong display name %s != %s\n", shfi.szDisplayName, shfi2.szDisplayName);
         ok(shfi2.iIcon == shfi.iIcon, "wrong icon index %d != %d\n", shfi.iIcon, shfi2.iIcon);
     }
     /* with drive root directory */
@@ -306,8 +306,8 @@ static void test_get_file_info(void)
     rc=SHGetFileInfoA("c:\\", 0, &shfi, sizeof(shfi),
                       SHGFI_TYPENAME | SHGFI_DISPLAYNAME | SHGFI_ICON | SHGFI_SMALLICON);
     ok(rc == 1, "SHGetFileInfoA(c:\\) should return 1, got 0x%x\n", rc);
-    ok(lstrcmp(shfi.szDisplayName, "dummy") != 0, "display name was expected to change\n");
-    ok(lstrcmp(shfi.szTypeName, "dummy") != 0, "type name was expected to change\n");
+    ok(strcmp(shfi.szDisplayName, "dummy") != 0, "display name was expected to change\n");
+    ok(strcmp(shfi.szTypeName, "dummy") != 0, "type name was expected to change\n");
     ok(shfi.hIcon != (HICON) 0xdeadbeef, "hIcon was expected to change\n");
     ok(shfi.iIcon != 0xdeadbeef, "iIcon was expected to change\n");
 }
@@ -569,7 +569,7 @@ static void test_delete(void)
     init_shfo_tests();
     shfo.fFlags |= FOF_FILESONLY;
     shfo.pFrom = "*.txt\0";
-    ok(!SHFileOperation(&shfo), "Failed to delete files\n");
+    ok(!SHFileOperationA(&shfo), "Failed to delete files\n");
     ok(!file_exists("test1.txt"), "test1.txt should have been removed\n");
     ok(!file_exists("test_5.txt"), "test_5.txt should have been removed\n");
     ok(dir_exists("test4.txt"), "test4.txt should not have been removed\n");
@@ -577,7 +577,7 @@ static void test_delete(void)
     /* FOF_FILESONLY only deletes a dir if explicitly specified */
     init_shfo_tests();
     shfo.pFrom = "test_?.txt\0test4.txt\0";
-    ok(!SHFileOperation(&shfo), "Failed to delete files and directory\n");
+    ok(!SHFileOperationA(&shfo), "Failed to delete files and directory\n");
     ok(!dir_exists("test4.txt") ||
        broken(dir_exists("test4.txt")), /* NT4 */
       "test4.txt should have been removed\n");
@@ -591,7 +591,7 @@ static void test_delete(void)
         shfo.pFrom = "\0";
         shfo.fFlags &= ~FOF_FILESONLY;
         shfo.fAnyOperationsAborted = FALSE;
-        ret = SHFileOperation(&shfo);
+        ret = SHFileOperationA(&shfo);
         ok(ret == ERROR_ACCESS_DENIED, "Expected ERROR_ACCESS_DENIED, got %d\n", ret);
         ok(!shfo.fAnyOperationsAborted, "Expected no aborted operations\n");
         ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
@@ -601,7 +601,7 @@ static void test_delete(void)
     init_shfo_tests();
     shfo.pFrom = "test1.txt\0";
     shfo.wFunc = 0;
-    ret = SHFileOperation(&shfo);
+    ret = SHFileOperationA(&shfo);
     ok(ret == ERROR_INVALID_PARAMETER ||
        broken(ret == ERROR_SUCCESS), /* Win9x, NT4 */
        "Expected ERROR_INVALID_PARAMETER, got %d\n", ret);
@@ -613,7 +613,7 @@ static void test_delete(void)
         init_shfo_tests();
         shfo.pFrom = "";
         shfo.wFunc = FO_DELETE;
-        ret = SHFileOperation(&shfo);
+        ret = SHFileOperationA(&shfo);
         ok(ret == ERROR_ACCESS_DENIED, "Expected ERROR_ACCESS_DENIED, got %d\n", ret);
         ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
     }
@@ -621,7 +621,7 @@ static void test_delete(void)
     /* delete a nonexistent file */
     shfo.pFrom = "nonexistent.txt\0";
     shfo.wFunc = FO_DELETE;
-    ret = SHFileOperation(&shfo);
+    ret = SHFileOperationA(&shfo);
     todo_wine
     ok(ret == 1026 ||
        ret == ERROR_FILE_NOT_FOUND || /* Vista */
@@ -636,7 +636,7 @@ static void test_delete(void)
         /* Vista would throw up a dialog box that we can't suppress */
         init_shfo_tests();
         shfo.pFrom = "testdir2\0testdir2\\one.txt\0";
-        ret = SHFileOperation(&shfo);
+        ret = SHFileOperationA(&shfo);
         ok(ret == ERROR_PATH_NOT_FOUND ||
            broken(ret == ERROR_SUCCESS), /* NT4 */
            "Expected ERROR_PATH_NOT_FOUND, got %d\n", ret);
@@ -646,11 +646,41 @@ static void test_delete(void)
     else
         skip("Test would show a dialog box\n");
 
+    /* delete an existent file and a nonexistent file */
+    init_shfo_tests();
+    shfo.pFrom = "test1.txt\0nonexistent.txt\0test2.txt\0";
+    shfo.wFunc = FO_DELETE;
+    ret = SHFileOperationA(&shfo);
+    todo_wine
+    ok(ret == 1026 ||
+       ret == ERROR_FILE_NOT_FOUND || /* Vista */
+       broken(ret == ERROR_SUCCESS), /* NT4 */
+       "Expected 1026 or ERROR_FILE_NOT_FOUND, got %d\n", ret);
+    todo_wine
+    ok(file_exists("test1.txt"), "Expected test1.txt to exist\n");
+    ok(file_exists("test2.txt"), "Expected test2.txt to exist\n");
+
+    /* delete a nonexistent file in an existent dir or a nonexistent dir */
+    init_shfo_tests();
+    shfo.pFrom = "testdir2\\nonexistent.txt\0";
+    ret = SHFileOperationA(&shfo);
+    todo_wine
+    ok(ret == ERROR_FILE_NOT_FOUND || /* Vista */
+       broken(ret == 0x402) || /* XP */
+       broken(ret == ERROR_SUCCESS), /* NT4 */
+       "Expected 0x402 or ERROR_FILE_NOT_FOUND, got %x\n", ret);
+    shfo.pFrom = "nonexistent\\one.txt\0";
+    ret = SHFileOperationA(&shfo);
+    todo_wine
+    ok(ret == DE_INVALIDFILES || /* Vista or later */
+       broken(ret == 0x402), /* XP */
+       "Expected 0x402 or DE_INVALIDFILES, got %x\n", ret);
+
     /* try the FOF_NORECURSION flag, continues deleting subdirs */
     init_shfo_tests();
     shfo.pFrom = "testdir2\0";
     shfo.fFlags |= FOF_NORECURSION;
-    ret = SHFileOperation(&shfo);
+    ret = SHFileOperationA(&shfo);
     ok(ret == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", ret);
     ok(!file_exists("testdir2\\one.txt"), "Expected testdir2\\one.txt to not exist\n");
     ok(!dir_exists("testdir2\\nested"), "Expected testdir2\\nested to not exist\n");
@@ -950,7 +980,7 @@ static void test_copy(void)
     shfo.fFlags = FOF_NOCONFIRMMKDIR;
     set_curr_dir_path(from, "test1.txt\0");
     set_curr_dir_path(to, "nonexistent\\notreal\\test2.txt\0");
-    retval= SHFileOperation(&shfo);
+    retval= SHFileOperationA(&shfo);
     ok(!retval, "Error copying into nonexistent directory\n");
     ok(file_exists("nonexistent"), "nonexistent not created\n");
     ok(file_exists("nonexistent\\notreal"), "nonexistent\\notreal not created\n");
@@ -962,7 +992,7 @@ static void test_copy(void)
     init_shfo_tests();
     shfo.pFrom = "test1.txt\0test2.txt\0test3.txt\0";
     shfo.pTo = "testdir2\0";
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
     ok(file_exists("testdir2\\test1.txt"), "Expected testdir2\\test1 to exist\n");
 
@@ -996,7 +1026,7 @@ static void test_copy(void)
     set_curr_dir_path(from, "test1.txt\0test2.txt\0");
     set_curr_dir_path(to, "test3.txt\0");
     shfo.fAnyOperationsAborted = 0xdeadbeef;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     ok(shfo.fAnyOperationsAborted != 0xdeadbeef ||
        broken(shfo.fAnyOperationsAborted == 0xdeadbeef), /* NT4 */
        "Expected TRUE/FALSE fAnyOperationsAborted not 0xdeadbeef\n");
@@ -1014,17 +1044,17 @@ static void test_copy(void)
     ok(!file_exists("test3.txt\\test2.txt"), "Expected test3.txt\\test2.txt to not exist\n");
 
     /* try to copy many files to nonexistent directory */
-    DeleteFile(to);
+    DeleteFileA(to);
     shfo.fFlags &= ~FOF_NOERRORUI;
     shfo.fAnyOperationsAborted = 0xdeadbeef;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&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");
-    ok(RemoveDirectory(to), "Expected test3.txt to exist\n");
+    ok(DeleteFileA("test3.txt\\test1.txt"), "Expected test3.txt\\test1.txt to exist\n");
+    ok(DeleteFileA("test3.txt\\test2.txt"), "Expected test3.txt\\test1.txt to exist\n");
+    ok(RemoveDirectoryA(to), "Expected test3.txt to exist\n");
 
     /* send in FOF_MULTIDESTFILES with too many destination files */
     init_shfo_tests();
@@ -1032,7 +1062,7 @@ static void test_copy(void)
     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);
+    retval = SHFileOperationA(&shfo);
     ok(shfo.fAnyOperationsAborted != 0xdeadbeef ||
        broken(shfo.fAnyOperationsAborted == 0xdeadbeef), /* NT4 */
        "Expected TRUE/FALSE fAnyOperationsAborted not 0xdeadbeef\n");
@@ -1041,12 +1071,12 @@ static void test_copy(void)
         /* 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");
-        RemoveDirectory("testdir2\\b.txt");
-        ok(DeleteFile("testdir2\\c.txt\\test3.txt"), "Expected testdir2\\c.txt\\test3.txt to exist\n");
-        RemoveDirectory("testdir2\\c.txt");
+        ok(DeleteFileA("testdir2\\a.txt\\test1.txt"), "Expected testdir2\\a.txt\\test1.txt to exist\n");
+        RemoveDirectoryA("testdir2\\a.txt");
+        ok(DeleteFileA("testdir2\\b.txt\\test2.txt"), "Expected testdir2\\b.txt\\test2.txt to exist\n");
+        RemoveDirectoryA("testdir2\\b.txt");
+        ok(DeleteFileA("testdir2\\c.txt\\test3.txt"), "Expected testdir2\\c.txt\\test3.txt to exist\n");
+        RemoveDirectoryA("testdir2\\c.txt");
         ok(!file_exists("testdir2\\d.txt"), "Expected testdir2\\d.txt to not exist\n");
     }
     else
@@ -1062,7 +1092,7 @@ static void test_copy(void)
     shfo.pFrom = "test1.txt\0test2.txt\0test3.txt\0";
     shfo.pTo = "e.txt\0f.txt\0";
     shfo.fAnyOperationsAborted = 0xdeadbeef;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     ok(shfo.fAnyOperationsAborted != 0xdeadbeef ||
        broken(shfo.fAnyOperationsAborted == 0xdeadbeef), /* NT4 */
        "Expected TRUE/FALSE fAnyOperationsAborted not 0xdeadbeef\n");
@@ -1071,10 +1101,10 @@ static void test_copy(void)
         /* 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");
-        ok(DeleteFile("f.txt\\test2.txt"), "Expected f.txt\\test2.txt to exist\n");
-        RemoveDirectory("f.txt");
+        ok(DeleteFileA("e.txt\\test1.txt"), "Expected e.txt\\test1.txt to exist\n");
+        RemoveDirectoryA("e.txt");
+        ok(DeleteFileA("f.txt\\test2.txt"), "Expected f.txt\\test2.txt to exist\n");
+        RemoveDirectoryA("f.txt");
     }
     else
     {
@@ -1089,24 +1119,24 @@ static void test_copy(void)
     shfo.pFrom = "test1.txt\0test2.txt\0test4.txt\0";
     shfo.pTo = "testdir2\\a.txt\0testdir2\\b.txt\0testdir2\\c.txt\0";
     shfo.fAnyOperationsAborted = 0xdeadbeef;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&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);
-    ok(DeleteFile("testdir2\\a.txt"), "Expected testdir2\\a.txt to exist\n");
-    ok(DeleteFile("testdir2\\b.txt"), "Expected testdir2\\b.txt to exist\n");
+    ok(DeleteFileA("testdir2\\a.txt"), "Expected testdir2\\a.txt to exist\n");
+    ok(DeleteFileA("testdir2\\b.txt"), "Expected testdir2\\b.txt to exist\n");
     if (retval == ERROR_SUCCESS)
-        ok(RemoveDirectory("testdir2\\c.txt"), "Expected testdir2\\c.txt to exist\n");
+        ok(RemoveDirectoryA("testdir2\\c.txt"), "Expected testdir2\\c.txt to exist\n");
 
     /* 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 = 0xdeadbeef;
     shfo.fFlags &= ~FOF_MULTIDESTFILES;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     ok(shfo.fAnyOperationsAborted != 0xdeadbeef ||
        broken(shfo.fAnyOperationsAborted == 0xdeadbeef), /* NT4 */
        "Expected TRUE/FALSE fAnyOperationsAborted not 0xdeadbeef\n");
@@ -1115,10 +1145,10 @@ static void test_copy(void)
         /* 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");
-        RemoveDirectory("a.txt");
+        ok(DeleteFileA("a.txt\\test1.txt"), "Expected a.txt\\test1.txt to exist\n");
+        ok(DeleteFileA("a.txt\\test2.txt"), "Expected a.txt\\test2.txt to exist\n");
+        ok(DeleteFileA("a.txt\\test3.txt"), "Expected a.txt\\test3.txt to exist\n");
+        RemoveDirectoryA("a.txt");
     }
     else
     {
@@ -1134,7 +1164,7 @@ static void test_copy(void)
     shfo.pFrom = "test?.txt\0";
     shfo.pTo = "testdir2\0";
     shfo.fFlags &= ~FOF_MULTIDESTFILES;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     ok(retval == ERROR_SUCCESS ||
        broken(retval == 0x100a1), /* WinMe */
        "Expected ERROR_SUCCESS, got %d\n", retval);
@@ -1145,7 +1175,7 @@ static void test_copy(void)
     init_shfo_tests();
     shfo.pFrom = "test?.txt\0";
     shfo.fFlags |= FOF_FILESONLY;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
     ok(file_exists("testdir2\\test1.txt"), "Expected testdir2\\test1.txt to exist\n");
     ok(!dir_exists("testdir2\\test4.txt"), "Expected testdir2\\test4.txt to not exist\n");
@@ -1158,16 +1188,16 @@ static void test_copy(void)
     shfo.pTo = "testdir2\\a.txt\0testdir2\\b.txt\0testdir2\\c.txt\0testdir2\\d.txt\0";
     shfo.fFlags &= ~FOF_FILESONLY;
     shfo.fFlags |= FOF_MULTIDESTFILES;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     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(DeleteFile("testdir2\\a.txt\\test1.txt"), "Expected testdir2\\a.txt\\test1.txt to exist\n");
-        ok(DeleteFile("testdir2\\a.txt\\test2.txt"), "Expected testdir2\\a.txt\\test2.txt to exist\n");
-        ok(DeleteFile("testdir2\\a.txt\\test3.txt"), "Expected testdir2\\a.txt\\test3.txt to exist\n");
-        ok(RemoveDirectory("testdir2\\a.txt\\test4.txt"), "Expected testdir2\\a.txt\\test4.txt to exist\n");
-        RemoveDirectory("testdir2\\a.txt");
+        ok(DeleteFileA("testdir2\\a.txt\\test1.txt"), "Expected testdir2\\a.txt\\test1.txt to exist\n");
+        ok(DeleteFileA("testdir2\\a.txt\\test2.txt"), "Expected testdir2\\a.txt\\test2.txt to exist\n");
+        ok(DeleteFileA("testdir2\\a.txt\\test3.txt"), "Expected testdir2\\a.txt\\test3.txt to exist\n");
+        ok(RemoveDirectoryA("testdir2\\a.txt\\test4.txt"), "Expected testdir2\\a.txt\\test4.txt to exist\n");
+        RemoveDirectoryA("testdir2\\a.txt");
     }
     else
     {
@@ -1177,7 +1207,7 @@ static void test_copy(void)
            "Expected aborted operations\n");
         ok(!file_exists("testdir2\\a.txt"), "Expected testdir2\\test1.txt to not exist\n");
     }
-    ok(!RemoveDirectory("b.txt"), "b.txt should not exist\n");
+    ok(!RemoveDirectoryA("b.txt"), "b.txt should not exist\n");
 
     /* copy one file to two others, second is ignored */
     clean_after_shfo_tests();
@@ -1185,7 +1215,7 @@ static void test_copy(void)
     shfo.pFrom = "test1.txt\0";
     shfo.pTo = "b.txt\0c.txt\0";
     shfo.fAnyOperationsAborted = 0xdeadbeef;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     ok(!shfo.fAnyOperationsAborted ||
        broken(shfo.fAnyOperationsAborted == 0xdeadbeef), /* NT4 */
        "Didn't expect aborted operations\n");
@@ -1200,24 +1230,24 @@ static void test_copy(void)
     else
     {
         ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
-        ok(DeleteFile("b.txt"), "Expected b.txt to exist\n");
+        ok(DeleteFileA("b.txt"), "Expected b.txt to exist\n");
     }
-    ok(!DeleteFile("c.txt"), "Expected c.txt to not exist\n");
+    ok(!DeleteFileA("c.txt"), "Expected c.txt to not exist\n");
 
     /* 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);
+    retval = SHFileOperationA(&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");
-        RemoveDirectory("c.txt");
+        ok(DeleteFileA("b.txt\\test1.txt"), "Expected b.txt\\test1.txt to exist\n");
+        RemoveDirectoryA("b.txt");
+        ok(DeleteFileA("c.txt\\test2.txt"), "Expected c.txt\\test2.txt to exist\n");
+        RemoveDirectoryA("c.txt");
     }
     else
     {
@@ -1225,23 +1255,23 @@ static void test_copy(void)
         ok(shfo.fAnyOperationsAborted ||
            broken(shfo.fAnyOperationsAborted == 0xdeadbeef), /* NT4 */
            "Expected aborted operations\n");
-        ok(!DeleteFile("b.txt"), "Expected b.txt to not exist\n");
+        ok(!DeleteFileA("b.txt"), "Expected b.txt to not exist\n");
     }
 
     /* 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 = 0xdeadbeef;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&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");
-        RemoveDirectory("c.txt");
+        ok(DeleteFileA("b.txt\\test1.txt"), "Expected b.txt\\test1.txt to exist\n");
+        RemoveDirectoryA("b.txt");
+        ok(RemoveDirectoryA("c.txt\\test4.txt"), "Expected c.txt\\test4.txt to exist\n");
+        RemoveDirectoryA("c.txt");
     }
     else
     {
@@ -1249,8 +1279,8 @@ static void test_copy(void)
         ok(shfo.fAnyOperationsAborted ||
            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");
+        ok(!DeleteFileA("b.txt"), "Expected b.txt to not exist\n");
+        ok(!DeleteFileA("c.txt"), "Expected c.txt to not exist\n");
     }
 
     /* copy a directory with a file beneath it, plus some files */
@@ -1259,42 +1289,42 @@ static void test_copy(void)
     shfo.pTo = "testdir2\0";
     shfo.fFlags &= ~FOF_MULTIDESTFILES;
     shfo.fAnyOperationsAborted = FALSE;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     ok(retval == ERROR_SUCCESS ||
        broken(retval == 0x100a1), /* WinMe */
        "Expected ERROR_SUCCESS, got %d\n", retval);
     if (retval == ERROR_SUCCESS)
     {
-        ok(DeleteFile("testdir2\\test1.txt"), "Expected testdir2\\test1.txt to exist\n");
-        ok(DeleteFile("testdir2\\test4.txt\\a.txt"), "Expected a.txt to exist\n");
-        ok(RemoveDirectory("testdir2\\test4.txt"), "Expected testdir2\\test4.txt to exist\n");
+        ok(DeleteFileA("testdir2\\test1.txt"), "Expected testdir2\\test1.txt to exist\n");
+        ok(DeleteFileA("testdir2\\test4.txt\\a.txt"), "Expected a.txt to exist\n");
+        ok(RemoveDirectoryA("testdir2\\test4.txt"), "Expected testdir2\\test4.txt to exist\n");
     }
 
     /* copy one directory and a file in that dir to another dir */
     shfo.pFrom = "test4.txt\0test4.txt\\a.txt\0";
     shfo.pTo = "testdir2\0";
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     ok(retval == ERROR_SUCCESS ||
        broken(retval == 0x100a1), /* WinMe */
        "Expected ERROR_SUCCESS, got %d\n", retval);
     if (retval == ERROR_SUCCESS)
     {
-        ok(DeleteFile("testdir2\\test4.txt\\a.txt"), "Expected a.txt to exist\n");
-        ok(DeleteFile("testdir2\\a.txt"), "Expected testdir2\\a.txt to exist\n");
+        ok(DeleteFileA("testdir2\\test4.txt\\a.txt"), "Expected a.txt to exist\n");
+        ok(DeleteFileA("testdir2\\a.txt"), "Expected testdir2\\a.txt to exist\n");
     }
 
     /* copy a file in a directory first, and then the directory to a nonexistent dir */
     shfo.pFrom = "test4.txt\\a.txt\0test4.txt\0";
     shfo.pTo = "nonexistent\0";
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     if (dir_exists("nonexistent"))
     {
         /* Vista and W2K8 (broken or new behavior ?) */
         ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
-        ok(DeleteFile("nonexistent\\test4.txt\\a.txt"), "Expected nonexistent\\test4.txt\\a.txt to exist\n");
-        RemoveDirectory("nonexistent\\test4.txt");
-        ok(DeleteFile("nonexistent\\a.txt"), "Expected nonexistent\\a.txt to exist\n");
-        RemoveDirectory("nonexistent");
+        ok(DeleteFileA("nonexistent\\test4.txt\\a.txt"), "Expected nonexistent\\test4.txt\\a.txt to exist\n");
+        RemoveDirectoryA("nonexistent\\test4.txt");
+        ok(DeleteFileA("nonexistent\\a.txt"), "Expected nonexistent\\a.txt to exist\n");
+        RemoveDirectoryA("nonexistent");
     }
     else
     {
@@ -1304,14 +1334,14 @@ static void test_copy(void)
            "Expected aborted operations\n");
         ok(!file_exists("nonexistent\\test4.txt"), "Expected nonexistent\\test4.txt to not exist\n");
     }
-    DeleteFile("test4.txt\\a.txt");
+    DeleteFileA("test4.txt\\a.txt");
 
     /* destination is same as source file */
     shfo.pFrom = "test1.txt\0test2.txt\0test3.txt\0";
     shfo.pTo = "b.txt\0test2.txt\0c.txt\0";
     shfo.fAnyOperationsAborted = FALSE;
     shfo.fFlags = FOF_NOERRORUI | FOF_MULTIDESTFILES;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     if (retval == DE_OPCANCELLED)
     {
         /* NT4 fails and doesn't copy any files */
@@ -1320,7 +1350,7 @@ static void test_copy(void)
     else
     {
         ok(retval == DE_SAMEFILE, "Expected DE_SAMEFILE, got %d\n", retval);
-        ok(DeleteFile("b.txt"), "Expected b.txt to exist\n");
+        ok(DeleteFileA("b.txt"), "Expected b.txt to exist\n");
     }
     ok(!shfo.fAnyOperationsAborted, "Expected no operations to be aborted\n");
     ok(!file_exists("c.txt"), "Expected c.txt to not exist\n");
@@ -1329,7 +1359,7 @@ static void test_copy(void)
     shfo.pFrom = "test1.txt\0test4.txt\0test3.txt\0";
     shfo.pTo = "b.txt\0test4.txt\0c.txt\0";
     shfo.fAnyOperationsAborted = FALSE;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     if (retval == DE_OPCANCELLED)
     {
         /* NT4 fails and doesn't copy any files */
@@ -1340,7 +1370,7 @@ static void test_copy(void)
         ok(retval == ERROR_SUCCESS ||
            retval == DE_DESTSAMETREE, /* Vista */
            "Expected ERROR_SUCCESS or DE_DESTSAMETREE, got %d\n", retval);
-        ok(DeleteFile("b.txt"), "Expected b.txt to exist\n");
+        ok(DeleteFileA("b.txt"), "Expected b.txt to exist\n");
     }
     ok(!file_exists("c.txt"), "Expected c.txt to not exist\n");
 
@@ -1349,17 +1379,17 @@ static void test_copy(void)
     shfo.pTo = "test4.txt\\newdir\0";
     shfo.fFlags &= ~FOF_MULTIDESTFILES;
     shfo.fAnyOperationsAborted = FALSE;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     ok(retval == ERROR_SUCCESS ||
        retval == DE_DESTSUBTREE, /* Vista */
        "Expected ERROR_SUCCESS or DE_DESTSUBTREE, got %d\n", retval);
-    ok(!RemoveDirectory("test4.txt\\newdir"), "Expected test4.txt\\newdir to not exist\n");
+    ok(!RemoveDirectoryA("test4.txt\\newdir"), "Expected test4.txt\\newdir to not exist\n");
 
     /* copy a directory to itself, error displayed in UI */
     shfo.pFrom = "test4.txt\0";
     shfo.pTo = "test4.txt\0";
     shfo.fAnyOperationsAborted = FALSE;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     ok(retval == ERROR_SUCCESS ||
        retval == DE_DESTSUBTREE, /* Vista */
        "Expected ERROR_SUCCESS or DE_DESTSUBTREE, got %d\n", retval);
@@ -1369,23 +1399,23 @@ static void test_copy(void)
     shfo.pTo = "test4.txt\0";
     shfo.fAnyOperationsAborted = FALSE;
     shfo.fFlags |= FOF_NOCONFIRMATION;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     ok(retval == ERROR_SUCCESS ||
        retval == DE_DESTSUBTREE, /* Vista */
        "Expected ERROR_SUCCESS or DE_DESTSUBTREE, got %d\n", retval);
-    ok(DeleteFile("test4.txt\\test1.txt"), "Expected test4.txt\\test1.txt to exist\n");
+    ok(DeleteFileA("test4.txt\\test1.txt"), "Expected test4.txt\\test1.txt to exist\n");
 
     /* copy a file to a file, and the directory into itself */
     shfo.pFrom = "test1.txt\0test4.txt\0";
     shfo.pTo = "test4.txt\\a.txt\0";
     shfo.fAnyOperationsAborted = FALSE;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     if (dir_exists("test4.txt\\a.txt"))
     {
         /* Vista and W2K8 (broken or new behavior ?) */
         ok(retval == DE_DESTSUBTREE, "Expected DE_DESTSUBTREE, got %d\n", retval);
-        ok(DeleteFile("test4.txt\\a.txt\\test1.txt"), "Expected test4.txt\\a.txt\\test1.txt to exist\n");
-        RemoveDirectory("test4.txt\\a.txt");
+        ok(DeleteFileA("test4.txt\\a.txt\\test1.txt"), "Expected test4.txt\\a.txt\\test1.txt to exist\n");
+        RemoveDirectoryA("test4.txt\\a.txt");
     }
     else
     {
@@ -1397,7 +1427,7 @@ static void test_copy(void)
     shfo.pFrom = "e.txt\0";
     shfo.pTo = "nonexistent\0";
     shfo.fAnyOperationsAborted = FALSE;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     ok(retval == 1026 ||
        retval == ERROR_FILE_NOT_FOUND || /* Vista */
        broken(retval == ERROR_SUCCESS), /* NT4 */
@@ -1418,7 +1448,7 @@ static void test_copy(void)
         shfo.pTo = "test2.txt\0";
         shfo.fAnyOperationsAborted = 0xdeadbeef;
         /* without FOF_NOCONFIRMATION the confirmation is Yes/No */
-        retval = SHFileOperation(&shfo);
+        retval = SHFileOperationA(&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");
@@ -1427,7 +1457,7 @@ static void test_copy(void)
         shfo.pTo = "test2.txt\0one.txt\0";
         shfo.fFlags = FOF_NOCONFIRMATION | FOF_MULTIDESTFILES;
         /* without FOF_NOCONFIRMATION the confirmation is Yes/Yes to All/No/Cancel */
-        retval = SHFileOperation(&shfo);
+        retval = SHFileOperationA(&shfo);
         ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
         ok(file_has_content("test2.txt", "test3.txt\n"), "The file was not copied\n");
 
@@ -1435,7 +1465,7 @@ static void test_copy(void)
         shfo.pTo = "testdir2\0";
         shfo.fFlags = FOF_NOCONFIRMATION;
         /* without FOF_NOCONFIRMATION the confirmation is Yes/No */
-        retval = SHFileOperation(&shfo);
+        retval = SHFileOperationA(&shfo);
         ok(retval == 0, "Expected 0, got %d\n", retval);
         ok(file_has_content("testdir2\\one.txt", "test1.txt\n"), "The file was not copied\n");
     }
@@ -1445,7 +1475,7 @@ static void test_copy(void)
     shfo.pTo = "testdir2\0";
     /* WinMe needs FOF_NOERRORUI */
     shfo.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     ok(retval == ERROR_SUCCESS ||
        broken(retval == 0x100a1), /* WinMe */
        "Expected ERROR_SUCCESS, got %d\n", retval);
@@ -1454,7 +1484,7 @@ static void test_copy(void)
     {
         createTestFile("test4.txt\\.\\test1.txt"); /* modify the content of the file */
         /* without FOF_NOCONFIRMATION the confirmation is "This folder already contains a folder named ..." */
-        retval = SHFileOperation(&shfo);
+        retval = SHFileOperationA(&shfo);
         ok(retval == 0, "Expected 0, got %d\n", retval);
         ok(file_has_content("testdir2\\test4.txt\\test1.txt", "test4.txt\\.\\test1.txt\n"), "The file was not copied\n");
     }
@@ -1468,7 +1498,7 @@ static void test_copy(void)
     shfo.pFrom = from;
     shfo.pTo = "two.txt\0";
     shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     ok(retval == 1148 || retval == 1026 ||
        retval == ERROR_ACCESS_DENIED || /* win2k */
        retval == DE_INVALIDFILES, /* Vista */
@@ -1476,7 +1506,7 @@ static void test_copy(void)
     ok(DeleteFileA("one.txt"), "Expected file to exist\n");
     if (dir_exists("two.txt"))
         /* Vista and W2K8 (broken or new behavior ?) */
-        ok(RemoveDirectory("two.txt"), "Expected two.txt to exist\n");
+        ok(RemoveDirectoryA("two.txt"), "Expected two.txt to exist\n");
     else
         ok(!DeleteFileA("two.txt"), "Expected file to not exist\n");
 
@@ -1489,7 +1519,7 @@ static void test_copy(void)
     shfo.pFrom = "one.txt\0";
     shfo.pTo = to;
     shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     if (retval == DE_OPCANCELLED)
     {
         /* NT4 fails and doesn't copy any files */
@@ -1508,7 +1538,7 @@ static void test_copy(void)
     shfo.pFrom = "one.txt\0";
     shfo.pTo = "two.txt\0three.txt\0";
     shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     if (retval == DE_OPCANCELLED)
     {
         /* NT4 fails and doesn't copy any files */
@@ -1533,7 +1563,7 @@ static void test_copy(void)
     shfo.pFrom = from;
     shfo.pTo = to;
     shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     ok(retval == 1148 || retval == 1026 ||
        retval == ERROR_ACCESS_DENIED ||  /* win2k */
        retval == DE_INVALIDFILES, /* Vista */
@@ -1541,7 +1571,7 @@ static void test_copy(void)
     ok(DeleteFileA("one.txt"), "Expected file to exist\n");
     if (dir_exists("two.txt"))
         /* Vista and W2K8 (broken or new behavior ?) */
-        ok(RemoveDirectory("two.txt"), "Expected two.txt to exist\n");
+        ok(RemoveDirectoryA("two.txt"), "Expected two.txt to exist\n");
     else
         ok(!DeleteFileA("two.txt"), "Expected file to not exist\n");
 
@@ -1555,7 +1585,7 @@ static void test_copy(void)
     shfo.pTo = to;
     shfo.fFlags = FOF_MULTIDESTFILES | FOF_NOCONFIRMATION |
                   FOF_SILENT | FOF_NOERRORUI;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     if (retval == DE_OPCANCELLED)
     {
         /* NT4 fails and doesn't copy any files */
@@ -1581,7 +1611,7 @@ static void test_copy(void)
     shfo.pFrom = "one.txt\0two.txt\0";
     shfo.pTo = to;
     shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     if (dir_exists("threedir"))
     {
         /* Vista and W2K8 (broken or new behavior ?) */
@@ -1615,7 +1645,7 @@ static void test_copy(void)
     shfo.pFrom = "one.txt\0two.txt\0";
     shfo.pTo = to;
     shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
     ok(DeleteFileA("threedir\\one.txt"), "Expected file to exist\n");
     ok(DeleteFileA("threedir\\two.txt"), "Expected file to exist\n");
@@ -1640,7 +1670,7 @@ static void test_copy(void)
         shfo.pTo = to;
         shfo.fFlags = FOF_MULTIDESTFILES | FOF_NOCONFIRMATION |
                       FOF_SILENT | FOF_NOERRORUI;
-        retval = SHFileOperation(&shfo);
+        retval = SHFileOperationA(&shfo);
         ok(retval == ERROR_CANCELLED ||
            retval == ERROR_SUCCESS, /* win2k3 */
            "Expected ERROR_CANCELLED or ERROR_SUCCESS, got %d\n", retval);
@@ -1672,7 +1702,7 @@ static void test_copy(void)
     shfo.pTo = to;
     shfo.fFlags = FOF_MULTIDESTFILES | FOF_NOCONFIRMATION |
                   FOF_SILENT | FOF_NOERRORUI;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
     ok(DeleteFileA("one.txt"), "Expected file to exist\n");
     ok(DeleteFileA("two.txt"), "Expected file to exist\n");
@@ -1704,7 +1734,7 @@ static void test_copy(void)
     shfo.pTo = "threedir\0fourdir\0";
     shfo.fFlags = FOF_MULTIDESTFILES | FOF_NOCONFIRMATION |
                   FOF_SILENT | FOF_NOERRORUI;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     ok(retval == ERROR_CANCELLED ||
        retval == DE_FILEDESTISFLD || /* Vista */
        broken(retval == DE_OPCANCELLED), /* Win9x, NT4 */
@@ -1734,7 +1764,7 @@ static void test_copy(void)
     shfo.pTo = "threedir\0fourdir\0five\0";
     shfo.fFlags = FOF_MULTIDESTFILES | FOF_NOCONFIRMATION |
                   FOF_SILENT | FOF_NOERRORUI;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
     ok(DeleteFileA("one.txt"), "Expected file to exist\n");
     ok(DeleteFileA("two.txt"), "Expected file to exist\n");
@@ -1765,7 +1795,7 @@ static void test_copy(void)
     shfo.pFrom = "a*.txt\0";
     shfo.pTo = "one\0two\0";
     shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
     ok(DeleteFileA("one\\aa.txt"), "Expected file to exist\n");
     ok(DeleteFileA("one\\ab.txt"), "Expected file to exist\n");
@@ -1782,7 +1812,7 @@ static void test_copy(void)
     shfo.pFrom = "dir\\abcdefgh.abc\0";
     shfo.pTo = "\0";
     shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
-    retval = SHFileOperation(&shfo);
+    retval = SHFileOperationA(&shfo);
     ok(retval == ERROR_SUCCESS ||
        broken(retval == DE_OPCANCELLED), /* NT4 */
        "Expected ERROR_SUCCESS, got %d\n", retval);
@@ -1841,7 +1871,8 @@ static void test_move(void)
 
     init_shfo_tests();
 
-    /* number of sources do not correspond to number of targets */
+    /* number of sources do not correspond to number of targets,
+       include directories */
     set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
     set_curr_dir_path(to, "test6.txt\0test7.txt\0");
     retval = SHFileOperationA(&shfo2);
@@ -1872,6 +1903,108 @@ static void test_move(void)
            "specified as a target\n");
     }
 
+    init_shfo_tests();
+    /* number of sources do not correspond to number of targets,
+       files only,
+       from exceeds to */
+    set_curr_dir_path(from, "test1.txt\0test2.txt\0test3.txt\0");
+    set_curr_dir_path(to, "test6.txt\0test7.txt\0");
+    retval = SHFileOperationA(&shfo2);
+    if (dir_exists("test6.txt"))
+    {
+        if (retval == ERROR_SUCCESS)
+        {
+            /* Old shell32 */
+            DeleteFileA("test6.txt\\test1.txt");
+            DeleteFileA("test6.txt\\test2.txt");
+            RemoveDirectoryA("test6.txt\\test4.txt");
+            RemoveDirectoryA("test6.txt");
+        }
+        else
+        {
+            /* Vista and W2K8 (broken or new behavior ?) */
+            ok(retval == DE_SAMEFILE, "Expected DE_SAMEFILE, got %d\n", retval);
+            ok(DeleteFileA("test6.txt\\test1.txt"), "The file is not moved\n");
+            RemoveDirectoryA("test6.txt");
+            ok(DeleteFileA("test7.txt\\test2.txt"), "The file is not moved\n");
+            RemoveDirectoryA("test7.txt");
+            ok(file_exists("test3.txt"), "File should not be moved\n");
+        }
+    }
+    else
+    {
+        expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* Win9x, NT4 */);
+        ok(!file_exists("test6.txt"), "The file is not moved - many files are "
+           "specified as a target\n");
+    }
+
+    init_shfo_tests();
+    /* number of sources do not correspond to number of targets,
+       files only,
+       too exceeds from */
+    set_curr_dir_path(from, "test1.txt\0test2.txt\0");
+    set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
+    retval = SHFileOperationA(&shfo2);
+    if (dir_exists("test6.txt"))
+    {
+        ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+        ok(DeleteFileA("test6.txt\\test1.txt"),"The file is not moved\n");
+        ok(DeleteFileA("test7.txt\\test2.txt"),"The file is not moved\n");
+        ok(!dir_exists("test8.txt") && !file_exists("test8.txt"),
+            "Directory should not be created\n");
+        RemoveDirectoryA("test6.txt");
+        RemoveDirectoryA("test7.txt");
+    }
+    else
+    {
+        expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* WinXp, Win2k */);
+        ok(!file_exists("test6.txt"), "The file is not moved - many files are "
+           "specified as a target\n");
+    }
+
+    init_shfo_tests();
+    /* number of sources do not correspond to number of targets,
+       target directories */
+    set_curr_dir_path(from, "test1.txt\0test2.txt\0test3.txt\0");
+    set_curr_dir_path(to, "test4.txt\0test5.txt\0");
+    retval = SHFileOperationA(&shfo2);
+    if (dir_exists("test5.txt"))
+    {
+        ok(retval == DE_SAMEFILE, "Expected DE_SAMEFILE, got %d\n", retval);
+        ok(DeleteFileA("test4.txt\\test1.txt"),"The file is not moved\n");
+        ok(DeleteFileA("test5.txt\\test2.txt"),"The file is not moved\n");
+        ok(file_exists("test3.txt"), "The file is not moved\n");
+        RemoveDirectoryA("test4.txt");
+        RemoveDirectoryA("test5.txt");
+    }
+    else
+    {
+        ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
+        ok(DeleteFileA("test4.txt\\test1.txt"),"The file is not moved\n");
+        ok(DeleteFileA("test4.txt\\test2.txt"),"The file is not moved\n");
+        ok(DeleteFileA("test4.txt\\test3.txt"),"The file is not moved\n");
+    }
+
+
+    init_shfo_tests();
+    /*  0 incomming files */
+    set_curr_dir_path(from, "\0\0");
+    set_curr_dir_path(to, "test6.txt\0\0");
+    retval = SHFileOperationA(&shfo2);
+    ok(retval == ERROR_SUCCESS || retval == ERROR_ACCESS_DENIED
+        , "Expected ERROR_SUCCESS || ERROR_ACCESS_DENIED, got %d\n", retval);
+    ok(!file_exists("test6.txt"), "The file should not exist\n");
+
+    init_shfo_tests();
+    /*  0 outgoing files */
+    set_curr_dir_path(from, "test1\0\0");
+    set_curr_dir_path(to, "\0\0");
+    retval = SHFileOperationA(&shfo2);
+    ok(retval == ERROR_FILE_NOT_FOUND ||
+        broken(retval == 1026)
+        , "Expected ERROR_FILE_NOT_FOUND, got %d\n", retval);
+    ok(!file_exists("test6.txt"), "The file should not exist\n");
+
     init_shfo_tests();
 
     set_curr_dir_path(from, "test3.txt\0");
@@ -1937,11 +2070,11 @@ static void test_move(void)
         ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
         if (old_shell32)
         {
-            DeleteFile("a.txt\\a.txt");
+            DeleteFileA("a.txt\\a.txt");
             RemoveDirectoryA("a.txt");
         }
         else
-            ok(DeleteFile("a.txt"), "Expected a.txt to exist\n");
+            ok(DeleteFileA("a.txt"), "Expected a.txt to exist\n");
         ok(!file_exists("test1.txt"), "Expected test1.txt to not exist\n");
     }
     ok(!file_exists("b.txt"), "Expected b.txt to not exist\n");
@@ -1976,7 +2109,7 @@ static void test_move(void)
     ok(retval == ERROR_SUCCESS ||
        retval == DE_DESTSUBTREE, /* Vista */
        "Expected ERROR_SUCCESS or DE_DESTSUBTREE, got %d\n", retval);
-    ok(!RemoveDirectory("test4.txt\\b.txt"), "Expected test4.txt\\b.txt to not exist\n");
+    ok(!RemoveDirectoryA("test4.txt\\b.txt"), "Expected test4.txt\\b.txt to not exist\n");
     ok(dir_exists("test4.txt"), "Expected test4.txt to exist\n");
 
     /* move many files without FOF_MULTIDESTFILES */
@@ -1997,8 +2130,8 @@ static void test_move(void)
     else
     {
         expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* Win9x, NT4 */);
-        ok(!DeleteFile("d.txt"), "Expected d.txt to not exist\n");
-        ok(!DeleteFile("e.txt"), "Expected e.txt to not exist\n");
+        ok(!DeleteFileA("d.txt"), "Expected d.txt to not exist\n");
+        ok(!DeleteFileA("e.txt"), "Expected e.txt to not exist\n");
     }
 
     /* number of sources != number of targets */
@@ -2028,7 +2161,7 @@ static void test_move(void)
     else
     {
         expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* Win9x, NT4 */);
-        ok(!DeleteFile("d.txt"), "Expected d.txt to not exist\n");
+        ok(!DeleteFileA("d.txt"), "Expected d.txt to not exist\n");
     }
 
     /* FO_MOVE does not create dest directories */
index 092f29a..f096476 100644 (file)
@@ -75,18 +75,6 @@ static HRESULT (WINAPI *pSHCreateDefaultContextMenu)(const DEFCONTEXTMENU*,REFII
 static HRESULT (WINAPI *pSHCreateShellFolderView)(const SFV_CREATE *pcsfv, IShellView **ppsv);
 static HRESULT (WINAPI *pSHCreateShellFolderViewEx)(LPCSFV psvcbi, IShellView **ppv);
 
-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;
@@ -232,10 +220,13 @@ static void test_ParseDisplayName(void)
     /* Tests crash on W2K and below (SHCreateShellItem available as of XP) */
     if (pSHCreateShellItem)
     {
-        /* null name and pidl */
-        hr = IShellFolder_ParseDisplayName(IDesktopFolder,
-            NULL, NULL, NULL, NULL, NULL, 0);
-        ok(hr == E_INVALIDARG, "returned %08x, expected E_INVALIDARG\n", hr);
+        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;
@@ -584,7 +575,7 @@ if (0)
                     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", debugstr_guid(&id));
+                        "Unexpected classid %s\n", wine_dbgstr_guid(&id));
                     IPersist_Release(pp);
                 }
 
@@ -1967,8 +1958,8 @@ static void test_SHGetFolderPathAndSubDirA(void)
     BOOL delret;
     DWORD dwret;
     int i;
-    static char wine[] = "wine";
-    static char winetemp[] = "wine\\temp";
+    static const char wine[] = "wine";
+    static const char winetemp[] = "wine\\temp";
     static char appdata[MAX_PATH];
     static char testpath[MAX_PATH];
     static char toolongpath[MAX_PATH+1];
@@ -2063,7 +2054,7 @@ static void test_SHGetFolderPathAndSubDirA(void)
         "expected %s to start with %s\n", testpath, appdata);
     ok(!lstrcmpA(&testpath[1 + strlen(appdata)], winetemp),
         "expected %s to end with %s\n", testpath, winetemp);
-    dwret = GetFileAttributes(testpath);
+    dwret = GetFileAttributesA(testpath);
     ok(FILE_ATTRIBUTE_DIRECTORY | dwret, "expected %x to contain FILE_ATTRIBUTE_DIRECTORY\n", dwret);
 
     /* cleanup */
@@ -3005,13 +2996,14 @@ static inline IUnknownImpl *impl_from_IUnknown(IUnknown *iface)
 static HRESULT WINAPI unk_fnQueryInterface(IUnknown *iunk, REFIID riid, void** punk)
 {
     IUnknownImpl *This = impl_from_IUnknown(iunk);
-    UINT i, found;
-    for(i = found = 0; This->ifaces[i].id != NULL; i++)
+    UINT i;
+    BOOL found = FALSE;
+    for(i = 0; This->ifaces[i].id != NULL; i++)
     {
         if(IsEqualIID(This->ifaces[i].id, riid))
         {
             This->ifaces[i].count++;
-            found = 1;
+            found = TRUE;
             break;
         }
     }
@@ -3647,10 +3639,23 @@ static void test_ShellItemBindToHandler(void)
             ok(hr == S_OK, "Got 0x%08x\n", hr);
             if(SUCCEEDED(hr)) IUnknown_Release(punk);
 
-            /* BHID_Transfer */
-            hr = IShellItem_BindToHandler(psi, NULL, &BHID_Transfer, &IID_IUnknown, (void**)&punk);
-            ok(hr == E_NOINTERFACE || broken(hr == MK_E_NOOBJECT /* XP */), "Got 0x%08x\n", hr);
-            if(SUCCEEDED(hr)) IUnknown_Release(punk);
+            /* BHID_Transfer
+               ITransferSource and ITransferDestination are accessible starting Vista, IUnknown is
+               supported start Win8. */
+            hr = IShellItem_BindToHandler(psi, NULL, &BHID_Transfer, &IID_ITransferSource, (void**)&punk);
+            ok(hr == S_OK || broken(FAILED(hr)) /* pre-Vista */, "Got 0x%08x\n", hr);
+            if(SUCCEEDED(hr))
+            {
+                IUnknown_Release(punk);
+
+                hr = IShellItem_BindToHandler(psi, NULL, &BHID_Transfer, &IID_ITransferDestination, (void**)&punk);
+                ok(hr == S_OK, "Got 0x%08x\n", hr);
+                if(SUCCEEDED(hr)) IUnknown_Release(punk);
+
+                hr = IShellItem_BindToHandler(psi, NULL, &BHID_Transfer, &IID_IUnknown, (void**)&punk);
+                ok(hr == S_OK || broken(hr == E_NOINTERFACE) /* pre-Win8 */, "Got 0x%08x\n", hr);
+                if(SUCCEEDED(hr)) IUnknown_Release(punk);
+            }
 
             /* BHID_EnumItems */
             hr = IShellItem_BindToHandler(psi, NULL, &BHID_EnumItems, &IID_IEnumShellItems, (void**)&punk);
@@ -3921,11 +3926,12 @@ static void test_GetUIObject(void)
             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, 0, id_upper_limit, CMF_NORMAL);
+                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);
@@ -3937,9 +3943,12 @@ static void test_GetUIObject(void)
                 {
                     MENUITEMINFOA mii;
                     INT res;
+                    char buf[255], buf2[255];
                     ZeroMemory(&mii, sizeof(MENUITEMINFOA));
                     mii.cbSize = sizeof(MENUITEMINFOA);
-                    mii.fMask = MIIM_ID | MIIM_FTYPE;
+                    mii.fMask = MIIM_ID | MIIM_FTYPE | MIIM_STRING;
+                    mii.dwTypeData = buf2;
+                    mii.cch = sizeof(buf2);
 
                     SetLastError(0);
                     res = GetMenuItemInfoA(hmenu, i, TRUE, &mii);
@@ -3948,8 +3957,17 @@ static void test_GetUIObject(void)
                     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 */),
                    "Not equal (or near equal), got %d and %d\n", max_id_check, max_id);
@@ -4403,7 +4421,7 @@ static LRESULT CALLBACK testwindow_wndproc(HWND hwnd, UINT msg, WPARAM wparam, L
             ok(0, "Didn't expect a WM_USER_NOTIFY message (event: %x)\n", signal);
         return 0;
     }
-    return DefWindowProc(hwnd, msg, wparam, lparam);
+    return DefWindowProcA(hwnd, msg, wparam, lparam);
 }
 
 static void register_testwindow_class(void)
index 1d55ecf..81f4754 100755 (executable)
@@ -87,13 +87,14 @@ static void test_StrRetToStringNW(void)
        "STRRET_OFFSET: dup failed, ret=%d\n", ret);
 
     /* The next test crashes on W2K, WinXP and W2K3, so we don't test. */
-#if 0
+if (0)
+{
     /* Invalid dest - should return FALSE, except NT4 does not, so we don't check. */
     strret.uType = STRRET_WSTR;
     U(strret).pOleStr = CoDupStrW("Test");
     pStrRetToStrNAW(NULL, sizeof(buff)/sizeof(WCHAR), &strret, NULL);
     trace("NULL dest: ret=%d\n", ret);
-#endif
+}
 }
 
 START_TEST(string)
index 6699350..c554262 100644 (file)
@@ -41,7 +41,7 @@ static void test_cbsize(void)
         nidW.hWnd = hMainWnd;
         nidW.uID = 1;
         nidW.uFlags = NIF_ICON|NIF_MESSAGE;
-        nidW.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+        nidW.hIcon = LoadIconA(NULL, (LPSTR)IDI_APPLICATION);
         nidW.uCallbackMessage = WM_USER+17;
         ret = pShell_NotifyIconW(NIM_ADD, &nidW);
         /* using an invalid cbSize does work */
@@ -61,7 +61,7 @@ static void test_cbsize(void)
     nidA.hWnd = hMainWnd;
     nidA.uID = 1;
     nidA.uFlags = NIF_ICON|NIF_MESSAGE;
-    nidA.hIcon = LoadIcon(NULL, IDI_APPLICATION);
+    nidA.hIcon = LoadIconA(NULL, (LPSTR)IDI_APPLICATION);
     nidA.uCallbackMessage = WM_USER+17;
     ok(Shell_NotifyIconA(NIM_ADD, &nidA), "NIM_ADD failed!\n");
 
@@ -91,11 +91,11 @@ START_TEST(systray)
     wc.cbWndExtra = 0;
     wc.hInstance = GetModuleHandleA(NULL);
     wc.hIcon = NULL;
-    wc.hCursor = LoadCursorA(NULL, IDC_IBEAM);
+    wc.hCursor = LoadCursorA(NULL, (LPSTR)IDC_IBEAM);
     wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);
     wc.lpszMenuName = NULL;
     wc.lpszClassName = "MyTestWnd";
-    wc.lpfnWndProc = DefWindowProc;
+    wc.lpfnWndProc = DefWindowProcA;
     RegisterClassA(&wc);
 
     hMainWnd = CreateWindowExA(0, "MyTestWnd", "Blah", WS_OVERLAPPEDWINDOW,
index 757db38..13e3a3e 100644 (file)
@@ -1,10 +1,7 @@
 /* Automatically generated file; DO NOT EDIT!! */
 
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
 #define STANDALONE
-#include "wine/test.h"
+#include <wine/test.h>
 
 extern void func_appbar(void);
 extern void func_assoc(void);