Author: akhaldi Date: Sun May 13 18:14:09 2012 New Revision: 56576
URL: http://svn.reactos.org/svn/reactos?rev=56576&view=rev Log: [SHELL32_WINETEST] * Sync to Wine 1.5.4.
Added: trunk/rostests/winetests/shell32/assoc.c (with props) Modified: trunk/rostests/winetests/shell32/CMakeLists.txt trunk/rostests/winetests/shell32/appbar.c trunk/rostests/winetests/shell32/brsfolder.c trunk/rostests/winetests/shell32/shelldispatch.c trunk/rostests/winetests/shell32/shellpath.c trunk/rostests/winetests/shell32/shlexec.c trunk/rostests/winetests/shell32/shlfolder.c trunk/rostests/winetests/shell32/systray.c trunk/rostests/winetests/shell32/testlist.c
Modified: trunk/rostests/winetests/shell32/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/CMakeLis... ============================================================================== --- trunk/rostests/winetests/shell32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/CMakeLists.txt [iso-8859-1] Sun May 13 18:14:09 2012 @@ -7,6 +7,7 @@
list(APPEND SOURCE appbar.c + assoc.c autocomplete.c brsfolder.c ebrowser.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 May 13 18:14:09 2012 @@ -17,7 +17,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <assert.h> #include <stdarg.h>
#include <windows.h>
Added: 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 (added) +++ trunk/rostests/winetests/shell32/assoc.c [iso-8859-1] Sun May 13 18:14:09 2012 @@ -1,0 +1,108 @@ +/* Unit test suite for various shell Association objects + * + * Copyright 2012 Detlef Riekenberg + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS + +#include <stdarg.h> + +#include "shlwapi.h" +#include "shlguid.h" +#include "shobjidl.h" + +#include "wine/test.h" + + +static void test_IQueryAssociations_QueryInterface(void) +{ + IQueryAssociations *qa; + IQueryAssociations *qa2; + 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; + } + + hr = IUnknown_QueryInterface(qa, &IID_IQueryAssociations, (void**)&qa2); + ok(hr == S_OK, "QueryInterface (IQueryAssociations) returned 0x%x\n", hr); + if (SUCCEEDED(hr)) { + IUnknown_Release(qa2); + } + + hr = IUnknown_QueryInterface(qa, &IID_IUnknown, (void**)&unk); + ok(hr == S_OK, "QueryInterface (IUnknown) returned 0x%x\n", hr); + if (SUCCEEDED(hr)) { + IUnknown_Release(unk); + } + + hr = IUnknown_QueryInterface(qa, &IID_IUnknown, NULL); + ok(hr == E_POINTER, "got 0x%x (expected E_POINTER)\n", hr); + + IQueryAssociations_Release(qa); +} + + +static void test_IApplicationAssociationRegistration_QueryInterface(void) +{ + IApplicationAssociationRegistration *appreg; + IApplicationAssociationRegistration *appreg2; + IUnknown *unk; + HRESULT hr; + + /* this works since Vista */ + hr = CoCreateInstance(&CLSID_ApplicationAssociationRegistration, NULL, CLSCTX_INPROC_SERVER, + &IID_IApplicationAssociationRegistration, (LPVOID*)&appreg); + + if (FAILED(hr)) { + skip("IApplicationAssociationRegistration not created: 0x%x\n", hr); + return; + } + + hr = IUnknown_QueryInterface(appreg, &IID_IApplicationAssociationRegistration, (void**)&appreg2); + ok(hr == S_OK, "QueryInterface (IApplicationAssociationRegistration) returned 0x%x\n", hr); + if (SUCCEEDED(hr)) { + IUnknown_Release(appreg2); + } + + hr = IUnknown_QueryInterface(appreg, &IID_IUnknown, (void**)&unk); + ok(hr == S_OK, "QueryInterface (IUnknown) returned 0x%x\n", hr); + if (SUCCEEDED(hr)) { + IUnknown_Release(unk); + } + + hr = IUnknown_QueryInterface(appreg, &IID_IUnknown, NULL); + ok(hr == E_POINTER, "got 0x%x (expected E_POINTER)\n", hr); + + IApplicationAssociationRegistration_Release(appreg); +} + + +START_TEST(assoc) +{ + CoInitialize(NULL); + + test_IQueryAssociations_QueryInterface(); + test_IApplicationAssociationRegistration_QueryInterface(); + + CoUninitialize(); +}
Propchange: trunk/rostests/winetests/shell32/assoc.c ------------------------------------------------------------------------------ svn:eol-style = native
Modified: trunk/rostests/winetests/shell32/brsfolder.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/brsfolde... ============================================================================== --- trunk/rostests/winetests/shell32/brsfolder.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/brsfolder.c [iso-8859-1] Sun May 13 18:14:09 2012 @@ -200,7 +200,7 @@ bi.ulFlags = BIF_NEWDIALOGSTYLE; bi.lpfn = create_new_folder_callback; /* Use test folder as the root folder for dialog box */ - MultiByteToWideChar(CP_UTF8, 0, test_folder_path, MAX_PATH, + MultiByteToWideChar(CP_UTF8, 0, test_folder_path, -1, test_folder_pathW, MAX_PATH); hr = SHGetDesktopFolder(&test_folder_object); ok (SUCCEEDED(hr), "SHGetDesktopFolder failed with hr 0x%08x\n", hr);
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 May 13 18:14:09 2012 @@ -27,6 +27,9 @@ #include "shlwapi.h" #include "wine/test.h"
+#define EXPECT_HR(hr,hr_exp) \ + ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp) + static HRESULT (WINAPI *pSHGetFolderPathW)(HWND, int, HANDLE, DWORD, LPWSTR); static HRESULT (WINAPI *pSHGetNameFromIDList)(PCIDLIST_ABSOLUTE,SIGDN,PWSTR*); static HRESULT (WINAPI *pSHGetSpecialFolderLocation)(HWND, int, LPITEMIDLIST *); @@ -303,6 +306,63 @@ IShellDispatch_Release(sd); }
+static void test_service(void) +{ + static const WCHAR spooler[] = {'S','p','o','o','l','e','r',0}; + static const WCHAR dummyW[] = {'d','u','m','m','y',0}; + SERVICE_STATUS_PROCESS status; + SC_HANDLE scm, service; + IShellDispatch2 *sd; + DWORD dummy; + HRESULT hr; + BSTR name; + VARIANT v; + + hr = CoCreateInstance(&CLSID_Shell, NULL, CLSCTX_INPROC_SERVER, + &IID_IShellDispatch2, (void**)&sd); + if (hr != S_OK) + { + win_skip("IShellDispatch2 not supported\n"); + return; + } + + V_VT(&v) = VT_I2; + V_I2(&v) = 10; + hr = IShellDispatch2_IsServiceRunning(sd, NULL, &v); + ok(V_VT(&v) == VT_BOOL, "got %d\n", V_VT(&v)); + ok(V_BOOL(&v) == VARIANT_FALSE, "got %d\n", V_BOOL(&v)); + EXPECT_HR(hr, S_OK); + + scm = OpenSCManagerW(NULL, NULL, SC_MANAGER_CONNECT); + service = OpenServiceW(scm, spooler, SERVICE_QUERY_STATUS); + QueryServiceStatusEx(service, SC_STATUS_PROCESS_INFO, (BYTE *)&status, sizeof(SERVICE_STATUS_PROCESS), &dummy); + CloseServiceHandle(service); + CloseServiceHandle(scm); + + /* service should exist */ + name = SysAllocString(spooler); + V_VT(&v) = VT_I2; + hr = IShellDispatch2_IsServiceRunning(sd, name, &v); + EXPECT_HR(hr, S_OK); + ok(V_VT(&v) == VT_BOOL, "got %d\n", V_VT(&v)); + if (status.dwCurrentState == SERVICE_RUNNING) + ok(V_BOOL(&v) == VARIANT_TRUE, "got %d\n", V_BOOL(&v)); + else + ok(V_BOOL(&v) == VARIANT_FALSE, "got %d\n", V_BOOL(&v)); + SysFreeString(name); + + /* service doesn't exist */ + name = SysAllocString(dummyW); + V_VT(&v) = VT_I2; + hr = IShellDispatch2_IsServiceRunning(sd, name, &v); + EXPECT_HR(hr, S_OK); + ok(V_VT(&v) == VT_BOOL, "got %d\n", V_VT(&v)); + ok(V_BOOL(&v) == VARIANT_FALSE, "got %d\n", V_BOOL(&v)); + SysFreeString(name); + + IShellDispatch_Release(sd); +} + START_TEST(shelldispatch) { HRESULT r; @@ -314,6 +374,7 @@
init_function_pointers(); test_namespace(); + test_service();
CoUninitialize(); }
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 May 13 18:14:09 2012 @@ -859,6 +859,12 @@ hr = pSHGetKnownFolderPath(&FOLDERID_Desktop, 0, NULL, NULL); ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr); } + /* non-existent folder id */ + path = (void *)0xdeadbeef; + hr = pSHGetKnownFolderPath(&IID_IOleObject, 0, NULL, &path); + ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "got 0x%08x\n", hr); + ok(path == NULL, "got %p\n", path); + path = NULL; hr = pSHGetKnownFolderPath(&FOLDERID_Desktop, 0, NULL, &path); ok(hr == S_OK, "expected S_OK, got 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 May 13 18:14:09 2012 @@ -92,7 +92,10 @@ static char shell_call[2048]=""; static int shell_execute(LPCSTR operation, LPCSTR file, LPCSTR parameters, LPCSTR directory) { - INT_PTR rc; + INT_PTR rc, rcEmpty = 0; + + if(!operation) + rcEmpty = shell_execute("", file, parameters, directory);
strcpy(shell_call, "ShellExecute("); strcat_param(shell_call, operation); @@ -138,6 +141,10 @@ WritePrivateProfileStringA(NULL, NULL, NULL, child_file); if (rc > 32) dump_child(); + + if(!operation) + ok(rc == rcEmpty || broken(rc > 32 && rcEmpty == SE_ERR_NOASSOC) /* NT4 */, + "Got different return value with empty string: %lu %lu\n", rc, rcEmpty);
return rc; } @@ -2150,6 +2157,7 @@ LPWSTR *args = (LPWSTR*)0xdeadcafe, pbuf; INT numargs = -1; size_t buflen; + DWORD lerror;
wsprintfW(cmdline,fmt1,one,two,three,four); args=CommandLineToArgvW(cmdline,&numargs); @@ -2163,6 +2171,15 @@ ok(lstrcmpW(args[1],two)==0,"arg1 is not as expected\n"); ok(lstrcmpW(args[2],three)==0,"arg2 is not as expected\n"); ok(lstrcmpW(args[3],four)==0,"arg3 is not as expected\n"); + + SetLastError(0xdeadbeef); + args=CommandLineToArgvW(cmdline,NULL); + lerror=GetLastError(); + ok(args == NULL && lerror == ERROR_INVALID_PARAMETER, "expected NULL with ERROR_INVALID_PARAMETER got %p with %d\n",args,lerror); + SetLastError(0xdeadbeef); + args=CommandLineToArgvW(NULL,NULL); + lerror=GetLastError(); + ok(args == NULL && lerror == ERROR_INVALID_PARAMETER, "expected NULL with ERROR_INVALID_PARAMETER got %p with %d\n",args,lerror);
wsprintfW(cmdline,fmt2,one,two,three,four); args=CommandLineToArgvW(cmdline,&numargs);
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 May 13 18:14:09 2012 @@ -347,6 +347,7 @@ RemoveDirectoryA(".\testdir\testdir2"); RemoveDirectoryA(".\testdir"); } +
/* perform test */ static void test_EnumObjects(IShellFolder *iFolder) @@ -1805,6 +1806,7 @@ cbOffset <= pidlFile->mkid.cb - sizeof(struct FileStructW)) { struct FileStructW *pFileStructW = (struct FileStructW *)(((LPBYTE)pidlFile)+cbOffset); + WCHAR *name = pFileStructW->wszName;
ok(pidlFile->mkid.cb == cbOffset + pFileStructW->cbLen, "FileStructW's offset and length should add up to the PIDL's length!\n"); @@ -1841,9 +1843,9 @@ /* TODO: Perform check for date being within one day.*/ }
- ok (!lstrcmpW(wszFile[i], pFileStructW->wszName) || - !lstrcmpW(wszFile[i], (WCHAR *)(pFileStructW->abFooBar2 + 22)) || /* Vista */ - !lstrcmpW(wszFile[i], (WCHAR *)(pFileStructW->abFooBar2 + 26)), /* Win7 */ + ok (!lstrcmpW(wszFile[i], name) || + !lstrcmpW(wszFile[i], name + 9) || /* Vista */ + !lstrcmpW(wszFile[i], name + 11), /* Win7 */ "The filename should be stored in unicode at this position!\n"); } } @@ -3783,12 +3785,15 @@ if (!pIsWow64Process || !pIsWow64Process( GetCurrentProcess(), &is_wow64 )) is_wow64 = FALSE; if (is_wow64 && pGetSystemWow64DirectoryW) { + UINT len; *dirW = 0; - ok(GetSystemDirectoryW(dirW, MAX_PATH) > 0, "GetSystemDirectoryW failed: %u\n", GetLastError()); + len = GetSystemDirectoryW(dirW, MAX_PATH); + ok(len > 0, "GetSystemDirectoryW failed: %u\n", GetLastError()); hr = pSHParseDisplayName(dirW, NULL, &pidl1, 0, NULL); ok(hr == S_OK, "failed %08x\n", hr); *dirW = 0; - ok(pGetSystemWow64DirectoryW(dirW, MAX_PATH) > 0, "GetSystemWow64DirectoryW failed: %u\n", GetLastError()); + len = pGetSystemWow64DirectoryW(dirW, MAX_PATH); + ok(len > 0, "GetSystemWow64DirectoryW failed: %u\n", GetLastError()); hr = pSHParseDisplayName(dirW, NULL, &pidl2, 0, NULL); ok(hr == S_OK, "failed %08x\n", hr); ret = pILIsEqual(pidl1, pidl2);
Modified: trunk/rostests/winetests/shell32/systray.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/systray.... ============================================================================== --- trunk/rostests/winetests/shell32/systray.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/systray.c [iso-8859-1] Sun May 13 18:14:09 2012 @@ -17,7 +17,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #define _WIN32_IE 0x600 -#include <assert.h> #include <stdarg.h>
#include <windows.h>
Modified: trunk/rostests/winetests/shell32/testlist.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shell32/testlist... ============================================================================== --- trunk/rostests/winetests/shell32/testlist.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shell32/testlist.c [iso-8859-1] Sun May 13 18:14:09 2012 @@ -7,6 +7,7 @@ #include "wine/test.h"
extern void func_appbar(void); +extern void func_assoc(void); extern void func_autocomplete(void); extern void func_brsfolder(void); extern void func_ebrowser(void); @@ -28,6 +29,7 @@ const struct test winetest_testlist[] = { { "appbar", func_appbar }, + { "assoc", func_assoc }, { "autocomplete", func_autocomplete }, { "brsfolder", func_brsfolder }, { "ebrowser", func_ebrowser },