mirror of
https://github.com/reactos/reactos.git
synced 2025-05-07 18:56:48 +00:00
Sync shell32 and mshtml winetests (this time with modified testlist.c). This will unbreak build again :-P
svn path=/trunk/; revision=47954
This commit is contained in:
parent
d848c9746e
commit
ef1db99fd9
15 changed files with 3980 additions and 608 deletions
|
@ -483,9 +483,7 @@ static void _test_event_x(unsigned line, IHTMLEventObj *event, LONG exl)
|
|||
|
||||
hres = IHTMLEventObj_get_x(event, &l);
|
||||
ok_(__FILE__,line)(hres == S_OK, "get_x failed: %08x\n", hres);
|
||||
if(exl == -10) /* don't test the exact value */
|
||||
todo_wine ok_(__FILE__,line)(l > 0, "x = %d\n", l);
|
||||
else
|
||||
if(exl != -10) /* don't test the exact value */
|
||||
ok_(__FILE__,line)(l == exl, "x = %d, expected %d\n", l, exl);
|
||||
}
|
||||
|
||||
|
@ -496,9 +494,7 @@ static void _test_event_y(unsigned line, IHTMLEventObj *event, LONG exl)
|
|||
|
||||
hres = IHTMLEventObj_get_y(event, &l);
|
||||
ok_(__FILE__,line)(hres == S_OK, "get_y failed: %08x\n", hres);
|
||||
if(exl == -10) /* don't test the exact value */
|
||||
todo_wine ok_(__FILE__,line)(l > 0, "y = %d\n", l);
|
||||
else
|
||||
if(exl != -10) /* don't test the exact value */
|
||||
ok_(__FILE__,line)(l == exl, "y = %d, expected %d\n", l, exl);
|
||||
}
|
||||
|
||||
|
@ -509,14 +505,8 @@ static void _test_event_clientx(unsigned line, IHTMLEventObj *event, LONG exl)
|
|||
|
||||
hres = IHTMLEventObj_get_clientX(event, &l);
|
||||
ok_(__FILE__,line)(hres == S_OK, "get_clientX failed: %08x\n", hres);
|
||||
if(exl == -10) {/* don't test the exact value */
|
||||
if(xy_todo)
|
||||
todo_wine ok_(__FILE__,line)(l > 0, "clientX = %d\n", l);
|
||||
else
|
||||
ok_(__FILE__,line)(l > 0, "clientX = %d\n", l);
|
||||
}else {
|
||||
if(exl != -10) /* don't test the exact value */
|
||||
ok_(__FILE__,line)(l == exl, "clientX = %d, expected %d\n", l, exl);
|
||||
}
|
||||
}
|
||||
|
||||
static void _test_event_clienty(unsigned line, IHTMLEventObj *event, LONG exl)
|
||||
|
@ -526,14 +516,8 @@ static void _test_event_clienty(unsigned line, IHTMLEventObj *event, LONG exl)
|
|||
|
||||
hres = IHTMLEventObj_get_clientY(event, &l);
|
||||
ok_(__FILE__,line)(hres == S_OK, "get_clientY failed: %08x\n", hres);
|
||||
if(exl == -10) {/* don't test the exact value */
|
||||
if(xy_todo)
|
||||
todo_wine ok_(__FILE__,line)(l > 0, "clientY = %d\n", l);
|
||||
else
|
||||
ok_(__FILE__,line)(l > 0, "clientY = %d\n", l);
|
||||
}else {
|
||||
if(exl != -10) /* don't test the exact value */
|
||||
ok_(__FILE__,line)(l == exl, "clientY = %d, expected %d\n", l, exl);
|
||||
}
|
||||
}
|
||||
|
||||
static void _test_event_offsetx(unsigned line, IHTMLEventObj *event, LONG exl)
|
||||
|
@ -543,9 +527,7 @@ static void _test_event_offsetx(unsigned line, IHTMLEventObj *event, LONG exl)
|
|||
|
||||
hres = IHTMLEventObj_get_offsetX(event, &l);
|
||||
ok_(__FILE__,line)(hres == S_OK, "get_offsetX failed: %08x\n", hres);
|
||||
if(exl == -10) /* don't test the exact value */
|
||||
todo_wine ok_(__FILE__,line)(l > 0, "offsetX = %d\n", l);
|
||||
else
|
||||
if(exl != -10) /* don't test the exact value */
|
||||
ok_(__FILE__,line)(l == exl, "offsetX = %d, expected %d\n", l, exl);
|
||||
}
|
||||
|
||||
|
@ -556,9 +538,7 @@ static void _test_event_offsety(unsigned line, IHTMLEventObj *event, LONG exl)
|
|||
|
||||
hres = IHTMLEventObj_get_offsetY(event, &l);
|
||||
ok_(__FILE__,line)(hres == S_OK, "get_offsetY failed: %08x\n", hres);
|
||||
if(exl == -10) /* don't test the exact value */
|
||||
todo_wine ok_(__FILE__,line)(l > 0, "offsetY = %d\n", l);
|
||||
else
|
||||
if(exl != -10) /* don't test the exact value */
|
||||
ok_(__FILE__,line)(l == exl, "offsetY = %d, expected %d\n", l, exl);
|
||||
}
|
||||
|
||||
|
@ -569,14 +549,8 @@ static void _test_event_screenx(unsigned line, IHTMLEventObj *event, LONG exl)
|
|||
|
||||
hres = IHTMLEventObj_get_screenX(event, &l);
|
||||
ok_(__FILE__,line)(hres == S_OK, "get_screenX failed: %08x\n", hres);
|
||||
if(exl == -10) { /* don't test the exact value */
|
||||
if(xy_todo)
|
||||
todo_wine ok_(__FILE__,line)(l > 0, "screenX = %d\n", l);
|
||||
else
|
||||
ok_(__FILE__,line)(l > 0, "screenX = %d\n", l);
|
||||
}else {
|
||||
if(exl != -10) /* don't test the exact value */
|
||||
ok_(__FILE__,line)(l == exl, "screenX = %d, expected %d\n", l, exl);
|
||||
}
|
||||
}
|
||||
|
||||
static void _test_event_screeny(unsigned line, IHTMLEventObj *event, LONG exl)
|
||||
|
@ -586,14 +560,8 @@ static void _test_event_screeny(unsigned line, IHTMLEventObj *event, LONG exl)
|
|||
|
||||
hres = IHTMLEventObj_get_screenY(event, &l);
|
||||
ok_(__FILE__,line)(hres == S_OK, "get_screenY failed: %08x\n", hres);
|
||||
if(exl == -10) { /* don't test the exact value */
|
||||
if(xy_todo)
|
||||
todo_wine ok_(__FILE__,line)(l > 0, "screenY = %d\n", l);
|
||||
else
|
||||
ok_(__FILE__,line)(l > 0, "screenY = %d\n", l);
|
||||
}else {
|
||||
if(exl != -10) /* don't test the exact value for -10 */
|
||||
ok_(__FILE__,line)(l == exl, "screenY = %d, expected %d\n", l, exl);
|
||||
}
|
||||
}
|
||||
|
||||
static void _test_event_type(unsigned line, IHTMLEventObj *event, const char *exstr)
|
||||
|
@ -1204,6 +1172,10 @@ static void test_onclick(IHTMLDocument2 *doc)
|
|||
hres = IHTMLElement_put_onclick(div, v);
|
||||
ok(hres == S_OK, "put_onclick failed: %08x\n", hres);
|
||||
|
||||
V_VT(&v) = VT_NULL;
|
||||
hres = IHTMLElement_put_ondblclick(div, v);
|
||||
ok(hres == S_OK, "put_ondblclick failed: %08x\n", hres);
|
||||
|
||||
V_VT(&v) = VT_EMPTY;
|
||||
hres = IHTMLElement_get_onclick(div, &v);
|
||||
ok(hres == S_OK, "get_onclick failed: %08x\n", hres);
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "idispids.h"
|
||||
#include "shlguid.h"
|
||||
#include "perhist.h"
|
||||
#include "shobjidl.h"
|
||||
#include "mshtml_test.h"
|
||||
|
||||
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
|
||||
|
@ -155,6 +156,7 @@ DEFINE_EXPECT(Frame_GetWindow);
|
|||
DEFINE_EXPECT(TranslateUrl);
|
||||
DEFINE_EXPECT(Advise_Close);
|
||||
DEFINE_EXPECT(OnViewChange);
|
||||
DEFINE_EXPECT(EvaluateNewWindow);
|
||||
|
||||
static IUnknown *doc_unk;
|
||||
static IMoniker *doc_mon;
|
||||
|
@ -164,7 +166,7 @@ static BOOL ipsex, ipsw;
|
|||
static BOOL set_clientsite, container_locked, navigated_load;
|
||||
static BOOL readystate_set_loading = FALSE, readystate_set_interactive = FALSE, load_from_stream;
|
||||
static BOOL editmode = FALSE, show_failed;
|
||||
static BOOL inplace_deactivated;
|
||||
static BOOL inplace_deactivated, open_call;
|
||||
static int stream_read, protocol_read;
|
||||
static enum load_state_t {
|
||||
LD_DOLOAD,
|
||||
|
@ -296,6 +298,9 @@ static void _test_GetCurMoniker(unsigned line, IUnknown *unk, IMoniker *exmon, L
|
|||
BSTR doc_url = (void*)0xdeadbeef;
|
||||
HRESULT hres;
|
||||
|
||||
if(open_call)
|
||||
return; /* FIXME */
|
||||
|
||||
hres = IUnknown_QueryInterface(unk, &IID_IPersistMoniker, (void**)&permon);
|
||||
ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
|
||||
if(FAILED(hres))
|
||||
|
@ -332,7 +337,7 @@ static void _test_GetCurMoniker(unsigned line, IUnknown *unk, IMoniker *exmon, L
|
|||
}else if(exurl) {
|
||||
LPOLESTR url;
|
||||
|
||||
ok(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
|
||||
ok_(__FILE__,line)(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres);
|
||||
|
||||
hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
|
||||
ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
|
||||
|
@ -737,6 +742,48 @@ static const IHlinkFrameVtbl HlinkFrameVtbl = {
|
|||
|
||||
static IHlinkFrame HlinkFrame = { &HlinkFrameVtbl };
|
||||
|
||||
static HRESULT WINAPI NewWindowManager_QueryInterface(INewWindowManager *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI NewWindowManager_AddRef(INewWindowManager *iface)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static ULONG WINAPI NewWindowManager_Release(INewWindowManager *iface)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI NewWindowManager_EvaluateNewWindow(INewWindowManager *iface, LPCWSTR pszUrl,
|
||||
LPCWSTR pszName, LPCWSTR pszUrlContext, LPCWSTR pszFeatures, BOOL fReplace, DWORD dwFlags,
|
||||
DWORD dwUserActionTime)
|
||||
{
|
||||
CHECK_EXPECT(EvaluateNewWindow);
|
||||
|
||||
ok(!strcmp_wa(pszUrl, "about:blank"), "pszUrl = %s\n", wine_dbgstr_w(pszUrl));
|
||||
ok(!strcmp_wa(pszName, "test"), "pszName = %s\n", wine_dbgstr_w(pszName));
|
||||
ok(!strcmp_wa(pszUrlContext, "about:blank"), "pszUrlContext = %s\n", wine_dbgstr_w(pszUrlContext));
|
||||
ok(!pszFeatures, "pszFeatures = %s\n", wine_dbgstr_w(pszFeatures));
|
||||
ok(!fReplace, "fReplace = %x\n", fReplace);
|
||||
ok(dwFlags == NWMF_FIRST, "dwFlags = %x\n", dwFlags);
|
||||
ok(!dwUserActionTime, "dwUserActionime = %d\n", dwUserActionTime);
|
||||
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
static const INewWindowManagerVtbl NewWindowManagerVtbl = {
|
||||
NewWindowManager_QueryInterface,
|
||||
NewWindowManager_AddRef,
|
||||
NewWindowManager_Release,
|
||||
NewWindowManager_EvaluateNewWindow
|
||||
};
|
||||
|
||||
static INewWindowManager NewWindowManager = { &NewWindowManagerVtbl };
|
||||
|
||||
static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
|
||||
REFIID riid, void**ppv)
|
||||
{
|
||||
|
@ -1321,6 +1368,74 @@ static const IOleContainerVtbl OleContainerVtbl = {
|
|||
|
||||
static IOleContainer OleContainer = { &OleContainerVtbl };
|
||||
|
||||
static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
return QueryInterface(riid, ppv);
|
||||
}
|
||||
|
||||
static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign, DWORD dwWhichMoniker,
|
||||
IMoniker **ppmon)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
|
||||
{
|
||||
CHECK_EXPECT(GetContainer);
|
||||
ok(ppContainer != NULL, "ppContainer = NULL\n");
|
||||
*ppContainer = &OleContainer;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const IOleClientSiteVtbl ClientSiteVtbl = {
|
||||
ClientSite_QueryInterface,
|
||||
ClientSite_AddRef,
|
||||
ClientSite_Release,
|
||||
ClientSite_SaveObject,
|
||||
ClientSite_GetMoniker,
|
||||
ClientSite_GetContainer,
|
||||
ClientSite_ShowObject,
|
||||
ClientSite_OnShowWindow,
|
||||
ClientSite_RequestNewObjectLayout
|
||||
};
|
||||
|
||||
static IOleClientSite ClientSite = { &ClientSiteVtbl };
|
||||
|
||||
static HRESULT WINAPI InPlaceFrame_QueryInterface(IOleInPlaceFrame *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
static const GUID undocumented_frame_iid = {0xfbece6c9,0x48d7,0x4a37,{0x8f,0xe3,0x6a,0xd4,0x27,0x2f,0xdd,0xac}};
|
||||
|
@ -1511,9 +1626,23 @@ static ULONG WINAPI InPlaceSiteWindowless_Release(IOleInPlaceSiteWindowless *ifa
|
|||
static HRESULT WINAPI InPlaceSiteWindowless_GetWindow(
|
||||
IOleInPlaceSiteWindowless *iface, HWND *phwnd)
|
||||
{
|
||||
IOleClientSite *client_site;
|
||||
IOleObject *ole_obj;
|
||||
HRESULT hres;
|
||||
|
||||
CHECK_EXPECT2(GetWindow);
|
||||
ok(phwnd != NULL, "phwnd = NULL\n");
|
||||
*phwnd = container_hwnd;
|
||||
|
||||
hres = IUnknown_QueryInterface(doc_unk, &IID_IOleObject, (void**)&ole_obj);
|
||||
ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
|
||||
|
||||
hres = IOleObject_GetClientSite(ole_obj, &client_site);
|
||||
IOleObject_Release(ole_obj);
|
||||
ok(hres == S_OK, "GetClientSite failed: %08x\n", hres);
|
||||
ok(client_site == &ClientSite, "client_site != ClientSite\n");
|
||||
IOleClientSite_Release(client_site);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -1774,74 +1903,6 @@ static const IOleInPlaceSiteWindowlessVtbl InPlaceSiteWindowlessVtbl = {
|
|||
|
||||
static IOleInPlaceSiteWindowless InPlaceSiteWindowless = { &InPlaceSiteWindowlessVtbl };
|
||||
|
||||
static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
return QueryInterface(riid, ppv);
|
||||
}
|
||||
|
||||
static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign, DWORD dwWhichMoniker,
|
||||
IMoniker **ppmon)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
|
||||
{
|
||||
CHECK_EXPECT(GetContainer);
|
||||
ok(ppContainer != NULL, "ppContainer = NULL\n");
|
||||
*ppContainer = &OleContainer;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
|
||||
{
|
||||
ok(0, "unexpected call\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const IOleClientSiteVtbl ClientSiteVtbl = {
|
||||
ClientSite_QueryInterface,
|
||||
ClientSite_AddRef,
|
||||
ClientSite_Release,
|
||||
ClientSite_SaveObject,
|
||||
ClientSite_GetMoniker,
|
||||
ClientSite_GetContainer,
|
||||
ClientSite_ShowObject,
|
||||
ClientSite_OnShowWindow,
|
||||
ClientSite_RequestNewObjectLayout
|
||||
};
|
||||
|
||||
static IOleClientSite ClientSite = { &ClientSiteVtbl };
|
||||
|
||||
static HRESULT WINAPI DocumentSite_QueryInterface(IOleDocumentSite *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
return QueryInterface(riid, ppv);
|
||||
|
@ -2423,6 +2484,8 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID
|
|||
ok(V_BSTR(pvaIn) != NULL, "V_BSTR(pvaIn) = NULL\n");
|
||||
test_readyState(NULL);
|
||||
return S_OK;
|
||||
case OLECMDID_UPDATETRAVELENTRY_DATARECOVERY:
|
||||
return E_FAIL; /* FIXME */
|
||||
default:
|
||||
ok(0, "unexpected command %d\n", nCmdID);
|
||||
return E_FAIL;
|
||||
|
@ -2701,6 +2764,12 @@ static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFG
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
if(IsEqualGUID(&SID_SNewWindowManager, guidService)) {
|
||||
ok(IsEqualGUID(&IID_INewWindowManager, riid), "unexpected riid\n");
|
||||
*ppv = &NewWindowManager;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
@ -2941,6 +3010,9 @@ static void _test_readyState(unsigned line, IUnknown *unk)
|
|||
"uninitialized"
|
||||
};
|
||||
|
||||
if(open_call)
|
||||
return; /* FIXME */
|
||||
|
||||
if(!unk)
|
||||
unk = doc_unk;
|
||||
|
||||
|
@ -3405,6 +3477,43 @@ static void test_put_href(IHTMLDocument2 *doc)
|
|||
test_download(DWL_VERBDONE);
|
||||
}
|
||||
|
||||
static void test_open_window(IHTMLDocument2 *doc)
|
||||
{
|
||||
IHTMLWindow2 *window, *new_window;
|
||||
BSTR name, url;
|
||||
HRESULT hres;
|
||||
|
||||
hres = IHTMLDocument2_get_parentWindow(doc, &window);
|
||||
ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
|
||||
|
||||
url = a2bstr("about:blank");
|
||||
name = a2bstr("test");
|
||||
new_window = (void*)0xdeadbeef;
|
||||
|
||||
open_call = TRUE;
|
||||
|
||||
SET_EXPECT(TranslateUrl);
|
||||
SET_EXPECT(EvaluateNewWindow);
|
||||
|
||||
hres = IHTMLWindow2_open(window, url, name, NULL, VARIANT_FALSE, &new_window);
|
||||
todo_wine
|
||||
ok(hres == S_OK, "open failed: %08x\n", hres);
|
||||
todo_wine
|
||||
ok(new_window == NULL, "new_window != NULL\n");
|
||||
|
||||
todo_wine
|
||||
CHECK_CALLED(TranslateUrl);
|
||||
todo_wine
|
||||
CHECK_CALLED(EvaluateNewWindow);
|
||||
|
||||
open_call = FALSE;
|
||||
SysFreeString(url);
|
||||
SysFreeString(name);
|
||||
|
||||
IHTMLWindow2_Release(window);
|
||||
SysFreeString(name);
|
||||
}
|
||||
|
||||
static void test_clear(IHTMLDocument2 *doc)
|
||||
{
|
||||
HRESULT hres;
|
||||
|
@ -4420,6 +4529,11 @@ static void test_QueryInterface(IHTMLDocument2 *doc)
|
|||
hres = IUnknown_QueryInterface(doc, &IID_IStdMarshalInfo, (void**)&qi);
|
||||
ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
|
||||
ok(qi == NULL, "qi=%p, expected NULL\n", qi);
|
||||
|
||||
hres = IUnknown_QueryInterface(doc, &IID_IDispatch, (void**)&qi);
|
||||
ok(hres == S_OK, "Could not get IDispatch interface: %08x\n", hres);
|
||||
ok(qi != (IUnknown*)doc, "disp == doc\n");
|
||||
IUnknown_Release(qi);
|
||||
}
|
||||
|
||||
static void init_test(enum load_state_t ls) {
|
||||
|
@ -4678,6 +4792,7 @@ static void test_HTMLDocument_http(void)
|
|||
test_GetCurMoniker((IUnknown*)doc, http_mon, NULL);
|
||||
|
||||
test_put_href(doc);
|
||||
test_open_window(doc);
|
||||
|
||||
test_InPlaceDeactivate(doc, TRUE);
|
||||
test_Close(doc, FALSE);
|
||||
|
|
|
@ -47,7 +47,7 @@ static IAutoComplete *test_init(void)
|
|||
win_skip("CLSID_AutoComplete is not registered\n");
|
||||
return NULL;
|
||||
}
|
||||
ok(SUCCEEDED(r), "no IID_IAutoComplete (0x%08x)\n", r);
|
||||
ok(r == S_OK, "no IID_IAutoComplete (0x%08x)\n", r);
|
||||
|
||||
/* AutoComplete source */
|
||||
r = CoCreateInstance(&CLSID_ACLMulti, NULL, CLSCTX_INPROC_SERVER,
|
||||
|
@ -57,11 +57,16 @@ static IAutoComplete *test_init(void)
|
|||
win_skip("CLSID_ACLMulti is not registered\n");
|
||||
return NULL;
|
||||
}
|
||||
ok(SUCCEEDED(r), "no IID_IACList (0x%08x)\n", r);
|
||||
ok(r == S_OK, "no IID_IACList (0x%08x)\n", r);
|
||||
|
||||
if (0)
|
||||
{
|
||||
/* crashes on native */
|
||||
r = IAutoComplete_Init(ac, hEdit, NULL, NULL, NULL);
|
||||
}
|
||||
/* bind to edit control */
|
||||
r = IAutoComplete_Init(ac, hEdit, acSource, NULL, NULL);
|
||||
ok(SUCCEEDED(r), "Init failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "Init failed (0x%08x)\n", r);
|
||||
|
||||
IUnknown_Release(acSource);
|
||||
|
||||
|
@ -121,8 +126,8 @@ START_TEST(autocomplete)
|
|||
IAutoComplete* ac;
|
||||
|
||||
r = CoInitialize(NULL);
|
||||
ok(SUCCEEDED(r), "CoInitialize failed (0x%08x). Tests aborted.\n", r);
|
||||
if (FAILED(r))
|
||||
ok(r == S_OK, "CoInitialize failed (0x%08x). Tests aborted.\n", r);
|
||||
if (r != S_OK)
|
||||
return;
|
||||
|
||||
createMainWnd();
|
||||
|
|
File diff suppressed because it is too large
Load diff
294
rostests/winetests/shell32/msg.h
Normal file
294
rostests/winetests/shell32/msg.h
Normal file
|
@ -0,0 +1,294 @@
|
|||
/* Message Sequence Testing Code
|
||||
*
|
||||
* Copyright (C) 2007 James Hawkins
|
||||
* Copyright (C) 2007 Lei Zhang
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <windows.h>
|
||||
#include "wine/test.h"
|
||||
|
||||
/* undocumented SWP flags - from SDK 3.1 */
|
||||
#define SWP_NOCLIENTSIZE 0x0800
|
||||
#define SWP_NOCLIENTMOVE 0x1000
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sent = 0x1,
|
||||
posted = 0x2,
|
||||
parent = 0x4,
|
||||
wparam = 0x8,
|
||||
lparam = 0x10,
|
||||
defwinproc = 0x20,
|
||||
beginpaint = 0x40,
|
||||
optional = 0x80,
|
||||
hook = 0x100,
|
||||
winevent_hook =0x200,
|
||||
id = 0x400
|
||||
} msg_flags_t;
|
||||
|
||||
struct message
|
||||
{
|
||||
UINT message; /* the WM_* code */
|
||||
msg_flags_t flags; /* message props */
|
||||
WPARAM wParam; /* expected value of wParam */
|
||||
LPARAM lParam; /* expected value of lParam */
|
||||
UINT id; /* extra message data: id of the window,
|
||||
notify code etc. */
|
||||
};
|
||||
|
||||
struct msg_sequence
|
||||
{
|
||||
int count;
|
||||
int size;
|
||||
struct message *sequence;
|
||||
};
|
||||
|
||||
static void add_message(struct msg_sequence **seq, int sequence_index,
|
||||
const struct message *msg)
|
||||
{
|
||||
struct msg_sequence *msg_seq = seq[sequence_index];
|
||||
|
||||
if (!msg_seq->sequence)
|
||||
{
|
||||
msg_seq->size = 10;
|
||||
msg_seq->sequence = HeapAlloc(GetProcessHeap(), 0,
|
||||
msg_seq->size * sizeof (struct message));
|
||||
}
|
||||
|
||||
if (msg_seq->count == msg_seq->size)
|
||||
{
|
||||
msg_seq->size *= 2;
|
||||
msg_seq->sequence = HeapReAlloc(GetProcessHeap(), 0,
|
||||
msg_seq->sequence,
|
||||
msg_seq->size * sizeof (struct message));
|
||||
}
|
||||
|
||||
assert(msg_seq->sequence);
|
||||
|
||||
msg_seq->sequence[msg_seq->count].message = msg->message;
|
||||
msg_seq->sequence[msg_seq->count].flags = msg->flags;
|
||||
msg_seq->sequence[msg_seq->count].wParam = msg->wParam;
|
||||
msg_seq->sequence[msg_seq->count].lParam = msg->lParam;
|
||||
msg_seq->sequence[msg_seq->count].id = msg->id;
|
||||
|
||||
msg_seq->count++;
|
||||
}
|
||||
|
||||
static void flush_sequence(struct msg_sequence **seg, int sequence_index)
|
||||
{
|
||||
struct msg_sequence *msg_seq = seg[sequence_index];
|
||||
HeapFree(GetProcessHeap(), 0, msg_seq->sequence);
|
||||
msg_seq->sequence = NULL;
|
||||
msg_seq->count = msg_seq->size = 0;
|
||||
}
|
||||
|
||||
static void flush_sequences(struct msg_sequence **seq, int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
flush_sequence(seq, i);
|
||||
}
|
||||
|
||||
static void ok_sequence_(struct msg_sequence **seq, int sequence_index,
|
||||
const struct message *expected, const char *context, int todo,
|
||||
const char *file, int line)
|
||||
{
|
||||
struct msg_sequence *msg_seq = seq[sequence_index];
|
||||
static const struct message end_of_sequence = {0, 0, 0, 0};
|
||||
const struct message *actual, *sequence;
|
||||
int failcount = 0;
|
||||
|
||||
add_message(seq, sequence_index, &end_of_sequence);
|
||||
|
||||
sequence = msg_seq->sequence;
|
||||
actual = sequence;
|
||||
|
||||
while (expected->message && actual->message)
|
||||
{
|
||||
trace_( file, line)("expected %04x - actual %04x\n", expected->message, actual->message);
|
||||
|
||||
if (expected->message == actual->message)
|
||||
{
|
||||
if (expected->flags & wparam)
|
||||
{
|
||||
if (expected->wParam != actual->wParam && todo)
|
||||
{
|
||||
todo_wine
|
||||
{
|
||||
failcount++;
|
||||
ok_(file, line) (FALSE,
|
||||
"%s: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
|
||||
context, expected->message, expected->wParam, actual->wParam);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ok_(file, line) (expected->wParam == actual->wParam,
|
||||
"%s: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
|
||||
context, expected->message, expected->wParam, actual->wParam);
|
||||
}
|
||||
}
|
||||
|
||||
if (expected->flags & lparam)
|
||||
{
|
||||
if (expected->lParam != actual->lParam && todo)
|
||||
{
|
||||
todo_wine
|
||||
{
|
||||
failcount++;
|
||||
ok_(file, line) (FALSE,
|
||||
"%s: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
|
||||
context, expected->message, expected->lParam, actual->lParam);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ok_(file, line) (expected->lParam == actual->lParam,
|
||||
"%s: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
|
||||
context, expected->message, expected->lParam, actual->lParam);
|
||||
}
|
||||
}
|
||||
|
||||
if (expected->flags & id)
|
||||
{
|
||||
if (expected->id != actual->id && expected->flags & optional)
|
||||
{
|
||||
expected++;
|
||||
continue;
|
||||
}
|
||||
if (expected->id != actual->id && todo)
|
||||
{
|
||||
todo_wine
|
||||
{
|
||||
failcount++;
|
||||
ok_(file, line) (FALSE,
|
||||
"%s: in msg 0x%04x expecting id 0x%x got 0x%x\n",
|
||||
context, expected->message, expected->id, actual->id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ok_(file, line) (expected->id == actual->id,
|
||||
"%s: in msg 0x%04x expecting id 0x%x got 0x%x\n",
|
||||
context, expected->message, expected->id, actual->id);
|
||||
}
|
||||
}
|
||||
|
||||
if ((expected->flags & defwinproc) != (actual->flags & defwinproc) && todo)
|
||||
{
|
||||
todo_wine
|
||||
{
|
||||
failcount++;
|
||||
ok_(file, line) (FALSE,
|
||||
"%s: the msg 0x%04x should %shave been sent by DefWindowProc\n",
|
||||
context, expected->message, (expected->flags & defwinproc) ? "" : "NOT ");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ok_(file, line) ((expected->flags & defwinproc) == (actual->flags & defwinproc),
|
||||
"%s: the msg 0x%04x should %shave been sent by DefWindowProc\n",
|
||||
context, expected->message, (expected->flags & defwinproc) ? "" : "NOT ");
|
||||
}
|
||||
|
||||
ok_(file, line) ((expected->flags & beginpaint) == (actual->flags & beginpaint),
|
||||
"%s: the msg 0x%04x should %shave been sent by BeginPaint\n",
|
||||
context, expected->message, (expected->flags & beginpaint) ? "" : "NOT ");
|
||||
ok_(file, line) ((expected->flags & (sent|posted)) == (actual->flags & (sent|posted)),
|
||||
"%s: the msg 0x%04x should have been %s\n",
|
||||
context, expected->message, (expected->flags & posted) ? "posted" : "sent");
|
||||
ok_(file, line) ((expected->flags & parent) == (actual->flags & parent),
|
||||
"%s: the msg 0x%04x was expected in %s\n",
|
||||
context, expected->message, (expected->flags & parent) ? "parent" : "child");
|
||||
ok_(file, line) ((expected->flags & hook) == (actual->flags & hook),
|
||||
"%s: the msg 0x%04x should have been sent by a hook\n",
|
||||
context, expected->message);
|
||||
ok_(file, line) ((expected->flags & winevent_hook) == (actual->flags & winevent_hook),
|
||||
"%s: the msg 0x%04x should have been sent by a winevent hook\n",
|
||||
context, expected->message);
|
||||
expected++;
|
||||
actual++;
|
||||
}
|
||||
else if (expected->flags & optional)
|
||||
expected++;
|
||||
else if (todo)
|
||||
{
|
||||
failcount++;
|
||||
todo_wine
|
||||
{
|
||||
ok_(file, line) (FALSE, "%s: the msg 0x%04x was expected, but got msg 0x%04x instead\n",
|
||||
context, expected->message, actual->message);
|
||||
}
|
||||
|
||||
flush_sequence(seq, sequence_index);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
ok_(file, line) (FALSE, "%s: the msg 0x%04x was expected, but got msg 0x%04x instead\n",
|
||||
context, expected->message, actual->message);
|
||||
expected++;
|
||||
actual++;
|
||||
}
|
||||
}
|
||||
|
||||
/* skip all optional trailing messages */
|
||||
while (expected->message && ((expected->flags & optional)))
|
||||
expected++;
|
||||
|
||||
if (todo)
|
||||
{
|
||||
todo_wine
|
||||
{
|
||||
if (expected->message || actual->message)
|
||||
{
|
||||
failcount++;
|
||||
ok_(file, line) (FALSE, "%s: the msg sequence is not complete: expected %04x - actual %04x\n",
|
||||
context, expected->message, actual->message);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (expected->message || actual->message)
|
||||
{
|
||||
ok_(file, line) (FALSE, "%s: the msg sequence is not complete: expected %04x - actual %04x\n",
|
||||
context, expected->message, actual->message);
|
||||
}
|
||||
|
||||
if(todo && !failcount) /* succeeded yet marked todo */
|
||||
{
|
||||
todo_wine
|
||||
{
|
||||
ok_(file, line)(TRUE, "%s: marked \"todo_wine\" but succeeds\n", context);
|
||||
}
|
||||
}
|
||||
|
||||
flush_sequence(seq, sequence_index);
|
||||
}
|
||||
|
||||
#define ok_sequence(seq, index, exp, contx, todo) \
|
||||
ok_sequence_(seq, index, (exp), (contx), (todo), __FILE__, __LINE__)
|
||||
|
||||
|
||||
static void init_msg_sequences(struct msg_sequence **seq, int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
seq[i] = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct msg_sequence));
|
||||
}
|
|
@ -149,7 +149,6 @@ static void init_strings(void)
|
|||
{
|
||||
HKEY key;
|
||||
DWORD size;
|
||||
LONG res;
|
||||
|
||||
/* Older Win9x and NT4 */
|
||||
|
||||
|
@ -162,7 +161,7 @@ static void init_strings(void)
|
|||
|
||||
RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &key);
|
||||
size = sizeof(commonprograms);
|
||||
res = RegQueryValueExA(key, "Common Programs", NULL, NULL, (LPBYTE)&commonprograms, &size);
|
||||
RegQueryValueExA(key, "Common Programs", NULL, NULL, (LPBYTE)&commonprograms, &size);
|
||||
RegCloseKey(key);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
<file>shlexec.c</file>
|
||||
<file>shlfileop.c</file>
|
||||
<file>shlfolder.c</file>
|
||||
<file>shlview.c</file>
|
||||
<file>string.c</file>
|
||||
<file>systray.c</file>
|
||||
<file>testlist.c</file>
|
||||
<file>shfldr_netplaces.c</file>
|
||||
<file>shfldr_special.c</file>
|
||||
<file>rsrc.rc</file>
|
||||
</module>
|
||||
|
|
|
@ -92,7 +92,7 @@ static LPITEMIDLIST path_to_pidl(const char* path)
|
|||
MultiByteToWideChar(CP_ACP, 0, path, -1, pathW, len);
|
||||
|
||||
r=pSHILCreateFromPath(pathW, &pidl, NULL);
|
||||
ok(SUCCEEDED(r), "SHILCreateFromPath failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "SHILCreateFromPath failed (0x%08x)\n", r);
|
||||
HeapFree(GetProcessHeap(), 0, pathW);
|
||||
}
|
||||
return pidl;
|
||||
|
@ -117,44 +117,53 @@ static void test_get_set(void)
|
|||
|
||||
r = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IShellLinkA, (LPVOID*)&sl);
|
||||
ok(SUCCEEDED(r), "no IID_IShellLinkA (0x%08x)\n", r);
|
||||
if (FAILED(r))
|
||||
ok(r == S_OK, "no IID_IShellLinkA (0x%08x)\n", r);
|
||||
if (r != S_OK)
|
||||
return;
|
||||
|
||||
/* Test Getting / Setting the description */
|
||||
strcpy(buffer,"garbage");
|
||||
r = IShellLinkA_GetDescription(sl, buffer, sizeof(buffer));
|
||||
ok(SUCCEEDED(r), "GetDescription failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "GetDescription failed (0x%08x)\n", r);
|
||||
ok(*buffer=='\0', "GetDescription returned '%s'\n", buffer);
|
||||
|
||||
str="Some description";
|
||||
r = IShellLinkA_SetDescription(sl, str);
|
||||
ok(SUCCEEDED(r), "SetDescription failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "SetDescription failed (0x%08x)\n", r);
|
||||
|
||||
strcpy(buffer,"garbage");
|
||||
r = IShellLinkA_GetDescription(sl, buffer, sizeof(buffer));
|
||||
ok(SUCCEEDED(r), "GetDescription failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "GetDescription failed (0x%08x)\n", r);
|
||||
ok(lstrcmp(buffer,str)==0, "GetDescription returned '%s'\n", buffer);
|
||||
|
||||
r = IShellLinkA_SetDescription(sl, NULL);
|
||||
ok(r == S_OK, "SetDescription failed (0x%08x)\n", r);
|
||||
|
||||
strcpy(buffer,"garbage");
|
||||
r = IShellLinkA_GetDescription(sl, buffer, sizeof(buffer));
|
||||
ok(r == S_OK, "GetDescription failed (0x%08x)\n", r);
|
||||
ok(*buffer=='\0' || broken(lstrcmp(buffer,str)==0), "GetDescription returned '%s'\n", buffer); /* NT4 */
|
||||
|
||||
|
||||
/* Test Getting / Setting the work directory */
|
||||
strcpy(buffer,"garbage");
|
||||
r = IShellLinkA_GetWorkingDirectory(sl, buffer, sizeof(buffer));
|
||||
ok(SUCCEEDED(r), "GetWorkingDirectory failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "GetWorkingDirectory failed (0x%08x)\n", r);
|
||||
ok(*buffer=='\0', "GetWorkingDirectory returned '%s'\n", buffer);
|
||||
|
||||
str="c:\\nonexistent\\directory";
|
||||
r = IShellLinkA_SetWorkingDirectory(sl, str);
|
||||
ok(SUCCEEDED(r), "SetWorkingDirectory failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "SetWorkingDirectory failed (0x%08x)\n", r);
|
||||
|
||||
strcpy(buffer,"garbage");
|
||||
r = IShellLinkA_GetWorkingDirectory(sl, buffer, sizeof(buffer));
|
||||
ok(SUCCEEDED(r), "GetWorkingDirectory failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "GetWorkingDirectory failed (0x%08x)\n", r);
|
||||
ok(lstrcmpi(buffer,str)==0, "GetWorkingDirectory returned '%s'\n", buffer);
|
||||
|
||||
/* Test Getting / Setting the path */
|
||||
strcpy(buffer,"garbage");
|
||||
r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH);
|
||||
ok(SUCCEEDED(r), "GetPath failed (0x%08x)\n", r);
|
||||
todo_wine ok(r == S_FALSE || broken(r == S_OK) /* NT4/W2K */, "GetPath failed (0x%08x)\n", r);
|
||||
ok(*buffer=='\0', "GetPath returned '%s'\n", buffer);
|
||||
|
||||
CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
|
||||
|
@ -175,7 +184,7 @@ static void test_get_set(void)
|
|||
|
||||
strcpy(buffer,"garbage");
|
||||
r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH);
|
||||
ok(SUCCEEDED(r), "GetPath failed (0x%08x)\n", r);
|
||||
todo_wine ok(r == S_FALSE, "GetPath failed (0x%08x)\n", r);
|
||||
ok(*buffer=='\0', "GetPath returned '%s'\n", buffer);
|
||||
|
||||
/* Win98 returns S_FALSE, but WinXP returns S_OK */
|
||||
|
@ -185,7 +194,7 @@ static void test_get_set(void)
|
|||
|
||||
strcpy(buffer,"garbage");
|
||||
r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH);
|
||||
ok(SUCCEEDED(r), "GetPath failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "GetPath failed (0x%08x)\n", r);
|
||||
ok(lstrcmpi(buffer,str)==0, "GetPath returned '%s'\n", buffer);
|
||||
|
||||
/* Get some real path to play with */
|
||||
|
@ -195,8 +204,8 @@ static void test_get_set(void)
|
|||
/* Test the interaction of SetPath and SetIDList */
|
||||
tmp_pidl=NULL;
|
||||
r = IShellLinkA_GetIDList(sl, &tmp_pidl);
|
||||
ok(SUCCEEDED(r), "GetIDList failed (0x%08x)\n", r);
|
||||
if (SUCCEEDED(r))
|
||||
todo_wine ok(r == S_OK, "GetIDList failed (0x%08x)\n", r);
|
||||
if (r == S_OK)
|
||||
{
|
||||
BOOL ret;
|
||||
|
||||
|
@ -218,16 +227,16 @@ static void test_get_set(void)
|
|||
LPITEMIDLIST second_pidl;
|
||||
|
||||
r = IShellLinkA_SetIDList(sl, pidl);
|
||||
ok(SUCCEEDED(r), "SetIDList failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "SetIDList failed (0x%08x)\n", r);
|
||||
|
||||
tmp_pidl=NULL;
|
||||
r = IShellLinkA_GetIDList(sl, &tmp_pidl);
|
||||
ok(SUCCEEDED(r), "GetIDList failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "GetIDList failed (0x%08x)\n", r);
|
||||
ok(tmp_pidl && pILIsEqual(pidl, tmp_pidl),
|
||||
"GetIDList returned an incorrect pidl\n");
|
||||
|
||||
r = IShellLinkA_GetIDList(sl, &second_pidl);
|
||||
ok(SUCCEEDED(r), "GetIDList failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "GetIDList failed (0x%08x)\n", r);
|
||||
ok(second_pidl && pILIsEqual(pidl, second_pidl),
|
||||
"GetIDList returned an incorrect pidl\n");
|
||||
ok(second_pidl != tmp_pidl, "pidls are the same\n");
|
||||
|
@ -238,7 +247,7 @@ static void test_get_set(void)
|
|||
|
||||
strcpy(buffer,"garbage");
|
||||
r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH);
|
||||
ok(SUCCEEDED(r), "GetPath failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "GetPath failed (0x%08x)\n", r);
|
||||
todo_wine
|
||||
ok(lstrcmpi(buffer, mypath)==0, "GetPath returned '%s'\n", buffer);
|
||||
|
||||
|
@ -273,44 +282,44 @@ static void test_get_set(void)
|
|||
/* Test Getting / Setting the arguments */
|
||||
strcpy(buffer,"garbage");
|
||||
r = IShellLinkA_GetArguments(sl, buffer, sizeof(buffer));
|
||||
ok(SUCCEEDED(r), "GetArguments failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "GetArguments failed (0x%08x)\n", r);
|
||||
ok(*buffer=='\0', "GetArguments returned '%s'\n", buffer);
|
||||
|
||||
str="param1 \"spaced param2\"";
|
||||
r = IShellLinkA_SetArguments(sl, str);
|
||||
ok(SUCCEEDED(r), "SetArguments failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "SetArguments failed (0x%08x)\n", r);
|
||||
|
||||
strcpy(buffer,"garbage");
|
||||
r = IShellLinkA_GetArguments(sl, buffer, sizeof(buffer));
|
||||
ok(SUCCEEDED(r), "GetArguments failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "GetArguments failed (0x%08x)\n", r);
|
||||
ok(lstrcmp(buffer,str)==0, "GetArguments returned '%s'\n", buffer);
|
||||
|
||||
strcpy(buffer,"garbage");
|
||||
r = IShellLinkA_SetArguments(sl, NULL);
|
||||
ok(SUCCEEDED(r), "SetArguments failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "SetArguments failed (0x%08x)\n", r);
|
||||
r = IShellLinkA_GetArguments(sl, buffer, sizeof(buffer));
|
||||
ok(SUCCEEDED(r), "GetArguments failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "GetArguments failed (0x%08x)\n", r);
|
||||
ok(!buffer[0] || lstrcmp(buffer,str)==0, "GetArguments returned '%s'\n", buffer);
|
||||
|
||||
strcpy(buffer,"garbage");
|
||||
r = IShellLinkA_SetArguments(sl, "");
|
||||
ok(SUCCEEDED(r), "SetArguments failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "SetArguments failed (0x%08x)\n", r);
|
||||
r = IShellLinkA_GetArguments(sl, buffer, sizeof(buffer));
|
||||
ok(SUCCEEDED(r), "GetArguments failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "GetArguments failed (0x%08x)\n", r);
|
||||
ok(!buffer[0], "GetArguments returned '%s'\n", buffer);
|
||||
|
||||
/* Test Getting / Setting showcmd */
|
||||
i=0xdeadbeef;
|
||||
r = IShellLinkA_GetShowCmd(sl, &i);
|
||||
ok(SUCCEEDED(r), "GetShowCmd failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "GetShowCmd failed (0x%08x)\n", r);
|
||||
ok(i==SW_SHOWNORMAL, "GetShowCmd returned %d\n", i);
|
||||
|
||||
r = IShellLinkA_SetShowCmd(sl, SW_SHOWMAXIMIZED);
|
||||
ok(SUCCEEDED(r), "SetShowCmd failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "SetShowCmd failed (0x%08x)\n", r);
|
||||
|
||||
i=0xdeadbeef;
|
||||
r = IShellLinkA_GetShowCmd(sl, &i);
|
||||
ok(SUCCEEDED(r), "GetShowCmd failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "GetShowCmd failed (0x%08x)\n", r);
|
||||
ok(i==SW_SHOWMAXIMIZED, "GetShowCmd returned %d'\n", i);
|
||||
|
||||
/* Test Getting / Setting the icon */
|
||||
|
@ -318,33 +327,33 @@ static void test_get_set(void)
|
|||
strcpy(buffer,"garbage");
|
||||
r = IShellLinkA_GetIconLocation(sl, buffer, sizeof(buffer), &i);
|
||||
todo_wine {
|
||||
ok(SUCCEEDED(r), "GetIconLocation failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "GetIconLocation failed (0x%08x)\n", r);
|
||||
}
|
||||
ok(*buffer=='\0', "GetIconLocation returned '%s'\n", buffer);
|
||||
ok(i==0, "GetIconLocation returned %d\n", i);
|
||||
|
||||
str="c:\\nonexistent\\file";
|
||||
r = IShellLinkA_SetIconLocation(sl, str, 0xbabecafe);
|
||||
ok(SUCCEEDED(r), "SetIconLocation failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "SetIconLocation failed (0x%08x)\n", r);
|
||||
|
||||
i=0xdeadbeef;
|
||||
r = IShellLinkA_GetIconLocation(sl, buffer, sizeof(buffer), &i);
|
||||
ok(SUCCEEDED(r), "GetIconLocation failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "GetIconLocation failed (0x%08x)\n", r);
|
||||
ok(lstrcmpi(buffer,str)==0, "GetIconLocation returned '%s'\n", buffer);
|
||||
ok(i==0xbabecafe, "GetIconLocation returned %d'\n", i);
|
||||
|
||||
/* Test Getting / Setting the hot key */
|
||||
w=0xbeef;
|
||||
r = IShellLinkA_GetHotkey(sl, &w);
|
||||
ok(SUCCEEDED(r), "GetHotkey failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "GetHotkey failed (0x%08x)\n", r);
|
||||
ok(w==0, "GetHotkey returned %d\n", w);
|
||||
|
||||
r = IShellLinkA_SetHotkey(sl, 0x5678);
|
||||
ok(SUCCEEDED(r), "SetHotkey failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "SetHotkey failed (0x%08x)\n", r);
|
||||
|
||||
w=0xbeef;
|
||||
r = IShellLinkA_GetHotkey(sl, &w);
|
||||
ok(SUCCEEDED(r), "GetHotkey failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "GetHotkey failed (0x%08x)\n", r);
|
||||
ok(w==0x5678, "GetHotkey returned %d'\n", w);
|
||||
|
||||
IShellLinkA_Release(sl);
|
||||
|
@ -372,19 +381,19 @@ void create_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int save_fails)
|
|||
|
||||
r = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IShellLinkA, (LPVOID*)&sl);
|
||||
lok(SUCCEEDED(r), "no IID_IShellLinkA (0x%08x)\n", r);
|
||||
if (FAILED(r))
|
||||
lok(r == S_OK, "no IID_IShellLinkA (0x%08x)\n", r);
|
||||
if (r != S_OK)
|
||||
return;
|
||||
|
||||
if (desc->description)
|
||||
{
|
||||
r = IShellLinkA_SetDescription(sl, desc->description);
|
||||
lok(SUCCEEDED(r), "SetDescription failed (0x%08x)\n", r);
|
||||
lok(r == S_OK, "SetDescription failed (0x%08x)\n", r);
|
||||
}
|
||||
if (desc->workdir)
|
||||
{
|
||||
r = IShellLinkA_SetWorkingDirectory(sl, desc->workdir);
|
||||
lok(SUCCEEDED(r), "SetWorkingDirectory failed (0x%08x)\n", r);
|
||||
lok(r == S_OK, "SetWorkingDirectory failed (0x%08x)\n", r);
|
||||
}
|
||||
if (desc->path)
|
||||
{
|
||||
|
@ -394,44 +403,80 @@ void create_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int save_fails)
|
|||
if (desc->pidl)
|
||||
{
|
||||
r = IShellLinkA_SetIDList(sl, desc->pidl);
|
||||
lok(SUCCEEDED(r), "SetIDList failed (0x%08x)\n", r);
|
||||
lok(r == S_OK, "SetIDList failed (0x%08x)\n", r);
|
||||
}
|
||||
if (desc->arguments)
|
||||
{
|
||||
r = IShellLinkA_SetArguments(sl, desc->arguments);
|
||||
lok(SUCCEEDED(r), "SetArguments failed (0x%08x)\n", r);
|
||||
lok(r == S_OK, "SetArguments failed (0x%08x)\n", r);
|
||||
}
|
||||
if (desc->showcmd)
|
||||
{
|
||||
r = IShellLinkA_SetShowCmd(sl, desc->showcmd);
|
||||
lok(SUCCEEDED(r), "SetShowCmd failed (0x%08x)\n", r);
|
||||
lok(r == S_OK, "SetShowCmd failed (0x%08x)\n", r);
|
||||
}
|
||||
if (desc->icon)
|
||||
{
|
||||
r = IShellLinkA_SetIconLocation(sl, desc->icon, desc->icon_id);
|
||||
lok(SUCCEEDED(r), "SetIconLocation failed (0x%08x)\n", r);
|
||||
lok(r == S_OK, "SetIconLocation failed (0x%08x)\n", r);
|
||||
}
|
||||
if (desc->hotkey)
|
||||
{
|
||||
r = IShellLinkA_SetHotkey(sl, desc->hotkey);
|
||||
lok(SUCCEEDED(r), "SetHotkey failed (0x%08x)\n", r);
|
||||
lok(r == S_OK, "SetHotkey failed (0x%08x)\n", r);
|
||||
}
|
||||
|
||||
r = IShellLinkW_QueryInterface(sl, &IID_IPersistFile, (LPVOID*)&pf);
|
||||
lok(SUCCEEDED(r), "no IID_IPersistFile (0x%08x)\n", r);
|
||||
if (SUCCEEDED(r))
|
||||
lok(r == S_OK, "no IID_IPersistFile (0x%08x)\n", r);
|
||||
if (r == S_OK)
|
||||
{
|
||||
LPOLESTR str;
|
||||
|
||||
if (0)
|
||||
{
|
||||
/* crashes on XP */
|
||||
r = IPersistFile_GetCurFile(pf, NULL);
|
||||
}
|
||||
|
||||
/* test GetCurFile before ::Save */
|
||||
str = (LPWSTR)0xdeadbeef;
|
||||
r = IPersistFile_GetCurFile(pf, &str);
|
||||
lok(r == S_FALSE ||
|
||||
broken(r == S_OK), /* shell32 < 5.0 */
|
||||
"got 0x%08x\n", r);
|
||||
lok(str == NULL, "got %p\n", str);
|
||||
|
||||
r = IPersistFile_Save(pf, path, TRUE);
|
||||
if (save_fails)
|
||||
{
|
||||
todo_wine {
|
||||
lok(SUCCEEDED(r), "save failed (0x%08x)\n", r);
|
||||
lok(r == S_OK, "save failed (0x%08x)\n", r);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lok(SUCCEEDED(r), "save failed (0x%08x)\n", r);
|
||||
lok(r == S_OK, "save failed (0x%08x)\n", r);
|
||||
}
|
||||
|
||||
/* test GetCurFile after ::Save */
|
||||
r = IPersistFile_GetCurFile(pf, &str);
|
||||
lok(r == S_OK, "got 0x%08x\n", r);
|
||||
lok(str != NULL ||
|
||||
broken(str == NULL), /* shell32 < 5.0 */
|
||||
"Didn't expect NULL\n");
|
||||
if (str != NULL)
|
||||
{
|
||||
IMalloc *pmalloc;
|
||||
|
||||
lok(!winetest_strcmpW(path, str), "Expected %s, got %s\n",
|
||||
wine_dbgstr_w(path), wine_dbgstr_w(str));
|
||||
|
||||
SHGetMalloc(&pmalloc);
|
||||
IMalloc_Free(pmalloc, str);
|
||||
}
|
||||
else
|
||||
win_skip("GetCurFile fails on shell32 < 5.0\n");
|
||||
|
||||
IPersistFile_Release(pf);
|
||||
}
|
||||
|
||||
|
@ -444,25 +489,54 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int todo)
|
|||
IShellLinkA *sl;
|
||||
IPersistFile *pf;
|
||||
char buffer[INFOTIPSIZE];
|
||||
LPOLESTR str;
|
||||
|
||||
r = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IShellLinkA, (LPVOID*)&sl);
|
||||
lok(SUCCEEDED(r), "no IID_IShellLinkA (0x%08x)\n", r);
|
||||
if (FAILED(r))
|
||||
lok(r == S_OK, "no IID_IShellLinkA (0x%08x)\n", r);
|
||||
if (r != S_OK)
|
||||
return;
|
||||
|
||||
r = IShellLinkA_QueryInterface(sl, &IID_IPersistFile, (LPVOID*)&pf);
|
||||
lok(SUCCEEDED(r), "no IID_IPersistFile (0x%08x)\n", r);
|
||||
if (FAILED(r))
|
||||
lok(r == S_OK, "no IID_IPersistFile (0x%08x)\n", r);
|
||||
if (r != S_OK)
|
||||
{
|
||||
IShellLinkA_Release(sl);
|
||||
return;
|
||||
}
|
||||
|
||||
/* test GetCurFile before ::Load */
|
||||
str = (LPWSTR)0xdeadbeef;
|
||||
r = IPersistFile_GetCurFile(pf, &str);
|
||||
lok(r == S_FALSE ||
|
||||
broken(r == S_OK), /* shell32 < 5.0 */
|
||||
"got 0x%08x\n", r);
|
||||
lok(str == NULL, "got %p\n", str);
|
||||
|
||||
r = IPersistFile_Load(pf, path, STGM_READ);
|
||||
lok(SUCCEEDED(r), "load failed (0x%08x)\n", r);
|
||||
lok(r == S_OK, "load failed (0x%08x)\n", r);
|
||||
|
||||
/* test GetCurFile after ::Save */
|
||||
r = IPersistFile_GetCurFile(pf, &str);
|
||||
lok(r == S_OK, "got 0x%08x\n", r);
|
||||
lok(str != NULL ||
|
||||
broken(str == NULL), /* shell32 < 5.0 */
|
||||
"Didn't expect NULL\n");
|
||||
if (str != NULL)
|
||||
{
|
||||
IMalloc *pmalloc;
|
||||
|
||||
lok(!winetest_strcmpW(path, str), "Expected %s, got %s\n",
|
||||
wine_dbgstr_w(path), wine_dbgstr_w(str));
|
||||
|
||||
SHGetMalloc(&pmalloc);
|
||||
IMalloc_Free(pmalloc, str);
|
||||
}
|
||||
else
|
||||
win_skip("GetCurFile fails on shell32 < 5.0\n");
|
||||
|
||||
IPersistFile_Release(pf);
|
||||
if (FAILED(r))
|
||||
if (r != S_OK)
|
||||
{
|
||||
IShellLinkA_Release(sl);
|
||||
return;
|
||||
|
@ -472,7 +546,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int todo)
|
|||
{
|
||||
strcpy(buffer,"garbage");
|
||||
r = IShellLinkA_GetDescription(sl, buffer, sizeof(buffer));
|
||||
lok(SUCCEEDED(r), "GetDescription failed (0x%08x)\n", r);
|
||||
lok(r == S_OK, "GetDescription failed (0x%08x)\n", r);
|
||||
lok_todo_4(0x1, lstrcmp(buffer, desc->description)==0,
|
||||
"GetDescription returned '%s' instead of '%s'\n",
|
||||
buffer, desc->description);
|
||||
|
@ -481,7 +555,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int todo)
|
|||
{
|
||||
strcpy(buffer,"garbage");
|
||||
r = IShellLinkA_GetWorkingDirectory(sl, buffer, sizeof(buffer));
|
||||
lok(SUCCEEDED(r), "GetWorkingDirectory failed (0x%08x)\n", r);
|
||||
lok(r == S_OK, "GetWorkingDirectory failed (0x%08x)\n", r);
|
||||
lok_todo_4(0x2, lstrcmpi(buffer, desc->workdir)==0,
|
||||
"GetWorkingDirectory returned '%s' instead of '%s'\n",
|
||||
buffer, desc->workdir);
|
||||
|
@ -499,7 +573,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int todo)
|
|||
{
|
||||
LPITEMIDLIST pidl=NULL;
|
||||
r = IShellLinkA_GetIDList(sl, &pidl);
|
||||
lok(SUCCEEDED(r), "GetIDList failed (0x%08x)\n", r);
|
||||
lok(r == S_OK, "GetIDList failed (0x%08x)\n", r);
|
||||
lok_todo_2(0x8, pILIsEqual(pidl, desc->pidl),
|
||||
"GetIDList returned an incorrect pidl\n");
|
||||
}
|
||||
|
@ -507,7 +581,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int todo)
|
|||
{
|
||||
int i=0xdeadbeef;
|
||||
r = IShellLinkA_GetShowCmd(sl, &i);
|
||||
lok(SUCCEEDED(r), "GetShowCmd failed (0x%08x)\n", r);
|
||||
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);
|
||||
|
@ -517,7 +591,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int todo)
|
|||
int i=0xdeadbeef;
|
||||
strcpy(buffer,"garbage");
|
||||
r = IShellLinkA_GetIconLocation(sl, buffer, sizeof(buffer), &i);
|
||||
lok(SUCCEEDED(r), "GetIconLocation failed (0x%08x)\n", r);
|
||||
lok(r == S_OK, "GetIconLocation failed (0x%08x)\n", r);
|
||||
lok_todo_4(0x20, lstrcmpi(buffer, desc->icon)==0,
|
||||
"GetIconLocation returned '%s' instead of '%s'\n",
|
||||
buffer, desc->icon);
|
||||
|
@ -529,7 +603,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int todo)
|
|||
{
|
||||
WORD i=0xbeef;
|
||||
r = IShellLinkA_GetHotkey(sl, &i);
|
||||
lok(SUCCEEDED(r), "GetHotkey failed (0x%08x)\n", r);
|
||||
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);
|
||||
|
@ -744,10 +818,11 @@ static void test_datalink(void)
|
|||
r = IShellLinkW_SetPath(sl, lnk);
|
||||
ok(r == S_OK, "set path failed\n");
|
||||
|
||||
/*
|
||||
* The following crashes:
|
||||
* r = IShellLinkDataList_GetFlags( dl, NULL );
|
||||
*/
|
||||
if (0)
|
||||
{
|
||||
/* the following crashes */
|
||||
r = IShellLinkDataList_GetFlags( dl, NULL );
|
||||
}
|
||||
|
||||
flags = 0;
|
||||
r = IShellLinkDataList_GetFlags( dl, &flags );
|
||||
|
@ -812,8 +887,8 @@ START_TEST(shelllink)
|
|||
pGetShortPathNameA = (void *)GetProcAddress(hkernel32, "GetShortPathNameA");
|
||||
|
||||
r = CoInitialize(NULL);
|
||||
ok(SUCCEEDED(r), "CoInitialize failed (0x%08x)\n", r);
|
||||
if (FAILED(r))
|
||||
ok(r == S_OK, "CoInitialize failed (0x%08x)\n", r);
|
||||
if (r != S_OK)
|
||||
return;
|
||||
|
||||
test_get_set();
|
||||
|
|
|
@ -201,7 +201,7 @@ static void loadShell32(void)
|
|||
{
|
||||
HRESULT hr = pSHGetMalloc(&pMalloc);
|
||||
|
||||
ok(SUCCEEDED(hr), "SHGetMalloc failed: 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "SHGetMalloc failed: 0x%08x\n", hr);
|
||||
ok(pMalloc != NULL, "SHGetMalloc returned a NULL IMalloc\n");
|
||||
}
|
||||
|
||||
|
@ -303,92 +303,66 @@ static const char *printGUID(const GUID *guid, char * guidSTR)
|
|||
return guidSTR;
|
||||
}
|
||||
|
||||
static void testSHGetFolderLocationInvalidArgs(void)
|
||||
{
|
||||
LPITEMIDLIST pidl;
|
||||
HRESULT hr;
|
||||
|
||||
if (!pSHGetFolderLocation) return;
|
||||
|
||||
/* check a bogus CSIDL: */
|
||||
pidl = NULL;
|
||||
hr = pSHGetFolderLocation(NULL, 0xeeee, NULL, 0, &pidl);
|
||||
ok(hr == E_INVALIDARG,
|
||||
"SHGetFolderLocation(NULL, 0xeeee, NULL, 0, &pidl) returned 0x%08x, expected E_INVALIDARG\n", hr);
|
||||
if (SUCCEEDED(hr))
|
||||
IMalloc_Free(pMalloc, pidl);
|
||||
/* check a bogus user token: */
|
||||
pidl = NULL;
|
||||
hr = pSHGetFolderLocation(NULL, CSIDL_FAVORITES, (HANDLE)2, 0, &pidl);
|
||||
ok(hr == E_FAIL || hr == E_HANDLE,
|
||||
"SHGetFolderLocation(NULL, CSIDL_FAVORITES, 2, 0, &pidl) returned 0x%08x, expected E_FAIL or E_HANDLE\n", hr);
|
||||
if (SUCCEEDED(hr))
|
||||
IMalloc_Free(pMalloc, pidl);
|
||||
/* a NULL pidl pointer crashes, so don't test it */
|
||||
}
|
||||
|
||||
static void testSHGetSpecialFolderLocationInvalidArgs(void)
|
||||
static void test_parameters(void)
|
||||
{
|
||||
LPITEMIDLIST pidl = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
if (!pSHGetSpecialFolderLocation) return;
|
||||
|
||||
/* SHGetSpecialFolderLocation(NULL, 0, NULL) crashes */
|
||||
hr = pSHGetSpecialFolderLocation(NULL, 0xeeee, &pidl);
|
||||
ok(hr == E_INVALIDARG,
|
||||
"SHGetSpecialFolderLocation(NULL, 0xeeee, &pidl) returned 0x%08x, "
|
||||
"expected E_INVALIDARG\n", hr);
|
||||
}
|
||||
|
||||
static void testSHGetFolderPathInvalidArgs(void)
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
HRESULT hr;
|
||||
|
||||
if (!pSHGetFolderPathA) return;
|
||||
if (pSHGetFolderLocation)
|
||||
{
|
||||
/* check a bogus CSIDL: */
|
||||
pidl = NULL;
|
||||
hr = pSHGetFolderLocation(NULL, 0xeeee, NULL, 0, &pidl);
|
||||
ok(hr == E_INVALIDARG, "got 0x%08x, expected E_INVALIDARG\n", hr);
|
||||
if (hr == S_OK) IMalloc_Free(pMalloc, pidl);
|
||||
|
||||
/* expect 2's a bogus handle, especially since we didn't open it */
|
||||
hr = pSHGetFolderPathA(NULL, CSIDL_DESKTOP, (HANDLE)2,
|
||||
SHGFP_TYPE_DEFAULT, path);
|
||||
ok(hr == E_FAIL ||
|
||||
hr == E_HANDLE || /* Windows Vista and 2008 */
|
||||
broken(hr == S_OK), /* Windows 2000 and Me */
|
||||
"SHGetFolderPathA(NULL, CSIDL_DESKTOP, 2, SHGFP_TYPE_DEFAULT, path) returned 0x%08x, expected E_FAIL\n", hr);
|
||||
hr = pSHGetFolderPathA(NULL, 0xeeee, NULL, SHGFP_TYPE_DEFAULT, path);
|
||||
ok(hr == E_INVALIDARG,
|
||||
"SHGetFolderPathA(NULL, 0xeeee, NULL, SHGFP_TYPE_DEFAULT, path) returned 0x%08x, expected E_INVALIDARG\n", hr);
|
||||
}
|
||||
/* check a bogus user token: */
|
||||
pidl = NULL;
|
||||
hr = pSHGetFolderLocation(NULL, CSIDL_FAVORITES, (HANDLE)2, 0, &pidl);
|
||||
ok(hr == E_FAIL || hr == E_HANDLE, "got 0x%08x, expected E_FAIL or E_HANDLE\n", hr);
|
||||
if (hr == S_OK) IMalloc_Free(pMalloc, pidl);
|
||||
|
||||
static void testSHGetSpecialFolderPathInvalidArgs(void)
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
BOOL ret;
|
||||
/* a NULL pidl pointer crashes, so don't test it */
|
||||
}
|
||||
|
||||
if (!pSHGetSpecialFolderPathA) return;
|
||||
if (pSHGetSpecialFolderLocation)
|
||||
{
|
||||
if (0)
|
||||
/* crashes */
|
||||
SHGetSpecialFolderLocation(NULL, 0, NULL);
|
||||
|
||||
#if 0
|
||||
ret = pSHGetSpecialFolderPathA(NULL, NULL, CSIDL_BITBUCKET, FALSE);
|
||||
ok(!ret,
|
||||
"SHGetSpecialFolderPathA(NULL, NULL, CSIDL_BITBUCKET, FALSE) returned TRUE, expected FALSE\n");
|
||||
#endif
|
||||
/* odd but true: calling with a NULL path still succeeds if it's a real
|
||||
* dir (on some windows platform). on winME it generates exception.
|
||||
*/
|
||||
ret = pSHGetSpecialFolderPathA(NULL, path, CSIDL_PROGRAMS, FALSE);
|
||||
ok(ret,
|
||||
"SHGetSpecialFolderPathA(NULL, path, CSIDL_PROGRAMS, FALSE) returned FALSE, expected TRUE\n");
|
||||
ret = pSHGetSpecialFolderPathA(NULL, path, 0xeeee, FALSE);
|
||||
ok(!ret,
|
||||
"SHGetSpecialFolderPathA(NULL, path, 0xeeee, FALSE) returned TRUE, expected FALSE\n");
|
||||
}
|
||||
hr = pSHGetSpecialFolderLocation(NULL, 0xeeee, &pidl);
|
||||
ok(hr == E_INVALIDARG, "got returned 0x%08x\n", hr);
|
||||
}
|
||||
|
||||
static void testApiParameters(void)
|
||||
{
|
||||
testSHGetFolderLocationInvalidArgs();
|
||||
testSHGetSpecialFolderLocationInvalidArgs();
|
||||
testSHGetFolderPathInvalidArgs();
|
||||
testSHGetSpecialFolderPathInvalidArgs();
|
||||
if (pSHGetFolderPathA)
|
||||
{
|
||||
/* expect 2's a bogus handle, especially since we didn't open it */
|
||||
hr = pSHGetFolderPathA(NULL, CSIDL_DESKTOP, (HANDLE)2, SHGFP_TYPE_DEFAULT, path);
|
||||
ok(hr == E_FAIL || hr == E_HANDLE || /* Vista and 2k8 */
|
||||
broken(hr == S_OK), /* W2k and Me */ "got 0x%08x, expected E_FAIL\n", hr);
|
||||
|
||||
hr = pSHGetFolderPathA(NULL, 0xeeee, NULL, SHGFP_TYPE_DEFAULT, path);
|
||||
ok(hr == E_INVALIDARG, "got 0x%08x, expected E_INVALIDARG\n", hr);
|
||||
}
|
||||
|
||||
if (pSHGetSpecialFolderPathA)
|
||||
{
|
||||
BOOL ret;
|
||||
|
||||
if (0)
|
||||
ret = pSHGetSpecialFolderPathA(NULL, NULL, CSIDL_BITBUCKET, FALSE);
|
||||
|
||||
/* odd but true: calling with a NULL path still succeeds if it's a real
|
||||
* dir (on some windows platform). on winME it generates exception.
|
||||
*/
|
||||
ret = pSHGetSpecialFolderPathA(NULL, path, CSIDL_PROGRAMS, FALSE);
|
||||
ok(ret, "got %d\n", ret);
|
||||
|
||||
ret = pSHGetSpecialFolderPathA(NULL, path, 0xeeee, FALSE);
|
||||
ok(!ret, "got %d\n", ret);
|
||||
}
|
||||
}
|
||||
|
||||
/* Returns the folder's PIDL type, or 0xff if one can't be found. */
|
||||
|
@ -403,7 +377,7 @@ static BYTE testSHGetFolderLocation(int folder)
|
|||
|
||||
pidl = NULL;
|
||||
hr = pSHGetFolderLocation(NULL, folder, NULL, 0, &pidl);
|
||||
if (SUCCEEDED(hr))
|
||||
if (hr == S_OK)
|
||||
{
|
||||
if (pidl)
|
||||
{
|
||||
|
@ -431,7 +405,7 @@ static BYTE testSHGetSpecialFolderLocation(int folder)
|
|||
|
||||
pidl = NULL;
|
||||
hr = pSHGetSpecialFolderLocation(NULL, folder, &pidl);
|
||||
if (SUCCEEDED(hr))
|
||||
if (hr == S_OK)
|
||||
{
|
||||
if (pidl)
|
||||
{
|
||||
|
@ -447,7 +421,7 @@ static BYTE testSHGetSpecialFolderLocation(int folder)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void testSHGetFolderPath(BOOL optional, int folder)
|
||||
static void test_SHGetFolderPath(BOOL optional, int folder)
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
HRESULT hr;
|
||||
|
@ -455,11 +429,11 @@ static void testSHGetFolderPath(BOOL optional, int folder)
|
|||
if (!pSHGetFolderPathA) return;
|
||||
|
||||
hr = pSHGetFolderPathA(NULL, folder, NULL, SHGFP_TYPE_CURRENT, path);
|
||||
ok(SUCCEEDED(hr) || optional,
|
||||
ok(hr == S_OK || optional,
|
||||
"SHGetFolderPathA(NULL, %s, NULL, SHGFP_TYPE_CURRENT, path) failed: 0x%08x\n", getFolderName(folder), hr);
|
||||
}
|
||||
|
||||
static void testSHGetSpecialFolderPath(BOOL optional, int folder)
|
||||
static void test_SHGetSpecialFolderPath(BOOL optional, int folder)
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
BOOL ret;
|
||||
|
@ -474,7 +448,7 @@ static void testSHGetSpecialFolderPath(BOOL optional, int folder)
|
|||
getFolderName(folder));
|
||||
}
|
||||
|
||||
static void testShellValues(const struct shellExpectedValues testEntries[],
|
||||
static void test_ShellValues(const struct shellExpectedValues testEntries[],
|
||||
int numEntries, BOOL optional)
|
||||
{
|
||||
int i;
|
||||
|
@ -509,8 +483,8 @@ static void testShellValues(const struct shellExpectedValues testEntries[],
|
|||
case PT_DRIVE:
|
||||
case PT_DRIVE2:
|
||||
case PT_IESPECIAL2:
|
||||
testSHGetFolderPath(optional, testEntries[i].folder);
|
||||
testSHGetSpecialFolderPath(optional, testEntries[i].folder);
|
||||
test_SHGetFolderPath(optional, testEntries[i].folder);
|
||||
test_SHGetSpecialFolderPath(optional, testEntries[i].folder);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -555,7 +529,7 @@ static void matchGUID(int folder, const GUID *guid, const GUID *guid_alt)
|
|||
|
||||
pidl = NULL;
|
||||
hr = pSHGetFolderLocation(NULL, folder, NULL, 0, &pidl);
|
||||
if (SUCCEEDED(hr))
|
||||
if (hr == S_OK)
|
||||
{
|
||||
LPITEMIDLIST pidlLast = pILFindLastID(pidl);
|
||||
|
||||
|
@ -580,27 +554,22 @@ static void matchGUID(int folder, const GUID *guid, const GUID *guid_alt)
|
|||
}
|
||||
}
|
||||
|
||||
static void testDesktop(void)
|
||||
{
|
||||
testSHGetFolderPath(FALSE, CSIDL_DESKTOP);
|
||||
testSHGetSpecialFolderPath(FALSE, CSIDL_DESKTOP);
|
||||
}
|
||||
|
||||
/* Checks the PIDL type of all the known values. */
|
||||
static void testPidlTypes(void)
|
||||
static void test_PidlTypes(void)
|
||||
{
|
||||
testDesktop();
|
||||
testShellValues(requiredShellValues, ARRAY_SIZE(requiredShellValues),
|
||||
FALSE);
|
||||
testShellValues(optionalShellValues, ARRAY_SIZE(optionalShellValues),
|
||||
TRUE);
|
||||
/* Desktop */
|
||||
test_SHGetFolderPath(FALSE, CSIDL_DESKTOP);
|
||||
test_SHGetSpecialFolderPath(FALSE, CSIDL_DESKTOP);
|
||||
|
||||
test_ShellValues(requiredShellValues, ARRAY_SIZE(requiredShellValues), FALSE);
|
||||
test_ShellValues(optionalShellValues, ARRAY_SIZE(optionalShellValues), TRUE);
|
||||
}
|
||||
|
||||
/* FIXME: Should be in shobjidl.idl */
|
||||
DEFINE_GUID(CLSID_NetworkExplorerFolder, 0xF02C1A0D, 0xBE21, 0x4350, 0x88, 0xB0, 0x73, 0x67, 0xFC, 0x96, 0xEF, 0x3C);
|
||||
|
||||
/* Verifies various shell virtual folders have the correct well-known GUIDs. */
|
||||
static void testGUIDs(void)
|
||||
static void test_GUIDs(void)
|
||||
{
|
||||
matchGUID(CSIDL_BITBUCKET, &CLSID_RecycleBin, NULL);
|
||||
matchGUID(CSIDL_CONTROLS, &CLSID_ControlPanel, NULL);
|
||||
|
@ -609,20 +578,20 @@ static void testGUIDs(void)
|
|||
matchGUID(CSIDL_NETWORK, &CLSID_NetworkPlaces, &CLSID_NetworkExplorerFolder); /* Vista and higher */
|
||||
matchGUID(CSIDL_PERSONAL, &CLSID_MyDocuments, NULL);
|
||||
matchGUID(CSIDL_COMMON_DOCUMENTS, &CLSID_CommonDocuments, NULL);
|
||||
matchGUID(CSIDL_PRINTERS, &CLSID_Printers, NULL);
|
||||
}
|
||||
|
||||
/* Verifies various shell paths match the environment variables to which they
|
||||
* correspond.
|
||||
*/
|
||||
static void testEnvVars(void)
|
||||
static void test_EnvVars(void)
|
||||
{
|
||||
matchSpecialFolderPathToEnv(CSIDL_PROGRAM_FILES, "ProgramFiles");
|
||||
matchSpecialFolderPathToEnv(CSIDL_APPDATA, "APPDATA");
|
||||
matchSpecialFolderPathToEnv(CSIDL_PROFILE, "USERPROFILE");
|
||||
matchSpecialFolderPathToEnv(CSIDL_WINDOWS, "SystemRoot");
|
||||
matchSpecialFolderPathToEnv(CSIDL_WINDOWS, "windir");
|
||||
matchSpecialFolderPathToEnv(CSIDL_PROGRAM_FILES_COMMON,
|
||||
"CommonProgramFiles");
|
||||
matchSpecialFolderPathToEnv(CSIDL_PROGRAM_FILES_COMMON, "CommonProgramFiles");
|
||||
/* this is only set on Wine, but can't hurt to verify it: */
|
||||
matchSpecialFolderPathToEnv(CSIDL_SYSTEM, "winsysdir");
|
||||
}
|
||||
|
@ -715,84 +684,71 @@ static int init(void)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* Subprocess helper 1: test what happens when CSIDL_FAVORITES is set to a
|
||||
* nonexistent directory.
|
||||
*/
|
||||
static void testNonExistentPath1(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
LPITEMIDLIST pidl;
|
||||
char *p, path[MAX_PATH];
|
||||
|
||||
/* test some failure cases first: */
|
||||
hr = pSHGetFolderPathA(NULL, CSIDL_FAVORITES, NULL,
|
||||
SHGFP_TYPE_CURRENT, path);
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
|
||||
"SHGetFolderPath returned 0x%08x, expected 0x80070002\n", hr);
|
||||
pidl = NULL;
|
||||
hr = pSHGetFolderLocation(NULL, CSIDL_FAVORITES, NULL, 0,
|
||||
&pidl);
|
||||
ok(hr == E_FAIL || hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
|
||||
"SHGetFolderLocation returned 0x%08x\n", hr);
|
||||
if (SUCCEEDED(hr) && pidl)
|
||||
IMalloc_Free(pMalloc, pidl);
|
||||
ok(!pSHGetSpecialFolderPathA(NULL, path, CSIDL_FAVORITES, FALSE),
|
||||
"SHGetSpecialFolderPath succeeded, expected failure\n");
|
||||
pidl = NULL;
|
||||
hr = pSHGetSpecialFolderLocation(NULL, CSIDL_FAVORITES, &pidl);
|
||||
ok(hr == E_FAIL || hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
|
||||
"SHGetFolderLocation returned 0x%08x\n", hr);
|
||||
if (SUCCEEDED(hr) && pidl)
|
||||
IMalloc_Free(pMalloc, pidl);
|
||||
/* now test success: */
|
||||
hr = pSHGetFolderPathA(NULL, CSIDL_FAVORITES | CSIDL_FLAG_CREATE, NULL,
|
||||
SHGFP_TYPE_CURRENT, path);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
BOOL ret;
|
||||
|
||||
trace("CSIDL_FAVORITES was changed to %s\n", path);
|
||||
ret = CreateDirectoryA(path, NULL);
|
||||
ok(!ret,
|
||||
"CreateDirectoryA succeeded but should have failed "
|
||||
"with ERROR_ALREADY_EXISTS\n");
|
||||
if (!ret)
|
||||
ok(GetLastError() == ERROR_ALREADY_EXISTS,
|
||||
"CreateDirectoryA failed with %d, "
|
||||
"expected ERROR_ALREADY_EXISTS\n",
|
||||
GetLastError());
|
||||
p = path + strlen(path);
|
||||
strcpy(p, "\\desktop.ini");
|
||||
DeleteFileA(path);
|
||||
*p = 0;
|
||||
SetFileAttributesA( path, FILE_ATTRIBUTE_NORMAL );
|
||||
ret = RemoveDirectoryA(path);
|
||||
ok( ret, "failed to remove %s error %u\n", path, GetLastError() );
|
||||
}
|
||||
ok(SUCCEEDED(hr),
|
||||
"SHGetFolderPath(NULL, CSIDL_FAVORITES | CSIDL_FLAG_CREATE, "
|
||||
"NULL, SHGFP_TYPE_CURRENT, path) failed: 0x%08x\n", hr);
|
||||
}
|
||||
|
||||
/* Subprocess helper 2: make sure SHGetFolderPath still succeeds when the
|
||||
* original value of CSIDL_FAVORITES is restored.
|
||||
*/
|
||||
static void testNonExistentPath2(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
char path[MAX_PATH];
|
||||
|
||||
hr = pSHGetFolderPathA(NULL, CSIDL_FAVORITES | CSIDL_FLAG_CREATE, NULL,
|
||||
SHGFP_TYPE_CURRENT, path);
|
||||
ok(SUCCEEDED(hr), "SHGetFolderPath failed: 0x%08x\n", hr);
|
||||
}
|
||||
|
||||
static void doChild(const char *arg)
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
HRESULT hr;
|
||||
|
||||
if (arg[0] == '1')
|
||||
testNonExistentPath1();
|
||||
{
|
||||
LPITEMIDLIST pidl;
|
||||
char *p;
|
||||
|
||||
/* test what happens when CSIDL_FAVORITES is set to a nonexistent directory */
|
||||
|
||||
/* test some failure cases first: */
|
||||
hr = pSHGetFolderPathA(NULL, CSIDL_FAVORITES, NULL, SHGFP_TYPE_CURRENT, path);
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
|
||||
"SHGetFolderPath returned 0x%08x, expected 0x80070002\n", hr);
|
||||
|
||||
pidl = NULL;
|
||||
hr = pSHGetFolderLocation(NULL, CSIDL_FAVORITES, NULL, 0, &pidl);
|
||||
ok(hr == E_FAIL || hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
|
||||
"SHGetFolderLocation returned 0x%08x\n", hr);
|
||||
if (hr == S_OK && pidl) IMalloc_Free(pMalloc, pidl);
|
||||
|
||||
ok(!pSHGetSpecialFolderPathA(NULL, path, CSIDL_FAVORITES, FALSE),
|
||||
"SHGetSpecialFolderPath succeeded, expected failure\n");
|
||||
|
||||
pidl = NULL;
|
||||
hr = pSHGetSpecialFolderLocation(NULL, CSIDL_FAVORITES, &pidl);
|
||||
ok(hr == E_FAIL || hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
|
||||
"SHGetFolderLocation returned 0x%08x\n", hr);
|
||||
|
||||
if (hr == S_OK && pidl) IMalloc_Free(pMalloc, pidl);
|
||||
|
||||
/* now test success: */
|
||||
hr = pSHGetFolderPathA(NULL, CSIDL_FAVORITES | CSIDL_FLAG_CREATE, NULL,
|
||||
SHGFP_TYPE_CURRENT, path);
|
||||
ok (hr == S_OK, "got 0x%08x\n", hr);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
BOOL ret;
|
||||
|
||||
trace("CSIDL_FAVORITES was changed to %s\n", path);
|
||||
ret = CreateDirectoryA(path, NULL);
|
||||
ok(!ret, "expected failure with ERROR_ALREADY_EXISTS\n");
|
||||
if (!ret)
|
||||
ok(GetLastError() == ERROR_ALREADY_EXISTS,
|
||||
"got %d, expected ERROR_ALREADY_EXISTS\n", GetLastError());
|
||||
|
||||
p = path + strlen(path);
|
||||
strcpy(p, "\\desktop.ini");
|
||||
DeleteFileA(path);
|
||||
*p = 0;
|
||||
SetFileAttributesA( path, FILE_ATTRIBUTE_NORMAL );
|
||||
ret = RemoveDirectoryA(path);
|
||||
ok( ret, "failed to remove %s error %u\n", path, GetLastError() );
|
||||
}
|
||||
}
|
||||
else if (arg[0] == '2')
|
||||
testNonExistentPath2();
|
||||
{
|
||||
/* make sure SHGetFolderPath still succeeds when the
|
||||
original value of CSIDL_FAVORITES is restored. */
|
||||
hr = pSHGetFolderPathA(NULL, CSIDL_FAVORITES | CSIDL_FLAG_CREATE, NULL,
|
||||
SHGFP_TYPE_CURRENT, path);
|
||||
ok(hr == S_OK, "SHGetFolderPath failed: 0x%08x\n", hr);
|
||||
}
|
||||
}
|
||||
|
||||
/* Tests the return values from the various shell functions both with and
|
||||
|
@ -808,7 +764,7 @@ static void doChild(const char *arg)
|
|||
* covered by other unit tests; I just print out something about failure to
|
||||
* help trace what's going on.
|
||||
*/
|
||||
static void testNonExistentPath(void)
|
||||
static void test_NonExistentPath(void)
|
||||
{
|
||||
static const char userShellFolders[] =
|
||||
"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders";
|
||||
|
@ -884,7 +840,6 @@ START_TEST(shellpath)
|
|||
loadShell32();
|
||||
pGetSystemWow64DirectoryA = (void *)GetProcAddress( GetModuleHandleA("kernel32.dll"),
|
||||
"GetSystemWow64DirectoryA" );
|
||||
|
||||
if (myARGC >= 3)
|
||||
doChild(myARGV[2]);
|
||||
else
|
||||
|
@ -894,14 +849,14 @@ START_TEST(shellpath)
|
|||
win_skip("SHGetFolderLocation is not available\n");
|
||||
|
||||
/* first test various combinations of parameters: */
|
||||
testApiParameters();
|
||||
test_parameters();
|
||||
|
||||
/* check known values: */
|
||||
testPidlTypes();
|
||||
testGUIDs();
|
||||
testEnvVars();
|
||||
test_PidlTypes();
|
||||
test_GUIDs();
|
||||
test_EnvVars();
|
||||
testWinDir();
|
||||
testSystemDir();
|
||||
testNonExistentPath();
|
||||
test_NonExistentPath();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
* Tests for My Network Places shell folder
|
||||
*
|
||||
* Copyright 2008 Robert Shearman for CodeWeavers
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define COBJMACROS
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include "shellapi.h"
|
||||
#include "shlobj.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
static void test_parse_for_entire_network(void)
|
||||
{
|
||||
static const WCHAR entire_network_path[] = {
|
||||
':',':','{','2','0','8','D','2','C','6','0','-','3','A','E','A','-',
|
||||
'1','0','6','9','-','A','2','D','7','-','0','8','0','0','2','B','3','0','3','0','9','D',
|
||||
'}','\\','E','n','t','i','r','e','N','e','t','w','o','r','k',0 };
|
||||
IShellFolder *psfDesktop;
|
||||
HRESULT hr;
|
||||
DWORD eaten = 0xdeadbeef;
|
||||
LPITEMIDLIST pidl;
|
||||
DWORD attr = ~0;
|
||||
DWORD expected_attr;
|
||||
|
||||
hr = SHGetDesktopFolder(&psfDesktop);
|
||||
ok(hr == S_OK, "SHGetDesktopFolder failed with error 0x%x\n", hr);
|
||||
|
||||
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, (LPWSTR)entire_network_path, &eaten, &pidl, &attr);
|
||||
ok(hr == S_OK, "IShellFolder_ParseDisplayName failed with error 0x%x\n", hr);
|
||||
todo_wine
|
||||
ok(eaten == 0xdeadbeef, "eaten should not have been set to %u\n", eaten);
|
||||
expected_attr = SFGAO_HASSUBFOLDER|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR|SFGAO_STORAGEANCESTOR|SFGAO_HASPROPSHEET|SFGAO_CANLINK;
|
||||
todo_wine
|
||||
ok(attr == expected_attr, "attr should be 0x%x, not 0x%x\n", expected_attr, attr);
|
||||
|
||||
ILFree(pidl);
|
||||
}
|
||||
|
||||
|
||||
START_TEST(shfldr_netplaces)
|
||||
{
|
||||
test_parse_for_entire_network();
|
||||
}
|
|
@ -23,6 +23,9 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#define COBJMACROS
|
||||
#define NONAMELESSUNION
|
||||
#define NONAMELESSSTRUCT
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include "shellapi.h"
|
||||
|
@ -30,6 +33,11 @@
|
|||
|
||||
#include "wine/test.h"
|
||||
|
||||
static inline BOOL SHELL_OsIsUnicode(void)
|
||||
{
|
||||
return !(GetVersion() & 0x80000000);
|
||||
}
|
||||
|
||||
/* Tests for My Network Places */
|
||||
static void test_parse_for_entire_network(void)
|
||||
{
|
||||
|
@ -119,9 +127,101 @@ static void test_parse_for_control_panel(void)
|
|||
ILFree(pidl);
|
||||
}
|
||||
|
||||
static void test_printers_folder(void)
|
||||
{
|
||||
IShellFolder2 *folder;
|
||||
IPersistFolder2 *pf;
|
||||
SHELLDETAILS details;
|
||||
SHCOLSTATEF state;
|
||||
LPITEMIDLIST pidl1, pidl2;
|
||||
HRESULT hr;
|
||||
INT i;
|
||||
|
||||
CoInitialize( NULL );
|
||||
|
||||
hr = CoCreateInstance(&CLSID_Printers, NULL, CLSCTX_INPROC_SERVER, &IID_IShellFolder2, (void**)&folder);
|
||||
if (hr != S_OK)
|
||||
{
|
||||
win_skip("Failed to created IShellFolder2 for Printers folder\n");
|
||||
CoUninitialize();
|
||||
return;
|
||||
}
|
||||
|
||||
if (0)
|
||||
{
|
||||
/* crashes on XP */
|
||||
hr = IShellFolder2_GetDetailsOf(folder, NULL, 0, NULL);
|
||||
hr = IShellFolder2_GetDefaultColumnState(folder, 0, NULL);
|
||||
hr = IPersistFolder2_GetCurFolder(pf, NULL);
|
||||
}
|
||||
|
||||
/* 5 columns defined */
|
||||
hr = IShellFolder2_GetDetailsOf(folder, NULL, 6, &details);
|
||||
ok(hr == E_NOTIMPL, "got 0x%08x\n", hr);
|
||||
|
||||
hr = IShellFolder2_GetDefaultColumnState(folder, 6, &state);
|
||||
ok(broken(hr == E_NOTIMPL) || hr == E_INVALIDARG /* Win7 */, "got 0x%08x\n", hr);
|
||||
|
||||
hr = IShellFolder2_GetDetailsOf(folder, NULL, 0, &details);
|
||||
ok(hr == S_OK || broken(E_NOTIMPL) /* W2K */, "got 0x%08x\n", hr);
|
||||
/* test every column if method is implemented */
|
||||
if (hr == S_OK)
|
||||
{
|
||||
ok(details.str.uType == STRRET_WSTR, "got %d\n", details.str.uType);
|
||||
|
||||
for(i = 0; i < 6; i++)
|
||||
{
|
||||
hr = IShellFolder2_GetDetailsOf(folder, NULL, i, &details);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
/* all columns are left-aligned */
|
||||
ok(details.fmt == LVCFMT_LEFT, "got 0x%x\n", details.fmt);
|
||||
/* can't be on w9x at this point, IShellFolder2 unsupported there,
|
||||
check present for running Wine with w9x setup */
|
||||
if (SHELL_OsIsUnicode()) SHFree(details.str.u.pOleStr);
|
||||
|
||||
hr = IShellFolder2_GetDefaultColumnState(folder, i, &state);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
/* all columns are string except document count */
|
||||
if (i == 1)
|
||||
ok(state == (SHCOLSTATE_TYPE_INT | SHCOLSTATE_ONBYDEFAULT), "got 0x%x\n", state);
|
||||
else
|
||||
ok(state == (SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT), "got 0x%x\n", state);
|
||||
}
|
||||
}
|
||||
|
||||
/* default pidl */
|
||||
hr = IShellFolder2_QueryInterface(folder, &IID_IPersistFolder2, (void**)&pf);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
/* not initialized */
|
||||
pidl1 = (void*)0xdeadbeef;
|
||||
hr = IPersistFolder2_GetCurFolder(pf, &pidl1);
|
||||
ok(hr == S_FALSE, "got 0x%08x\n", hr);
|
||||
ok(pidl1 == NULL, "got %p\n", pidl1);
|
||||
|
||||
hr = SHGetSpecialFolderLocation(NULL, CSIDL_PRINTERS, &pidl2);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
hr = IPersistFolder2_Initialize(pf, pidl2);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
hr = IPersistFolder2_GetCurFolder(pf, &pidl1);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
ok(ILIsEqual(pidl1, pidl2), "expected same PIDL\n");
|
||||
IPersistFolder2_Release(pf);
|
||||
|
||||
ILFree(pidl1);
|
||||
ILFree(pidl2);
|
||||
IShellFolder2_Release(folder);
|
||||
|
||||
CoUninitialize();
|
||||
}
|
||||
|
||||
START_TEST(shfldr_special)
|
||||
{
|
||||
test_parse_for_entire_network();
|
||||
test_parse_for_control_panel();
|
||||
test_printers_folder();
|
||||
}
|
||||
|
|
|
@ -797,6 +797,10 @@ static const char* testfiles[]=
|
|||
"%s\\test file.sde",
|
||||
"%s\\test file.exe",
|
||||
"%s\\test2.exe",
|
||||
"%s\\simple.shlexec",
|
||||
"%s\\drawback_file.noassoc",
|
||||
"%s\\drawback_file.noassoc foo.shlexec",
|
||||
"%s\\drawback_nonexist.noassoc foo.shlexec",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -852,6 +856,239 @@ static filename_tests_t noquotes_tests[]=
|
|||
{NULL, NULL, 0}
|
||||
};
|
||||
|
||||
static void test_lpFile_parsed(void)
|
||||
{
|
||||
/* basename tmpdir */
|
||||
const char* shorttmpdir;
|
||||
|
||||
const char *testfile;
|
||||
char fileA[MAX_PATH];
|
||||
|
||||
int rc;
|
||||
|
||||
GetTempPathA(sizeof(fileA), fileA);
|
||||
shorttmpdir = tmpdir + strlen(fileA);
|
||||
|
||||
/* ensure tmpdir is in %TEMP%: GetTempPath() can succeed even if TEMP is undefined */
|
||||
SetEnvironmentVariableA("TEMP", fileA);
|
||||
|
||||
/* existing "drawback_file.noassoc" prevents finding "drawback_file.noassoc foo.shlexec" on wine */
|
||||
testfile = "%s\\drawback_file.noassoc foo.shlexec";
|
||||
sprintf(fileA, testfile, tmpdir);
|
||||
rc=shell_execute(NULL, fileA, NULL, NULL);
|
||||
todo_wine {
|
||||
ok(rc>32,
|
||||
"expected success (33), got %s (%d), lpFile: %s\n",
|
||||
rc > 32 ? "success" : "failure", rc, fileA
|
||||
);
|
||||
}
|
||||
|
||||
/* if quoted, existing "drawback_file.noassoc" not prevents finding "drawback_file.noassoc foo.shlexec" on wine */
|
||||
testfile = "\"%s\\drawback_file.noassoc foo.shlexec\"";
|
||||
sprintf(fileA, testfile, tmpdir);
|
||||
rc=shell_execute(NULL, fileA, NULL, NULL);
|
||||
ok(rc>32 || broken(rc == 2) /* Win95/NT4 */,
|
||||
"expected success (33), got %s (%d), lpFile: %s\n",
|
||||
rc > 32 ? "success" : "failure", rc, fileA
|
||||
);
|
||||
|
||||
/* error should be 2, not 31 */
|
||||
testfile = "\"%s\\drawback_file.noassoc\" foo.shlexec";
|
||||
sprintf(fileA, testfile, tmpdir);
|
||||
rc=shell_execute(NULL, fileA, NULL, NULL);
|
||||
ok(rc==2,
|
||||
"expected failure (2), got %s (%d), lpFile: %s\n",
|
||||
rc > 32 ? "success" : "failure", rc, fileA
|
||||
);
|
||||
|
||||
/* ""command"" not works on wine (and real win9x and w2k) */
|
||||
testfile = "\"\"%s\\simple.shlexec\"\"";
|
||||
sprintf(fileA, testfile, tmpdir);
|
||||
rc=shell_execute(NULL, fileA, NULL, NULL);
|
||||
todo_wine {
|
||||
ok(rc>32 || broken(rc == 2) /* Win9x/2000 */,
|
||||
"expected success (33), got %s (%d), lpFile: %s\n",
|
||||
rc > 32 ? "success" : "failure", rc, fileA
|
||||
);
|
||||
}
|
||||
|
||||
/* nonexisting "drawback_nonexist.noassoc" not prevents finding "drawback_nonexist.noassoc foo.shlexec" on wine */
|
||||
testfile = "%s\\drawback_nonexist.noassoc foo.shlexec";
|
||||
sprintf(fileA, testfile, tmpdir);
|
||||
rc=shell_execute(NULL, fileA, NULL, NULL);
|
||||
ok(rc>32,
|
||||
"expected success (33), got %s (%d), lpFile: %s\n",
|
||||
rc > 32 ? "success" : "failure", rc, fileA
|
||||
);
|
||||
|
||||
/* is SEE_MASK_DOENVSUBST default flag? Should only be when XP emulates 9x (XP bug or real 95 or ME behavior ?) */
|
||||
testfile = "%%TEMP%%\\%s\\simple.shlexec";
|
||||
sprintf(fileA, testfile, shorttmpdir);
|
||||
rc=shell_execute(NULL, fileA, NULL, NULL);
|
||||
todo_wine {
|
||||
ok(rc==2,
|
||||
"expected failure (2), got %s (%d), lpFile: %s\n",
|
||||
rc > 32 ? "success" : "failure", rc, fileA
|
||||
);
|
||||
}
|
||||
|
||||
/* quoted */
|
||||
testfile = "\"%%TEMP%%\\%s\\simple.shlexec\"";
|
||||
sprintf(fileA, testfile, shorttmpdir);
|
||||
rc=shell_execute(NULL, fileA, NULL, NULL);
|
||||
todo_wine {
|
||||
ok(rc==2,
|
||||
"expected failure (2), got %s (%d), lpFile: %s\n",
|
||||
rc > 32 ? "success" : "failure", rc, fileA
|
||||
);
|
||||
}
|
||||
|
||||
/* test SEE_MASK_DOENVSUBST works */
|
||||
testfile = "%%TEMP%%\\%s\\simple.shlexec";
|
||||
sprintf(fileA, testfile, shorttmpdir);
|
||||
rc=shell_execute_ex(SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI, NULL, fileA, NULL, NULL);
|
||||
ok(rc>32,
|
||||
"expected success (33), got %s (%d), lpFile: %s\n",
|
||||
rc > 32 ? "success" : "failure", rc, fileA
|
||||
);
|
||||
|
||||
/* quoted lpFile not works only on real win95 and nt4 */
|
||||
testfile = "\"%%TEMP%%\\%s\\simple.shlexec\"";
|
||||
sprintf(fileA, testfile, shorttmpdir);
|
||||
rc=shell_execute_ex(SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI, NULL, fileA, NULL, NULL);
|
||||
ok(rc>32 || broken(rc == 2) /* Win95/NT4 */,
|
||||
"expected success (33), got %s (%d), lpFile: %s\n",
|
||||
rc > 32 ? "success" : "failure", rc, fileA
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
static void test_argify(void)
|
||||
{
|
||||
char fileA[MAX_PATH];
|
||||
|
||||
int rc;
|
||||
|
||||
sprintf(fileA, "%s\\test file.shlexec", tmpdir);
|
||||
|
||||
/* %2 */
|
||||
rc=shell_execute("NoQuotesParam2", fileA, "a b", NULL);
|
||||
ok(rc>32,
|
||||
"expected success (33), got %s (%d), lpFile: %s\n",
|
||||
rc > 32 ? "success" : "failure", rc, fileA
|
||||
);
|
||||
if (rc>32)
|
||||
{
|
||||
okChildInt("argcA", 5);
|
||||
okChildString("argvA4", "a");
|
||||
}
|
||||
|
||||
/* %2 */
|
||||
/* '"a"""' -> 'a"' */
|
||||
rc=shell_execute("NoQuotesParam2", fileA, "\"a:\"\"some string\"\"\"", NULL);
|
||||
ok(rc>32,
|
||||
"expected success (33), got %s (%d), lpFile: %s\n",
|
||||
rc > 32 ? "success" : "failure", rc, fileA
|
||||
);
|
||||
if (rc>32)
|
||||
{
|
||||
okChildInt("argcA", 5);
|
||||
todo_wine {
|
||||
okChildString("argvA4", "a:some string");
|
||||
}
|
||||
}
|
||||
|
||||
/* %2 */
|
||||
/* backslash isn't escape char
|
||||
* '"a\""' -> '"a\""' */
|
||||
rc=shell_execute("NoQuotesParam2", fileA, "\"a:\\\"some string\\\"\"", NULL);
|
||||
ok(rc>32,
|
||||
"expected success (33), got %s (%d), lpFile: %s\n",
|
||||
rc > 32 ? "success" : "failure", rc, fileA
|
||||
);
|
||||
if (rc>32)
|
||||
{
|
||||
okChildInt("argcA", 5);
|
||||
todo_wine {
|
||||
okChildString("argvA4", "a:\\");
|
||||
}
|
||||
}
|
||||
|
||||
/* "%2" */
|
||||
/* \t isn't whitespace */
|
||||
rc=shell_execute("QuotedParam2", fileA, "a\tb c", NULL);
|
||||
ok(rc>32,
|
||||
"expected success (33), got %s (%d), lpFile: %s\n",
|
||||
rc > 32 ? "success" : "failure", rc, fileA
|
||||
);
|
||||
if (rc>32)
|
||||
{
|
||||
okChildInt("argcA", 5);
|
||||
todo_wine {
|
||||
okChildString("argvA4", "a\tb");
|
||||
}
|
||||
}
|
||||
|
||||
/* %* */
|
||||
rc=shell_execute("NoQuotesAllParams", fileA, "a b c d e f g h", NULL);
|
||||
ok(rc>32,
|
||||
"expected success (33), got %s (%d), lpFile: %s\n",
|
||||
rc > 32 ? "success" : "failure", rc, fileA
|
||||
);
|
||||
if (rc>32)
|
||||
{
|
||||
todo_wine {
|
||||
okChildInt("argcA", 12);
|
||||
okChildString("argvA4", "a");
|
||||
okChildString("argvA11", "h");
|
||||
}
|
||||
}
|
||||
|
||||
/* %* can sometimes contain only whitespaces and no args */
|
||||
rc=shell_execute("QuotedAllParams", fileA, " ", NULL);
|
||||
ok(rc>32,
|
||||
"expected success (33), got %s (%d), lpFile: %s\n",
|
||||
rc > 32 ? "success" : "failure", rc, fileA
|
||||
);
|
||||
if (rc>32)
|
||||
{
|
||||
todo_wine {
|
||||
okChildInt("argcA", 5);
|
||||
okChildString("argvA4", " ");
|
||||
}
|
||||
}
|
||||
|
||||
/* %~3 */
|
||||
rc=shell_execute("NoQuotesParams345etc", fileA, "a b c d e f g h", NULL);
|
||||
ok(rc>32,
|
||||
"expected success (33), got %s (%d), lpFile: %s\n",
|
||||
rc > 32 ? "success" : "failure", rc, fileA
|
||||
);
|
||||
if (rc>32)
|
||||
{
|
||||
todo_wine {
|
||||
okChildInt("argcA", 11);
|
||||
okChildString("argvA4", "b");
|
||||
okChildString("argvA10", "h");
|
||||
}
|
||||
}
|
||||
|
||||
/* %~3 is rest of command line starting with whitespaces after 2nd arg */
|
||||
rc=shell_execute("QuotedParams345etc", fileA, "a ", NULL);
|
||||
ok(rc>32,
|
||||
"expected success (33), got %s (%d), lpFile: %s\n",
|
||||
rc > 32 ? "success" : "failure", rc, fileA
|
||||
);
|
||||
if (rc>32)
|
||||
{
|
||||
okChildInt("argcA", 5);
|
||||
todo_wine {
|
||||
okChildString("argvA4", " ");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void test_filename(void)
|
||||
{
|
||||
char filename[MAX_PATH];
|
||||
|
@ -1744,7 +1981,7 @@ static void init_test(void)
|
|||
}
|
||||
|
||||
r = CoInitialize(NULL);
|
||||
ok(SUCCEEDED(r), "CoInitialize failed (0x%08x)\n", r);
|
||||
ok(r == S_OK, "CoInitialize failed (0x%08x)\n", r);
|
||||
if (FAILED(r))
|
||||
exit(1);
|
||||
|
||||
|
@ -1825,6 +2062,15 @@ static void init_test(void)
|
|||
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", "NoQuotesParam2", 0, "NoQuotesParam2 %2");
|
||||
create_test_verb(".shlexec", "QuotedParam2", 0, "QuotedParam2 \"%2\"");
|
||||
|
||||
create_test_verb(".shlexec", "NoQuotesAllParams", 0, "NoQuotesAllParams %*");
|
||||
create_test_verb(".shlexec", "QuotedAllParams", 0, "QuotedAllParams \"%*\"");
|
||||
|
||||
create_test_verb(".shlexec", "NoQuotesParams345etc", 0, "NoQuotesParams345etc %~3");
|
||||
create_test_verb(".shlexec", "QuotedParams345etc", 0, "QuotedParams345etc \"%~3\"");
|
||||
}
|
||||
|
||||
static void cleanup_test(void)
|
||||
|
@ -1938,6 +2184,8 @@ START_TEST(shlexec)
|
|||
|
||||
init_test();
|
||||
|
||||
test_argify();
|
||||
test_lpFile_parsed();
|
||||
test_filename();
|
||||
test_find_executable();
|
||||
test_lnks();
|
||||
|
|
|
@ -60,6 +60,7 @@ static void init_function_pointers(void)
|
|||
{
|
||||
HMODULE hmod;
|
||||
HRESULT hr;
|
||||
void *ptr;
|
||||
|
||||
hmod = GetModuleHandleA("shell32.dll");
|
||||
|
||||
|
@ -81,6 +82,33 @@ static void init_function_pointers(void)
|
|||
MAKEFUNC_ORD(ILFree, 155);
|
||||
#undef MAKEFUNC_ORD
|
||||
|
||||
/* test named exports */
|
||||
ptr = GetProcAddress(hmod, "ILFree");
|
||||
ok(broken(ptr == 0) || ptr != 0, "expected named export for ILFree\n");
|
||||
if (ptr)
|
||||
{
|
||||
#define TESTNAMED(f) \
|
||||
ptr = (void*)GetProcAddress(hmod, #f); \
|
||||
ok(ptr != 0, "expected named export for " #f "\n");
|
||||
|
||||
TESTNAMED(ILAppendID);
|
||||
TESTNAMED(ILClone);
|
||||
TESTNAMED(ILCloneFirst);
|
||||
TESTNAMED(ILCombine);
|
||||
TESTNAMED(ILCreateFromPath);
|
||||
TESTNAMED(ILCreateFromPathA);
|
||||
TESTNAMED(ILCreateFromPathW);
|
||||
TESTNAMED(ILFindChild);
|
||||
TESTNAMED(ILFindLastID);
|
||||
TESTNAMED(ILGetNext);
|
||||
TESTNAMED(ILGetSize);
|
||||
TESTNAMED(ILIsEqual);
|
||||
TESTNAMED(ILIsParent);
|
||||
TESTNAMED(ILRemoveLastID);
|
||||
TESTNAMED(ILSaveToStream);
|
||||
#undef TESTNAMED
|
||||
}
|
||||
|
||||
hmod = GetModuleHandleA("shlwapi.dll");
|
||||
pStrRetToBufW = (void*)GetProcAddress(hmod, "StrRetToBufW");
|
||||
|
||||
|
@ -102,6 +130,7 @@ static void test_ParseDisplayName(void)
|
|||
BOOL bRes;
|
||||
|
||||
hr = SHGetDesktopFolder(&IDesktopFolder);
|
||||
ok(hr == S_OK, "Expected SHGetDesktopFolder to return S_OK, got 0x%08x\n", hr);
|
||||
if(hr != S_OK) return;
|
||||
|
||||
/* Tests crash on W2K and below (SHCreateShellItem available as of XP) */
|
||||
|
@ -125,9 +154,9 @@ static void test_ParseDisplayName(void)
|
|||
MultiByteToWideChar(CP_ACP, 0, cInetTestA, -1, cTestDirW, MAX_PATH);
|
||||
hr = IShellFolder_ParseDisplayName(IDesktopFolder,
|
||||
NULL, NULL, cTestDirW, NULL, &newPIDL, 0);
|
||||
todo_wine ok((SUCCEEDED(hr) || broken(hr == E_FAIL) /* NT4 */),
|
||||
todo_wine ok(hr == S_OK || broken(hr == E_FAIL) /* NT4 */,
|
||||
"ParseDisplayName returned %08x, expected SUCCESS or E_FAIL\n", hr);
|
||||
if (SUCCEEDED(hr))
|
||||
if (hr == S_OK)
|
||||
{
|
||||
ok(pILFindLastID(newPIDL)->mkid.abID[0] == 0x61, "Last pidl should be of type "
|
||||
"PT_IESPECIAL1, but is: %02x\n", pILFindLastID(newPIDL)->mkid.abID[0]);
|
||||
|
@ -137,9 +166,9 @@ static void test_ParseDisplayName(void)
|
|||
MultiByteToWideChar(CP_ACP, 0, cInetTest2A, -1, cTestDirW, MAX_PATH);
|
||||
hr = IShellFolder_ParseDisplayName(IDesktopFolder,
|
||||
NULL, NULL, cTestDirW, NULL, &newPIDL, 0);
|
||||
todo_wine ok((SUCCEEDED(hr) || broken(hr == E_FAIL) /* NT4 */),
|
||||
todo_wine ok(hr == S_OK || broken(hr == E_FAIL) /* NT4 */,
|
||||
"ParseDisplayName returned %08x, expected SUCCESS or E_FAIL\n", hr);
|
||||
if (SUCCEEDED(hr))
|
||||
if (hr == S_OK)
|
||||
{
|
||||
ok(pILFindLastID(newPIDL)->mkid.abID[0] == 0x61, "Last pidl should be of type "
|
||||
"PT_IESPECIAL1, but is: %02x\n", pILFindLastID(newPIDL)->mkid.abID[0]);
|
||||
|
@ -147,7 +176,11 @@ static void test_ParseDisplayName(void)
|
|||
}
|
||||
|
||||
res = GetFileAttributesA(cNonExistDir1A);
|
||||
if(res != INVALID_FILE_ATTRIBUTES) return;
|
||||
if(res != INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
skip("Test directory unexpectedly exists\n");
|
||||
goto finished;
|
||||
}
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, cNonExistDir1A, -1, cTestDirW, MAX_PATH);
|
||||
hr = IShellFolder_ParseDisplayName(IDesktopFolder,
|
||||
|
@ -156,7 +189,11 @@ static void test_ParseDisplayName(void)
|
|||
"ParseDisplayName returned %08x, expected 80070002 or E_FAIL\n", hr);
|
||||
|
||||
res = GetFileAttributesA(cNonExistDir2A);
|
||||
if(res != INVALID_FILE_ATTRIBUTES) return;
|
||||
if(res != INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
skip("Test directory unexpectedly exists\n");
|
||||
goto finished;
|
||||
}
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, cNonExistDir2A, -1, cTestDirW, MAX_PATH);
|
||||
hr = IShellFolder_ParseDisplayName(IDesktopFolder,
|
||||
|
@ -167,15 +204,19 @@ static void test_ParseDisplayName(void)
|
|||
/* I thought that perhaps the DesktopFolder's ParseDisplayName would recognize the
|
||||
* path corresponding to CSIDL_PERSONAL and return a CLSID_MyDocuments PIDL. Turns
|
||||
* out it doesn't. The magic seems to happen in the file dialogs, then. */
|
||||
if (!pSHGetSpecialFolderPathW || !pILFindLastID) goto finished;
|
||||
|
||||
if (!pSHGetSpecialFolderPathW || !pILFindLastID)
|
||||
{
|
||||
win_skip("SHGetSpecialFolderPathW and/or ILFindLastID are not available\n");
|
||||
goto finished;
|
||||
}
|
||||
|
||||
bRes = pSHGetSpecialFolderPathW(NULL, cTestDirW, CSIDL_PERSONAL, FALSE);
|
||||
ok(bRes, "SHGetSpecialFolderPath(CSIDL_PERSONAL) failed! %u\n", GetLastError());
|
||||
if (!bRes) goto finished;
|
||||
|
||||
hr = IShellFolder_ParseDisplayName(IDesktopFolder, NULL, NULL, cTestDirW, NULL, &newPIDL, 0);
|
||||
ok(SUCCEEDED(hr), "DesktopFolder->ParseDisplayName failed. hr = %08x.\n", hr);
|
||||
if (FAILED(hr)) goto finished;
|
||||
ok(hr == S_OK, "DesktopFolder->ParseDisplayName failed. hr = %08x.\n", hr);
|
||||
if (hr != S_OK) goto finished;
|
||||
|
||||
ok(pILFindLastID(newPIDL)->mkid.abID[0] == 0x31 ||
|
||||
pILFindLastID(newPIDL)->mkid.abID[0] == 0xb1, /* Win98 */
|
||||
|
@ -331,8 +372,8 @@ static void test_BindToObject(void)
|
|||
* with an empty pidl. This is tested for Desktop, MyComputer and the FS ShellFolder
|
||||
*/
|
||||
hr = SHGetDesktopFolder(&psfDesktop);
|
||||
ok (SUCCEEDED(hr), "SHGetDesktopFolder failed! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) return;
|
||||
ok (hr == S_OK, "SHGetDesktopFolder failed! hr = %08x\n", hr);
|
||||
if (hr != S_OK) return;
|
||||
|
||||
hr = IShellFolder_BindToObject(psfDesktop, pidlEmpty, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
|
||||
ok (hr == E_INVALIDARG, "Desktop's BindToObject should fail, when called with empty pidl! hr = %08x\n", hr);
|
||||
|
@ -341,17 +382,17 @@ static void test_BindToObject(void)
|
|||
ok (hr == E_INVALIDARG, "Desktop's BindToObject should fail, when called with NULL pidl! hr = %08x\n", hr);
|
||||
|
||||
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszMyComputer, NULL, &pidlMyComputer, NULL);
|
||||
ok (SUCCEEDED(hr), "Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) {
|
||||
ok (hr == S_OK, "Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08x\n", hr);
|
||||
if (hr != S_OK) {
|
||||
IShellFolder_Release(psfDesktop);
|
||||
return;
|
||||
}
|
||||
|
||||
hr = IShellFolder_BindToObject(psfDesktop, pidlMyComputer, NULL, &IID_IShellFolder, (LPVOID*)&psfMyComputer);
|
||||
ok (SUCCEEDED(hr), "Desktop failed to bind to MyComputer object! hr = %08x\n", hr);
|
||||
ok (hr == S_OK, "Desktop failed to bind to MyComputer object! hr = %08x\n", hr);
|
||||
IShellFolder_Release(psfDesktop);
|
||||
IMalloc_Free(ppM, pidlMyComputer);
|
||||
if (FAILED(hr)) return;
|
||||
if (hr != S_OK) return;
|
||||
|
||||
hr = IShellFolder_BindToObject(psfMyComputer, pidlEmpty, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
|
||||
ok (hr == E_INVALIDARG, "MyComputers's BindToObject should fail, when called with empty pidl! hr = %08x\n", hr);
|
||||
|
@ -372,17 +413,17 @@ if (0)
|
|||
MultiByteToWideChar(CP_ACP, 0, szSystemDir, -1, wszSystemDir, MAX_PATH);
|
||||
|
||||
hr = IShellFolder_ParseDisplayName(psfMyComputer, NULL, NULL, wszSystemDir, NULL, &pidlSystemDir, NULL);
|
||||
ok (SUCCEEDED(hr), "MyComputers's ParseDisplayName failed to parse the SystemDirectory! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) {
|
||||
ok (hr == S_OK, "MyComputers's ParseDisplayName failed to parse the SystemDirectory! hr = %08x\n", hr);
|
||||
if (hr != S_OK) {
|
||||
IShellFolder_Release(psfMyComputer);
|
||||
return;
|
||||
}
|
||||
|
||||
hr = IShellFolder_BindToObject(psfMyComputer, pidlSystemDir, NULL, &IID_IShellFolder, (LPVOID*)&psfSystemDir);
|
||||
ok (SUCCEEDED(hr), "MyComputer failed to bind to a FileSystem ShellFolder! hr = %08x\n", hr);
|
||||
ok (hr == S_OK, "MyComputer failed to bind to a FileSystem ShellFolder! hr = %08x\n", hr);
|
||||
IShellFolder_Release(psfMyComputer);
|
||||
IMalloc_Free(ppM, pidlSystemDir);
|
||||
if (FAILED(hr)) return;
|
||||
if (hr != S_OK) return;
|
||||
|
||||
hr = IShellFolder_BindToObject(psfSystemDir, pidlEmpty, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
|
||||
ok (hr == E_INVALIDARG,
|
||||
|
@ -475,14 +516,14 @@ static void test_GetDisplayName(void)
|
|||
|
||||
/* Getting an itemidlist for the file. */
|
||||
hr = SHGetDesktopFolder(&psfDesktop);
|
||||
ok(SUCCEEDED(hr), "SHGetDesktopFolder failed! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) return;
|
||||
ok(hr == S_OK, "SHGetDesktopFolder failed! hr = %08x\n", hr);
|
||||
if (hr != S_OK) return;
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, szTestFile, -1, wszTestFile, MAX_PATH);
|
||||
|
||||
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszTestFile, NULL, &pidlTestFile, NULL);
|
||||
ok(SUCCEEDED(hr), "Desktop->ParseDisplayName failed! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) {
|
||||
ok(hr == S_OK, "Desktop->ParseDisplayName failed! hr = %08x\n", hr);
|
||||
if (hr != S_OK) {
|
||||
IShellFolder_Release(psfDesktop);
|
||||
return;
|
||||
}
|
||||
|
@ -510,9 +551,9 @@ static void test_GetDisplayName(void)
|
|||
todo_wine
|
||||
ok (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
|
||||
hr == E_NOTIMPL || /* Vista */
|
||||
broken(SUCCEEDED(hr)), /* Win9x, W2K */
|
||||
broken(hr == S_OK), /* Win9x, W2K */
|
||||
"hr = %08x\n", hr);
|
||||
if (SUCCEEDED(hr)) {
|
||||
if (hr == S_OK) {
|
||||
IShellFolder_Release(psfFile);
|
||||
}
|
||||
|
||||
|
@ -528,15 +569,15 @@ static void test_GetDisplayName(void)
|
|||
if (pSHGetFolderPathAndSubDirA)
|
||||
{
|
||||
hr = pSHBindToParent(pidlTestFile, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast);
|
||||
ok(SUCCEEDED(hr), "SHBindToParent failed! hr = %08x\n", hr);
|
||||
if (SUCCEEDED(hr)) {
|
||||
ok(hr == S_OK, "SHBindToParent failed! hr = %08x\n", hr);
|
||||
if (hr == S_OK) {
|
||||
/* It's ok to use this fixed path. Call will fail anyway. */
|
||||
WCHAR wszAbsoluteFilename[] = { 'C',':','\\','w','i','n','e','t','e','s','t', 0 };
|
||||
LPITEMIDLIST pidlNew;
|
||||
|
||||
/* The pidl returned through the last parameter of SetNameOf is a simple one. */
|
||||
hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlLast, wszDirName, SHGDN_NORMAL, &pidlNew);
|
||||
ok (SUCCEEDED(hr), "SetNameOf failed! hr = %08x\n", hr);
|
||||
ok (hr == S_OK, "SetNameOf failed! hr = %08x\n", hr);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
ok (((LPITEMIDLIST)((LPBYTE)pidlNew+pidlNew->mkid.cb))->mkid.cb == 0,
|
||||
|
@ -551,7 +592,7 @@ static void test_GetDisplayName(void)
|
|||
/* Rename the file back to its original name. SetNameOf ignores the fact, that the
|
||||
* SHGDN flags specify an absolute path. */
|
||||
hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszFileName, SHGDN_FORPARSING, NULL);
|
||||
ok (SUCCEEDED(hr), "SetNameOf failed! hr = %08x\n", hr);
|
||||
ok (hr == S_OK, "SetNameOf failed! hr = %08x\n", hr);
|
||||
|
||||
pILFree(pidlNew);
|
||||
}
|
||||
|
@ -576,19 +617,19 @@ static void test_GetDisplayName(void)
|
|||
|
||||
/* SHBindToParent fails, if called with a NULL PIDL. */
|
||||
hr = pSHBindToParent(NULL, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast);
|
||||
ok (FAILED(hr), "SHBindToParent(NULL) should fail!\n");
|
||||
ok (hr != S_OK, "SHBindToParent(NULL) should fail!\n");
|
||||
|
||||
/* But it succeeds with an empty PIDL. */
|
||||
hr = pSHBindToParent(pidlEmpty, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast);
|
||||
ok (SUCCEEDED(hr), "SHBindToParent(empty PIDL) should succeed! hr = %08x\n", hr);
|
||||
ok (hr == S_OK, "SHBindToParent(empty PIDL) should succeed! hr = %08x\n", hr);
|
||||
ok (pidlLast == pidlEmpty, "The last element of an empty PIDL should be the PIDL itself!\n");
|
||||
if (SUCCEEDED(hr))
|
||||
if (hr == S_OK)
|
||||
IShellFolder_Release(psfPersonal);
|
||||
|
||||
/* Binding to the folder and querying the display name of the file also works. */
|
||||
hr = pSHBindToParent(pidlTestFile, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast);
|
||||
ok (SUCCEEDED(hr), "SHBindToParent failed! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) {
|
||||
ok (hr == S_OK, "SHBindToParent failed! hr = %08x\n", hr);
|
||||
if (hr != S_OK) {
|
||||
IShellFolder_Release(psfDesktop);
|
||||
return;
|
||||
}
|
||||
|
@ -599,8 +640,8 @@ static void test_GetDisplayName(void)
|
|||
"SHBindToParent doesn't return the last id of the pidl param!\n");
|
||||
|
||||
hr = IShellFolder_GetDisplayNameOf(psfPersonal, pidlLast, SHGDN_FORPARSING, &strret);
|
||||
ok (SUCCEEDED(hr), "Personal->GetDisplayNameOf failed! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) {
|
||||
ok (hr == S_OK, "Personal->GetDisplayNameOf failed! hr = %08x\n", hr);
|
||||
if (hr != S_OK) {
|
||||
IShellFolder_Release(psfDesktop);
|
||||
IShellFolder_Release(psfPersonal);
|
||||
return;
|
||||
|
@ -609,7 +650,7 @@ static void test_GetDisplayName(void)
|
|||
if (pStrRetToBufW)
|
||||
{
|
||||
hr = pStrRetToBufW(&strret, pidlLast, wszTestFile2, MAX_PATH);
|
||||
ok (SUCCEEDED(hr), "StrRetToBufW failed! hr = %08x\n", hr);
|
||||
ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
|
||||
ok (!lstrcmpiW(wszTestFile, wszTestFile2), "GetDisplayNameOf returns incorrect path!\n");
|
||||
}
|
||||
|
||||
|
@ -648,15 +689,15 @@ static void test_CallForAttributes(void)
|
|||
* on MSDN. This test is meant to document the observed behaviour on WinXP SP2.
|
||||
*/
|
||||
hr = SHGetDesktopFolder(&psfDesktop);
|
||||
ok (SUCCEEDED(hr), "SHGetDesktopFolder failed! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) return;
|
||||
ok (hr == S_OK, "SHGetDesktopFolder failed! hr = %08x\n", hr);
|
||||
if (hr != S_OK) return;
|
||||
|
||||
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszMyDocuments, NULL,
|
||||
&pidlMyDocuments, NULL);
|
||||
ok (SUCCEEDED(hr) ||
|
||||
ok (hr == S_OK ||
|
||||
broken(hr == E_INVALIDARG), /* Win95, NT4 */
|
||||
"Desktop's ParseDisplayName failed to parse MyDocuments's CLSID! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) {
|
||||
if (hr != S_OK) {
|
||||
IShellFolder_Release(psfDesktop);
|
||||
return;
|
||||
}
|
||||
|
@ -664,7 +705,7 @@ static void test_CallForAttributes(void)
|
|||
dwAttributes = 0xffffffff;
|
||||
hr = IShellFolder_GetAttributesOf(psfDesktop, 1,
|
||||
(LPCITEMIDLIST*)&pidlMyDocuments, &dwAttributes);
|
||||
ok (SUCCEEDED(hr), "Desktop->GetAttributesOf(MyDocuments) failed! hr = %08x\n", hr);
|
||||
ok (hr == S_OK, "Desktop->GetAttributesOf(MyDocuments) failed! hr = %08x\n", hr);
|
||||
|
||||
/* We need the following setup (as observed on WinXP SP2), for the tests to make sense. */
|
||||
ok (dwAttributes & SFGAO_FILESYSTEM, "SFGAO_FILESYSTEM attribute is not set for MyDocuments!\n");
|
||||
|
@ -726,8 +767,8 @@ static void test_CallForAttributes(void)
|
|||
dwAttributes = SFGAO_ISSLOW|SFGAO_GHOSTED|SFGAO_FILESYSTEM;
|
||||
hr = IShellFolder_GetAttributesOf(psfDesktop, 1,
|
||||
(LPCITEMIDLIST*)&pidlMyDocuments, &dwAttributes);
|
||||
ok (SUCCEEDED(hr), "Desktop->GetAttributesOf(MyDocuments) failed! hr = %08x\n", hr);
|
||||
if (SUCCEEDED(hr))
|
||||
ok (hr == S_OK, "Desktop->GetAttributesOf(MyDocuments) failed! hr = %08x\n", hr);
|
||||
if (hr == S_OK)
|
||||
ok (dwAttributes == SFGAO_FILESYSTEM,
|
||||
"Desktop->GetAttributes(MyDocuments) returned unexpected attributes: %08x\n",
|
||||
dwAttributes);
|
||||
|
@ -786,13 +827,13 @@ static void test_GetAttributesOf(void)
|
|||
BOOL foundFlagsMatch;
|
||||
|
||||
hr = SHGetDesktopFolder(&psfDesktop);
|
||||
ok (SUCCEEDED(hr), "SHGetDesktopFolder failed! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) return;
|
||||
ok (hr == S_OK, "SHGetDesktopFolder failed! hr = %08x\n", hr);
|
||||
if (hr != S_OK) return;
|
||||
|
||||
/* The Desktop attributes can be queried with a single empty itemidlist, .. */
|
||||
dwFlags = 0xffffffff;
|
||||
hr = IShellFolder_GetAttributesOf(psfDesktop, 1, &pidlEmpty, &dwFlags);
|
||||
ok (SUCCEEDED(hr), "Desktop->GetAttributesOf(empty pidl) failed! hr = %08x\n", hr);
|
||||
ok (hr == S_OK, "Desktop->GetAttributesOf(empty pidl) failed! hr = %08x\n", hr);
|
||||
for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch &&
|
||||
i < sizeof(desktopFlags) / sizeof(desktopFlags[0]); i++)
|
||||
{
|
||||
|
@ -804,7 +845,7 @@ static void test_GetAttributesOf(void)
|
|||
/* .. or with no itemidlist at all. */
|
||||
dwFlags = 0xffffffff;
|
||||
hr = IShellFolder_GetAttributesOf(psfDesktop, 0, NULL, &dwFlags);
|
||||
ok (SUCCEEDED(hr), "Desktop->GetAttributesOf(NULL) failed! hr = %08x\n", hr);
|
||||
ok (hr == S_OK, "Desktop->GetAttributesOf(NULL) failed! hr = %08x\n", hr);
|
||||
for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch &&
|
||||
i < sizeof(desktopFlags) / sizeof(desktopFlags[0]); i++)
|
||||
{
|
||||
|
@ -815,8 +856,8 @@ static void test_GetAttributesOf(void)
|
|||
|
||||
/* Testing the attributes of the MyComputer shellfolder */
|
||||
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszMyComputer, NULL, &pidlMyComputer, NULL);
|
||||
ok (SUCCEEDED(hr), "Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) {
|
||||
ok (hr == S_OK, "Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08x\n", hr);
|
||||
if (hr != S_OK) {
|
||||
IShellFolder_Release(psfDesktop);
|
||||
return;
|
||||
}
|
||||
|
@ -826,7 +867,7 @@ static void test_GetAttributesOf(void)
|
|||
*/
|
||||
dwFlags = 0xffffffff;
|
||||
hr = IShellFolder_GetAttributesOf(psfDesktop, 1, (LPCITEMIDLIST*)&pidlMyComputer, &dwFlags);
|
||||
ok (SUCCEEDED(hr), "Desktop->GetAttributesOf(MyComputer) failed! hr = %08x\n", hr);
|
||||
ok (hr == S_OK, "Desktop->GetAttributesOf(MyComputer) failed! hr = %08x\n", hr);
|
||||
for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch &&
|
||||
i < sizeof(myComputerFlags) / sizeof(myComputerFlags[0]); i++)
|
||||
{
|
||||
|
@ -837,20 +878,20 @@ static void test_GetAttributesOf(void)
|
|||
ok (foundFlagsMatch, "Wrong MyComputer attributes: %08x\n", dwFlags);
|
||||
|
||||
hr = IShellFolder_BindToObject(psfDesktop, pidlMyComputer, NULL, &IID_IShellFolder, (LPVOID*)&psfMyComputer);
|
||||
ok (SUCCEEDED(hr), "Desktop failed to bind to MyComputer object! hr = %08x\n", hr);
|
||||
ok (hr == S_OK, "Desktop failed to bind to MyComputer object! hr = %08x\n", hr);
|
||||
IShellFolder_Release(psfDesktop);
|
||||
IMalloc_Free(ppM, pidlMyComputer);
|
||||
if (FAILED(hr)) return;
|
||||
if (hr != S_OK) return;
|
||||
|
||||
hr = IShellFolder_GetAttributesOf(psfMyComputer, 1, &pidlEmpty, &dwFlags);
|
||||
todo_wine
|
||||
ok (hr == E_INVALIDARG ||
|
||||
broken(SUCCEEDED(hr)), /* W2K and earlier */
|
||||
broken(hr == S_OK), /* W2K and earlier */
|
||||
"MyComputer->GetAttributesOf(emtpy pidl) should fail! hr = %08x\n", hr);
|
||||
|
||||
dwFlags = 0xffffffff;
|
||||
hr = IShellFolder_GetAttributesOf(psfMyComputer, 0, NULL, &dwFlags);
|
||||
ok (SUCCEEDED(hr), "MyComputer->GetAttributesOf(NULL) failed! hr = %08x\n", hr);
|
||||
ok (hr == S_OK, "MyComputer->GetAttributesOf(NULL) failed! hr = %08x\n", hr);
|
||||
for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch &&
|
||||
i < sizeof(myComputerFlags) / sizeof(myComputerFlags[0]); i++)
|
||||
{
|
||||
|
@ -895,7 +936,7 @@ static void test_GetAttributesOf(void)
|
|||
/* test the shell attributes of the test directory using the relative PIDL */
|
||||
dwFlags = SFGAO_FOLDER;
|
||||
hr = IShellFolder_GetAttributesOf(testIShellFolder, 1, (LPCITEMIDLIST*)&newPIDL, &dwFlags);
|
||||
ok (SUCCEEDED(hr), "Desktop->GetAttributesOf() failed! hr = %08x\n", hr);
|
||||
ok (hr == S_OK, "Desktop->GetAttributesOf() failed! hr = %08x\n", hr);
|
||||
ok ((dwFlags&SFGAO_FOLDER), "Wrong directory attribute for relative PIDL: %08x\n", dwFlags);
|
||||
|
||||
/* free memory */
|
||||
|
@ -913,7 +954,7 @@ static void test_GetAttributesOf(void)
|
|||
/* test the shell attributes of the test directory using the absolute PIDL */
|
||||
dwFlags = SFGAO_FOLDER;
|
||||
hr = IShellFolder_GetAttributesOf(IDesktopFolder, 1, (LPCITEMIDLIST*)&newPIDL, &dwFlags);
|
||||
ok (SUCCEEDED(hr), "Desktop->GetAttributesOf() failed! hr = %08x\n", hr);
|
||||
ok (hr == S_OK, "Desktop->GetAttributesOf() failed! hr = %08x\n", hr);
|
||||
ok ((dwFlags&SFGAO_FOLDER), "Wrong directory attribute for absolute PIDL: %08x\n", dwFlags);
|
||||
|
||||
/* free memory */
|
||||
|
@ -982,12 +1023,12 @@ static void test_SHGetPathFromIDList(void)
|
|||
|
||||
/* MyComputer does not map to a filesystem path. SHGetPathFromIDListW should fail. */
|
||||
hr = SHGetDesktopFolder(&psfDesktop);
|
||||
ok (SUCCEEDED(hr), "SHGetDesktopFolder failed! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) return;
|
||||
ok (hr == S_OK, "SHGetDesktopFolder failed! hr = %08x\n", hr);
|
||||
if (hr != S_OK) return;
|
||||
|
||||
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszMyComputer, NULL, &pidlMyComputer, NULL);
|
||||
ok (SUCCEEDED(hr), "Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) {
|
||||
ok (hr == S_OK, "Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08x\n", hr);
|
||||
if (hr != S_OK) {
|
||||
IShellFolder_Release(psfDesktop);
|
||||
return;
|
||||
}
|
||||
|
@ -1025,8 +1066,8 @@ static void test_SHGetPathFromIDList(void)
|
|||
CloseHandle(hTestFile);
|
||||
|
||||
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszTestFile, NULL, &pidlTestFile, NULL);
|
||||
ok (SUCCEEDED(hr), "Desktop's ParseDisplayName failed to parse filename hr = %08x\n", hr);
|
||||
if (FAILED(hr)) {
|
||||
ok (hr == S_OK, "Desktop's ParseDisplayName failed to parse filename hr = %08x\n", hr);
|
||||
if (hr != S_OK) {
|
||||
IShellFolder_Release(psfDesktop);
|
||||
DeleteFileW(wszFileName);
|
||||
IMalloc_Free(ppM, pidlTestFile);
|
||||
|
@ -1036,10 +1077,10 @@ static void test_SHGetPathFromIDList(void)
|
|||
/* This test is to show that the Desktop shellfolder prepends the CSIDL_DESKTOPDIRECTORY
|
||||
* path for files placed on the desktop, if called with SHGDN_FORPARSING. */
|
||||
hr = IShellFolder_GetDisplayNameOf(psfDesktop, pidlTestFile, SHGDN_FORPARSING, &strret);
|
||||
ok (SUCCEEDED(hr), "Desktop's GetDisplayNamfOf failed! hr = %08x\n", hr);
|
||||
ok (hr == S_OK, "Desktop's GetDisplayNamfOf failed! hr = %08x\n", hr);
|
||||
IShellFolder_Release(psfDesktop);
|
||||
DeleteFileW(wszFileName);
|
||||
if (FAILED(hr)) {
|
||||
if (hr != S_OK) {
|
||||
IMalloc_Free(ppM, pidlTestFile);
|
||||
return;
|
||||
}
|
||||
|
@ -1063,7 +1104,7 @@ static void test_SHGetPathFromIDList(void)
|
|||
pSHGetSpecialFolderLocation = (void *)GetProcAddress(hShell32, "SHGetSpecialFolderLocation");
|
||||
|
||||
hr = pSHGetSpecialFolderLocation(NULL, CSIDL_PROGRAM_FILES, &pidlPrograms);
|
||||
ok(SUCCEEDED(hr), "SHGetFolderLocation failed: 0x%08x\n", hr);
|
||||
ok(hr == S_OK, "SHGetFolderLocation failed: 0x%08x\n", hr);
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
result = pSHGetPathFromIDListW(pidlPrograms, wszPath);
|
||||
|
@ -1280,12 +1321,12 @@ static void test_FolderShortcut(void) {
|
|||
win_skip("CLSID_FolderShortcut is not implemented\n");
|
||||
return;
|
||||
}
|
||||
ok (SUCCEEDED(hr), "CoCreateInstance failed! hr = 0x%08x\n", hr);
|
||||
if (FAILED(hr)) return;
|
||||
ok (hr == S_OK, "CoCreateInstance failed! hr = 0x%08x\n", hr);
|
||||
if (hr != S_OK) return;
|
||||
|
||||
hr = IPersistPropertyBag_Load(pPersistPropertyBag, &InitPropertyBag, NULL);
|
||||
ok(SUCCEEDED(hr), "IPersistPropertyBag_Load failed! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) {
|
||||
ok(hr == S_OK, "IPersistPropertyBag_Load failed! hr = %08x\n", hr);
|
||||
if (hr != S_OK) {
|
||||
IPersistPropertyBag_Release(pPersistPropertyBag);
|
||||
return;
|
||||
}
|
||||
|
@ -1293,12 +1334,12 @@ static void test_FolderShortcut(void) {
|
|||
hr = IPersistPropertyBag_QueryInterface(pPersistPropertyBag, &IID_IShellFolder,
|
||||
(LPVOID*)&pShellFolder);
|
||||
IPersistPropertyBag_Release(pPersistPropertyBag);
|
||||
ok(SUCCEEDED(hr), "IPersistPropertyBag_QueryInterface(IShellFolder) failed! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) return;
|
||||
ok(hr == S_OK, "IPersistPropertyBag_QueryInterface(IShellFolder) failed! hr = %08x\n", hr);
|
||||
if (hr != S_OK) return;
|
||||
|
||||
hr = IShellFolder_GetDisplayNameOf(pShellFolder, NULL, SHGDN_FORPARSING, &strret);
|
||||
ok(SUCCEEDED(hr), "IShellFolder_GetDisplayNameOf(NULL) failed! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) {
|
||||
ok(hr == S_OK, "IShellFolder_GetDisplayNameOf(NULL) failed! hr = %08x\n", hr);
|
||||
if (hr != S_OK) {
|
||||
IShellFolder_Release(pShellFolder);
|
||||
return;
|
||||
}
|
||||
|
@ -1312,15 +1353,15 @@ static void test_FolderShortcut(void) {
|
|||
|
||||
hr = IShellFolder_QueryInterface(pShellFolder, &IID_IPersistFolder3, (LPVOID*)&pPersistFolder3);
|
||||
IShellFolder_Release(pShellFolder);
|
||||
ok(SUCCEEDED(hr), "IShellFolder_QueryInterface(IID_IPersistFolder3 failed! hr = 0x%08x\n", hr);
|
||||
if (FAILED(hr)) return;
|
||||
ok(hr == S_OK, "IShellFolder_QueryInterface(IID_IPersistFolder3 failed! hr = 0x%08x\n", hr);
|
||||
if (hr != S_OK) return;
|
||||
|
||||
hr = IPersistFolder3_GetClassID(pPersistFolder3, &clsid);
|
||||
ok(SUCCEEDED(hr), "IPersistFolder3_GetClassID failed! hr=0x%08x\n", hr);
|
||||
ok(hr == S_OK, "IPersistFolder3_GetClassID failed! hr=0x%08x\n", hr);
|
||||
ok(IsEqualCLSID(&clsid, &CLSID_FolderShortcut), "Unexpected CLSID!\n");
|
||||
|
||||
hr = IPersistFolder3_GetCurFolder(pPersistFolder3, &pidlCurrentFolder);
|
||||
ok(SUCCEEDED(hr), "IPersistFolder3_GetCurFolder failed! hr=0x%08x\n", hr);
|
||||
todo_wine ok(hr == S_FALSE, "IPersistFolder3_GetCurFolder failed! hr=0x%08x\n", hr);
|
||||
ok(!pidlCurrentFolder, "IPersistFolder3_GetCurFolder should return a NULL pidl!\n");
|
||||
|
||||
/* For FolderShortcut objects, the Initialize method initialized the folder's position in the
|
||||
|
@ -1330,8 +1371,8 @@ static void test_FolderShortcut(void) {
|
|||
* itemidlist, but GetDisplayNameOf still returns the path from above.
|
||||
*/
|
||||
hr = SHGetDesktopFolder(&pDesktopFolder);
|
||||
ok (SUCCEEDED(hr), "SHGetDesktopFolder failed! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) return;
|
||||
ok (hr == S_OK, "SHGetDesktopFolder failed! hr = %08x\n", hr);
|
||||
if (hr != S_OK) return;
|
||||
|
||||
/* Temporarily register WineTestFolder as a shell namespace extension at the Desktop.
|
||||
* Otherwise ParseDisplayName fails on WinXP with E_INVALIDARG */
|
||||
|
@ -1341,19 +1382,19 @@ static void test_FolderShortcut(void) {
|
|||
&pidlWineTestFolder, NULL);
|
||||
RegDeleteKeyW(HKEY_CURRENT_USER, wszShellExtKey);
|
||||
IShellFolder_Release(pDesktopFolder);
|
||||
ok (SUCCEEDED(hr), "IShellFolder::ParseDisplayName failed! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) return;
|
||||
ok (hr == S_OK, "IShellFolder::ParseDisplayName failed! hr = %08x\n", hr);
|
||||
if (hr != S_OK) return;
|
||||
|
||||
hr = IPersistFolder3_Initialize(pPersistFolder3, pidlWineTestFolder);
|
||||
ok (SUCCEEDED(hr), "IPersistFolder3::Initialize failed! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) {
|
||||
ok (hr == S_OK, "IPersistFolder3::Initialize failed! hr = %08x\n", hr);
|
||||
if (hr != S_OK) {
|
||||
IPersistFolder3_Release(pPersistFolder3);
|
||||
pILFree(pidlWineTestFolder);
|
||||
return;
|
||||
}
|
||||
|
||||
hr = IPersistFolder3_GetCurFolder(pPersistFolder3, &pidlCurrentFolder);
|
||||
ok(SUCCEEDED(hr), "IPersistFolder3_GetCurFolder failed! hr=0x%08x\n", hr);
|
||||
ok(hr == S_OK, "IPersistFolder3_GetCurFolder failed! hr=0x%08x\n", hr);
|
||||
ok(pILIsEqual(pidlCurrentFolder, pidlWineTestFolder),
|
||||
"IPersistFolder3_GetCurFolder should return pidlWineTestFolder!\n");
|
||||
pILFree(pidlCurrentFolder);
|
||||
|
@ -1361,12 +1402,12 @@ static void test_FolderShortcut(void) {
|
|||
|
||||
hr = IPersistFolder3_QueryInterface(pPersistFolder3, &IID_IShellFolder, (LPVOID*)&pShellFolder);
|
||||
IPersistFolder3_Release(pPersistFolder3);
|
||||
ok(SUCCEEDED(hr), "IPersistFolder3_QueryInterface(IShellFolder) failed! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) return;
|
||||
ok(hr == S_OK, "IPersistFolder3_QueryInterface(IShellFolder) failed! hr = %08x\n", hr);
|
||||
if (hr != S_OK) return;
|
||||
|
||||
hr = IShellFolder_GetDisplayNameOf(pShellFolder, NULL, SHGDN_FORPARSING, &strret);
|
||||
ok(SUCCEEDED(hr), "IShellFolder_GetDisplayNameOf(NULL) failed! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) {
|
||||
ok(hr == S_OK, "IShellFolder_GetDisplayNameOf(NULL) failed! hr = %08x\n", hr);
|
||||
if (hr != S_OK) {
|
||||
IShellFolder_Release(pShellFolder);
|
||||
return;
|
||||
}
|
||||
|
@ -1386,8 +1427,8 @@ static void test_FolderShortcut(void) {
|
|||
hr = IShellFolder_ParseDisplayName(pShellFolder, NULL, NULL, wszSomeSubFolder, NULL,
|
||||
&pidlSubFolder, NULL);
|
||||
RemoveDirectoryW(wszDesktopPath);
|
||||
ok (SUCCEEDED(hr), "IShellFolder::ParseDisplayName failed! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) {
|
||||
ok (hr == S_OK, "IShellFolder::ParseDisplayName failed! hr = %08x\n", hr);
|
||||
if (hr != S_OK) {
|
||||
IShellFolder_Release(pShellFolder);
|
||||
return;
|
||||
}
|
||||
|
@ -1396,14 +1437,14 @@ static void test_FolderShortcut(void) {
|
|||
(LPVOID*)&pPersistFolder3);
|
||||
IShellFolder_Release(pShellFolder);
|
||||
pILFree(pidlSubFolder);
|
||||
ok (SUCCEEDED(hr), "IShellFolder::BindToObject failed! hr = %08x\n", hr);
|
||||
if (FAILED(hr))
|
||||
ok (hr == S_OK, "IShellFolder::BindToObject failed! hr = %08x\n", hr);
|
||||
if (hr != S_OK)
|
||||
return;
|
||||
|
||||
/* On windows, we expect CLSID_ShellFSFolder. On wine we relax this constraint
|
||||
* a little bit and also allow CLSID_UnixDosFolder. */
|
||||
hr = IPersistFolder3_GetClassID(pPersistFolder3, &clsid);
|
||||
ok(SUCCEEDED(hr), "IPersistFolder3_GetClassID failed! hr=0x%08x\n", hr);
|
||||
ok(hr == S_OK, "IPersistFolder3_GetClassID failed! hr=0x%08x\n", hr);
|
||||
ok(IsEqualCLSID(&clsid, &CLSID_ShellFSFolder) || IsEqualCLSID(&clsid, &CLSID_UnixDosFolder),
|
||||
"IPersistFolder3::GetClassID returned unexpected CLSID!\n");
|
||||
|
||||
|
@ -1463,12 +1504,12 @@ static void test_ITEMIDLIST_format(void) {
|
|||
if (!bResult) return;
|
||||
|
||||
hr = SHGetDesktopFolder(&psfDesktop);
|
||||
ok(SUCCEEDED(hr), "SHGetDesktopFolder failed! hr: %08x\n", hr);
|
||||
if (FAILED(hr)) return;
|
||||
ok(hr == S_OK, "SHGetDesktopFolder failed! hr: %08x\n", hr);
|
||||
if (hr != S_OK) return;
|
||||
|
||||
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszPersonal, NULL, &pidlPersonal, NULL);
|
||||
ok(SUCCEEDED(hr), "psfDesktop->ParseDisplayName failed! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) {
|
||||
ok(hr == S_OK, "psfDesktop->ParseDisplayName failed! hr = %08x\n", hr);
|
||||
if (hr != S_OK) {
|
||||
IShellFolder_Release(psfDesktop);
|
||||
return;
|
||||
}
|
||||
|
@ -1477,8 +1518,8 @@ static void test_ITEMIDLIST_format(void) {
|
|||
(LPVOID*)&psfPersonal);
|
||||
IShellFolder_Release(psfDesktop);
|
||||
pILFree(pidlPersonal);
|
||||
ok(SUCCEEDED(hr), "psfDesktop->BindToObject failed! hr = %08x\n", hr);
|
||||
if (FAILED(hr)) return;
|
||||
ok(hr == S_OK, "psfDesktop->BindToObject failed! hr = %08x\n", hr);
|
||||
if (hr != S_OK) return;
|
||||
|
||||
for (i=0; i<3; i++) {
|
||||
CHAR szFile[MAX_PATH];
|
||||
|
@ -1497,8 +1538,8 @@ static void test_ITEMIDLIST_format(void) {
|
|||
|
||||
hr = IShellFolder_ParseDisplayName(psfPersonal, NULL, NULL, wszFile[i], NULL, &pidlFile, NULL);
|
||||
DeleteFileW(wszFile[i]);
|
||||
ok(SUCCEEDED(hr), "psfPersonal->ParseDisplayName failed! hr: %08x\n", hr);
|
||||
if (FAILED(hr)) {
|
||||
ok(hr == S_OK, "psfPersonal->ParseDisplayName failed! hr: %08x\n", hr);
|
||||
if (hr != S_OK) {
|
||||
IShellFolder_Release(psfPersonal);
|
||||
return;
|
||||
}
|
||||
|
@ -1771,10 +1812,10 @@ static void test_LocalizedNames(void)
|
|||
hr = IShellFolder_GetDisplayNameOf(testIShellFolder, newPIDL, SHGDN_INFOLDER, &strret);
|
||||
ok(hr == S_OK, "GetDisplayNameOf failed %08x\n", hr);
|
||||
|
||||
if (SUCCEEDED(hr) && pStrRetToBufW)
|
||||
if (hr == S_OK && pStrRetToBufW)
|
||||
{
|
||||
hr = pStrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR));
|
||||
ok (SUCCEEDED(hr), "StrRetToBufW failed! hr = %08x\n", hr);
|
||||
ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
|
||||
todo_wine
|
||||
ok (!lstrcmpiW(tempbufW, folderdisplayW) ||
|
||||
broken(!lstrcmpiW(tempbufW, foldernameW)), /* W2K */
|
||||
|
@ -1785,10 +1826,10 @@ static void test_LocalizedNames(void)
|
|||
hr = IShellFolder_GetDisplayNameOf(testIShellFolder, newPIDL, SHGDN_INFOLDER|SHGDN_FOREDITING, &strret);
|
||||
ok(hr == S_OK, "GetDisplayNameOf failed %08x\n", hr);
|
||||
|
||||
if (SUCCEEDED(hr) && pStrRetToBufW)
|
||||
if (hr == S_OK && pStrRetToBufW)
|
||||
{
|
||||
hr = pStrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR));
|
||||
ok (SUCCEEDED(hr), "StrRetToBufW failed! hr = %08x\n", hr);
|
||||
ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
|
||||
todo_wine
|
||||
ok (!lstrcmpiW(tempbufW, folderdisplayW) ||
|
||||
broken(!lstrcmpiW(tempbufW, foldernameW)), /* W2K */
|
||||
|
@ -1799,10 +1840,10 @@ static void test_LocalizedNames(void)
|
|||
hr = IShellFolder_GetDisplayNameOf(testIShellFolder, newPIDL, SHGDN_INFOLDER|SHGDN_FORPARSING, &strret);
|
||||
ok(hr == S_OK, "GetDisplayNameOf failed %08x\n", hr);
|
||||
|
||||
if (SUCCEEDED(hr) && pStrRetToBufW)
|
||||
if (hr == S_OK && pStrRetToBufW)
|
||||
{
|
||||
hr = pStrRetToBufW(&strret, newPIDL, tempbufW, sizeof(tempbufW)/sizeof(WCHAR));
|
||||
ok (SUCCEEDED(hr), "StrRetToBufW failed! hr = %08x\n", hr);
|
||||
ok (hr == S_OK, "StrRetToBufW failed! hr = %08x\n", hr);
|
||||
ok (!lstrcmpiW(tempbufW, foldernameW), "GetDisplayNameOf returned %s\n", wine_dbgstr_w(tempbufW));
|
||||
}
|
||||
|
||||
|
@ -1983,7 +2024,6 @@ static void test_SHCreateShellItem(void)
|
|||
|
||||
static void test_SHParseDisplayName(void)
|
||||
{
|
||||
static const WCHAR prefixW[] = {'w','t',0};
|
||||
LPITEMIDLIST pidl1, pidl2;
|
||||
IShellFolder *desktop;
|
||||
WCHAR dirW[MAX_PATH];
|
||||
|
@ -2025,9 +2065,7 @@ if (0)
|
|||
pILFree(pidl2);
|
||||
|
||||
/* with path */
|
||||
GetTempPathW(sizeof(dirW)/sizeof(WCHAR), dirW);
|
||||
GetTempFileNameW(dirW, prefixW, 0, dirW);
|
||||
CreateFileW(dirW, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
||||
GetWindowsDirectoryW( dirW, MAX_PATH );
|
||||
|
||||
hr = pSHParseDisplayName(dirW, NULL, &pidl1, 0, NULL);
|
||||
ok(hr == S_OK, "failed %08x\n", hr);
|
||||
|
@ -2039,7 +2077,35 @@ if (0)
|
|||
pILFree(pidl1);
|
||||
pILFree(pidl2);
|
||||
|
||||
DeleteFileW(dirW);
|
||||
IShellFolder_Release(desktop);
|
||||
}
|
||||
|
||||
static void test_desktop_IPersist(void)
|
||||
{
|
||||
IShellFolder *desktop;
|
||||
IPersist *persist;
|
||||
CLSID clsid;
|
||||
HRESULT hr;
|
||||
|
||||
hr = SHGetDesktopFolder(&desktop);
|
||||
ok(hr == S_OK, "failed %08x\n", hr);
|
||||
|
||||
hr = IShellFolder_QueryInterface(desktop, &IID_IPersist, (void**)&persist);
|
||||
ok(hr == S_OK || broken(hr == E_NOINTERFACE) /* NT4, W9X */, "failed %08x\n", hr);
|
||||
|
||||
if (hr == S_OK)
|
||||
{
|
||||
if (0)
|
||||
{
|
||||
/* crashes on native */
|
||||
hr = IPersist_GetClassID(persist, NULL);
|
||||
}
|
||||
memset(&clsid, 0, sizeof(clsid));
|
||||
hr = IPersist_GetClassID(persist, &clsid);
|
||||
ok(hr == S_OK, "failed %08x\n", hr);
|
||||
ok(IsEqualIID(&CLSID_ShellDesktop, &clsid), "Expected CLSID_ShellDesktop\n");
|
||||
IPersist_Release(persist);
|
||||
}
|
||||
|
||||
IShellFolder_Release(desktop);
|
||||
}
|
||||
|
@ -2064,6 +2130,7 @@ START_TEST(shlfolder)
|
|||
test_SHGetFolderPathAndSubDirA();
|
||||
test_LocalizedNames();
|
||||
test_SHCreateShellItem();
|
||||
test_desktop_IPersist();
|
||||
|
||||
OleUninitialize();
|
||||
}
|
||||
|
|
759
rostests/winetests/shell32/shlview.c
Normal file
759
rostests/winetests/shell32/shlview.c
Normal file
|
@ -0,0 +1,759 @@
|
|||
/*
|
||||
* Unit test of the IShellView
|
||||
*
|
||||
* Copyright 2010 Nikolay Sivov for CodeWeavers
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define COBJMACROS
|
||||
#define CONST_VTABLE
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wtypes.h"
|
||||
#include "shellapi.h"
|
||||
|
||||
#include "shlguid.h"
|
||||
#include "shlobj.h"
|
||||
#include "shobjidl.h"
|
||||
#include "shlwapi.h"
|
||||
#include "ocidl.h"
|
||||
#include "oleauto.h"
|
||||
|
||||
#include "initguid.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
#include "msg.h"
|
||||
|
||||
#define LISTVIEW_SEQ_INDEX 0
|
||||
#define NUM_MSG_SEQUENCES 1
|
||||
|
||||
DEFINE_GUID(IID_IPersistHistory, 0x91a565c1, 0xe38f, 0x11d0, 0x94, 0xbf, 0x00, 0xa0, 0xc9, 0x05, 0x5c, 0xbf);
|
||||
|
||||
static struct msg_sequence *sequences[NUM_MSG_SEQUENCES];
|
||||
|
||||
static LRESULT WINAPI listview_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
|
||||
static LONG defwndproc_counter = 0;
|
||||
LRESULT ret;
|
||||
struct message msg;
|
||||
|
||||
trace("listview: %p, %04x, %08lx, %08lx\n", hwnd, message, wParam, lParam);
|
||||
|
||||
msg.message = message;
|
||||
msg.flags = sent|wparam|lparam;
|
||||
if (defwndproc_counter) msg.flags |= defwinproc;
|
||||
msg.wParam = wParam;
|
||||
msg.lParam = lParam;
|
||||
add_message(sequences, LISTVIEW_SEQ_INDEX, &msg);
|
||||
|
||||
defwndproc_counter++;
|
||||
ret = CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
|
||||
defwndproc_counter--;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static HWND subclass_listview(HWND hwnd)
|
||||
{
|
||||
WNDPROC oldproc;
|
||||
HWND listview;
|
||||
|
||||
/* listview is a first child */
|
||||
listview = FindWindowExA(hwnd, NULL, WC_LISTVIEWA, NULL);
|
||||
|
||||
oldproc = (WNDPROC)SetWindowLongPtrA(listview, GWLP_WNDPROC,
|
||||
(LONG_PTR)listview_subclass_proc);
|
||||
SetWindowLongPtrA(listview, GWLP_USERDATA, (LONG_PTR)oldproc);
|
||||
|
||||
return listview;
|
||||
}
|
||||
|
||||
/* dummy IDataObject implementation */
|
||||
typedef struct {
|
||||
const IDataObjectVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
} IDataObjectImpl;
|
||||
|
||||
static const IDataObjectVtbl IDataObjectImpl_Vtbl;
|
||||
|
||||
static IDataObject* IDataObjectImpl_Construct(void)
|
||||
{
|
||||
IDataObjectImpl *obj;
|
||||
|
||||
obj = HeapAlloc(GetProcessHeap(), 0, sizeof(*obj));
|
||||
obj->lpVtbl = &IDataObjectImpl_Vtbl;
|
||||
obj->ref = 1;
|
||||
|
||||
return (IDataObject*)obj;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDataObjectImpl_QueryInterface(IDataObject *iface, REFIID riid, void **ppvObj)
|
||||
{
|
||||
IDataObjectImpl *This = (IDataObjectImpl *)iface;
|
||||
|
||||
if (IsEqualIID(riid, &IID_IUnknown) ||
|
||||
IsEqualIID(riid, &IID_IDataObject))
|
||||
{
|
||||
*ppvObj = This;
|
||||
}
|
||||
|
||||
if(*ppvObj)
|
||||
{
|
||||
IUnknown_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI IDataObjectImpl_AddRef(IDataObject * iface)
|
||||
{
|
||||
IDataObjectImpl *This = (IDataObjectImpl *)iface;
|
||||
return InterlockedIncrement(&This->ref);
|
||||
}
|
||||
|
||||
static ULONG WINAPI IDataObjectImpl_Release(IDataObject * iface)
|
||||
{
|
||||
IDataObjectImpl *This = (IDataObjectImpl *)iface;
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
if (!ref)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
return 0;
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDataObjectImpl_GetData(IDataObject *iface, FORMATETC *pformat, STGMEDIUM *pmedium)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDataObjectImpl_GetDataHere(IDataObject *iface, FORMATETC *pformat, STGMEDIUM *pmedium)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDataObjectImpl_QueryGetData(IDataObject *iface, FORMATETC *pformat)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDataObjectImpl_GetCanonicalFormatEtc(
|
||||
IDataObject *iface, FORMATETC *pformatIn, FORMATETC *pformatOut)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDataObjectImpl_SetData(
|
||||
IDataObject *iface, FORMATETC *pformat, STGMEDIUM *pmedium, BOOL release)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDataObjectImpl_EnumFormatEtc(
|
||||
IDataObject *iface, DWORD direction, IEnumFORMATETC **ppenumFormatEtc)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDataObjectImpl_DAdvise(
|
||||
IDataObject *iface, FORMATETC *pformatetc, DWORD advf, IAdviseSink *pSink, DWORD *pConnection)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDataObjectImpl_DUnadvise(IDataObject *iface, DWORD connection)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDataObjectImpl_EnumDAdvise(IDataObject *iface, IEnumSTATDATA **ppenumAdvise)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const IDataObjectVtbl IDataObjectImpl_Vtbl =
|
||||
{
|
||||
IDataObjectImpl_QueryInterface,
|
||||
IDataObjectImpl_AddRef,
|
||||
IDataObjectImpl_Release,
|
||||
IDataObjectImpl_GetData,
|
||||
IDataObjectImpl_GetDataHere,
|
||||
IDataObjectImpl_QueryGetData,
|
||||
IDataObjectImpl_GetCanonicalFormatEtc,
|
||||
IDataObjectImpl_SetData,
|
||||
IDataObjectImpl_EnumFormatEtc,
|
||||
IDataObjectImpl_DAdvise,
|
||||
IDataObjectImpl_DUnadvise,
|
||||
IDataObjectImpl_EnumDAdvise
|
||||
};
|
||||
|
||||
/* dummy IShellBrowser implementation */
|
||||
typedef struct {
|
||||
const IShellBrowserVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
} IShellBrowserImpl;
|
||||
|
||||
static const IShellBrowserVtbl IShellBrowserImpl_Vtbl;
|
||||
|
||||
static IShellBrowser* IShellBrowserImpl_Construct(void)
|
||||
{
|
||||
IShellBrowserImpl *browser;
|
||||
|
||||
browser = HeapAlloc(GetProcessHeap(), 0, sizeof(*browser));
|
||||
browser->lpVtbl = &IShellBrowserImpl_Vtbl;
|
||||
browser->ref = 1;
|
||||
|
||||
return (IShellBrowser*)browser;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
|
||||
REFIID riid,
|
||||
LPVOID *ppvObj)
|
||||
{
|
||||
IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
|
||||
|
||||
*ppvObj = NULL;
|
||||
|
||||
if(IsEqualIID(riid, &IID_IUnknown) ||
|
||||
IsEqualIID(riid, &IID_IOleWindow) ||
|
||||
IsEqualIID(riid, &IID_IShellBrowser))
|
||||
{
|
||||
*ppvObj = This;
|
||||
}
|
||||
|
||||
if(*ppvObj)
|
||||
{
|
||||
IUnknown_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI IShellBrowserImpl_AddRef(IShellBrowser * iface)
|
||||
{
|
||||
IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
|
||||
return InterlockedIncrement(&This->ref);
|
||||
}
|
||||
|
||||
static ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface)
|
||||
{
|
||||
IShellBrowserImpl *This = (IShellBrowserImpl *)iface;
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
if (!ref)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
return 0;
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser *iface,
|
||||
HWND *phwnd)
|
||||
{
|
||||
if (phwnd) *phwnd = GetDesktopWindow();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IShellBrowserImpl_ContextSensitiveHelp(IShellBrowser *iface,
|
||||
BOOL fEnterMode)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
|
||||
LPCITEMIDLIST pidl,
|
||||
UINT wFlags)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface,
|
||||
BOOL fEnable)
|
||||
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface,
|
||||
UINT id,
|
||||
HWND *lphwnd)
|
||||
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface,
|
||||
DWORD mode,
|
||||
LPSTREAM *pStrm)
|
||||
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IShellBrowserImpl_InsertMenusSB(IShellBrowser *iface,
|
||||
HMENU hmenuShared,
|
||||
LPOLEMENUGROUPWIDTHS lpMenuWidths)
|
||||
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface,
|
||||
IShellView *ppshv)
|
||||
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *iface,
|
||||
IShellView **ppshv)
|
||||
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB(IShellBrowser *iface,
|
||||
HMENU hmenuShared)
|
||||
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface,
|
||||
UINT id,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam,
|
||||
LRESULT *pret)
|
||||
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface,
|
||||
HMENU hmenuShared,
|
||||
HOLEMENU holemenuReserved,
|
||||
HWND hwndActiveObject)
|
||||
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface,
|
||||
LPCOLESTR lpszStatusText)
|
||||
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface,
|
||||
LPTBBUTTON lpButtons,
|
||||
UINT nButtons,
|
||||
UINT uFlags)
|
||||
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface,
|
||||
LPMSG lpmsg,
|
||||
WORD wID)
|
||||
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const IShellBrowserVtbl IShellBrowserImpl_Vtbl =
|
||||
{
|
||||
IShellBrowserImpl_QueryInterface,
|
||||
IShellBrowserImpl_AddRef,
|
||||
IShellBrowserImpl_Release,
|
||||
IShellBrowserImpl_GetWindow,
|
||||
IShellBrowserImpl_ContextSensitiveHelp,
|
||||
IShellBrowserImpl_InsertMenusSB,
|
||||
IShellBrowserImpl_SetMenuSB,
|
||||
IShellBrowserImpl_RemoveMenusSB,
|
||||
IShellBrowserImpl_SetStatusTextSB,
|
||||
IShellBrowserImpl_EnableModelessSB,
|
||||
IShellBrowserImpl_TranslateAcceleratorSB,
|
||||
IShellBrowserImpl_BrowseObject,
|
||||
IShellBrowserImpl_GetViewStateStream,
|
||||
IShellBrowserImpl_GetControlWindow,
|
||||
IShellBrowserImpl_SendControlMsg,
|
||||
IShellBrowserImpl_QueryActiveShellView,
|
||||
IShellBrowserImpl_OnViewWindowActive,
|
||||
IShellBrowserImpl_SetToolbarItems
|
||||
};
|
||||
|
||||
static const struct message empty_seq[] = {
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static const struct message folderview_getspacing_seq[] = {
|
||||
{ LVM_GETITEMSPACING, wparam|sent, FALSE },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static const struct message folderview_getselectionmarked_seq[] = {
|
||||
{ LVM_GETSELECTIONMARK, sent },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static const struct message folderview_getfocused_seq[] = {
|
||||
{ LVM_GETNEXTITEM, sent|wparam|lparam, -1, LVNI_FOCUSED },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static const struct message folderview_itemcount_seq[] = {
|
||||
{ LVM_GETITEMCOUNT, sent },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void test_IShellView_CreateViewWindow(void)
|
||||
{
|
||||
IShellFolder *desktop;
|
||||
FOLDERSETTINGS settings;
|
||||
IShellView *view;
|
||||
IDropTarget *dt;
|
||||
HWND hwnd_view;
|
||||
HRESULT hr;
|
||||
RECT r = {0};
|
||||
|
||||
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);
|
||||
|
||||
if (0)
|
||||
{
|
||||
/* crashes on native */
|
||||
hr = IShellView_CreateViewWindow(view, NULL, &settings, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
settings.ViewMode = FVM_ICON;
|
||||
settings.fFlags = 0;
|
||||
hwnd_view = (HWND)0xdeadbeef;
|
||||
hr = IShellView_CreateViewWindow(view, NULL, &settings, NULL, NULL, &hwnd_view);
|
||||
ok(hr == E_UNEXPECTED, "got (0x%08x)\n", hr);
|
||||
ok(hwnd_view == 0, "got %p\n", hwnd_view);
|
||||
|
||||
hwnd_view = (HWND)0xdeadbeef;
|
||||
hr = IShellView_CreateViewWindow(view, NULL, &settings, NULL, &r, &hwnd_view);
|
||||
ok(hr == E_UNEXPECTED, "got (0x%08x)\n", hr);
|
||||
ok(hwnd_view == 0, "got %p\n", hwnd_view);
|
||||
|
||||
/* ::DragLeave without drag operation */
|
||||
hr = IShellView_QueryInterface(view, &IID_IDropTarget, (void**)&dt);
|
||||
ok(hr == S_OK, "got (0x%08x)\n", hr);
|
||||
hr = IDropTarget_DragLeave(dt);
|
||||
ok(hr == S_OK, "got (0x%08x)\n", hr);
|
||||
IDropTarget_Release(dt);
|
||||
|
||||
IShellView_Release(view);
|
||||
IShellFolder_Release(desktop);
|
||||
}
|
||||
|
||||
static void test_IFolderView(void)
|
||||
{
|
||||
IShellFolder *desktop, *folder;
|
||||
FOLDERSETTINGS settings;
|
||||
IShellView *view;
|
||||
IShellBrowser *browser;
|
||||
IFolderView *fv;
|
||||
HWND hwnd_view, hwnd_list;
|
||||
PITEMID_CHILD pidl;
|
||||
HRESULT hr;
|
||||
INT ret;
|
||||
POINT pt;
|
||||
LONG ref1, ref2;
|
||||
RECT r;
|
||||
|
||||
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_IFolderView, (void**)&fv);
|
||||
if (hr != S_OK)
|
||||
{
|
||||
win_skip("IFolderView not supported by desktop folder\n");
|
||||
IShellView_Release(view);
|
||||
IShellFolder_Release(desktop);
|
||||
return;
|
||||
}
|
||||
|
||||
/* call methods before window creation */
|
||||
hr = IFolderView_GetSpacing(fv, NULL);
|
||||
ok(hr == S_FALSE || broken(hr == S_OK) /* win7 */, "got (0x%08x)\n", hr);
|
||||
|
||||
pidl = (void*)0xdeadbeef;
|
||||
hr = IFolderView_Item(fv, 0, &pidl);
|
||||
ok(hr == E_INVALIDARG || broken(hr == E_FAIL) /* < Vista */, "got (0x%08x)\n", hr);
|
||||
ok(pidl == 0 || broken(pidl == (void*)0xdeadbeef) /* < Vista */, "got %p\n", pidl);
|
||||
|
||||
if (0)
|
||||
{
|
||||
/* crashes on Vista and Win2k8 - List not created yet case */
|
||||
hr = IFolderView_GetSpacing(fv, &pt);
|
||||
|
||||
/* crashes on XP */
|
||||
hr = IFolderView_GetSelectionMarkedItem(fv, NULL);
|
||||
hr = IFolderView_GetFocusedItem(fv, NULL);
|
||||
|
||||
/* crashes on Vista+ */
|
||||
hr = IFolderView_Item(fv, 0, NULL);
|
||||
}
|
||||
|
||||
browser = IShellBrowserImpl_Construct();
|
||||
|
||||
settings.ViewMode = FVM_ICON;
|
||||
settings.fFlags = 0;
|
||||
hwnd_view = (HWND)0xdeadbeef;
|
||||
r.left = r.top = 0;
|
||||
r.right = r.bottom = 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);
|
||||
|
||||
hwnd_list = subclass_listview(hwnd_view);
|
||||
if (!hwnd_list)
|
||||
{
|
||||
win_skip("Failed to subclass ListView control\n");
|
||||
IShellBrowser_Release(browser);
|
||||
IFolderView_Release(fv);
|
||||
IShellView_Release(view);
|
||||
IShellFolder_Release(desktop);
|
||||
return;
|
||||
}
|
||||
|
||||
/* IFolderView::GetSpacing */
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
hr = IFolderView_GetSpacing(fv, NULL);
|
||||
ok(hr == S_OK, "got (0x%08x)\n", hr);
|
||||
ok_sequence(sequences, LISTVIEW_SEQ_INDEX, empty_seq, "IFolderView::GetSpacing, empty", FALSE);
|
||||
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
hr = IFolderView_GetSpacing(fv, &pt);
|
||||
ok(hr == S_OK, "got (0x%08x)\n", hr);
|
||||
/* fails with empty sequence on win7 for unknown reason */
|
||||
if (sequences[LISTVIEW_SEQ_INDEX]->count)
|
||||
{
|
||||
ok_sequence(sequences, LISTVIEW_SEQ_INDEX, folderview_getspacing_seq, "IFolderView::GetSpacing", FALSE);
|
||||
ok(pt.x > 0, "got %d\n", pt.x);
|
||||
ok(pt.y > 0, "got %d\n", pt.y);
|
||||
ret = SendMessageA(hwnd_list, LVM_GETITEMSPACING, 0, 0);
|
||||
ok(pt.x == LOWORD(ret) && pt.y == HIWORD(ret), "got (%d, %d)\n", LOWORD(ret), HIWORD(ret));
|
||||
}
|
||||
|
||||
/* IFolderView::GetSelectionMarkedItem */
|
||||
if (0)
|
||||
{
|
||||
/* crashes on XP */
|
||||
hr = IFolderView_GetSelectionMarkedItem(fv, NULL);
|
||||
}
|
||||
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
hr = IFolderView_GetSelectionMarkedItem(fv, &ret);
|
||||
ok(hr == S_OK, "got (0x%08x)\n", hr);
|
||||
ok_sequence(sequences, LISTVIEW_SEQ_INDEX, folderview_getselectionmarked_seq,
|
||||
"IFolderView::GetSelectionMarkedItem", FALSE);
|
||||
|
||||
/* IFolderView::GetFocusedItem */
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
hr = IFolderView_GetFocusedItem(fv, &ret);
|
||||
ok(hr == S_OK, "got (0x%08x)\n", hr);
|
||||
ok_sequence(sequences, LISTVIEW_SEQ_INDEX, folderview_getfocused_seq,
|
||||
"IFolderView::GetFocusedItem", FALSE);
|
||||
|
||||
/* IFolderView::GetFolder, just return pointer */
|
||||
if (0)
|
||||
{
|
||||
/* crashes on XP */
|
||||
hr = IFolderView_GetFolder(fv, NULL, (void**)&folder);
|
||||
hr = IFolderView_GetFolder(fv, NULL, NULL);
|
||||
}
|
||||
|
||||
hr = IFolderView_GetFolder(fv, &IID_IShellFolder, NULL);
|
||||
ok(hr == E_POINTER, "got (0x%08x)\n", hr);
|
||||
|
||||
ref1 = IShellFolder_AddRef(desktop);
|
||||
IShellFolder_Release(desktop);
|
||||
hr = IFolderView_GetFolder(fv, &IID_IShellFolder, (void**)&folder);
|
||||
ok(hr == S_OK, "got (0x%08x)\n", hr);
|
||||
ref2 = IShellFolder_AddRef(desktop);
|
||||
IShellFolder_Release(desktop);
|
||||
ok(ref1 == ref2, "expected same refcount, got %d\n", ref2);
|
||||
ok(desktop == folder, "\n");
|
||||
|
||||
/* IFolderView::ItemCount */
|
||||
if (0)
|
||||
{
|
||||
/* crashes on XP */
|
||||
hr = IFolderView_ItemCount(fv, SVGIO_ALLVIEW, NULL);
|
||||
}
|
||||
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
hr = IFolderView_ItemCount(fv, SVGIO_ALLVIEW, &ret);
|
||||
ok(hr == S_OK, "got (0x%08x)\n", hr);
|
||||
ok_sequence(sequences, LISTVIEW_SEQ_INDEX, folderview_itemcount_seq,
|
||||
"IFolderView::ItemCount", FALSE);
|
||||
|
||||
IShellBrowser_Release(browser);
|
||||
IFolderView_Release(fv);
|
||||
IShellView_Release(view);
|
||||
IShellFolder_Release(desktop);
|
||||
}
|
||||
|
||||
static void test_GetItemObject(void)
|
||||
{
|
||||
IShellFolder *desktop;
|
||||
IShellView *view;
|
||||
IUnknown *unk;
|
||||
HRESULT hr;
|
||||
|
||||
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);
|
||||
|
||||
/* from documentation three interfaces are supported for SVGIO_BACKGROUND:
|
||||
IContextMenu, IDispatch, IPersistHistory */
|
||||
hr = IShellView_GetItemObject(view, SVGIO_BACKGROUND, &IID_IContextMenu, (void**)&unk);
|
||||
ok(hr == S_OK, "got (0x%08x)\n", hr);
|
||||
IUnknown_Release(unk);
|
||||
|
||||
unk = NULL;
|
||||
hr = IShellView_GetItemObject(view, SVGIO_BACKGROUND, &IID_IDispatch, (void**)&unk);
|
||||
todo_wine ok(hr == S_OK || broken(hr == E_NOTIMPL) /* NT4 */, "got (0x%08x)\n", hr);
|
||||
if (unk) IUnknown_Release(unk);
|
||||
|
||||
unk = NULL;
|
||||
hr = IShellView_GetItemObject(view, SVGIO_BACKGROUND, &IID_IPersistHistory, (void**)&unk);
|
||||
todo_wine ok(hr == S_OK || broken(hr == E_NOTIMPL) /* W9x, NT4 */, "got (0x%08x)\n", hr);
|
||||
if (unk) IUnknown_Release(unk);
|
||||
|
||||
/* example of unsupported interface, base for IPersistHistory */
|
||||
hr = IShellView_GetItemObject(view, SVGIO_BACKGROUND, &IID_IPersist, (void**)&unk);
|
||||
ok(hr == E_NOINTERFACE || broken(hr == E_NOTIMPL) /* W2K */, "got (0x%08x)\n", hr);
|
||||
|
||||
IShellView_Release(view);
|
||||
IShellFolder_Release(desktop);
|
||||
}
|
||||
|
||||
static void test_IShellFolderView(void)
|
||||
{
|
||||
IShellFolderView *folderview;
|
||||
IShellFolder *desktop;
|
||||
IShellView *view;
|
||||
IDataObject *obj;
|
||||
UINT i;
|
||||
HRESULT hr;
|
||||
|
||||
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_IShellFolderView, (void**)&folderview);
|
||||
if (hr != S_OK)
|
||||
{
|
||||
win_skip("IShellView doesn't provide IShellFolderView on this platform\n");
|
||||
IShellView_Release(view);
|
||||
IShellFolder_Release(desktop);
|
||||
return;
|
||||
}
|
||||
|
||||
/* ::MoveIcons */
|
||||
obj = IDataObjectImpl_Construct();
|
||||
hr = IShellFolderView_MoveIcons(folderview, obj);
|
||||
ok(hr == E_NOTIMPL || broken(hr == S_OK) /* W98 */, "got (0x%08x)\n", hr);
|
||||
IDataObject_Release(obj);
|
||||
|
||||
/* ::SetRedraw without list created */
|
||||
hr = IShellFolderView_SetRedraw(folderview, TRUE);
|
||||
ok(hr == S_OK, "got (0x%08x)\n", hr);
|
||||
|
||||
/* ::QuerySupport */
|
||||
hr = IShellFolderView_QuerySupport(folderview, NULL);
|
||||
ok(hr == S_OK, "got (0x%08x)\n", hr);
|
||||
i = 0xdeadbeef;
|
||||
hr = IShellFolderView_QuerySupport(folderview, &i);
|
||||
ok(hr == S_OK, "got (0x%08x)\n", hr);
|
||||
ok(i == 0xdeadbeef, "got %d\n", i);
|
||||
|
||||
/* ::RemoveObject */
|
||||
i = 0xdeadbeef;
|
||||
hr = IShellFolderView_RemoveObject(folderview, NULL, &i);
|
||||
ok(hr == S_OK, "got (0x%08x)\n", hr);
|
||||
ok(i == 0 || i == -1 /* Win7 */ || broken(i == 0xdeadbeef) /* Vista, 2k8 */,
|
||||
"got %d\n", i);
|
||||
|
||||
IShellFolderView_Release(folderview);
|
||||
|
||||
IShellView_Release(view);
|
||||
IShellFolder_Release(desktop);
|
||||
}
|
||||
|
||||
static void test_IOleWindow(void)
|
||||
{
|
||||
IShellFolder *desktop;
|
||||
IShellView *view;
|
||||
HRESULT hr;
|
||||
|
||||
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);
|
||||
|
||||
/* IShellView::ContextSensitiveHelp */
|
||||
hr = IShellView_ContextSensitiveHelp(view, TRUE);
|
||||
ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr);
|
||||
hr = IShellView_ContextSensitiveHelp(view, FALSE);
|
||||
ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr);
|
||||
|
||||
IShellView_Release(view);
|
||||
IShellFolder_Release(desktop);
|
||||
}
|
||||
|
||||
START_TEST(shlview)
|
||||
{
|
||||
OleInitialize(NULL);
|
||||
|
||||
init_msg_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
||||
test_IShellView_CreateViewWindow();
|
||||
test_IFolderView();
|
||||
test_GetItemObject();
|
||||
test_IShellFolderView();
|
||||
test_IOleWindow();
|
||||
|
||||
OleUninitialize();
|
||||
}
|
|
@ -12,11 +12,11 @@ extern void func_generated(void);
|
|||
extern void func_progman_dde(void);
|
||||
extern void func_shelllink(void);
|
||||
extern void func_shellpath(void);
|
||||
extern void func_shfldr_netplaces(void);
|
||||
extern void func_shfldr_special(void);
|
||||
extern void func_shlexec(void);
|
||||
extern void func_shlfileop(void);
|
||||
extern void func_shlfolder(void);
|
||||
extern void func_shlview(void);
|
||||
extern void func_string(void);
|
||||
extern void func_systray(void);
|
||||
|
||||
|
@ -28,11 +28,11 @@ const struct test winetest_testlist[] =
|
|||
{ "progman_dde", func_progman_dde },
|
||||
{ "shelllink", func_shelllink },
|
||||
{ "shellpath", func_shellpath },
|
||||
{ "shfldr_netplaces", func_shfldr_netplaces },
|
||||
{ "shfldr_special", func_shfldr_special },
|
||||
{ "shlexec", func_shlexec },
|
||||
{ "shlfileop", func_shlfileop },
|
||||
{ "shlfolder", func_shlfolder },
|
||||
{ "shlview", func_shlview },
|
||||
{ "string", func_string },
|
||||
{ "systray", func_systray },
|
||||
{ 0, 0 }
|
||||
|
|
Loading…
Reference in a new issue