shell32: Implement ParseDisplayName for EntireNetwork in the Network Places shell folder.
Add a test for this behaviour.
This commit is contained in:
parent
ac0db11459
commit
21b9a50e08
|
@ -1570,6 +1570,23 @@ LPITEMIDLIST _ILCreateDrive(LPCWSTR lpszNew)
|
|||
return pidlOut;
|
||||
}
|
||||
|
||||
LPITEMIDLIST _ILCreateEntireNetwork(void)
|
||||
{
|
||||
LPITEMIDLIST pidlOut;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
pidlOut = _ILAlloc(PT_NETWORK, FIELD_OFFSET(PIDLDATA, u.network.szNames[sizeof("Entire Network")]));
|
||||
if (pidlOut)
|
||||
{
|
||||
LPPIDLDATA pData = _ILGetDataPointer(pidlOut);
|
||||
|
||||
pData->u.network.dummy = 0;
|
||||
strcpy(pData->u.network.szNames, "Entire Network");
|
||||
}
|
||||
return pidlOut;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* _ILGetDrive()
|
||||
*
|
||||
|
|
|
@ -255,6 +255,7 @@ LPITEMIDLIST _ILCreateNetwork (void);
|
|||
LPITEMIDLIST _ILCreateNetHood (void);
|
||||
LPITEMIDLIST _ILCreateBitBucket (void);
|
||||
LPITEMIDLIST _ILCreateDrive (LPCWSTR);
|
||||
LPITEMIDLIST _ILCreateEntireNetwork (void);
|
||||
|
||||
/*
|
||||
* helper functions (getting struct-pointer)
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "shell32_main.h"
|
||||
#include "shresdef.h"
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "debughlp.h"
|
||||
#include "shfldr.h"
|
||||
|
||||
|
@ -181,17 +182,53 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnParseDisplayName (IShellFolder2 * ifac
|
|||
HWND hwndOwner, LPBC pbcReserved, LPOLESTR lpszDisplayName,
|
||||
DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
|
||||
{
|
||||
static const WCHAR wszEntireNetwork[] = {'E','n','t','i','r','e','N','e','t','w','o','r','k'}; /* not nul-terminated */
|
||||
IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
||||
|
||||
HRESULT hr = E_UNEXPECTED;
|
||||
HRESULT hr = E_INVALIDARG;
|
||||
LPCWSTR szNext = NULL;
|
||||
WCHAR szElement[MAX_PATH];
|
||||
LPITEMIDLIST pidlTemp = NULL;
|
||||
int len;
|
||||
|
||||
TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n", This,
|
||||
hwndOwner, pbcReserved, lpszDisplayName, debugstr_w (lpszDisplayName),
|
||||
pchEaten, ppidl, pdwAttributes);
|
||||
|
||||
*ppidl = 0;
|
||||
if (pchEaten)
|
||||
*pchEaten = 0; /* strange but like the original */
|
||||
*ppidl = NULL;
|
||||
|
||||
szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
|
||||
len = strlenW(szElement);
|
||||
if (len == sizeof(wszEntireNetwork)/sizeof(wszEntireNetwork[0]) &&
|
||||
!strncmpiW(szElement, wszEntireNetwork, sizeof(wszEntireNetwork)/sizeof(wszEntireNetwork[0])))
|
||||
{
|
||||
pidlTemp = _ILCreateEntireNetwork();
|
||||
if (pidlTemp)
|
||||
hr = S_OK;
|
||||
else
|
||||
hr = E_OUTOFMEMORY;
|
||||
}
|
||||
else
|
||||
FIXME("not implemented for %s\n", debugstr_w(lpszDisplayName));
|
||||
|
||||
if (SUCCEEDED(hr) && pidlTemp)
|
||||
{
|
||||
if (szNext && *szNext)
|
||||
{
|
||||
hr = SHELL32_ParseNextElement(iface, hwndOwner, pbcReserved,
|
||||
&pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pdwAttributes && *pdwAttributes)
|
||||
hr = SHELL32_GetItemAttributes(_IShellFolder_ (This),
|
||||
pidlTemp, pdwAttributes);
|
||||
}
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
*ppidl = pidlTemp;
|
||||
else
|
||||
ILFree(pidlTemp);
|
||||
|
||||
TRACE ("(%p)->(-- ret=0x%08x)\n", This, hr);
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ CTESTS = \
|
|||
generated.c \
|
||||
shelllink.c \
|
||||
shellpath.c \
|
||||
shfldr_netplaces.c \
|
||||
shlexec.c \
|
||||
shlfileop.c \
|
||||
shlfolder.c \
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* 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();
|
||||
}
|
Loading…
Reference in New Issue