[SHELL32_WINETEST] Sync with Wine Staging 1.7.55. CORE-10536

svn path=/trunk/; revision=70295
This commit is contained in:
Amine Khaldi 2015-12-08 10:33:14 +00:00
parent c4a7014182
commit 3ac50badb6
13 changed files with 1113 additions and 330 deletions

View file

@ -29,6 +29,7 @@
static const CHAR testwindow_class[] = "testwindow"; static const CHAR testwindow_class[] = "testwindow";
static HMONITOR (WINAPI *pMonitorFromWindow)(HWND, DWORD); static HMONITOR (WINAPI *pMonitorFromWindow)(HWND, DWORD);
static HRESULT (WINAPI *pGetCurrentProcessExplicitAppUserModelID)(PWSTR*);
typedef BOOL (*boolean_function)(void); typedef BOOL (*boolean_function)(void);
@ -430,15 +431,39 @@ static void test_appbarget(void)
return; return;
} }
static void test_GetCurrentProcessExplicitAppUserModelID(void)
{
WCHAR *appid;
HRESULT hr;
if (!pGetCurrentProcessExplicitAppUserModelID)
{
win_skip("GetCurrentProcessExplicitAppUserModelID() is not supported.\n");
return;
}
if (0) /* crashes on native */
hr = pGetCurrentProcessExplicitAppUserModelID(NULL);
appid = (void*)0xdeadbeef;
hr = pGetCurrentProcessExplicitAppUserModelID(&appid);
todo_wine
ok(hr == E_FAIL, "got 0x%08x\n", hr);
ok(appid == NULL, "got %p\n", appid);
}
START_TEST(appbar) START_TEST(appbar)
{ {
HMODULE huser32; HMODULE huser32, hshell32;
huser32 = GetModuleHandleA("user32.dll"); huser32 = GetModuleHandleA("user32.dll");
hshell32 = GetModuleHandleA("shell32.dll");
pMonitorFromWindow = (void*)GetProcAddress(huser32, "MonitorFromWindow"); pMonitorFromWindow = (void*)GetProcAddress(huser32, "MonitorFromWindow");
pGetCurrentProcessExplicitAppUserModelID = (void*)GetProcAddress(hshell32, "GetCurrentProcessExplicitAppUserModelID");
register_testwindow_class(); register_testwindow_class();
test_setpos(); test_setpos();
test_appbarget(); test_appbarget();
test_GetCurrentProcessExplicitAppUserModelID();
} }

View file

