Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygennetplaces.cpp
Go to the documentation of this file.
00001 /* 00002 * Network Places (Neighbourhood) folder 00003 * 00004 * Copyright 1997 Marcus Meissner 00005 * Copyright 1998, 1999, 2002 Juergen Schmied 00006 * Copyright 2003 Mike McCormack for Codeweavers 00007 * Copyright 2009 Andrew Hill 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Lesser General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 2.1 of the License, or (at your option) any later version. 00013 * 00014 * This library is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Lesser General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public 00020 * License along with this library; if not, write to the Free Software 00021 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00022 */ 00023 00024 #include <precomp.h> 00025 00026 WINE_DEFAULT_DEBUG_CHANNEL (shell); 00027 00028 /*********************************************************************** 00029 * IShellFolder implementation 00030 */ 00031 00032 static shvheader NetworkPlacesSFHeader[] = { 00033 {IDS_SHV_COLUMN8, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15}, 00034 {IDS_SHV_COLUMN13, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10}, 00035 {IDS_SHV_COLUMN_WORKGROUP, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15}, 00036 {IDS_SHV_NETWORKLOCATION, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15} 00037 }; 00038 00039 #define COLUMN_NAME 0 00040 #define COLUMN_CATEGORY 1 00041 #define COLUMN_WORKGROUP 2 00042 #define COLUMN_NETLOCATION 3 00043 00044 #define NETWORKPLACESSHELLVIEWCOLUMNS 4 00045 00046 CNetFolder::CNetFolder() 00047 { 00048 pidlRoot = NULL; 00049 } 00050 00051 CNetFolder::~CNetFolder() 00052 { 00053 TRACE("-- destroying IShellFolder(%p)\n", this); 00054 SHFree(pidlRoot); 00055 } 00056 00057 HRESULT WINAPI CNetFolder::FinalConstruct() 00058 { 00059 pidlRoot = _ILCreateNetHood(); /* my qualified pidl */ 00060 if (pidlRoot == NULL) 00061 return E_OUTOFMEMORY; 00062 return S_OK; 00063 } 00064 00065 /************************************************************************** 00066 * CNetFolder::ParseDisplayName 00067 */ 00068 HRESULT WINAPI CNetFolder::ParseDisplayName(HWND hwndOwner, LPBC pbcReserved, LPOLESTR lpszDisplayName, 00069 DWORD *pchEaten, LPITEMIDLIST *ppidl, DWORD *pdwAttributes) 00070 { 00071 HRESULT hr = E_UNEXPECTED; 00072 00073 TRACE("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n", this, 00074 hwndOwner, pbcReserved, lpszDisplayName, debugstr_w (lpszDisplayName), 00075 pchEaten, ppidl, pdwAttributes); 00076 00077 *ppidl = 0; 00078 if (pchEaten) 00079 *pchEaten = 0; /* strange but like the original */ 00080 00081 TRACE("(%p)->(-- ret=0x%08x)\n", this, hr); 00082 00083 return hr; 00084 } 00085 00086 /************************************************************************** 00087 * CNetFolder::EnumObjects 00088 */ 00089 HRESULT WINAPI CNetFolder::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList) 00090 { 00091 TRACE("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", this, 00092 hwndOwner, dwFlags, ppEnumIDList); 00093 00094 *ppEnumIDList = NULL; //IEnumIDList_Constructor(); 00095 00096 TRACE("-- (%p)->(new ID List: %p)\n", this, *ppEnumIDList); 00097 return S_FALSE; 00098 // return (*ppEnumIDList) ? S_OK : E_OUTOFMEMORY; 00099 } 00100 00101 /************************************************************************** 00102 * CNetFolder::BindToObject 00103 */ 00104 HRESULT WINAPI CNetFolder::BindToObject(LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) 00105 { 00106 TRACE ("(%p)->(pidl=%p,%p,%s,%p)\n", this, 00107 pidl, pbcReserved, shdebugstr_guid (&riid), ppvOut); 00108 00109 return SHELL32_BindToChild(pidlRoot, NULL, pidl, riid, ppvOut); 00110 } 00111 00112 /************************************************************************** 00113 * CNetFolder::BindToStorage 00114 */ 00115 HRESULT WINAPI CNetFolder::BindToStorage(LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) 00116 { 00117 FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", this, 00118 pidl, pbcReserved, shdebugstr_guid (&riid), ppvOut); 00119 00120 *ppvOut = NULL; 00121 return E_NOTIMPL; 00122 } 00123 00124 /************************************************************************** 00125 * CNetFolder::CompareIDs 00126 */ 00127 00128 HRESULT WINAPI CNetFolder::CompareIDs(LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) 00129 { 00130 int nReturn; 00131 00132 TRACE("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n", this, lParam, pidl1, pidl2); 00133 nReturn = SHELL32_CompareIDs(this, lParam, pidl1, pidl2); 00134 TRACE("-- %i\n", nReturn); 00135 return nReturn; 00136 } 00137 00138 /************************************************************************** 00139 * CNetFolder::CreateViewObject 00140 */ 00141 HRESULT WINAPI CNetFolder::CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut) 00142 { 00143 LPSHELLVIEW pShellView; 00144 HRESULT hr = E_INVALIDARG; 00145 00146 TRACE("(%p)->(hwnd=%p,%s,%p)\n", this, 00147 hwndOwner, shdebugstr_guid (&riid), ppvOut); 00148 00149 if (!ppvOut) 00150 return hr; 00151 00152 *ppvOut = NULL; 00153 00154 if (IsEqualIID(riid, IID_IDropTarget)) 00155 { 00156 WARN("IDropTarget not implemented\n"); 00157 hr = E_NOTIMPL; 00158 } 00159 else if (IsEqualIID(riid, IID_IContextMenu)) 00160 { 00161 WARN("IContextMenu not implemented\n"); 00162 hr = E_NOTIMPL; 00163 } 00164 else if (IsEqualIID(riid, IID_IShellView)) 00165 { 00166 hr = IShellView_Constructor((IShellFolder *)this, &pShellView); 00167 if (pShellView) 00168 { 00169 hr = pShellView->QueryInterface(riid, ppvOut); 00170 pShellView->Release(); 00171 } 00172 } 00173 TRACE("-- (%p)->(interface=%p)\n", this, ppvOut); 00174 return hr; 00175 } 00176 00177 /************************************************************************** 00178 * CNetFolder::GetAttributesOf 00179 */ 00180 HRESULT WINAPI CNetFolder::GetAttributesOf(UINT cidl, LPCITEMIDLIST *apidl, DWORD *rgfInOut) 00181 { 00182 static const DWORD dwNethoodAttributes = 00183 SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR | 00184 SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER | SFGAO_CANRENAME | SFGAO_CANDELETE; 00185 HRESULT hr = S_OK; 00186 00187 TRACE("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n", this, 00188 cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0); 00189 00190 if (!rgfInOut) 00191 return E_INVALIDARG; 00192 if (cidl && !apidl) 00193 return E_INVALIDARG; 00194 00195 if (*rgfInOut == 0) 00196 *rgfInOut = ~0; 00197 00198 if(cidl == 0) 00199 *rgfInOut = dwNethoodAttributes; 00200 else 00201 { 00202 while (cidl > 0 && *apidl) 00203 { 00204 pdump(*apidl); 00205 SHELL32_GetItemAttributes(this, *apidl, rgfInOut); 00206 apidl++; 00207 cidl--; 00208 } 00209 } 00210 00211 /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */ 00212 *rgfInOut &= ~SFGAO_VALIDATE; 00213 00214 TRACE("-- result=0x%08x\n", *rgfInOut); 00215 return hr; 00216 } 00217 00218 /************************************************************************** 00219 * CNetFolder::GetUIObjectOf 00220 * 00221 * PARAMETERS 00222 * hwndOwner [in] Parent window for any output 00223 * cidl [in] array size 00224 * apidl [in] simple pidl array 00225 * riid [in] Requested Interface 00226 * prgfInOut [ ] reserved 00227 * ppvObject [out] Resulting Interface 00228 * 00229 */ 00230 HRESULT WINAPI CNetFolder::GetUIObjectOf(HWND hwndOwner, UINT cidl, LPCITEMIDLIST *apidl, REFIID riid, 00231 UINT * prgfInOut, LPVOID * ppvOut) 00232 { 00233 LPITEMIDLIST pidl; 00234 IUnknown *pObj = NULL; 00235 HRESULT hr = E_INVALIDARG; 00236 00237 TRACE("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n", this, 00238 hwndOwner, cidl, apidl, shdebugstr_guid (&riid), prgfInOut, ppvOut); 00239 00240 if (!ppvOut) 00241 return hr; 00242 00243 *ppvOut = NULL; 00244 00245 if (IsEqualIID(riid, IID_IContextMenu) && (cidl >= 1)) 00246 { 00247 hr = CDefFolderMenu_Create2(pidlRoot, hwndOwner, cidl, apidl, (IShellFolder*)this, NULL, 0, NULL, (IContextMenu**)&pObj); 00248 } 00249 else if (IsEqualIID(riid, IID_IDataObject) && (cidl >= 1)) 00250 { 00251 hr = IDataObject_Constructor (hwndOwner, pidlRoot, apidl, cidl, (IDataObject **)&pObj); 00252 } 00253 else if (IsEqualIID(riid, IID_IExtractIconA) && (cidl == 1)) 00254 { 00255 pidl = ILCombine (pidlRoot, apidl[0]); 00256 pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl); 00257 SHFree (pidl); 00258 hr = S_OK; 00259 } 00260 else if (IsEqualIID(riid, IID_IExtractIconW) && (cidl == 1)) 00261 { 00262 pidl = ILCombine (pidlRoot, apidl[0]); 00263 pObj = (LPUNKNOWN) IExtractIconW_Constructor (pidl); 00264 SHFree (pidl); 00265 hr = S_OK; 00266 } 00267 else if (IsEqualIID(riid, IID_IDropTarget) && (cidl >= 1)) 00268 { 00269 hr = this->QueryInterface(IID_IDropTarget, (LPVOID *) & pObj); 00270 } 00271 else 00272 hr = E_NOINTERFACE; 00273 00274 if (SUCCEEDED(hr) && !pObj) 00275 hr = E_OUTOFMEMORY; 00276 00277 *ppvOut = pObj; 00278 TRACE("(%p)->hr=0x%08x\n", this, hr); 00279 return hr; 00280 } 00281 00282 /************************************************************************** 00283 * CNetFolder::GetDisplayNameOf 00284 * 00285 */ 00286 HRESULT WINAPI CNetFolder::GetDisplayNameOf(LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet) 00287 { 00288 FIXME("(%p)->(pidl=%p,0x%08x,%p)\n", this, pidl, dwFlags, strRet); 00289 pdump(pidl); 00290 00291 if (!strRet) 00292 return E_INVALIDARG; 00293 00294 return E_NOTIMPL; 00295 } 00296 00297 /************************************************************************** 00298 * CNetFolder::SetNameOf 00299 * Changes the name of a file object or subfolder, possibly changing its item 00300 * identifier in the process. 00301 * 00302 * PARAMETERS 00303 * hwndOwner [in] Owner window for output 00304 * pidl [in] simple pidl of item to change 00305 * lpszName [in] the items new display name 00306 * dwFlags [in] SHGNO formatting flags 00307 * ppidlOut [out] simple pidl returned 00308 */ 00309 HRESULT WINAPI CNetFolder::SetNameOf(HWND hwndOwner, LPCITEMIDLIST pidl, /*simple pidl */ 00310 LPCOLESTR lpName, DWORD dwFlags, LPITEMIDLIST * pPidlOut) 00311 { 00312 FIXME("(%p)->(%p,pidl=%p,%s,%u,%p)\n", this, 00313 hwndOwner, pidl, debugstr_w (lpName), dwFlags, pPidlOut); 00314 return E_FAIL; 00315 } 00316 00317 HRESULT WINAPI CNetFolder::GetDefaultSearchGUID(GUID *pguid) 00318 { 00319 FIXME("(%p)\n", this); 00320 return E_NOTIMPL; 00321 } 00322 00323 HRESULT WINAPI CNetFolder::EnumSearches(IEnumExtraSearch ** ppenum) 00324 { 00325 FIXME("(%p)\n", this); 00326 return E_NOTIMPL; 00327 } 00328 00329 HRESULT WINAPI CNetFolder::GetDefaultColumn (DWORD dwRes, ULONG *pSort, ULONG *pDisplay) 00330 { 00331 TRACE("(%p)\n", this); 00332 00333 if (pSort) 00334 *pSort = 0; 00335 if (pDisplay) 00336 *pDisplay = 0; 00337 00338 return S_OK; 00339 } 00340 00341 HRESULT WINAPI CNetFolder::GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags) 00342 { 00343 TRACE("(%p)\n", this); 00344 00345 if (!pcsFlags || iColumn >= NETWORKPLACESSHELLVIEWCOLUMNS) 00346 return E_INVALIDARG; 00347 *pcsFlags = NetworkPlacesSFHeader[iColumn].pcsFlags; 00348 return S_OK; 00349 } 00350 00351 HRESULT WINAPI CNetFolder::GetDetailsEx(LPCITEMIDLIST pidl, const SHCOLUMNID *pscid, VARIANT *pv) 00352 { 00353 FIXME("(%p)\n", this); 00354 return E_NOTIMPL; 00355 } 00356 00357 HRESULT WINAPI CNetFolder::GetDetailsOf(LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS *psd) 00358 { 00359 WCHAR buffer[MAX_PATH] = {0}; 00360 HRESULT hr = E_FAIL; 00361 00362 if (iColumn >= NETWORKPLACESSHELLVIEWCOLUMNS) 00363 return E_FAIL; 00364 00365 psd->fmt = NetworkPlacesSFHeader[iColumn].fmt; 00366 psd->cxChar = NetworkPlacesSFHeader[iColumn].cxChar; 00367 if (pidl == NULL) 00368 { 00369 psd->str.uType = STRRET_WSTR; 00370 if (LoadStringW(shell32_hInstance, NetworkPlacesSFHeader[iColumn].colnameid, buffer, _countof(buffer))) 00371 hr = SHStrDupW(buffer, &psd->str.pOleStr); 00372 00373 return hr; 00374 } 00375 00376 if (iColumn == COLUMN_NAME) 00377 return GetDisplayNameOf(pidl, SHGDN_NORMAL, &psd->str); 00378 00379 FIXME("(%p)->(%p %i %p)\n", this, pidl, iColumn, psd); 00380 00381 return E_NOTIMPL; 00382 } 00383 00384 HRESULT WINAPI CNetFolder::MapColumnToSCID(UINT column, SHCOLUMNID *pscid) 00385 { 00386 FIXME("(%p)\n", this); 00387 00388 return E_NOTIMPL; 00389 } 00390 00391 /************************************************************************ 00392 * CNetFolder::GetClassID 00393 */ 00394 HRESULT WINAPI CNetFolder::GetClassID(CLSID *lpClassId) 00395 { 00396 TRACE("(%p)\n", this); 00397 00398 if (!lpClassId) 00399 return E_POINTER; 00400 00401 *lpClassId = CLSID_NetworkPlaces; 00402 00403 return S_OK; 00404 } 00405 00406 /************************************************************************ 00407 * CNetFolder::Initialize 00408 * 00409 * NOTES: it makes no sense to change the pidl 00410 */ 00411 HRESULT WINAPI CNetFolder::Initialize(LPCITEMIDLIST pidl) 00412 { 00413 TRACE("(%p)->(%p)\n", this, pidl); 00414 00415 return E_NOTIMPL; 00416 } 00417 00418 /************************************************************************** 00419 * CNetFolder::GetCurFolder 00420 */ 00421 HRESULT WINAPI CNetFolder::GetCurFolder(LPITEMIDLIST *pidl) 00422 { 00423 TRACE("(%p)->(%p)\n", this, pidl); 00424 00425 if (!pidl) 00426 return E_POINTER; 00427 00428 *pidl = ILClone(pidlRoot); 00429 00430 return S_OK; 00431 } Generated on Sun May 27 2012 04:26:22 for ReactOS by
1.7.6.1
|