shell32/tests: Use strict comparison for return values.

This commit is contained in:
Nikolay Sivov 2010-03-23 04:21:13 +03:00 committed by Alexandre Julliard
parent 0a32123d10
commit edcaf53f94
5 changed files with 184 additions and 184 deletions

View File

@ -47,7 +47,7 @@ static IAutoComplete *test_init(void)
win_skip("CLSID_AutoComplete is not registered\n"); win_skip("CLSID_AutoComplete is not registered\n");
return NULL; 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 */ /* AutoComplete source */
r = CoCreateInstance(&CLSID_ACLMulti, NULL, CLSCTX_INPROC_SERVER, r = CoCreateInstance(&CLSID_ACLMulti, NULL, CLSCTX_INPROC_SERVER,
@ -57,7 +57,7 @@ static IAutoComplete *test_init(void)
win_skip("CLSID_ACLMulti is not registered\n"); win_skip("CLSID_ACLMulti is not registered\n");
return NULL; 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) if (0)
{ {
@ -66,7 +66,7 @@ if (0)
} }
/* bind to edit control */ /* bind to edit control */
r = IAutoComplete_Init(ac, hEdit, acSource, NULL, NULL); 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); IUnknown_Release(acSource);
@ -126,8 +126,8 @@ START_TEST(autocomplete)
IAutoComplete* ac; IAutoComplete* ac;
r = CoInitialize(NULL); r = CoInitialize(NULL);
ok(SUCCEEDED(r), "CoInitialize failed (0x%08x). Tests aborted.\n", r); ok(r == S_OK, "CoInitialize failed (0x%08x). Tests aborted.\n", r);
if (FAILED(r)) if (r != S_OK)
return; return;
createMainWnd(); createMainWnd();

View File

