From: Amine Khaldi Date: Sun, 20 Apr 2014 13:19:24 +0000 (+0000) Subject: [SHELL32_WINETEST] X-Git-Tag: backups/0.3.17@66124~1649 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=aa2170e490b9a6d0fef3c3a0597f1a7970ec086a [SHELL32_WINETEST] * Sync with Wine 1.7.17. * Speedup build. CORE-8080 svn path=/trunk/; revision=62838 --- diff --git a/rostests/winetests/shell32/CMakeLists.txt b/rostests/winetests/shell32/CMakeLists.txt index 6f2663fc34f..e42a50c43bb 100644 --- a/rostests/winetests/shell32/CMakeLists.txt +++ b/rostests/winetests/shell32/CMakeLists.txt @@ -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) diff --git a/rostests/winetests/shell32/appbar.c b/rostests/winetests/shell32/appbar.c index 2bba332eed0..7675493747e 100644 --- a/rostests/winetests/shell32/appbar.c +++ b/rostests/winetests/shell32/appbar.c @@ -20,6 +20,7 @@ #include #include +#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); diff --git a/rostests/winetests/shell32/assoc.c b/rostests/winetests/shell32/assoc.c index 29524dc601a..ff999e98dc7 100644 --- a/rostests/winetests/shell32/assoc.c +++ b/rostests/winetests/shell32/assoc.c @@ -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(); diff --git a/rostests/winetests/shell32/autocomplete.c b/rostests/winetests/shell32/autocomplete.c index 5ff88479c1a..63a2eb2b11e 100644 --- a/rostests/winetests/shell32/autocomplete.c +++ b/rostests/winetests/shell32/autocomplete.c @@ -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"; diff --git a/rostests/winetests/shell32/brsfolder.c b/rostests/winetests/shell32/brsfolder.c index f8e8e16a554..0ef5bb15fe4 100644 --- a/rostests/winetests/shell32/brsfolder.c +++ b/rostests/winetests/shell32/brsfolder.c @@ -18,10 +18,14 @@ * 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 #include #include #include +#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(); } diff --git a/rostests/winetests/shell32/ebrowser.c b/rostests/winetests/shell32/ebrowser.c index 8149f8f95a4..1936cf9ec11 100644 --- a/rostests/winetests/shell32/ebrowser.c +++ b/rostests/winetests/shell32/ebrowser.c @@ -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 }, diff --git a/rostests/winetests/shell32/msg.h b/rostests/winetests/shell32/msg.h index 361ccdbf598..a457fd4fce5 100644 --- a/rostests/winetests/shell32/msg.h +++ b/rostests/winetests/shell32/msg.h @@ -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]; diff --git a/rostests/winetests/shell32/progman_dde.c b/rostests/winetests/shell32/progman_dde.c index f94c783ba2a..540c6d439c1 100644 --- a/rostests/winetests/shell32/progman_dde.c +++ b/rostests/winetests/shell32/progman_dde.c @@ -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)); diff --git a/rostests/winetests/shell32/shelllink.c b/rostests/winetests/shell32/shelllink.c index b22079c7e85..0b2b7be226f 100755 --- a/rostests/winetests/shell32/shelllink.c +++ b/rostests/winetests/shell32/shelllink.c @@ -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(rcbSize = 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(); } diff --git a/rostests/winetests/shell32/shellole.c b/rostests/winetests/shell32/shellole.c index da1f667932e..3f0b490e600 100644 --- a/rostests/winetests/shell32/shellole.c +++ b/rostests/winetests/shell32/shellole.c @@ -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(); } diff --git a/rostests/winetests/shell32/shellpath.c b/rostests/winetests/shell32/shellpath.c index e6b70d01a5e..7486fac4df9 100644 --- a/rostests/winetests/shell32/shellpath.c +++ b/rostests/winetests/shell32/shellpath.c @@ -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; diff --git a/rostests/winetests/shell32/shlexec.c b/rostests/winetests/shell32/shlexec.c index db6f25d4967..597b38c33a3 100755 --- a/rostests/winetests/shell32/shlexec.c +++ b/rostests/winetests/shell32/shlexec.c @@ -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 && rcData1, 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) diff --git a/rostests/winetests/shell32/string.c b/rostests/winetests/shell32/string.c index 1d55ecf9221..81f47547aa0 100755 --- a/rostests/winetests/shell32/string.c +++ b/rostests/winetests/shell32/string.c @@ -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) diff --git a/rostests/winetests/shell32/systray.c b/rostests/winetests/shell32/systray.c index 6699350cf68..c554262f830 100644 --- a/rostests/winetests/shell32/systray.c +++ b/rostests/winetests/shell32/systray.c @@ -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, diff --git a/rostests/winetests/shell32/testlist.c b/rostests/winetests/shell32/testlist.c index 757db385028..13e3a3eeb4a 100644 --- a/rostests/winetests/shell32/testlist.c +++ b/rostests/winetests/shell32/testlist.c @@ -1,10 +1,7 @@ /* Automatically generated file; DO NOT EDIT!! */ -#define WIN32_LEAN_AND_MEAN -#include - #define STANDALONE -#include "wine/test.h" +#include extern void func_appbar(void); extern void func_assoc(void);