@ -192,7 +192,7 @@ static void test_IApplicationAssociationRegistration_QueryCurrentDefault(IApplic
ok(hr == E_INVALIDARG, "got 0x%x\n", hr); ok(hr == E_INVALIDARG, "got 0x%x\n", hr);
hr = IApplicationAssociationRegistration_QueryCurrentDefault(appreg, spacetxtW, AT_FILEEXTENSION, AL_EFFECTIVE, &assocprog); hr = IApplicationAssociationRegistration_QueryCurrentDefault(appreg, spacetxtW, AT_FILEEXTENSION, AL_EFFECTIVE, &assocprog);
ok(hr == E_INVALIDARG || hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) /* Win8 */, "got 0x%x\n", hr); ok(hr == E_INVALIDARG || hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) /*Win8*/, "got 0x%x\n", hr);
hr = IApplicationAssociationRegistration_QueryCurrentDefault(appreg, httpW, AT_URLPROTOCOL, AL_EFFECTIVE, NULL); hr = IApplicationAssociationRegistration_QueryCurrentDefault(appreg, httpW, AT_URLPROTOCOL, AL_EFFECTIVE, NULL);
ok(hr == E_INVALIDARG, "got 0x%x\n", hr); ok(hr == E_INVALIDARG, "got 0x%x\n", hr);
@ -212,13 +212,14 @@ static void test_IApplicationAssociationRegistration_QueryCurrentDefault(IApplic
hr = IApplicationAssociationRegistration_QueryCurrentDefault(appreg, httpW, AT_URLPROTOCOL, AL_EFFECTIVE, &assocprog); hr = IApplicationAssociationRegistration_QueryCurrentDefault(appreg, httpW, AT_URLPROTOCOL, AL_EFFECTIVE, &assocprog);
todo_wine ok(hr == S_OK, "got 0x%x\n", hr); todo_wine ok(hr == S_OK, "got 0x%x\n", hr);
trace("%s\n", wine_dbgstr_w(assocprog)); trace("%s\n", wine_dbgstr_w(assocprog));
CoTaskMemFree(assocprog); CoTaskMemFree(assocprog);
} }
START_TEST(assoc) START_TEST(assoc)
{ {
IQueryAssociations *qa; IQueryAssociations *qa;
IApplicationAssociationRegistration *appreg; IApplicationAssociationRegistration *appreg = NULL;
HRESULT hr; HRESULT hr;
CoInitialize(NULL); CoInitialize(NULL);
@ -238,7 +239,7 @@ START_TEST(assoc)
/* this works since Vista */ /* this works since Vista */
hr = CoCreateInstance(&CLSID_ApplicationAssociationRegistration, NULL, CLSCTX_INPROC_SERVER, hr = CoCreateInstance(&CLSID_ApplicationAssociationRegistration, NULL, CLSCTX_INPROC_SERVER,
&IID_IApplicationAssociationRegistration, (LPVOID *)&appreg); &IID_IApplicationAssociationRegistration, (LPVOID*)&appreg);
if (hr == S_OK) if (hr == S_OK)
{ {
test_IApplicationAssociationRegistration_QueryInterface(appreg); test_IApplicationAssociationRegistration_QueryInterface(appreg);

View file

@ -759,8 +759,10 @@ static void test_initialization(void)
{ {
IExplorerBrowser *peb; IExplorerBrowser *peb;
IShellBrowser *psb; IShellBrowser *psb;
HWND eb_hwnd;
HRESULT hr; HRESULT hr;
ULONG lres; ULONG lres;
LONG style;
RECT rc; RECT rc;
ebrowser_instantiate(&peb); ebrowser_instantiate(&peb);
@ -807,10 +809,9 @@ static void test_initialization(void)
ok(hr == S_OK, "Got 0x%08x\n", hr); ok(hr == S_OK, "Got 0x%08x\n", hr);
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
{ {
HWND eb_hwnd;
RECT eb_rc; RECT eb_rc;
char buf[1024]; char buf[1024];
LONG style, expected_style; LONG expected_style;
static const RECT exp_rc = {0, 0, 48, 58}; static const RECT exp_rc = {0, 0, 48, 58};
hr = IShellBrowser_GetWindow(psb, &eb_hwnd); hr = IShellBrowser_GetWindow(psb, &eb_hwnd);
@ -856,6 +857,29 @@ static void test_initialization(void)
ok(lres == 0, "Got refcount %d\n", lres); ok(lres == 0, "Got refcount %d\n", lres);
} }
/* check window style with EBO_NOBORDER */
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;
hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL);
ok(hr == S_OK, "got (0x%08x)\n", hr);
hr = IExplorerBrowser_QueryInterface(peb, &IID_IShellBrowser, (void**)&psb);
ok(hr == S_OK, "Got 0x%08x\n", hr);
hr = IShellBrowser_GetWindow(psb, &eb_hwnd);
ok(hr == S_OK, "Got 0x%08x\n", hr);
style = GetWindowLongPtrW(eb_hwnd, GWL_STYLE);
ok(!(style & WS_BORDER) || broken(style & WS_BORDER) /* before win8 */, "got style 0x%08x\n", style);
IShellBrowser_Release(psb);
IExplorerBrowser_Destroy(peb);
IExplorerBrowser_Release(peb);
/* empty rectangle */
ebrowser_instantiate(&peb); ebrowser_instantiate(&peb);
rc.left = 0; rc.top = 0; rc.right = 0; rc.bottom = 0; rc.left = 0; rc.top = 0; rc.right = 0; rc.bottom = 0;
hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL); hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL);
@ -1469,7 +1493,7 @@ static void test_navigation(void)
test_browse_pidl_sb(peb2, &ebev, pidl_relative, SBSP_RELATIVE, S_OK, 1, 1, 0, 1); test_browse_pidl_sb(peb2, &ebev, pidl_relative, SBSP_RELATIVE, S_OK, 1, 1, 0, 1);
ILFree(pidl_relative); ILFree(pidl_relative);
/* IShellFolder_Release(psf); */ IShellFolder_Release(psf);
IFolderView_Release(pfv); IFolderView_Release(pfv);
} }

View file

@ -363,7 +363,7 @@ static void DdeExecuteCommand(DWORD instance, HCONV hConv, const char *strCmd, H
* window creation happened were not encouraging (not including * window creation happened were not encouraging (not including
* SetWindowsHookEx). * SetWindowsHookEx).
*/ */
static void CheckWindowCreated(const char *winName, BOOL closeWindow, int testParams) static HWND CheckWindowCreated(const char *winName, BOOL closeWindow, int testParams)
{ {
HWND window = NULL; HWND window = NULL;
int i; int i;
@ -381,7 +381,9 @@ static void CheckWindowCreated(const char *winName, BOOL closeWindow, int testPa
if (window != NULL && closeWindow) if (window != NULL && closeWindow)
{ {
SendMessageA(window, WM_SYSCOMMAND, SC_CLOSE, 0); SendMessageA(window, WM_SYSCOMMAND, SC_CLOSE, 0);
window = NULL;
} }
return window;
} }
/* Check for Existence (or non-existence) of a file or group /* Check for Existence (or non-existence) of a file or group
@ -468,11 +470,12 @@ static void CreateGroupTest(DWORD instance, HCONV hConv, const char *command, UI
* if expected_result is DMLERR_NO_ERROR, test * if expected_result is DMLERR_NO_ERROR, test
* 1. window is open * 1. window is open
*/ */
static void ShowGroupTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result, static HWND ShowGroupTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
const char *groupName, const char *windowTitle, BOOL closeAfterShowing, int testParams) const char *groupName, const char *windowTitle, BOOL closeAfterShowing, int testParams)
{ {
HDDEDATA hData; HDDEDATA hData;
UINT error; UINT error;
HWND hwnd = 0;
DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams); DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
/* todo_wine... Is expected to fail, wine stubbed functions DO fail */ /* todo_wine... Is expected to fail, wine stubbed functions DO fail */
@ -494,8 +497,9 @@ static void ShowGroupTest(DWORD instance, HCONV hConv, const char *command, UINT
if (error == DMLERR_NO_ERROR) if (error == DMLERR_NO_ERROR)
{ {
/* Check if Window is Open (polling) */ /* Check if Window is Open (polling) */
CheckWindowCreated(windowTitle, closeAfterShowing, testParams); hwnd = CheckWindowCreated(windowTitle, closeAfterShowing, testParams);
} }
return hwnd;
} }
/* Delete Group Test. /* Delete Group Test.
@ -582,12 +586,13 @@ static void DeleteItemTest(DWORD instance, HCONV hConv, const char *command, UIN
* All samples I've seen using Compound were of this form (CreateGroup, * All samples I've seen using Compound were of this form (CreateGroup,
* AddItems) so this covers minimum expected functionality. * AddItems) so this covers minimum expected functionality.
*/ */
static void CompoundCommandTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result, static HWND CompoundCommandTest(DWORD instance, HCONV hConv, const char *command, UINT expected_result,
const char *groupName, const char *windowTitle, const char *fileName1, const char *groupName, const char *windowTitle, const char *fileName1,
const char *fileName2, int testParams) const char *fileName2, int testParams)
{ {
HDDEDATA hData; HDDEDATA hData;
UINT error; UINT error;
HWND hwnd = 0;
DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams); DdeExecuteCommand(instance, hConv, command, &hData, &error, testParams);
todo_wine todo_wine
@ -601,10 +606,11 @@ static void CompoundCommandTest(DWORD instance, HCONV hConv, const char *command
{ {
/* Check that File exists */ /* Check that File exists */
CheckFileExistsInProgramGroups(groupName, TRUE, TRUE, NULL, testParams); CheckFileExistsInProgramGroups(groupName, TRUE, TRUE, NULL, testParams);
CheckWindowCreated(windowTitle, FALSE, testParams); hwnd = CheckWindowCreated(windowTitle, FALSE, testParams);
CheckFileExistsInProgramGroups(fileName1, TRUE, FALSE, groupName, testParams); CheckFileExistsInProgramGroups(fileName1, TRUE, FALSE, groupName, testParams);
CheckFileExistsInProgramGroups(fileName2, TRUE, FALSE, groupName, testParams); CheckFileExistsInProgramGroups(fileName2, TRUE, FALSE, groupName, testParams);
} }
return hwnd;
} }
static void CreateAddItemText(char *itemtext, const char *cmdline, const char *name) static void CreateAddItemText(char *itemtext, const char *cmdline, const char *name)
@ -626,6 +632,7 @@ static int DdeTestProgman(DWORD instance, HCONV hConv)
char f1g1[MAX_PATH], f2g1[MAX_PATH], f3g1[MAX_PATH], f1g3[MAX_PATH], f2g3[MAX_PATH]; char f1g1[MAX_PATH], f2g1[MAX_PATH], f3g1[MAX_PATH], f1g3[MAX_PATH], f2g3[MAX_PATH];
char itemtext[MAX_PATH + 20]; char itemtext[MAX_PATH + 20];
char comptext[2 * (MAX_PATH + 20) + 21]; char comptext[2 * (MAX_PATH + 20) + 21];
HWND hwnd;
testnum = 1; testnum = 1;
/* Invalid Command */ /* Invalid Command */
@ -658,10 +665,11 @@ static int DdeTestProgman(DWORD instance, HCONV hConv)
ShowGroupTest(instance, hConv, "[ShowGroup(Group1)]", DMLERR_NOTPROCESSED, "Group1", Group1Title, TRUE, DDE_TEST_SHOWGROUP|testnum++); ShowGroupTest(instance, hConv, "[ShowGroup(Group1)]", DMLERR_NOTPROCESSED, "Group1", Group1Title, TRUE, DDE_TEST_SHOWGROUP|testnum++);
DeleteItemTest(instance, hConv, "[DeleteItem(f3g1Name)]", DMLERR_NO_ERROR, "f3g1Name.lnk", "Group1", DDE_TEST_DELETEITEM|testnum++); DeleteItemTest(instance, hConv, "[DeleteItem(f3g1Name)]", DMLERR_NO_ERROR, "f3g1Name.lnk", "Group1", DDE_TEST_DELETEITEM|testnum++);
ShowGroupTest(instance, hConv, "[ShowGroup(Startup,0)]", DMLERR_NO_ERROR, "Startup", StartupTitle, TRUE, DDE_TEST_SHOWGROUP|testnum++); ShowGroupTest(instance, hConv, "[ShowGroup(Startup,0)]", DMLERR_NO_ERROR, "Startup", StartupTitle, TRUE, DDE_TEST_SHOWGROUP|testnum++);
ShowGroupTest(instance, hConv, "[ShowGroup(Group1,0)]", DMLERR_NO_ERROR, "Group1", Group1Title, FALSE, DDE_TEST_SHOWGROUP|testnum++); hwnd = ShowGroupTest(instance, hConv, "[ShowGroup(Group1,0)]", DMLERR_NO_ERROR, "Group1", Group1Title, FALSE, DDE_TEST_SHOWGROUP|testnum++);
/* DeleteGroup Test - Note that Window is Open for this test */ /* DeleteGroup Test - Note that Window is Open for this test */
DeleteGroupTest(instance, hConv, "[DeleteGroup(Group1)]", DMLERR_NO_ERROR, "Group1", DDE_TEST_DELETEGROUP|testnum++); DeleteGroupTest(instance, hConv, "[DeleteGroup(Group1)]", DMLERR_NO_ERROR, "Group1", DDE_TEST_DELETEGROUP|testnum++);
if (hwnd) SendMessageA(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
/* Compound Execute String Command */ /* Compound Execute String Command */
lstrcpyA(comptext, "[CreateGroup(Group3)]"); lstrcpyA(comptext, "[CreateGroup(Group3)]");
@ -669,9 +677,10 @@ static int DdeTestProgman(DWORD instance, HCONV hConv)
lstrcatA(comptext, itemtext); lstrcatA(comptext, itemtext);
CreateAddItemText(itemtext, f2g3, "f2g3Name"); CreateAddItemText(itemtext, f2g3, "f2g3Name");
lstrcatA(comptext, itemtext); lstrcatA(comptext, itemtext);
CompoundCommandTest(instance, hConv, comptext, DMLERR_NO_ERROR, "Group3", Group3Title, "f1g3Name.lnk", "f2g3Name.lnk", DDE_TEST_COMPOUND|testnum++); hwnd = CompoundCommandTest(instance, hConv, comptext, DMLERR_NO_ERROR, "Group3", Group3Title, "f1g3Name.lnk", "f2g3Name.lnk", DDE_TEST_COMPOUND|testnum++);
DeleteGroupTest(instance, hConv, "[DeleteGroup(Group3)]", DMLERR_NO_ERROR, "Group3", DDE_TEST_DELETEGROUP|testnum++); DeleteGroupTest(instance, hConv, "[DeleteGroup(Group3)]", DMLERR_NO_ERROR, "Group3", DDE_TEST_DELETEGROUP|testnum++);
if (hwnd) SendMessageA(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
/* Full Parameters of Add Item */ /* Full Parameters of Add Item */
/* AddItem(CmdLine[,Name[,IconPath[,IconIndex[,xPos,yPos[,DefDir[,HotKey[,fMinimize[fSeparateSpace]]]]]]]) */ /* AddItem(CmdLine[,Name[,IconPath[,IconIndex[,xPos,yPos[,DefDir[,HotKey[,fMinimize[fSeparateSpace]]]]]]]) */

View file

@ -363,6 +363,511 @@ static void test_service(void)
IShellDispatch2_Release(sd); IShellDispatch2_Release(sd);
} }
static void test_dispatch_typeinfo(IDispatch *disp, REFIID *riid)
{
ITypeInfo *typeinfo;
TYPEATTR *typeattr;
UINT count;
HRESULT hr;
count = 10;
hr = IDispatch_GetTypeInfoCount(disp, &count);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(count == 1, "got %u\n", count);
hr = IDispatch_GetTypeInfo(disp, 0, LOCALE_SYSTEM_DEFAULT, &typeinfo);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = ITypeInfo_GetTypeAttr(typeinfo, &typeattr);
ok(hr == S_OK, "got 0x%08x\n", hr);
while (!IsEqualGUID(*riid, &IID_NULL)) {
if (IsEqualGUID(&typeattr->guid, *riid))
break;
riid++;
}
ok(IsEqualGUID(&typeattr->guid, *riid), "unexpected type guid %s\n", wine_dbgstr_guid(&typeattr->guid));
ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr);
ITypeInfo_Release(typeinfo);
}
static void test_ShellFolderViewDual(void)
{
static const IID *shelldisp_riids[] = {
&IID_IShellDispatch6,
&IID_IShellDispatch5,
&IID_IShellDispatch4,
&IID_IShellDispatch2,
&IID_NULL
};
IShellFolderViewDual *viewdual;
IShellFolder *desktop, *tmpdir;
IShellView *view, *view2;
IDispatch *disp, *disp2;
WCHAR pathW[MAX_PATH];
LPITEMIDLIST pidl;
HRESULT hr;
/* IShellFolderViewDual is not an IShellView extension */
hr = SHGetDesktopFolder(&desktop);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IShellFolder_CreateViewObject(desktop, NULL, &IID_IShellView, (void**)&view);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IShellView_QueryInterface(view, &IID_IShellFolderViewDual, (void**)&viewdual);
ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr);
hr = IShellView_GetItemObject(view, SVGIO_BACKGROUND, &IID_IDispatch, (void**)&disp);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IShellView_GetItemObject(view, SVGIO_BACKGROUND, &IID_IDispatch, (void**)&disp2);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(disp2 == disp, "got %p, %p\n", disp2, disp);
IDispatch_Release(disp2);
hr = IDispatch_QueryInterface(disp, &IID_IShellFolderViewDual, (void**)&viewdual);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(disp == (IDispatch*)viewdual, "got %p, expected %p\n", viewdual, disp);
hr = IShellFolderViewDual_QueryInterface(viewdual, &IID_IShellView, (void**)&view2);
ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr);
/* get_Application() */
if (0) /* crashes on pre-vista */ {
hr = IShellFolderViewDual_get_Application(viewdual, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
}
hr = IShellFolderViewDual_get_Application(viewdual, &disp2);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(disp2 != (IDispatch*)viewdual, "got %p, %p\n", disp2, viewdual);
test_dispatch_typeinfo(disp2, shelldisp_riids);
IDispatch_Release(disp2);
IShellFolderViewDual_Release(viewdual);
IDispatch_Release(disp);
disp = (void*)0xdeadbeef;
hr = IShellView_GetItemObject(view, SVGIO_BACKGROUND, &IID_IShellFolderViewDual, (void**)&disp);
ok(hr == E_NOINTERFACE || broken(hr == E_NOTIMPL) /* win2k */, "got 0x%08x\n", hr);
ok(disp == NULL, "got %p\n", disp);
IShellView_Release(view);
/* Try with some other folder, that's not a desktop */
GetTempPathW(sizeof(pathW)/sizeof(pathW[0]), pathW);
hr = IShellFolder_ParseDisplayName(desktop, NULL, NULL, pathW, NULL, &pidl, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IShellFolder_BindToObject(desktop, pidl, NULL, &IID_IShellFolder, (void**)&tmpdir);
ok(hr == S_OK, "got 0x%08x\n", hr);
CoTaskMemFree(pidl);
hr = IShellFolder_CreateViewObject(desktop, NULL, &IID_IShellView, (void**)&view);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IShellView_QueryInterface(view, &IID_IShellFolderViewDual, (void**)&viewdual);
ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr);
hr = IShellView_GetItemObject(view, SVGIO_BACKGROUND, &IID_IDispatch, (void**)&disp);
ok(hr == S_OK, "got 0x%08x\n", hr);
IDispatch_Release(disp);
IShellView_Release(view);
IShellFolder_Release(tmpdir);
IShellFolder_Release(desktop);
}
static void test_ShellWindows(void)
{
IShellWindows *shellwindows;
LONG cookie, cookie2, ret;
IDispatch *disp;
VARIANT v, v2;
HRESULT hr;
HWND hwnd;
hr = CoCreateInstance(&CLSID_ShellWindows, NULL, CLSCTX_LOCAL_SERVER,
&IID_IShellWindows, (void**)&shellwindows);
ok(hr == S_OK, "got 0x%08x\n", hr);
/* TODO: remove when explorer startup with clean prefix is fixed */
if (hr != S_OK)
return;
if (0) /* NULL out argument - currently crashes on Wine */ {
hr = IShellWindows_Register(shellwindows, NULL, 0, SWC_EXPLORER, NULL);
ok(hr == HRESULT_FROM_WIN32(RPC_X_NULL_REF_POINTER), "got 0x%08x\n", hr);
}
hr = IShellWindows_Register(shellwindows, NULL, 0, SWC_EXPLORER, &cookie);
todo_wine
ok(hr == E_POINTER, "got 0x%08x\n", hr);
hr = IShellWindows_Register(shellwindows, (IDispatch*)shellwindows, 0, SWC_EXPLORER, &cookie);
todo_wine
ok(hr == E_POINTER, "got 0x%08x\n", hr);
hr = IShellWindows_Register(shellwindows, (IDispatch*)shellwindows, 0, SWC_EXPLORER, &cookie);
todo_wine
ok(hr == E_POINTER, "got 0x%08x\n", hr);
hwnd = CreateWindowExA(0, "button", "test", BS_CHECKBOX | WS_VISIBLE | WS_POPUP,
0, 0, 50, 14, 0, 0, 0, NULL);
ok(hwnd != NULL, "got %p, error %d\n", hwnd, GetLastError());
cookie = 0;
hr = IShellWindows_Register(shellwindows, NULL, HandleToLong(hwnd), SWC_EXPLORER, &cookie);
todo_wine {
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(cookie != 0, "got %d\n", cookie);
}
cookie2 = 0;
hr = IShellWindows_Register(shellwindows, NULL, HandleToLong(hwnd), SWC_EXPLORER, &cookie2);
todo_wine {
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(cookie2 != 0 && cookie2 != cookie, "got %d\n", cookie2);
}
hr = IShellWindows_Revoke(shellwindows, cookie);
todo_wine
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IShellWindows_Revoke(shellwindows, cookie2);
todo_wine
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IShellWindows_Revoke(shellwindows, 0);
todo_wine
ok(hr == S_FALSE, "got 0x%08x\n", hr);
/* we can register ourselves as desktop, but FindWindowSW still returns real desktop window */
cookie = 0;
hr = IShellWindows_Register(shellwindows, NULL, HandleToLong(hwnd), SWC_DESKTOP, &cookie);
todo_wine {
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(cookie != 0, "got %d\n", cookie);
}
disp = (void*)0xdeadbeef;
ret = 0xdead;
VariantInit(&v);
hr = IShellWindows_FindWindowSW(shellwindows, &v, &v, SWC_DESKTOP, &ret, SWFO_NEEDDISPATCH, &disp);
ok(hr == S_OK || broken(hr == S_FALSE), "got 0x%08x\n", hr);
if (hr == S_FALSE) /* winxp and earlier */ {
win_skip("SWC_DESKTOP is not supported, some tests will be skipped.\n");
/* older versions allowed to regiser SWC_DESKTOP and access it with FindWindowSW */
ok(disp == NULL, "got %p\n", disp);
ok(ret == 0, "got %d\n", ret);
}
else {
static const IID *browser_riids[] = {
&IID_IWebBrowser2,
&IID_NULL
};
static const IID *viewdual_riids[] = {
&IID_IShellFolderViewDual3,
&IID_NULL
};
IShellFolderViewDual *view;
IShellBrowser *sb, *sb2;
IServiceProvider *sp;
IDispatch *doc, *app;
IWebBrowser2 *wb;
IShellView *sv;
IUnknown *unk;
ok(disp != NULL, "got %p\n", disp);
ok(ret != HandleToUlong(hwnd), "got %d\n", ret);
/* IDispatch-related tests */
test_dispatch_typeinfo(disp, browser_riids);
/* IWebBrowser2 */
hr = IDispatch_QueryInterface(disp, &IID_IWebBrowser2, (void**)&wb);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IWebBrowser2_Refresh(wb);
todo_wine
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IWebBrowser2_get_Application(wb, &app);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(disp == app, "got %p, %p\n", app, disp);
IDispatch_Release(app);
hr = IWebBrowser2_get_Document(wb, &doc);
todo_wine
ok(hr == S_OK, "got 0x%08x\n", hr);
if (hr == S_OK)
test_dispatch_typeinfo(doc, viewdual_riids);
IWebBrowser2_Release(wb);
/* IServiceProvider */
hr = IDispatch_QueryInterface(disp, &IID_IShellFolderViewDual, (void**)&view);
ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr);
hr = IDispatch_QueryInterface(disp, &IID_IServiceProvider, (void**)&sp);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IServiceProvider_QueryService(sp, &SID_STopLevelBrowser, &IID_IShellBrowser, (void**)&sb);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IServiceProvider_QueryService(sp, &SID_STopLevelBrowser, &IID_IShellBrowser, (void**)&sb2);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(sb == sb2, "got %p, %p\n", sb, sb2);
hr = IServiceProvider_QueryService(sp, &SID_STopLevelBrowser, &IID_IOleWindow, (void**)&unk);
ok(hr == S_OK, "got 0x%08x\n", hr);
IUnknown_Release(unk);
hr = IServiceProvider_QueryService(sp, &SID_STopLevelBrowser, &IID_IExplorerBrowser, (void**)&unk);
ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr);
hr = IShellBrowser_QueryInterface(sb, &IID_IExplorerBrowser, (void**)&unk);
ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr);
hr = IShellBrowser_QueryInterface(sb, &IID_IWebBrowser2, (void**)&unk);
ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr);
hr = IShellBrowser_QueryInterface(sb, &IID_IDispatch, (void**)&unk);
ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr);
hr = IShellBrowser_QueryActiveShellView(sb, &sv);
ok(hr == S_OK, "got 0x%08x\n", hr);
IShellView_Release(sv);
IShellBrowser_Release(sb2);
IShellBrowser_Release(sb);
hr = IServiceProvider_QueryService(sp, &SID_STopLevelBrowser, &IID_IUnknown, (void**)&unk);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IUnknown_QueryInterface(unk, &IID_IShellBrowser, (void**)&sb2);
ok(hr == S_OK, "got 0x%08x\n", hr);
IShellBrowser_Release(sb2);
IUnknown_Release(unk);
hr = IServiceProvider_QueryService(sp, &SID_STopLevelBrowser, &IID_IShellView, (void**)&sv);
ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr);
IServiceProvider_Release(sp);
IDispatch_Release(disp);
}
disp = (void*)0xdeadbeef;
ret = 0xdead;
VariantInit(&v);
hr = IShellWindows_FindWindowSW(shellwindows, &v, &v, SWC_DESKTOP, &ret, 0, &disp);
ok(hr == S_OK || broken(hr == S_FALSE) /* winxp */, "got 0x%08x\n", hr);
ok(disp == NULL, "got %p\n", disp);
ok(ret != HandleToUlong(hwnd), "got %d\n", ret);
disp = (void*)0xdeadbeef;
ret = 0xdead;
V_VT(&v) = VT_I4;
V_I4(&v) = cookie;
VariantInit(&v2);
hr = IShellWindows_FindWindowSW(shellwindows, &v, &v2, SWC_BROWSER, &ret, SWFO_COOKIEPASSED, &disp);
todo_wine
ok(hr == S_FALSE, "got 0x%08x\n", hr);
ok(disp == NULL, "got %p\n", disp);
ok(ret == 0, "got %d\n", ret);
hr = IShellWindows_Revoke(shellwindows, cookie);
todo_wine
ok(hr == S_OK, "got 0x%08x\n", hr);
DestroyWindow(hwnd);
IShellWindows_Release(shellwindows);
}
static void test_ParseName(void)
{
static const WCHAR cadabraW[] = {'c','a','d','a','b','r','a',0};
WCHAR pathW[MAX_PATH];
IShellDispatch *sd;
FolderItem *item;
Folder *folder;
HRESULT hr;
VARIANT v;
BSTR str;
hr = CoCreateInstance(&CLSID_Shell, NULL, CLSCTX_INPROC_SERVER,
&IID_IShellDispatch, (void**)&sd);
ok(hr == S_OK, "got 0x%08x\n", hr);
GetTempPathW(sizeof(pathW)/sizeof(pathW[0]), pathW);
V_VT(&v) = VT_BSTR;
V_BSTR(&v) = SysAllocString(pathW);
hr = IShellDispatch_NameSpace(sd, v, &folder);
ok(hr == S_OK, "got 0x%08x\n", hr);
VariantClear(&v);
item = (void*)0xdeadbeef;
hr = Folder_ParseName(folder, NULL, &item);
ok(hr == S_FALSE || broken(hr == E_INVALIDARG) /* win2k */, "got 0x%08x\n", hr);
ok(item == NULL, "got %p\n", item);
/* empty name */
str = SysAllocStringLen(NULL, 0);
item = (void*)0xdeadbeef;
hr = Folder_ParseName(folder, str, &item);
ok(hr == S_FALSE || broken(hr == E_INVALIDARG) /* win2k */, "got 0x%08x\n", hr);
ok(item == NULL, "got %p\n", item);
SysFreeString(str);
/* path doesn't exist */
str = SysAllocString(cadabraW);
item = (void*)0xdeadbeef;
hr = Folder_ParseName(folder, str, &item);
ok(hr == S_FALSE || broken(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) /* win2k */,
"got 0x%08x\n", hr);
ok(item == NULL, "got %p\n", item);
SysFreeString(str);
lstrcatW(pathW, cadabraW);
CreateDirectoryW(pathW, NULL);
str = SysAllocString(cadabraW);
item = NULL;
hr = Folder_ParseName(folder, str, &item);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(item != NULL, "got %p\n", item);
SysFreeString(str);
hr = FolderItem_get_Path(item, &str);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(str[0] != 0, "path %s\n", wine_dbgstr_w(str));
SysFreeString(str);
RemoveDirectoryW(pathW);
FolderItem_Release(item);
Folder_Release(folder);
IShellDispatch_Release(sd);
}
static void test_Verbs(void)
{
FolderItemVerbs *verbs;
WCHAR pathW[MAX_PATH];
FolderItemVerb *verb;
IShellDispatch *sd;
FolderItem *item;
Folder2 *folder2;
Folder *folder;
HRESULT hr;
LONG count, i;
VARIANT v;
BSTR str;
hr = CoCreateInstance(&CLSID_Shell, NULL, CLSCTX_INPROC_SERVER,
&IID_IShellDispatch, (void**)&sd);
ok(hr == S_OK, "got 0x%08x\n", hr);
GetTempPathW(sizeof(pathW)/sizeof(pathW[0]), pathW);
V_VT(&v) = VT_BSTR;
V_BSTR(&v) = SysAllocString(pathW);
hr = IShellDispatch_NameSpace(sd, v, &folder);
ok(hr == S_OK, "got 0x%08x\n", hr);
VariantClear(&v);
hr = Folder_QueryInterface(folder, &IID_Folder2, (void**)&folder2);
ok(hr == S_OK, "got 0x%08x\n", hr);
Folder_Release(folder);
hr = Folder2_get_Self(folder2, &item);
ok(hr == S_OK, "got 0x%08x\n", hr);
Folder2_Release(folder2);
if (0) { /* crashes on some systems */
hr = FolderItem_Verbs(item, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
}
hr = FolderItem_Verbs(item, &verbs);
ok(hr == S_OK, "got 0x%08x\n", hr);
if (0) { /* crashes on winxp/win2k3 */
hr = FolderItemVerbs_get_Count(verbs, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
}
count = 0;
hr = FolderItemVerbs_get_Count(verbs, &count);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(count > 0, "got count %d\n", count);
if (0) { /* crashes on winxp/win2k3 */
V_VT(&v) = VT_I4;
V_I4(&v) = 0;
hr = FolderItemVerbs_Item(verbs, v, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
}
/* there's always one item more, so you can access [0,count],
instead of actual [0,count) */
for (i = 0; i <= count; i++) {
V_VT(&v) = VT_I4;
V_I4(&v) = i;
hr = FolderItemVerbs_Item(verbs, v, &verb);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = FolderItemVerb_get_Name(verb, &str);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(str != NULL, "%d: name %s\n", i, wine_dbgstr_w(str));
if (i == count)
ok(str[0] == 0, "%d: got teminating item %s\n", i, wine_dbgstr_w(str));
SysFreeString(str);
FolderItemVerb_Release(verb);
}
V_VT(&v) = VT_I4;
V_I4(&v) = count+1;
verb = NULL;
hr = FolderItemVerbs_Item(verbs, v, &verb);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(verb == NULL, "got %p\n", verb);
FolderItemVerbs_Release(verbs);
FolderItem_Release(item);
IShellDispatch_Release(sd);
}
static void test_ShellExecute(void)
{
HRESULT hr;
IShellDispatch2 *sd;
BSTR name;
VARIANT args, dir, op, show;
static const WCHAR regW[] = {'r','e','g',0};
hr = CoCreateInstance(&CLSID_Shell, NULL, CLSCTX_INPROC_SERVER,
&IID_IShellDispatch2, (void**)&sd);
if (hr != S_OK)
{
win_skip("IShellDispatch2 not supported\n");
return;
}
VariantInit(&args);
VariantInit(&dir);
VariantInit(&op);
VariantInit(&show);
V_VT(&show) = VT_I4;
V_I4(&show) = 0;
name = SysAllocString(regW);
hr = IShellDispatch2_ShellExecute(sd, name, args, dir, op, show);
ok(hr == S_OK, "ShellExecute failed: %08x\n", hr);
/* test invalid value for show */
V_VT(&show) = VT_BSTR;
V_BSTR(&show) = name;
hr = IShellDispatch2_ShellExecute(sd, name, args, dir, op, show);
ok(hr == S_OK, "ShellExecute failed: %08x\n", hr);
SysFreeString(name);
}
START_TEST(shelldispatch) START_TEST(shelldispatch)
{ {
HRESULT r; HRESULT r;
@ -376,5 +881,17 @@ START_TEST(shelldispatch)
test_namespace(); test_namespace();
test_service(); test_service();
if (!winetest_interactive)
skip("ROSTESTS-209: Skipping test_ShellFolderViewDual(), test_ShellWindows(), test_ParseName() and test_Verbs().\n");
else
{
test_ShellFolderViewDual();
test_ShellWindows();
test_ParseName();
test_Verbs();
}
test_ShellExecute();
CoUninitialize(); CoUninitialize();
} }

View file

@ -993,7 +993,6 @@ static void test_SHGetStockIconInfo(void)
{ {
BYTE buffer[sizeof(SHSTOCKICONINFO) + 16]; BYTE buffer[sizeof(SHSTOCKICONINFO) + 16];
SHSTOCKICONINFO *sii = (SHSTOCKICONINFO *) buffer; SHSTOCKICONINFO *sii = (SHSTOCKICONINFO *) buffer;
BOOL atleast_win7;
HRESULT hr; HRESULT hr;
INT i; INT i;
@ -1007,11 +1006,11 @@ static void test_SHGetStockIconInfo(void)
/* negative values are handled */ /* negative values are handled */
memset(buffer, '#', sizeof(buffer)); memset(buffer, '#', sizeof(buffer));
sii->cbSize = sizeof(SHSTOCKICONINFO); sii->cbSize = sizeof(SHSTOCKICONINFO);
hr = pSHGetStockIconInfo(-1, SHGSI_ICONLOCATION, sii); hr = pSHGetStockIconInfo(SIID_INVALID, SHGSI_ICONLOCATION, sii);
ok(hr == E_INVALIDARG, "-1: got 0x%x (expected E_INVALIDARG)\n", hr); 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) */ /* max. id for vista is 140 (no definition exists for this value) */
for (i = 0; i <= 140; i++) for (i = SIID_DOCNOASSOC; i <= SIID_CLUSTEREDDRIVE; i++)
{ {
memset(buffer, '#', sizeof(buffer)); memset(buffer, '#', sizeof(buffer));
sii->cbSize = sizeof(SHSTOCKICONINFO); sii->cbSize = sizeof(SHSTOCKICONINFO);
@ -1026,38 +1025,17 @@ static void test_SHGetStockIconInfo(void)
sii->iIcon, wine_dbgstr_w(sii->szPath)); sii->iIcon, wine_dbgstr_w(sii->szPath));
} }
/* there are more icons since win7 */ /* test invalid icons indices that are invalid for all platforms */
memset(buffer, '#', sizeof(buffer)); for (i = SIID_MAX_ICONS; i < (SIID_MAX_ICONS + 25) ; i++)
sii->cbSize = sizeof(SHSTOCKICONINFO);
hr = pSHGetStockIconInfo(i, SHGSI_ICONLOCATION, sii);
atleast_win7 = (!hr);
for (; i < (SIID_MAX_ICONS + 25) ; i++)
{ {
memset(buffer, '#', sizeof(buffer)); memset(buffer, '#', sizeof(buffer));
sii->cbSize = sizeof(SHSTOCKICONINFO); sii->cbSize = sizeof(SHSTOCKICONINFO);
hr = pSHGetStockIconInfo(i, SHGSI_ICONLOCATION, sii); 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); ok(hr == E_INVALIDARG, "%3d: got 0x%x (expected E_INVALIDARG)\n", i, hr);
todo_wine {
ok(sii->iSysImageIndex == -1, "%d: got iSysImageIndex %d\n", i, sii->iSysImageIndex);
ok(sii->iIcon == -1, "%d: got iIcon %d\n", i, sii->iIcon);
}
} }
/* test more returned SHSTOCKICONINFO elements without extra flags */ /* test more returned SHSTOCKICONINFO elements without extra flags */

View file

@ -742,10 +742,126 @@ static void test_SHCreateQueryCancelAutoPlayMoniker(void)
IMoniker_Release(mon); IMoniker_Release(mon);
} }
#define DROPTEST_FILENAME "c:\\wintest.bin"
struct DragParam {
HWND hwnd;
HANDLE ready;
};
static LRESULT WINAPI drop_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
switch (msg) {
case WM_DROPFILES:
{
HDROP hDrop = (HDROP)wparam;
char filename[MAX_PATH] = "dummy";
UINT num;
num = DragQueryFileA(hDrop, 0xffffffff, NULL, 0);
ok(num == 1, "expected 1, got %u\n", num);
num = DragQueryFileA(hDrop, 0xffffffff, (char*)0xdeadbeef, 0xffffffff);
ok(num == 1, "expected 1, got %u\n", num);
num = DragQueryFileA(hDrop, 0, filename, sizeof(filename));
ok(num == strlen(DROPTEST_FILENAME), "got %u\n", num);
ok(!strcmp(filename, DROPTEST_FILENAME), "got %s\n", filename);
DragFinish(hDrop);
return 0;
}
}
return DefWindowProcA(hwnd, msg, wparam, lparam);
}
static DWORD WINAPI drop_window_therad(void *arg)
{
struct DragParam *param = arg;
WNDCLASSA cls;
WINDOWINFO info;
BOOL r;
MSG msg;
memset(&cls, 0, sizeof(cls));
cls.lpfnWndProc = drop_window_proc;
cls.hInstance = GetModuleHandleA(NULL);
cls.lpszClassName = "drop test";
RegisterClassA(&cls);
param->hwnd = CreateWindowA("drop test", NULL, 0, 0, 0, 0, 0,
NULL, 0, NULL, 0);
ok(param->hwnd != NULL, "CreateWindow failed: %d\n", GetLastError());
memset(&info, 0, sizeof(info));
info.cbSize = sizeof(info);
r = GetWindowInfo(param->hwnd, &info);
ok(r, "got %d\n", r);
ok(!(info.dwExStyle & WS_EX_ACCEPTFILES), "got %08x\n", info.dwExStyle);
DragAcceptFiles(param->hwnd, TRUE);
memset(&info, 0, sizeof(info));
info.cbSize = sizeof(info);
r = GetWindowInfo(param->hwnd, &info);
ok(r, "got %d\n", r);
ok((info.dwExStyle & WS_EX_ACCEPTFILES), "got %08x\n", info.dwExStyle);
SetEvent(param->ready);
while ((r = GetMessageA(&msg, NULL, 0, 0)) != 0) {
if (r == (BOOL)-1) {
ok(0, "unexpected return value, got %d\n", r);
break;
}
DispatchMessageA(&msg);
}
DestroyWindow(param->hwnd);
UnregisterClassA("drop test", GetModuleHandleA(NULL));
return 0;
}
static void test_DragQueryFile(void)
{
struct DragParam param;
HANDLE hThread;
DWORD rc;
HGLOBAL hDrop;
DROPFILES *pDrop;
int ret;
BOOL r;
param.ready = CreateEventA(NULL, FALSE, FALSE, NULL);
ok(param.ready != NULL, "can't create event\n");
hThread = CreateThread(NULL, 0, drop_window_therad, &param, 0, NULL);
rc = WaitForSingleObject(param.ready, 5000);
ok(rc == WAIT_OBJECT_0, "got %u\n", rc);
hDrop = GlobalAlloc(GHND, sizeof(DROPFILES) + (strlen(DROPTEST_FILENAME) + 2) * sizeof(WCHAR));
pDrop = GlobalLock(hDrop);
pDrop->pFiles = sizeof(DROPFILES);
ret = MultiByteToWideChar(CP_ACP, 0, DROPTEST_FILENAME, -1,
(LPWSTR)(pDrop + 1), strlen(DROPTEST_FILENAME) + 1);
ok(ret > 0, "got %d\n", ret);
pDrop->fWide = TRUE;
GlobalUnlock(hDrop);
r = PostMessageA(param.hwnd, WM_DROPFILES, (WPARAM)hDrop, 0);
ok(r, "got %d\n", r);
r = PostMessageA(param.hwnd, WM_QUIT, 0, 0);
ok(r, "got %d\n", r);
rc = WaitForSingleObject(hThread, 5000);
ok(rc == WAIT_OBJECT_0, "got %d\n", rc);
CloseHandle(param.ready);
CloseHandle(hThread);
}
#undef DROPTEST_FILENAME
START_TEST(shellole) START_TEST(shellole)
{ {
init(); init();
test_SHPropStg_functions(); test_SHPropStg_functions();
test_SHCreateQueryCancelAutoPlayMoniker(); test_SHCreateQueryCancelAutoPlayMoniker();
test_DragQueryFile();
} }