@ -92,7 +92,7 @@ static LPITEMIDLIST path_to_pidl(const char* path)
MultiByteToWideChar(CP_ACP, 0, path, -1, pathW, len); MultiByteToWideChar(CP_ACP, 0, path, -1, pathW, len);
r=pSHILCreateFromPath(pathW, &pidl, NULL); 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); HeapFree(GetProcessHeap(), 0, pathW);
} }
return pidl; return pidl;
@ -117,44 +117,44 @@ static void test_get_set(void)
r = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, r = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
&IID_IShellLinkA, (LPVOID*)&sl); &IID_IShellLinkA, (LPVOID*)&sl);
ok(SUCCEEDED(r), "no IID_IShellLinkA (0x%08x)\n", r); ok(r == S_OK, "no IID_IShellLinkA (0x%08x)\n", r);
if (FAILED(r)) if (r != S_OK)
return; return;
/* Test Getting / Setting the description */ /* Test Getting / Setting the description */
strcpy(buffer,"garbage"); strcpy(buffer,"garbage");
r = IShellLinkA_GetDescription(sl, buffer, sizeof(buffer)); 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); ok(*buffer=='\0', "GetDescription returned '%s'\n", buffer);
str="Some description"; str="Some description";
r = IShellLinkA_SetDescription(sl, str); 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"); strcpy(buffer,"garbage");
r = IShellLinkA_GetDescription(sl, buffer, sizeof(buffer)); 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); ok(lstrcmp(buffer,str)==0, "GetDescription returned '%s'\n", buffer);
/* Test Getting / Setting the work directory */ /* Test Getting / Setting the work directory */
strcpy(buffer,"garbage"); strcpy(buffer,"garbage");
r = IShellLinkA_GetWorkingDirectory(sl, buffer, sizeof(buffer)); 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); ok(*buffer=='\0', "GetWorkingDirectory returned '%s'\n", buffer);
str="c:\\nonexistent\\directory"; str="c:\\nonexistent\\directory";
r = IShellLinkA_SetWorkingDirectory(sl, str); 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"); strcpy(buffer,"garbage");
r = IShellLinkA_GetWorkingDirectory(sl, buffer, sizeof(buffer)); 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); ok(lstrcmpi(buffer,str)==0, "GetWorkingDirectory returned '%s'\n", buffer);
/* Test Getting / Setting the path */ /* Test Getting / Setting the path */
strcpy(buffer,"garbage"); strcpy(buffer,"garbage");
r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH); 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); ok(*buffer=='\0', "GetPath returned '%s'\n", buffer);
CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
@ -175,7 +175,7 @@ static void test_get_set(void)
strcpy(buffer,"garbage"); strcpy(buffer,"garbage");
r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH); 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); ok(*buffer=='\0', "GetPath returned '%s'\n", buffer);
/* Win98 returns S_FALSE, but WinXP returns S_OK */ /* Win98 returns S_FALSE, but WinXP returns S_OK */
@ -185,7 +185,7 @@ static void test_get_set(void)
strcpy(buffer,"garbage"); strcpy(buffer,"garbage");
r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH); 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); ok(lstrcmpi(buffer,str)==0, "GetPath returned '%s'\n", buffer);
/* Get some real path to play with */ /* Get some real path to play with */
@ -195,8 +195,8 @@ static void test_get_set(void)
/* Test the interaction of SetPath and SetIDList */ /* Test the interaction of SetPath and SetIDList */
tmp_pidl=NULL; tmp_pidl=NULL;
r = IShellLinkA_GetIDList(sl, &tmp_pidl); r = IShellLinkA_GetIDList(sl, &tmp_pidl);
ok(SUCCEEDED(r), "GetIDList failed (0x%08x)\n", r); todo_wine ok(r == S_OK, "GetIDList failed (0x%08x)\n", r);
if (SUCCEEDED(r)) if (r == S_OK)
{ {
BOOL ret; BOOL ret;
@ -218,16 +218,16 @@ static void test_get_set(void)
LPITEMIDLIST second_pidl; LPITEMIDLIST second_pidl;
r = IShellLinkA_SetIDList(sl, 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; tmp_pidl=NULL;
r = IShellLinkA_GetIDList(sl, &tmp_pidl); 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), ok(tmp_pidl && pILIsEqual(pidl, tmp_pidl),
"GetIDList returned an incorrect pidl\n"); "GetIDList returned an incorrect pidl\n");
r = IShellLinkA_GetIDList(sl, &second_pidl); 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), ok(second_pidl && pILIsEqual(pidl, second_pidl),
"GetIDList returned an incorrect pidl\n"); "GetIDList returned an incorrect pidl\n");
ok(second_pidl != tmp_pidl, "pidls are the same\n"); ok(second_pidl != tmp_pidl, "pidls are the same\n");
@ -238,7 +238,7 @@ static void test_get_set(void)
strcpy(buffer,"garbage"); strcpy(buffer,"garbage");
r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH); 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 todo_wine
ok(lstrcmpi(buffer, mypath)==0, "GetPath returned '%s'\n", buffer); ok(lstrcmpi(buffer, mypath)==0, "GetPath returned '%s'\n", buffer);
@ -273,44 +273,44 @@ static void test_get_set(void)
/* Test Getting / Setting the arguments */ /* Test Getting / Setting the arguments */
strcpy(buffer,"garbage"); strcpy(buffer,"garbage");
r = IShellLinkA_GetArguments(sl, buffer, sizeof(buffer)); 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); ok(*buffer=='\0', "GetArguments returned '%s'\n", buffer);
str="param1 \"spaced param2\""; str="param1 \"spaced param2\"";
r = IShellLinkA_SetArguments(sl, str); 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"); strcpy(buffer,"garbage");
r = IShellLinkA_GetArguments(sl, buffer, sizeof(buffer)); 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); ok(lstrcmp(buffer,str)==0, "GetArguments returned '%s'\n", buffer);
strcpy(buffer,"garbage"); strcpy(buffer,"garbage");
r = IShellLinkA_SetArguments(sl, NULL); 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)); 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); ok(!buffer[0] || lstrcmp(buffer,str)==0, "GetArguments returned '%s'\n", buffer);
strcpy(buffer,"garbage"); strcpy(buffer,"garbage");
r = IShellLinkA_SetArguments(sl, ""); 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)); 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); ok(!buffer[0], "GetArguments returned '%s'\n", buffer);
/* Test Getting / Setting showcmd */ /* Test Getting / Setting showcmd */
i=0xdeadbeef; i=0xdeadbeef;
r = IShellLinkA_GetShowCmd(sl, &i); 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); ok(i==SW_SHOWNORMAL, "GetShowCmd returned %d\n", i);
r = IShellLinkA_SetShowCmd(sl, SW_SHOWMAXIMIZED); 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; i=0xdeadbeef;
r = IShellLinkA_GetShowCmd(sl, &i); 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); ok(i==SW_SHOWMAXIMIZED, "GetShowCmd returned %d'\n", i);
/* Test Getting / Setting the icon */ /* Test Getting / Setting the icon */
@ -318,33 +318,33 @@ static void test_get_set(void)
strcpy(buffer,"garbage"); strcpy(buffer,"garbage");
r = IShellLinkA_GetIconLocation(sl, buffer, sizeof(buffer), &i); r = IShellLinkA_GetIconLocation(sl, buffer, sizeof(buffer), &i);
todo_wine { 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(*buffer=='\0', "GetIconLocation returned '%s'\n", buffer);
ok(i==0, "GetIconLocation returned %d\n", i); ok(i==0, "GetIconLocation returned %d\n", i);
str="c:\\nonexistent\\file"; str="c:\\nonexistent\\file";
r = IShellLinkA_SetIconLocation(sl, str, 0xbabecafe); 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; i=0xdeadbeef;
r = IShellLinkA_GetIconLocation(sl, buffer, sizeof(buffer), &i); 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(lstrcmpi(buffer,str)==0, "GetIconLocation returned '%s'\n", buffer);
ok(i==0xbabecafe, "GetIconLocation returned %d'\n", i); ok(i==0xbabecafe, "GetIconLocation returned %d'\n", i);
/* Test Getting / Setting the hot key */ /* Test Getting / Setting the hot key */
w=0xbeef; w=0xbeef;
r = IShellLinkA_GetHotkey(sl, &w); 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); ok(w==0, "GetHotkey returned %d\n", w);
r = IShellLinkA_SetHotkey(sl, 0x5678); 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; w=0xbeef;
r = IShellLinkA_GetHotkey(sl, &w); 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); ok(w==0x5678, "GetHotkey returned %d'\n", w);
IShellLinkA_Release(sl); IShellLinkA_Release(sl);
@ -372,19 +372,19 @@ void create_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int save_fails)
r = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, r = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
&IID_IShellLinkA, (LPVOID*)&sl); &IID_IShellLinkA, (LPVOID*)&sl);
lok(SUCCEEDED(r), "no IID_IShellLinkA (0x%08x)\n", r); lok(r == S_OK, "no IID_IShellLinkA (0x%08x)\n", r);
if (FAILED(r)) if (r != S_OK)
return; return;
if (desc->description) if (desc->description)
{ {
r = IShellLinkA_SetDescription(sl, 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) if (desc->workdir)
{ {
r = IShellLinkA_SetWorkingDirectory(sl, 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) if (desc->path)
{ {
@ -394,32 +394,32 @@ void create_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int save_fails)
if (desc->pidl) if (desc->pidl)
{ {
r = IShellLinkA_SetIDList(sl, 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) if (desc->arguments)
{ {
r = IShellLinkA_SetArguments(sl, 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) if (desc->showcmd)
{ {
r = IShellLinkA_SetShowCmd(sl, 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) if (desc->icon)
{ {
r = IShellLinkA_SetIconLocation(sl, desc->icon, desc->icon_id); 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) if (desc->hotkey)
{ {
r = IShellLinkA_SetHotkey(sl, 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); r = IShellLinkW_QueryInterface(sl, &IID_IPersistFile, (LPVOID*)&pf);
lok(SUCCEEDED(r), "no IID_IPersistFile (0x%08x)\n", r); lok(r == S_OK, "no IID_IPersistFile (0x%08x)\n", r);
if (SUCCEEDED(r)) if (r == S_OK)
{ {
LPOLESTR str; LPOLESTR str;
@ -441,12 +441,12 @@ void create_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int save_fails)
if (save_fails) if (save_fails)
{ {
todo_wine { todo_wine {
lok(SUCCEEDED(r), "save failed (0x%08x)\n", r); lok(r == S_OK, "save failed (0x%08x)\n", r);
} }
} }
else else
{ {
lok(SUCCEEDED(r), "save failed (0x%08x)\n", r); lok(r == S_OK, "save failed (0x%08x)\n", r);
} }
/* test GetCurFile after ::Save */ /* test GetCurFile after ::Save */
@ -484,13 +484,13 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int todo)
r = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, r = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
&IID_IShellLinkA, (LPVOID*)&sl); &IID_IShellLinkA, (LPVOID*)&sl);
lok(SUCCEEDED(r), "no IID_IShellLinkA (0x%08x)\n", r); lok(r == S_OK, "no IID_IShellLinkA (0x%08x)\n", r);
if (FAILED(r)) if (r != S_OK)
return; return;
r = IShellLinkA_QueryInterface(sl, &IID_IPersistFile, (LPVOID*)&pf); r = IShellLinkA_QueryInterface(sl, &IID_IPersistFile, (LPVOID*)&pf);
lok(SUCCEEDED(r), "no IID_IPersistFile (0x%08x)\n", r); lok(r == S_OK, "no IID_IPersistFile (0x%08x)\n", r);
if (FAILED(r)) if (r != S_OK)
{ {
IShellLinkA_Release(sl); IShellLinkA_Release(sl);
return; return;
@ -505,7 +505,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int todo)
lok(str == NULL, "got %p\n", str); lok(str == NULL, "got %p\n", str);
r = IPersistFile_Load(pf, path, STGM_READ); 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 */ /* test GetCurFile after ::Save */
r = IPersistFile_GetCurFile(pf, &str); r = IPersistFile_GetCurFile(pf, &str);
@ -527,7 +527,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int todo)
win_skip("GetCurFile fails on shell32 < 5.0\n"); win_skip("GetCurFile fails on shell32 < 5.0\n");
IPersistFile_Release(pf); IPersistFile_Release(pf);
if (FAILED(r)) if (r != S_OK)
{ {
IShellLinkA_Release(sl); IShellLinkA_Release(sl);
return; return;
@ -537,7 +537,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int todo)
{ {
strcpy(buffer,"garbage"); strcpy(buffer,"garbage");
r = IShellLinkA_GetDescription(sl, buffer, sizeof(buffer)); 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, lok_todo_4(0x1, lstrcmp(buffer, desc->description)==0,
"GetDescription returned '%s' instead of '%s'\n", "GetDescription returned '%s' instead of '%s'\n",
buffer, desc->description); buffer, desc->description);
@ -546,7 +546,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int todo)
{ {
strcpy(buffer,"garbage"); strcpy(buffer,"garbage");
r = IShellLinkA_GetWorkingDirectory(sl, buffer, sizeof(buffer)); 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, lok_todo_4(0x2, lstrcmpi(buffer, desc->workdir)==0,
"GetWorkingDirectory returned '%s' instead of '%s'\n", "GetWorkingDirectory returned '%s' instead of '%s'\n",
buffer, desc->workdir); buffer, desc->workdir);
@ -564,7 +564,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int todo)
{ {
LPITEMIDLIST pidl=NULL; LPITEMIDLIST pidl=NULL;
r = IShellLinkA_GetIDList(sl, &pidl); 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), lok_todo_2(0x8, pILIsEqual(pidl, desc->pidl),
"GetIDList returned an incorrect pidl\n"); "GetIDList returned an incorrect pidl\n");
} }
@ -572,7 +572,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int todo)
{ {
int i=0xdeadbeef; int i=0xdeadbeef;
r = IShellLinkA_GetShowCmd(sl, &i); 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, lok_todo_4(0x10, i==desc->showcmd,
"GetShowCmd returned 0x%0x instead of 0x%0x\n", "GetShowCmd returned 0x%0x instead of 0x%0x\n",
i, desc->showcmd); i, desc->showcmd);
@ -582,7 +582,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int todo)
int i=0xdeadbeef; int i=0xdeadbeef;
strcpy(buffer,"garbage"); strcpy(buffer,"garbage");
r = IShellLinkA_GetIconLocation(sl, buffer, sizeof(buffer), &i); 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, lok_todo_4(0x20, lstrcmpi(buffer, desc->icon)==0,
"GetIconLocation returned '%s' instead of '%s'\n", "GetIconLocation returned '%s' instead of '%s'\n",
buffer, desc->icon); buffer, desc->icon);
@ -594,7 +594,7 @@ static void check_lnk_(int line, const WCHAR* path, lnk_desc_t* desc, int todo)
{ {
WORD i=0xbeef; WORD i=0xbeef;
r = IShellLinkA_GetHotkey(sl, &i); 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, lok_todo_4(0x40, i==desc->hotkey,
"GetHotkey returned 0x%04x instead of 0x%04x\n", "GetHotkey returned 0x%04x instead of 0x%04x\n",
i, desc->hotkey); i, desc->hotkey);
@ -878,8 +878,8 @@ START_TEST(shelllink)
pGetShortPathNameA = (void *)GetProcAddress(hkernel32, "GetShortPathNameA"); pGetShortPathNameA = (void *)GetProcAddress(hkernel32, "GetShortPathNameA");
r = CoInitialize(NULL); 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)) if (r != S_OK)
return; return;
test_get_set(); test_get_set();

View File

@ -201,7 +201,7 @@ static void loadShell32(void)
{ {
HRESULT hr = pSHGetMalloc(&pMalloc); 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"); ok(pMalloc != NULL, "SHGetMalloc returned a NULL IMalloc\n");
} }
@ -315,14 +315,14 @@ static void testSHGetFolderLocationInvalidArgs(void)
hr = pSHGetFolderLocation(NULL, 0xeeee, NULL, 0, &pidl); hr = pSHGetFolderLocation(NULL, 0xeeee, NULL, 0, &pidl);
ok(hr == E_INVALIDARG, ok(hr == E_INVALIDARG,
"SHGetFolderLocation(NULL, 0xeeee, NULL, 0, &pidl) returned 0x%08x, expected E_INVALIDARG\n", hr); "SHGetFolderLocation(NULL, 0xeeee, NULL, 0, &pidl) returned 0x%08x, expected E_INVALIDARG\n", hr);
if (SUCCEEDED(hr)) if (hr == S_OK)
IMalloc_Free(pMalloc, pidl); IMalloc_Free(pMalloc, pidl);
/* check a bogus user token: */ /* check a bogus user token: */
pidl = NULL; pidl = NULL;
hr = pSHGetFolderLocation(NULL, CSIDL_FAVORITES, (HANDLE)2, 0, &pidl); hr = pSHGetFolderLocation(NULL, CSIDL_FAVORITES, (HANDLE)2, 0, &pidl);
ok(hr == E_FAIL || hr == E_HANDLE, 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); "SHGetFolderLocation(NULL, CSIDL_FAVORITES, 2, 0, &pidl) returned 0x%08x, expected E_FAIL or E_HANDLE\n", hr);
if (SUCCEEDED(hr)) if (hr == S_OK)
IMalloc_Free(pMalloc, pidl); IMalloc_Free(pMalloc, pidl);
/* a NULL pidl pointer crashes, so don't test it */ /* a NULL pidl pointer crashes, so don't test it */
} }
@ -403,7 +403,7 @@ static BYTE testSHGetFolderLocation(int folder)
pidl = NULL; pidl = NULL;
hr = pSHGetFolderLocation(NULL, folder, NULL, 0, &pidl); hr = pSHGetFolderLocation(NULL, folder, NULL, 0, &pidl);
if (SUCCEEDED(hr)) if (hr == S_OK)
{ {
if (pidl) if (pidl)
{ {
@ -431,7 +431,7 @@ static BYTE testSHGetSpecialFolderLocation(int folder)
pidl = NULL; pidl = NULL;
hr = pSHGetSpecialFolderLocation(NULL, folder, &pidl); hr = pSHGetSpecialFolderLocation(NULL, folder, &pidl);
if (SUCCEEDED(hr)) if (hr == S_OK)
{ {
if (pidl) if (pidl)
{ {
@ -455,7 +455,7 @@ static void testSHGetFolderPath(BOOL optional, int folder)
if (!pSHGetFolderPathA) return; if (!pSHGetFolderPathA) return;
hr = pSHGetFolderPathA(NULL, folder, NULL, SHGFP_TYPE_CURRENT, path); 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); "SHGetFolderPathA(NULL, %s, NULL, SHGFP_TYPE_CURRENT, path) failed: 0x%08x\n", getFolderName(folder), hr);
} }
@ -555,7 +555,7 @@ static void matchGUID(int folder, const GUID *guid, const GUID *guid_alt)
pidl = NULL; pidl = NULL;
hr = pSHGetFolderLocation(NULL, folder, NULL, 0, &pidl); hr = pSHGetFolderLocation(NULL, folder, NULL, 0, &pidl);
if (SUCCEEDED(hr)) if (hr == S_OK)
{ {
LPITEMIDLIST pidlLast = pILFindLastID(pidl); LPITEMIDLIST pidlLast = pILFindLastID(pidl);
@ -734,7 +734,7 @@ static void testNonExistentPath1(void)
&pidl); &pidl);
ok(hr == E_FAIL || hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), ok(hr == E_FAIL || hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
"SHGetFolderLocation returned 0x%08x\n", hr); "SHGetFolderLocation returned 0x%08x\n", hr);
if (SUCCEEDED(hr) && pidl) if (hr == S_OK && pidl)
IMalloc_Free(pMalloc, pidl); IMalloc_Free(pMalloc, pidl);
ok(!pSHGetSpecialFolderPathA(NULL, path, CSIDL_FAVORITES, FALSE), ok(!pSHGetSpecialFolderPathA(NULL, path, CSIDL_FAVORITES, FALSE),
"SHGetSpecialFolderPath succeeded, expected failure\n"); "SHGetSpecialFolderPath succeeded, expected failure\n");
@ -742,12 +742,12 @@ static void testNonExistentPath1(void)
hr = pSHGetSpecialFolderLocation(NULL, CSIDL_FAVORITES, &pidl); hr = pSHGetSpecialFolderLocation(NULL, CSIDL_FAVORITES, &pidl);
ok(hr == E_FAIL || hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), ok(hr == E_FAIL || hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
"SHGetFolderLocation returned 0x%08x\n", hr); "SHGetFolderLocation returned 0x%08x\n", hr);
if (SUCCEEDED(hr) && pidl) if (hr == S_OK && pidl)
IMalloc_Free(pMalloc, pidl); IMalloc_Free(pMalloc, pidl);
/* now test success: */ /* now test success: */
hr = pSHGetFolderPathA(NULL, CSIDL_FAVORITES | CSIDL_FLAG_CREATE, NULL, hr = pSHGetFolderPathA(NULL, CSIDL_FAVORITES | CSIDL_FLAG_CREATE, NULL,
SHGFP_TYPE_CURRENT, path); SHGFP_TYPE_CURRENT, path);
if (SUCCEEDED(hr)) if (hr == S_OK)
{ {
BOOL ret; BOOL ret;
@ -769,7 +769,7 @@ static void testNonExistentPath1(void)
ret = RemoveDirectoryA(path); ret = RemoveDirectoryA(path);
ok( ret, "failed to remove %s error %u\n", path, GetLastError() ); ok( ret, "failed to remove %s error %u\n", path, GetLastError() );
} }
ok(SUCCEEDED(hr), ok(hr == S_OK,
"SHGetFolderPath(NULL, CSIDL_FAVORITES | CSIDL_FLAG_CREATE, " "SHGetFolderPath(NULL, CSIDL_FAVORITES | CSIDL_FLAG_CREATE, "
"NULL, SHGFP_TYPE_CURRENT, path) failed: 0x%08x\n", hr); "NULL, SHGFP_TYPE_CURRENT, path) failed: 0x%08x\n", hr);
} }
@ -784,7 +784,7 @@ static void testNonExistentPath2(void)
hr = pSHGetFolderPathA(NULL, CSIDL_FAVORITES | CSIDL_FLAG_CREATE, NULL, hr = pSHGetFolderPathA(NULL, CSIDL_FAVORITES | CSIDL_FLAG_CREATE, NULL,
SHGFP_TYPE_CURRENT, path); SHGFP_TYPE_CURRENT, path);
ok(SUCCEEDED(hr), "SHGetFolderPath failed: 0x%08x\n", hr); ok(hr == S_OK, "SHGetFolderPath failed: 0x%08x\n", hr);
} }
static void doChild(const char *arg) static void doChild(const char *arg)

View File

@ -1854,7 +1854,7 @@ static void init_test(void)
} }
r = CoInitialize(NULL); 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)) if (FAILED(r))
exit(1); exit(1);

