- Timestamp:
- Nov 2, 1999, 9:38:48 PM (26 years ago)
- Location:
- trunk/src/shell32
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/shell32/shell32_main.cpp
r1360 r1558 1 /* $Id: shell32_main.cpp,v 1. 4 1999-10-19 14:32:14phaller Exp $ */1 /* $Id: shell32_main.cpp,v 1.5 1999-11-02 20:38:47 phaller Exp $ */ 2 2 3 3 /* … … 46 46 #include "shlguid.h" 47 47 #include "wine/undocshell.h" 48 #include "shpolicy.h" 48 49 49 50 #include <heapstring.h> … … 159 160 { 160 161 pidl = (LPCITEMIDLIST) path; 162 if (!pidl ) 163 { 164 dprintf(("pidl is null!\n")); 165 return FALSE; 166 } 161 167 } 162 168 else if (!(flags & SHGFI_USEFILEATTRIBUTES)) … … 200 206 if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME)) 201 207 { 202 if(_ILIsValue(pidlLast)) 203 { 204 char sTemp[64]; 205 if (_ILGetExtension (pidlLast, sTemp, 64)) 206 { 207 if (!( HCR_MapTypeToValue(sTemp, sTemp, 64, TRUE) 208 && HCR_MapTypeToValue(sTemp, psfi->szTypeName, 80, FALSE ))) 209 { 210 lstrcpynA (psfi->szTypeName, sTemp, 74); 211 strcat (psfi->szTypeName, "-file"); 212 } 213 } 214 } 215 else 216 { 217 strcpy(psfi->szTypeName, "Folder"); 218 } 208 _ILGetFileType(pidlLast, psfi->szTypeName, 80); 219 209 } 220 210 … … 569 559 * AboutDlgProc32 (internal) 570 560 */ 571 572 561 BOOL WINAPI AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, 573 562 LPARAM lParam ) … … 925 914 { 926 915 dprintf(("shell32.dll instantiated twice in one address space!\n")); 916 } 917 else 918 { 919 /* we only want to call this the first time shell32 is instantiated */ 920 SHInitRestricted(NULL, NULL); 927 921 } 928 922 … … 988 982 shell32_RefCount--; 989 983 990 pOleUninitialize();991 FreeLibrary(hOle32);992 FreeLibrary(hComctl32);993 994 984 if ( !shell32_RefCount ) 995 985 { … … 1010 1000 } 1011 1001 } 1002 1003 FreeLibrary(hOle32); 1004 FreeLibrary(hComctl32); 1005 1012 1006 dprintf(("refcount=%u objcount=%u \n", shell32_RefCount, shell32_ObjCount)); 1013 1007 break; -
trunk/src/shell32/shlfolder.cpp
r1215 r1558 1 /* $Id: shlfolder.cpp,v 1. 2 1999-10-09 11:17:05 sandervlExp $ */1 /* $Id: shlfolder.cpp,v 1.3 1999-11-02 20:38:47 phaller Exp $ */ 2 2 /* 3 * 3 * Shell Folder stuff 4 4 * 5 * Copyright 1997Marcus Meissner6 * Copyright 1998, 1999Juergen Schmied7 * 8 * 5 * Copyright 1997 Marcus Meissner 6 * Copyright 1998, 1999 Juergen Schmied 7 * 8 * IShellFolder with IDropTarget, IPersistFolder 9 9 * 10 10 */ … … 52 52 53 53 static LPCWSTR GetNextElementW(LPCWSTR pszNext,LPWSTR pszOut,DWORD dwOut) 54 { 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 54 { LPCWSTR pszTail = pszNext; 55 DWORD dwCopy; 56 TRACE("(%s %p 0x%08lx)\n",debugstr_w(pszNext),pszOut,dwOut); 57 58 *pszOut=0x0000; 59 60 if(!pszNext || !*pszNext) 61 return NULL; 62 63 while(*pszTail && (*pszTail != (WCHAR)'\\')) 64 pszTail++; 65 66 dwCopy = (WCHAR*)pszTail - (WCHAR*)pszNext + 1; 67 lstrcpynW(pszOut, pszNext, (dwOut<dwCopy)? dwOut : dwCopy); 68 69 if(*pszTail) 70 pszTail++; 71 else 72 pszTail = NULL; 73 74 TRACE("--(%s %s 0x%08lx %p)\n",debugstr_w(pszNext),debugstr_w(pszOut),dwOut,pszTail); 75 return pszTail; 76 76 } 77 77 78 78 static HRESULT SHELL32_ParseNextElement( 79 80 81 82 83 84 85 { 86 HRESULThr = E_OUTOFMEMORY;87 LPITEMIDLISTpidlOut, pidlTemp = NULL;88 IShellFolder*psfChild;89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 return hr; 79 HWND hwndOwner, 80 IShellFolder * psf, 81 LPITEMIDLIST * pidlInOut, 82 LPOLESTR szNext, 83 DWORD *pEaten, 84 DWORD *pdwAttributes) 85 { 86 HRESULT hr = E_OUTOFMEMORY; 87 LPITEMIDLIST pidlOut, pidlTemp = NULL; 88 IShellFolder *psfChild; 89 90 TRACE("(%p %p %s)\n",psf, pidlInOut? *pidlInOut: NULL, debugstr_w(szNext)); 91 92 93 /* get the shellfolder for the child pidl and let it analyse further */ 94 hr = IShellFolder_BindToObject(psf, *pidlInOut, NULL, &IID_IShellFolder, (LPVOID*)&psfChild); 95 96 if (psfChild) 97 { 98 hr = IShellFolder_ParseDisplayName(psfChild, hwndOwner, NULL, szNext, pEaten, &pidlOut, pdwAttributes); 99 IShellFolder_Release(psfChild); 100 101 pidlTemp = ILCombine(*pidlInOut, pidlOut); 102 103 if (pidlOut) 104 ILFree(pidlOut); 105 } 106 107 ILFree(*pidlInOut); 108 *pidlInOut = pidlTemp; 109 110 TRACE("-- pidl=%p ret=0x%08lx\n", pidlInOut? *pidlInOut: NULL, hr); 111 return hr; 112 112 } 113 113 114 114 /*********************************************************************** 115 * 115 * SHELL32_CoCreateInitSF 116 116 * 117 * 117 * creates a initialized shell folder 118 118 */ 119 119 static HRESULT SHELL32_CoCreateInitSF ( 120 121 122 123 124 125 { 126 127 LPITEMIDLISTabsPidl;128 IShellFolder*pShellFolder;129 IPersistFolder*pPersistFolder;130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 120 LPITEMIDLIST pidlRoot, 121 LPITEMIDLIST pidlChild, 122 REFCLSID clsid, 123 REFIID iid, 124 LPVOID * ppvOut) 125 { 126 HRESULT hr; 127 LPITEMIDLIST absPidl; 128 IShellFolder *pShellFolder; 129 IPersistFolder *pPersistFolder; 130 131 TRACE("%p %p\n", pidlRoot, pidlChild); 132 133 *ppvOut = NULL; 134 135 /* we have to ask first for IPersistFolder, some special folders are expecting this */ 136 hr = SHCoCreateInstance(NULL, clsid, NULL, &IID_IPersistFolder, (LPVOID*)&pPersistFolder); 137 if (SUCCEEDED(hr)) 138 { 139 hr = IPersistFolder_QueryInterface(pPersistFolder, iid, (LPVOID*)&pShellFolder); 140 if (SUCCEEDED(hr)) 141 { 142 absPidl = ILCombine (pidlRoot, pidlChild); 143 hr = IPersistFolder_Initialize(pPersistFolder, absPidl); 144 IPersistFolder_Release(pPersistFolder); 145 SHFree(absPidl); 146 *ppvOut = pShellFolder; 147 } 148 } 149 150 TRACE("-- ret=0x%08lx\n", hr); 151 return hr; 152 152 } 153 153 154 154 static HRESULT SHELL32_GetDisplayNameOfChild( 155 156 157 158 159 160 { 161 LPITEMIDLISTpidlFirst, pidlNext;162 IShellFolder *psfChild;163 HRESULThr = E_OUTOFMEMORY;164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 155 IShellFolder * psf, 156 LPCITEMIDLIST pidl, 157 DWORD dwFlags, 158 LPSTR szOut, 159 DWORD dwOutLen) 160 { 161 LPITEMIDLIST pidlFirst, pidlNext; 162 IShellFolder * psfChild; 163 HRESULT hr = E_OUTOFMEMORY; 164 STRRET strTemp; 165 166 TRACE("(%p)->(pidl=%p 0x%08lx %p 0x%08lx)\n",psf,pidl,dwFlags,szOut, dwOutLen); 167 pdump(pidl); 168 169 if ((pidlFirst = ILCloneFirst(pidl))) 170 { 171 hr = IShellFolder_BindToObject(psf, pidlFirst, NULL, &IID_IShellFolder, (LPVOID*)&psfChild); 172 if (SUCCEEDED(hr)) 173 { 174 pidlNext = ILGetNext(pidl); 175 176 hr = IShellFolder_GetDisplayNameOf(psfChild, pidlNext, dwFlags | SHGDN_INFOLDER, &strTemp); 177 if (SUCCEEDED(hr)) 178 { 179 hr = StrRetToStrNA(szOut, dwOutLen, &strTemp, pidlNext); 180 } 181 182 IShellFolder_Release(psfChild); 183 } 184 ILFree(pidlFirst); 185 } 186 187 TRACE("-- ret=0x%08lx %s\n", hr, szOut); 188 189 return hr; 190 190 } 191 191 … … 196 196 typedef struct 197 197 { 198 ICOM_VTABLE(IShellFolder)*lpvtbl;199 DWORDref;200 201 ICOM_VTABLE(IPersistFolder)*lpvtblPersistFolder;202 ICOM_VTABLE(IDropTarget)*lpvtblDropTarget;203 204 CLSID*pclsid;205 206 LPSTRsMyPath;207 LPITEMIDLIST absPidl;/* complete pidl */208 209 UINT cfShellIDList;/* clipboardformat for IDropTarget */210 BOOL fAcceptFmt;/* flag for pending Drop */198 ICOM_VTABLE(IShellFolder)* lpvtbl; 199 DWORD ref; 200 201 ICOM_VTABLE(IPersistFolder)* lpvtblPersistFolder; 202 ICOM_VTABLE(IDropTarget)* lpvtblDropTarget; 203 204 CLSID* pclsid; 205 206 LPSTR sMyPath; 207 LPITEMIDLIST absPidl; /* complete pidl */ 208 209 UINT cfShellIDList; /* clipboardformat for IDropTarget */ 210 BOOL fAcceptFmt; /* flag for pending Drop */ 211 211 } IGenericSFImpl; 212 212 … … 219 219 #define _IPersistFolder_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblPersistFolder))) 220 220 #define _ICOM_THIS_From_IPersistFolder(class, name) class* This = (class*)(((char*)name)-_IPersistFolder_Offset); 221 221 222 222 #define _IDropTarget_Offset ((int)(&(((IGenericSFImpl*)0)->lpvtblDropTarget))) 223 223 #define _ICOM_THIS_From_IDropTarget(class, name) class* This = (class*)(((char*)name)-_IDropTarget_Offset); 224 224 225 225 /************************************************************************** 226 * 226 * registers clipboardformat once 227 227 */ 228 228 static void SF_RegisterClipFmt (IShellFolder * iface) 229 229 { 230 231 232 233 234 235 236 237 238 } 239 240 /************************************************************************** 241 * 230 ICOM_THIS(IGenericSFImpl, iface); 231 232 TRACE("(%p)\n", This); 233 234 if (!This->cfShellIDList) 235 { 236 This->cfShellIDList = RegisterClipboardFormatA(CFSTR_SHELLIDLIST); 237 } 238 } 239 240 /************************************************************************** 241 * IShellFolder_Constructor 242 242 * 243 243 */ 244 244 245 245 static IShellFolder * IShellFolder_Constructor( 246 247 248 { 249 IGenericSFImpl *sf;250 IGenericSFImpl *sfParent = (IGenericSFImpl*) psf;251 DWORDdwSize=0;252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 if(pidl)/* do we have a pidl? */267 268 269 270 sf->absPidl = ILCombine(sfParent->absPidl, pidl);/* build a absolute pidl */271 272 if (!_ILIsSpecialFolder(pidl))/* only file system paths */273 274 if(sfParent->sMyPath)/* get the size of the parents path */275 276 277 278 279 280 dwSize += _ILSimpleGetText(pidl,NULL,0);/* add the size of our name*/281 sf->sMyPath = (char*)SHAlloc(dwSize + 2);/* '\0' and backslash */282 283 284 285 286 if(sfParent->sMyPath)/* if the parent has a path, get it*/287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 246 IShellFolder * psf, 247 LPITEMIDLIST pidl) 248 { 249 IGenericSFImpl * sf; 250 IGenericSFImpl * sfParent = (IGenericSFImpl*) psf; 251 DWORD dwSize=0; 252 253 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl)); 254 sf->ref=1; 255 256 sf->lpvtbl=&sfvt; 257 sf->lpvtblPersistFolder=&psfvt; 258 sf->lpvtblDropTarget=&dt2vt; 259 sf->pclsid = (CLSID*)&CLSID_SFFile; 260 sf->cfShellIDList=0; 261 sf->fAcceptFmt=FALSE; 262 263 TRACE("(%p)->(parent=%p, pidl=%p)\n",sf,sfParent, pidl); 264 pdump(pidl); 265 266 if(pidl) /* do we have a pidl? */ 267 { 268 int len; 269 270 sf->absPidl = ILCombine(sfParent->absPidl, pidl); /* build a absolute pidl */ 271 272 if (!_ILIsSpecialFolder(pidl)) /* only file system paths */ 273 { 274 if(sfParent->sMyPath) /* get the size of the parents path */ 275 { 276 dwSize += strlen(sfParent->sMyPath) ; 277 TRACE("-- (%p)->(parent's path=%s)\n",sf, debugstr_a(sfParent->sMyPath)); 278 } 279 280 dwSize += _ILSimpleGetText(pidl,NULL,0); /* add the size of our name*/ 281 sf->sMyPath = (char*)SHAlloc(dwSize + 2); /* '\0' and backslash */ 282 283 if(!sf->sMyPath) return NULL; 284 *(sf->sMyPath)=0x00; 285 286 if(sfParent->sMyPath) /* if the parent has a path, get it*/ 287 { 288 strcpy(sf->sMyPath, sfParent->sMyPath); 289 PathAddBackslashA (sf->sMyPath); 290 } 291 292 len = strlen(sf->sMyPath); 293 _ILSimpleGetText(pidl, sf->sMyPath + len, dwSize - len + 1); 294 } 295 296 TRACE("-- (%p)->(my pidl=%p, my path=%s)\n",sf, sf->absPidl,debugstr_a(sf->sMyPath)); 297 298 pdump (sf->absPidl); 299 } 300 301 shell32_ObjCount++; 302 return (IShellFolder *)sf; 303 303 } 304 304 /************************************************************************** … … 306 306 * 307 307 * PARAMETERS 308 * REFIID riid 309 * LPVOID* ppvObject 308 * REFIID riid [in ] Requested InterfaceID 309 * LPVOID* ppvObject [out] Interface* to hold the result 310 310 */ 311 311 static HRESULT WINAPI IShellFolder_fnQueryInterface( 312 313 314 315 { 316 317 318 char xriid[50]; 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 312 IShellFolder * iface, 313 REFIID riid, 314 LPVOID *ppvObj) 315 { 316 ICOM_THIS(IGenericSFImpl, iface); 317 318 char xriid[50]; 319 WINE_StringFromCLSID((LPCLSID)riid,xriid); 320 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,xriid,ppvObj); 321 322 *ppvObj = NULL; 323 324 if(IsEqualIID(riid, &IID_IUnknown)) 325 { *ppvObj = This; 326 } 327 else if(IsEqualIID(riid, &IID_IShellFolder)) 328 { 329 *ppvObj = (IShellFolder*)This; 330 } 331 else if(IsEqualIID(riid, &IID_IPersist)) 332 { 333 *ppvObj = (IPersistFolder*)&(This->lpvtblPersistFolder); 334 } 335 else if(IsEqualIID(riid, &IID_IPersistFolder)) 336 { 337 *ppvObj = (IPersistFolder*)&(This->lpvtblPersistFolder); 338 } 339 else if(IsEqualIID(riid, &IID_IDropTarget)) 340 { 341 *ppvObj = (IDropTarget*)&(This->lpvtblDropTarget); 342 SF_RegisterClipFmt((IShellFolder*)This); 343 } 344 345 if(*ppvObj) 346 { 347 IUnknown_AddRef((IUnknown*)(*ppvObj)); 348 TRACE("-- Interface = %p\n", *ppvObj); 349 return S_OK; 350 } 351 TRACE("-- Interface: E_NOINTERFACE\n"); 352 return E_NOINTERFACE; 353 353 } 354 354 … … 359 359 static ULONG WINAPI IShellFolder_fnAddRef(IShellFolder * iface) 360 360 { 361 361 ICOM_THIS(IGenericSFImpl, iface); 362 362 363 363 #ifdef MEM_DEBUG 364 364 TRACE("called from: 0x%08x\n", *( ((UINT*)&iface)-1 )); 365 365 #endif 366 367 368 369 366 TRACE("(%p)->(count=%lu)\n",This,This->ref); 367 368 shell32_ObjCount++; 369 return ++(This->ref); 370 370 } 371 371 … … 375 375 static ULONG WINAPI IShellFolder_fnRelease(IShellFolder * iface) 376 376 { 377 377 ICOM_THIS(IGenericSFImpl, iface); 378 378 379 379 #ifdef MEM_DEBUG 380 380 TRACE("called from: 0x%08x\n", *( ((UINT*)&iface)-1 )); 381 381 #endif 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 } 405 /************************************************************************** 406 * 382 TRACE("(%p)->(count=%lu)\n",This,This->ref); 383 384 shell32_ObjCount--; 385 if (!--(This->ref)) 386 { TRACE("-- destroying IShellFolder(%p)\n",This); 387 388 if (pdesktopfolder == iface) 389 { pdesktopfolder=NULL; 390 TRACE("-- destroyed IShellFolder(%p) was Desktopfolder\n",This); 391 } 392 if(This->absPidl) 393 { SHFree(This->absPidl); 394 } 395 if(This->sMyPath) 396 { SHFree(This->sMyPath); 397 } 398 399 HeapFree(GetProcessHeap(),0,This); 400 401 return 0; 402 } 403 return This->ref; 404 } 405 /************************************************************************** 406 * IShellFolder_fnParseDisplayName 407 407 * PARAMETERS 408 408 * HWND hwndOwner, //[in ] Parent window for any message's … … 418 418 * now we can parse into namespaces implemented by shell extensions 419 419 * 420 * behaviour on win98: 421 * 420 * behaviour on win98: lpszDisplayName=NULL -> chrash 421 * lpszDisplayName="" -> returns mycoputer-pidl 422 422 * 423 423 * FIXME: … … 426 426 */ 427 427 static HRESULT WINAPI IShellFolder_fnParseDisplayName( 428 IShellFolder * iface, 429 HWND hwndOwner, 430 LPBC pbcReserved, 431 LPOLESTR lpszDisplayName, 432 DWORD *pchEaten, 433 LPITEMIDLIST *ppidl, 434 DWORD *pdwAttributes) 435 { 436 ICOM_THIS(IGenericSFImpl, iface); 437 438 HRESULT hr = E_OUTOFMEMORY; 439 LPCWSTR szNext=NULL; 440 WCHAR szElement[MAX_PATH]; 441 CHAR szTempA[MAX_PATH], szPath[MAX_PATH]; 442 LPITEMIDLIST pidlTemp=NULL; 443 444 TRACE("(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n", 445 This,hwndOwner,pbcReserved,lpszDisplayName, 446 debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes); 447 448 if (pchEaten) *pchEaten = 0; /* strange but like the original */ 449 450 if (*lpszDisplayName) 451 { 452 /* get the next element */ 453 szNext = GetNextElementW(lpszDisplayName, szElement, MAX_PATH); 454 455 /* build the full pathname to the element */ 456 WideCharToLocal(szTempA, szElement, lstrlenW(szElement) + 1); 457 strcpy(szPath, This->sMyPath); 458 PathAddBackslashA(szPath); 459 strcat(szPath, szTempA); 460 461 /* get the pidl */ 462 pidlTemp = SHSimpleIDListFromPathA(szPath); 463 464 if (pidlTemp) 465 { 466 /* try to analyse the next element */ 467 if (szNext && *szNext) 468 { 469 hr = SHELL32_ParseNextElement(hwndOwner, (IShellFolder*)This, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes); 470 } 471 else 472 { 473 hr = S_OK; 474 } 475 } 476 } 477 478 *ppidl = pidlTemp; 479 480 TRACE("(%p)->(-- pidl=%p ret=0x%08lx)\n", This, ppidl? *ppidl:0, hr); 481 482 return hr; 483 } 484 485 /************************************************************************** 486 * IShellFolder_fnEnumObjects 428 IShellFolder * iface, 429 HWND hwndOwner, 430 LPBC pbcReserved, 431 LPOLESTR lpszDisplayName, 432 DWORD *pchEaten, 433 LPITEMIDLIST *ppidl, 434 DWORD *pdwAttributes) 435 { 436 ICOM_THIS(IGenericSFImpl, iface); 437 438 HRESULT hr = E_OUTOFMEMORY; 439 LPCWSTR szNext=NULL; 440 WCHAR szElement[MAX_PATH]; 441 CHAR szTempA[MAX_PATH], szPath[MAX_PATH]; 442 LPITEMIDLIST pidlTemp=NULL; 443 444 TRACE("(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n", 445 This,hwndOwner,pbcReserved,lpszDisplayName, 446 debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes); 447 448 if (!lpszDisplayName || !ppidl) return E_INVALIDARG; 449 450 if (pchEaten) *pchEaten = 0; /* strange but like the original */ 451 452 if (*lpszDisplayName) 453 { 454 /* get the next element */ 455 szNext = GetNextElementW(lpszDisplayName, szElement, MAX_PATH); 456 457 /* build the full pathname to the element */ 458 WideCharToLocal(szTempA, szElement, lstrlenW(szElement) + 1); 459 strcpy(szPath, This->sMyPath); 460 PathAddBackslashA(szPath); 461 strcat(szPath, szTempA); 462 463 /* get the pidl */ 464 pidlTemp = SHSimpleIDListFromPathA(szPath); 465 466 if (pidlTemp) 467 { 468 /* try to analyse the next element */ 469 if (szNext && *szNext) 470 { 471 hr = SHELL32_ParseNextElement(hwndOwner, (IShellFolder*)This, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes); 472 } 473 else 474 { 475 hr = S_OK; 476 } 477 } 478 } 479 480 *ppidl = pidlTemp; 481 482 TRACE("(%p)->(-- pidl=%p ret=0x%08lx)\n", This, ppidl? *ppidl:0, hr); 483 484 return hr; 485 } 486 487 /************************************************************************** 488 * IShellFolder_fnEnumObjects 487 489 * PARAMETERS 488 490 * HWND hwndOwner, //[in ] Parent Window … … 491 493 */ 492 494 static HRESULT WINAPI IShellFolder_fnEnumObjects( 493 494 495 496 497 { 498 499 500 501 502 503 504 505 506 507 508 509 return S_OK; 510 } 511 512 /************************************************************************** 513 * 495 IShellFolder * iface, 496 HWND hwndOwner, 497 DWORD dwFlags, 498 LPENUMIDLIST* ppEnumIDList) 499 { 500 ICOM_THIS(IGenericSFImpl, iface); 501 502 TRACE("(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n",This,hwndOwner,dwFlags,ppEnumIDList); 503 504 *ppEnumIDList = NULL; 505 *ppEnumIDList = IEnumIDList_Constructor (This->sMyPath, dwFlags, EIDL_FILE); 506 507 TRACE("-- (%p)->(new ID List: %p)\n",This,*ppEnumIDList); 508 509 if(!*ppEnumIDList) return E_OUTOFMEMORY; 510 511 return S_OK; 512 } 513 514 /************************************************************************** 515 * IShellFolder_fnBindToObject 514 516 * PARAMETERS 515 517 * LPCITEMIDLIST pidl, //[in ] relative pidl to open … … 519 521 */ 520 522 static HRESULT WINAPI IShellFolder_fnBindToObject( IShellFolder * iface, LPCITEMIDLIST pidl, 521 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut) 522 { 523 ICOM_THIS(IGenericSFImpl, iface); 524 GUID const * iid; 525 char xriid[50]; 526 IShellFolder *pShellFolder, *pSubFolder; 527 IPersistFolder *pPersistFolder; 528 LPITEMIDLIST absPidl; 529 530 WINE_StringFromCLSID(riid,xriid); 531 532 TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n",This,pidl,pbcReserved,xriid,ppvOut); 533 534 *ppvOut = NULL; 535 536 if ((iid=_ILGetGUIDPointer(pidl))) 537 { 538 /* we have to create a alien folder */ 539 if ( SUCCEEDED(SHCoCreateInstance(NULL, iid, NULL, riid, (LPVOID*)&pShellFolder)) 540 && SUCCEEDED(IShellFolder_QueryInterface(pShellFolder, &IID_IPersistFolder, (LPVOID*)&pPersistFolder))) 541 { 542 absPidl = ILCombine (This->absPidl, pidl); 543 IPersistFolder_Initialize(pPersistFolder, absPidl); 544 IPersistFolder_Release(pPersistFolder); 545 SHFree(absPidl); 546 } 547 else 548 { 549 return E_FAIL; 550 } 551 } 552 else 553 { 554 LPITEMIDLIST pidltemp = ILCloneFirst(pidl); 555 pShellFolder = IShellFolder_Constructor((IShellFolder*)This, pidltemp); 556 ILFree(pidltemp); 557 } 558 559 if (_ILIsPidlSimple(pidl)) 560 { 561 *ppvOut = pShellFolder; 562 } 563 else 564 { 565 IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, &IID_IShellFolder, (LPVOID*)&pSubFolder); 566 IShellFolder_Release(pShellFolder); 567 *ppvOut = pSubFolder; 568 } 569 570 TRACE("-- (%p) returning (%p)\n",This, *ppvOut); 571 572 return S_OK; 523 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut) 524 { 525 ICOM_THIS(IGenericSFImpl, iface); 526 GUID const * iid; 527 char xriid[50]; 528 IShellFolder *pShellFolder, *pSubFolder; 529 IPersistFolder *pPersistFolder; 530 LPITEMIDLIST absPidl; 531 532 WINE_StringFromCLSID(riid,xriid); 533 534 TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n",This,pidl,pbcReserved,xriid,ppvOut); 535 536 if(!pidl || !ppvOut) return E_INVALIDARG; 537 538 *ppvOut = NULL; 539 540 if ((iid=_ILGetGUIDPointer(pidl))) 541 { 542 /* we have to create a alien folder */ 543 if ( SUCCEEDED(SHCoCreateInstance(NULL, iid, NULL, riid, (LPVOID*)&pShellFolder)) 544 && SUCCEEDED(IShellFolder_QueryInterface(pShellFolder, &IID_IPersistFolder, (LPVOID*)&pPersistFolder))) 545 { 546 absPidl = ILCombine (This->absPidl, pidl); 547 IPersistFolder_Initialize(pPersistFolder, absPidl); 548 IPersistFolder_Release(pPersistFolder); 549 SHFree(absPidl); 550 } 551 else 552 { 553 return E_FAIL; 554 } 555 } 556 else 557 { 558 LPITEMIDLIST pidltemp = ILCloneFirst(pidl); 559 pShellFolder = IShellFolder_Constructor((IShellFolder*)This, pidltemp); 560 ILFree(pidltemp); 561 } 562 563 if (_ILIsPidlSimple(pidl)) 564 { 565 *ppvOut = pShellFolder; 566 } 567 else 568 { 569 IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, &IID_IShellFolder, (LPVOID*)&pSubFolder); 570 IShellFolder_Release(pShellFolder); 571 *ppvOut = pSubFolder; 572 } 573 574 TRACE("-- (%p) returning (%p)\n",This, *ppvOut); 575 576 return S_OK; 573 577 } 574 578 … … 582 586 */ 583 587 static HRESULT WINAPI IShellFolder_fnBindToStorage( 584 585 586 587 588 589 { 590 591 592 593 594 595 596 597 598 588 IShellFolder * iface, 589 LPCITEMIDLIST pidl, 590 LPBC pbcReserved, 591 REFIID riid, 592 LPVOID *ppvOut) 593 { 594 ICOM_THIS(IGenericSFImpl, iface); 595 596 char xriid[50]; 597 WINE_StringFromCLSID(riid,xriid); 598 599 FIXME("(%p)->(pidl=%p,%p,\n\tIID:%s,%p) stub\n",This,pidl,pbcReserved,xriid,ppvOut); 600 601 *ppvOut = NULL; 602 return E_NOTIMPL; 599 603 } 600 604 … … 616 620 617 621 static HRESULT WINAPI IShellFolder_fnCompareIDs( 618 619 620 621 622 { 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 else/* same type of pidl */664 665 666 667 668 669 if (nReturn == 0)/* first pidl different ? */670 671 672 673 if (pidl1 && pidl1->mkid.cb) /* go deeper? */ 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 hr = ResultFromShort(nReturn);/* two equal simple pidls */690 691 692 693 694 hr = ResultFromShort(nReturn);/* two different simple pidls */695 696 697 698 699 700 701 } 702 703 /************************************************************************** 704 * 622 IShellFolder * iface, 623 LPARAM lParam, 624 LPCITEMIDLIST pidl1, 625 LPCITEMIDLIST pidl2) 626 { 627 ICOM_THIS(IGenericSFImpl, iface); 628 629 CHAR szTemp1[MAX_PATH]; 630 CHAR szTemp2[MAX_PATH]; 631 int nReturn; 632 IShellFolder * psf; 633 HRESULT hr = E_OUTOFMEMORY; 634 LPCITEMIDLIST pidlTemp; 635 PIDLTYPE pt1, pt2; 636 637 TRACE("(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n",This,lParam,pidl1,pidl2); 638 pdump (pidl1); 639 pdump (pidl2); 640 641 if (!pidl1 && !pidl2) 642 { 643 hr = ResultFromShort(0); 644 } 645 else if (!pidl1) 646 { 647 hr = ResultFromShort(-1); 648 } 649 else if (!pidl2) 650 { 651 hr = ResultFromShort(1); 652 } 653 else 654 { 655 LPPIDLDATA pd1, pd2; 656 pd1 = _ILGetDataPointer(pidl1); 657 pd2 = _ILGetDataPointer(pidl2); 658 659 /* compate the types. sort order is the PT_* constant */ 660 pt1 = ( pd1 ? pd1->type: PT_DESKTOP); 661 pt2 = ( pd2 ? pd2->type: PT_DESKTOP); 662 663 if (pt1 != pt2) 664 { 665 hr = ResultFromShort(pt1-pt2); 666 } 667 else /* same type of pidl */ 668 { 669 _ILSimpleGetText(pidl1, szTemp1, MAX_PATH); 670 _ILSimpleGetText(pidl2, szTemp2, MAX_PATH); 671 nReturn = strcmp(szTemp1, szTemp2); 672 673 if (nReturn == 0) /* first pidl different ? */ 674 { 675 pidl1 = ILGetNext(pidl1); 676 677 if (pidl1 && pidl1->mkid.cb) /* go deeper? */ 678 { 679 pidlTemp = ILCloneFirst(pidl1); 680 pidl2 = ILGetNext(pidl2); 681 682 hr = IShellFolder_BindToObject((IShellFolder*)This, pidlTemp, NULL, &IID_IShellFolder, (LPVOID*)&psf); 683 if (SUCCEEDED(hr)) 684 { 685 nReturn = IShellFolder_CompareIDs(psf, 0, pidl1, pidl2); 686 IShellFolder_Release(psf); 687 hr = ResultFromShort(nReturn); 688 } 689 ILFree(pidlTemp); 690 } 691 else 692 { 693 hr = ResultFromShort(nReturn); /* two equal simple pidls */ 694 } 695 } 696 else 697 { 698 hr = ResultFromShort(nReturn); /* two different simple pidls */ 699 } 700 } 701 } 702 703 TRACE("-- res=0x%08lx\n", hr); 704 return hr; 705 } 706 707 /************************************************************************** 708 * IShellFolder_fnCreateViewObject 705 709 */ 706 710 static HRESULT WINAPI IShellFolder_fnCreateViewObject( IShellFolder * iface, 707 708 { 709 710 711 LPSHELLVIEWpShellView;712 charxriid[50];713 HRESULThr = E_INVALIDARG;714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 711 HWND hwndOwner, REFIID riid, LPVOID *ppvOut) 712 { 713 ICOM_THIS(IGenericSFImpl, iface); 714 715 LPSHELLVIEW pShellView; 716 char xriid[50]; 717 HRESULT hr = E_INVALIDARG; 718 719 WINE_StringFromCLSID(riid,xriid); 720 TRACE("(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",This,hwndOwner,xriid,ppvOut); 721 722 if(ppvOut) 723 { 724 *ppvOut = NULL; 725 726 if(IsEqualIID(riid, &IID_IDropTarget)) 727 { 728 hr = IShellFolder_QueryInterface((IShellFolder*)This, &IID_IDropTarget, ppvOut); 729 } 730 else if(IsEqualIID(riid, &IID_IContextMenu)) 731 { 732 FIXME("IContextMenu not implemented\n"); 733 hr = E_NOTIMPL; 734 } 735 else if(IsEqualIID(riid, &IID_IShellView)) 736 { 737 pShellView = IShellView_Constructor((IShellFolder *) This); 738 if(pShellView) 739 { 740 hr = IShellView_QueryInterface(pShellView, riid, ppvOut); 741 IShellView_Release(pShellView); 742 } 743 } 744 } 745 TRACE("-- (%p)->(interface=%p)\n",This, ppvOut); 746 return hr; 743 747 } 744 748 … … 754 758 static HRESULT WINAPI IShellFolder_fnGetAttributesOf(IShellFolder * iface,UINT cidl,LPCITEMIDLIST *apidl,DWORD *rgfInOut) 755 759 { 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 next: 781 782 783 784 785 786 760 ICOM_THIS(IGenericSFImpl, iface); 761 762 HRESULT hr = S_OK; 763 764 TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",This,cidl,apidl,*rgfInOut); 765 766 if ( (!cidl) || (!apidl) || (!rgfInOut)) 767 return E_INVALIDARG; 768 769 while (cidl > 0 && *apidl) 770 { 771 pdump (*apidl); 772 if (_ILIsFolder( *apidl)) 773 { 774 *rgfInOut &= 0xe0000177; 775 goto next; 776 } 777 else if (_ILIsValue( *apidl)) 778 { 779 *rgfInOut &= 0x40000177; 780 goto next; 781 } 782 hr = E_INVALIDARG; 783 784 next: apidl++; 785 cidl--; 786 } 787 788 TRACE("-- result=0x%08lx\n",*rgfInOut); 789 790 return hr; 787 791 } 788 792 /************************************************************************** … … 808 812 */ 809 813 static HRESULT WINAPI IShellFolder_fnGetUIObjectOf( 810 IShellFolder *iface,811 HWNDhwndOwner,812 UINTcidl,813 LPCITEMIDLIST *apidl,814 REFIIDriid,815 UINT *prgfInOut,816 LPVOID *ppvOut)817 { 818 819 820 charxclsid[50];821 LPITEMIDLISTpidl;822 IUnknown*pObj = NULL;823 HRESULThr = E_INVALIDARG;824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 814 IShellFolder * iface, 815 HWND hwndOwner, 816 UINT cidl, 817 LPCITEMIDLIST * apidl, 818 REFIID riid, 819 UINT * prgfInOut, 820 LPVOID * ppvOut) 821 { 822 ICOM_THIS(IGenericSFImpl, iface); 823 824 char xclsid[50]; 825 LPITEMIDLIST pidl; 826 IUnknown* pObj = NULL; 827 HRESULT hr = E_INVALIDARG; 828 829 WINE_StringFromCLSID(riid,xclsid); 830 831 TRACE("(%p)->(%u,%u,apidl=%p,\n\tIID:%s,%p,%p)\n", 832 This,hwndOwner,cidl,apidl,xclsid,prgfInOut,ppvOut); 833 834 if (ppvOut) 835 { 836 *ppvOut = NULL; 837 838 if(IsEqualIID(riid, &IID_IContextMenu) && (cidl >= 1)) 839 { 840 pObj = (LPUNKNOWN)IContextMenu_Constructor((IShellFolder *)This, This->absPidl, apidl, cidl); 841 hr = S_OK; 842 } 843 else if (IsEqualIID(riid, &IID_IDataObject) &&(cidl >= 1)) 844 { 845 pObj = (LPUNKNOWN)IDataObject_Constructor (hwndOwner, This->absPidl, apidl, cidl); 846 hr = S_OK; 847 } 848 else if (IsEqualIID(riid, &IID_IExtractIconA) && (cidl == 1)) 849 { 850 pidl = ILCombine(This->absPidl,apidl[0]); 851 pObj = (LPUNKNOWN)IExtractIconA_Constructor( pidl ); 852 SHFree(pidl); 853 hr = S_OK; 854 } 855 else if (IsEqualIID(riid, &IID_IDropTarget) && (cidl >= 1)) 856 { 857 hr = IShellFolder_QueryInterface((IShellFolder*)This, &IID_IDropTarget, (LPVOID*)&pObj); 858 } 859 else 860 { 861 hr = E_NOINTERFACE; 862 } 863 864 if(!pObj) 865 hr = E_OUTOFMEMORY; 866 867 *ppvOut = pObj; 868 } 869 TRACE("(%p)->hr=0x%08lx\n",This, hr); 870 return hr; 867 871 } 868 872 … … 883 887 884 888 static HRESULT WINAPI IShellFolder_fnGetDisplayNameOf( 885 886 887 888 889 { 890 891 892 CHARszPath[MAX_PATH]= "";893 intlen = 0;894 BOOLbSimplePidl;895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 strcpy (szPath, This->sMyPath);/* get path to root*/916 917 918 919 _ILSimpleGetText(pidl, szPath + len, MAX_PATH - len);/* append my own path */920 921 922 if ( (dwFlags & SHGDN_FORPARSING) && !bSimplePidl)/* go deeper if needed */923 924 925 926 927 928 929 930 931 932 933 934 889 IShellFolder * iface, 890 LPCITEMIDLIST pidl, 891 DWORD dwFlags, 892 LPSTRRET strRet) 893 { 894 ICOM_THIS(IGenericSFImpl, iface); 895 896 CHAR szPath[MAX_PATH]= ""; 897 int len = 0; 898 BOOL bSimplePidl; 899 900 TRACE("(%p)->(pidl=%p,0x%08lx,%p)\n",This,pidl,dwFlags,strRet); 901 pdump(pidl); 902 903 if(!pidl || !strRet) return E_INVALIDARG; 904 905 bSimplePidl = _ILIsPidlSimple(pidl); 906 907 /* take names of special folders only if its only this folder */ 908 if (_ILIsSpecialFolder(pidl)) 909 { 910 if ( bSimplePidl) 911 { 912 _ILSimpleGetText(pidl, szPath, MAX_PATH); /* append my own path */ 913 } 914 } 915 else 916 { 917 if (!(dwFlags & SHGDN_INFOLDER) && (dwFlags & SHGDN_FORPARSING) && This->sMyPath) 918 { 919 strcpy (szPath, This->sMyPath); /* get path to root*/ 920 PathAddBackslashA(szPath); 921 len = strlen(szPath); 922 } 923 _ILSimpleGetText(pidl, szPath + len, MAX_PATH - len); /* append my own path */ 924 } 925 926 if ( (dwFlags & SHGDN_FORPARSING) && !bSimplePidl) /* go deeper if needed */ 927 { 928 PathAddBackslashA(szPath); 929 len = strlen(szPath); 930 931 if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild((IShellFolder*)This, pidl, dwFlags, szPath + len, MAX_PATH - len))) 932 return E_OUTOFMEMORY; 933 } 934 strRet->uType = STRRET_CSTRA; 935 lstrcpynA(strRet->u.cStr, szPath, MAX_PATH); 936 937 TRACE("-- (%p)->(%s)\n", This, szPath); 938 return S_OK; 935 939 } 936 940 … … 948 952 */ 949 953 static HRESULT WINAPI IShellFolder_fnSetNameOf( 950 951 952 953 954 955 956 { 957 958 959 960 961 962 954 IShellFolder * iface, 955 HWND hwndOwner, 956 LPCITEMIDLIST pidl, /*simple pidl*/ 957 LPCOLESTR lpName, 958 DWORD dw, 959 LPITEMIDLIST *pPidlOut) 960 { 961 ICOM_THIS(IGenericSFImpl, iface); 962 963 FIXME("(%p)->(%u,pidl=%p,%s,%lu,%p),stub!\n", 964 This,hwndOwner,pidl,debugstr_w(lpName),dw,pPidlOut); 965 966 return E_NOTIMPL; 963 967 } 964 968 … … 968 972 static HRESULT WINAPI IShellFolder_fnGetFolderPath(IShellFolder * iface, LPSTR lpszOut, DWORD dwOutSize) 969 973 { 970 971 972 973 974 975 976 977 978 979 980 981 982 983 974 ICOM_THIS(IGenericSFImpl, iface); 975 976 TRACE("(%p)->(%p %lu)\n",This, lpszOut, dwOutSize); 977 978 if (!lpszOut) return FALSE; 979 980 *lpszOut=0; 981 982 if (! This->sMyPath) return FALSE; 983 984 lstrcpynA(lpszOut, This->sMyPath, dwOutSize); 985 986 TRACE("-- (%p)->(return=%s)\n",This, lpszOut); 987 return TRUE; 984 988 } 985 989 986 990 ICOM_VTABLE(IShellFolder) sfvt = 987 { 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 991 { 992 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 993 IShellFolder_fnQueryInterface, 994 IShellFolder_fnAddRef, 995 IShellFolder_fnRelease, 996 IShellFolder_fnParseDisplayName, 997 IShellFolder_fnEnumObjects, 998 IShellFolder_fnBindToObject, 999 IShellFolder_fnBindToStorage, 1000 IShellFolder_fnCompareIDs, 1001 IShellFolder_fnCreateViewObject, 1002 IShellFolder_fnGetAttributesOf, 1003 IShellFolder_fnGetUIObjectOf, 1004 IShellFolder_fnGetDisplayNameOf, 1005 IShellFolder_fnSetNameOf, 1006 IShellFolder_fnGetFolderPath 1003 1007 }; 1004 1008 1005 1009 /*********************************************************************** 1006 * [Desktopfolder]IShellFolder implementation1010 * [Desktopfolder] IShellFolder implementation 1007 1011 */ 1008 1012 extern struct ICOM_VTABLE(IShellFolder) sfdvt; 1009 1013 1010 1014 /************************************************************************** 1011 * 1015 * ISF_Desktop_Constructor 1012 1016 * 1013 1017 */ 1014 1018 IShellFolder * ISF_Desktop_Constructor() 1015 1019 { 1016 IGenericSFImpl *sf;1017 1018 1019 1020 1021 sf->absPidl=_ILCreateDesktop();/* my qualified pidl */1022 1023 1024 1025 1026 1027 } 1028 1029 /************************************************************************** 1030 * 1020 IGenericSFImpl * sf; 1021 1022 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl)); 1023 sf->ref=1; 1024 sf->lpvtbl=&sfdvt; 1025 sf->absPidl=_ILCreateDesktop(); /* my qualified pidl */ 1026 1027 TRACE("(%p)\n",sf); 1028 1029 shell32_ObjCount++; 1030 return (IShellFolder *)sf; 1031 } 1032 1033 /************************************************************************** 1034 * ISF_Desktop_fnQueryInterface 1031 1035 * 1032 1036 * NOTES supports not IPersist/IPersistFolder 1033 1037 */ 1034 1038 static HRESULT WINAPI ISF_Desktop_fnQueryInterface( 1035 1036 1037 1038 { 1039 1040 1041 char xriid[50]; 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 } 1063 1064 /************************************************************************** 1065 * 1039 IShellFolder * iface, 1040 REFIID riid, 1041 LPVOID *ppvObj) 1042 { 1043 ICOM_THIS(IGenericSFImpl, iface); 1044 1045 char xriid[50]; 1046 WINE_StringFromCLSID((LPCLSID)riid,xriid); 1047 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,xriid,ppvObj); 1048 1049 *ppvObj = NULL; 1050 1051 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ 1052 { *ppvObj = This; 1053 } 1054 else if(IsEqualIID(riid, &IID_IShellFolder)) /*IShellFolder*/ 1055 { *ppvObj = (IShellFolder*)This; 1056 } 1057 1058 if(*ppvObj) 1059 { 1060 IUnknown_AddRef((IUnknown*)(*ppvObj)); 1061 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); 1062 return S_OK; 1063 } 1064 TRACE("-- Interface: E_NOINTERFACE\n"); 1065 return E_NOINTERFACE; 1066 } 1067 1068 /************************************************************************** 1069 * ISF_Desktop_fnParseDisplayName 1066 1070 * 1067 1071 * NOTES 1068 * 1069 * 1072 * "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" and "" binds 1073 * to MyComputer 1070 1074 */ 1071 1075 static HRESULT WINAPI ISF_Desktop_fnParseDisplayName( 1072 1073 1074 1075 1076 1077 1078 1079 { 1080 1081 1082 LPCWSTRszNext=NULL;1083 LPITEMIDLISTpidlTemp=NULL;1084 HRESULThr=E_OUTOFMEMORY;1085 1086 1087 1088 1089 1090 1091 if (pchEaten) *pchEaten = 0;/* strange but like the original */1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 return hr; 1111 } 1112 1113 /************************************************************************** 1114 * 1076 IShellFolder * iface, 1077 HWND hwndOwner, 1078 LPBC pbcReserved, 1079 LPOLESTR lpszDisplayName, 1080 DWORD *pchEaten, 1081 LPITEMIDLIST *ppidl, 1082 DWORD *pdwAttributes) 1083 { 1084 ICOM_THIS(IGenericSFImpl, iface); 1085 1086 LPCWSTR szNext=NULL; 1087 LPITEMIDLIST pidlTemp=NULL; 1088 HRESULT hr=E_OUTOFMEMORY; 1089 1090 TRACE("(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n", 1091 This,hwndOwner,pbcReserved,lpszDisplayName, 1092 debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes); 1093 1094 *ppidl = 0; 1095 if (pchEaten) *pchEaten = 0; /* strange but like the original */ 1096 1097 /* fixme no real parsing implemented */ 1098 pidlTemp = _ILCreateMyComputer(); 1099 szNext = lpszDisplayName; 1100 1101 if (szNext && *szNext) 1102 { 1103 hr = SHELL32_ParseNextElement(hwndOwner, (IShellFolder*)This, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes); 1104 } 1105 else 1106 { 1107 hr = S_OK; 1108 } 1109 1110 *ppidl = pidlTemp; 1111 1112 TRACE("(%p)->(-- ret=0x%08lx)\n", This, hr); 1113 1114 return hr; 1115 } 1116 1117 /************************************************************************** 1118 * ISF_Desktop_fnEnumObjects 1115 1119 */ 1116 1120 static HRESULT WINAPI ISF_Desktop_fnEnumObjects( 1117 1118 1119 1120 1121 { 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 return S_OK; 1134 } 1135 1136 /************************************************************************** 1137 * 1121 IShellFolder * iface, 1122 HWND hwndOwner, 1123 DWORD dwFlags, 1124 LPENUMIDLIST* ppEnumIDList) 1125 { 1126 ICOM_THIS(IGenericSFImpl, iface); 1127 1128 TRACE("(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n",This,hwndOwner,dwFlags,ppEnumIDList); 1129 1130 *ppEnumIDList = NULL; 1131 *ppEnumIDList = IEnumIDList_Constructor (NULL, dwFlags, EIDL_DESK); 1132 1133 TRACE("-- (%p)->(new ID List: %p)\n",This,*ppEnumIDList); 1134 1135 if(!*ppEnumIDList) return E_OUTOFMEMORY; 1136 1137 return S_OK; 1138 } 1139 1140 /************************************************************************** 1141 * ISF_Desktop_fnBindToObject 1138 1142 */ 1139 1143 static HRESULT WINAPI ISF_Desktop_fnBindToObject( IShellFolder * iface, LPCITEMIDLIST pidl, 1140 1141 { 1142 1143 GUIDconst * clsid;1144 charxriid[50];1145 IShellFolder*pShellFolder, *pSubFolder;1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 if (_ILIsPidlSimple(pidl))/* no sub folders */1177 1178 1179 1180 else/* go deeper */1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 } 1191 1192 /************************************************************************** 1193 * 1144 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut) 1145 { 1146 ICOM_THIS(IGenericSFImpl, iface); 1147 GUID const * clsid; 1148 char xriid[50]; 1149 IShellFolder *pShellFolder, *pSubFolder; 1150 1151 WINE_StringFromCLSID(riid,xriid); 1152 1153 TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n",This,pidl,pbcReserved,xriid,ppvOut); 1154 1155 *ppvOut = NULL; 1156 1157 if ((clsid=_ILGetGUIDPointer(pidl))) 1158 { 1159 if ( IsEqualIID(clsid, &IID_MyComputer)) 1160 { 1161 pShellFolder = ISF_MyComputer_Constructor(); 1162 } 1163 else 1164 { 1165 /* shell extension */ 1166 if (!SUCCEEDED(SHELL32_CoCreateInitSF (This->absPidl, pidl, clsid, riid, (LPVOID*)&pShellFolder))) 1167 { 1168 return E_INVALIDARG; 1169 } 1170 } 1171 } 1172 else 1173 { 1174 /* file system folder on the desktop */ 1175 LPITEMIDLIST pidltemp = ILCloneFirst(pidl); 1176 pShellFolder = IShellFolder_Constructor((IShellFolder*)This, pidltemp); 1177 ILFree(pidltemp); 1178 } 1179 1180 if (_ILIsPidlSimple(pidl)) /* no sub folders */ 1181 { 1182 *ppvOut = pShellFolder; 1183 } 1184 else /* go deeper */ 1185 { 1186 IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, riid, (LPVOID*)&pSubFolder); 1187 IShellFolder_Release(pShellFolder); 1188 *ppvOut = pSubFolder; 1189 } 1190 1191 TRACE("-- (%p) returning (%p)\n",This, *ppvOut); 1192 1193 return S_OK; 1194 } 1195 1196 /************************************************************************** 1197 * ISF_Desktop_fnCreateViewObject 1194 1198 */ 1195 1199 static HRESULT WINAPI ISF_Desktop_fnCreateViewObject( IShellFolder * iface, 1196 1197 { 1198 1199 1200 LPSHELLVIEWpShellView;1201 charxriid[50];1202 HRESULThr = E_INVALIDARG;1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1200 HWND hwndOwner, REFIID riid, LPVOID *ppvOut) 1201 { 1202 ICOM_THIS(IGenericSFImpl, iface); 1203 1204 LPSHELLVIEW pShellView; 1205 char xriid[50]; 1206 HRESULT hr = E_INVALIDARG; 1207 1208 WINE_StringFromCLSID(riid,xriid); 1209 TRACE("(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",This,hwndOwner,xriid,ppvOut); 1210 1211 if(ppvOut) 1212 { 1213 *ppvOut = NULL; 1214 1215 if(IsEqualIID(riid, &IID_IDropTarget)) 1216 { 1217 FIXME("IDropTarget not implemented\n"); 1218 hr = E_NOTIMPL; 1219 } 1220 else if(IsEqualIID(riid, &IID_IContextMenu)) 1221 { 1222 FIXME("IContextMenu not implemented\n"); 1223 hr = E_NOTIMPL; 1224 } 1225 else if(IsEqualIID(riid, &IID_IShellView)) 1226 { 1227 pShellView = IShellView_Constructor((IShellFolder *) This); 1228 if(pShellView) 1229 { 1230 hr = IShellView_QueryInterface(pShellView, riid, ppvOut); 1231 IShellView_Release(pShellView); 1232 } 1233 } 1234 } 1235 TRACE("-- (%p)->(interface=%p)\n",This, ppvOut); 1236 return hr; 1233 1237 } 1234 1238 … … 1238 1242 static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf(IShellFolder * iface,UINT cidl,LPCITEMIDLIST *apidl,DWORD *rgfInOut) 1239 1243 { 1240 1241 1242 GUIDconst * clsid;1243 DWORDattributes;1244 HRESULThr = S_OK;1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 next: 1285 1286 1287 1288 1289 1290 1291 } 1292 1293 /************************************************************************** 1294 * 1244 ICOM_THIS(IGenericSFImpl, iface); 1245 1246 GUID const * clsid; 1247 DWORD attributes; 1248 HRESULT hr = S_OK; 1249 1250 TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",This,cidl,apidl, *rgfInOut); 1251 1252 if ( (!cidl) || (!apidl) || (!rgfInOut)) 1253 return E_INVALIDARG; 1254 1255 while (cidl > 0 && *apidl) 1256 { 1257 pdump (*apidl); 1258 1259 if ((clsid=_ILGetGUIDPointer(*apidl))) 1260 { 1261 if (IsEqualIID(clsid, &IID_MyComputer)) 1262 { 1263 *rgfInOut &= 0xb0000154; 1264 goto next; 1265 } 1266 else if (HCR_GetFolderAttributes(clsid, &attributes)) 1267 { 1268 *rgfInOut &= attributes; 1269 goto next; 1270 } 1271 else 1272 { /* some shell-extension */ 1273 *rgfInOut &= 0xb0000154; 1274 } 1275 } 1276 else if (_ILIsFolder( *apidl)) 1277 { 1278 *rgfInOut &= 0xe0000177; 1279 goto next; 1280 } 1281 else if (_ILIsValue( *apidl)) 1282 { 1283 *rgfInOut &= 0x40000177; 1284 goto next; 1285 } 1286 hr = E_INVALIDARG; 1287 1288 next: apidl++; 1289 cidl--; 1290 } 1291 1292 TRACE("-- result=0x%08lx\n",*rgfInOut); 1293 1294 return hr; 1295 } 1296 1297 /************************************************************************** 1298 * ISF_Desktop_fnGetDisplayNameOf 1295 1299 * 1296 1300 * NOTES 1297 * 1301 * special case: pidl = null gives desktop-name back 1298 1302 */ 1299 1303 static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf( 1300 1301 1302 1303 1304 { 1305 1306 1307 CHARszPath[MAX_PATH]= "";1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1304 IShellFolder * iface, 1305 LPCITEMIDLIST pidl, 1306 DWORD dwFlags, 1307 LPSTRRET strRet) 1308 { 1309 ICOM_THIS(IGenericSFImpl, iface); 1310 1311 CHAR szPath[MAX_PATH]= ""; 1312 1313 TRACE("(%p)->(pidl=%p,0x%08lx,%p)\n",This,pidl,dwFlags,strRet); 1314 pdump(pidl); 1315 1316 if(!strRet) return E_INVALIDARG; 1317 1318 if(!pidl) 1319 { 1320 HCR_GetClassName(&CLSID_ShellDesktop, szPath, MAX_PATH); 1321 } 1322 else if ( _ILIsPidlSimple(pidl) ) 1323 { 1324 _ILSimpleGetText(pidl, szPath, MAX_PATH); 1325 } 1326 else 1327 { 1328 if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild((IShellFolder*)This, pidl, dwFlags, szPath, MAX_PATH))) 1329 return E_OUTOFMEMORY; 1330 } 1331 strRet->uType = STRRET_CSTRA; 1332 lstrcpynA(strRet->u.cStr, szPath, MAX_PATH); 1333 1334 1335 TRACE("-- (%p)->(%s)\n", This, szPath); 1336 return S_OK; 1333 1337 } 1334 1338 1335 1339 ICOM_VTABLE(IShellFolder) sfdvt = 1336 { 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1340 { 1341 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 1342 ISF_Desktop_fnQueryInterface, 1343 IShellFolder_fnAddRef, 1344 IShellFolder_fnRelease, 1345 ISF_Desktop_fnParseDisplayName, 1346 ISF_Desktop_fnEnumObjects, 1347 ISF_Desktop_fnBindToObject, 1348 IShellFolder_fnBindToStorage, 1349 IShellFolder_fnCompareIDs, 1350 ISF_Desktop_fnCreateViewObject, 1351 ISF_Desktop_fnGetAttributesOf, 1352 IShellFolder_fnGetUIObjectOf, 1353 ISF_Desktop_fnGetDisplayNameOf, 1354 IShellFolder_fnSetNameOf, 1355 IShellFolder_fnGetFolderPath 1352 1356 }; 1353 1357 … … 1360 1364 1361 1365 /************************************************************************** 1362 * 1366 * ISF_MyComputer_Constructor 1363 1367 */ 1364 1368 static IShellFolder * ISF_MyComputer_Constructor(void) 1365 1369 { 1366 IGenericSFImpl *sf;1367 1368 1369 1370 1371 1372 1373 1374 sf->absPidl=_ILCreateMyComputer();/* my qualified pidl */1375 1376 1377 1378 1379 1380 } 1381 1382 /************************************************************************** 1383 * 1370 IGenericSFImpl * sf; 1371 1372 sf=(IGenericSFImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGenericSFImpl)); 1373 sf->ref=1; 1374 1375 sf->lpvtbl = &sfmcvt; 1376 sf->lpvtblPersistFolder = &psfvt; 1377 sf->pclsid = (CLSID*)&CLSID_SFMyComp; 1378 sf->absPidl=_ILCreateMyComputer(); /* my qualified pidl */ 1379 1380 TRACE("(%p)\n",sf); 1381 1382 shell32_ObjCount++; 1383 return (IShellFolder *)sf; 1384 } 1385 1386 /************************************************************************** 1387 * ISF_MyComputer_fnParseDisplayName 1384 1388 */ 1385 1389 static HRESULT WINAPI ISF_MyComputer_fnParseDisplayName( 1386 1387 1388 1389 1390 1391 1392 1393 { 1394 1395 1396 HRESULThr = E_OUTOFMEMORY;1397 LPCWSTRszNext=NULL;1398 WCHARszElement[MAX_PATH];1399 CHARszTempA[MAX_PATH];1400 LPITEMIDLISTpidlTemp;1401 1402 1403 1404 1405 1406 1407 if (pchEaten) *pchEaten = 0;/* strange but like the original */1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 return hr; 1429 } 1430 1431 /************************************************************************** 1432 * 1390 IShellFolder * iface, 1391 HWND hwndOwner, 1392 LPBC pbcReserved, 1393 LPOLESTR lpszDisplayName, 1394 DWORD *pchEaten, 1395 LPITEMIDLIST *ppidl, 1396 DWORD *pdwAttributes) 1397 { 1398 ICOM_THIS(IGenericSFImpl, iface); 1399 1400 HRESULT hr = E_OUTOFMEMORY; 1401 LPCWSTR szNext=NULL; 1402 WCHAR szElement[MAX_PATH]; 1403 CHAR szTempA[MAX_PATH]; 1404 LPITEMIDLIST pidlTemp; 1405 1406 TRACE("(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n", 1407 This,hwndOwner,pbcReserved,lpszDisplayName, 1408 debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes); 1409 1410 *ppidl = 0; 1411 if (pchEaten) *pchEaten = 0; /* strange but like the original */ 1412 1413 if (PathIsRootW(lpszDisplayName)) 1414 { 1415 szNext = GetNextElementW(lpszDisplayName, szElement, MAX_PATH); 1416 WideCharToLocal(szTempA, szElement, lstrlenW(szElement) + 1); 1417 pidlTemp = _ILCreateDrive(szTempA); 1418 1419 if (szNext && *szNext) 1420 { 1421 hr = SHELL32_ParseNextElement(hwndOwner, (IShellFolder*)This, &pidlTemp, (LPOLESTR)szNext, pchEaten, pdwAttributes); 1422 } 1423 else 1424 { 1425 hr = S_OK; 1426 } 1427 *ppidl = pidlTemp; 1428 } 1429 1430 TRACE("(%p)->(-- ret=0x%08lx)\n", This, hr); 1431 1432 return hr; 1433 } 1434 1435 /************************************************************************** 1436 * ISF_MyComputer_fnEnumObjects 1433 1437 */ 1434 1438 static HRESULT WINAPI ISF_MyComputer_fnEnumObjects( 1435 1436 1437 1438 1439 { 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 return S_OK; 1452 } 1453 1454 /************************************************************************** 1455 * 1439 IShellFolder * iface, 1440 HWND hwndOwner, 1441 DWORD dwFlags, 1442 LPENUMIDLIST* ppEnumIDList) 1443 { 1444 ICOM_THIS(IGenericSFImpl, iface); 1445 1446 TRACE("(%p)->(HWND=0x%08x flags=0x%08lx pplist=%p)\n",This,hwndOwner,dwFlags,ppEnumIDList); 1447 1448 *ppEnumIDList = NULL; 1449 *ppEnumIDList = IEnumIDList_Constructor (NULL, dwFlags, EIDL_MYCOMP); 1450 1451 TRACE("-- (%p)->(new ID List: %p)\n",This,*ppEnumIDList); 1452 1453 if(!*ppEnumIDList) return E_OUTOFMEMORY; 1454 1455 return S_OK; 1456 } 1457 1458 /************************************************************************** 1459 * ISF_MyComputer_fnBindToObject 1456 1460 */ 1457 1461 static HRESULT WINAPI ISF_MyComputer_fnBindToObject( IShellFolder * iface, LPCITEMIDLIST pidl, 1458 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut) 1459 { 1460 ICOM_THIS(IGenericSFImpl, iface); 1461 GUID const * clsid; 1462 char xriid[50]; 1463 IShellFolder *pShellFolder, *pSubFolder; 1464 LPITEMIDLIST pidltemp; 1465 1466 WINE_StringFromCLSID(riid,xriid); 1467 1468 TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n",This,pidl,pbcReserved,xriid,ppvOut); 1469 1470 *ppvOut = NULL; 1471 1472 if ((clsid=_ILGetGUIDPointer(pidl)) && !IsEqualIID(clsid, &IID_MyComputer)) 1473 { 1474 if (!SUCCEEDED(SHELL32_CoCreateInitSF (This->absPidl, pidl, clsid, riid, (LPVOID*)&pShellFolder))) 1475 { 1476 return E_FAIL; 1477 } 1478 } 1479 else 1480 { 1481 if (!_ILIsDrive(pidl)) return E_INVALIDARG; 1482 1483 pidltemp = ILCloneFirst(pidl); 1484 pShellFolder = IShellFolder_Constructor((IShellFolder*)This, pidltemp); 1485 ILFree(pidltemp); 1486 } 1487 1488 if (_ILIsPidlSimple(pidl)) /* no sub folders */ 1489 { 1490 *ppvOut = pShellFolder; 1491 } 1492 else /* go deeper */ 1493 { 1494 IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, &IID_IShellFolder, (LPVOID*)&pSubFolder); 1495 IShellFolder_Release(pShellFolder); 1496 *ppvOut = pSubFolder; 1497 } 1498 1499 TRACE("-- (%p) returning (%p)\n",This, *ppvOut); 1500 1501 return S_OK; 1502 } 1503 1504 /************************************************************************** 1505 * ISF_MyComputer_fnCreateViewObject 1462 LPBC pbcReserved, REFIID riid, LPVOID * ppvOut) 1463 { 1464 ICOM_THIS(IGenericSFImpl, iface); 1465 GUID const * clsid; 1466 char xriid[50]; 1467 IShellFolder *pShellFolder, *pSubFolder; 1468 LPITEMIDLIST pidltemp; 1469 1470 WINE_StringFromCLSID(riid,xriid); 1471 1472 TRACE("(%p)->(pidl=%p,%p,\n\tIID:\t%s,%p)\n",This,pidl,pbcReserved,xriid,ppvOut); 1473 1474 if(!pidl || !ppvOut) return E_INVALIDARG; 1475 1476 *ppvOut = NULL; 1477 1478 if ((clsid=_ILGetGUIDPointer(pidl)) && !IsEqualIID(clsid, &IID_MyComputer)) 1479 { 1480 if (!SUCCEEDED(SHELL32_CoCreateInitSF (This->absPidl, pidl, clsid, riid, (LPVOID*)&pShellFolder))) 1481 { 1482 return E_FAIL; 1483 } 1484 } 1485 else 1486 { 1487 if (!_ILIsDrive(pidl)) return E_INVALIDARG; 1488 1489 pidltemp = ILCloneFirst(pidl); 1490 pShellFolder = IShellFolder_Constructor((IShellFolder*)This, pidltemp); 1491 ILFree(pidltemp); 1492 } 1493 1494 if (_ILIsPidlSimple(pidl)) /* no sub folders */ 1495 { 1496 *ppvOut = pShellFolder; 1497 } 1498 else /* go deeper */ 1499 { 1500 IShellFolder_BindToObject(pShellFolder, ILGetNext(pidl), NULL, &IID_IShellFolder, (LPVOID*)&pSubFolder); 1501 IShellFolder_Release(pShellFolder); 1502 *ppvOut = pSubFolder; 1503 } 1504 1505 TRACE("-- (%p) returning (%p)\n",This, *ppvOut); 1506 1507 return S_OK; 1508 } 1509 1510 /************************************************************************** 1511 * ISF_MyComputer_fnCreateViewObject 1506 1512 */ 1507 1513 static HRESULT WINAPI ISF_MyComputer_fnCreateViewObject( IShellFolder * iface, 1508 1509 { 1510 1511 1512 LPSHELLVIEWpShellView;1513 charxriid[50];1514 HRESULThr = E_INVALIDARG;1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1514 HWND hwndOwner, REFIID riid, LPVOID *ppvOut) 1515 { 1516 ICOM_THIS(IGenericSFImpl, iface); 1517 1518 LPSHELLVIEW pShellView; 1519 char xriid[50]; 1520 HRESULT hr = E_INVALIDARG; 1521 1522 WINE_StringFromCLSID(riid,xriid); 1523 TRACE("(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",This,hwndOwner,xriid,ppvOut); 1524 1525 if(ppvOut) 1526 { 1527 *ppvOut = NULL; 1528 1529 if(IsEqualIID(riid, &IID_IDropTarget)) 1530 { 1531 FIXME("IDropTarget not implemented\n"); 1532 hr = E_NOTIMPL; 1533 } 1534 else if(IsEqualIID(riid, &IID_IContextMenu)) 1535 { 1536 FIXME("IContextMenu not implemented\n"); 1537 hr = E_NOTIMPL; 1538 } 1539 else if(IsEqualIID(riid, &IID_IShellView)) 1540 { 1541 pShellView = IShellView_Constructor((IShellFolder *) This); 1542 if(pShellView) 1543 { 1544 hr = IShellView_QueryInterface(pShellView, riid, ppvOut); 1545 IShellView_Release(pShellView); 1546 } 1547 } 1548 } 1549 TRACE("-- (%p)->(interface=%p)\n",This, ppvOut); 1550 return hr; 1545 1551 } 1546 1552 … … 1550 1556 static HRESULT WINAPI ISF_MyComputer_fnGetAttributesOf(IShellFolder * iface,UINT cidl,LPCITEMIDLIST *apidl,DWORD *rgfInOut) 1551 1557 { 1552 1553 1554 GUIDconst * clsid;1555 DWORDattributes;1556 HRESULThr = S_OK;1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 next: 1585 1586 1587 1588 1589 1590 } 1591 1592 /************************************************************************** 1593 * 1558 ICOM_THIS(IGenericSFImpl, iface); 1559 1560 GUID const * clsid; 1561 DWORD attributes; 1562 HRESULT hr = S_OK; 1563 1564 TRACE("(%p)->(cidl=%d apidl=%p mask=0x%08lx)\n",This,cidl,apidl,*rgfInOut); 1565 1566 if ( (!cidl) || (!apidl) || (!rgfInOut)) 1567 return E_INVALIDARG; 1568 1569 *rgfInOut = 0xffffffff; 1570 1571 while (cidl > 0 && *apidl) 1572 { 1573 pdump (*apidl); 1574 1575 if (_ILIsDrive(*apidl)) 1576 { 1577 *rgfInOut &= 0xf0000144; 1578 goto next; 1579 } 1580 else if ((clsid=_ILGetGUIDPointer(*apidl))) 1581 { 1582 if (HCR_GetFolderAttributes(clsid, &attributes)) 1583 { 1584 *rgfInOut &= attributes; 1585 goto next; 1586 } 1587 } 1588 hr = E_INVALIDARG; 1589 1590 next: apidl++; 1591 cidl--; 1592 } 1593 1594 TRACE("-- result=0x%08lx\n",*rgfInOut); 1595 return hr; 1596 } 1597 1598 /************************************************************************** 1599 * ISF_MyComputer_fnGetDisplayNameOf 1594 1600 * 1595 1601 * NOTES 1596 * 1597 * 1602 * The desktopfolder creates only complete paths (SHGDN_FORPARSING). 1603 * SHGDN_INFOLDER makes no sense. 1598 1604 */ 1599 1605 static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf( 1600 1601 1602 1603 1604 { 1605 1606 1607 charszPath[MAX_PATH], szDrive[18];1608 intlen = 0;1609 BOOLbSimplePidl;1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 _ILSimpleGetText(pidl, szPath, MAX_PATH);/* append my own path */1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 if (!bSimplePidl)/* go deeper if needed */1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1606 IShellFolder * iface, 1607 LPCITEMIDLIST pidl, 1608 DWORD dwFlags, 1609 LPSTRRET strRet) 1610 { 1611 ICOM_THIS(IGenericSFImpl, iface); 1612 1613 char szPath[MAX_PATH], szDrive[18]; 1614 int len = 0; 1615 BOOL bSimplePidl; 1616 1617 TRACE("(%p)->(pidl=%p,0x%08lx,%p)\n",This,pidl,dwFlags,strRet); 1618 pdump(pidl); 1619 1620 if(!strRet) return E_INVALIDARG; 1621 1622 szPath[0]=0x00; szDrive[0]=0x00; 1623 1624 1625 bSimplePidl = _ILIsPidlSimple(pidl); 1626 1627 if (_ILIsSpecialFolder(pidl)) 1628 { 1629 /* take names of special folders only if its only this folder */ 1630 if ( bSimplePidl ) 1631 { 1632 _ILSimpleGetText(pidl, szPath, MAX_PATH); /* append my own path */ 1633 } 1634 } 1635 else 1636 { 1637 if (!_ILIsDrive(pidl)) 1638 { 1639 ERR("Wrong pidl type\n"); 1640 return E_INVALIDARG; 1641 } 1642 1643 _ILSimpleGetText(pidl, szPath, MAX_PATH); /* append my own path */ 1644 1645 /* long view "lw_name (C:)" */ 1646 if ( bSimplePidl && !(dwFlags & SHGDN_FORPARSING)) 1647 { 1648 DWORD dwVolumeSerialNumber,dwMaximumComponetLength,dwFileSystemFlags; 1649 1650 GetVolumeInformationA(szPath,szDrive,12,&dwVolumeSerialNumber,&dwMaximumComponetLength,&dwFileSystemFlags,NULL,0); 1651 strcat (szDrive," ("); 1652 strncat (szDrive, szPath, 2); 1653 strcat (szDrive,")"); 1654 strcpy (szPath, szDrive); 1655 } 1656 } 1657 1658 if (!bSimplePidl) /* go deeper if needed */ 1659 { 1660 PathAddBackslashA(szPath); 1661 len = strlen(szPath); 1662 1663 if (!SUCCEEDED(SHELL32_GetDisplayNameOfChild((IShellFolder*)This, pidl, dwFlags | SHGDN_FORPARSING, szPath + len, MAX_PATH - len))) 1664 return E_OUTOFMEMORY; 1665 } 1666 strRet->uType = STRRET_CSTRA; 1667 lstrcpynA(strRet->u.cStr, szPath, MAX_PATH); 1668 1669 1670 TRACE("-- (%p)->(%s)\n", This, szPath); 1671 return S_OK; 1666 1672 } 1667 1673 1668 1674 ICOM_VTABLE(IShellFolder) sfmcvt = 1669 { 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1675 { 1676 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 1677 IShellFolder_fnQueryInterface, 1678 IShellFolder_fnAddRef, 1679 IShellFolder_fnRelease, 1680 ISF_MyComputer_fnParseDisplayName, 1681 ISF_MyComputer_fnEnumObjects, 1682 ISF_MyComputer_fnBindToObject, 1683 IShellFolder_fnBindToStorage, 1684 IShellFolder_fnCompareIDs, 1685 ISF_MyComputer_fnCreateViewObject, 1686 ISF_MyComputer_fnGetAttributesOf, 1687 IShellFolder_fnGetUIObjectOf, 1688 ISF_MyComputer_fnGetDisplayNameOf, 1689 IShellFolder_fnSetNameOf, 1690 IShellFolder_fnGetFolderPath 1685 1691 }; 1686 1692 … … 1691 1697 */ 1692 1698 static HRESULT WINAPI ISFPersistFolder_QueryInterface( 1693 IPersistFolder *iface,1694 REFIIDiid,1695 LPVOID*ppvObj)1696 { 1697 1698 1699 1700 1701 1699 IPersistFolder * iface, 1700 REFIID iid, 1701 LPVOID* ppvObj) 1702 { 1703 _ICOM_THIS_From_IPersistFolder(IGenericSFImpl, iface); 1704 1705 TRACE("(%p)\n", This); 1706 1707 return IShellFolder_QueryInterface((IShellFolder*)This, iid, ppvObj); 1702 1708 } 1703 1709 … … 1707 1713 */ 1708 1714 static ULONG WINAPI ISFPersistFolder_AddRef( 1709 IPersistFolder *iface)1710 { 1711 1712 1713 1714 1715 1715 IPersistFolder * iface) 1716 { 1717 _ICOM_THIS_From_IPersistFolder(IShellFolder, iface); 1718 1719 TRACE("(%p)\n", This); 1720 1721 return IShellFolder_AddRef((IShellFolder*)This); 1716 1722 } 1717 1723 … … 1721 1727 */ 1722 1728 static ULONG WINAPI ISFPersistFolder_Release( 1723 IPersistFolder *iface)1724 { 1725 1726 1727 1728 1729 1729 IPersistFolder * iface) 1730 { 1731 _ICOM_THIS_From_IPersistFolder(IGenericSFImpl, iface); 1732 1733 TRACE("(%p)\n", This); 1734 1735 return IShellFolder_Release((IShellFolder*)This); 1730 1736 } 1731 1737 … … 1734 1740 */ 1735 1741 static HRESULT WINAPI ISFPersistFolder_GetClassID( 1736 IPersistFolder *iface,1737 CLSID *lpClassId)1738 { 1739 1740 1741 1742 1743 1744 1745 1746 1742 IPersistFolder * iface, 1743 CLSID * lpClassId) 1744 { 1745 _ICOM_THIS_From_IPersistFolder(IGenericSFImpl, iface); 1746 1747 TRACE("(%p)\n", This); 1748 1749 if (!lpClassId) return E_POINTER; 1750 *lpClassId = *This->pclsid; 1751 1752 return S_OK; 1747 1753 } 1748 1754 … … 1754 1760 */ 1755 1761 static HRESULT WINAPI ISFPersistFolder_Initialize( 1756 IPersistFolder *iface,1757 LPCITEMIDLISTpidl)1758 { 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1762 IPersistFolder * iface, 1763 LPCITEMIDLIST pidl) 1764 { 1765 _ICOM_THIS_From_IPersistFolder(IGenericSFImpl, iface); 1766 1767 TRACE("(%p)\n", This); 1768 1769 if(This->absPidl) 1770 { 1771 SHFree(This->absPidl); 1772 This->absPidl = NULL; 1773 } 1774 This->absPidl = ILClone(pidl); 1775 return S_OK; 1770 1776 } 1771 1777 1772 1778 ICOM_VTABLE(IPersistFolder) psfvt = 1773 1779 { 1774 1775 1776 1777 1778 1779 1780 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 1781 ISFPersistFolder_QueryInterface, 1782 ISFPersistFolder_AddRef, 1783 ISFPersistFolder_Release, 1784 ISFPersistFolder_GetClassID, 1785 ISFPersistFolder_Initialize 1780 1786 }; 1781 1787 … … 1784 1790 */ 1785 1791 static BOOL ISFDropTarget_QueryDrop( 1786 1787 1788 1789 { 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1792 IDropTarget *iface, 1793 DWORD dwKeyState, 1794 LPDWORD pdwEffect) 1795 { 1796 DWORD dwEffect = *pdwEffect; 1797 1798 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 1799 1800 *pdwEffect = DROPEFFECT_NONE; 1801 1802 if (This->fAcceptFmt) 1803 { /* Does our interpretation of the keystate ... */ 1804 *pdwEffect = KeyStateToDropEffect(dwKeyState); 1805 1806 /* ... matches the desired effect ? */ 1807 if (dwEffect & *pdwEffect) 1808 { 1809 return TRUE; 1810 } 1811 } 1812 return FALSE; 1807 1813 } 1808 1814 1809 1815 static HRESULT WINAPI ISFDropTarget_QueryInterface( 1810 1811 1812 1813 { 1814 1815 1816 1817 1818 1816 IDropTarget *iface, 1817 REFIID riid, 1818 LPVOID *ppvObj) 1819 { 1820 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 1821 1822 TRACE("(%p)\n", This); 1823 1824 return IShellFolder_QueryInterface((IShellFolder*)This, riid, ppvObj); 1819 1825 } 1820 1826 1821 1827 static ULONG WINAPI ISFDropTarget_AddRef( IDropTarget *iface) 1822 1828 { 1823 1824 1825 1826 1827 1829 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 1830 1831 TRACE("(%p)\n", This); 1832 1833 return IShellFolder_AddRef((IShellFolder*)This); 1828 1834 } 1829 1835 1830 1836 static ULONG WINAPI ISFDropTarget_Release( IDropTarget *iface) 1831 1837 { 1832 1833 1834 1835 1836 1838 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 1839 1840 TRACE("(%p)\n", This); 1841 1842 return IShellFolder_Release((IShellFolder*)This); 1837 1843 } 1838 1844 1839 1845 static HRESULT WINAPI ISFDropTarget_DragEnter( 1840 IDropTarget*iface,1841 IDataObject*pDataObject,1842 DWORDdwKeyState,1843 POINTLpt,1844 DWORD*pdwEffect)1845 { 1846 FORMATETCfmt;1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1846 IDropTarget *iface, 1847 IDataObject *pDataObject, 1848 DWORD dwKeyState, 1849 POINTL pt, 1850 DWORD *pdwEffect) 1851 { 1852 FORMATETC fmt; 1853 1854 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 1855 1856 TRACE("(%p)->(DataObject=%p)\n",This,pDataObject); 1857 1858 InitFormatEtc(fmt, This->cfShellIDList, TYMED_HGLOBAL); 1859 1860 This->fAcceptFmt = (S_OK == IDataObject_QueryGetData(pDataObject, &fmt)) ? TRUE : FALSE; 1861 1862 ISFDropTarget_QueryDrop(iface, dwKeyState, pdwEffect); 1863 1864 return S_OK; 1859 1865 } 1860 1866 1861 1867 static HRESULT WINAPI ISFDropTarget_DragOver( 1862 IDropTarget*iface,1863 DWORDdwKeyState,1864 POINTLpt,1865 DWORD*pdwEffect)1866 { 1867 1868 1869 1870 1871 1872 1873 1874 1875 1868 IDropTarget *iface, 1869 DWORD dwKeyState, 1870 POINTL pt, 1871 DWORD *pdwEffect) 1872 { 1873 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 1874 1875 TRACE("(%p)\n",This); 1876 1877 if(!pdwEffect) return E_INVALIDARG; 1878 1879 ISFDropTarget_QueryDrop(iface, dwKeyState, pdwEffect); 1880 1881 return S_OK; 1876 1882 } 1877 1883 1878 1884 static HRESULT WINAPI ISFDropTarget_DragLeave( 1879 IDropTarget*iface)1880 { 1881 1882 1883 1884 1885 1886 1887 1885 IDropTarget *iface) 1886 { 1887 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 1888 1889 TRACE("(%p)\n",This); 1890 1891 This->fAcceptFmt = FALSE; 1892 1893 return S_OK; 1888 1894 } 1889 1895 1890 1896 static HRESULT WINAPI ISFDropTarget_Drop( 1891 IDropTarget*iface,1892 IDataObject*pDataObject,1893 DWORDdwKeyState,1894 POINTLpt,1895 DWORD*pdwEffect)1896 { 1897 1898 1899 1900 1901 1897 IDropTarget *iface, 1898 IDataObject* pDataObject, 1899 DWORD dwKeyState, 1900 POINTL pt, 1901 DWORD *pdwEffect) 1902 { 1903 _ICOM_THIS_From_IDropTarget(IGenericSFImpl,iface); 1904 1905 FIXME("(%p) object dropped\n",This); 1906 1907 return E_NOTIMPL; 1902 1908 } 1903 1909 1904 1910 struct ICOM_VTABLE(IDropTarget) dt2vt = 1905 1911 { 1906 1907 1908 1909 1910 1911 1912 1913 1912 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 1913 ISFDropTarget_QueryInterface, 1914 ISFDropTarget_AddRef, 1915 ISFDropTarget_Release, 1916 ISFDropTarget_DragEnter, 1917 ISFDropTarget_DragOver, 1918 ISFDropTarget_DragLeave, 1919 ISFDropTarget_Drop 1914 1920 }; 1915 1921 -
trunk/src/shell32/shlmenu.cpp
r1470 r1558 1 /* $Id: shlmenu.cpp,v 1. 3 1999-10-27 09:33:48phaller Exp $ */1 /* $Id: shlmenu.cpp,v 1.4 1999-11-02 20:38:47 phaller Exp $ */ 2 2 3 3 /* … … 60 60 61 61 typedef struct 62 { BOOL bInitialized; 63 BOOL bIsMagic; 62 { 63 BOOL bInitialized; 64 BOOL bFixedItems; 64 65 65 66 /* create */ … … 165 166 return 0; 166 167 168 pidl = ((pAlternatePidl) ? pAlternatePidl : menudata->pidl); 169 if (!pidl) 170 return 0; 171 167 172 uID = menudata->uID; 168 pidl = ((pAlternatePidl) ? pAlternatePidl : menudata->pidl);169 173 uFlags = menudata->uFlags; 170 174 uEnumFlags = menudata->uEnumFlags; … … 264 268 265 269 menudata = (LPFMINFO)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMINFO)); 266 menudata->bIsMagic = TRUE;267 270 menudata->crBorderColor = crBorderColor; 268 271 menudata->nBorderWidth = nBorderWidth; … … 317 320 MENUITEMINFOA mii; 318 321 LPFMITEM myItem; 322 LPFMINFO menudata; 323 MENUINFO MenuInfo; 319 324 320 325 TRACE("0x%08x %s 0x%08x 0x%08x 0x%08x 0x%08x\n", … … 357 362 InsertMenuItemA (hMenu, (UINT)-1, TRUE, &mii); 358 363 364 /* set bFixedItems to true */ 365 MenuInfo.cbSize = sizeof(MENUINFO); 366 MenuInfo.fMask = MIM_MENUDATA; 367 368 if (! GetMenuInfo(hMenu, &MenuInfo)) 369 return FALSE; 370 371 menudata = (LPFMINFO)MenuInfo.dwMenuData; 372 assert ((menudata != 0) && (MenuInfo.cbSize == sizeof(MENUINFO))); 373 menudata->bFixedItems = TRUE; 374 SetMenuInfo(hMenu, &MenuInfo); 375 359 376 return TRUE; 360 377 … … 549 566 /* add the menubitmap */ 550 567 menuinfo = FM_GetMenuInfo(pMyItem->hMenu); 551 if (menuinfo-> bIsMagic)568 if (menuinfo->nBorderWidth) 552 569 lpmis->itemWidth += menuinfo->nBorderWidth; 553 570 … … 587 604 /* add the menubitmap */ 588 605 menuinfo = FM_GetMenuInfo(pMyItem->hMenu); 589 if (menuinfo-> bIsMagic)606 if (menuinfo->nBorderWidth) 590 607 TextRect.left += menuinfo->nBorderWidth; 591 608 … … 979 996 } 980 997 981 -
trunk/src/shell32/shlview.cpp
r1431 r1558 1 /* $Id: shlview.cpp,v 1. 3 1999-10-24 22:50:46 sandervlExp $ */1 /* $Id: shlview.cpp,v 1.4 1999-11-02 20:38:48 phaller Exp $ */ 2 2 /* 3 * 3 * ShellView 4 4 * 5 * Copyright 1998,1999<juergen.schmied@metronet.de>5 * Copyright 1998,1999 <juergen.schmied@metronet.de> 6 6 * 7 7 * FIXME: when the ShellView_WndProc gets a WM_NCDESTROY should we do a … … 28 28 #include "wine/obj_dragdrop.h" 29 29 #include "wine/undocshell.h" 30 #include "docobj.h"31 30 #include "shresdef.h" 32 31 #include "spy.h" … … 34 33 #include "winerror.h" 35 34 35 #include "docobj.h" 36 36 #include "pidl.h" 37 37 #include "shell32_main.h" … … 41 41 DEFAULT_DEBUG_CHANNEL(shell) 42 42 43 44 43 typedef struct 45 { ICOM_VTABLE(IShellView)* lpvtbl; 46 DWORD ref; 47 ICOM_VTABLE(IOleCommandTarget)* lpvtblOleCommandTarget; 48 ICOM_VTABLE(IDropTarget)* lpvtblDropTarget; 49 ICOM_VTABLE(IDropSource)* lpvtblDropSource; 50 ICOM_VTABLE(IViewObject)* lpvtblViewObject; 51 IShellFolder* pSFParent; 52 IShellBrowser* pShellBrowser; 53 ICommDlgBrowser* pCommDlgBrowser; 54 HWND hWnd; 55 HWND hWndList; 56 HWND hWndParent; 57 FOLDERSETTINGS FolderSettings; 58 HMENU hMenu; 59 UINT uState; 60 UINT cidl; 61 LPITEMIDLIST *apidl; 44 { BOOL bIsAscending; 45 INT nHeaderID; 46 INT nLastHeaderID; 47 }LISTVIEW_SORT_INFO, *LPLISTVIEW_SORT_INFO; 48 49 typedef struct 50 { ICOM_VTABLE(IShellView)* lpvtbl; 51 DWORD ref; 52 ICOM_VTABLE(IOleCommandTarget)* lpvtblOleCommandTarget; 53 ICOM_VTABLE(IDropTarget)* lpvtblDropTarget; 54 ICOM_VTABLE(IDropSource)* lpvtblDropSource; 55 ICOM_VTABLE(IViewObject)* lpvtblViewObject; 56 IShellFolder* pSFParent; 57 IShellBrowser* pShellBrowser; 58 ICommDlgBrowser* pCommDlgBrowser; 59 HWND hWnd; 60 HWND hWndList; 61 HWND hWndParent; 62 FOLDERSETTINGS FolderSettings; 63 HMENU hMenu; 64 UINT uState; 65 UINT cidl; 66 LPITEMIDLIST *apidl; 67 LISTVIEW_SORT_INFO ListViewSortInfo; 62 68 } IShellViewImpl; 63 69 … … 78 84 #define _IViewObject_Offset ((int)(&(((IShellViewImpl*)0)->lpvtblViewObject))) 79 85 #define _ICOM_THIS_From_IViewObject(myClass, name) myClass* This = (myClass*)(((char*)name)-_IViewObject_Offset); 86 87 /* ListView Header ID's */ 88 #define LISTVIEW_COLUMN_NAME 0 89 #define LISTVIEW_COLUMN_SIZE 1 90 #define LISTVIEW_COLUMN_TYPE 2 91 #define LISTVIEW_COLUMN_TIME 3 92 #define LISTVIEW_COLUMN_ATTRIB 4 80 93 81 94 /*menu items */ … … 94 107 #define WM_SETTINGCHANGE WM_WININICHANGE 95 108 extern void WINAPI _InsertMenuItem (HMENU hmenu, UINT indexMenu, BOOL fByPosition, 96 109 UINT wID, UINT fType, LPSTR dwTypeData, UINT fState); 97 110 98 111 /* … … 120 133 121 134 /********************************************************** 122 * 135 * IShellView_Constructor 123 136 */ 124 137 IShellView * IShellView_Constructor( IShellFolder * pFolder) 125 { 126 127 128 129 130 131 132 133 134 sv->pSFParent= pFolder;135 136 137 138 139 140 141 138 { IShellViewImpl * sv; 139 sv=(IShellViewImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IShellViewImpl)); 140 sv->ref=1; 141 sv->lpvtbl=&svvt; 142 sv->lpvtblOleCommandTarget=&ctvt; 143 sv->lpvtblDropTarget=&dtvt; 144 sv->lpvtblDropSource=&dsvt; 145 sv->lpvtblViewObject=&vovt; 146 147 sv->pSFParent = pFolder; 148 149 if(pFolder) 150 IShellFolder_AddRef(pFolder); 151 152 TRACE("(%p)->(%p)\n",sv, pFolder); 153 shell32_ObjCount++; 154 return (IShellView *) sv; 142 155 } 143 156 … … 147 160 */ 148 161 static BOOL IsInCommDlg(IShellViewImpl * This) 149 { 162 { return(This->pCommDlgBrowser != NULL); 150 163 } 151 164 152 165 static HRESULT IncludeObject(IShellViewImpl * This, LPCITEMIDLIST pidl) 153 166 { 154 155 156 157 158 159 160 161 162 167 HRESULT ret = S_OK; 168 169 if ( IsInCommDlg(This) ) 170 { 171 TRACE("ICommDlgBrowser::IncludeObject pidl=%p\n", pidl); 172 ret = ICommDlgBrowser_IncludeObject(This->pCommDlgBrowser, (IShellView*)This, pidl); 173 TRACE("--0x%08lx\n", ret); 174 } 175 return ret; 163 176 } 164 177 165 178 static HRESULT OnDefaultCommand(IShellViewImpl * This) 166 179 { 167 168 169 170 171 172 173 174 175 180 HRESULT ret = S_FALSE; 181 182 if (IsInCommDlg(This)) 183 { 184 TRACE("ICommDlgBrowser::OnDefaultCommand\n"); 185 ret = ICommDlgBrowser_OnDefaultCommand(This->pCommDlgBrowser, (IShellView*)This); 186 TRACE("--\n"); 187 } 188 return ret; 176 189 } 177 190 178 191 static HRESULT OnStateChange(IShellViewImpl * This, UINT uFlags) 179 192 { 180 181 182 183 184 185 186 187 188 193 HRESULT ret = S_FALSE; 194 195 if (IsInCommDlg(This)) 196 { 197 TRACE("ICommDlgBrowser::OnStateChange flags=%x\n", uFlags); 198 ret = ICommDlgBrowser_OnStateChange(This->pCommDlgBrowser, (IShellView*)This, uFlags); 199 TRACE("--\n"); 200 } 201 return ret; 189 202 } 190 203 /********************************************************** … … 193 206 */ 194 207 /********************************************************** 195 * 208 * set the toolbar buttons 196 209 */ 197 210 static void CheckToolbar(IShellViewImpl * This) 198 211 { 199 200 201 202 203 204 205 206 207 208 209 210 211 } 212 213 /********************************************************** 214 * 212 LRESULT result; 213 214 TRACE("\n"); 215 216 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON, 217 FCIDM_TB_SMALLICON, (This->FolderSettings.ViewMode==FVM_LIST)? TRUE : FALSE, &result); 218 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON, 219 FCIDM_TB_REPORTVIEW, (This->FolderSettings.ViewMode==FVM_DETAILS)? TRUE : FALSE, &result); 220 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON, 221 FCIDM_TB_SMALLICON, TRUE, &result); 222 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON, 223 FCIDM_TB_REPORTVIEW, TRUE, &result); 224 } 225 226 /********************************************************** 227 * change the style of the listview control 215 228 */ 216 229 217 230 static void SetStyle(IShellViewImpl * This, DWORD dwAdd, DWORD dwRemove) 218 231 { 219 220 221 222 223 224 232 DWORD tmpstyle; 233 234 TRACE("(%p)\n", This); 235 236 tmpstyle = GetWindowLongA(This->hWndList, GWL_STYLE); 237 SetWindowLongA(This->hWndList, GWL_STYLE, dwAdd | (tmpstyle & ~dwRemove)); 225 238 } 226 239 … … 230 243 */ 231 244 static BOOL ShellView_CreateList (IShellViewImpl * This) 232 { DWORD dwStyle; 233 234 TRACE("%p\n",This); 235 236 dwStyle = WS_TABSTOP | WS_VISIBLE | WS_CHILD | WS_BORDER | WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | 237 LVS_SHAREIMAGELISTS | LVS_EDITLABELS | LVS_ALIGNLEFT | LVS_AUTOARRANGE; 238 239 switch (This->FolderSettings.ViewMode) 240 { 241 case FVM_ICON: dwStyle |= LVS_ICON; break; 242 case FVM_DETAILS: dwStyle |= LVS_REPORT; break; 243 case FVM_SMALLICON: dwStyle |= LVS_SMALLICON; break; 244 case FVM_LIST: dwStyle |= LVS_LIST; break; 245 default: dwStyle |= LVS_LIST; break; 246 } 247 248 if (This->FolderSettings.fFlags && FWF_AUTOARRANGE) dwStyle |= LVS_AUTOARRANGE; 249 /*if (This->FolderSettings.fFlags && FWF_DESKTOP); used from explorer*/ 250 if (This->FolderSettings.fFlags && FWF_SINGLESEL) dwStyle |= LVS_SINGLESEL; 251 252 This->hWndList=CreateWindowExA( WS_EX_CLIENTEDGE, 253 WC_LISTVIEWA, 254 NULL, 255 dwStyle, 256 0,0,0,0, 257 This->hWnd, 258 (HMENU)ID_LISTVIEW, 259 shell32_hInstance, 260 NULL); 261 262 if(!This->hWndList) 263 return FALSE; 264 265 /* UpdateShellSettings(); */ 266 return TRUE; 245 { DWORD dwStyle; 246 247 TRACE("%p\n",This); 248 249 dwStyle = WS_TABSTOP | WS_VISIBLE | WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | 250 LVS_SHAREIMAGELISTS | LVS_EDITLABELS | LVS_ALIGNLEFT | LVS_AUTOARRANGE; 251 252 switch (This->FolderSettings.ViewMode) 253 { 254 case FVM_ICON: dwStyle |= LVS_ICON; break; 255 case FVM_DETAILS: dwStyle |= LVS_REPORT; break; 256 case FVM_SMALLICON: dwStyle |= LVS_SMALLICON; break; 257 case FVM_LIST: dwStyle |= LVS_LIST; break; 258 default: dwStyle |= LVS_LIST; break; 259 } 260 261 if (This->FolderSettings.fFlags && FWF_AUTOARRANGE) dwStyle |= LVS_AUTOARRANGE; 262 /*if (This->FolderSettings.fFlags && FWF_DESKTOP); used from explorer*/ 263 if (This->FolderSettings.fFlags && FWF_SINGLESEL) dwStyle |= LVS_SINGLESEL; 264 265 This->hWndList=CreateWindowExA( WS_EX_CLIENTEDGE, 266 WC_LISTVIEWA, 267 NULL, 268 dwStyle, 269 0,0,0,0, 270 This->hWnd, 271 (HMENU)ID_LISTVIEW, 272 shell32_hInstance, 273 NULL); 274 275 if(!This->hWndList) 276 return FALSE; 277 278 This->ListViewSortInfo.bIsAscending = TRUE; 279 This->ListViewSortInfo.nHeaderID = -1; 280 This->ListViewSortInfo.nLastHeaderID = -1; 281 282 /* UpdateShellSettings(); */ 283 return TRUE; 267 284 } 268 285 /********************************************************** … … 271 288 static BOOL ShellView_InitList(IShellViewImpl * This) 272 289 { 273 274 275 276 277 278 279 280 281 lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;/* | LVCF_SUBITEM;*/282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 290 LVCOLUMNA lvColumn; 291 CHAR szString[50]; 292 293 TRACE("%p\n",This); 294 295 ListView_DeleteAllItems(This->hWndList); 296 297 /*initialize the columns */ 298 lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT; /* | LVCF_SUBITEM;*/ 299 lvColumn.fmt = LVCFMT_LEFT; 300 lvColumn.pszText = szString; 301 302 lvColumn.cx = 120; 303 LoadStringA(shell32_hInstance, IDS_SHV_COLUMN1, szString, sizeof(szString)); 304 ListView_InsertColumnA(This->hWndList, 0, &lvColumn); 305 306 lvColumn.cx = 80; 307 LoadStringA(shell32_hInstance, IDS_SHV_COLUMN2, szString, sizeof(szString)); 308 ListView_InsertColumnA(This->hWndList, 1, &lvColumn); 309 310 lvColumn.cx = 170; 311 LoadStringA(shell32_hInstance, IDS_SHV_COLUMN3, szString, sizeof(szString)); 312 ListView_InsertColumnA(This->hWndList, 2, &lvColumn); 313 314 lvColumn.cx = 60; 315 LoadStringA(shell32_hInstance, IDS_SHV_COLUMN4, szString, sizeof(szString)); 316 ListView_InsertColumnA(This->hWndList, 3, &lvColumn); 317 318 ListView_SetImageList(This->hWndList, ShellSmallIconList, LVSIL_SMALL); 319 ListView_SetImageList(This->hWndList, ShellBigIconList, LVSIL_NORMAL); 320 321 return TRUE; 305 322 } 306 323 /********************************************************** … … 312 329 static INT CALLBACK ShellView_CompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData) 313 330 { 314 int ret; 315 TRACE("pidl1=%p pidl2=%p lpsf=%p\n", lParam1, lParam2, (LPVOID) lpData); 316 317 if(!lpData) return 0; 318 319 ret = (SHORT) SCODE_CODE(IShellFolder_CompareIDs((LPSHELLFOLDER)lpData, 0, (LPITEMIDLIST)lParam1, (LPITEMIDLIST)lParam2)); 320 TRACE("ret=%i\n",ret); 321 return ret; 331 int ret; 332 TRACE("pidl1=%p pidl2=%p lpsf=%p\n", lParam1, lParam2, (LPVOID) lpData); 333 334 if(!lpData) return 0; 335 336 ret = (SHORT) SCODE_CODE(IShellFolder_CompareIDs((LPSHELLFOLDER)lpData, 0, (LPITEMIDLIST)lParam1, (LPITEMIDLIST)lParam2)); 337 TRACE("ret=%i\n",ret); 338 return ret; 339 } 340 341 342 /************************************************************************* 343 * ShellView_ListViewCompareItems 344 * 345 * Compare Function for the Listview (FileOpen Dialog) 346 * 347 * PARAMS 348 * lParam1 [I] the first ItemIdList to compare with 349 * lParam2 [I] the second ItemIdList to compare with 350 * lpData [I] The column ID for the header Ctrl to process 351 * 352 * RETURNS 353 * A negative value if the first item should precede the second, 354 * a positive value if the first item should follow the second, 355 * or zero if the two items are equivalent 356 * 357 * NOTES 358 * 359 */ 360 static INT CALLBACK ShellView_ListViewCompareItems(LPVOID lParam1, LPVOID lParam2, LPARAM lpData) 361 { 362 INT nDiff=0; 363 FILETIME fd1, fd2; 364 char strName1[MAX_PATH], strName2[MAX_PATH]; 365 BOOL bIsFolder1, bIsFolder2,bIsBothFolder; 366 LPITEMIDLIST pItemIdList1 = (LPITEMIDLIST) lParam1; 367 LPITEMIDLIST pItemIdList2 = (LPITEMIDLIST) lParam2; 368 LISTVIEW_SORT_INFO *pSortInfo = (LPLISTVIEW_SORT_INFO) lpData; 369 370 371 bIsFolder1 = _ILIsFolder(pItemIdList1); 372 bIsFolder2 = _ILIsFolder(pItemIdList2); 373 bIsBothFolder = bIsFolder1 && bIsFolder2; 374 375 /* When sorting between a File and a Folder, the Folder gets sorted first */ 376 if( (bIsFolder1 || bIsFolder2) && !bIsBothFolder) 377 { 378 nDiff = bIsFolder1 ? -1 : 1; 379 } 380 else 381 { 382 /* Sort by Time: Folders or Files can be sorted */ 383 384 if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_TIME) 385 { 386 _ILGetFileDateTime(pItemIdList1, &fd1); 387 _ILGetFileDateTime(pItemIdList2, &fd2); 388 nDiff = CompareFileTime(&fd2, &fd1); 389 } 390 /* Sort by Attribute: Folder or Files can be sorted */ 391 else if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_ATTRIB) 392 { 393 _ILGetAttributeStr(pItemIdList1, strName1, MAX_PATH); 394 _ILGetAttributeStr(pItemIdList2, strName2, MAX_PATH); 395 nDiff = strcmp(strName1, strName2); 396 } 397 /* Sort by FileName: Folder or Files can be sorted */ 398 else if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_NAME || bIsBothFolder) 399 { 400 /* Sort by Text */ 401 _ILSimpleGetText(pItemIdList1, strName1, MAX_PATH); 402 _ILSimpleGetText(pItemIdList2, strName2, MAX_PATH); 403 nDiff = strcmp(strName1, strName2); 404 } 405 /* Sort by File Size, Only valid for Files */ 406 else if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_SIZE) 407 { 408 nDiff = (INT)(_ILGetFileSize(pItemIdList1, NULL, 0) - _ILGetFileSize(pItemIdList2, NULL, 0)); 409 } 410 /* Sort by File Type, Only valid for Files */ 411 else if(pSortInfo->nHeaderID == LISTVIEW_COLUMN_TYPE) 412 { 413 /* Sort by Type */ 414 _ILGetFileType(pItemIdList1, strName1, MAX_PATH); 415 _ILGetFileType(pItemIdList2, strName2, MAX_PATH); 416 nDiff = strcmp(strName1, strName2); 417 } 418 } 419 /* If the Date, FileSize, FileType, Attrib was the same, sort by FileName */ 420 421 if(nDiff == 0) 422 { 423 _ILSimpleGetText(pItemIdList1, strName1, MAX_PATH); 424 _ILSimpleGetText(pItemIdList2, strName2, MAX_PATH); 425 nDiff = strcmp(strName1, strName2); 426 } 427 428 if(!pSortInfo->bIsAscending) 429 { 430 nDiff = -nDiff; 431 } 432 433 return nDiff; 434 322 435 } 323 436 … … 331 444 static HRESULT ShellView_FillList(IShellViewImpl * This) 332 445 { 333 LPENUMIDLISTpEnumIDList;334 LPITEMIDLISTpidl;335 DWORDdwFetched;336 UINTi;337 LVITEMAlvItem;338 HRESULThRes;339 HDPAhdpa;340 341 342 343 344 345 346 347 348 349 350 351 352 /* create a pointer array */ 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 for (i=0; i < DPA_GetPtrCount(hdpa); ++i)/* DPA_GetPtrCount is a macro*/375 376 377 if (IncludeObject(This, pidl) == S_OK)/* in a commdlg This works as a filemask*/378 379 ZeroMemory(&lvItem, sizeof(lvItem));/* create the listviewitem*/380 lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;/*set the mask*/381 lvItem.iItem = ListView_GetItemCount(This->hWndList);/*add the item to the end of the list*/382 lvItem.lParam = (LPARAM) pidl;/*set the item's data*/383 lvItem.pszText = LPSTR_TEXTCALLBACKA;/*get text on a callback basis*/384 lvItem.iImage = I_IMAGECALLBACK;/*get the image on a callback basis*/385 386 387 388 SHFree(pidl);/* the listview has the COPY*/389 390 391 392 393 394 395 396 397 398 399 446 LPENUMIDLIST pEnumIDList; 447 LPITEMIDLIST pidl; 448 DWORD dwFetched; 449 UINT i; 450 LVITEMA lvItem; 451 HRESULT hRes; 452 HDPA hdpa; 453 454 TRACE("%p\n",This); 455 456 /* get the itemlist from the shfolder*/ 457 hRes = IShellFolder_EnumObjects(This->pSFParent,This->hWnd, SHCONTF_NONFOLDERS | SHCONTF_FOLDERS, &pEnumIDList); 458 if (hRes != S_OK) 459 { 460 if (hRes==S_FALSE) 461 return(NOERROR); 462 return(hRes); 463 } 464 465 /* create a pointer array */ 466 hdpa = pDPA_Create(16); 467 if (!hdpa) 468 { 469 return(E_OUTOFMEMORY); 470 } 471 472 /* copy the items into the array*/ 473 while((S_OK == IEnumIDList_Next(pEnumIDList,1, &pidl, &dwFetched)) && dwFetched) 474 { 475 if (pDPA_InsertPtr(hdpa, 0x7fff, pidl) == -1) 476 { 477 SHFree(pidl); 478 } 479 } 480 481 /*sort the array*/ 482 pDPA_Sort(hdpa, (PFNDPACOMPARE)ShellView_CompareItems, (LPARAM)This->pSFParent); 483 484 /*turn the listview's redrawing off*/ 485 SendMessageA(This->hWndList, WM_SETREDRAW, FALSE, 0); 486 487 for (i=0; i < DPA_GetPtrCount(hdpa); ++i) /* DPA_GetPtrCount is a macro*/ 488 { 489 pidl = (LPITEMIDLIST)DPA_GetPtr(hdpa, i); 490 if (IncludeObject(This, pidl) == S_OK) /* in a commdlg This works as a filemask*/ 491 { 492 ZeroMemory(&lvItem, sizeof(lvItem)); /* create the listviewitem*/ 493 lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; /*set the mask*/ 494 lvItem.iItem = ListView_GetItemCount(This->hWndList); /*add the item to the end of the list*/ 495 lvItem.lParam = (LPARAM) pidl; /*set the item's data*/ 496 lvItem.pszText = LPSTR_TEXTCALLBACKA; /*get text on a callback basis*/ 497 lvItem.iImage = I_IMAGECALLBACK; /*get the image on a callback basis*/ 498 ListView_InsertItemA(This->hWndList, &lvItem); 499 } 500 else 501 SHFree(pidl); /* the listview has the COPY*/ 502 } 503 504 /*turn the listview's redrawing back on and force it to draw*/ 505 SendMessageA(This->hWndList, WM_SETREDRAW, TRUE, 0); 506 InvalidateRect(This->hWndList, NULL, TRUE); 507 UpdateWindow(This->hWndList); 508 509 IEnumIDList_Release(pEnumIDList); /* destroy the list*/ 510 pDPA_Destroy(hdpa); 511 512 return S_OK; 400 513 } 401 514 … … 406 519 { 407 520 #if 0 408 521 IDropTarget* pdt; 409 522 #endif 410 411 412 413 414 415 416 417 418 419 523 TRACE("%p\n",This); 524 525 if(ShellView_CreateList(This)) 526 { 527 if(ShellView_InitList(This)) 528 { 529 ShellView_FillList(This); 530 } 531 } 532 420 533 #if 0 421 422 423 424 425 426 427 428 429 534 /* This makes a chrash since we havn't called OleInititialize. But if we 535 do this call in DllMain it breaks some apps. The native shell32 does not 536 call OleInitialize and not even depend on ole32.dll. 537 But for some apps it works...*/ 538 if (SUCCEEDED(IShellFolder_CreateViewObject(This->pSFParent, This->hWnd, &IID_IDropTarget, (LPVOID*)&pdt))) 539 { 540 pRegisterDragDrop(This->hWnd, pdt); 541 IDropTarget_Release(pdt); 542 } 430 543 #endif 431 432 } 433 434 /********************************************************** 435 * 544 return S_OK; 545 } 546 547 /********************************************************** 548 * #### Handling of the menus #### 436 549 */ 437 550 … … 440 553 */ 441 554 static HMENU ShellView_BuildFileMenu(IShellViewImpl * This) 442 { CHARszText[MAX_PATH];443 MENUITEMINFOAmii;444 intnTools,i;445 HMENUhSubMenu;446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 555 { CHAR szText[MAX_PATH]; 556 MENUITEMINFOA mii; 557 int nTools,i; 558 HMENU hSubMenu; 559 560 TRACE("(%p)\n",This); 561 562 hSubMenu = CreatePopupMenu(); 563 if(hSubMenu) 564 { /*get the number of items in our global array*/ 565 for(nTools = 0; Tools[nTools].idCommand != -1; nTools++){} 566 567 /*add the menu items*/ 568 for(i = 0; i < nTools; i++) 569 { 570 LoadStringA(shell32_hInstance, Tools[i].idMenuString, szText, MAX_PATH); 571 572 ZeroMemory(&mii, sizeof(mii)); 573 mii.cbSize = sizeof(mii); 574 mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE; 575 576 if(TBSTYLE_SEP != Tools[i].bStyle) /* no seperator*/ 577 { 578 mii.fType = MFT_STRING; 579 mii.fState = MFS_ENABLED; 580 mii.dwTypeData = szText; 581 mii.wID = Tools[i].idCommand; 582 } 583 else 584 { 585 mii.fType = MFT_SEPARATOR; 586 } 587 /* tack This item onto the end of the menu */ 588 InsertMenuItemA(hSubMenu, (UINT)-1, TRUE, &mii); 589 } 590 } 591 TRACE("-- return (menu=0x%x)\n",hSubMenu); 592 return hSubMenu; 480 593 } 481 594 /********************************************************** … … 483 596 */ 484 597 static void ShellView_MergeFileMenu(IShellViewImpl * This, HMENU hSubMenu) 485 { 486 487 488 489 490 491 492 493 TRACE("--\n"); 598 { TRACE("(%p)->(submenu=0x%08x) stub\n",This,hSubMenu); 599 600 if(hSubMenu) 601 { /*insert This item at the beginning of the menu */ 602 _InsertMenuItem(hSubMenu, 0, TRUE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED); 603 _InsertMenuItem(hSubMenu, 0, TRUE, IDM_MYFILEITEM, MFT_STRING, "dummy45", MFS_ENABLED); 604 605 } 606 TRACE("--\n"); 494 607 } 495 608 … … 499 612 500 613 static void ShellView_MergeViewMenu(IShellViewImpl * This, HMENU hSubMenu) 501 { MENUITEMINFOAmii;502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 614 { MENUITEMINFOA mii; 615 616 TRACE("(%p)->(submenu=0x%08x)\n",This,hSubMenu); 617 618 if(hSubMenu) 619 { /*add a separator at the correct position in the menu*/ 620 _InsertMenuItem(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED); 621 622 ZeroMemory(&mii, sizeof(mii)); 623 mii.cbSize = sizeof(mii); 624 mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_DATA;; 625 mii.fType = MFT_STRING; 626 mii.dwTypeData = "View"; 627 mii.hSubMenu = LoadMenuA(shell32_hInstance, "MENU_001"); 628 InsertMenuItemA(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii); 629 } 517 630 } 518 631 … … 525 638 static UINT ShellView_GetSelections(IShellViewImpl * This) 526 639 { 527 LVITEMAlvItem;528 UINTi = 0;529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 } 562 /********************************************************** 563 * 640 LVITEMA lvItem; 641 UINT i = 0; 642 643 if (This->apidl) 644 { 645 SHFree(This->apidl); 646 } 647 648 This->cidl = ListView_GetSelectedCount(This->hWndList); 649 This->apidl = (LPITEMIDLIST*)SHAlloc(This->cidl * sizeof(LPITEMIDLIST)); 650 651 TRACE("selected=%i\n", This->cidl); 652 653 if(This->apidl) 654 { 655 TRACE("-- Items selected =%u\n", This->cidl); 656 657 ZeroMemory(&lvItem, sizeof(lvItem)); 658 lvItem.mask = LVIF_STATE | LVIF_PARAM; 659 lvItem.stateMask = LVIS_SELECTED; 660 661 while(ListView_GetItemA(This->hWndList, &lvItem) && (i < This->cidl)) 662 { 663 if(lvItem.state & LVIS_SELECTED) 664 { 665 This->apidl[i] = (LPITEMIDLIST)lvItem.lParam; 666 i++; 667 TRACE("-- selected Item found\n"); 668 } 669 lvItem.iItem++; 670 } 671 } 672 return This->cidl; 673 674 } 675 /********************************************************** 676 * ShellView_DoContextMenu() 564 677 */ 565 678 static void ShellView_DoContextMenu(IShellViewImpl * This, WORD x, WORD y, BOOL bDefault) 566 { UINTuCommand;567 DWORDwFlags;568 HMENUhMenu;569 BOOLfExplore = FALSE;570 HWNDhwndTree = 0;571 LPCONTEXTMENUpContextMenu = NULL;572 IContextMenu *pCM = NULL;573 CMINVOKECOMMANDINFOcmi;574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 } 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 else/* background context menu */640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 } 660 661 /********************************************************** 662 * 679 { UINT uCommand; 680 DWORD wFlags; 681 HMENU hMenu; 682 BOOL fExplore = FALSE; 683 HWND hwndTree = 0; 684 LPCONTEXTMENU pContextMenu = NULL; 685 IContextMenu * pCM = NULL; 686 CMINVOKECOMMANDINFO cmi; 687 688 TRACE("(%p)->(0x%08x 0x%08x 0x%08x) stub\n",This, x, y, bDefault); 689 690 /* look, what's selected and create a context menu object of it*/ 691 if( ShellView_GetSelections(This) ) 692 { 693 IShellFolder_GetUIObjectOf( This->pSFParent, This->hWndParent, This->cidl, This->apidl, 694 (REFIID)&IID_IContextMenu, NULL, (LPVOID *)&pContextMenu); 695 696 if(pContextMenu) 697 { 698 TRACE("-- pContextMenu\n"); 699 hMenu = CreatePopupMenu(); 700 701 if( hMenu ) 702 { 703 /* See if we are in Explore or Open mode. If the browser's tree is present, we are in Explore mode.*/ 704 if(SUCCEEDED(IShellBrowser_GetControlWindow(This->pShellBrowser,FCW_TREE, &hwndTree)) && hwndTree) 705 { 706 TRACE("-- explore mode\n"); 707 fExplore = TRUE; 708 } 709 710 /* build the flags depending on what we can do with the selected item */ 711 wFlags = CMF_NORMAL | (This->cidl != 1 ? 0 : CMF_CANRENAME) | (fExplore ? CMF_EXPLORE : 0); 712 713 /* let the ContextMenu merge its items in */ 714 if (SUCCEEDED(IContextMenu_QueryContextMenu( pContextMenu, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, wFlags ))) 715 { 716 if( bDefault ) 717 { 718 TRACE("-- get menu default command\n"); 719 uCommand = GetMenuDefaultItem(hMenu, FALSE, GMDI_GOINTOPOPUPS); 720 } 721 else 722 { 723 TRACE("-- track popup\n"); 724 uCommand = TrackPopupMenu( hMenu,TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL); 725 } 726 727 if(uCommand > 0) 728 { 729 TRACE("-- uCommand=%u\n", uCommand); 730 if (IsInCommDlg(This) && ((uCommand==IDM_EXPLORE) || (uCommand==IDM_OPEN))) 731 { 732 TRACE("-- dlg: OnDefaultCommand\n"); 733 OnDefaultCommand(This); 734 } 735 else 736 { 737 TRACE("-- explore -- invoke command\n"); 738 ZeroMemory(&cmi, sizeof(cmi)); 739 cmi.cbSize = sizeof(cmi); 740 cmi.hwnd = This->hWndParent; 741 cmi.lpVerb = (LPCSTR)MAKEINTRESOURCEA(uCommand); 742 IContextMenu_InvokeCommand(pContextMenu, &cmi); 743 } 744 } 745 DestroyMenu(hMenu); 746 } 747 } 748 if (pContextMenu) 749 IContextMenu_Release(pContextMenu); 750 } 751 } 752 else /* background context menu */ 753 { 754 hMenu = CreatePopupMenu(); 755 756 pCM = ISvBgCm_Constructor(); 757 IContextMenu_QueryContextMenu(pCM, hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, 0); 758 759 uCommand = TrackPopupMenu( hMenu, TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,This->hWnd,NULL); 760 DestroyMenu(hMenu); 761 762 TRACE("-- (%p)->(uCommand=0x%08x )\n",This, uCommand); 763 764 ZeroMemory(&cmi, sizeof(cmi)); 765 cmi.cbSize = sizeof(cmi); 766 cmi.lpVerb = (LPCSTR)MAKEINTRESOURCEA(uCommand); 767 cmi.hwnd = This->hWndParent; 768 IContextMenu_InvokeCommand(pCM, &cmi); 769 770 IContextMenu_Release(pCM); 771 } 772 } 773 774 /********************************************************** 775 * ##### message handling ##### 663 776 */ 664 777 … … 668 781 static LRESULT ShellView_OnSize(IShellViewImpl * This, WORD wWidth, WORD wHeight) 669 782 { 670 671 672 673 674 675 676 677 678 783 TRACE("%p width=%u height=%u\n",This, wWidth,wHeight); 784 785 /*resize the ListView to fit our window*/ 786 if(This->hWndList) 787 { 788 MoveWindow(This->hWndList, 0, 0, wWidth, wHeight, TRUE); 789 } 790 791 return S_OK; 679 792 } 680 793 /********************************************************** … … 686 799 static void ShellView_OnDeactivate(IShellViewImpl * This) 687 800 { 688 689 690 691 692 693 694 695 696 697 698 699 700 701 801 TRACE("%p\n",This); 802 803 if(This->uState != SVUIA_DEACTIVATE) 804 { 805 if(This->hMenu) 806 { 807 IShellBrowser_SetMenuSB(This->pShellBrowser,0, 0, 0); 808 IShellBrowser_RemoveMenusSB(This->pShellBrowser,This->hMenu); 809 DestroyMenu(This->hMenu); 810 This->hMenu = 0; 811 } 812 813 This->uState = SVUIA_DEACTIVATE; 814 } 702 815 } 703 816 … … 706 819 */ 707 820 static LRESULT ShellView_OnActivate(IShellViewImpl * This, UINT uState) 708 { 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 821 { OLEMENUGROUPWIDTHS omw = { {0, 0, 0, 0, 0, 0} }; 822 MENUITEMINFOA mii; 823 CHAR szText[MAX_PATH]; 824 825 TRACE("%p uState=%x\n",This,uState); 826 827 /*don't do anything if the state isn't really changing */ 828 if(This->uState == uState) 829 { 830 return S_OK; 831 } 832 833 ShellView_OnDeactivate(This); 834 835 /*only do This if we are active */ 836 if(uState != SVUIA_DEACTIVATE) 837 { 838 /*merge the menus */ 839 This->hMenu = CreateMenu(); 840 841 if(This->hMenu) 842 { 843 IShellBrowser_InsertMenusSB(This->pShellBrowser, This->hMenu, &omw); 844 TRACE("-- after fnInsertMenusSB\n"); 845 846 /*build the top level menu get the menu item's text*/ 847 strcpy(szText,"dummy 31"); 848 849 ZeroMemory(&mii, sizeof(mii)); 850 mii.cbSize = sizeof(mii); 851 mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_STATE; 852 mii.fType = MFT_STRING; 853 mii.fState = MFS_ENABLED; 854 mii.dwTypeData = szText; 855 mii.hSubMenu = ShellView_BuildFileMenu(This); 856 857 /*insert our menu into the menu bar*/ 858 if(mii.hSubMenu) 859 { 860 InsertMenuItemA(This->hMenu, FCIDM_MENU_HELP, FALSE, &mii); 861 } 862 863 /*get the view menu so we can merge with it*/ 864 ZeroMemory(&mii, sizeof(mii)); 865 mii.cbSize = sizeof(mii); 866 mii.fMask = MIIM_SUBMENU; 867 868 if(GetMenuItemInfoA(This->hMenu, FCIDM_MENU_VIEW, FALSE, &mii)) 869 { 870 ShellView_MergeViewMenu(This, mii.hSubMenu); 871 } 872 873 /*add the items that should only be added if we have the focus*/ 874 if(SVUIA_ACTIVATE_FOCUS == uState) 875 { 876 /*get the file menu so we can merge with it */ 877 ZeroMemory(&mii, sizeof(mii)); 878 mii.cbSize = sizeof(mii); 879 mii.fMask = MIIM_SUBMENU; 880 881 if(GetMenuItemInfoA(This->hMenu, FCIDM_MENU_FILE, FALSE, &mii)) 882 { 883 ShellView_MergeFileMenu(This, mii.hSubMenu); 884 } 885 } 886 TRACE("-- before fnSetMenuSB\n"); 887 IShellBrowser_SetMenuSB(This->pShellBrowser, This->hMenu, 0, This->hWnd); 888 } 889 } 890 This->uState = uState; 891 TRACE("--\n"); 892 return S_OK; 780 893 } 781 894 … … 786 899 static LRESULT ShellView_OnSetFocus(IShellViewImpl * This) 787 900 { 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 901 TRACE("%p\n",This); 902 903 /* Tell the browser one of our windows has received the focus. This 904 should always be done before merging menus (OnActivate merges the 905 menus) if one of our windows has the focus.*/ 906 907 IShellBrowser_OnViewWindowActive(This->pShellBrowser,(IShellView*) This); 908 ShellView_OnActivate(This, SVUIA_ACTIVATE_FOCUS); 909 910 /* Set the focus to the listview */ 911 SetFocus(This->hWndList); 912 913 /* Notify the ICommDlgBrowser interface */ 914 OnStateChange(This,CDBOSC_SETFOCUS); 915 916 return 0; 804 917 } 805 918 … … 809 922 static LRESULT ShellView_OnKillFocus(IShellViewImpl * This) 810 923 { 811 812 813 814 815 816 817 924 TRACE("(%p) stub\n",This); 925 926 ShellView_OnActivate(This, SVUIA_ACTIVATE_NOFOCUS); 927 /* Notify the ICommDlgBrowser */ 928 OnStateChange(This,CDBOSC_KILLFOCUS); 929 930 return 0; 818 931 } 819 932 820 933 /********************************************************** 821 934 * ShellView_OnCommand() 935 * 936 * NOTES 937 * the CmdID's are the ones from the context menu 822 938 */ 823 939 static LRESULT ShellView_OnCommand(IShellViewImpl * This,DWORD dwCmdID, DWORD dwCmd, HWND hwndCmd) 824 940 { 825 TRACE("(%p)->(0x%08lx 0x%08lx 0x%08x) stub\n",This, dwCmdID, dwCmd, hwndCmd); 826 827 switch(dwCmdID) 828 { 829 case FCIDM_SHVIEW_SMALLICON: 830 This->FolderSettings.ViewMode = FVM_SMALLICON; 831 SetStyle (This, LVS_SMALLICON, LVS_TYPEMASK); 832 break; 833 834 case FCIDM_SHVIEW_BIGICON: 835 This->FolderSettings.ViewMode = FVM_ICON; 836 SetStyle (This, LVS_ICON, LVS_TYPEMASK); 837 break; 838 839 case FCIDM_SHVIEW_LISTVIEW: 840 This->FolderSettings.ViewMode = FVM_LIST; 841 SetStyle (This, LVS_LIST, LVS_TYPEMASK); 842 break; 843 844 case FCIDM_SHVIEW_REPORTVIEW: 845 This->FolderSettings.ViewMode = FVM_DETAILS; 846 SetStyle (This, LVS_REPORT, LVS_TYPEMASK); 847 break; 848 849 default: 850 TRACE("-- COMMAND 0x%04lx unhandled\n", dwCmdID); 851 } 852 return 0; 941 TRACE("(%p)->(0x%08lx 0x%08lx 0x%08x) stub\n",This, dwCmdID, dwCmd, hwndCmd); 942 943 switch(dwCmdID) 944 { 945 case FCIDM_SHVIEW_SMALLICON: 946 This->FolderSettings.ViewMode = FVM_SMALLICON; 947 SetStyle (This, LVS_SMALLICON, LVS_TYPEMASK); 948 break; 949 950 case FCIDM_SHVIEW_BIGICON: 951 This->FolderSettings.ViewMode = FVM_ICON; 952 SetStyle (This, LVS_ICON, LVS_TYPEMASK); 953 break; 954 955 case FCIDM_SHVIEW_LISTVIEW: 956 This->FolderSettings.ViewMode = FVM_LIST; 957 SetStyle (This, LVS_LIST, LVS_TYPEMASK); 958 break; 959 960 case FCIDM_SHVIEW_REPORTVIEW: 961 This->FolderSettings.ViewMode = FVM_DETAILS; 962 SetStyle (This, LVS_REPORT, LVS_TYPEMASK); 963 break; 964 965 /* the menu-ID's for sorting are 0x30... see shrec.rc */ 966 case 0x30: 967 case 0x31: 968 case 0x32: 969 case 0x33: 970 ListView_SortItems(This->hWndList, ShellView_ListViewCompareItems, (LPARAM) (dwCmdID - 0x30)); 971 break; 972 973 default: 974 TRACE("-- COMMAND 0x%04lx unhandled\n", dwCmdID); 975 } 976 return 0; 853 977 } 854 978 … … 858 982 859 983 static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpnmh) 860 { NM_LISTVIEW *lpnmlv = (NM_LISTVIEW*)lpnmh; 861 NMLVDISPINFOA *lpdi = (NMLVDISPINFOA *)lpnmh; 862 LPITEMIDLIST pidl; 863 STRRET str; 864 865 TRACE("%p CtlID=%u lpnmh->code=%x\n",This,CtlID,lpnmh->code); 866 867 switch(lpnmh->code) 868 { 869 case NM_SETFOCUS: 870 TRACE("-- NM_SETFOCUS %p\n",This); 871 ShellView_OnSetFocus(This); 872 break; 873 874 case NM_KILLFOCUS: 875 TRACE("-- NM_KILLFOCUS %p\n",This); 876 ShellView_OnDeactivate(This); 877 /* Notify the ICommDlgBrowser interface */ 878 OnStateChange(This,CDBOSC_KILLFOCUS); 879 break; 880 881 case HDN_ENDTRACKA: 882 TRACE("-- HDN_ENDTRACKA %p\n",This); 883 /*nColumn1 = ListView_GetColumnWidth(This->hWndList, 0); 884 nColumn2 = ListView_GetColumnWidth(This->hWndList, 1);*/ 885 break; 886 887 case LVN_DELETEITEM: 888 TRACE("-- LVN_DELETEITEM %p\n",This); 889 SHFree((LPITEMIDLIST)lpnmlv->lParam); /*delete the pidl because we made a copy of it*/ 890 break; 891 892 case LVN_ITEMACTIVATE: 893 TRACE("-- LVN_ITEMACTIVATE %p\n",This); 894 OnStateChange(This, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */ 895 ShellView_DoContextMenu(This, 0, 0, TRUE); 896 break; 897 898 case LVN_GETDISPINFOA: 899 TRACE("-- LVN_GETDISPINFOA %p\n",This); 900 pidl = (LPITEMIDLIST)lpdi->item.lParam; 901 902 903 if(lpdi->item.iSubItem) /*is the sub-item information being requested?*/ 904 { if(lpdi->item.mask & LVIF_TEXT) /*is the text being requested?*/ 905 { if(_ILIsValue(pidl)) /*is This a value or a folder?*/ 906 { switch (lpdi->item.iSubItem) 907 { case 1: /* size */ 908 _ILGetFileSize (pidl, lpdi->item.pszText, lpdi->item.cchTextMax); 909 break; 910 case 2: /* extension */ 911 { char sTemp[64]; 912 if (_ILGetExtension (pidl, sTemp, 64)) 913 { if (!( HCR_MapTypeToValue(sTemp, sTemp, 64, TRUE) 914 && HCR_MapTypeToValue(sTemp, lpdi->item.pszText, lpdi->item.cchTextMax, FALSE ))) 915 { lstrcpynA (lpdi->item.pszText, sTemp, lpdi->item.cchTextMax); 916 strncat (lpdi->item.pszText, "-file", lpdi->item.cchTextMax); 917 } 918 } 919 else /* no extension found */ 920 { lpdi->item.pszText[0]=0x00; 921 } 922 } 923 break; 924 case 3: /* date */ 925 _ILGetFileDate (pidl, lpdi->item.pszText, lpdi->item.cchTextMax); 926 break; 927 } 928 } 929 else /*its a folder*/ 930 { switch (lpdi->item.iSubItem) 931 { case 1: 932 strcpy(lpdi->item.pszText, ""); 933 break; 934 case 2: 935 lstrcpynA (lpdi->item.pszText, "Folder", lpdi->item.cchTextMax); 936 break; 937 case 3: 938 _ILGetFileDate (pidl, lpdi->item.pszText, lpdi->item.cchTextMax); 939 break; 940 } 941 } 942 TRACE("-- text=%s\n",lpdi->item.pszText); 943 } 944 } 945 else /*the item text is being requested*/ 946 { 947 if(lpdi->item.mask & LVIF_TEXT) /*is the text being requested?*/ 948 { 949 if(SUCCEEDED(IShellFolder_GetDisplayNameOf(This->pSFParent,pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &str))) 950 { 951 StrRetToStrNA(lpdi->item.pszText, lpdi->item.cchTextMax, &str, pidl); 952 } 953 TRACE("-- text=%s\n",lpdi->item.pszText); 954 } 955 956 if(lpdi->item.mask & LVIF_IMAGE) /*is the image being requested?*/ 957 { 958 lpdi->item.iImage = SHMapPIDLToSystemImageListIndex(This->pSFParent, pidl, 0); 959 } 960 } 961 break; 962 963 case LVN_ITEMCHANGED: 964 TRACE("-- LVN_ITEMCHANGED %p\n",This); 965 OnStateChange(This, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */ 966 break; 967 968 case LVN_BEGINDRAG: 969 case LVN_BEGINRDRAG: 970 971 if (ShellView_GetSelections(This)) 972 { 973 IDataObject * pda; 974 DWORD dwAttributes; 975 DWORD dwEffect = DROPEFFECT_COPY | DROPEFFECT_MOVE; 976 977 if (SUCCEEDED(IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl, This->apidl, &IID_IDataObject,0,(LPVOID *)&pda))) 978 { 979 IDropSource * pds = (IDropSource*)&(This->lpvtblDropSource); /* own DropSource interface */ 980 981 if (SUCCEEDED(IShellFolder_GetAttributesOf(This->pSFParent, This->cidl, This->apidl, &dwAttributes))) 982 { 983 if (dwAttributes & SFGAO_CANLINK) 984 { 985 dwEffect |= DROPEFFECT_LINK; 986 } 987 } 988 989 if (pds) 990 { 991 DWORD dwEffect; 992 pDoDragDrop(pda, pds, dwEffect, &dwEffect); 993 } 994 995 IDataObject_Release(pda); 996 } 997 } 998 break; 999 1000 case LVN_BEGINLABELEDITA: 1001 case LVN_ENDLABELEDITA: 1002 FIXME("labeledit\n"); 1003 break; 1004 1005 default: 1006 // TRACE("-- %p WM_COMMAND %s unhandled\n", This, SPY_GetMsgName(lpnmh->code)); 1007 break;; 1008 } 1009 return 0; 984 { LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)lpnmh; 985 NMLVDISPINFOA *lpdi = (NMLVDISPINFOA *)lpnmh; 986 LPITEMIDLIST pidl; 987 STRRET str; 988 989 TRACE("%p CtlID=%u lpnmh->code=%x\n",This,CtlID,lpnmh->code); 990 991 switch(lpnmh->code) 992 { 993 case NM_SETFOCUS: 994 TRACE("-- NM_SETFOCUS %p\n",This); 995 ShellView_OnSetFocus(This); 996 break; 997 998 case NM_KILLFOCUS: 999 TRACE("-- NM_KILLFOCUS %p\n",This); 1000 ShellView_OnDeactivate(This); 1001 /* Notify the ICommDlgBrowser interface */ 1002 OnStateChange(This,CDBOSC_KILLFOCUS); 1003 break; 1004 1005 case HDN_ENDTRACKA: 1006 TRACE("-- HDN_ENDTRACKA %p\n",This); 1007 /*nColumn1 = ListView_GetColumnWidth(This->hWndList, 0); 1008 nColumn2 = ListView_GetColumnWidth(This->hWndList, 1);*/ 1009 break; 1010 1011 case LVN_DELETEITEM: 1012 TRACE("-- LVN_DELETEITEM %p\n",This); 1013 SHFree((LPITEMIDLIST)lpnmlv->lParam); /*delete the pidl because we made a copy of it*/ 1014 break; 1015 1016 case LVN_ITEMACTIVATE: 1017 TRACE("-- LVN_ITEMACTIVATE %p\n",This); 1018 OnStateChange(This, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */ 1019 ShellView_DoContextMenu(This, 0, 0, TRUE); 1020 break; 1021 1022 case LVN_COLUMNCLICK: 1023 { 1024 This->ListViewSortInfo.nHeaderID = lpnmlv->iSubItem; 1025 if(This->ListViewSortInfo.nLastHeaderID == This->ListViewSortInfo.nHeaderID) 1026 { 1027 This->ListViewSortInfo.bIsAscending = !This->ListViewSortInfo.bIsAscending; 1028 } 1029 else 1030 { 1031 This->ListViewSortInfo.bIsAscending = TRUE; 1032 } 1033 This->ListViewSortInfo.nLastHeaderID = This->ListViewSortInfo.nHeaderID; 1034 1035 ListView_SortItems(lpnmlv->hdr.hwndFrom, ShellView_ListViewCompareItems, (LPARAM) (&(This->ListViewSortInfo))); 1036 1037 break; 1038 } 1039 1040 case LVN_GETDISPINFOA: 1041 TRACE("-- LVN_GETDISPINFOA %p\n",This); 1042 pidl = (LPITEMIDLIST)lpdi->item.lParam; 1043 1044 1045 if(lpdi->item.iSubItem) /*is the sub-item information being requested?*/ 1046 { if(lpdi->item.mask & LVIF_TEXT) /*is the text being requested?*/ 1047 { if(_ILIsValue(pidl)) /*is This a value or a folder?*/ 1048 { switch (lpdi->item.iSubItem) 1049 { case 1: /* size */ 1050 _ILGetFileSize (pidl, lpdi->item.pszText, lpdi->item.cchTextMax); 1051 break; 1052 case 2: /* extension */ 1053 { char sTemp[64]; 1054 if (_ILGetExtension (pidl, sTemp, 64)) 1055 { if (!( HCR_MapTypeToValue(sTemp, sTemp, 64, TRUE) 1056 && HCR_MapTypeToValue(sTemp, lpdi->item.pszText, lpdi->item.cchTextMax, FALSE ))) 1057 { lstrcpynA (lpdi->item.pszText, sTemp, lpdi->item.cchTextMax); 1058 strncat (lpdi->item.pszText, "-file", lpdi->item.cchTextMax); 1059 } 1060 } 1061 else /* no extension found */ 1062 { lpdi->item.pszText[0]=0x00; 1063 } 1064 } 1065 break; 1066 case 3: /* date */ 1067 _ILGetFileDate (pidl, lpdi->item.pszText, lpdi->item.cchTextMax); 1068 break; 1069 } 1070 } 1071 else /*its a folder*/ 1072 { switch (lpdi->item.iSubItem) 1073 { case 1: 1074 strcpy(lpdi->item.pszText, ""); 1075 break; 1076 case 2: 1077 lstrcpynA (lpdi->item.pszText, "Folder", lpdi->item.cchTextMax); 1078 break; 1079 case 3: 1080 _ILGetFileDate (pidl, lpdi->item.pszText, lpdi->item.cchTextMax); 1081 break; 1082 } 1083 } 1084 TRACE("-- text=%s\n",lpdi->item.pszText); 1085 } 1086 } 1087 else /*the item text is being requested*/ 1088 { 1089 if(lpdi->item.mask & LVIF_TEXT) /*is the text being requested?*/ 1090 { 1091 if(SUCCEEDED(IShellFolder_GetDisplayNameOf(This->pSFParent,pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &str))) 1092 { 1093 StrRetToStrNA(lpdi->item.pszText, lpdi->item.cchTextMax, &str, pidl); 1094 } 1095 TRACE("-- text=%s\n",lpdi->item.pszText); 1096 } 1097 1098 if(lpdi->item.mask & LVIF_IMAGE) /*is the image being requested?*/ 1099 { 1100 lpdi->item.iImage = SHMapPIDLToSystemImageListIndex(This->pSFParent, pidl, 0); 1101 } 1102 } 1103 break; 1104 1105 case LVN_ITEMCHANGED: 1106 TRACE("-- LVN_ITEMCHANGED %p\n",This); 1107 OnStateChange(This, CDBOSC_SELCHANGE); /* the browser will get the IDataObject now */ 1108 break; 1109 1110 case LVN_BEGINDRAG: 1111 case LVN_BEGINRDRAG: 1112 1113 if (ShellView_GetSelections(This)) 1114 { 1115 IDataObject * pda; 1116 DWORD dwAttributes; 1117 DWORD dwEffect = DROPEFFECT_COPY | DROPEFFECT_MOVE; 1118 1119 if (SUCCEEDED(IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl, This->apidl, &IID_IDataObject,0,(LPVOID *)&pda))) 1120 { 1121 IDropSource * pds = (IDropSource*)&(This->lpvtblDropSource); /* own DropSource interface */ 1122 1123 if (SUCCEEDED(IShellFolder_GetAttributesOf(This->pSFParent, This->cidl, This->apidl, &dwAttributes))) 1124 { 1125 if (dwAttributes & SFGAO_CANLINK) 1126 { 1127 dwEffect |= DROPEFFECT_LINK; 1128 } 1129 } 1130 1131 if (pds) 1132 { 1133 DWORD dwEffect; 1134 pDoDragDrop(pda, pds, dwEffect, &dwEffect); 1135 } 1136 1137 IDataObject_Release(pda); 1138 } 1139 } 1140 break; 1141 1142 case LVN_BEGINLABELEDITA: 1143 case LVN_ENDLABELEDITA: 1144 FIXME("labeledit\n"); 1145 break; 1146 1147 default: 1148 // TRACE("-- %p WM_COMMAND %s unhandled\n", This, SPY_GetMsgName(lpnmh->code)); 1149 break;; 1150 } 1151 return 0; 1010 1152 } 1011 1153 … … 1016 1158 static LRESULT CALLBACK ShellView_WndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam) 1017 1159 { 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 case WM_SIZE:return ShellView_OnSize(pThis,LOWORD(lParam), HIWORD(lParam));1033 case WM_SETFOCUS:return ShellView_OnSetFocus(pThis);1034 case WM_KILLFOCUS:return ShellView_OnKillFocus(pThis);1035 case WM_CREATE:return ShellView_OnCreate(pThis);1036 case WM_ACTIVATE:return ShellView_OnActivate(pThis, SVUIA_ACTIVATE_FOCUS);1037 case WM_NOTIFY:return ShellView_OnNotify(pThis,(UINT)wParam, (LPNMHDR)lParam);1038 1039 1040 1041 1042 1043 1044 1045 1046 case WM_SHOWWINDOW:UpdateWindow(pThis->hWndList);1047 1048 1049 case WM_GETDLGCODE:return SendMessageA(pThis->hWndList,uMessage,0,0);1050 1051 case WM_DESTROY:pRevokeDragDrop(pThis->hWnd);1052 1053 1054 1055 1160 IShellViewImpl * pThis = (IShellViewImpl*)GetWindowLongA(hWnd, GWL_USERDATA); 1161 LPCREATESTRUCTA lpcs; 1162 1163 TRACE("(hwnd=%x msg=%x wparm=%x lparm=%lx)\n",hWnd, uMessage, wParam, lParam); 1164 1165 switch (uMessage) 1166 { 1167 case WM_NCCREATE: 1168 lpcs = (LPCREATESTRUCTA)lParam; 1169 pThis = (IShellViewImpl*)(lpcs->lpCreateParams); 1170 SetWindowLongA(hWnd, GWL_USERDATA, (LONG)pThis); 1171 pThis->hWnd = hWnd; /*set the window handle*/ 1172 break; 1173 1174 case WM_SIZE: return ShellView_OnSize(pThis,LOWORD(lParam), HIWORD(lParam)); 1175 case WM_SETFOCUS: return ShellView_OnSetFocus(pThis); 1176 case WM_KILLFOCUS: return ShellView_OnKillFocus(pThis); 1177 case WM_CREATE: return ShellView_OnCreate(pThis); 1178 case WM_ACTIVATE: return ShellView_OnActivate(pThis, SVUIA_ACTIVATE_FOCUS); 1179 case WM_NOTIFY: return ShellView_OnNotify(pThis,(UINT)wParam, (LPNMHDR)lParam); 1180 case WM_COMMAND: return ShellView_OnCommand(pThis, 1181 GET_WM_COMMAND_ID(wParam, lParam), 1182 GET_WM_COMMAND_CMD(wParam, lParam), 1183 GET_WM_COMMAND_HWND(wParam, lParam)); 1184 1185 case WM_CONTEXTMENU: ShellView_DoContextMenu(pThis, LOWORD(lParam), HIWORD(lParam), FALSE); 1186 return 0; 1187 1188 case WM_SHOWWINDOW: UpdateWindow(pThis->hWndList); 1189 break; 1190 1191 case WM_GETDLGCODE: return SendMessageA(pThis->hWndList,uMessage,0,0); 1192 1193 case WM_DESTROY: pRevokeDragDrop(pThis->hWnd); 1194 break; 1195 } 1196 1197 return DefWindowProcA (hWnd, uMessage, wParam, lParam); 1056 1198 } 1057 1199 /********************************************************** … … 1066 1208 static HRESULT WINAPI IShellView_fnQueryInterface(IShellView * iface,REFIID riid, LPVOID *ppvObj) 1067 1209 { 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1210 ICOM_THIS(IShellViewImpl, iface); 1211 1212 char xriid[50]; 1213 WINE_StringFromCLSID((LPCLSID)riid,xriid); 1214 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,xriid,ppvObj); 1215 1216 *ppvObj = NULL; 1217 1218 if(IsEqualIID(riid, &IID_IUnknown)) 1219 { 1220 *ppvObj = This; 1221 } 1222 else if(IsEqualIID(riid, &IID_IShellView)) 1223 { 1224 *ppvObj = (IShellView*)This; 1225 } 1226 else if(IsEqualIID(riid, &IID_IOleCommandTarget)) 1227 { 1228 *ppvObj = (IOleCommandTarget*)&(This->lpvtblOleCommandTarget); 1229 } 1230 else if(IsEqualIID(riid, &IID_IDropTarget)) 1231 { 1232 *ppvObj = (IDropTarget*)&(This->lpvtblDropTarget); 1233 } 1234 else if(IsEqualIID(riid, &IID_IDropSource)) 1235 { 1236 *ppvObj = (IDropSource*)&(This->lpvtblDropSource); 1237 } 1238 else if(IsEqualIID(riid, &IID_IViewObject)) 1239 { 1240 *ppvObj = (IViewObject*)&(This->lpvtblViewObject); 1241 } 1242 1243 if(*ppvObj) 1244 { 1245 IUnknown_AddRef( (IUnknown*)*ppvObj ); 1246 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); 1247 return S_OK; 1248 } 1249 TRACE("-- Interface: E_NOINTERFACE\n"); 1250 return E_NOINTERFACE; 1109 1251 } 1110 1252 … … 1114 1256 static ULONG WINAPI IShellView_fnAddRef(IShellView * iface) 1115 1257 { 1116 1117 1118 1119 1120 1121 1258 ICOM_THIS(IShellViewImpl, iface); 1259 1260 TRACE("(%p)->(count=%lu)\n",This,This->ref); 1261 1262 shell32_ObjCount++; 1263 return ++(This->ref); 1122 1264 } 1123 1265 /********************************************************** … … 1126 1268 static ULONG WINAPI IShellView_fnRelease(IShellView * iface) 1127 1269 { 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1270 ICOM_THIS(IShellViewImpl, iface); 1271 1272 TRACE("(%p)->()\n",This); 1273 1274 shell32_ObjCount--; 1275 1276 if (!--(This->ref)) 1277 { 1278 TRACE(" destroying IShellView(%p)\n",This); 1279 1280 if(This->pSFParent) 1281 IShellFolder_Release(This->pSFParent); 1282 1283 if (This->apidl) 1284 SHFree(This->apidl); 1285 1286 if (This->pCommDlgBrowser) 1287 ICommDlgBrowser_Release(This->pCommDlgBrowser); 1288 1289 HeapFree(GetProcessHeap(),0,This); 1290 return 0; 1291 } 1292 return This->ref; 1151 1293 } 1152 1294 … … 1156 1298 static HRESULT WINAPI IShellView_fnGetWindow(IShellView * iface,HWND * phWnd) 1157 1299 { 1158 1159 1160 1161 1162 1163 1164 1300 ICOM_THIS(IShellViewImpl, iface); 1301 1302 TRACE("(%p)\n",This); 1303 1304 *phWnd = This->hWnd; 1305 1306 return S_OK; 1165 1307 } 1166 1308 1167 1309 static HRESULT WINAPI IShellView_fnContextSensitiveHelp(IShellView * iface,BOOL fEnterMode) 1168 1310 { 1169 1170 1171 1172 1173 1311 ICOM_THIS(IShellViewImpl, iface); 1312 1313 FIXME("(%p) stub\n",This); 1314 1315 return E_NOTIMPL; 1174 1316 } 1175 1317 … … 1182 1324 static HRESULT WINAPI IShellView_fnTranslateAccelerator(IShellView * iface,LPMSG lpmsg) 1183 1325 { 1184 1185 1186 1187 1188 1189 1190 { case WM_KEYDOWN:TRACE("-- key=0x04%x",lpmsg->wParam) ;1191 1192 1326 ICOM_THIS(IShellViewImpl, iface); 1327 1328 FIXME("(%p)->(%p: hwnd=%x msg=%x lp=%lx wp=%x) stub\n",This,lpmsg, lpmsg->hwnd, lpmsg->message, lpmsg->lParam, lpmsg->wParam); 1329 1330 1331 switch (lpmsg->message) 1332 { case WM_KEYDOWN: TRACE("-- key=0x04%x",lpmsg->wParam) ; 1333 } 1334 return NOERROR; 1193 1335 } 1194 1336 1195 1337 static HRESULT WINAPI IShellView_fnEnableModeless(IShellView * iface,BOOL fEnable) 1196 1338 { 1197 1198 1199 1200 1201 1339 ICOM_THIS(IShellViewImpl, iface); 1340 1341 FIXME("(%p) stub\n",This); 1342 1343 return E_NOTIMPL; 1202 1344 } 1203 1345 1204 1346 static HRESULT WINAPI IShellView_fnUIActivate(IShellView * iface,UINT uState) 1205 1347 { 1206 1207 1208 CHARszName[MAX_PATH];1209 LRESULTlResult;1210 intnPartArray[1] = {-1};1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1348 ICOM_THIS(IShellViewImpl, iface); 1349 1350 CHAR szName[MAX_PATH]; 1351 LRESULT lResult; 1352 int nPartArray[1] = {-1}; 1353 1354 TRACE("(%p)->(state=%x) stub\n",This, uState); 1355 1356 /*don't do anything if the state isn't really changing*/ 1357 if(This->uState == uState) 1358 { 1359 return S_OK; 1360 } 1361 1362 /*OnActivate handles the menu merging and internal state*/ 1363 ShellView_OnActivate(This, uState); 1364 1365 /*only do This if we are active*/ 1366 if(uState != SVUIA_DEACTIVATE) 1367 { 1368 1369 IShellFolder_GetFolderPath( This->pSFParent, szName, sizeof(szName) ); 1370 1371 /* set the number of parts */ 1372 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETPARTS, 1, 1373 (LPARAM)nPartArray, &lResult); 1374 1375 /* set the text for the parts */ 1376 IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_STATUS, SB_SETTEXTA, 1377 0, (LPARAM)szName, &lResult); 1378 } 1379 1380 return S_OK; 1239 1381 } 1240 1382 1241 1383 static HRESULT WINAPI IShellView_fnRefresh(IShellView * iface) 1242 1384 { 1243 1244 1245 1246 1247 1248 1249 1250 1385 ICOM_THIS(IShellViewImpl, iface); 1386 1387 TRACE("(%p)\n",This); 1388 1389 ListView_DeleteAllItems(This->hWndList); 1390 ShellView_FillList(This); 1391 1392 return S_OK; 1251 1393 } 1252 1394 1253 1395 static HRESULT WINAPI IShellView_fnCreateViewWindow( 1254 1255 1256 1257 1258 1259 1260 { 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1396 IShellView * iface, 1397 IShellView *lpPrevView, 1398 LPCFOLDERSETTINGS lpfs, 1399 IShellBrowser * psb, 1400 RECT * prcView, 1401 HWND *phWnd) 1402 { 1403 ICOM_THIS(IShellViewImpl, iface); 1404 1405 WNDCLASSA wc; 1406 *phWnd = 0; 1407 1408 1409 TRACE("(%p)->(shlview=%p set=%p shlbrs=%p rec=%p hwnd=%p) incomplete\n",This, lpPrevView,lpfs, psb, prcView, phWnd); 1410 TRACE("-- vmode=%x flags=%x left=%i top=%i right=%i bottom=%i\n",lpfs->ViewMode, lpfs->fFlags ,prcView->left,prcView->top, prcView->right, prcView->bottom); 1411 1412 /*set up the member variables*/ 1413 This->pShellBrowser = psb; 1414 This->FolderSettings = *lpfs; 1415 1416 /*get our parent window*/ 1417 IShellBrowser_AddRef(This->pShellBrowser); 1418 IShellBrowser_GetWindow(This->pShellBrowser, &(This->hWndParent)); 1419 1420 /* try to get the ICommDlgBrowserInterface, adds a reference !!! */ 1421 This->pCommDlgBrowser=NULL; 1422 if ( SUCCEEDED (IShellBrowser_QueryInterface( This->pShellBrowser, 1423 (REFIID)&IID_ICommDlgBrowser, (LPVOID*) &This->pCommDlgBrowser))) 1424 { 1425 TRACE("-- CommDlgBrowser\n"); 1426 } 1427 1428 /*if our window class has not been registered, then do so*/ 1287 1429 //SvL: Don't check this now 1288 // 1289 // 1290 1291 wc.style= CS_HREDRAW | CS_VREDRAW;1292 wc.lpfnWndProc= (WNDPROC) ShellView_WndProc;1293 wc.cbClsExtra= 0;1294 wc.cbWndExtra= 0;1295 wc.hInstance= shell32_hInstance;1296 wc.hIcon= 0;1297 wc.hCursor= LoadCursorA (0, IDC_ARROWA);1298 wc.hbrBackground= (HBRUSH) (COLOR_WINDOW + 1);1299 wc.lpszMenuName= NULL;1300 wc.lpszClassName= SV_CLASS_NAME;1301 1302 1303 1304 // 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1430 // if(!GetClassInfoA(shell32_hInstance, SV_CLASS_NAME, &wc)) 1431 // { 1432 ZeroMemory(&wc, sizeof(wc)); 1433 wc.style = CS_HREDRAW | CS_VREDRAW; 1434 wc.lpfnWndProc = (WNDPROC) ShellView_WndProc; 1435 wc.cbClsExtra = 0; 1436 wc.cbWndExtra = 0; 1437 wc.hInstance = shell32_hInstance; 1438 wc.hIcon = 0; 1439 wc.hCursor = LoadCursorA (0, IDC_ARROWA); 1440 wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1); 1441 wc.lpszMenuName = NULL; 1442 wc.lpszClassName = SV_CLASS_NAME; 1443 1444 if(!RegisterClassA(&wc)) 1445 return E_FAIL; 1446 // } 1447 1448 *phWnd = CreateWindowExA(0, 1449 SV_CLASS_NAME, 1450 NULL, 1451 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_TABSTOP, 1452 prcView->left, 1453 prcView->top, 1454 prcView->right - prcView->left, 1455 prcView->bottom - prcView->top, 1456 This->hWndParent, 1457 0, 1458 shell32_hInstance, 1459 (LPVOID)This); 1460 1461 CheckToolbar(This); 1462 1463 if(!*phWnd) 1464 return E_FAIL; 1465 1466 return S_OK; 1325 1467 } 1326 1468 1327 1469 static HRESULT WINAPI IShellView_fnDestroyViewWindow(IShellView * iface) 1328 1470 { 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1471 ICOM_THIS(IShellViewImpl, iface); 1472 1473 TRACE("(%p)\n",This); 1474 1475 /*Make absolutely sure all our UI is cleaned up.*/ 1476 IShellView_UIActivate((IShellView*)This, SVUIA_DEACTIVATE); 1477 1478 if(This->hMenu) 1479 { 1480 DestroyMenu(This->hMenu); 1481 } 1482 1483 DestroyWindow(This->hWnd); 1484 IShellBrowser_Release(This->pShellBrowser); 1485 1486 return S_OK; 1345 1487 } 1346 1488 1347 1489 static HRESULT WINAPI IShellView_fnGetCurrentInfo(IShellView * iface, LPFOLDERSETTINGS lpfs) 1348 1490 { 1349 1350 1351 1352 1353 1354 1355 1356 1357 1491 ICOM_THIS(IShellViewImpl, iface); 1492 1493 TRACE("(%p)->(%p) vmode=%x flags=%x\n",This, lpfs, 1494 This->FolderSettings.ViewMode, This->FolderSettings.fFlags); 1495 1496 if (!lpfs) return E_INVALIDARG; 1497 1498 *lpfs = This->FolderSettings; 1499 return NOERROR; 1358 1500 } 1359 1501 1360 1502 static HRESULT WINAPI IShellView_fnAddPropertySheetPages(IShellView * iface, DWORD dwReserved,LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam) 1361 1503 { 1362 1363 1364 1365 1366 1504 ICOM_THIS(IShellViewImpl, iface); 1505 1506 FIXME("(%p) stub\n",This); 1507 1508 return E_NOTIMPL; 1367 1509 } 1368 1510 1369 1511 static HRESULT WINAPI IShellView_fnSaveViewState(IShellView * iface) 1370 1512 { 1371 1372 1373 1374 1375 1513 ICOM_THIS(IShellViewImpl, iface); 1514 1515 FIXME("(%p) stub\n",This); 1516 1517 return S_OK; 1376 1518 } 1377 1519 1378 1520 static HRESULT WINAPI IShellView_fnSelectItem(IShellView * iface, LPCITEMIDLIST pidlItem, UINT uFlags) 1379 { 1380 1381 1382 1383 1521 { ICOM_THIS(IShellViewImpl, iface); 1522 1523 FIXME("(%p)->(pidl=%p, 0x%08x) stub\n",This, pidlItem, uFlags); 1524 1525 return E_NOTIMPL; 1384 1526 } 1385 1527 1386 1528 static HRESULT WINAPI IShellView_fnGetItemObject(IShellView * iface, UINT uItem, REFIID riid, LPVOID *ppvOut) 1387 1529 { 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1530 ICOM_THIS(IShellViewImpl, iface); 1531 1532 char xriid[50]; 1533 1534 WINE_StringFromCLSID((LPCLSID)riid,xriid); 1535 TRACE("(%p)->(uItem=0x%08x,\n\tIID=%s, ppv=%p)\n",This, uItem, xriid, ppvOut); 1536 1537 *ppvOut = NULL; 1538 1539 switch(uItem) 1540 { 1541 case SVGIO_BACKGROUND: 1542 *ppvOut = ISvBgCm_Constructor(); 1543 break; 1544 1545 case SVGIO_SELECTION: 1546 ShellView_GetSelections(This); 1547 IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl, This->apidl, riid, 0, ppvOut); 1548 break; 1549 } 1550 TRACE("-- (%p)->(interface=%p)\n",This, *ppvOut); 1551 1552 if(!*ppvOut) return E_OUTOFMEMORY; 1553 1554 return S_OK; 1413 1555 } 1414 1556 1415 1557 struct ICOM_VTABLE(IShellView) svvt = 1416 { 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1558 { 1559 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 1560 IShellView_fnQueryInterface, 1561 IShellView_fnAddRef, 1562 IShellView_fnRelease, 1563 IShellView_fnGetWindow, 1564 IShellView_fnContextSensitiveHelp, 1565 IShellView_fnTranslateAccelerator, 1566 IShellView_fnEnableModeless, 1567 IShellView_fnUIActivate, 1568 IShellView_fnRefresh, 1569 IShellView_fnCreateViewWindow, 1570 IShellView_fnDestroyViewWindow, 1571 IShellView_fnGetCurrentInfo, 1572 IShellView_fnAddPropertySheetPages, 1573 IShellView_fnSaveViewState, 1574 IShellView_fnSelectItem, 1575 IShellView_fnGetItemObject 1434 1576 }; 1435 1577 … … 1439 1581 */ 1440 1582 static HRESULT WINAPI ISVOleCmdTarget_QueryInterface( 1441 IOleCommandTarget *iface,1442 REFIIDiid,1443 LPVOID*ppvObj)1444 { 1445 1446 1447 1583 IOleCommandTarget * iface, 1584 REFIID iid, 1585 LPVOID* ppvObj) 1586 { 1587 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface); 1588 1589 return IShellFolder_QueryInterface((IShellFolder*)This, iid, ppvObj); 1448 1590 } 1449 1591 … … 1452 1594 */ 1453 1595 static ULONG WINAPI ISVOleCmdTarget_AddRef( 1454 IOleCommandTarget *iface)1455 { 1456 1457 1458 1596 IOleCommandTarget * iface) 1597 { 1598 _ICOM_THIS_From_IOleCommandTarget(IShellFolder, iface); 1599 1600 return IShellFolder_AddRef((IShellFolder*)This); 1459 1601 } 1460 1602 … … 1463 1605 */ 1464 1606 static ULONG WINAPI ISVOleCmdTarget_Release( 1465 IOleCommandTarget *iface)1466 { 1467 1468 1469 1607 IOleCommandTarget * iface) 1608 { 1609 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface); 1610 1611 return IShellFolder_Release((IShellFolder*)This); 1470 1612 } 1471 1613 … … 1474 1616 */ 1475 1617 static HRESULT WINAPI ISVOleCmdTarget_QueryStatus( 1476 1477 1478 1479 1480 1481 { 1482 1483 1484 1485 1486 1487 1488 1489 1618 IOleCommandTarget *iface, 1619 const GUID* pguidCmdGroup, 1620 ULONG cCmds, 1621 OLECMD * prgCmds, 1622 OLECMDTEXT* pCmdText) 1623 { 1624 char xguid[50]; 1625 1626 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface); 1627 1628 WINE_StringFromCLSID((LPCLSID)pguidCmdGroup,xguid); 1629 1630 FIXME("(%p)->(%p(%s) 0x%08lx %p %p\n", This, pguidCmdGroup, xguid, cCmds, prgCmds, pCmdText); 1631 return E_NOTIMPL; 1490 1632 } 1491 1633 … … 1496 1638 */ 1497 1639 static HRESULT WINAPI ISVOleCmdTarget_Exec( 1498 1499 1500 1501 1502 1503 1504 { 1505 1506 1507 1508 1509 1510 1511 1512 1640 IOleCommandTarget *iface, 1641 const GUID* pguidCmdGroup, 1642 DWORD nCmdID, 1643 DWORD nCmdexecopt, 1644 VARIANT* pvaIn, 1645 VARIANT* pvaOut) 1646 { 1647 char xguid[50]; 1648 1649 _ICOM_THIS_From_IOleCommandTarget(IShellViewImpl, iface); 1650 1651 WINE_StringFromCLSID((LPCLSID)pguidCmdGroup,xguid); 1652 1653 FIXME("(%p)->(\n\tTarget GUID:%s Command:0x%08lx Opt:0x%08lx %p %p)\n", This, xguid, nCmdID, nCmdexecopt, pvaIn, pvaOut); 1654 return E_NOTIMPL; 1513 1655 } 1514 1656 1515 1657 ICOM_VTABLE(IOleCommandTarget) ctvt = 1516 1658 { 1517 1518 1519 1520 1521 1522 1659 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 1660 ISVOleCmdTarget_QueryInterface, 1661 ISVOleCmdTarget_AddRef, 1662 ISVOleCmdTarget_Release, 1663 ISVOleCmdTarget_QueryStatus, 1664 ISVOleCmdTarget_Exec 1523 1665 }; 1524 1666 … … 1528 1670 1529 1671 static HRESULT WINAPI ISVDropTarget_QueryInterface( 1530 1531 1532 1533 { 1534 charxriid[50];1535 1536 1537 1538 1539 1540 1541 1542 1672 IDropTarget *iface, 1673 REFIID riid, 1674 LPVOID *ppvObj) 1675 { 1676 char xriid[50]; 1677 1678 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); 1679 1680 WINE_StringFromCLSID((LPCLSID)riid,xriid); 1681 1682 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,xriid,ppvObj); 1683 1684 return IShellFolder_QueryInterface((IShellFolder*)This, riid, ppvObj); 1543 1685 } 1544 1686 1545 1687 static ULONG WINAPI ISVDropTarget_AddRef( IDropTarget *iface) 1546 1688 { 1547 1548 1549 1550 1551 1689 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); 1690 1691 TRACE("(%p)->(count=%lu)\n",This,This->ref); 1692 1693 return IShellFolder_AddRef((IShellFolder*)This); 1552 1694 } 1553 1695 1554 1696 static ULONG WINAPI ISVDropTarget_Release( IDropTarget *iface) 1555 1697 { 1556 1557 1558 1559 1560 1698 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); 1699 1700 TRACE("(%p)->(count=%lu)\n",This,This->ref); 1701 1702 return IShellFolder_Release((IShellFolder*)This); 1561 1703 } 1562 1704 1563 1705 static HRESULT WINAPI ISVDropTarget_DragEnter( 1564 IDropTarget*iface,1565 IDataObject*pDataObject,1566 DWORDgrfKeyState,1567 POINTLpt,1568 DWORD*pdwEffect)1569 { 1570 1571 1572 1573 1574 1575 1706 IDropTarget *iface, 1707 IDataObject *pDataObject, 1708 DWORD grfKeyState, 1709 POINTL pt, 1710 DWORD *pdwEffect) 1711 { 1712 1713 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); 1714 1715 FIXME("Stub: This=%p, DataObject=%p\n",This,pDataObject); 1716 1717 return E_NOTIMPL; 1576 1718 } 1577 1719 1578 1720 static HRESULT WINAPI ISVDropTarget_DragOver( 1579 IDropTarget*iface,1580 DWORDgrfKeyState,1581 POINTLpt,1582 DWORD*pdwEffect)1583 { 1584 1585 1586 1587 1588 1721 IDropTarget *iface, 1722 DWORD grfKeyState, 1723 POINTL pt, 1724 DWORD *pdwEffect) 1725 { 1726 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); 1727 1728 FIXME("Stub: This=%p\n",This); 1729 1730 return E_NOTIMPL; 1589 1731 } 1590 1732 1591 1733 static HRESULT WINAPI ISVDropTarget_DragLeave( 1592 IDropTarget*iface)1593 { 1594 1595 1596 1597 1598 1734 IDropTarget *iface) 1735 { 1736 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); 1737 1738 FIXME("Stub: This=%p\n",This); 1739 1740 return E_NOTIMPL; 1599 1741 } 1600 1742 1601 1743 static HRESULT WINAPI ISVDropTarget_Drop( 1602 IDropTarget*iface,1603 IDataObject*pDataObject,1604 DWORDgrfKeyState,1605 POINTLpt,1606 DWORD*pdwEffect)1607 { 1608 1609 1610 1611 1612 1744 IDropTarget *iface, 1745 IDataObject* pDataObject, 1746 DWORD grfKeyState, 1747 POINTL pt, 1748 DWORD *pdwEffect) 1749 { 1750 _ICOM_THIS_From_IDropTarget(IShellViewImpl, iface); 1751 1752 FIXME("Stub: This=%p\n",This); 1753 1754 return E_NOTIMPL; 1613 1755 } 1614 1756 1615 1757 struct ICOM_VTABLE(IDropTarget) dtvt = 1616 1758 { 1617 1618 1619 1620 1621 1622 1623 1624 1759 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 1760 ISVDropTarget_QueryInterface, 1761 ISVDropTarget_AddRef, 1762 ISVDropTarget_Release, 1763 ISVDropTarget_DragEnter, 1764 ISVDropTarget_DragOver, 1765 ISVDropTarget_DragLeave, 1766 ISVDropTarget_Drop 1625 1767 }; 1626 1768 … … 1630 1772 1631 1773 static HRESULT WINAPI ISVDropSource_QueryInterface( 1632 1633 1634 1635 { 1636 charxriid[50];1637 1638 1639 1640 1641 1642 1643 1644 1774 IDropSource *iface, 1775 REFIID riid, 1776 LPVOID *ppvObj) 1777 { 1778 char xriid[50]; 1779 1780 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface); 1781 1782 WINE_StringFromCLSID((LPCLSID)riid,xriid); 1783 1784 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,xriid,ppvObj); 1785 1786 return IShellFolder_QueryInterface((IShellFolder*)This, riid, ppvObj); 1645 1787 } 1646 1788 1647 1789 static ULONG WINAPI ISVDropSource_AddRef( IDropSource *iface) 1648 1790 { 1649 1650 1651 1652 1653 1791 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface); 1792 1793 TRACE("(%p)->(count=%lu)\n",This,This->ref); 1794 1795 return IShellFolder_AddRef((IShellFolder*)This); 1654 1796 } 1655 1797 1656 1798 static ULONG WINAPI ISVDropSource_Release( IDropSource *iface) 1657 1799 { 1658 1659 1660 1661 1662 1800 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface); 1801 1802 TRACE("(%p)->(count=%lu)\n",This,This->ref); 1803 1804 return IShellFolder_Release((IShellFolder*)This); 1663 1805 } 1664 1806 static HRESULT WINAPI ISVDropSource_QueryContinueDrag( 1665 1666 1667 1668 { 1669 1670 1671 1672 1673 1674 1675 1676 1677 1807 IDropSource *iface, 1808 BOOL fEscapePressed, 1809 DWORD grfKeyState) 1810 { 1811 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface); 1812 TRACE("(%p)\n",This); 1813 1814 if (fEscapePressed) 1815 return DRAGDROP_S_CANCEL; 1816 else if (!(grfKeyState & MK_LBUTTON) && !(grfKeyState & MK_RBUTTON)) 1817 return DRAGDROP_S_DROP; 1818 else 1819 return NOERROR; 1678 1820 } 1679 1821 1680 1822 static HRESULT WINAPI ISVDropSource_GiveFeedback( 1681 1682 1683 { 1684 1685 1686 1687 1823 IDropSource *iface, 1824 DWORD dwEffect) 1825 { 1826 _ICOM_THIS_From_IDropSource(IShellViewImpl, iface); 1827 TRACE("(%p)\n",This); 1828 1829 return DRAGDROP_S_USEDEFAULTCURSORS; 1688 1830 } 1689 1831 1690 1832 struct ICOM_VTABLE(IDropSource) dsvt = 1691 1833 { 1692 1693 1694 1695 1696 1697 1834 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 1835 ISVDropSource_QueryInterface, 1836 ISVDropSource_AddRef, 1837 ISVDropSource_Release, 1838 ISVDropSource_QueryContinueDrag, 1839 ISVDropSource_GiveFeedback 1698 1840 }; 1699 1841 /********************************************************** … … 1702 1844 1703 1845 static HRESULT WINAPI ISVViewObject_QueryInterface( 1704 1705 1706 1707 { 1708 charxriid[50];1709 1710 1711 1712 1713 1714 1715 1716 1846 IViewObject *iface, 1847 REFIID riid, 1848 LPVOID *ppvObj) 1849 { 1850 char xriid[50]; 1851 1852 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 1853 1854 WINE_StringFromCLSID((LPCLSID)riid,xriid); 1855 1856 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,xriid,ppvObj); 1857 1858 return IShellFolder_QueryInterface((IShellFolder*)This, riid, ppvObj); 1717 1859 } 1718 1860 1719 1861 static ULONG WINAPI ISVViewObject_AddRef( IViewObject *iface) 1720 1862 { 1721 1722 1723 1724 1725 1863 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 1864 1865 TRACE("(%p)->(count=%lu)\n",This,This->ref); 1866 1867 return IShellFolder_AddRef((IShellFolder*)This); 1726 1868 } 1727 1869 1728 1870 static ULONG WINAPI ISVViewObject_Release( IViewObject *iface) 1729 1871 { 1730 1731 1732 1733 1734 1872 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 1873 1874 TRACE("(%p)->(count=%lu)\n",This,This->ref); 1875 1876 return IShellFolder_Release((IShellFolder*)This); 1735 1877 } 1736 1878 1737 1879 static HRESULT WINAPI ISVViewObject_Draw( 1738 IViewObject*iface,1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 { 1750 1751 1752 1753 1754 1755 1880 IViewObject *iface, 1881 DWORD dwDrawAspect, 1882 LONG lindex, 1883 void* pvAspect, 1884 DVTARGETDEVICE* ptd, 1885 HDC hdcTargetDev, 1886 HDC hdcDraw, 1887 LPCRECTL lprcBounds, 1888 LPCRECTL lprcWBounds, 1889 IVO_ContCallback pfnContinue, 1890 DWORD dwContinue) 1891 { 1892 1893 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 1894 1895 FIXME("Stub: This=%p\n",This); 1896 1897 return E_NOTIMPL; 1756 1898 } 1757 1899 static HRESULT WINAPI ISVViewObject_GetColorSet( 1758 IViewObject*iface,1759 1760 1761 1762 1763 1764 1765 { 1766 1767 1768 1769 1770 1771 1900 IViewObject *iface, 1901 DWORD dwDrawAspect, 1902 LONG lindex, 1903 void *pvAspect, 1904 DVTARGETDEVICE* ptd, 1905 HDC hicTargetDevice, 1906 tagLOGPALETTE** ppColorSet) 1907 { 1908 1909 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 1910 1911 FIXME("Stub: This=%p\n",This); 1912 1913 return E_NOTIMPL; 1772 1914 } 1773 1915 static HRESULT WINAPI ISVViewObject_Freeze( 1774 IViewObject*iface,1775 1776 1777 1778 1779 { 1780 1781 1782 1783 1784 1785 1916 IViewObject *iface, 1917 DWORD dwDrawAspect, 1918 LONG lindex, 1919 void* pvAspect, 1920 DWORD* pdwFreeze) 1921 { 1922 1923 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 1924 1925 FIXME("Stub: This=%p\n",This); 1926 1927 return E_NOTIMPL; 1786 1928 } 1787 1929 static HRESULT WINAPI ISVViewObject_Unfreeze( 1788 IViewObject*iface,1789 1790 { 1791 1792 1793 1794 1795 1796 1930 IViewObject *iface, 1931 DWORD dwFreeze) 1932 { 1933 1934 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 1935 1936 FIXME("Stub: This=%p\n",This); 1937 1938 return E_NOTIMPL; 1797 1939 } 1798 1940 static HRESULT WINAPI ISVViewObject_SetAdvise( 1799 IViewObject*iface,1800 1801 1802 1803 { 1804 1805 1806 1807 1808 1809 1941 IViewObject *iface, 1942 DWORD aspects, 1943 DWORD advf, 1944 IAdviseSink* pAdvSink) 1945 { 1946 1947 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 1948 1949 FIXME("Stub: This=%p\n",This); 1950 1951 return E_NOTIMPL; 1810 1952 } 1811 1953 static HRESULT WINAPI ISVViewObject_GetAdvise( 1812 IViewObject*iface,1813 1814 1815 1816 { 1817 1818 1819 1820 1821 1822 1954 IViewObject *iface, 1955 DWORD* pAspects, 1956 DWORD* pAdvf, 1957 IAdviseSink** ppAdvSink) 1958 { 1959 1960 _ICOM_THIS_From_IViewObject(IShellViewImpl, iface); 1961 1962 FIXME("Stub: This=%p\n",This); 1963 1964 return E_NOTIMPL; 1823 1965 } 1824 1966 … … 1826 1968 struct ICOM_VTABLE(IViewObject) vovt = 1827 1969 { 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1970 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 1971 ISVViewObject_QueryInterface, 1972 ISVViewObject_AddRef, 1973 ISVViewObject_Release, 1974 ISVViewObject_Draw, 1975 ISVViewObject_GetColorSet, 1976 ISVViewObject_Freeze, 1977 ISVViewObject_Unfreeze, 1978 ISVViewObject_SetAdvise, 1979 ISVViewObject_GetAdvise 1838 1980 }; 1839 1981 -
trunk/src/shell32/shv_bg_cmenu.cpp
r1214 r1558 1 /* $Id: shv_bg_cmenu.cpp,v 1. 1 1999-10-09 11:13:25 sandervlExp $ */1 /* $Id: shv_bg_cmenu.cpp,v 1.2 1999-11-02 20:38:48 phaller Exp $ */ 2 2 3 3 /* … … 8 8 9 9 /* 10 * 11 * 10 * IContextMenu 11 * ShellView Background Context Menu (shv_bg_cm) 12 12 * 13 * Copyright 1999Juergen Schmied <juergen.schmied@metronet.de>13 * Copyright 1999 Juergen Schmied <juergen.schmied@metronet.de> 14 14 */ 15 15 … … 45 45 */ 46 46 typedef struct 47 { 48 DWORDref;47 { ICOM_VTABLE(IContextMenu)* lpvtbl; 48 DWORD ref; 49 49 } BgCmImpl; 50 50 … … 57 57 static HRESULT WINAPI ISVBgCm_fnQueryInterface(IContextMenu *iface, REFIID riid, LPVOID *ppvObj) 58 58 { 59 60 61 62 59 ICOM_THIS(BgCmImpl, iface); 60 61 char xriid[50]; 62 WINE_StringFromCLSID((LPCLSID)riid,xriid); 63 63 64 64 dprintf(("SHELL32:shv_bg_cmenu: ISVBgCm_fnQueryInterface(%08xh,%s,%08xh)\n", … … 67 67 ppvObj)); 68 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 69 *ppvObj = NULL; 70 71 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ 72 { 73 *ppvObj = This; 74 } 75 else if(IsEqualIID(riid, &IID_IContextMenu)) /*IContextMenu*/ 76 { 77 *ppvObj = This; 78 } 79 else if(IsEqualIID(riid, &IID_IShellExtInit)) /*IShellExtInit*/ 80 { 81 FIXME("-- LPSHELLEXTINIT pointer requested\n"); 82 } 83 84 if(*ppvObj) 85 { 86 IUnknown_AddRef((IUnknown*)*ppvObj); 87 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); 88 return S_OK; 89 } 90 TRACE("-- Interface: E_NOINTERFACE\n"); 91 return E_NOINTERFACE; 92 92 } 93 93 … … 97 97 static ULONG WINAPI ISVBgCm_fnAddRef(IContextMenu *iface) 98 98 { 99 99 ICOM_THIS(BgCmImpl, iface); 100 100 101 101 dprintf(("SHELL32:shv_bg_cmenu: ISVBgCm_fnAddRef(%08xh,%u)\n", … … 103 103 This->ref)); 104 104 105 106 105 shell32_ObjCount++; 106 return ++(This->ref); 107 107 } 108 108 … … 112 112 static ULONG WINAPI ISVBgCm_fnRelease(IContextMenu *iface) 113 113 { 114 114 ICOM_THIS(BgCmImpl, iface); 115 115 116 116 dprintf(("SHELL32:shv_bg_cmenu: ISVBgCm_fnRelease(%08xh)\n", 117 117 This)); 118 118 119 120 121 122 123 124 125 126 127 119 shell32_ObjCount--; 120 121 if (!--(This->ref)) 122 { TRACE(" destroying IContextMenu(%p)\n",This); 123 124 HeapFree(GetProcessHeap(),0,This); 125 return 0; 126 } 127 return This->ref; 128 128 } 129 129 … … 133 133 134 134 static HRESULT WINAPI ISVBgCm_fnQueryContextMenu( 135 136 137 138 139 140 141 { 142 HMENUhMyMenu;143 UINTidMax;144 145 135 IContextMenu *iface, 136 HMENU hMenu, 137 UINT indexMenu, 138 UINT idCmdFirst, 139 UINT idCmdLast, 140 UINT uFlags) 141 { 142 HMENU hMyMenu; 143 UINT idMax; 144 145 ICOM_THIS(BgCmImpl, iface); 146 146 147 147 dprintf(("SHELL32:shv_bg_cmenu: ISVBgCm_fnQueryContextMenu(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)\n", … … 153 153 uFlags)); 154 154 155 156 157 158 159 160 161 155 hMyMenu = LoadMenuA(shell32_hInstance, "MENU_002"); 156 157 idMax = Shell_MergeMenus (hMenu, GetSubMenu(hMyMenu,0), indexMenu, idCmdFirst, idCmdLast, MM_SUBMENUSHAVEIDS); 158 159 DestroyMenu(hMyMenu); 160 161 return ResultFromShort(idMax - idCmdFirst); 162 162 } 163 163 … … 166 166 */ 167 167 static HRESULT WINAPI ISVBgCm_fnInvokeCommand( 168 169 170 { 171 172 173 LPSHELLBROWSERlpSB;174 LPSHELLVIEWlpSV;175 HWNDhWndSV;168 IContextMenu *iface, 169 LPCMINVOKECOMMANDINFO lpcmi) 170 { 171 ICOM_THIS(BgCmImpl, iface); 172 173 LPSHELLBROWSER lpSB; 174 LPSHELLVIEW lpSV; 175 HWND hWndSV; 176 176 177 177 dprintf(("SHELL32:shv_bg_cmenu: ISVBgCm_fnInvokeCommand((%p)->(invcom=%p verb=%p wnd=%x)\n", … … 181 181 lpcmi->hwnd)); 182 182 183 /* get the active IShellView */ 184 lpSB = (LPSHELLBROWSER)SendMessageA(lpcmi->hwnd, CWM_GETISHELLBROWSER,0,0); 185 IShellBrowser_QueryActiveShellView(lpSB, &lpSV); 186 IShellView_GetWindow(lpSV, &hWndSV); 187 188 if(HIWORD(lpcmi->lpVerb)) 189 { 190 TRACE("%s\n",lpcmi->lpVerb); 191 192 if (! strcmp(lpcmi->lpVerb,CMDSTR_NEWFOLDERA)) 193 { 194 FIXME("%s not implemented\n",lpcmi->lpVerb); 195 } 196 else if (! strcmp(lpcmi->lpVerb,CMDSTR_VIEWLISTA)) 197 { 198 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_LISTVIEW,0),0 ); 199 } 200 else if (! strcmp(lpcmi->lpVerb,CMDSTR_VIEWDETAILSA)) 201 { 202 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_REPORTVIEW,0),0 ); 203 } 204 else 205 { 206 FIXME("please report: unknown verb %s\n",lpcmi->lpVerb); 207 } 208 } 209 else 210 { 211 switch(LOWORD(lpcmi->lpVerb)) 212 { 213 case FCIDM_SHVIEW_BIGICON: 214 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_BIGICON,0),0 ); 215 break; 216 217 case FCIDM_SHVIEW_SMALLICON: 218 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_SMALLICON,0),0 ); 219 220 case FCIDM_SHVIEW_LISTVIEW: 221 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_LISTVIEW,0),0 ); 222 break; 223 224 case FCIDM_SHVIEW_REPORTVIEW: 225 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_REPORTVIEW,0),0 ); 226 break; 227 } 228 } 229 230 IShellView_Release(lpSV); /* QueryActiveShellView does AddRef*/ 231 return NOERROR; 183 /* get the active IShellView */ 184 lpSB = (LPSHELLBROWSER)SendMessageA(lpcmi->hwnd, CWM_GETISHELLBROWSER,0,0); 185 IShellBrowser_QueryActiveShellView(lpSB, &lpSV); 186 IShellView_GetWindow(lpSV, &hWndSV); 187 188 if(HIWORD(lpcmi->lpVerb)) 189 { 190 TRACE("%s\n",lpcmi->lpVerb); 191 192 if (! strcmp(lpcmi->lpVerb,CMDSTR_NEWFOLDERA)) 193 { 194 FIXME("%s not implemented\n",lpcmi->lpVerb); 195 } 196 else if (! strcmp(lpcmi->lpVerb,CMDSTR_VIEWLISTA)) 197 { 198 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_LISTVIEW,0),0 ); 199 } 200 else if (! strcmp(lpcmi->lpVerb,CMDSTR_VIEWDETAILSA)) 201 { 202 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_REPORTVIEW,0),0 ); 203 } 204 else 205 { 206 FIXME("please report: unknown verb %s\n",lpcmi->lpVerb); 207 } 208 } 209 else 210 { 211 /* if it's a id just pass it to the parent shv */ 212 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(LOWORD(lpcmi->lpVerb), 0),0 ); 213 } 214 215 IShellView_Release(lpSV); /* QueryActiveShellView does AddRef*/ 216 return NOERROR; 232 217 } 233 218 … … 237 222 */ 238 223 static HRESULT WINAPI ISVBgCm_fnGetCommandString( 239 240 241 242 243 244 245 { 246 224 IContextMenu *iface, 225 UINT idCommand, 226 UINT uFlags, 227 LPUINT lpReserved, 228 LPSTR lpszName, 229 UINT uMaxNameLen) 230 { 231 ICOM_THIS(BgCmImpl, iface); 247 232 248 233 dprintf(("SHELL32:shv_bg_cmenu: ISVBgCm_fnGetCommandString((%p)->(idcom=%x flags=%x %p name=%p len=%x)\n", … … 254 239 uMaxNameLen)); 255 240 256 257 258 259 260 261 262 263 264 265 { 266 267 268 269 270 271 272 241 /* test the existance of the menu items, the file dialog enables 242 the buttons according to this */ 243 if (uFlags == GCS_VALIDATEA) 244 { 245 if(HIWORD(idCommand)) 246 { 247 if (!strcmp((LPSTR)idCommand, CMDSTR_VIEWLISTA) || 248 !strcmp((LPSTR)idCommand, CMDSTR_VIEWDETAILSA) || 249 !strcmp((LPSTR)idCommand, CMDSTR_NEWFOLDERA)) 250 { 251 return NOERROR; 252 } 253 } 254 } 255 256 FIXME("unknown command string\n"); 257 return E_FAIL; 273 258 } 274 259 … … 277 262 */ 278 263 static HRESULT WINAPI ISVBgCm_fnHandleMenuMsg( 279 280 281 282 283 { 284 264 IContextMenu *iface, 265 UINT uMsg, 266 WPARAM wParam, 267 LPARAM lParam) 268 { 269 ICOM_THIS(BgCmImpl, iface); 285 270 286 271 dprintf(("SHELL32:shv_bg_cmenu: ISVBgCm_fnHandleMenuMsg((%p)->(msg=%x wp=%x lp=%lx)\n", … … 290 275 lParam)); 291 276 292 277 return E_NOTIMPL; 293 278 } 294 279 … … 298 283 */ 299 284 static struct ICOM_VTABLE(IContextMenu) cmvt = 300 { 301 302 303 304 305 306 307 308 309 (void *) 0xdeadbabe/* just paranoia (IContextMenu3) */285 { 286 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 287 ISVBgCm_fnQueryInterface, 288 ISVBgCm_fnAddRef, 289 ISVBgCm_fnRelease, 290 ISVBgCm_fnQueryContextMenu, 291 ISVBgCm_fnInvokeCommand, 292 ISVBgCm_fnGetCommandString, 293 ISVBgCm_fnHandleMenuMsg, 294 (void *) 0xdeadbabe /* just paranoia (IContextMenu3) */ 310 295 }; 311 296 … … 315 300 IContextMenu *ISvBgCm_Constructor(void) 316 301 { 317 318 319 320 321 302 BgCmImpl* cm; 303 304 cm = (BgCmImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(BgCmImpl)); 305 cm->lpvtbl=&cmvt; 306 cm->ref = 1; 322 307 323 308 dprintf(("SHELL32:shv_bg_cmenu: ISVBgCm_Constructor(%p)\n", 324 309 cm)); 325 310 326 327 328 } 329 330 311 shell32_ObjCount++; 312 return (IContextMenu*)cm; 313 } 314 315
Note:
See TracChangeset
for help on using the changeset viewer.