File diff suppressed because it is too large Load diff

View file

@ -127,6 +127,8 @@ static INT_PTR shell_execute(LPCSTR verb, LPCSTR file, LPCSTR parameters, LPCSTR
if (wait_rc == WAIT_TIMEOUT) if (wait_rc == WAIT_TIMEOUT)
{ {
HWND wnd = FindWindowA("#32770", "Windows"); HWND wnd = FindWindowA("#32770", "Windows");
if (!wnd)
wnd = FindWindowA("Shell_Flyout", "");
if (wnd != NULL) if (wnd != NULL)
{ {
SendMessageA(wnd, WM_CLOSE, 0, 0); SendMessageA(wnd, WM_CLOSE, 0, 0);
@ -857,7 +859,6 @@ static const char* testfiles[]=
"%s\\masked", "%s\\masked",
"%s\\test file.sde", "%s\\test file.sde",
"%s\\test file.exe", "%s\\test file.exe",
"%s\\test file two.exe",
"%s\\test2.exe", "%s\\test2.exe",
"%s\\simple.shlexec", "%s\\simple.shlexec",
"%s\\drawback_file.noassoc", "%s\\drawback_file.noassoc",
@ -901,9 +902,11 @@ static filename_tests_t filename_tests[]=
{"QuotedUpperL", "%s\\test file.shlexec", 0x0, 33}, {"QuotedUpperL", "%s\\test file.shlexec", 0x0, 33},
/* Test file masked due to space */ /* Test file masked due to space */
{NULL, "%s\\masked file.shlexec", 0x1, 33}, {NULL, "%s\\masked file.shlexec", 0x0, 33},
/* Test if quoting prevents the masking */ /* Test if quoting prevents the masking */
{NULL, "%s\\masked file.shlexec", 0x40, 33}, {NULL, "%s\\masked file.shlexec", 0x40, 33},
/* Test with incorrect quote */
{NULL, "\"%s\\masked file.shlexec", 0x0, SE_ERR_FNF},
{NULL, NULL, 0} {NULL, NULL, 0}
}; };
@ -1220,7 +1223,7 @@ static void test_commandline2argv(void)
*strW = 0; *strW = 0;
args = CommandLineToArgvW(strW, &numargs); args = CommandLineToArgvW(strW, &numargs);
ok(numargs == 1, "expected 1 args, got %d\n", numargs); ok(numargs == 1 || broken(numargs > 1), "expected 1 args, got %d\n", numargs);
ok(!args || (!args[numargs] || broken(args[numargs] != NULL) /* before Vista */), ok(!args || (!args[numargs] || broken(args[numargs] != NULL) /* before Vista */),
"expected NULL-terminated list of commandline arguments\n"); "expected NULL-terminated list of commandline arguments\n");
if (numargs == 1) if (numargs == 1)
@ -1541,18 +1544,10 @@ static void test_filename(void)
} }
if (rc > 32) if (rc > 32)
rc=33; rc=33;
if ((test->todo & 0x1)==0)
{
ok(rc==test->rc || ok(rc==test->rc ||
broken(quotedfile && rc == SE_ERR_FNF), /* NT4 */ broken(quotedfile && rc == SE_ERR_FNF), /* NT4 */
"%s failed: rc=%ld err=%u\n", shell_call, "%s failed: rc=%ld err=%u\n", shell_call,
rc, GetLastError()); rc, GetLastError());
}
else
{
ok(rc==test->rc, "%s failed: rc=%ld err=%u\n", shell_call,
rc, GetLastError());
}
if (rc == 33) if (rc == 33)
{ {
const char* verb; const char* verb;
@ -2095,7 +2090,6 @@ static void test_exes(void)
{ {
char filename[MAX_PATH]; char filename[MAX_PATH];
char params[1024]; char params[1024];
DWORD retval;
INT_PTR rc; INT_PTR rc;
sprintf(params, "shlexec \"%s\" Exec", child_file); sprintf(params, "shlexec \"%s\" Exec", child_file);
@ -2123,31 +2117,14 @@ static void test_exes(void)
win_skip("Skipping shellexecute of file with unassociated extension\n"); win_skip("Skipping shellexecute of file with unassociated extension\n");
} }
/* the directory with the test programs contain "test file.exe" /* test combining executable and parameters */
* and "test file two.exe". Check we do not start the first sprintf(filename, "%s shlexec \"%s\" Exec", argv0, child_file);
* when we specify to start the second (see bug 19666) rc = shell_execute(NULL, filename, NULL, NULL);
*/ ok(rc == SE_ERR_FNF, "%s returned %lu\n", shell_call, rc);
sprintf(filename, "%s\\test file.exe", tmpdir);
retval = CopyFileA(argv0, filename, FALSE);
ok(retval, "CopyFile(\"%s\",\"%s\",FALSE) failed\n", argv0, filename);
sprintf(filename, "%s\\test file two.exe", tmpdir);
retval = CopyFileA(argv0, filename, FALSE);
ok(retval, "CopyFile(\"%s\",\"%s\",FALSE) failed\n", argv0, filename);
rc=shell_execute_ex(SEE_MASK_NOZONECHECKS, NULL, filename, params, NULL, NULL);
ok(rc > 32, "%s returned %lu\n", shell_call, rc);
okChildInt("argcA", 4);
okChildString("argvA0", filename);
okChildString("argvA3", "Exec");
/* check quoted filename */ sprintf(filename, "\"%s\" shlexec \"%s\" Exec", argv0, child_file);
sprintf(filename, "\"%s\\test file two.exe\"", tmpdir); rc = shell_execute(NULL, filename, NULL, NULL);
rc=shell_execute_ex(SEE_MASK_NOZONECHECKS, NULL, filename, params, NULL, NULL); ok(rc == SE_ERR_FNF, "%s returned %lu\n", shell_call, rc);
ok(rc > 32, "%s returned %lu\n", shell_call, rc);
okChildInt("argcA", 4);
/* strip the quotes for the compare */
sprintf(filename, "%s\\test file two.exe", tmpdir);
okChildString("argvA0", filename);
okChildString("argvA3", "Exec");
} }
typedef struct typedef struct
@ -2551,6 +2528,11 @@ static void init_test(void)
"unable to find argv0!\n"); "unable to find argv0!\n");
} }
/* Older versions (win 2k) fail tests if there is a space in
the path. */
if (dllver.dwMajorVersion <= 5)
strcpy(filename, "c:\\");
else
GetTempPathA(sizeof(filename), filename); GetTempPathA(sizeof(filename), filename);
GetTempFileNameA(filename, "wt", 0, tmpdir); GetTempFileNameA(filename, "wt", 0, tmpdir);
GetLongPathNameA(tmpdir, tmpdir, sizeof(tmpdir)); GetLongPathNameA(tmpdir, tmpdir, sizeof(tmpdir));

