Author: akhaldi Date: Sun Jul 3 11:36:38 2016 New Revision: 71781
URL: http://svn.reactos.org/svn/reactos?rev=71781&view=rev Log: [SHELL32_WINETEST] Sync with Wine Staging 1.9.11. CORE-11368
Modified: trunk/rostests/winetests/shell32/appbar.c trunk/rostests/winetests/shell32/assoc.c trunk/rostests/winetests/shell32/ebrowser.c trunk/rostests/winetests/shell32/progman_dde.c trunk/rostests/winetests/shell32/shelldispatch.c trunk/rostests/winetests/shell32/shelllink.c trunk/rostests/winetests/shell32/shellpath.c trunk/rostests/winetests/shell32/shlexec.c trunk/rostests/winetests/shell32/shlfileop.c trunk/rostests/winetests/shell32/shlfolder.c trunk/rostests/winetests/shell32/shlview.c
Modified: trunk/rostests/winetests/shell32/appbar.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/appbar.c... ============================================================================== --- trunk/rostests/winetests/shell32/appbar.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/appbar.c [iso-8859-1] Sun Jul 3 11:36:38 2016 @@ -232,10 +232,7 @@ windows[0].registered = TRUE; windows[0].to_be_deleted = FALSE; windows[0].edge = ABE_BOTTOM; - windows[0].desired_rect.left = 0; - windows[0].desired_rect.right = screen_width; - windows[0].desired_rect.top = screen_height - 15; - windows[0].desired_rect.bottom = screen_height; + SetRect(&windows[0].desired_rect, 0, screen_height - 15, screen_width, screen_height); SetWindowLongPtrA(windows[0].hwnd, GWLP_USERDATA, (LONG_PTR)&windows[0]); testwindow_setpos(windows[0].hwnd); do_events(); @@ -253,10 +250,7 @@ windows[1].registered = TRUE; windows[1].to_be_deleted = FALSE; windows[1].edge = ABE_BOTTOM; - windows[1].desired_rect.left = 0; - windows[1].desired_rect.right = screen_width; - windows[1].desired_rect.top = screen_height - 10; - windows[1].desired_rect.bottom = screen_height; + SetRect(&windows[1].desired_rect, 0, screen_height - 10, screen_width, screen_height); SetWindowLongPtrA(windows[1].hwnd, GWLP_USERDATA, (LONG_PTR)&windows[1]); testwindow_setpos(windows[1].hwnd);
@@ -285,10 +279,7 @@ windows[2].registered = TRUE; windows[2].to_be_deleted = FALSE; windows[2].edge = ABE_BOTTOM; - windows[2].desired_rect.left = 0; - windows[2].desired_rect.right = screen_width; - windows[2].desired_rect.top = screen_height - 10; - windows[2].desired_rect.bottom = screen_height; + SetRect(&windows[2].desired_rect, 0, screen_height - 10, screen_width, screen_height); SetWindowLongPtrA(windows[2].hwnd, GWLP_USERDATA, (LONG_PTR)&windows[2]); testwindow_setpos(windows[2].hwnd);
@@ -299,10 +290,7 @@
/* move windows[2] to the right side of the screen */ windows[2].edge = ABE_RIGHT; - windows[2].desired_rect.left = screen_width - 15; - windows[2].desired_rect.right = screen_width; - windows[2].desired_rect.top = 0; - windows[2].desired_rect.bottom = screen_height; + SetRect(&windows[2].desired_rect, screen_width - 15, 0, screen_width, screen_height); testwindow_setpos(windows[2].hwnd);
do_events_until(no_appbars_intersect); @@ -312,10 +300,7 @@
/* move windows[1] to the top of the screen */ windows[1].edge = ABE_TOP; - windows[1].desired_rect.left = 0; - windows[1].desired_rect.right = screen_width; - windows[1].desired_rect.top = 0; - windows[1].desired_rect.bottom = 15; + SetRect(&windows[1].desired_rect, 0, 0, screen_width, 15); testwindow_setpos(windows[1].hwnd);
do_events_until(no_appbars_intersect); @@ -325,10 +310,7 @@
/* move windows[1] back to the bottom of the screen */ windows[1].edge = ABE_BOTTOM; - windows[1].desired_rect.left = 0; - windows[1].desired_rect.right = screen_width; - windows[1].desired_rect.top = screen_height - 10; - windows[1].desired_rect.bottom = screen_height; + SetRect(&windows[1].desired_rect, 0, screen_height - 10, screen_width, screen_height); testwindow_setpos(windows[1].hwnd);
do_events_until(no_appbars_intersect);
Modified: trunk/rostests/winetests/shell32/assoc.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/assoc.c?... ============================================================================== --- trunk/rostests/winetests/shell32/assoc.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/assoc.c [iso-8859-1] Sun Jul 3 11:36:38 2016 @@ -100,13 +100,84 @@ { NULL } };
+static void getstring_test(LPCWSTR assocName, HKEY progIdKey, ASSOCSTR str, LPCWSTR expected_string, int line) +{ + IQueryAssociations *assoc; + HRESULT hr; + WCHAR *buffer; + DWORD len; + + hr = CoCreateInstance(&CLSID_QueryAssociations, NULL, CLSCTX_INPROC_SERVER, &IID_IQueryAssociations, (void*)&assoc); + ok_(__FILE__, line)(hr == S_OK, "failed to create IQueryAssociations, 0x%x\n", hr); + hr = IQueryAssociations_Init(assoc, 0, assocName, progIdKey, NULL); + ok_(__FILE__, line)(hr == S_OK, "IQueryAssociations::Init failed, 0x%x\n", hr); + + hr = IQueryAssociations_GetString(assoc, 0, str, NULL, NULL, &len); + if (hr != S_FALSE) { + if (expected_string) { + ok_(__FILE__, line)(SUCCEEDED(hr), "GetString returned 0x%x, expected success\n", hr); + } else { + ok_(__FILE__, line)(FAILED(hr), "GetString returned 0x%x, expected failure\n", hr); + } + } + + buffer = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + ok_(__FILE__, line)(buffer != NULL, "out of memory\n"); + hr = IQueryAssociations_GetString(assoc, 0, str, NULL, buffer, &len); + + if (expected_string) { + ok_(__FILE__, line)(lstrcmpW(buffer, expected_string) == 0, "GetString returned %s, expected %s\n", + wine_dbgstr_w(buffer), wine_dbgstr_w(expected_string)); + } +} + static void test_IQueryAssociations_GetString(void) { + static WCHAR test_extensionW[] = {'.','t','e','s','t',0}; + static WCHAR test_progidW[] = {'t','e','s','t','f','i','l','e',0}; + static WCHAR DefaultIconW[] = {'D','e','f','a','u','l','t','I','c','o','n',0}; + /* folder.ico, why not */ + static WCHAR test_iconW[] = {'s','h','e','l','l','3','2','.','d','l','l',',','1',0}; + HKEY test_extension_key; + HKEY test_progid_key; + HKEY test_defaulticon_key; + LRESULT r; + struct assoc_getstring_test *ptr = getstring_tests; IQueryAssociations *assoc; HRESULT hr; DWORD len; int i = 0; + + r = RegCreateKeyExW(HKEY_CLASSES_ROOT, test_extensionW, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &test_extension_key, NULL); + if (r == ERROR_ACCESS_DENIED) + { + win_skip("Not enough permissions to create a test key.\n"); + return; + } + + ok(r == ERROR_SUCCESS, "RegCreateKeyExW(HKCR, ".test") failed: 0x%lx\n", r); + r = RegSetValueExW(test_extension_key, NULL, 0, REG_SZ, (PBYTE)test_progidW, sizeof(test_progidW)); + ok(r == ERROR_SUCCESS, "RegSetValueExW(HKCR\.test, NULL, "testfile") failed: 0x%lx\n", r); + + /* adding progid key with no information should fail to return information */ + r = RegCreateKeyExW(HKEY_CLASSES_ROOT, test_progidW, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &test_progid_key, NULL); + ok(r == ERROR_SUCCESS, "RegCreateKeyExW(HKCR, "testfile") failed: 0x%lx\n", r); + getstring_test(test_extensionW, NULL, ASSOCSTR_DEFAULTICON, NULL, __LINE__); + getstring_test(test_progidW, NULL, ASSOCSTR_DEFAULTICON, NULL, __LINE__); + getstring_test(NULL, test_progid_key, ASSOCSTR_DEFAULTICON, NULL, __LINE__); + + /* adding information to the progid should return that information */ + r = RegCreateKeyExW(test_progid_key, DefaultIconW, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &test_defaulticon_key, NULL); + ok(r == ERROR_SUCCESS, "RegCreateKeyExW(HKCR\testfile\DefaultIcon) failed: 0x%lx\n", r); + r = RegSetValueExW(test_defaulticon_key, NULL, 0, REG_SZ, (PBYTE)test_iconW, sizeof(test_iconW)); + ok(r == ERROR_SUCCESS, "RegSetValueExW(HKCR\testfile\DefaultIcon, NULL, "folder.ico") failed: 0x%lx\n", r); + getstring_test(test_extensionW, NULL, ASSOCSTR_DEFAULTICON, test_iconW, __LINE__); + getstring_test(test_progidW, NULL, ASSOCSTR_DEFAULTICON, test_iconW, __LINE__); + getstring_test(NULL, test_progid_key, ASSOCSTR_DEFAULTICON, test_iconW, __LINE__); + + RegDeleteKeyW(HKEY_CLASSES_ROOT, test_extensionW); + RegDeleteKeyW(HKEY_CLASSES_ROOT, test_progidW);
hr = CoCreateInstance(&CLSID_QueryAssociations, NULL, CLSCTX_INPROC_SERVER, &IID_IQueryAssociations, (void*)&assoc); ok(hr == S_OK, "failed to create object, 0x%x\n", hr);
Modified: trunk/rostests/winetests/shell32/ebrowser.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/ebrowser... ============================================================================== --- trunk/rostests/winetests/shell32/ebrowser.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/ebrowser.c [iso-8859-1] Sun Jul 3 11:36:38 2016 @@ -98,7 +98,7 @@ static HRESULT ebrowser_initialize(IExplorerBrowser *peb) { RECT rc; - rc.top = rc.left = 0; rc.bottom = rc.right = 500; + SetRect(&rc, 0, 0, 500, 500); return IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL); }
@@ -802,7 +802,7 @@ /* Initialize with a few different rectangles */ peb = NULL; ebrowser_instantiate(&peb); - rc.left = 50; rc.top = 20; rc.right = 100; rc.bottom = 80; + SetRect(&rc, 50, 20, 100, 80); hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL); ok(hr == S_OK, "got (0x%08x)\n", hr); hr = IExplorerBrowser_QueryInterface(peb, &IID_IShellBrowser, (void**)&psb); @@ -861,7 +861,7 @@ ebrowser_instantiate(&peb); hr = IExplorerBrowser_SetOptions(peb, EBO_NOBORDER); ok(hr == S_OK, "got 0x%08x\n", hr); - rc.left = 50; rc.top = 20; rc.right = 100; rc.bottom = 80; + SetRect(&rc, 50, 20, 100, 80);
hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL); ok(hr == S_OK, "got (0x%08x)\n", hr); @@ -881,7 +881,7 @@
/* empty rectangle */ ebrowser_instantiate(&peb); - rc.left = 0; rc.top = 0; rc.right = 0; rc.bottom = 0; + SetRectEmpty(&rc); hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL); ok(hr == S_OK, "got (0x%08x)\n", hr); IExplorerBrowser_Destroy(peb); @@ -889,7 +889,7 @@ ok(lres == 0, "Got refcount %d\n", lres);
ebrowser_instantiate(&peb); - rc.left = -1; rc.top = -1; rc.right = 1; rc.bottom = 1; + SetRect(&rc, -1, -1, 1, 1); hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL); ok(hr == S_OK, "got (0x%08x)\n", hr); IExplorerBrowser_Destroy(peb); @@ -897,7 +897,7 @@ ok(lres == 0, "Got refcount %d\n", lres);
ebrowser_instantiate(&peb); - rc.left = 10; rc.top = 10; rc.right = 5; rc.bottom = 5; + SetRect(&rc, 10, 10, 5, 5); hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL); ok(hr == S_OK, "got (0x%08x)\n", hr); IExplorerBrowser_Destroy(peb); @@ -905,7 +905,7 @@ ok(lres == 0, "Got refcount %d\n", lres);
ebrowser_instantiate(&peb); - rc.left = 10; rc.top = 10; rc.right = 5; rc.bottom = 5; + SetRect(&rc, 10, 10, 5, 5); hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL); ok(hr == S_OK, "got (0x%08x)\n", hr); IExplorerBrowser_Destroy(peb); @@ -1101,16 +1101,16 @@ ebrowser_initialize(peb);
/* SetRect */ - rc.left = 0; rc.top = 0; rc.right = 0; rc.bottom = 0; + SetRectEmpty(&rc); hr = IExplorerBrowser_SetRect(peb, NULL, rc); ok(hr == S_OK, "got (0x%08x)\n", hr);
- rc.left = 100; rc.top = 100; rc.right = 10; rc.bottom = 10; + SetRect(&rc, 100, 100, 10, 10); hr = IExplorerBrowser_SetRect(peb, NULL, rc); ok(hr == S_OK, "got (0x%08x)\n", hr);
/* SetRect with DeferWindowPos */ - rc.left = rc.top = 0; rc.right = rc.bottom = 10; + SetRect(&rc, 0, 0, 10, 10); hdwp = BeginDeferWindowPos(1); hr = IExplorerBrowser_SetRect(peb, &hdwp, rc); ok(hr == S_OK, "got (0x%08x)\n", hr); @@ -1125,7 +1125,7 @@ ok(!lres, "EndDeferWindowPos succeeded unexpectedly.\n");
/* Test positioning */ - rc.left = 10; rc.top = 20; rc.right = 50; rc.bottom = 50; + SetRect(&rc, 10, 20, 50, 50); hr = IExplorerBrowser_SetRect(peb, NULL, rc); ok(hr == S_OK, "got (0x%08x)\n", hr); hr = IExplorerBrowser_QueryInterface(peb, &IID_IShellBrowser, (void**)&psb); @@ -1715,7 +1715,7 @@ hr = IInputObject_TranslateAcceleratorIO(pio, &msg_a); todo_wine ok(hr == E_FAIL, "Got 0x%08x\n", hr);
- rc.left = 0; rc.top = 0; rc.right = 100; rc.bottom = 100; + SetRect(&rc, 0, 0, 100, 100); hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL); ok(hr == S_OK, "Got 0x%08x\n", hr);
Modified: trunk/rostests/winetests/shell32/progman_dde.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/progman_... ============================================================================== --- trunk/rostests/winetests/shell32/progman_dde.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/progman_dde.c [iso-8859-1] Sun Jul 3 11:36:38 2016 @@ -486,19 +486,10 @@ DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams); /* todo_wine... Is expected to fail, wine stubbed functions DO fail */ /* TODO REMOVE THIS CODE!!! */ - if (expected_result == DMLERR_NOTPROCESSED) - { + todo_wine_if (expected_result != DMLERR_NOTPROCESSED) ok (expected_result == error, "ShowGroup %s: Expected Error %s, received %s.%s\n", groupName, GetStringFromError(expected_result), GetStringFromError(error), GetStringFromTestParams(testParams)); - } else { - todo_wine - { - ok (expected_result == error, "ShowGroup %s: Expected Error %s, received %s.%s\n", - groupName, GetStringFromError(expected_result), GetStringFromError(error), - GetStringFromTestParams(testParams)); - } - }
if (error == DMLERR_NO_ERROR) {
Modified: trunk/rostests/winetests/shell32/shelldispatch.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/shelldis... ============================================================================== --- trunk/rostests/winetests/shell32/shelldispatch.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/shelldispatch.c [iso-8859-1] Sun Jul 3 11:36:38 2016 @@ -884,7 +884,6 @@ test_ShellWindows(); test_ParseName(); test_Verbs(); - test_ShellExecute();
CoUninitialize();
Modified: trunk/rostests/winetests/shell32/shelllink.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/shelllin... ============================================================================== --- trunk/rostests/winetests/shell32/shelllink.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/shelllink.c [iso-8859-1] Sun Jul 3 11:36:38 2016 @@ -351,12 +351,6 @@ */
#define lok ok_(__FILE__, line) -#define lok_todo_4(todo_flag,a,b,c,d) \ - if ((todo & todo_flag) == 0) lok((a), (b), (c), (d)); \ - else todo_wine lok((a), (b), (c), (d)); -#define lok_todo_2(todo_flag,a,b) \ - if ((todo & todo_flag) == 0) lok((a), (b)); \ - else todo_wine lok((a), (b)); #define check_lnk(a,b,c) check_lnk_(__LINE__, (a), (b), (c))
void create_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int save_fails) @@ -433,16 +427,8 @@ lok(str == NULL, "got %p\n", str);
r = IPersistFile_Save(pf, path, TRUE); - if (save_fails) - { - todo_wine { + todo_wine_if (save_fails) lok(r == S_OK, "save failed (0x%08x)\n", r); - } - } - else - { - lok(r == S_OK, "save failed (0x%08x)\n", r); - }
/* test GetCurFile after ::Save */ r = IPersistFile_GetCurFile(pf, &str); @@ -533,44 +519,44 @@ strcpy(buffer,"garbage"); r = IShellLinkA_GetDescription(sl, buffer, sizeof(buffer)); lok(r == S_OK, "GetDescription failed (0x%08x)\n", r); - lok_todo_4(0x1, strcmp(buffer, desc->description)==0, - "GetDescription returned '%s' instead of '%s'\n", - buffer, desc->description); + todo_wine_if ((todo & 0x1) != 0) + lok(strcmp(buffer, desc->description)==0, "GetDescription returned '%s' instead of '%s'\n", + buffer, desc->description); } if (desc->workdir) { strcpy(buffer,"garbage"); r = IShellLinkA_GetWorkingDirectory(sl, buffer, sizeof(buffer)); lok(r == S_OK, "GetWorkingDirectory failed (0x%08x)\n", r); - lok_todo_4(0x2, lstrcmpiA(buffer, desc->workdir)==0, - "GetWorkingDirectory returned '%s' instead of '%s'\n", - buffer, desc->workdir); + todo_wine_if ((todo & 0x2) != 0) + lok(lstrcmpiA(buffer, desc->workdir)==0, "GetWorkingDirectory returned '%s' instead of '%s'\n", + buffer, desc->workdir); } if (desc->path) { 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, lstrcmpiA(buffer, desc->path)==0, - "GetPath returned '%s' instead of '%s'\n", - buffer, desc->path); + todo_wine_if ((todo & 0x4) != 0) + lok(lstrcmpiA(buffer, desc->path)==0, "GetPath returned '%s' instead of '%s'\n", + buffer, desc->path); } if (desc->pidl) { LPITEMIDLIST pidl=NULL; r = IShellLinkA_GetIDList(sl, &pidl); lok(r == S_OK, "GetIDList failed (0x%08x)\n", r); - lok_todo_2(0x8, pILIsEqual(pidl, desc->pidl), - "GetIDList returned an incorrect pidl\n"); + todo_wine_if ((todo & 0x8) != 0) + lok(pILIsEqual(pidl, desc->pidl), "GetIDList returned an incorrect pidl\n"); } if (desc->showcmd) { int i=0xdeadbeef; r = IShellLinkA_GetShowCmd(sl, &i); lok(r == S_OK, "GetShowCmd failed (0x%08x)\n", r); - lok_todo_4(0x10, i==desc->showcmd, - "GetShowCmd returned 0x%0x instead of 0x%0x\n", - i, desc->showcmd); + todo_wine_if ((todo & 0x10) != 0) + lok(i==desc->showcmd, "GetShowCmd returned 0x%0x instead of 0x%0x\n", + i, desc->showcmd); } if (desc->icon) { @@ -578,21 +564,21 @@ 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, lstrcmpiA(buffer, desc->icon)==0, - "GetIconLocation returned '%s' instead of '%s'\n", - buffer, desc->icon); - lok_todo_4(0x20, i==desc->icon_id, - "GetIconLocation returned 0x%0x instead of 0x%0x\n", - i, desc->icon_id); + todo_wine_if ((todo & 0x20) != 0) { + lok(lstrcmpiA(buffer, desc->icon)==0, "GetIconLocation returned '%s' instead of '%s'\n", + buffer, desc->icon); + lok(i==desc->icon_id, "GetIconLocation returned 0x%0x instead of 0x%0x\n", + i, desc->icon_id); + } } if (desc->hotkey) { WORD i=0xbeef; r = IShellLinkA_GetHotkey(sl, &i); lok(r == S_OK, "GetHotkey failed (0x%08x)\n", r); - lok_todo_4(0x40, i==desc->hotkey, - "GetHotkey returned 0x%04x instead of 0x%04x\n", - i, desc->hotkey); + todo_wine_if ((todo & 0x40) != 0) + lok(i==desc->hotkey, "GetHotkey returned 0x%04x instead of 0x%04x\n", + i, desc->hotkey); }
IShellLinkA_Release(sl);
Modified: trunk/rostests/winetests/shell32/shellpath.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/shellpat... ============================================================================== --- trunk/rostests/winetests/shell32/shellpath.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/shellpath.c [iso-8859-1] Sun Jul 3 11:36:38 2016 @@ -2283,7 +2283,7 @@ /* remove newly created directory */ RemoveDirectoryW(sSubFolder2Path);
- /* verify sub folder. It still succeedes, so Windows does not check folder presence each time */ + /* verify subfolder. It still succeeds, so Windows does not check folder presence each time */ hr = IKnownFolder_GetPath(subFolder, 0, &folderPath); todo_wine ok(hr == S_OK, "failed to get known folder path: 0x%08x\n", hr);
Modified: trunk/rostests/winetests/shell32/shlexec.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/shlexec.... ============================================================================== --- trunk/rostests/winetests/shell32/shlexec.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/shlexec.c [iso-8859-1] Sun Jul 3 11:36:38 2016 @@ -365,7 +365,7 @@ #define okShell okShell_(__FILE__, __LINE__)
static char assoc_desc[2048]; -void reset_association_description(void) +static void reset_association_description(void) { *assoc_desc = '\0'; } @@ -650,7 +650,7 @@ * functions know about it */ WritePrivateProfileStringA(NULL, NULL, NULL, child_file); - if (GetFileAttributesA(child_file) != INVALID_FILE_ATTRIBUTES) + if (rc > 32 && GetFileAttributesA(child_file) != INVALID_FILE_ATTRIBUTES) { int c; dump_child_(file, line); @@ -684,9 +684,37 @@ * ***/
+static BOOL create_test_class(const char* class, BOOL protocol) +{ + HKEY hkey, hkey_shell; + LONG rc; + + rc = RegCreateKeyExA(HKEY_CLASSES_ROOT, class, 0, NULL, 0, + KEY_CREATE_SUB_KEY | KEY_SET_VALUE, NULL, + &hkey, NULL); + ok(rc == ERROR_SUCCESS || rc == ERROR_ACCESS_DENIED, + "could not create class %s (rc=%d)\n", class, rc); + if (rc != ERROR_SUCCESS) + return FALSE; + + if (protocol) + { + rc = RegSetValueExA(hkey, "URL Protocol", 0, REG_SZ, (LPBYTE)"", 1); + ok(rc == ERROR_SUCCESS, "RegSetValueEx '%s' failed, expected ERROR_SUCCESS, got %d\n", class, rc); + } + + 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); + CloseHandle(hkey_shell); + return TRUE; +} + static BOOL create_test_association(const char* extension) { - HKEY hkey, hkey_shell; + HKEY hkey; char class[MAX_PATH]; LONG rc;
@@ -702,18 +730,7 @@ ok(rc==ERROR_SUCCESS, "RegSetValueEx '%s' failed, expected ERROR_SUCCESS, got %d\n", class, rc); CloseHandle(hkey);
- 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=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); - CloseHandle(hkey_shell); - - return TRUE; + return create_test_class(class, FALSE); }
/* Based on RegDeleteTreeW from dlls/advapi32/registry.c */ @@ -783,16 +800,21 @@ return ret; }
+static void delete_test_class(const char* classname) +{ + myRegDeleteTreeA(HKEY_CLASSES_ROOT, classname); +} + static void delete_test_association(const char* extension) { - char class[MAX_PATH]; - - sprintf(class, "shlexec%s", extension); - myRegDeleteTreeA(HKEY_CLASSES_ROOT, class); + char classname[MAX_PATH]; + + sprintf(classname, "shlexec%s", extension); + delete_test_class(classname); myRegDeleteTreeA(HKEY_CLASSES_ROOT, extension); }
-static void create_test_verb_dde(const char* extension, const char* verb, +static void create_test_verb_dde(const char* classname, const char* verb, int rawcmd, const char* cmdtail, const char *ddeexec, const char *application, const char *topic, const char *ifexec) @@ -803,7 +825,7 @@ LONG rc;
strcpy(assoc_desc, " Assoc "); - strcat_param(assoc_desc, "ext", extension); + strcat_param(assoc_desc, "class", classname); strcat_param(assoc_desc, "verb", verb); sprintf(shell, "%d", rawcmd); strcat_param(assoc_desc, "rawcmd", shell); @@ -813,7 +835,7 @@ strcat_param(assoc_desc, "topic", topic); strcat_param(assoc_desc, "ifexec", ifexec);
- sprintf(shell, "shlexec%s\shell", extension); + sprintf(shell, "%s\shell", classname); 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); @@ -893,10 +915,10 @@ * This function is meant to be used to create long term test verbs and thus * does not trace them. */ -static void create_test_verb(const char* extension, const char* verb, +static void create_test_verb(const char* classname, const char* verb, int rawcmd, const char* cmdtail) { - create_test_verb_dde(extension, verb, rawcmd, cmdtail, NULL, NULL, + create_test_verb_dde(classname, verb, rawcmd, cmdtail, NULL, NULL, NULL, NULL); reset_association_description(); } @@ -994,7 +1016,9 @@ "%s\test_shortcut_exe.lnk", "%s\test file.shl", "%s\test file.shlfoo", + "%s\test file.sha", "%s\test file.sfe", + "%s\test file.shlproto", "%s\masked file.shlexec", "%s\masked", "%s\test file.sde", @@ -1043,12 +1067,17 @@
{"notaverb", "%s\test file.shlexec", 0x10, SE_ERR_NOASSOC},
+ {"averb", "%s\test file.sha", 0x10, 33}, + /* Test file masked due to space */ {NULL, "%s\masked file.shlexec", 0x0, 33}, /* Test if quoting prevents the masking */ {NULL, "%s\masked file.shlexec", 0x40, 33}, /* Test with incorrect quote */ {NULL, ""%s\masked file.shlexec", 0x0, SE_ERR_FNF}, + + /* Test extension / URI protocol collision */ + {NULL, "%s\test file.shlproto", 0x0, SE_ERR_NOASSOC},
{NULL, NULL, 0} }; @@ -1570,13 +1599,13 @@ 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""); - create_test_verb(".shlexec", "Params2345Etc", 0, "Params2345Etc ~2="%~2" ~3="%~3" ~4="%~4" ~5=%~5"); - create_test_verb(".shlexec", "Params9Etc", 0, "Params9Etc ~9="%~9""); - create_test_verb(".shlexec", "Params20", 0, "Params20 "%20""); - create_test_verb(".shlexec", "ParamsBad", 0, "ParamsBad "%% %- %~ %~0 %~1 %~a %~* %a %b %c %TMPDIR%""); + create_test_verb("shlexec.shlexec", "Params232S", 0, "Params232S %2 %3 "%2" "%*""); + create_test_verb("shlexec.shlexec", "Params23456", 0, "Params23456 "%2" "%3" "%4" "%5" "%6""); + create_test_verb("shlexec.shlexec", "Params23456789", 0, "Params23456789 "%2" "%3" "%4" "%5" "%6" "%7" "%8" "%9""); + create_test_verb("shlexec.shlexec", "Params2345Etc", 0, "Params2345Etc ~2="%~2" ~3="%~3" ~4="%~4" ~5=%~5"); + create_test_verb("shlexec.shlexec", "Params9Etc", 0, "Params9Etc ~9="%~9""); + create_test_verb("shlexec.shlexec", "Params20", 0, "Params20 "%20""); + create_test_verb("shlexec.shlexec", "ParamsBad", 0, "ParamsBad "%% %- %~ %~0 %~1 %~a %~* %a %b %c %TMPDIR%"");
sprintf(fileA, "%s\test file.shlexec", tmpdir);
@@ -1748,6 +1777,14 @@ sprintf(filename, "%s\test file.shlexec", tmpdir); okChildPath("argvA4", filename); } + + sprintf(filename, ""%s\test file.sha"", tmpdir); + rc=shell_execute(NULL, filename, NULL, NULL); + todo_wine okShell(rc > 32, "failed: rc=%ld err=%u\n", rc, GetLastError()); + okChildInt("argcA", 5); + todo_wine okChildString("argvA3", "averb"); + sprintf(filename, "%s\test file.sha", tmpdir); + todo_wine okChildPath("argvA4", filename); }
typedef struct @@ -1792,6 +1829,9 @@ /* Test shortcuts vs. URLs */ {"file://///", "%s\test_shortcut_shlexec.lnk", 0, 0x1d},
+ /* Confuse things by mixing protocols */ + {"file://", "shlproto://foo/bar", USE_COLON, 0}, + {NULL, NULL, 0, 0} };
@@ -1878,6 +1918,100 @@ SetEnvironmentVariableA("urlprefix", NULL); }
+static void test_urls(void) +{ + char url[MAX_PATH]; + INT_PTR rc; + + if (!create_test_class("fakeproto", FALSE)) + { + skip("Unable to create 'fakeproto' class for URL tests\n"); + return; + } + create_test_verb("fakeproto", "open", 0, "URL %1"); + + create_test_class("shlpaverb", TRUE); + create_test_verb("shlpaverb", "averb", 0, "PAVerb "%1""); + + /* Protocols must be properly declared */ + rc = shell_execute(NULL, "notaproto://foo", NULL, NULL); + ok(rc == SE_ERR_NOASSOC || broken(rc == SE_ERR_ACCESSDENIED), + "%s returned %lu\n", shell_call, rc); + + rc = shell_execute(NULL, "fakeproto://foo/bar", NULL, NULL); + todo_wine ok(rc == SE_ERR_NOASSOC || broken(rc == SE_ERR_ACCESSDENIED), + "%s returned %lu\n", shell_call, rc); + + /* Here's a real live one */ + rc = shell_execute(NULL, "shlproto://foo/bar", NULL, NULL); + ok(rc > 32, "%s failed: rc=%lu\n", shell_call, rc); + okChildInt("argcA", 5); + okChildString("argvA3", "URL"); + okChildString("argvA4", "shlproto://foo/bar"); + + /* Check default verb detection */ + rc = shell_execute(NULL, "shlpaverb://foo/bar", NULL, NULL); + todo_wine ok(rc > 32 || /* XP+IE7 - Win10 */ + broken(rc == SE_ERR_NOASSOC), /* XP+IE6 */ + "%s failed: rc=%lu\n", shell_call, rc); + if (rc > 32) + { + okChildInt("argcA", 5); + todo_wine okChildString("argvA3", "PAVerb"); + todo_wine okChildString("argvA4", "shlpaverb://foo/bar"); + } + + /* But alternative verbs are a recent feature! */ + rc = shell_execute("averb", "shlproto://foo/bar", NULL, NULL); + ok(rc > 32 || /* Win8 - Win10 */ + broken(rc == SE_ERR_ACCESSDENIED), /* XP - Win7 */ + "%s failed: rc=%lu\n", shell_call, rc); + if (rc > 32) + { + okChildString("argvA3", "AVerb"); + okChildString("argvA4", "shlproto://foo/bar"); + } + + /* A .lnk ending does not turn a URL into a shortcut */ + todo_wait rc = shell_execute(NULL, "shlproto://foo/bar.lnk", NULL, NULL); + ok(rc > 32, "%s failed: rc=%lu\n", shell_call, rc); + okChildInt("argcA", 5); + todo_wine okChildString("argvA3", "URL"); + todo_wine okChildString("argvA4", "shlproto://foo/bar.lnk"); + + /* Neither does a .exe extension */ + rc = shell_execute(NULL, "shlproto://foo/bar.exe", NULL, NULL); + ok(rc > 32, "%s failed: rc=%lu\n", shell_call, rc); + okChildInt("argcA", 5); + okChildString("argvA3", "URL"); + okChildString("argvA4", "shlproto://foo/bar.exe"); + + /* But a class name overrides it */ + rc = shell_execute(NULL, "shlproto://foo/bar", "shlexec.shlexec", NULL); + ok(rc > 32, "%s failed: rc=%lu\n", shell_call, rc); + okChildInt("argcA", 5); + okChildString("argvA3", "URL"); + okChildString("argvA4", "shlproto://foo/bar"); + + /* Environment variables are expanded in URLs (but not in file URLs!) */ + rc = shell_execute_ex(SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI, + NULL, "shlproto://%TMPDIR%/bar", NULL, NULL, NULL); + okShell(rc > 32, "failed: rc=%lu\n", rc); + okChildInt("argcA", 5); + sprintf(url, "shlproto://%s/bar", tmpdir); + okChildString("argvA3", "URL"); + okChildStringBroken("argvA4", url, "shlproto://%TMPDIR%/bar"); + + /* But only after the path has been identified as a URL */ + SetEnvironmentVariableA("urlprefix", "shlproto:///"); + rc = shell_execute(NULL, "%urlprefix%foo", NULL, NULL); + todo_wine ok(rc == SE_ERR_FNF, "%s returned %lu\n", shell_call, rc); + SetEnvironmentVariableA("urlprefix", NULL); + + delete_test_class("fakeproto"); + delete_test_class("shlpaverb"); +} + static void test_find_executable(void) { char notepad_path[MAX_PATH]; @@ -1891,7 +2025,7 @@ skip("Unable to create association for '.sfe'\n"); return; } - create_test_verb(".sfe", "Open", 1, "%1"); + create_test_verb("shlexec.sfe", "Open", 1, "%1");
/* Don't test FindExecutable(..., NULL), it always crashes */
@@ -1941,7 +2075,7 @@ skip("Unable to create association for '.shl'\n"); return; } - create_test_verb(".shl", "Open", 0, "Open"); + create_test_verb("shlexec.shl", "Open", 0, "Open");
sprintf(filename, "%s\test file.shl", tmpdir); rc=(INT_PTR)FindExecutableA(filename, NULL, command); @@ -2328,7 +2462,7 @@ skip("Unable to create association for '.sde'\n"); return; } - create_test_verb_dde(".sde", "Open", 0, test->command, test->ddeexec, + create_test_verb_dde("shlexec.sde", "Open", 0, test->command, test->ddeexec, test->application, test->topic, test->ifexec);
if (test->application != NULL || test->topic != NULL) @@ -2506,7 +2640,7 @@ return; } sprintf(params, test->command, tmpdir); - create_test_verb_dde(".sde", "Open", 1, params, "[test]", NULL, + create_test_verb_dde("shlexec.sde", "Open", 1, params, "[test]", NULL, "shlexec", NULL); ddeApplication[0] = 0;
@@ -2677,12 +2811,19 @@ skip("Unable to create association for '.shlexec'\n"); return; } - create_test_verb(".shlexec", "Open", 0, "Open "%1""); - create_test_verb(".shlexec", "NoQuotes", 0, "NoQuotes %1"); - create_test_verb(".shlexec", "LowerL", 0, "LowerL %l"); - create_test_verb(".shlexec", "QuotedLowerL", 0, "QuotedLowerL "%l""); - create_test_verb(".shlexec", "UpperL", 0, "UpperL %L"); - create_test_verb(".shlexec", "QuotedUpperL", 0, "QuotedUpperL "%L""); + create_test_verb("shlexec.shlexec", "Open", 0, "Open "%1""); + create_test_verb("shlexec.shlexec", "NoQuotes", 0, "NoQuotes %1"); + create_test_verb("shlexec.shlexec", "LowerL", 0, "LowerL %l"); + create_test_verb("shlexec.shlexec", "QuotedLowerL", 0, "QuotedLowerL "%l""); + create_test_verb("shlexec.shlexec", "UpperL", 0, "UpperL %L"); + create_test_verb("shlexec.shlexec", "QuotedUpperL", 0, "QuotedUpperL "%L""); + + create_test_association(".sha"); + create_test_verb("shlexec.sha", "averb", 0, "AVerb "%1""); + + create_test_class("shlproto", TRUE); + create_test_verb("shlproto", "open", 0, "URL "%1""); + create_test_verb("shlproto", "averb", 0, "AVerb "%1"");
/* Set an environment variable to see if it is inherited */ SetEnvironmentVariableA("ShlexecVar", "Present"); @@ -2708,6 +2849,8 @@
/* Delete the test association */ delete_test_association(".shlexec"); + delete_test_association(".sha"); + delete_test_class("shlproto");
CloseHandle(hEvent);
@@ -2785,6 +2928,7 @@ test_lpFile_parsed(); test_filename(); test_fileurls(); + test_urls(); test_find_executable(); test_lnks(); test_exes();
Modified: trunk/rostests/winetests/shell32/shlfileop.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/shlfileo... ============================================================================== --- trunk/rostests/winetests/shell32/shlfileop.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/shlfileop.c [iso-8859-1] Sun Jul 3 11:36:38 2016 @@ -1819,6 +1819,30 @@ ok(DeleteFileA("abcdefgh.abc"), "Expected file to exist\n"); ok(DeleteFileA("dir\abcdefgh.abc"), "Expected file to exist\n"); ok(RemoveDirectoryA("dir"), "Expected dir to exist\n"); + + /* Check last error after a successful file operation. */ + clean_after_shfo_tests(); + init_shfo_tests(); + shfo.pFrom = "test1.txt\0"; + shfo.pTo = "testdir2\0"; + shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI; + SetLastError(0xdeadbeef); + retval = SHFileOperationA(&shfo); + ok(retval == ERROR_SUCCESS, "File copy failed with %d\n", retval); + ok(!shfo.fAnyOperationsAborted, "Didn't expect aborted operations\n"); + ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError()); + + /* Check last error after a failed file operation. */ + clean_after_shfo_tests(); + init_shfo_tests(); + shfo.pFrom = "nonexistent\0"; + shfo.pTo = "testdir2\0"; + shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI; + SetLastError(0xdeadbeef); + retval = SHFileOperationA(&shfo); + ok(retval != ERROR_SUCCESS, "Unexpected ERROR_SUCCESS\n"); + ok(!shfo.fAnyOperationsAborted, "Didn't expect aborted operations\n"); + ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError()); }
/* tests the FO_MOVE action */ @@ -2464,6 +2488,7 @@ SHFILEOPSTRUCTW shfoW; int ret; HANDLE file; + static const WCHAR UNICODE_PATH_TO[] = {'c',':','\',0x00ae,0x00ae,'\0'};
if (!pSHFileOperationW) { @@ -2530,6 +2555,36 @@ ret = pSHFileOperationW(&shfoW); ok(!ret, "Directory is not removed, ErrorCode: %d\n", ret); ok(!file_existsW(UNICODE_PATH), "The directory should have been removed\n"); + + shfoW.hwnd = NULL; + shfoW.wFunc = FO_COPY; + shfoW.pFrom = UNICODE_PATH; + shfoW.pTo = UNICODE_PATH_TO; + shfoW.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI; + shfoW.hNameMappings = NULL; + shfoW.lpszProgressTitle = NULL; + + /* Check last error after a successful file operation. */ + createTestFileW(UNICODE_PATH); + ok(file_existsW(UNICODE_PATH), "The file does not exist\n"); + SetLastError(0xdeadbeef); + ret = SHFileOperationW(&shfoW); + ok(ret == ERROR_SUCCESS, "File copy failed with %d\n", ret); + ok(!shfoW.fAnyOperationsAborted, "Didn't expect aborted operations\n"); + ok(GetLastError() == ERROR_SUCCESS || + broken(GetLastError() == ERROR_INVALID_HANDLE), /* WinXp, win2k3 */ + "Expected ERROR_SUCCESS, got %d\n", GetLastError()); + + /* Check last error after a failed file operation. */ + DeleteFileW(UNICODE_PATH); + ok(!file_existsW(UNICODE_PATH), "The file should have been removed\n"); + SetLastError(0xdeadbeef); + ret = SHFileOperationW(&shfoW); + ok(ret != ERROR_SUCCESS, "Unexpected ERROR_SUCCESS\n"); + ok(!shfoW.fAnyOperationsAborted, "Didn't expect aborted operations\n"); + ok(GetLastError() == ERROR_SUCCESS || + broken(GetLastError() == ERROR_INVALID_HANDLE), /* WinXp, win2k3 */ + "Expected ERROR_SUCCESS, got %d\n", GetLastError()); }
static void
Modified: trunk/rostests/winetests/shell32/shlfolder.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/shlfolde... ============================================================================== --- trunk/rostests/winetests/shell32/shlfolder.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/shlfolder.c [iso-8859-1] Sun Jul 3 11:36:38 2016 @@ -1142,7 +1142,7 @@ todo_wine ok (hr == E_INVALIDARG || broken(hr == S_OK), /* W2K and earlier */ - "MyComputer->GetAttributesOf(emtpy pidl) should fail! hr = %08x\n", hr); + "MyComputer->GetAttributesOf(empty pidl) should fail! hr = %08x\n", hr);
dwFlags = 0xffffffff; hr = IShellFolder_GetAttributesOf(psfMyComputer, 0, NULL, &dwFlags);
Modified: trunk/rostests/winetests/shell32/shlview.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/shlview.... ============================================================================== --- trunk/rostests/winetests/shell32/shlview.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/shlview.c [iso-8859-1] Sun Jul 3 11:36:38 2016 @@ -761,8 +761,7 @@ settings.ViewMode = FVM_ICON; settings.fFlags = 0; hwnd_view = (HWND)0xdeadbeef; - r.left = r.top = 0; - r.right = r.bottom = 100; + SetRect(&r, 0, 0, 100, 100); hr = IShellView_CreateViewWindow(view, NULL, &settings, browser, &r, &hwnd_view); ok(hr == S_OK, "got (0x%08x)\n", hr); ok(IsWindow(hwnd_view), "got %p\n", hwnd_view);