View File

@ -125,9 +125,9 @@ static void test_ParseDisplayName(void)
MultiByteToWideChar(CP_ACP, 0, cInetTestA, -1, cTestDirW, MAX_PATH); MultiByteToWideChar(CP_ACP, 0, cInetTestA, -1, cTestDirW, MAX_PATH);
hr = IShellFolder_ParseDisplayName(IDesktopFolder, hr = IShellFolder_ParseDisplayName(IDesktopFolder,
NULL, NULL, cTestDirW, NULL, &newPIDL, 0); 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); "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 " ok(pILFindLastID(newPIDL)->mkid.abID[0] == 0x61, "Last pidl should be of type "
"PT_IESPECIAL1, but is: %02x\n", pILFindLastID(newPIDL)->mkid.abID[0]); "PT_IESPECIAL1, but is: %02x\n", pILFindLastID(newPIDL)->mkid.abID[0]);
@ -137,9 +137,9 @@ static void test_ParseDisplayName(void)
MultiByteToWideChar(CP_ACP, 0, cInetTest2A, -1, cTestDirW, MAX_PATH); MultiByteToWideChar(CP_ACP, 0, cInetTest2A, -1, cTestDirW, MAX_PATH);
hr = IShellFolder_ParseDisplayName(IDesktopFolder, hr = IShellFolder_ParseDisplayName(IDesktopFolder,
NULL, NULL, cTestDirW, NULL, &newPIDL, 0); 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); "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 " ok(pILFindLastID(newPIDL)->mkid.abID[0] == 0x61, "Last pidl should be of type "
"PT_IESPECIAL1, but is: %02x\n", pILFindLastID(newPIDL)->mkid.abID[0]); "PT_IESPECIAL1, but is: %02x\n", pILFindLastID(newPIDL)->mkid.abID[0]);
@ -174,8 +174,8 @@ static void test_ParseDisplayName(void)
if (!bRes) goto finished; if (!bRes) goto finished;
hr = IShellFolder_ParseDisplayName(IDesktopFolder, NULL, NULL, cTestDirW, NULL, &newPIDL, 0); hr = IShellFolder_ParseDisplayName(IDesktopFolder, NULL, NULL, cTestDirW, NULL, &newPIDL, 0);
ok(SUCCEEDED(hr), "DesktopFolder->ParseDisplayName failed. hr = %08x.\n", hr); ok(hr == S_OK, "DesktopFolder->ParseDisplayName failed. hr = %08x.\n", hr);
if (FAILED(hr)) goto finished; if (hr != S_OK) goto finished;
ok(pILFindLastID(newPIDL)->mkid.abID[0] == 0x31 || ok(pILFindLastID(newPIDL)->mkid.abID[0] == 0x31 ||
pILFindLastID(newPIDL)->mkid.abID[0] == 0xb1, /* Win98 */ pILFindLastID(newPIDL)->mkid.abID[0] == 0xb1, /* Win98 */
@ -331,8 +331,8 @@ static void test_BindToObject(void)
* with an empty pidl. This is tested for Desktop, MyComputer and the FS ShellFolder * with an empty pidl. This is tested for Desktop, MyComputer and the FS ShellFolder
*/ */
hr = SHGetDesktopFolder(&psfDesktop); hr = SHGetDesktopFolder(&psfDesktop);
ok (SUCCEEDED(hr), "SHGetDesktopFolder failed! hr = %08x\n", hr); ok (hr == S_OK, "SHGetDesktopFolder failed! hr = %08x\n", hr);
if (FAILED(hr)) return; if (hr != S_OK) return;
hr = IShellFolder_BindToObject(psfDesktop, pidlEmpty, NULL, &IID_IShellFolder, (LPVOID*)&psfChild); 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); ok (hr == E_INVALIDARG, "Desktop's BindToObject should fail, when called with empty pidl! hr = %08x\n", hr);
@ -341,17 +341,17 @@ static void test_BindToObject(void)
ok (hr == E_INVALIDARG, "Desktop's BindToObject should fail, when called with NULL pidl! hr = %08x\n", hr); 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); 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); ok (hr == S_OK, "Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08x\n", hr);
if (FAILED(hr)) { if (hr != S_OK) {
IShellFolder_Release(psfDesktop); IShellFolder_Release(psfDesktop);
return; return;
} }
hr = IShellFolder_BindToObject(psfDesktop, pidlMyComputer, NULL, &IID_IShellFolder, (LPVOID*)&psfMyComputer); 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); IShellFolder_Release(psfDesktop);
IMalloc_Free(ppM, pidlMyComputer); IMalloc_Free(ppM, pidlMyComputer);
if (FAILED(hr)) return; if (hr != S_OK) return;
hr = IShellFolder_BindToObject(psfMyComputer, pidlEmpty, NULL, &IID_IShellFolder, (LPVOID*)&psfChild); 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); ok (hr == E_INVALIDARG, "MyComputers's BindToObject should fail, when called with empty pidl! hr = %08x\n", hr);
@ -372,17 +372,17 @@ if (0)
MultiByteToWideChar(CP_ACP, 0, szSystemDir, -1, wszSystemDir, MAX_PATH); MultiByteToWideChar(CP_ACP, 0, szSystemDir, -1, wszSystemDir, MAX_PATH);
hr = IShellFolder_ParseDisplayName(psfMyComputer, NULL, NULL, wszSystemDir, NULL, &pidlSystemDir, NULL); 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); ok (hr == S_OK, "MyComputers's ParseDisplayName failed to parse the SystemDirectory! hr = %08x\n", hr);
if (FAILED(hr)) { if (hr != S_OK) {
IShellFolder_Release(psfMyComputer); IShellFolder_Release(psfMyComputer);
return; return;
} }
hr = IShellFolder_BindToObject(psfMyComputer, pidlSystemDir, NULL, &IID_IShellFolder, (LPVOID*)&psfSystemDir); 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); IShellFolder_Release(psfMyComputer);
IMalloc_Free(ppM, pidlSystemDir); IMalloc_Free(ppM, pidlSystemDir);
if (FAILED(hr)) return; if (hr != S_OK) return;
hr = IShellFolder_BindToObject(psfSystemDir, pidlEmpty, NULL, &IID_IShellFolder, (LPVOID*)&psfChild); hr = IShellFolder_BindToObject(psfSystemDir, pidlEmpty, NULL, &IID_IShellFolder, (LPVOID*)&psfChild);
ok (hr == E_INVALIDARG, ok (hr == E_INVALIDARG,
@ -475,14 +475,14 @@ static void test_GetDisplayName(void)
/* Getting an itemidlist for the file. */ /* Getting an itemidlist for the file. */
hr = SHGetDesktopFolder(&psfDesktop); hr = SHGetDesktopFolder(&psfDesktop);
ok(SUCCEEDED(hr), "SHGetDesktopFolder failed! hr = %08x\n", hr); ok(hr == S_OK, "SHGetDesktopFolder failed! hr = %08x\n", hr);
if (FAILED(hr)) return; if (hr != S_OK) return;
MultiByteToWideChar(CP_ACP, 0, szTestFile, -1, wszTestFile, MAX_PATH); MultiByteToWideChar(CP_ACP, 0, szTestFile, -1, wszTestFile, MAX_PATH);
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszTestFile, NULL, &pidlTestFile, NULL); hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszTestFile, NULL, &pidlTestFile, NULL);
ok(SUCCEEDED(hr), "Desktop->ParseDisplayName failed! hr = %08x\n", hr); ok(hr == S_OK, "Desktop->ParseDisplayName failed! hr = %08x\n", hr);
if (FAILED(hr)) { if (hr != S_OK) {
IShellFolder_Release(psfDesktop); IShellFolder_Release(psfDesktop);
return; return;
} }
@ -510,9 +510,9 @@ static void test_GetDisplayName(void)
todo_wine todo_wine
ok (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || ok (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
hr == E_NOTIMPL || /* Vista */ hr == E_NOTIMPL || /* Vista */
broken(SUCCEEDED(hr)), /* Win9x, W2K */ broken(hr == S_OK), /* Win9x, W2K */
"hr = %08x\n", hr); "hr = %08x\n", hr);
if (SUCCEEDED(hr)) { if (hr == S_OK) {
IShellFolder_Release(psfFile); IShellFolder_Release(psfFile);
} }
@ -528,15 +528,15 @@ static void test_GetDisplayName(void)
if (pSHGetFolderPathAndSubDirA) if (pSHGetFolderPathAndSubDirA)
{ {
hr = pSHBindToParent(pidlTestFile, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast); hr = pSHBindToParent(pidlTestFile, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast);
ok(SUCCEEDED(hr), "SHBindToParent failed! hr = %08x\n", hr); ok(hr == S_OK, "SHBindToParent failed! hr = %08x\n", hr);
if (SUCCEEDED(hr)) { if (hr == S_OK) {
/* It's ok to use this fixed path. Call will fail anyway. */ /* It's ok to use this fixed path. Call will fail anyway. */
WCHAR wszAbsoluteFilename[] = { 'C',':','\\','w','i','n','e','t','e','s','t', 0 }; WCHAR wszAbsoluteFilename[] = { 'C',':','\\','w','i','n','e','t','e','s','t', 0 };
LPITEMIDLIST pidlNew; LPITEMIDLIST pidlNew;
/* The pidl returned through the last parameter of SetNameOf is a simple one. */ /* The pidl returned through the last parameter of SetNameOf is a simple one. */
hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlLast, wszDirName, SHGDN_NORMAL, &pidlNew); 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) if (hr == S_OK)
{ {
ok (((LPITEMIDLIST)((LPBYTE)pidlNew+pidlNew->mkid.cb))->mkid.cb == 0, ok (((LPITEMIDLIST)((LPBYTE)pidlNew+pidlNew->mkid.cb))->mkid.cb == 0,
@ -551,7 +551,7 @@ static void test_GetDisplayName(void)
/* Rename the file back to its original name. SetNameOf ignores the fact, that the /* Rename the file back to its original name. SetNameOf ignores the fact, that the
* SHGDN flags specify an absolute path. */ * SHGDN flags specify an absolute path. */
hr = IShellFolder_SetNameOf(psfPersonal, NULL, pidlNew, wszFileName, SHGDN_FORPARSING, NULL); 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); pILFree(pidlNew);
} }
@ -576,19 +576,19 @@ static void test_GetDisplayName(void)
/* SHBindToParent fails, if called with a NULL PIDL. */ /* SHBindToParent fails, if called with a NULL PIDL. */
hr = pSHBindToParent(NULL, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast); 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. */ /* But it succeeds with an empty PIDL. */
hr = pSHBindToParent(pidlEmpty, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast); 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"); 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); IShellFolder_Release(psfPersonal);
/* Binding to the folder and querying the display name of the file also works. */ /* Binding to the folder and querying the display name of the file also works. */
hr = pSHBindToParent(pidlTestFile, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast); hr = pSHBindToParent(pidlTestFile, &IID_IShellFolder, (VOID**)&psfPersonal, &pidlLast);
ok (SUCCEEDED(hr), "SHBindToParent failed! hr = %08x\n", hr); ok (hr == S_OK, "SHBindToParent failed! hr = %08x\n", hr);
if (FAILED(hr)) { if (hr != S_OK) {
IShellFolder_Release(psfDesktop); IShellFolder_Release(psfDesktop);
return; return;
} }
@ -599,8 +599,8 @@ static void test_GetDisplayName(void)
"SHBindToParent doesn't return the last id of the pidl param!\n"); "SHBindToParent doesn't return the last id of the pidl param!\n");
hr = IShellFolder_GetDisplayNameOf(psfPersonal, pidlLast, SHGDN_FORPARSING, &strret); hr = IShellFolder_GetDisplayNameOf(psfPersonal, pidlLast, SHGDN_FORPARSING, &strret);
ok (SUCCEEDED(hr), "Personal->GetDisplayNameOf failed! hr = %08x\n", hr); ok (hr == S_OK, "Personal->GetDisplayNameOf failed! hr = %08x\n", hr);
if (FAILED(hr)) { if (hr != S_OK) {
IShellFolder_Release(psfDesktop); IShellFolder_Release(psfDesktop);
IShellFolder_Release(psfPersonal); IShellFolder_Release(psfPersonal);
return; return;
@ -609,7 +609,7 @@ static void test_GetDisplayName(void)
if (pStrRetToBufW) if (pStrRetToBufW)
{ {
hr = pStrRetToBufW(&strret, pidlLast, wszTestFile2, MAX_PATH); 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"); ok (!lstrcmpiW(wszTestFile, wszTestFile2), "GetDisplayNameOf returns incorrect path!\n");
} }
@ -648,15 +648,15 @@ static void test_CallForAttributes(void)
* on MSDN. This test is meant to document the observed behaviour on WinXP SP2. * on MSDN. This test is meant to document the observed behaviour on WinXP SP2.
*/ */
hr = SHGetDesktopFolder(&psfDesktop); hr = SHGetDesktopFolder(&psfDesktop);
ok (SUCCEEDED(hr), "SHGetDesktopFolder failed! hr = %08x\n", hr); ok (hr == S_OK, "SHGetDesktopFolder failed! hr = %08x\n", hr);
if (FAILED(hr)) return; if (hr != S_OK) return;
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszMyDocuments, NULL, hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszMyDocuments, NULL,
&pidlMyDocuments, NULL); &pidlMyDocuments, NULL);
ok (SUCCEEDED(hr) || ok (hr == S_OK ||
broken(hr == E_INVALIDARG), /* Win95, NT4 */ broken(hr == E_INVALIDARG), /* Win95, NT4 */
"Desktop's ParseDisplayName failed to parse MyDocuments's CLSID! hr = %08x\n", hr); "Desktop's ParseDisplayName failed to parse MyDocuments's CLSID! hr = %08x\n", hr);
if (FAILED(hr)) { if (hr != S_OK) {
IShellFolder_Release(psfDesktop); IShellFolder_Release(psfDesktop);
return; return;
} }
@ -664,7 +664,7 @@ static void test_CallForAttributes(void)
dwAttributes = 0xffffffff; dwAttributes = 0xffffffff;
hr = IShellFolder_GetAttributesOf(psfDesktop, 1, hr = IShellFolder_GetAttributesOf(psfDesktop, 1,
(LPCITEMIDLIST*)&pidlMyDocuments, &dwAttributes); (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. */ /* 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"); ok (dwAttributes & SFGAO_FILESYSTEM, "SFGAO_FILESYSTEM attribute is not set for MyDocuments!\n");
@ -726,8 +726,8 @@ static void test_CallForAttributes(void)
dwAttributes = SFGAO_ISSLOW|SFGAO_GHOSTED|SFGAO_FILESYSTEM; dwAttributes = SFGAO_ISSLOW|SFGAO_GHOSTED|SFGAO_FILESYSTEM;
hr = IShellFolder_GetAttributesOf(psfDesktop, 1, hr = IShellFolder_GetAttributesOf(psfDesktop, 1,
(LPCITEMIDLIST*)&pidlMyDocuments, &dwAttributes); (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);
if (SUCCEEDED(hr)) if (hr == S_OK)
ok (dwAttributes == SFGAO_FILESYSTEM, ok (dwAttributes == SFGAO_FILESYSTEM,
"Desktop->GetAttributes(MyDocuments) returned unexpected attributes: %08x\n", "Desktop->GetAttributes(MyDocuments) returned unexpected attributes: %08x\n",
dwAttributes); dwAttributes);
@ -786,13 +786,13 @@ static void test_GetAttributesOf(void)
BOOL foundFlagsMatch; BOOL foundFlagsMatch;
hr = SHGetDesktopFolder(&psfDesktop); hr = SHGetDesktopFolder(&psfDesktop);
ok (SUCCEEDED(hr), "SHGetDesktopFolder failed! hr = %08x\n", hr); ok (hr == S_OK, "SHGetDesktopFolder failed! hr = %08x\n", hr);
if (FAILED(hr)) return; if (hr != S_OK) return;
/* The Desktop attributes can be queried with a single empty itemidlist, .. */ /* The Desktop attributes can be queried with a single empty itemidlist, .. */
dwFlags = 0xffffffff; dwFlags = 0xffffffff;
hr = IShellFolder_GetAttributesOf(psfDesktop, 1, &pidlEmpty, &dwFlags); 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 && for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch &&
i < sizeof(desktopFlags) / sizeof(desktopFlags[0]); i++) i < sizeof(desktopFlags) / sizeof(desktopFlags[0]); i++)
{ {
@ -804,7 +804,7 @@ static void test_GetAttributesOf(void)
/* .. or with no itemidlist at all. */ /* .. or with no itemidlist at all. */
dwFlags = 0xffffffff; dwFlags = 0xffffffff;
hr = IShellFolder_GetAttributesOf(psfDesktop, 0, NULL, &dwFlags); 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 && for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch &&
i < sizeof(desktopFlags) / sizeof(desktopFlags[0]); i++) i < sizeof(desktopFlags) / sizeof(desktopFlags[0]); i++)
{ {
@ -815,8 +815,8 @@ static void test_GetAttributesOf(void)
/* Testing the attributes of the MyComputer shellfolder */ /* Testing the attributes of the MyComputer shellfolder */
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszMyComputer, NULL, &pidlMyComputer, NULL); 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); ok (hr == S_OK, "Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08x\n", hr);
if (FAILED(hr)) { if (hr != S_OK) {
IShellFolder_Release(psfDesktop); IShellFolder_Release(psfDesktop);
return; return;
} }
@ -826,7 +826,7 @@ static void test_GetAttributesOf(void)
*/ */
dwFlags = 0xffffffff; dwFlags = 0xffffffff;
hr = IShellFolder_GetAttributesOf(psfDesktop, 1, (LPCITEMIDLIST*)&pidlMyComputer, &dwFlags); 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 && for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch &&
i < sizeof(myComputerFlags) / sizeof(myComputerFlags[0]); i++) i < sizeof(myComputerFlags) / sizeof(myComputerFlags[0]); i++)
{ {
@ -837,20 +837,20 @@ static void test_GetAttributesOf(void)
ok (foundFlagsMatch, "Wrong MyComputer attributes: %08x\n", dwFlags); ok (foundFlagsMatch, "Wrong MyComputer attributes: %08x\n", dwFlags);
hr = IShellFolder_BindToObject(psfDesktop, pidlMyComputer, NULL, &IID_IShellFolder, (LPVOID*)&psfMyComputer); 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); IShellFolder_Release(psfDesktop);
IMalloc_Free(ppM, pidlMyComputer); IMalloc_Free(ppM, pidlMyComputer);
if (FAILED(hr)) return; if (hr != S_OK) return;
hr = IShellFolder_GetAttributesOf(psfMyComputer, 1, &pidlEmpty, &dwFlags); hr = IShellFolder_GetAttributesOf(psfMyComputer, 1, &pidlEmpty, &dwFlags);
todo_wine todo_wine
ok (hr == E_INVALIDARG || 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); "MyComputer->GetAttributesOf(emtpy pidl) should fail! hr = %08x\n", hr);
dwFlags = 0xffffffff; dwFlags = 0xffffffff;
hr = IShellFolder_GetAttributesOf(psfMyComputer, 0, NULL, &dwFlags); 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 && for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch &&
i < sizeof(myComputerFlags) / sizeof(myComputerFlags[0]); i++) i < sizeof(myComputerFlags) / sizeof(myComputerFlags[0]); i++)
{ {
@ -895,7 +895,7 @@ static void test_GetAttributesOf(void)
/* test the shell attributes of the test directory using the relative PIDL */ /* test the shell attributes of the test directory using the relative PIDL */
dwFlags = SFGAO_FOLDER; dwFlags = SFGAO_FOLDER;
hr = IShellFolder_GetAttributesOf(testIShellFolder, 1, (LPCITEMIDLIST*)&newPIDL, &dwFlags); 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); ok ((dwFlags&SFGAO_FOLDER), "Wrong directory attribute for relative PIDL: %08x\n", dwFlags);
/* free memory */ /* free memory */
@ -913,7 +913,7 @@ static void test_GetAttributesOf(void)
/* test the shell attributes of the test directory using the absolute PIDL */ /* test the shell attributes of the test directory using the absolute PIDL */
dwFlags = SFGAO_FOLDER; dwFlags = SFGAO_FOLDER;
hr = IShellFolder_GetAttributesOf(IDesktopFolder, 1, (LPCITEMIDLIST*)&newPIDL, &dwFlags); 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); ok ((dwFlags&SFGAO_FOLDER), "Wrong directory attribute for absolute PIDL: %08x\n", dwFlags);
/* free memory */ /* free memory */
@ -982,12 +982,12 @@ static void test_SHGetPathFromIDList(void)
/* MyComputer does not map to a filesystem path. SHGetPathFromIDListW should fail. */ /* MyComputer does not map to a filesystem path. SHGetPathFromIDListW should fail. */
hr = SHGetDesktopFolder(&psfDesktop); hr = SHGetDesktopFolder(&psfDesktop);
ok (SUCCEEDED(hr), "SHGetDesktopFolder failed! hr = %08x\n", hr); ok (hr == S_OK, "SHGetDesktopFolder failed! hr = %08x\n", hr);
if (FAILED(hr)) return; if (hr != S_OK) return;
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszMyComputer, NULL, &pidlMyComputer, NULL); 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); ok (hr == S_OK, "Desktop's ParseDisplayName failed to parse MyComputer's CLSID! hr = %08x\n", hr);
if (FAILED(hr)) { if (hr != S_OK) {
IShellFolder_Release(psfDesktop); IShellFolder_Release(psfDesktop);
return; return;
} }
@ -1025,8 +1025,8 @@ static void test_SHGetPathFromIDList(void)
CloseHandle(hTestFile); CloseHandle(hTestFile);
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszTestFile, NULL, &pidlTestFile, NULL); hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszTestFile, NULL, &pidlTestFile, NULL);
ok (SUCCEEDED(hr), "Desktop's ParseDisplayName failed to parse filename hr = %08x\n", hr); ok (hr == S_OK, "Desktop's ParseDisplayName failed to parse filename hr = %08x\n", hr);
if (FAILED(hr)) { if (hr != S_OK) {
IShellFolder_Release(psfDesktop); IShellFolder_Release(psfDesktop);
DeleteFileW(wszFileName); DeleteFileW(wszFileName);
IMalloc_Free(ppM, pidlTestFile); IMalloc_Free(ppM, pidlTestFile);
@ -1036,10 +1036,10 @@ static void test_SHGetPathFromIDList(void)
/* This test is to show that the Desktop shellfolder prepends the CSIDL_DESKTOPDIRECTORY /* 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. */ * path for files placed on the desktop, if called with SHGDN_FORPARSING. */
hr = IShellFolder_GetDisplayNameOf(psfDesktop, pidlTestFile, SHGDN_FORPARSING, &strret); 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); IShellFolder_Release(psfDesktop);
DeleteFileW(wszFileName); DeleteFileW(wszFileName);
if (FAILED(hr)) { if (hr != S_OK) {
IMalloc_Free(ppM, pidlTestFile); IMalloc_Free(ppM, pidlTestFile);
return; return;
} }
@ -1063,7 +1063,7 @@ static void test_SHGetPathFromIDList(void)
pSHGetSpecialFolderLocation = (void *)GetProcAddress(hShell32, "SHGetSpecialFolderLocation"); pSHGetSpecialFolderLocation = (void *)GetProcAddress(hShell32, "SHGetSpecialFolderLocation");
hr = pSHGetSpecialFolderLocation(NULL, CSIDL_PROGRAM_FILES, &pidlPrograms); 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); SetLastError(0xdeadbeef);
result = pSHGetPathFromIDListW(pidlPrograms, wszPath); result = pSHGetPathFromIDListW(pidlPrograms, wszPath);
@ -1280,12 +1280,12 @@ static void test_FolderShortcut(void) {
win_skip("CLSID_FolderShortcut is not implemented\n"); win_skip("CLSID_FolderShortcut is not implemented\n");
return; return;
} }
ok (SUCCEEDED(hr), "CoCreateInstance failed! hr = 0x%08x\n", hr); ok (hr == S_OK, "CoCreateInstance failed! hr = 0x%08x\n", hr);
if (FAILED(hr)) return; if (hr != S_OK) return;
hr = IPersistPropertyBag_Load(pPersistPropertyBag, &InitPropertyBag, NULL); hr = IPersistPropertyBag_Load(pPersistPropertyBag, &InitPropertyBag, NULL);
ok(SUCCEEDED(hr), "IPersistPropertyBag_Load failed! hr = %08x\n", hr); ok(hr == S_OK, "IPersistPropertyBag_Load failed! hr = %08x\n", hr);
if (FAILED(hr)) { if (hr != S_OK) {
IPersistPropertyBag_Release(pPersistPropertyBag); IPersistPropertyBag_Release(pPersistPropertyBag);
return; return;
} }
@ -1293,12 +1293,12 @@ static void test_FolderShortcut(void) {
hr = IPersistPropertyBag_QueryInterface(pPersistPropertyBag, &IID_IShellFolder, hr = IPersistPropertyBag_QueryInterface(pPersistPropertyBag, &IID_IShellFolder,
(LPVOID*)&pShellFolder); (LPVOID*)&pShellFolder);
IPersistPropertyBag_Release(pPersistPropertyBag); IPersistPropertyBag_Release(pPersistPropertyBag);
ok(SUCCEEDED(hr), "IPersistPropertyBag_QueryInterface(IShellFolder) failed! hr = %08x\n", hr); ok(hr == S_OK, "IPersistPropertyBag_QueryInterface(IShellFolder) failed! hr = %08x\n", hr);
if (FAILED(hr)) return; if (hr != S_OK) return;
hr = IShellFolder_GetDisplayNameOf(pShellFolder, NULL, SHGDN_FORPARSING, &strret); hr = IShellFolder_GetDisplayNameOf(pShellFolder, NULL, SHGDN_FORPARSING, &strret);
ok(SUCCEEDED(hr), "IShellFolder_GetDisplayNameOf(NULL) failed! hr = %08x\n", hr); ok(hr == S_OK, "IShellFolder_GetDisplayNameOf(NULL) failed! hr = %08x\n", hr);
if (FAILED(hr)) { if (hr != S_OK) {
IShellFolder_Release(pShellFolder); IShellFolder_Release(pShellFolder);
return; return;
} }
@ -1312,15 +1312,15 @@ static void test_FolderShortcut(void) {
hr = IShellFolder_QueryInterface(pShellFolder, &IID_IPersistFolder3, (LPVOID*)&pPersistFolder3); hr = IShellFolder_QueryInterface(pShellFolder, &IID_IPersistFolder3, (LPVOID*)&pPersistFolder3);
IShellFolder_Release(pShellFolder); IShellFolder_Release(pShellFolder);
ok(SUCCEEDED(hr), "IShellFolder_QueryInterface(IID_IPersistFolder3 failed! hr = 0x%08x\n", hr); ok(hr == S_OK, "IShellFolder_QueryInterface(IID_IPersistFolder3 failed! hr = 0x%08x\n", hr);
if (FAILED(hr)) return; if (hr != S_OK) return;
hr = IPersistFolder3_GetClassID(pPersistFolder3, &clsid); 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"); ok(IsEqualCLSID(&clsid, &CLSID_FolderShortcut), "Unexpected CLSID!\n");
hr = IPersistFolder3_GetCurFolder(pPersistFolder3, &pidlCurrentFolder); 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"); ok(!pidlCurrentFolder, "IPersistFolder3_GetCurFolder should return a NULL pidl!\n");
/* For FolderShortcut objects, the Initialize method initialized the folder's position in the /* For FolderShortcut objects, the Initialize method initialized the folder's position in the
@ -1330,8 +1330,8 @@ static void test_FolderShortcut(void) {
* itemidlist, but GetDisplayNameOf still returns the path from above. * itemidlist, but GetDisplayNameOf still returns the path from above.
*/ */
hr = SHGetDesktopFolder(&pDesktopFolder); hr = SHGetDesktopFolder(&pDesktopFolder);
ok (SUCCEEDED(hr), "SHGetDesktopFolder failed! hr = %08x\n", hr); ok (hr == S_OK, "SHGetDesktopFolder failed! hr = %08x\n", hr);
if (FAILED(hr)) return; if (hr != S_OK) return;
/* Temporarily register WineTestFolder as a shell namespace extension at the Desktop. /* Temporarily register WineTestFolder as a shell namespace extension at the Desktop.
* Otherwise ParseDisplayName fails on WinXP with E_INVALIDARG */ * Otherwise ParseDisplayName fails on WinXP with E_INVALIDARG */
@ -1341,19 +1341,19 @@ static void test_FolderShortcut(void) {
&pidlWineTestFolder, NULL); &pidlWineTestFolder, NULL);
RegDeleteKeyW(HKEY_CURRENT_USER, wszShellExtKey); RegDeleteKeyW(HKEY_CURRENT_USER, wszShellExtKey);
IShellFolder_Release(pDesktopFolder); IShellFolder_Release(pDesktopFolder);
ok (SUCCEEDED(hr), "IShellFolder::ParseDisplayName failed! hr = %08x\n", hr); ok (hr == S_OK, "IShellFolder::ParseDisplayName failed! hr = %08x\n", hr);
if (FAILED(hr)) return; if (hr != S_OK) return;
hr = IPersistFolder3_Initialize(pPersistFolder3, pidlWineTestFolder); hr = IPersistFolder3_Initialize(pPersistFolder3, pidlWineTestFolder);
ok (SUCCEEDED(hr), "IPersistFolder3::Initialize failed! hr = %08x\n", hr); ok (hr == S_OK, "IPersistFolder3::Initialize failed! hr = %08x\n", hr);
if (FAILED(hr)) { if (hr != S_OK) {
IPersistFolder3_Release(pPersistFolder3); IPersistFolder3_Release(pPersistFolder3);
pILFree(pidlWineTestFolder); pILFree(pidlWineTestFolder);
return; return;
} }
hr = IPersistFolder3_GetCurFolder(pPersistFolder3, &pidlCurrentFolder); 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), ok(pILIsEqual(pidlCurrentFolder, pidlWineTestFolder),
"IPersistFolder3_GetCurFolder should return pidlWineTestFolder!\n"); "IPersistFolder3_GetCurFolder should return pidlWineTestFolder!\n");
pILFree(pidlCurrentFolder); pILFree(pidlCurrentFolder);
@ -1361,12 +1361,12 @@ static void test_FolderShortcut(void) {
hr = IPersistFolder3_QueryInterface(pPersistFolder3, &IID_IShellFolder, (LPVOID*)&pShellFolder); hr = IPersistFolder3_QueryInterface(pPersistFolder3, &IID_IShellFolder, (LPVOID*)&pShellFolder);
IPersistFolder3_Release(pPersistFolder3); IPersistFolder3_Release(pPersistFolder3);
ok(SUCCEEDED(hr), "IPersistFolder3_QueryInterface(IShellFolder) failed! hr = %08x\n", hr); ok(hr == S_OK, "IPersistFolder3_QueryInterface(IShellFolder) failed! hr = %08x\n", hr);
if (FAILED(hr)) return; if (hr != S_OK) return;
hr = IShellFolder_GetDisplayNameOf(pShellFolder, NULL, SHGDN_FORPARSING, &strret); hr = IShellFolder_GetDisplayNameOf(pShellFolder, NULL, SHGDN_FORPARSING, &strret);
ok(SUCCEEDED(hr), "IShellFolder_GetDisplayNameOf(NULL) failed! hr = %08x\n", hr); ok(hr == S_OK, "IShellFolder_GetDisplayNameOf(NULL) failed! hr = %08x\n", hr);
if (FAILED(hr)) { if (hr != S_OK) {
IShellFolder_Release(pShellFolder); IShellFolder_Release(pShellFolder);
return; return;
} }
@ -1386,8 +1386,8 @@ static void test_FolderShortcut(void) {
hr = IShellFolder_ParseDisplayName(pShellFolder, NULL, NULL, wszSomeSubFolder, NULL, hr = IShellFolder_ParseDisplayName(pShellFolder, NULL, NULL, wszSomeSubFolder, NULL,
&pidlSubFolder, NULL); &pidlSubFolder, NULL);
RemoveDirectoryW(wszDesktopPath); RemoveDirectoryW(wszDesktopPath);
ok (SUCCEEDED(hr), "IShellFolder::ParseDisplayName failed! hr = %08x\n", hr); ok (hr == S_OK, "IShellFolder::ParseDisplayName failed! hr = %08x\n", hr);
if (FAILED(hr)) { if (hr != S_OK) {
IShellFolder_Release(pShellFolder); IShellFolder_Release(pShellFolder);
return; return;
} }
@ -1396,14 +1396,14 @@ static void test_FolderShortcut(void) {
(LPVOID*)&pPersistFolder3); (LPVOID*)&pPersistFolder3);
IShellFolder_Release(pShellFolder); IShellFolder_Release(pShellFolder);
pILFree(pidlSubFolder); pILFree(pidlSubFolder);
ok (SUCCEEDED(hr), "IShellFolder::BindToObject failed! hr = %08x\n", hr); ok (hr == S_OK, "IShellFolder::BindToObject failed! hr = %08x\n", hr);
if (FAILED(hr)) if (hr != S_OK)
return; return;
/* On windows, we expect CLSID_ShellFSFolder. On wine we relax this constraint /* On windows, we expect CLSID_ShellFSFolder. On wine we relax this constraint
* a little bit and also allow CLSID_UnixDosFolder. */ * a little bit and also allow CLSID_UnixDosFolder. */
hr = IPersistFolder3_GetClassID(pPersistFolder3, &clsid); 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), ok(IsEqualCLSID(&clsid, &CLSID_ShellFSFolder) || IsEqualCLSID(&clsid, &CLSID_UnixDosFolder),
"IPersistFolder3::GetClassID returned unexpected CLSID!\n"); "IPersistFolder3::GetClassID returned unexpected CLSID!\n");
@ -1463,12 +1463,12 @@ static void test_ITEMIDLIST_format(void) {
if (!bResult) return; if (!bResult) return;
hr = SHGetDesktopFolder(&psfDesktop); hr = SHGetDesktopFolder(&psfDesktop);
ok(SUCCEEDED(hr), "SHGetDesktopFolder failed! hr: %08x\n", hr); ok(hr == S_OK, "SHGetDesktopFolder failed! hr: %08x\n", hr);
if (FAILED(hr)) return; if (hr != S_OK) return;
hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszPersonal, NULL, &pidlPersonal, NULL); hr = IShellFolder_ParseDisplayName(psfDesktop, NULL, NULL, wszPersonal, NULL, &pidlPersonal, NULL);
ok(SUCCEEDED(hr), "psfDesktop->ParseDisplayName failed! hr = %08x\n", hr); ok(hr == S_OK, "psfDesktop->ParseDisplayName failed! hr = %08x\n", hr);
if (FAILED(hr)) { if (hr != S_OK) {
IShellFolder_Release(psfDesktop); IShellFolder_Release(psfDesktop);
return; return;
} }
@ -1477,8 +1477,8 @@ static void test_ITEMIDLIST_format(void) {
(LPVOID*)&psfPersonal); (LPVOID*)&psfPersonal);
IShellFolder_Release(psfDesktop); IShellFolder_Release(psfDesktop);
pILFree(pidlPersonal); pILFree(pidlPersonal);
ok(SUCCEEDED(hr), "psfDesktop->BindToObject failed! hr = %08x\n", hr); ok(hr == S_OK, "psfDesktop->BindToObject failed! hr = %08x\n", hr);
if (FAILED(hr)) return; if (hr != S_OK) return;
for (i=0; i<3; i++) { for (i=0; i<3; i++) {
CHAR szFile[MAX_PATH]; CHAR szFile[MAX_PATH];
@ -1497,8 +1497,8 @@ static void test_ITEMIDLIST_format(void) {
hr = IShellFolder_ParseDisplayName(psfPersonal, NULL, NULL, wszFile[i], NULL, &pidlFile, NULL); hr = IShellFolder_ParseDisplayName(psfPersonal, NULL, NULL, wszFile[i], NULL, &pidlFile, NULL);
DeleteFileW(wszFile[i]); DeleteFileW(wszFile[i]);
ok(SUCCEEDED(hr), "psfPersonal->ParseDisplayName failed! hr: %08x\n", hr); ok(hr == S_OK, "psfPersonal->ParseDisplayName failed! hr: %08x\n", hr);
if (FAILED(hr)) { if (hr != S_OK) {
IShellFolder_Release(psfPersonal); IShellFolder_Release(psfPersonal);
return; return;
} }
@ -1771,10 +1771,10 @@ static void test_LocalizedNames(void)
hr = IShellFolder_GetDisplayNameOf(testIShellFolder, newPIDL, SHGDN_INFOLDER, &strret); hr = IShellFolder_GetDisplayNameOf(testIShellFolder, newPIDL, SHGDN_INFOLDER, &strret);
ok(hr == S_OK, "GetDisplayNameOf failed %08x\n", hr); 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)); 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 todo_wine
ok (!lstrcmpiW(tempbufW, folderdisplayW) || ok (!lstrcmpiW(tempbufW, folderdisplayW) ||
broken(!lstrcmpiW(tempbufW, foldernameW)), /* W2K */ broken(!lstrcmpiW(tempbufW, foldernameW)), /* W2K */
@ -1785,10 +1785,10 @@ static void test_LocalizedNames(void)
hr = IShellFolder_GetDisplayNameOf(testIShellFolder, newPIDL, SHGDN_INFOLDER|SHGDN_FOREDITING, &strret); hr = IShellFolder_GetDisplayNameOf(testIShellFolder, newPIDL, SHGDN_INFOLDER|SHGDN_FOREDITING, &strret);
ok(hr == S_OK, "GetDisplayNameOf failed %08x\n", hr); 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)); 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 todo_wine
ok (!lstrcmpiW(tempbufW, folderdisplayW) || ok (!lstrcmpiW(tempbufW, folderdisplayW) ||
broken(!lstrcmpiW(tempbufW, foldernameW)), /* W2K */ broken(!lstrcmpiW(tempbufW, foldernameW)), /* W2K */
@ -1799,10 +1799,10 @@ static void test_LocalizedNames(void)
hr = IShellFolder_GetDisplayNameOf(testIShellFolder, newPIDL, SHGDN_INFOLDER|SHGDN_FORPARSING, &strret); hr = IShellFolder_GetDisplayNameOf(testIShellFolder, newPIDL, SHGDN_INFOLDER|SHGDN_FORPARSING, &strret);
ok(hr == S_OK, "GetDisplayNameOf failed %08x\n", hr); 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)); 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)); ok (!lstrcmpiW(tempbufW, foldernameW), "GetDisplayNameOf returned %s\n", wine_dbgstr_w(tempbufW));
} }