View file

@ -164,6 +164,9 @@ static void clean_after_shfo_tests(void)
DeleteFileA("test4.txt\\test1.txt"); DeleteFileA("test4.txt\\test1.txt");
DeleteFileA("test4.txt\\test2.txt"); DeleteFileA("test4.txt\\test2.txt");
DeleteFileA("test4.txt\\test3.txt"); DeleteFileA("test4.txt\\test3.txt");
DeleteFileA("test4.txt\\one.txt");
DeleteFileA("test4.txt\\nested\\two.txt");
RemoveDirectoryA("test4.txt\\nested");
RemoveDirectoryA("test4.txt"); RemoveDirectoryA("test4.txt");
DeleteFileA("testdir2\\one.txt"); DeleteFileA("testdir2\\one.txt");
DeleteFileA("testdir2\\test1.txt"); DeleteFileA("testdir2\\test1.txt");
@ -1826,6 +1829,48 @@ static void test_move(void)
CHAR to[5*MAX_PATH]; CHAR to[5*MAX_PATH];
DWORD retval; DWORD retval;
clean_after_shfo_tests();
init_shfo_tests();
shfo.hwnd = NULL;
shfo.wFunc = FO_MOVE;
shfo.pFrom = from;
shfo.pTo = to;
shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR;
shfo.hNameMappings = NULL;
shfo.lpszProgressTitle = NULL;
shfo.fAnyOperationsAborted = FALSE;
set_curr_dir_path(from, "testdir2\\*.*\0");
set_curr_dir_path(to, "test4.txt\\*.*\0");
retval = SHFileOperationA(&shfo);
ok(retval != 0, "SHFileOperation should fail\n");
ok(!shfo.fAnyOperationsAborted, "fAnyOperationsAborted %d\n", shfo.fAnyOperationsAborted);
ok(file_exists("testdir2"), "dir should not be moved\n");
ok(file_exists("testdir2\\one.txt"), "file should not be moved\n");
ok(file_exists("testdir2\\nested"), "dir should not be moved\n");
ok(file_exists("testdir2\\nested\\two.txt"), "file should not be moved\n");
set_curr_dir_path(from, "testdir2\\*.*\0");
set_curr_dir_path(to, "test4.txt\0");
retval = SHFileOperationA(&shfo);
ok(!retval, "SHFileOperation error %#x\n", retval);
ok(!shfo.fAnyOperationsAborted, "fAnyOperationsAborted %d\n", shfo.fAnyOperationsAborted);
ok(file_exists("testdir2"), "dir should not be moved\n");
ok(!file_exists("testdir2\\one.txt"), "file should be moved\n");
ok(!file_exists("testdir2\\nested"), "dir should be moved\n");
ok(!file_exists("testdir2\\nested\\two.txt"), "file should be moved\n");
ok(file_exists("test4.txt"), "dir should exist\n");
ok(file_exists("test4.txt\\one.txt"), "file should exist\n");
ok(file_exists("test4.txt\\nested"), "dir should exist\n");
ok(file_exists("test4.txt\\nested\\two.txt"), "file should exist\n");
clean_after_shfo_tests();
init_shfo_tests();
shfo.hwnd = NULL; shfo.hwnd = NULL;
shfo.wFunc = FO_MOVE; shfo.wFunc = FO_MOVE;
shfo.pFrom = from; shfo.pFrom = from;
@ -2160,13 +2205,13 @@ static void test_move(void)
ok(!DeleteFileA("d.txt"), "Expected d.txt to not exist\n"); ok(!DeleteFileA("d.txt"), "Expected d.txt to not exist\n");
} }
/* FO_MOVE does not create dest directories */ /* FO_MOVE should create dest directories */
shfo.pFrom = "test2.txt\0"; shfo.pFrom = "test2.txt\0";
shfo.pTo = "dir1\\dir2\\test2.txt\0"; shfo.pTo = "dir1\\dir2\\test2.txt\0";
retval = SHFileOperationA(&shfo); retval = SHFileOperationA(&shfo);
if (dir_exists("dir1")) if (dir_exists("dir1"))
{ {
/* Vista and W2K8 (broken or new behavior ?) */ /* New behavior on Vista or later */
ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval); ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval);
ok(DeleteFileA("dir1\\dir2\\test2.txt"), "Expected dir1\\dir2\\test2.txt to exist\n"); ok(DeleteFileA("dir1\\dir2\\test2.txt"), "Expected dir1\\dir2\\test2.txt to exist\n");
RemoveDirectoryA("dir1\\dir2"); RemoveDirectoryA("dir1\\dir2");
@ -2429,7 +2474,7 @@ static void test_unicode(void)
shfoW.hwnd = NULL; shfoW.hwnd = NULL;
shfoW.wFunc = FO_DELETE; shfoW.wFunc = FO_DELETE;
shfoW.pFrom = UNICODE_PATH; shfoW.pFrom = UNICODE_PATH;
shfoW.pTo = '\0'; shfoW.pTo = NULL;
shfoW.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI; shfoW.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
shfoW.hNameMappings = NULL; shfoW.hNameMappings = NULL;
shfoW.lpszProgressTitle = NULL; shfoW.lpszProgressTitle = NULL;

View file

@ -75,6 +75,7 @@ static UINT (WINAPI *pGetSystemWow64DirectoryW)(LPWSTR, UINT);
static HRESULT (WINAPI *pSHCreateDefaultContextMenu)(const DEFCONTEXTMENU*,REFIID,void**); static HRESULT (WINAPI *pSHCreateDefaultContextMenu)(const DEFCONTEXTMENU*,REFIID,void**);
static HRESULT (WINAPI *pSHCreateShellFolderView)(const SFV_CREATE *pcsfv, IShellView **ppsv); static HRESULT (WINAPI *pSHCreateShellFolderView)(const SFV_CREATE *pcsfv, IShellView **ppsv);
static HRESULT (WINAPI *pSHCreateShellFolderViewEx)(LPCSFV psvcbi, IShellView **ppv); static HRESULT (WINAPI *pSHCreateShellFolderViewEx)(LPCSFV psvcbi, IShellView **ppv);
static HRESULT (WINAPI *pSHILCreateFromPath)(LPCWSTR, LPITEMIDLIST *,DWORD*);
static WCHAR *make_wstr(const char *str) static WCHAR *make_wstr(const char *str)
{ {
@ -140,6 +141,7 @@ static void init_function_pointers(void)
MAKEFUNC_ORD(ILFindLastID, 16); MAKEFUNC_ORD(ILFindLastID, 16);
MAKEFUNC_ORD(ILIsEqual, 21); MAKEFUNC_ORD(ILIsEqual, 21);
MAKEFUNC_ORD(ILCombine, 25); MAKEFUNC_ORD(ILCombine, 25);
MAKEFUNC_ORD(SHILCreateFromPath, 28);
MAKEFUNC_ORD(ILFree, 155); MAKEFUNC_ORD(ILFree, 155);
MAKEFUNC_ORD(SHSimpleIDListFromPathAW, 162); MAKEFUNC_ORD(SHSimpleIDListFromPathAW, 162);
#undef MAKEFUNC_ORD #undef MAKEFUNC_ORD
@ -4235,12 +4237,34 @@ static void test_ShellItemArrayGetAttributes(void)
Cleanup(); Cleanup();
} }
static WCHAR *get_empty_cddrive(void)
{
static WCHAR cdrom_drive[] = {'A',':','\\',0};
DWORD drives = GetLogicalDrives();
cdrom_drive[0] = 'A';
while (drives)
{
if ((drives & 1) &&
GetDriveTypeW(cdrom_drive) == DRIVE_CDROM &&
GetFileAttributesW(cdrom_drive) == INVALID_FILE_ATTRIBUTES)
{
return cdrom_drive;
}
drives = drives >> 1;
cdrom_drive[0]++;
}
return NULL;
}
static void test_SHParseDisplayName(void) static void test_SHParseDisplayName(void)
{ {
LPITEMIDLIST pidl1, pidl2; LPITEMIDLIST pidl1, pidl2;
IShellFolder *desktop; IShellFolder *desktop;
WCHAR dirW[MAX_PATH]; WCHAR dirW[MAX_PATH];
WCHAR nameW[10]; WCHAR nameW[10];
WCHAR *cdrom;
HRESULT hr; HRESULT hr;
BOOL ret, is_wow64; BOOL ret, is_wow64;
@ -4312,6 +4336,16 @@ if (0)
} }
IShellFolder_Release(desktop); IShellFolder_Release(desktop);
cdrom = get_empty_cddrive();
if (!cdrom)
skip("No empty cdrom drive found, skipping test\n");
else
{
hr = pSHParseDisplayName(cdrom, NULL, &pidl1, 0, NULL);
ok(hr == S_OK, "failed %08x\n", hr);
if (SUCCEEDED(hr)) pILFree(pidl1);
}
} }
static void test_desktop_IPersist(void) static void test_desktop_IPersist(void)
@ -4974,9 +5008,9 @@ static void test_SHChangeNotify(BOOL test_new_delivery)
entries[0].pidl = NULL; entries[0].pidl = NULL;
if(has_unicode) if(has_unicode)
hr = SHILCreateFromPath(root_dirW, (LPITEMIDLIST*)&entries[0].pidl, 0); hr = pSHILCreateFromPath(root_dirW, (LPITEMIDLIST*)&entries[0].pidl, 0);
else else
hr = SHILCreateFromPath((LPCVOID)root_dirA, (LPITEMIDLIST*)&entries[0].pidl, 0); hr = pSHILCreateFromPath((LPCVOID)root_dirA, (LPITEMIDLIST*)&entries[0].pidl, 0);
ok(hr == S_OK, "SHILCreateFromPath failed: 0x%08x\n", hr); ok(hr == S_OK, "SHILCreateFromPath failed: 0x%08x\n", hr);
entries[0].fRecursive = TRUE; entries[0].fRecursive = TRUE;

