mirror of
https://github.com/reactos/reactos.git
synced 2025-07-29 10:12:00 +00:00
[SHELL32_WINETEST]
* Sync to Wine 1.5.4. svn path=/trunk/; revision=56576
This commit is contained in:
parent
0ee2dd3bd6
commit
0f01ebae92
10 changed files with 207 additions and 9 deletions
|
@ -7,6 +7,7 @@ add_definitions(
|
|||
|
||||
list(APPEND SOURCE
|
||||
appbar.c
|
||||
assoc.c
|
||||
autocomplete.c
|
||||
brsfolder.c
|
||||
ebrowser.c
|
||||
|
|
|
@ -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>
|
||||
|
|
108
rostests/winetests/shell32/assoc.c
Normal file
108
rostests/winetests/shell32/assoc.c
Normal file
|
@ -0,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();
|
||||
}
|
|
@ -200,7 +200,7 @@ static void test_click_make_new_folder_button(void)
|
|||
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);
|
||||
|
|
|
@ -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 @@ static void test_namespace(void)
|
|||
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 @@ START_TEST(shelldispatch)
|
|||
|
||||
init_function_pointers();
|
||||
test_namespace();
|
||||
test_service();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
||||
|
|
|
@ -859,6 +859,12 @@ if (0) { /* crashes */
|
|||
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);
|
||||
|
|
|
@ -92,7 +92,10 @@ static void strcat_param(char* str, const char* param)
|
|||
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);
|
||||
|
@ -139,6 +142,10 @@ static int shell_execute(LPCSTR operation, LPCSTR file, LPCSTR parameters, LPCST
|
|||
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 @@ static void test_commandline(void)
|
|||
LPWSTR *args = (LPWSTR*)0xdeadcafe, pbuf;
|
||||
INT numargs = -1;
|
||||
size_t buflen;
|
||||
DWORD lerror;
|
||||
|
||||
wsprintfW(cmdline,fmt1,one,two,three,four);
|
||||
args=CommandLineToArgvW(cmdline,&numargs);
|
||||
|
@ -2164,6 +2172,15 @@ static void test_commandline(void)
|
|||
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);
|
||||
ok(numargs == 5, "expected 5 args, got %i\n",numargs);
|
||||
|
|
|
@ -348,6 +348,7 @@ static void Cleanup(void)
|
|||
RemoveDirectoryA(".\\testdir");
|
||||
}
|
||||
|
||||
|
||||
/* perform test */
|
||||
static void test_EnumObjects(IShellFolder *iFolder)
|
||||
{
|
||||
|
@ -1805,6 +1806,7 @@ static void test_ITEMIDLIST_format(void) {
|
|||
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 @@ static void test_ITEMIDLIST_format(void) {
|
|||
/* 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 (0)
|
|||
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);
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 @@ extern void func_systray(void);
|
|||
const struct test winetest_testlist[] =
|
||||
{
|
||||
{ "appbar", func_appbar },
|
||||
{ "assoc", func_assoc },
|
||||
{ "autocomplete", func_autocomplete },
|
||||
{ "brsfolder", func_brsfolder },
|
||||
{ "ebrowser", func_ebrowser },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue