ReactOS 0.4.16-dev-1255-g6dd0406
CDrivesFolder.cpp
Go to the documentation of this file.
1/*
2 * Virtual Workplace folder
3 *
4 * Copyright 1997 Marcus Meissner
5 * Copyright 1998, 1999, 2002 Juergen Schmied
6 * Copyright 2009 Andrew Hill
7 * Copyright 2017-2024 Katayama Hirofumi MZ
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#include <precomp.h>
25#include <process.h>
26
28
29extern BOOL IsDriveFloppyA(LPCSTR pszDriveRoot);
30extern BOOL IsDriveFloppyW(LPCWSTR pszDriveRoot);
31
32/*
33CDrivesFolder should create a CRegFolder to represent the virtual items that exist only in
34the registry. The CRegFolder is aggregated by the CDrivesFolder.
35The CDrivesFolderEnum class should enumerate only drives on the system. Since the CRegFolder
36implementation of IShellFolder::EnumObjects enumerates the virtual items, the
37CDrivesFolderEnum is only responsible for returning the physical items.
38
392. At least on my XP system, the drive pidls returned are of type PT_DRIVE1, not PT_DRIVE
403. The parsing name returned for my computer is incorrect. It should be "My Computer"
41*/
42
43static int iDriveIconIds[7] = { IDI_SHELL_DRIVE, /* DRIVE_UNKNOWN */
44 IDI_SHELL_CDROM, /* DRIVE_NO_ROOT_DIR*/
45 IDI_SHELL_3_14_FLOPPY, /* DRIVE_REMOVABLE*/
46 IDI_SHELL_DRIVE, /* DRIVE_FIXED*/
47 IDI_SHELL_NETDRIVE, /* DRIVE_REMOTE*/
48 IDI_SHELL_CDROM, /* DRIVE_CDROM*/
49 IDI_SHELL_RAMDISK /* DRIVE_RAMDISK*/
50 };
51
52static int iDriveTypeIds[7] = { IDS_DRIVE_FIXED, /* DRIVE_UNKNOWN */
53 IDS_DRIVE_FIXED, /* DRIVE_NO_ROOT_DIR*/
54 IDS_DRIVE_FLOPPY, /* DRIVE_REMOVABLE*/
55 IDS_DRIVE_FIXED, /* DRIVE_FIXED*/
56 IDS_DRIVE_NETWORK, /* DRIVE_REMOTE*/
57 IDS_DRIVE_CDROM, /* DRIVE_CDROM*/
58 IDS_DRIVE_FIXED /* DRIVE_RAMDISK*/
59 };
60
62{
63 { CLSID_ControlPanel, NULL, REGITEMORDER_MYCOMPUTER_CONTROLS },
64};
66{
69 CLSID_MyComputer,
70 L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}",
71 L"MyComputer",
72};
73
74static const CLSID* IsRegItem(PCUITEMID_CHILD pidl)
75{
76 if (pidl && pidl->mkid.cb == 2 + 2 + sizeof(CLSID))
77 {
78 if (pidl->mkid.abID[0] == PT_SHELLEXT || pidl->mkid.abID[0] == PT_GUID) // FIXME: Remove PT_GUID when CRegFolder is fixed
79 return (const CLSID*)(&pidl->mkid.abID[2]);
80 }
81 return NULL;
82}
83
85{
86 const CLSID *pClass = IsRegItem(pidl);
87 return pClass && *pClass == clsid;
88}
89
91{
92 if (!_ILIsDrive(pidl))
93 return -1;
94 BYTE letter = ((PIDLDATA*)pidl->mkid.abID)->u.drive.szDriveName[0];
95 BYTE number = (letter | 32) - 'a';
96 return number < 26 ? number : -1;
97}
98
99template<class T> static T* GetDrivePath(PCUITEMID_CHILD pidl, T *Path)
100{
101 int number = GetDriveNumber(pidl);
102 if (number < 0)
103 return NULL;
104 Path[0] = 'A' + number;
105 Path[1] = ':';
106 Path[2] = '\\';
107 Path[3] = '\0';
108 return Path;
109}
110
112{
113 WCHAR buf[8];
114 if (GetDrivePath(pidl, buf) && IsDriveFloppyW(buf))
115 return SHDID_COMPUTER_DRIVE35; // TODO: 3.5-inch vs 5.25-inch
117}
118
120{
121 WCHAR szDrive[8];
122 if (!_ILGetDrive(pidl, szDrive, _countof(szDrive)))
123 {
124 ERR("pidl %p is not a drive\n", pidl);
125 return DRIVE_UNKNOWN;
126 }
127 return ::GetDriveTypeW(szDrive);
128}
129
131{
132 // If this function returns true, the item should be hidden in DefView but not in the Explorer folder tree.
134 wsprintfW(path, L"%s\\%s", REGSTR_PATH_EXPLORER, SubKey);
136 DWORD data = 0, size = sizeof(data);
138}
139
140/***********************************************************************
141* IShellFolder implementation
142*/
143
144#define RETRY_COUNT 3
145#define RETRY_SLEEP 250
147{
148 DWORD dwError, dwBytesReturned;
149 DWORD dwCode = (bLock ? FSCTL_LOCK_VOLUME : FSCTL_UNLOCK_VOLUME);
150 for (DWORD i = 0; i < RETRY_COUNT; ++i)
151 {
152 if (DeviceIoControl(hDrive, dwCode, NULL, 0, NULL, 0, &dwBytesReturned, NULL))
153 return TRUE;
154
155 dwError = GetLastError();
156 if (dwError == ERROR_INVALID_FUNCTION)
157 break; /* don't sleep if function is not implemented */
158
160 }
161 SetLastError(dwError);
162 return FALSE;
163}
164
165// NOTE: See also https://support.microsoft.com/en-us/help/165721/how-to-ejecting-removable-media-in-windows-nt-windows-2000-windows-xp
166static BOOL DoEjectDrive(const WCHAR *physical, UINT nDriveType, INT *pnStringID)
167{
168 /* GENERIC_WRITE isn't needed for umount */
169 DWORD dwAccessMode = GENERIC_READ;
170 DWORD dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
171
172 HANDLE hDrive = CreateFile(physical, dwAccessMode, dwShareMode, 0, OPEN_EXISTING, 0, NULL);
173 if (hDrive == INVALID_HANDLE_VALUE)
174 return FALSE;
175
176 BOOL bResult, bNeedUnlock = FALSE;
177 DWORD dwBytesReturned, dwError = NO_ERROR;
178 PREVENT_MEDIA_REMOVAL removal;
179 do
180 {
181 bResult = TryToLockOrUnlockDrive(hDrive, TRUE);
182 if (!bResult)
183 {
184 dwError = GetLastError();
185 *pnStringID = IDS_CANTLOCKVOLUME; /* Unable to lock volume */
186 break;
187 }
188 bResult = DeviceIoControl(hDrive, FSCTL_DISMOUNT_VOLUME, NULL, 0, NULL, 0, &dwBytesReturned, NULL);
189 if (!bResult)
190 {
191 dwError = GetLastError();
192 *pnStringID = IDS_CANTDISMOUNTVOLUME; /* Unable to dismount volume */
193 bNeedUnlock = TRUE;
194 break;
195 }
196 removal.PreventMediaRemoval = FALSE;
197 bResult = DeviceIoControl(hDrive, IOCTL_STORAGE_MEDIA_REMOVAL, &removal, sizeof(removal), NULL,
198 0, &dwBytesReturned, NULL);
199 if (!bResult)
200 {
201 *pnStringID = IDS_CANTEJECTMEDIA; /* Unable to eject media */
202 dwError = GetLastError();
203 bNeedUnlock = TRUE;
204 break;
205 }
206 bResult = DeviceIoControl(hDrive, IOCTL_STORAGE_EJECT_MEDIA, NULL, 0, NULL, 0, &dwBytesReturned, NULL);
207 if (!bResult)
208 {
209 *pnStringID = IDS_CANTEJECTMEDIA; /* Unable to eject media */
210 dwError = GetLastError();
211 bNeedUnlock = TRUE;
212 break;
213 }
214 } while (0);
215
216 if (bNeedUnlock)
217 {
219 }
220
221 CloseHandle(hDrive);
222
223 SetLastError(dwError);
224 return bResult;
225}
226
228{
229 UINT nDrive = PtrToUlong(args);
230 WCHAR szPath[] = { LOWORD(L'A' + nDrive), L'\0' }; // Arbitrary, just needs to include nDrive
233 if (FAILED(hr))
234 return hr;
236 return stub.DestroyWindow();
237}
238
240{
242 return succ ? S_OK : E_FAIL;
243}
244
246 HWND hwnd,
247 IDataObject *pdtobj,
248 UINT uMsg,
251{
252 if (uMsg != DFM_MERGECONTEXTMENU && uMsg != DFM_INVOKECOMMAND)
253 return SHELL32_DefaultContextMenuCallBack(psf, pdtobj, uMsg);
254
255 PIDLIST_ABSOLUTE pidlFolder;
256 PUITEMID_CHILD *apidl;
257 UINT cidl;
258 UINT nDriveType;
260 HRESULT hr = SH_GetApidlFromDataObject(pdtobj, &pidlFolder, &apidl, &cidl);
262 return hr;
263
264 WCHAR szDrive[8] = {0};
265 if (!_ILGetDrive(apidl[0], szDrive, _countof(szDrive)))
266 {
267 ERR("pidl is not a drive\n");
268 SHFree(pidlFolder);
269 _ILFreeaPidl(apidl, cidl);
270 return E_FAIL;
271 }
272 nDriveType = GetDriveTypeW(szDrive);
273 if (!GetVolumeInformationW(szDrive, NULL, 0, NULL, NULL, &dwFlags, NULL, 0))
274 {
275 if (nDriveType >= DRIVE_REMOTE)
277 else
278 dwFlags = 0; // Assume drive with unknown filesystem, allow format
279 }
280
281// custom command IDs
282#if 0 // Disabled until our menu building system is fixed
283#define CMDID_FORMAT 0
284#define CMDID_EJECT 1
285#define CMDID_DISCONNECT 2
286#else
287/* FIXME: These IDs should start from 0, however there is difference
288 * between ours and Windows' menu building systems, which should be fixed. */
289#define CMDID_FORMAT 1
290#define CMDID_EJECT 2
291#define CMDID_DISCONNECT 3
292#endif
293
294 if (uMsg == DFM_MERGECONTEXTMENU)
295 {
296 QCMINFO *pqcminfo = (QCMINFO *)lParam;
297
298 UINT idCmdFirst = pqcminfo->idCmdFirst;
299 UINT idCmd = 0;
300 if (!(dwFlags & FILE_READ_ONLY_VOLUME) && nDriveType != DRIVE_REMOTE && cidl == 1)
301 {
302 /* add separator and Format */
303 idCmd = idCmdFirst + CMDID_FORMAT;
304 _InsertMenuItemW(pqcminfo->hmenu, pqcminfo->indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0);
306 }
307 if (nDriveType == DRIVE_REMOVABLE || nDriveType == DRIVE_CDROM)
308 {
309 /* add separator and Eject */
310 idCmd = idCmdFirst + CMDID_EJECT;
311 _InsertMenuItemW(pqcminfo->hmenu, pqcminfo->indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0);
313 }
314 if (nDriveType == DRIVE_REMOTE)
315 {
316 /* add separator and Disconnect */
317 idCmd = idCmdFirst + CMDID_DISCONNECT;
318 _InsertMenuItemW(pqcminfo->hmenu, pqcminfo->indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0);
320 }
321
322 if (idCmd)
323#if 0 // see FIXME above
324 pqcminfo->idCmdFirst = ++idCmd;
325#else
326 pqcminfo->idCmdFirst = (idCmd + 2);
327#endif
328 hr = S_OK;
329 }
330 else if (uMsg == DFM_INVOKECOMMAND)
331 {
332 WCHAR wszBuf[4] = L"A:\\";
333 wszBuf[0] = (WCHAR)szDrive[0];
334
335 INT nStringID = 0;
336 DWORD dwError = NO_ERROR;
337
339 {
340 ATLASSERT(pdtobj);
342 // Not setting nStringID because SHOpenPropSheet already displayed an error box
343 }
344 else
345 {
346 if (wParam == CMDID_FORMAT)
347 {
348 hr = DoFormatDriveAsync(hwnd, szDrive[0] - 'A');
349 }
350 else if (wParam == CMDID_EJECT)
351 {
352 /* do eject */
353 WCHAR physical[10];
354 wsprintfW(physical, _T("\\\\.\\%c:"), szDrive[0]);
355
356 if (DoEjectDrive(physical, nDriveType, &nStringID))
357 {
359 }
360 else
361 {
362 dwError = GetLastError();
363 }
364 }
365 else if (wParam == CMDID_DISCONNECT)
366 {
367 /* do disconnect */
368 wszBuf[2] = UNICODE_NULL;
369 dwError = WNetCancelConnection2W(wszBuf, 0, FALSE);
370 if (dwError == NO_ERROR)
371 {
373 }
374 else
375 {
376 nStringID = IDS_CANTDISCONNECT;
377 }
378 }
379 }
380
381 if (nStringID != 0)
382 {
383 /* show error message */
384 WCHAR szFormat[128], szMessage[128];
385 LoadStringW(shell32_hInstance, nStringID, szFormat, _countof(szFormat));
386 wsprintfW(szMessage, szFormat, dwError);
387 MessageBoxW(hwnd, szMessage, NULL, MB_ICONERROR);
388 }
389 }
390
391 SHFree(pidlFolder);
392 _ILFreeaPidl(apidl, cidl);
393
394 return hr;
395}
396
398 HWND hwnd,
399 UINT cidl,
401 IShellFolder *psf,
402 IContextMenu **ppcm)
403{
404 HKEY hKeys[2];
405 UINT cKeys = 0;
406 AddClassKeyToArray(L"Drive", hKeys, &cKeys);
407 AddClassKeyToArray(L"Folder", hKeys, &cKeys);
408
409 return CDefFolderMenu_Create2(pidlFolder, hwnd, cidl, apidl, psf, DrivesContextMenuCallback, cKeys, hKeys, ppcm);
410}
411
412static HRESULT
414 LPWSTR szIconFile, UINT cchMax, int *piIndex, UINT *pwFlags)
415{
416 WCHAR wszPath[MAX_PATH];
417 WCHAR wszAutoRunInfPath[MAX_PATH];
418 WCHAR wszValue[MAX_PATH], wszTemp[MAX_PATH];
419
420 // get path
421 if (!ILGetDisplayNameExW(psf, pidl, wszPath, 0))
422 return E_FAIL;
423 if (!PathIsDirectoryW(wszPath))
424 return E_FAIL;
425
426 // build the full path of autorun.inf
427 StringCchCopyW(wszAutoRunInfPath, _countof(wszAutoRunInfPath), wszPath);
428 PathAppendW(wszAutoRunInfPath, L"autorun.inf");
429
430 // autorun.inf --> wszValue
431 if (GetPrivateProfileStringW(L"autorun", L"icon", NULL, wszValue, _countof(wszValue),
432 wszAutoRunInfPath) && wszValue[0] != 0)
433 {
434 // wszValue --> wszTemp
435 ExpandEnvironmentStringsW(wszValue, wszTemp, _countof(wszTemp));
436
437 // parse the icon location
438 *piIndex = PathParseIconLocationW(wszTemp);
439
440 // wszPath + wszTemp --> wszPath
441 if (PathIsRelativeW(wszTemp))
442 PathAppendW(wszPath, wszTemp);
443 else
444 StringCchCopyW(wszPath, _countof(wszPath), wszTemp);
445
446 // wszPath --> szIconFile
447 GetFullPathNameW(wszPath, cchMax, szIconFile, NULL);
448
449 return S_OK;
450 }
451
452 return E_FAIL;
453}
454
455static HRESULT
457{
458 WCHAR wszAutoRunInfPath[MAX_PATH];
459 WCHAR wszTemp[MAX_PATH];
460
461 if (!PathIsDirectoryW(wszPath))
462 return E_FAIL;
463
464 StringCchCopyW(wszAutoRunInfPath, _countof(wszAutoRunInfPath), wszPath);
465 PathAppendW(wszAutoRunInfPath, L"autorun.inf");
466
467 if (GetPrivateProfileStringW(L"autorun", L"label", NULL, wszTemp, _countof(wszTemp),
468 wszAutoRunInfPath) && wszTemp[0] != 0)
469 {
470 StringCchCopyW(szLabel, cchMax, wszTemp);
471 return S_OK;
472 }
473
474 return E_FAIL;
475}
476
477static inline HRESULT GetRawDriveLabel(PCWSTR DrivePath, LPWSTR szLabel, UINT cchMax)
478{
479 if (GetVolumeInformationW(DrivePath, szLabel, cchMax, NULL, NULL, NULL, NULL, 0))
480 return *szLabel ? S_OK : S_FALSE;
482}
483
484static HRESULT GetDriveLabel(PCWSTR DrivePath, LPWSTR szLabel, UINT cchMax)
485{
486 HRESULT hr = getLabelForDriveFromAutoRun(DrivePath, szLabel, cchMax);
487 return hr == S_OK ? S_OK : GetRawDriveLabel(DrivePath, szLabel, cchMax);
488}
489
491{
492 CComPtr<IDefaultExtractIconInit> initIcon;
495 return hr;
496
497 CHAR* pszDrive = _ILGetDataPointer(pidl)->u.drive.szDriveName;
498 UINT DriveType = GetDriveTypeA(pszDrive);
501
502 WCHAR wTemp[MAX_PATH];
503 int icon_idx, reg_idx;
504 UINT flags = 0;
505
506 switch (DriveType)
507 {
508 case DRIVE_FIXED:
509 case DRIVE_UNKNOWN:
510 reg_idx = IDI_SHELL_DRIVE;
511 break;
512 case DRIVE_CDROM:
513 reg_idx = IDI_SHELL_CDROM;
514 break;
515 case DRIVE_REMOTE:
516 reg_idx = IDI_SHELL_NETDRIVE;
517 break;
518 case DRIVE_REMOVABLE:
519 if (!IsDriveFloppyA(pszDrive))
520 reg_idx = IDI_SHELL_REMOVEABLE;
521 else
522 reg_idx = IDI_SHELL_3_14_FLOPPY;
523 break;
524 case DRIVE_RAMDISK:
525 reg_idx = IDI_SHELL_RAMDISK;
526 break;
528 default:
529 reg_idx = IDI_SHELL_DOCUMENT;
530 break;
531 }
532
533 hr = getIconLocationForDrive(psf, pidl, 0, wTemp, _countof(wTemp),
534 &icon_idx, &flags);
535 if (SUCCEEDED(hr))
536 {
537 initIcon->SetNormalIcon(wTemp, icon_idx);
538 }
539 else if (HLM_GetIconW(reg_idx - 1, wTemp, _countof(wTemp), &icon_idx))
540 {
541 initIcon->SetNormalIcon(wTemp, icon_idx);
542 }
543 else if ((DriveType == DRIVE_FIXED || DriveType == DRIVE_UNKNOWN) &&
544 (HCR_GetIconW(L"Drive", wTemp, NULL, _countof(wTemp), &icon_idx)))
545 {
546 initIcon->SetNormalIcon(wTemp, icon_idx);
547 }
548 else
549 {
550 if (DriveType == DRIVE_REMOVABLE && !IsDriveFloppyA(pszDrive))
551 {
552 icon_idx = IDI_SHELL_REMOVEABLE;
553 }
554 else
555 {
556 icon_idx = iDriveIconIds[DriveType];
557 }
558 initIcon->SetNormalIcon(swShell32Name, -icon_idx);
559 }
560
561 return initIcon->QueryInterface(riid, ppvOut);
562}
563
565 public CEnumIDListBase
566{
567 public:
568 HRESULT WINAPI Initialize(HWND hwndOwner, DWORD dwFlags, IEnumIDList* pRegEnumerator)
569 {
570 /* enumerate the folders */
571 if (dwFlags & SHCONTF_FOLDERS)
572 {
573 WCHAR wszDriveName[] = {'A', ':', '\\', '\0'};
574 DWORD dwDrivemap = GetLogicalDrives() & ~SHRestricted(REST_NODRIVES);
575 for (; wszDriveName[0] <= 'Z'; wszDriveName[0]++)
576 {
577 if (dwDrivemap & 1)
578 AddToEnumList(_ILCreateDrive(wszDriveName));
579 dwDrivemap >>= 1;
580 }
581 }
582
583 /* Enumerate the items of the reg folder */
584 AppendItemsFromEnumerator(pRegEnumerator);
585
586 return S_OK;
587 }
588
590 COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList)
592};
593
594/***********************************************************************
595* IShellFolder [MyComputer] implementation
596*/
597
604};
605
607 SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET |
608 SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_CANLINK;
610 SFGAO_HASSUBFOLDER | SFGAO_FOLDER | SFGAO_CANLINK;
612 SFGAO_HASSUBFOLDER | SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR |
613 SFGAO_DROPTARGET | SFGAO_HASPROPSHEET | SFGAO_CANRENAME | SFGAO_CANLINK | SFGAO_CANCOPY;
614
616{
617 pidlRoot = NULL;
619}
620
622{
623 TRACE("-- destroying IShellFolder(%p)\n", this);
625}
626
628{
629 pidlRoot = _ILCreateMyComputer(); /* my qualified pidl */
630 if (pidlRoot == NULL)
631 return E_OUTOFMEMORY;
632
633 REGFOLDERINITDATA RegInit = { static_cast<IShellFolder*>(this), &g_RegFolderInfo };
635 pidlRoot,
637
638 return hr;
639}
640
641/**************************************************************************
642* CDrivesFolder::ParseDisplayName
643*/
645 DWORD * pchEaten, PIDLIST_RELATIVE * ppidl, DWORD * pdwAttributes)
646{
648
649 TRACE("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n", this,
650 hwndOwner, pbc, lpszDisplayName, debugstr_w (lpszDisplayName),
651 pchEaten, ppidl, pdwAttributes);
652
653 if (!ppidl)
654 return hr;
655
656 *ppidl = NULL;
657
658 if (!lpszDisplayName)
659 return hr;
660
661 /* handle CLSID paths */
662 if (lpszDisplayName[0] == L':' && lpszDisplayName[1] == L':')
663 {
664 return m_regFolder->ParseDisplayName(hwndOwner, pbc, lpszDisplayName, pchEaten, ppidl,
665 pdwAttributes);
666 }
667
668 if (((L'A' <= lpszDisplayName[0] && lpszDisplayName[0] <= L'Z') ||
669 (L'a' <= lpszDisplayName[0] && lpszDisplayName[0] <= L'z')) &&
670 lpszDisplayName[1] == L':' && (lpszDisplayName[2] == L'\\' || !lpszDisplayName[2]))
671 {
672 // "C:\..."
673 WCHAR szRoot[8];
674 PathBuildRootW(szRoot, ((*lpszDisplayName - 1) & 0x1F));
675
676 if (SHIsFileSysBindCtx(pbc, NULL) != S_OK && !(BindCtx_GetMode(pbc, 0) & STGM_CREATE))
677 {
678 if (::GetDriveType(szRoot) == DRIVE_NO_ROOT_DIR)
680 }
681
682 CComHeapPtr<ITEMIDLIST> pidlTemp(_ILCreateDrive(szRoot));
683 if (!pidlTemp)
684 return E_OUTOFMEMORY;
685
686 if (lpszDisplayName[2] && lpszDisplayName[3])
687 {
688 CComPtr<IShellFolder> pChildFolder;
689 hr = BindToObject(pidlTemp, pbc, IID_PPV_ARG(IShellFolder, &pChildFolder));
691 return hr;
692
693 ULONG chEaten;
694 CComHeapPtr<ITEMIDLIST> pidlChild;
695 hr = pChildFolder->ParseDisplayName(hwndOwner, pbc, &lpszDisplayName[3], &chEaten,
696 &pidlChild, pdwAttributes);
698 return hr;
699
700 hr = SHILCombine(pidlTemp, pidlChild, ppidl);
701 }
702 else
703 {
704 *ppidl = pidlTemp.Detach();
705 if (pdwAttributes && *pdwAttributes)
706 GetAttributesOf(1, (PCUITEMID_CHILD_ARRAY)ppidl, pdwAttributes);
707 hr = S_OK;
708 }
709 }
710
711 TRACE("(%p)->(-- ret=0x%08x)\n", this, hr);
712
713 return hr;
714}
715
716/**************************************************************************
717* CDrivesFolder::EnumObjects
718*/
719HRESULT WINAPI CDrivesFolder::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
720{
721 CComPtr<IEnumIDList> pRegEnumerator;
722 m_regFolder->EnumObjects(hwndOwner, dwFlags, &pRegEnumerator);
723
724 return ShellObjectCreatorInit<CDrivesFolderEnum>(hwndOwner, dwFlags, pRegEnumerator, IID_PPV_ARG(IEnumIDList, ppEnumIDList));
725}
726
727/**************************************************************************
728* CDrivesFolder::BindToObject
729*/
731{
732 TRACE("(%p)->(pidl=%p,%p,%s,%p)\n", this,
733 pidl, pbcReserved, shdebugstr_guid(&riid), ppvOut);
734
735 if (!pidl)
736 return E_INVALIDARG;
737
738 if (_ILIsSpecialFolder(pidl))
739 return m_regFolder->BindToObject(pidl, pbcReserved, riid, ppvOut);
740
741 CHAR* pchDrive = _ILGetDataPointer(pidl)->u.drive.szDriveName;
742
743 PERSIST_FOLDER_TARGET_INFO pfti = {0};
744 pfti.dwAttributes = -1;
745 pfti.csidl = -1;
746 pfti.szTargetParsingName[0] = *pchDrive;
747 pfti.szTargetParsingName[1] = L':';
748 pfti.szTargetParsingName[2] = L'\\';
749
751 &pfti,
752 pidl,
753 &CLSID_ShellFSFolder,
754 riid,
755 ppvOut);
757 return hr;
758
759 return S_OK;
760}
761
762/**************************************************************************
763* CDrivesFolder::BindToStorage
764*/
766{
767 FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", this,
768 pidl, pbcReserved, shdebugstr_guid (&riid), ppvOut);
769
770 *ppvOut = NULL;
771 return E_NOTIMPL;
772}
773
774/**************************************************************************
775* CDrivesFolder::CompareIDs
776*/
777
779{
781
782 if (!pidl1 || !pidl2)
783 {
784 ERR("Got null pidl pointer (%Ix %p %p)!\n", lParam, pidl1, pidl2);
785 return E_INVALIDARG;
786 }
787
788 if (_ILIsSpecialFolder(pidl1) || _ILIsSpecialFolder(pidl2))
789 return m_regFolder->CompareIDs(lParam, pidl1, pidl2);
790
791 UINT iColumn = LOWORD(lParam);
792 if (!_ILIsDrive(pidl1) || !_ILIsDrive(pidl2) || iColumn >= _countof(MyComputerSFHeader))
793 return E_INVALIDARG;
794
795 CHAR* pszDrive1 = _ILGetDataPointer(pidl1)->u.drive.szDriveName;
796 CHAR* pszDrive2 = _ILGetDataPointer(pidl2)->u.drive.szDriveName;
797
798 int result;
799 switch (MyComputerSFHeader[iColumn].colnameid)
800 {
802 {
803 result = _stricmp(pszDrive1, pszDrive2);
805 break;
806 }
808 {
809 /* We want to return immediately because SHELL32_CompareDetails also compares children. */
810 return SHELL32_CompareDetails(this, lParam, pidl1, pidl2);
811 }
814 {
815 ULARGE_INTEGER Drive1Available, Drive1Total, Drive2Available, Drive2Total;
816
817 if (GetVolumeInformationA(pszDrive1, NULL, 0, NULL, NULL, NULL, NULL, 0))
818 GetDiskFreeSpaceExA(pszDrive1, &Drive1Available, &Drive1Total, NULL);
819 else
820 Drive1Available.QuadPart = Drive1Total.QuadPart = 0;
821
822 if (GetVolumeInformationA(pszDrive2, NULL, 0, NULL, NULL, NULL, NULL, 0))
823 GetDiskFreeSpaceExA(pszDrive2, &Drive2Available, &Drive2Total, NULL);
824 else
825 Drive2Available.QuadPart = Drive2Total.QuadPart = 0;
826
827 LARGE_INTEGER Diff;
828 if (lParam == 3) /* Size */
829 Diff.QuadPart = Drive1Total.QuadPart - Drive2Total.QuadPart;
830 else /* Size available */
831 Diff.QuadPart = Drive1Available.QuadPart - Drive2Available.QuadPart;
832
834 break;
835 }
838 break;
840 }
841
842 if (HRESULT_CODE(hres) == 0)
843 return SHELL32_CompareChildren(this, lParam, pidl1, pidl2);
844
845 return hres;
846}
847
848/**************************************************************************
849* CDrivesFolder::CreateViewObject
850*/
852{
853 CComPtr<IShellView> pShellView;
855
856 TRACE("(%p)->(hwnd=%p,%s,%p)\n", this,
857 hwndOwner, shdebugstr_guid (&riid), ppvOut);
858
859 if (!ppvOut)
860 return hr;
861
862 *ppvOut = NULL;
863
864 if (IsEqualIID(riid, IID_IDropTarget))
865 {
866 WARN("IDropTarget not implemented\n");
867 hr = E_NOTIMPL;
868 }
869 else if (IsEqualIID(riid, IID_IContextMenu))
870 {
871 DEFCONTEXTMENU dcm = { hwndOwner, this, pidlRoot, this };
872 hr = SHCreateDefaultContextMenu(&dcm, riid, ppvOut);
873 }
874 else if (IsEqualIID(riid, IID_IShellView))
875 {
876 SFV_CREATE sfvparams = { sizeof(SFV_CREATE), this, NULL, static_cast<IShellFolderViewCB*>(this) };
877 hr = SHCreateShellFolderView(&sfvparams, (IShellView**)ppvOut);
878 }
879 TRACE("-- (%p)->(interface=%p)\n", this, ppvOut);
880 return hr;
881}
882
883/**************************************************************************
884* CDrivesFolder::GetAttributesOf
885*/
887{
888 TRACE("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n",
889 this, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
890
891 if (cidl && !apidl)
892 return E_INVALIDARG;
893
894 if (*rgfInOut == 0)
895 *rgfInOut = ~0;
896
897 if(cidl == 0)
898 *rgfInOut &= dwComputerAttributes;
899 else
900 {
901 for (UINT i = 0; i < cidl; ++i)
902 {
903 if (_ILIsDrive(apidl[i]))
904 {
905 *rgfInOut &= dwDriveAttributes;
906
907 if (_ILGetDriveType(apidl[i]) == DRIVE_CDROM)
908 *rgfInOut &= ~SFGAO_CANRENAME; // CD-ROM drive cannot rename
909 }
910 else if (IsRegItem(apidl[i], CLSID_ControlPanel))
911 {
912 *rgfInOut &= dwControlPanelAttributes;
913 }
914 else if (_ILIsSpecialFolder(*apidl))
915 {
916 m_regFolder->GetAttributesOf(1, &apidl[i], rgfInOut);
917 }
918 else
919 {
920 ERR("Got unknown pidl type!\n");
921 }
922 }
923 }
924
925 /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
926 *rgfInOut &= ~SFGAO_VALIDATE;
927
928 TRACE("-- result=0x%08x\n", *rgfInOut);
929 return S_OK;
930}
931
932/**************************************************************************
933* CDrivesFolder::GetUIObjectOf
934*
935* PARAMETERS
936* hwndOwner [in] Parent window for any output
937* cidl [in] array size
938* apidl [in] simple pidl array
939* riid [in] Requested Interface
940* prgfInOut [ ] reserved
941* ppvObject [out] Resulting Interface
942*
943*/
945 UINT cidl, PCUITEMID_CHILD_ARRAY apidl,
946 REFIID riid, UINT *prgfInOut, LPVOID *ppvOut)
947{
948 LPVOID pObj = NULL;
950
951 TRACE("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n", this,
952 hwndOwner, cidl, apidl, shdebugstr_guid (&riid), prgfInOut, ppvOut);
953
954 if (!ppvOut)
955 return hr;
956
957 *ppvOut = NULL;
958
959 if (IsEqualIID (riid, IID_IContextMenu) && (cidl >= 1))
960 {
961 if (_ILIsDrive(apidl[0]))
962 hr = CDrivesContextMenu_CreateInstance(pidlRoot, hwndOwner, cidl, apidl, static_cast<IShellFolder*>(this), (IContextMenu**)&pObj);
963 else
964 hr = m_regFolder->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, &pObj);
965 }
966 else if (IsEqualIID (riid, IID_IDataObject) && (cidl >= 1))
967 {
968 hr = IDataObject_Constructor(hwndOwner,
969 pidlRoot, apidl, cidl, TRUE, (IDataObject **)&pObj);
970 }
971 else if ((IsEqualIID (riid, IID_IExtractIconA) || IsEqualIID (riid, IID_IExtractIconW)) && (cidl == 1))
972 {
973 if (_ILIsDrive(apidl[0]))
974 hr = CDrivesExtractIcon_CreateInstance(this, apidl[0], riid, &pObj);
975 else
976 hr = m_regFolder->GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, &pObj);
977 }
978 else if (IsEqualIID (riid, IID_IDropTarget) && (cidl == 1))
979 {
980 CComPtr<IShellFolder> psfChild;
981 hr = this->BindToObject(apidl[0], NULL, IID_PPV_ARG(IShellFolder, &psfChild));
983 return hr;
984
985 return psfChild->CreateViewObject(NULL, riid, ppvOut);
986 }
987 else
989
990 if (SUCCEEDED(hr) && !pObj)
992
993 *ppvOut = pObj;
994 TRACE("(%p)->hr=0x%08x\n", this, hr);
995 return hr;
996}
997
998/**************************************************************************
999* CDrivesFolder::GetDisplayNameOf
1000*/
1002{
1003 WCHAR szDrive[8];
1004
1005 TRACE("(%p)->(pidl=%p,0x%08x,%p)\n", this, pidl, dwFlags, strRet);
1006 pdump (pidl);
1007
1008 if (!strRet)
1009 return E_INVALIDARG;
1010
1011 if (!_ILIsPidlSimple (pidl))
1012 {
1013 return SHELL32_GetDisplayNameOfChild(this, pidl, dwFlags, strRet);
1014 }
1015 else if (_ILIsSpecialFolder(pidl))
1016 {
1017 return m_regFolder->GetDisplayNameOf(pidl, dwFlags, strRet);
1018 }
1019 else if (!GetDrivePath(pidl, szDrive))
1020 {
1021 ERR("Wrong pidl type\n");
1022 return E_INVALIDARG;
1023 }
1024
1025 PWSTR pszPath = (LPWSTR)CoTaskMemAlloc((MAX_PATH + 1) * sizeof(WCHAR));
1026 if (!pszPath)
1027 return E_OUTOFMEMORY;
1028 pszPath[0] = UNICODE_NULL;
1029 szDrive[0] &= ~32; // Always uppercase
1030
1031 /* long view "lw_name (C:)" */
1033 if (!(dwFlags & SHGDN_FORPARSING))
1034 {
1035 if (m_DriveDisplayMode < 0)
1036 {
1037 DWORD err, type, data, cb = sizeof(data);
1038 err = SHRegGetUSValueW(L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
1039 L"ShowDriveLettersFirst", &type, &data, &cb, FALSE, NULL, 0);
1040 m_DriveDisplayMode = (!err && type == REG_DWORD && cb == sizeof(data)) ? (BYTE)data : 0;
1041 }
1042 BOOL bRemoteFirst = m_DriveDisplayMode == 1;
1043 BOOL bNoLetter = m_DriveDisplayMode == 2;
1044 BOOL bAllFirst = m_DriveDisplayMode == 4;
1045 PWSTR pszLabel = pszPath;
1046
1047 if (!bNoLetter && (bAllFirst || (bRemoteFirst && GetDriveTypeW(szDrive) == DRIVE_REMOTE)))
1048 {
1049 bNoLetter = TRUE; // Handling the letter now, don't append it again later
1050 if (!bEditLabel)
1051 pszLabel += wsprintfW(pszPath, L"(%c:) ", szDrive[0]);
1052 }
1053
1054 if (GetDriveLabel(szDrive, pszLabel, MAX_PATH - 7) != S_OK && !bEditLabel)
1055 {
1056 UINT ResourceId = 0;
1057 switch (GetDriveTypeW(szDrive))
1058 {
1059 case DRIVE_REMOVABLE: ResourceId = IDS_DRIVE_REMOVABLE; break; // TODO: Floppy (cached)
1060 case DRIVE_FIXED: ResourceId = IDS_DRIVE_FIXED; break;
1062 case DRIVE_CDROM: ResourceId = IDS_DRIVE_CDROM; break;
1063 }
1064 if (ResourceId)
1065 {
1067 if (len > MAX_PATH - 7)
1068 pszLabel[MAX_PATH-7] = UNICODE_NULL;
1069 }
1070 }
1071
1072 if (!*pszLabel && !bEditLabel) // No label nor fallback description, use SHGDN_FORPARSING
1073 *pszPath = UNICODE_NULL;
1074 else if (!bNoLetter && !bEditLabel)
1075 wsprintfW(pszPath + wcslen(pszPath), L" (%c:)", szDrive[0]);
1076 }
1077
1078 if (!*pszPath && !bEditLabel) // SHGDN_FORPARSING or failure above (except editing empty label)
1079 {
1081 szDrive[2] = UNICODE_NULL; // Remove backslash
1082 wcscpy(pszPath, szDrive);
1083 }
1084 strRet->uType = STRRET_WSTR;
1085 strRet->pOleStr = pszPath;
1086
1087 TRACE("-- (%p)->(%s)\n", this, strRet->uType == STRRET_CSTR ? strRet->cStr : debugstr_w(strRet->pOleStr));
1088 return S_OK;
1089}
1090
1091/**************************************************************************
1092* CDrivesFolder::SetNameOf
1093* Changes the name of a file object or subfolder, possibly changing its item
1094* identifier in the process.
1095*
1096* PARAMETERS
1097* hwndOwner [in] Owner window for output
1098* pidl [in] simple pidl of item to change
1099* lpszName [in] the items new display name
1100* dwFlags [in] SHGNO formatting flags
1101* ppidlOut [out] simple pidl returned
1102*/
1104 LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut)
1105{
1106 if (_ILIsDrive(pidl))
1107 {
1108 WCHAR szDrive[8];
1109 HRESULT hr = GetDrivePath(pidl, szDrive) ? SetDriveLabel(hwndOwner, szDrive, lpName) : E_FAIL;
1110 if (pPidlOut)
1111 *pPidlOut = SUCCEEDED(hr) ? _ILCreateDrive(szDrive) : NULL;
1112 return hr;
1113 }
1114 return m_regFolder->SetNameOf(hwndOwner, pidl, lpName, dwFlags, pPidlOut);
1115}
1116
1118{
1120 if (SUCCEEDED(hr))
1121 SHChangeNotify(SHCNE_RENAMEFOLDER, SHCNF_PATHW, DrivePath, DrivePath); // DisplayName changed
1122 else if (hwndOwner)
1123 SHELL_ErrorBox(hwndOwner, hr);
1124 return hr;
1125}
1126
1128{
1129 FIXME("(%p)\n", this);
1130 return E_NOTIMPL;
1131}
1132
1134{
1135 FIXME("(%p)\n", this);
1136 return E_NOTIMPL;
1137}
1138
1140{
1141 TRACE("(%p)\n", this);
1142
1143 if (pSort)
1144 *pSort = 0;
1145 if (pDisplay)
1146 *pDisplay = 0;
1147 return S_OK;
1148}
1149
1151{
1152 TRACE("(%p)\n", this);
1153
1154 if (!pcsFlags || iColumn >= _countof(MyComputerSFHeader))
1155 return E_INVALIDARG;
1156 *pcsFlags = MyComputerSFHeader[iColumn].colstate;
1157 return S_OK;
1158}
1159
1161{
1162 const CLSID *pCLSID = IsRegItem(pidl);
1163 if (pscid->fmtid == FMTID_ShellDetails)
1164 {
1165 switch (pscid->pid)
1166 {
1167 case PID_DESCRIPTIONID:
1168 {
1169 if (pCLSID)
1172 switch (_ILGetDriveType(pidl))
1173 {
1174 case DRIVE_REMOVABLE: id = _ILGetRemovableTypeId(pidl); break;
1175 case DRIVE_FIXED: id = SHDID_COMPUTER_FIXED; break;
1176 case DRIVE_REMOTE: id = SHDID_COMPUTER_NETDRIVE; break;
1177 case DRIVE_CDROM: id = SHDID_COMPUTER_CDROM; break;
1178 case DRIVE_RAMDISK: id = SHDID_COMPUTER_RAMDISK; break;
1179 }
1180 return SHELL_CreateSHDESCRIPTIONID(pv, id, &CLSID_NULL);
1181 }
1182 }
1183 }
1184 if (pCLSID)
1185 return m_regFolder->GetDetailsEx(pidl, pscid, pv);
1186 return SH32_GetDetailsOfPKeyAsVariant(this, pidl, pscid, pv, FALSE);
1187}
1188
1190{
1191 HRESULT hr;
1192
1193 TRACE("(%p)->(%p %i %p)\n", this, pidl, iColumn, psd);
1194
1195 if (!psd || iColumn >= _countof(MyComputerSFHeader))
1196 return E_INVALIDARG;
1197
1198 if (!pidl)
1199 {
1200 psd->fmt = MyComputerSFHeader[iColumn].fmt;
1201 psd->cxChar = MyComputerSFHeader[iColumn].cxChar;
1202 return SHSetStrRet(&psd->str, MyComputerSFHeader[iColumn].colnameid);
1203 }
1204 else if (!_ILIsDrive(pidl))
1205 {
1206 switch (MyComputerSFHeader[iColumn].colnameid)
1207 {
1209 return m_regFolder->GetDetailsOf(pidl, SHFSF_COL_NAME, psd);
1211 return m_regFolder->GetDetailsOf(pidl, SHFSF_COL_TYPE, psd);
1214 return SHSetStrRetEmpty(&psd->str);
1216 return m_regFolder->GetDetailsOf(pidl, SHFSF_COL_COMMENT, psd);
1218 }
1219 }
1220 else
1221 {
1222 ULARGE_INTEGER ulTotalBytes, ulFreeBytes;
1223 CHAR* pszDrive = _ILGetDataPointer(pidl)->u.drive.szDriveName;
1224 UINT DriveType = GetDriveTypeA(pszDrive);
1227
1228 switch (MyComputerSFHeader[iColumn].colnameid)
1229 {
1232 break;
1234 if (DriveType == DRIVE_REMOVABLE && !IsDriveFloppyA(pszDrive))
1235 hr = SHSetStrRet(&psd->str, IDS_DRIVE_REMOVABLE);
1236 else
1237 hr = SHSetStrRet(&psd->str, iDriveTypeIds[DriveType]);
1238 break;
1241 psd->str.cStr[0] = 0x00;
1242 psd->str.uType = STRRET_CSTR;
1243 if (GetVolumeInformationA(pszDrive, NULL, 0, NULL, NULL, NULL, NULL, 0))
1244 {
1245 GetDiskFreeSpaceExA(pszDrive, &ulFreeBytes, &ulTotalBytes, NULL);
1246 if (iColumn == 2)
1247 StrFormatByteSize64A(ulTotalBytes.QuadPart, psd->str.cStr, MAX_PATH);
1248 else
1249 StrFormatByteSize64A(ulFreeBytes.QuadPart, psd->str.cStr, MAX_PATH);
1250 }
1251 hr = S_OK;
1252 break;
1254 hr = SHSetStrRet(&psd->str, ""); /* FIXME: comments */
1255 break;
1257 }
1258 }
1259
1260 return hr;
1261}
1262
1264{
1265 switch (column < _countof(MyComputerSFHeader) ? MyComputerSFHeader[column].colnameid : ~0UL)
1266 {
1267 case IDS_SHV_COLUMN_NAME: return MakeSCID(*pscid, FMTID_Storage, PID_STG_NAME);
1268 case IDS_SHV_COLUMN_TYPE: return MakeSCID(*pscid, FMTID_Storage, PID_STG_STORAGETYPE);
1269 case IDS_SHV_COLUMN_COMMENTS: return MakeSCID(*pscid, FMTID_SummaryInformation, PIDSI_COMMENTS);
1270 }
1271 return E_INVALIDARG;
1272}
1273
1274/************************************************************************
1275 * CDrivesFolder::GetClassID
1276 */
1278{
1279 TRACE("(%p)\n", this);
1280
1281 if (!lpClassId)
1282 return E_POINTER;
1283
1284 *lpClassId = CLSID_MyComputer;
1285 return S_OK;
1286}
1287
1288/************************************************************************
1289 * CDrivesFolder::Initialize
1290 *
1291 * NOTES: it makes no sense to change the pidl
1292 */
1294{
1295 return S_OK;
1296}
1297
1298/**************************************************************************
1299 * CDrivesFolder::GetCurFolder
1300 */
1302{
1303 TRACE("(%p)->(%p)\n", this, pidl);
1304
1305 if (!pidl)
1306 return E_INVALIDARG; /* xp doesn't have this check and crashes on NULL */
1307
1308 *pidl = ILClone(pidlRoot);
1309 return S_OK;
1310}
1311
1312/**************************************************************************
1313 * CDrivesFolder::ShouldShow
1314 */
1316{
1317 if (const CLSID* pClsid = IsRegItem(pidlItem))
1318 return SHELL32_IsShellFolderNamespaceItemHidden(L"HideMyComputerIcons", *pClsid) ? S_FALSE : S_OK;
1319 return S_OK;
1320}
1321
1322/**************************************************************************
1323 * CDrivesFolder::MessageSFVCB (IShellFolderViewCB)
1324 */
1326{
1327 switch (uMsg)
1328 {
1329 case SFVM_FSNOTIFY:
1330 if (lParam == SHCNE_DRIVEADD && wParam)
1331 {
1333 if (drive >= 0 && ((1UL << drive) & SHRestricted(REST_NODRIVES)))
1334 return S_FALSE;
1335 }
1336 break;
1337 }
1338 return E_NOTIMPL;
1339}
1340
1341/************************************************************************/
1342/* IContextMenuCB interface */
1343
1345{
1346 enum { IDC_PROPERTIES };
1347 /* no data object means no selection */
1348 if (!pdtobj)
1349 {
1350 if (uMsg == DFM_INVOKECOMMAND && wParam == IDC_PROPERTIES)
1351 {
1352 // "System" properties
1353 return SHELL_ExecuteControlPanelCPL(hwndOwner, L"sysdm.cpl") ? S_OK : E_FAIL;
1354 }
1355 else if (uMsg == DFM_MERGECONTEXTMENU) // TODO: DFM_MERGECONTEXTMENU_BOTTOM
1356 {
1357 QCMINFO *pqcminfo = (QCMINFO *)lParam;
1358 HMENU hpopup = CreatePopupMenu();
1360 pqcminfo->idCmdFirst = Shell_MergeMenus(pqcminfo->hmenu, hpopup, pqcminfo->indexMenu, pqcminfo->idCmdFirst, pqcminfo->idCmdLast, MM_ADDSEPARATOR);
1361 DestroyMenu(hpopup);
1362 return S_OK;
1363 }
1364 }
1365 return SHELL32_DefaultContextMenuCallBack(psf, pdtobj, uMsg);
1366}
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
static const REGFOLDERINFO g_RegFolderInfo
static const CLSID * IsRegItem(LPCITEMIDLIST pidl)
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:4800
HRESULT WINAPI SHCreateDefaultContextMenu(const DEFCONTEXTMENU *pdcm, REFIID riid, void **ppv)
HRESULT WINAPI CDefFolderMenu_Create2(PCIDLIST_ABSOLUTE pidlFolder, HWND hwnd, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, IShellFolder *psf, LPFNDFMCALLBACK lpfn, UINT nKeys, const HKEY *ahkeyClsKeys, IContextMenu **ppcm)
BOOL SHELL32_IsShellFolderNamespaceItemHidden(LPCWSTR SubKey, REFCLSID Clsid)
static HRESULT getIconLocationForDrive(IShellFolder *psf, PCITEMID_CHILD pidl, UINT uFlags, LPWSTR szIconFile, UINT cchMax, int *piIndex, UINT *pwFlags)
BOOL _ILGetDriveType(LPCITEMIDLIST pidl)
static HRESULT DoFormatDriveAsync(HWND hwnd, UINT nDrive)
static UINT _ILGetRemovableTypeId(LPCITEMIDLIST pidl)
#define RETRY_COUNT
HRESULT CDrivesContextMenu_CreateInstance(PCIDLIST_ABSOLUTE pidlFolder, HWND hwnd, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, IShellFolder *psf, IContextMenu **ppcm)
#define CMDID_FORMAT
static const CLSID * IsRegItem(PCUITEMID_CHILD pidl)
static BOOL TryToLockOrUnlockDrive(HANDLE hDrive, BOOL bLock)
HRESULT CALLBACK DrivesContextMenuCallback(IShellFolder *psf, HWND hwnd, IDataObject *pdtobj, UINT uMsg, WPARAM wParam, LPARAM lParam)
static T * GetDrivePath(PCUITEMID_CHILD pidl, T *Path)
static BOOL DoEjectDrive(const WCHAR *physical, UINT nDriveType, INT *pnStringID)
static const DWORD dwComputerAttributes
BOOL SHELL32_IsShellFolderNamespaceItemHidden(LPCWSTR SubKey, REFCLSID Clsid)
static const REGFOLDERINFO g_RegFolderInfo
static HRESULT GetRawDriveLabel(PCWSTR DrivePath, LPWSTR szLabel, UINT cchMax)
static int iDriveIconIds[7]
static const shvheader MyComputerSFHeader[]
static int iDriveTypeIds[7]
static INT8 GetDriveNumber(PCUITEMID_CHILD pidl)
#define CMDID_EJECT
BOOL IsDriveFloppyA(LPCSTR pszDriveRoot)
Definition: drvdefext.cpp:386
static const REQUIREDREGITEM g_RequiredItems[]
BOOL IsDriveFloppyW(LPCWSTR pszDriveRoot)
Definition: drvdefext.cpp:320
static HRESULT getLabelForDriveFromAutoRun(PCWSTR wszPath, LPWSTR szLabel, UINT cchMax)
static const DWORD dwDriveAttributes
static const DWORD dwControlPanelAttributes
#define CMDID_DISCONNECT
#define RETRY_SLEEP
static HRESULT GetDriveLabel(PCWSTR DrivePath, LPWSTR szLabel, UINT cchMax)
static DWORD CALLBACK DoFormatDriveThread(LPVOID args)
HRESULT CDrivesExtractIcon_CreateInstance(IShellFolder *psf, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
HRESULT WINAPI SHCreateDefaultExtractIcon(REFIID riid, void **ppv)
HRESULT IDataObject_Constructor(HWND hwndOwner, PCIDLIST_ABSOLUTE pMyPidl, PCUIDLIST_RELATIVE_ARRAY apidl, UINT cidl, BOOL bExtendedObject, IDataObject **dataObject)
HRESULT CRegFolder_CreateInstance(PREGFOLDERINITDATA pInit, LPCITEMIDLIST pidlRoot, REFIID riid, void **ppv)
UINT DriveType
INT ResourceId
Definition: LoadImageGCC.c:72
signed char INT8
PRTL_UNICODE_STRING_BUFFER Path
#define shell32_hInstance
UINT cchMax
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
#define IDS_PROPERTIES
Definition: resource.h:108
PWCHAR Label
Definition: format.c:70
#define STDMETHODIMP
Definition: basetyps.h:43
#define _stricmp
Definition: cat.c:22
EXTERN_C void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
HRESULT WINAPI Initialize(HWND hwndOwner, DWORD dwFlags, IEnumIDList *pRegEnumerator)
STDMETHOD() GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, LPVOID *ppvOut) override
STDMETHOD() GetCurFolder(PIDLIST_ABSOLUTE *pidl) override
STDMETHOD() GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut) override
STDMETHOD() GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet) override
STDMETHOD() Initialize(PCIDLIST_ABSOLUTE pidl) override
STDMETHOD() EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList) override
STDMETHOD() GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd) override
STDMETHOD() BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
STDMETHOD() GetDefaultSearchGUID(GUID *pguid) override
STDMETHOD() CallBack(IShellFolder *psf, HWND hwndOwner, IDataObject *pdtobj, UINT uMsg, WPARAM wParam, LPARAM lParam) override
STDMETHOD() ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes) override
STDMETHOD() ShouldShow(IShellFolder *psf, PCIDLIST_ABSOLUTE pidlFolder, PCUITEMID_CHILD pidlItem) override
STDMETHODIMP MessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM lParam) override
STDMETHOD() GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags) override
STDMETHOD() GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv) override
STDMETHOD() GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay) override
STDMETHOD() MapColumnToSCID(UINT column, SHCOLUMNID *pscid) override
CComPtr< IShellFolder2 > m_regFolder
Definition: CDrivesFolder.h:38
static HRESULT SetDriveLabel(HWND hwndOwner, PCWSTR DrivePath, PCWSTR Label)
STDMETHOD() CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut) override
LPITEMIDLIST pidlRoot
Definition: CDrivesFolder.h:37
INT8 m_DriveDisplayMode
Definition: CDrivesFolder.h:39
STDMETHOD() CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2) override
HRESULT WINAPI FinalConstruct()
STDMETHOD() SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut) override
STDMETHOD() BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
STDMETHOD() GetClassID(CLSID *lpClassId) override
STDMETHOD() EnumSearches(IEnumExtraSearch **ppenum) override
BOOL AddToEnumList(LPITEMIDLIST pidl)
HRESULT AppendItemsFromEnumerator(IEnumIDList *pEnum)
@ TYPE_FORMATDRIVE
Definition: precomp.h:200
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
wcscpy
#define CHARS_IN_GUID
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
void pdump(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:322
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:438
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define IDS_SHV_COLUMN_TYPE
Definition: resource.h:89
#define IDS_SHV_COLUMN_NAME
Definition: resource.h:88
#define IDC_PROPERTIES
Definition: resource.h:32
#define GET_SHGDN_RELATION(dwFlags)
Definition: precomp.h:53
#define DFM_MERGECONTEXTMENU
Definition: precomp.h:44
#define DFM_INVOKECOMMAND
Definition: precomp.h:45
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1931
UINT uFlags
Definition: api.c:59
BOOL WINAPI _ILIsPidlSimple(LPCITEMIDLIST pidl)
#define CloseHandle
Definition: compat.h:739
#define OPEN_EXISTING
Definition: compat.h:775
#define SetLastError(x)
Definition: compat.h:752
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define CALLBACK
Definition: compat.h:35
#define FILE_SHARE_READ
Definition: compat.h:136
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
UINT WINAPI GetDriveTypeA(IN LPCSTR lpRootPathName)
Definition: disk.c:468
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
BOOL WINAPI GetDiskFreeSpaceExA(IN LPCSTR lpDirectoryName OPTIONAL, OUT PULARGE_INTEGER lpFreeBytesAvailableToCaller, OUT PULARGE_INTEGER lpTotalNumberOfBytes, OUT PULARGE_INTEGER lpTotalNumberOfFreeBytes)
Definition: disk.c:313
BOOL WINAPI GetVolumeInformationW(IN LPCWSTR lpRootPathName, IN LPWSTR lpVolumeNameBuffer, IN DWORD nVolumeNameSize, OUT LPDWORD lpVolumeSerialNumber OPTIONAL, OUT LPDWORD lpMaximumComponentLength OPTIONAL, OUT LPDWORD lpFileSystemFlags OPTIONAL, OUT LPWSTR lpFileSystemNameBuffer OPTIONAL, IN DWORD nFileSystemNameSize)
Definition: volume.c:226
BOOL WINAPI GetVolumeInformationA(IN LPCSTR lpRootPathName, IN LPSTR lpVolumeNameBuffer, IN DWORD nVolumeNameSize, OUT LPDWORD lpVolumeSerialNumber OPTIONAL, OUT LPDWORD lpMaximumComponentLength OPTIONAL, OUT LPDWORD lpFileSystemFlags OPTIONAL, OUT LPSTR lpFileSystemNameBuffer OPTIONAL, IN DWORD nFileSystemNameSize)
Definition: volume.c:32
BOOL WINAPI SetVolumeLabelW(IN LPCWSTR lpRootPathName, IN LPCWSTR lpVolumeName OPTIONAL)
Definition: volume.c:503
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
INT WINAPI GetPrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR def_val, LPWSTR buffer, UINT len, LPCWSTR filename)
Definition: profile.c:1142
BOOL WINAPI PathIsRelativeW(const WCHAR *path)
Definition: path.c:973
int WINAPI PathParseIconLocationW(WCHAR *path)
Definition: path.c:2587
LONG WINAPI SHRegGetUSValueW(const WCHAR *subkey, const WCHAR *value, DWORD *type, void *data, DWORD *data_len, BOOL ignore_hkcu, void *default_data, DWORD default_data_len)
Definition: registry.c:4077
INT WINAPI DECLSPEC_HOTPATCH LoadStringW(HINSTANCE instance, UINT resource_id, LPWSTR buffer, INT buflen)
Definition: string.c:1220
DWORD WINAPI DECLSPEC_HOTPATCH GetLogicalDrives(void)
Definition: volume.c:513
#define RRF_RT_DWORD
Definition: driver.c:581
DWORD WINAPI SHFormatDrive(HWND hwnd, UINT drive, UINT fmtID, UINT options)
Definition: drive.cpp:762
#define SHELL_ExecuteControlPanelCPL(hwnd, cpl)
Definition: precomp.h:188
DWORD BindCtx_GetMode(_In_ IBindCtx *pbc, _In_ DWORD dwDefault)
Definition: utils.cpp:278
HRESULT SHIsFileSysBindCtx(_In_ IBindCtx *pBindCtx, _Out_opt_ WIN32_FIND_DATAW *pFindData)
Definition: utils.cpp:303
HRESULT SHELL32_DefaultContextMenuCallBack(IShellFolder *psf, IDataObject *pdo, UINT msg)
Definition: shlfolder.cpp:613
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
LPWSTR WINAPI PathBuildRootW(LPWSTR lpszPath, int drive)
Definition: path.c:348
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1729
LPSTR WINAPI StrFormatByteSize64A(LONGLONG llBytes, LPSTR lpszDest, UINT cchMax)
Definition: string.c:2502
BOOL WINAPI SHCreateThread(LPTHREAD_START_ROUTINE pfnThreadProc, VOID *pData, DWORD dwFlags, LPTHREAD_START_ROUTINE pfnCallback)
Definition: thread.c:356
#define FAILED_UNEXPECTEDLY
Definition: utils.cpp:30
#define UlongToPtr(u)
Definition: config.h:106
#define PtrToUlong(u)
Definition: config.h:107
BOOL IsDriveFloppyA(LPCSTR pszDriveRoot)
Definition: drvdefext.cpp:386
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
WCHAR swShell32Name[MAX_PATH]
Definition: folders.cpp:22
#define FILE_READ_ONLY_VOLUME
Definition: from_kernel.h:246
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLbitfield flags
Definition: glext.h:7161
GLuint64EXT * result
Definition: glext.h:11304
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT SHELL32_ShowFilesystemItemPropertiesDialogAsync(IDataObject *pDO)
Definition: item_prop.cpp:157
#define debugstr_w
Definition: kernel32.h:32
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:581
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:601
#define END_COM_MAP()
Definition: atlcom.h:592
#define T
Definition: mbstring.h:31
#define PT_COMPUTER_REGITEM
Definition: lnktool.cpp:39
#define HResultFromWin32
Definition: loader.cpp:14
#define DRIVE_CDROM
Definition: machpc98.h:119
LPCWSTR szPath
Definition: env.c:37
static unsigned int number
Definition: dsound.c:1479
HRESULT hres
Definition: protocol.c:465
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
static LPOLESTR
Definition: stg_prop.c:27
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
REFCLSID clsid
Definition: msctf.c:82
unsigned int UINT
Definition: ndis.h:50
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FSCTL_LOCK_VOLUME
Definition: nt_native.h:832
#define FSCTL_UNLOCK_VOLUME
Definition: nt_native.h:833
#define FSCTL_DISMOUNT_VOLUME
Definition: nt_native.h:834
#define DEFAULT_UNREACHABLE
#define UNICODE_NULL
#define IOCTL_STORAGE_EJECT_MEDIA
Definition: ntddstor.h:107
#define IOCTL_STORAGE_MEDIA_REMOVAL
Definition: ntddstor.h:104
#define PID_STG_STORAGETYPE
Definition: ntquery.h:50
#define PID_STG_NAME
Definition: ntquery.h:56
#define L(x)
Definition: ntvdm.h:50
#define STGM_CREATE
Definition: objbase.h:926
interface IBindCtx * LPBC
Definition: objfwd.h:18
const FMTID FMTID_SummaryInformation
const GUID IID_IDataObject
#define PathAppendW
Definition: pathcch.h:309
#define LOWORD(l)
Definition: pedump.c:82
LPITEMIDLIST _ILCreateMyComputer(void)
Definition: pidl.c:1798
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:237
LPITEMIDLIST _ILCreateDrive(LPCWSTR lpszNew)
Definition: pidl.c:2000
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2271
BOOL _ILIsSpecialFolder(LPCITEMIDLIST pidl)
Definition: pidl.c:2119
DWORD _ILGetDrive(LPCITEMIDLIST pidl, LPWSTR pOut, UINT uSize)
Definition: pidl.c:2045
void _ILFreeaPidl(LPITEMIDLIST *apidl, UINT cidl)
Definition: pidl.c:2607
BOOL ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPWSTR path, DWORD type)
Definition: pidl.c:100
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:2130
#define PT_GUID
Definition: pidl.h:87
#define PT_SHELLEXT
Definition: pidl.h:91
#define LVCFMT_LEFT
Definition: commctrl.h:2603
#define LVCFMT_RIGHT
Definition: commctrl.h:2604
#define CLSID_NULL
Definition: guiddef.h:99
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
#define err(...)
#define REGSTR_PATH_EXPLORER
Definition: regstr.h:33
#define REG_DWORD
Definition: sdbapi.c:596
BOOL HCR_GetIconW(LPCWSTR szClass, LPWSTR szDest, LPCWSTR szName, DWORD len, int *picon_idx)
Definition: classes.c:314
static HRESULT SHELL_CreateSHDESCRIPTIONID(VARIANT *pVar, DWORD Id, const CLSID *pCLSID)
Definition: shell32_main.h:274
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:663
#define SHELL_ErrorBox
Definition: shellutils.h:126
HRESULT SH32_GetDetailsOfPKeyAsVariant(IShellFolder2 *pSF, PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pVar, BOOL UseFsColMap)
Definition: shlfolder.cpp:133
HRESULT SHELL32_BindToSF(LPCITEMIDLIST pidlRoot, PERSIST_FOLDER_TARGET_INFO *ppfti, LPCITEMIDLIST pidl, const GUID *clsid, REFIID riid, LPVOID *ppvOut)
Definition: shlfolder.cpp:293
#define SHFSF_COL_COMMENT
Definition: shfldr.h:49
static HRESULT MakeSCID(SHCOLUMNID &scid, REFCLSID fmtid, UINT pid)
Definition: shfldr.h:99
HRESULT SHELL32_GetDisplayNameOfChild(IShellFolder2 *psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
Definition: shlfolder.cpp:331
#define SHFSF_COL_NAME
Definition: shfldr.h:44
HRESULT SHELL32_CompareChildren(IShellFolder2 *psf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: shlfolder.cpp:349
static __inline int SHELL32_GUIDToStringW(REFGUID guid, LPWSTR str)
Definition: shfldr.h:162
#define SHFSF_COL_TYPE
Definition: shfldr.h:46
LSTATUS AddClassKeyToArray(const WCHAR *szClass, HKEY *array, UINT *cKeys)
Definition: shlfolder.cpp:408
HRESULT SHELL32_CompareDetails(IShellFolder2 *isf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: shlfolder.cpp:372
HRESULT SH_GetApidlFromDataObject(IDataObject *pDataObject, PIDLIST_ABSOLUTE *ppidlfolder, PUITEMID_CHILD **apidlItems, UINT *pcidl)
Definition: shlfolder.cpp:499
void WINAPI _InsertMenuItemW(HMENU hmenu, UINT indexMenu, BOOL fByPosition, UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState)
HRESULT hr
Definition: shlfolder.c:183
#define PID_DESCRIPTIONID
Definition: shlguid.h:171
UINT WINAPI Shell_MergeMenus(HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags)
Definition: shlmenu.c:856
#define SHDID_COMPUTER_NETDRIVE
Definition: shlobj.h:1472
#define SHDID_COMPUTER_FIXED
Definition: shlobj.h:1471
#define SHCNE_DRIVEREMOVED
Definition: shlobj.h:1905
#define SHDID_COMPUTER_REMOVABLE
Definition: shlobj.h:1470
#define SHCNE_RENAMEFOLDER
Definition: shlobj.h:1915
#define SHCNE_MEDIAREMOVED
Definition: shlobj.h:1904
#define SHCNE_DRIVEADD
Definition: shlobj.h:1906
#define SHDID_COMPUTER_CDROM
Definition: shlobj.h:1473
#define SHFMT_ID_DEFAULT
Definition: shlobj.h:332
#define SHCNF_PATHW
Definition: shlobj.h:1933
#define SHDID_COMPUTER_OTHER
Definition: shlobj.h:1475
#define MM_ADDSEPARATOR
Definition: shlobj.h:2536
#define SHDID_COMPUTER_DRIVE35
Definition: shlobj.h:1468
struct _SFV_CREATE SFV_CREATE
#define DFM_CMD_PROPERTIES
Definition: shlobj.h:2620
#define SHCNF_FLUSHNOWAIT
Definition: shlobj.h:1937
#define SFVM_FSNOTIFY
Definition: shlobj.h:1315
@ REST_NODRIVES
Definition: shlobj.h:1659
#define SHDID_COMPUTER_RAMDISK
Definition: shlobj.h:1474
#define SHDID_ROOT_REGITEM
Definition: shlobj.h:1464
#define CTF_PROCESS_REF
Definition: shlwapi.h:1991
DWORD WINAPI SHRestricted(RESTRICTIONS rest)
Definition: shpolicy.c:166
#define IDS_DISCONNECT
Definition: shresdef.h:244
#define IDS_DRIVE_CDROM
Definition: shresdef.h:112
#define IDS_CANTDISMOUNTVOLUME
Definition: shresdef.h:148
#define IDS_EJECT
Definition: shresdef.h:243
#define IDS_DRIVE_FIXED
Definition: shresdef.h:111
#define IDS_DRIVE_NETWORK
Definition: shresdef.h:113
#define IDS_DRIVE_REMOVABLE
Definition: shresdef.h:115
#define IDI_SHELL_3_14_FLOPPY
Definition: shresdef.h:585
#define IDI_SHELL_NETDRIVE
Definition: shresdef.h:588
#define IDS_CANTLOCKVOLUME
Definition: shresdef.h:147
#define IDS_DRIVE_FLOPPY
Definition: shresdef.h:114
#define IDS_SHV_COLUMN_DISK_AVAILABLE
Definition: shresdef.h:55
#define IDI_SHELL_DOCUMENT
Definition: shresdef.h:579
#define IDI_SHELL_CDROM
Definition: shresdef.h:590
#define IDI_SHELL_DRIVE
Definition: shresdef.h:587
#define IDS_CANTEJECTMEDIA
Definition: shresdef.h:149
#define IDI_SHELL_RAMDISK
Definition: shresdef.h:591
#define IDS_CANTDISCONNECT
Definition: shresdef.h:151
#define IDI_SHELL_REMOVEABLE
Definition: shresdef.h:586
#define IDS_SHV_COLUMN_DISK_CAPACITY
Definition: shresdef.h:54
#define IDS_FORMATDRIVE
Definition: shresdef.h:229
#define IDS_SHV_COLUMN_COMMENTS
Definition: shresdef.h:67
ITEMID_CHILD UNALIGNED * PUITEMID_CHILD
Definition: shtypes.idl:68
@ STRRET_CSTR
Definition: shtypes.idl:87
@ STRRET_WSTR
Definition: shtypes.idl:85
const PCUITEMID_CHILD * PCUITEMID_CHILD_ARRAY
Definition: shtypes.idl:71
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
Definition: shtypes.idl:70
@ SHCOLSTATE_TYPE_STR
Definition: shtypes.idl:121
@ SHCOLSTATE_ONBYDEFAULT
Definition: shtypes.idl:125
const ITEMIDLIST_RELATIVE UNALIGNED * PCUIDLIST_RELATIVE
Definition: shtypes.idl:57
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
DWORD SHCOLSTATEF
Definition: shtypes.idl:142
#define _countof(array)
Definition: sndvol32.h:70
#define TRACE(s)
Definition: solgame.cpp:4
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
STRRET str
Definition: shtypes.idl:108
BOOLEAN PreventMediaRemoval
Definition: ntddstor.h:343
HMENU hmenu
Definition: shlobj.h:1398
UINT idCmdLast
Definition: shlobj.h:1401
UINT idCmdFirst
Definition: shlobj.h:1400
UINT indexMenu
Definition: shlobj.h:1399
char cStr[MAX_PATH]
Definition: shtypes.idl:98
UINT uType
Definition: shtypes.idl:93
LPWSTR pOleStr
Definition: shtypes.idl:96
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
Definition: stubgen.c:11
Definition: match.c:390
Definition: name.c:39
WORD colstate
Definition: shfldr.h:32
struct tagDriveStruct drive
Definition: pidl.h:234
union tagPIDLDATA::@623 u
struct _stub stub
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
#define UL
Definition: tui.h:164
uint16_t * PWSTR
Definition: typedefs.h:56
const uint16_t * PCWSTR
Definition: typedefs.h:57
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
LONGLONG QuadPart
Definition: typedefs.h:114
#define _T(x)
Definition: vfdio.h:22
#define DRIVE_UNKNOWN
Definition: winbase.h:289
#define DRIVE_NO_ROOT_DIR
Definition: winbase.h:290
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define GetDriveType
Definition: winbase.h:3853
#define DRIVE_REMOTE
Definition: winbase.h:286
_In_ LPCSTR lpName
Definition: winbase.h:2830
#define DRIVE_RAMDISK
Definition: winbase.h:288
#define DRIVE_FIXED
Definition: winbase.h:285
#define DRIVE_REMOVABLE
Definition: winbase.h:284
#define CreateFile
Definition: winbase.h:3790
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:2357
#define E_NOINTERFACE
Definition: winerror.h:2364
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define E_POINTER
Definition: winerror.h:2365
#define HRESULT_CODE(hr)
Definition: winerror.h:76
#define HKEY_CURRENT_USER
Definition: winreg.h:11
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:838
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
#define MFT_SEPARATOR
Definition: winuser.h:755
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_ICONERROR
Definition: winuser.h:798
#define MFS_ENABLED
Definition: winuser.h:761
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define MFT_STRING
Definition: winuser.h:757
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
DWORD WINAPI WNetCancelConnection2W(LPCWSTR lpName, DWORD dwFlags, BOOL fForce)
Definition: wnet.c:2420
#define IID_PPV_ARG(Itype, ppType)
const char * LPCSTR
Definition: xmlstorage.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
char CHAR
Definition: xmlstorage.h:175
unsigned char BYTE
Definition: xxhash.c:193