View file

@ -32,7 +32,7 @@
#include "wine/test.h" #include "wine/test.h"
static HMODULE hShell32; static HMODULE hShell32;
static HRESULT (WINAPI *pStrRetToStrNAW)(LPVOID,DWORD,LPSTRRET,const ITEMIDLIST *); static BOOL (WINAPI *pStrRetToStrNAW)(LPVOID,DWORD,LPSTRRET,const ITEMIDLIST *);
static WCHAR *CoDupStrW(const char* src) static WCHAR *CoDupStrW(const char* src)
{ {

View file

@ -44,6 +44,7 @@ static void test_cbsize(void)
nidW.hIcon = LoadIconA(NULL, (LPSTR)IDI_APPLICATION); nidW.hIcon = LoadIconA(NULL, (LPSTR)IDI_APPLICATION);
nidW.uCallbackMessage = WM_USER+17; nidW.uCallbackMessage = WM_USER+17;
ret = pShell_NotifyIconW(NIM_ADD, &nidW); ret = pShell_NotifyIconW(NIM_ADD, &nidW);
ok(ret, "NIM_ADD failed!\n");
/* using an invalid cbSize does work */ /* using an invalid cbSize does work */
nidW.cbSize = 3; nidW.cbSize = 3;
nidW.hWnd = hMainWnd; nidW.hWnd = hMainWnd;