ReactOS 0.4.16-dev-2284-g3529151
CNewMenu.cpp
Go to the documentation of this file.
1/*
2 * provides new shell item service
3 *
4 * Copyright 2007 Johannes Anderwald (johannes.anderwald@reactos.org)
5 * Copyright 2009 Andrew Hill
6 * Copyright 2012 Rafal Harabien
7 * Copyright 2019 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
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
27
29 m_pidlFolder(NULL),
30 m_pItems(NULL),
31 m_pLinkItem(NULL),
32 m_pSite(NULL),
33 m_idCmdFirst(0),
34 m_idCmdFolder(-1),
35 m_idCmdLink(-1),
36 m_bCustomIconFolder(FALSE),
37 m_bCustomIconLink(FALSE),
38 m_hIconFolder(NULL),
39 m_hIconLink(NULL)
40{
41}
42
44{
46
51 if (m_pidlFolder)
53}
54
56{
57 /* Note: free allows NULL as argument */
58 free(pItem->pData);
59 free(pItem->pwszDesc);
60 free(pItem->pwszExt);
61
62 if (pItem->hIcon)
63 DestroyIcon(pItem->hIcon);
64
65 HeapFree(GetProcessHeap(), 0, pItem);
66}
67
69{
70 SHELLNEW_ITEM *pCurItem;
71
72 /* Unload the handler items, including the link item */
73 while (m_pItems)
74 {
75 pCurItem = m_pItems;
77 UnloadItem(pCurItem);
78 }
79 m_pItems = NULL;
81}
82
84{
85 HKEY hKey;
86 WCHAR wszBuf[MAX_PATH];
89
90 StringCbPrintfW(wszBuf, sizeof(wszBuf), L"%s\\ShellNew", pwszExt);
91
92 TRACE("LoadItem Keyname %s Name %s\n", debugstr_w(pwszExt), debugstr_w(wszBuf));
93
95 {
96 WCHAR wszValue[MAX_PATH];
97 cbData = sizeof(wszValue);
98 if (RegGetValueW(HKEY_CLASSES_ROOT, pwszExt, NULL, RRF_RT_REG_SZ, NULL, wszValue,
99 &cbData) != ERROR_SUCCESS || !wszValue[0])
100 {
101 TRACE("Failed to open key\n");
102 return NULL;
103 }
104 wszValue[_countof(wszValue) - 1] = UNICODE_NULL; // Avoid buffer overrun
105 StringCbPrintfW(wszBuf, sizeof(wszBuf), L"%s\\%s\\ShellNew", pwszExt, wszValue);
107 {
108 TRACE("Failed to open key\n");
109 return NULL;
110 }
111 }
112
113 /* Find first valid value */
114 struct
115 {
116 LPCWSTR pszName;
118 BOOL bNeedData;
119 BOOL bStr;
120 } Types[] = {
121 {L"FileName", SHELLNEW_TYPE_FILENAME, TRUE, TRUE},
122 {L"Command", SHELLNEW_TYPE_COMMAND, TRUE, TRUE},
123 {L"Data", SHELLNEW_TYPE_DATA, TRUE, FALSE},
124 {L"NullFile", SHELLNEW_TYPE_NULLFILE, FALSE},
125 {NULL}
126 };
127 UINT i;
128
129 for (i = 0; Types[i].pszName; ++i)
130 {
131 /* Note: We are using ANSI function because strings can be treated as data */
132 cbData = 0;
134 DWORD dwType;
136 {
137 if (Types[i].bNeedData && cbData > 0)
138 {
140 RegGetValueW(hKey, NULL, Types[i].pszName, dwFlags, &dwType, pData, &cbData);
141 if (!Types[i].bStr && (dwType == REG_SZ || dwType == REG_EXPAND_SZ))
142 {
143 PBYTE pData2 = (PBYTE)malloc(cbData);
145 free(pData);
146 pData = pData2;
147 }
148 }
149 break;
150 }
151 }
153
154 /* Was any key found? */
155 if (!Types[i].pszName)
156 {
157 free(pData);
158 return NULL;
159 }
160
161 SHFILEINFOW fi;
163 {
164 free(pData);
165 return NULL;
166 }
167
168 /* Create new item */
169 SHELLNEW_ITEM *pNewItem = static_cast<SHELLNEW_ITEM *>(HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SHELLNEW_ITEM)));
170 if (!pNewItem)
171 {
172 free(pData);
173 return NULL;
174 }
175
176 TRACE("new item %ls\n", fi.szTypeName);
177 pNewItem->Type = Types[i].Type;
178 pNewItem->pData = pData;
179 pNewItem->cbData = pData ? cbData : 0;
180 pNewItem->pwszExt = _wcsdup(pwszExt);
181 pNewItem->pwszDesc = _wcsdup(fi.szTypeName);
182 if (fi.hIcon)
183 pNewItem->hIcon = fi.hIcon;
184
185 return pNewItem;
186}
187
188BOOL
190{
191 HKEY hKey;
192 DWORD dwSize = 0;
193 DWORD dwIndex = 0;
194 LPWSTR lpValue;
195 LPWSTR lpValues;
196 WCHAR wszName[MAX_PATH];
197 SHELLNEW_ITEM *pNewItem;
198 SHELLNEW_ITEM *pCurItem = NULL;
199
200 /* Enumerate all extensions */
201 while (RegEnumKeyW(HKEY_CLASSES_ROOT, dwIndex++, wszName, _countof(wszName)) == ERROR_SUCCESS)
202 {
203 if (wszName[0] != L'.')
204 continue;
205
206 pNewItem = LoadItem(wszName);
207 if (pNewItem)
208 {
209 dwSize += wcslen(wszName) + 1;
210 if (!m_pLinkItem && _wcsicmp(pNewItem->pwszExt, L".lnk") == 0)
211 {
212 /* The unique link handler */
213 m_pLinkItem = pNewItem;
214 }
215
216 /* Add at the end of the list */
217 if (pCurItem)
218 {
219 pCurItem->pNext = pNewItem;
220 pCurItem = pNewItem;
221 }
222 else
223 {
224 pCurItem = m_pItems = pNewItem;
225 }
226 }
227 }
228
229 dwSize++;
230
231 lpValues = (LPWSTR) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize * sizeof(WCHAR));
232 if (!lpValues)
233 return FALSE;
234
235 for (pCurItem = m_pItems, lpValue = lpValues; pCurItem; pCurItem = pCurItem->pNext)
236 {
237 memcpy(lpValue, pCurItem->pwszExt, (wcslen(pCurItem->pwszExt) + 1) * sizeof(WCHAR));
238 lpValue += wcslen(pCurItem->pwszExt) + 1;
239 }
240
242 {
243 HeapFree(GetProcessHeap(), 0, lpValues);
244 return FALSE;
245 }
246
247 if (RegSetValueExW(hKey, L"Classes", NULL, REG_MULTI_SZ, (LPBYTE)lpValues, dwSize * sizeof(WCHAR)) != ERROR_SUCCESS)
248 {
249 HeapFree(GetProcessHeap(), 0, lpValues);
251 return FALSE;
252 }
253
254 HeapFree(GetProcessHeap(), 0, lpValues);
256
257 return TRUE;
258}
259
260BOOL
262{
263 LPWSTR wszName;
264 LPWSTR lpValues;
266 HKEY hKey;
267 SHELLNEW_ITEM *pNewItem;
268 SHELLNEW_ITEM *pCurItem = NULL;
269
271 return FALSE;
272
273 if (RegQueryValueExW(hKey, L"Classes", NULL, NULL, NULL, &dwSize) != ERROR_SUCCESS)
274 return FALSE;
275
276 lpValues = (LPWSTR) HeapAlloc(GetProcessHeap(), 0, dwSize);
277 if (!lpValues)
278 return FALSE;
279
280 if (RegQueryValueExW(hKey, L"Classes", NULL, NULL, (LPBYTE)lpValues, &dwSize) != ERROR_SUCCESS)
281 {
282 HeapFree(GetProcessHeap(), 0, lpValues);
283 return FALSE;
284 }
285
286 wszName = lpValues;
287
288 for (; *wszName != '\0'; wszName += wcslen(wszName) + 1)
289 {
290 pNewItem = LoadItem(wszName);
291 if (pNewItem)
292 {
293 if (!m_pLinkItem && _wcsicmp(pNewItem->pwszExt, L".lnk") == 0)
294 {
295 /* The unique link handler */
296 m_pLinkItem = pNewItem;
297 }
298
299 /* Add at the end of the list */
300 if (pCurItem)
301 {
302 pCurItem->pNext = pNewItem;
303 pCurItem = pNewItem;
304 }
305 else
306 {
307 pCurItem = m_pItems = pNewItem;
308 }
309 }
310 }
311
312 HeapFree(GetProcessHeap(), 0, lpValues);
314
315 return TRUE;
316}
317
318BOOL
320{
321 // TODO: We need to find a way to refresh the cache from time to time, when
322 // e.g. new extensions with ShellNew handlers have been added or removed.
323
324 /* If there are any unload them */
326
327 if (!LoadCachedItems())
328 {
329 CacheItems();
330 }
331
332 return (m_pItems != NULL);
333}
334
335UINT
337{
338 MENUITEMINFOW mii;
339 UINT idCmd = idCmdFirst;
340 WCHAR wszBuf[256];
341
342 if (m_pItems == NULL)
343 {
344 if (!LoadAllItems())
345 return 0;
346 }
347
348 ZeroMemory(&mii, sizeof(mii));
349 mii.cbSize = sizeof(mii);
350
351 m_idCmdFirst = idCmd;
352
353 /* Insert the new folder action */
355 wszBuf[0] = 0;
357 mii.dwTypeData = wszBuf;
358 mii.cch = wcslen(mii.dwTypeData);
359 mii.wID = idCmd;
360 mii.hbmpItem = HBMMENU_CALLBACK;
361 if (InsertMenuItemW(hMenu, Pos++, TRUE, &mii))
362 m_idCmdFolder = idCmd++;
363
364 /* Insert the new shortcut action */
365 if (m_pLinkItem)
366 {
368 wszBuf[0] = 0;
369 mii.dwTypeData = wszBuf;
370 mii.cch = wcslen(mii.dwTypeData);
371 mii.wID = idCmd;
372 if (InsertMenuItemW(hMenu, Pos++, TRUE, &mii))
373 m_idCmdLink = idCmd++;
374 }
375
376 /* Insert a seperator for the custom new action */
377 mii.fMask = MIIM_TYPE | MIIM_ID;
378 mii.fType = MFT_SEPARATOR;
379 mii.wID = -1;
380 InsertMenuItemW(hMenu, Pos++, TRUE, &mii);
381
382 /* Insert the rest of the items */
384 mii.fType = 0;
385
386 for (SHELLNEW_ITEM *pCurItem = m_pItems; pCurItem; pCurItem = pCurItem->pNext)
387 {
388 /* Skip shortcut item */
389 if (pCurItem == m_pLinkItem)
390 continue;
391
392 TRACE("szDesc %s\n", debugstr_w(pCurItem->pwszDesc));
393 mii.dwItemData = (ULONG_PTR)pCurItem;
394 mii.dwTypeData = pCurItem->pwszDesc;
395 mii.cch = wcslen(mii.dwTypeData);
396 mii.wID = idCmd;
397 if (InsertMenuItemW(hMenu, Pos++, TRUE, &mii))
398 ++idCmd;
399 }
400
401 return idCmd - idCmdFirst;
402}
403
405{
406 /* Folder */
407 if (m_idCmdFirst + IdOffset == m_idCmdFolder)
408 return NULL;
409
410 /* Shortcut */
411 if (m_idCmdFirst + IdOffset == m_idCmdLink)
412 return m_pLinkItem;
413
414 /* Find shell new item - Retrieve menu item info */
415 MENUITEMINFOW mii;
416 ZeroMemory(&mii, sizeof(mii));
417 mii.cbSize = sizeof(mii);
418 mii.fMask = MIIM_DATA;
419
420 if (GetMenuItemInfoW(m_hSubMenu, m_idCmdFirst + IdOffset, FALSE, &mii) && mii.dwItemData)
421 return (SHELLNEW_ITEM *)mii.dwItemData;
422 else
423 return NULL;
424}
425
427{
430 HRESULT hr = E_FAIL;
431 LPITEMIDLIST pidl;
432 PITEMID_CHILD pidlNewItem;
433 DWORD dwSelectFlags;
434
435 dwSelectFlags = SVSI_DESELECTOTHERS | SVSI_ENSUREVISIBLE | SVSI_FOCUSED | SVSI_SELECT;
436 if (bRename)
437 dwSelectFlags |= SVSI_EDIT;
438
439 /* Notify the view object about the new item */
440 SHChangeNotify(wEventId, uFlags | SHCNF_FLUSH, (LPCVOID)pszName, NULL);
441
442 if (!m_pSite)
443 return S_OK;
444
445 /* Get a pointer to the shell view */
446 hr = IUnknown_QueryService(m_pSite, SID_SFolderView, IID_PPV_ARG(IShellView, &lpSV));
448 return S_OK;
449
450 /* Attempt to get the pidl of the new item */
451 hr = SHILCreateFromPathW(pszName, &pidl, NULL);
453 return hr;
454
455 pidlNewItem = ILFindLastID(pidl);
456
457 hr = lpSV->SelectItem(pidlNewItem, dwSelectFlags);
458
459 SHFree(pidl);
460
461 return hr;
462}
463
464// Code is duplicated in CDefaultContextMenu
466{
467 WCHAR wszPath[MAX_PATH];
468 WCHAR wszName[MAX_PATH];
469 WCHAR wszNewFolder[25];
470 HRESULT hr;
471
472 /* Get folder path */
475 return hr;
476
477 if (!LoadStringW(shell32_hInstance, IDS_NEWFOLDER, wszNewFolder, _countof(wszNewFolder)))
478 return E_FAIL;
479
480 /* Create the name of the new directory */
481 if (!PathYetAnotherMakeUniqueName(wszName, wszPath, NULL, wszNewFolder))
482 return E_FAIL;
483
484 /* Create the new directory and show the appropriate dialog in case of error */
485 if (SHCreateDirectory(lpici->hwnd, wszName) != ERROR_SUCCESS)
486 return E_FAIL;
487
488 /* Show and select the new item in the def view */
490
491 return S_OK;
492}
493
495{
496 WCHAR wszBuf[MAX_PATH];
497 LPWSTR Ptr, pwszCmd;
498 WCHAR wszTemp[MAX_PATH];
501
502 if (!ExpandEnvironmentStringsW((LPWSTR)pItem->pData, wszBuf, _countof(wszBuf)))
503 {
504 TRACE("ExpandEnvironmentStrings failed\n");
505 return E_FAIL;
506 }
507
508 /* Expand command parameter, FIXME: there can be more modifiers */
509 Ptr = wcsstr(wszBuf, L"%1");
510 if (Ptr)
511 {
512 Ptr[1] = L's';
513 StringCbPrintfW(wszTemp, sizeof(wszTemp), wszBuf, wszPath);
514 pwszCmd = wszTemp;
515 }
516 else
517 {
518 pwszCmd = wszBuf;
519 }
520
521 /* Create process */
522 ZeroMemory(&si, sizeof(si));
523 si.cb = sizeof(si);
524 if (CreateProcessW(NULL, pwszCmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
525 {
528 return S_OK;
529 }
530 else
531 {
532 ERR("Failed to create process\n");
533 return E_FAIL;
534 }
535}
536
538 DWORD cchNameMax, LPCWSTR wszPath)
539{
540 BOOL bSuccess = TRUE;
541
542 CStringW strNewItem;
543 strNewItem.Format(IDS_NEWITEMFORMAT, pItem->pwszDesc);
544 strNewItem += pItem->pwszExt;
545
546 /* Create the name of the new file */
547 if (!PathYetAnotherMakeUniqueName(wszName, wszPath, NULL, strNewItem))
548 return E_FAIL;
549
550 /* Create new file */
553 {
554 if (pItem->Type == SHELLNEW_TYPE_DATA)
555 {
556 /* Write a content */
557 DWORD cbWritten;
558 WriteFile(hFile, pItem->pData, pItem->cbData, &cbWritten, NULL);
559 }
560
561 /* Close file now */
563 }
564 else
565 {
566 bSuccess = FALSE;
567 }
568
569 if (pItem->Type == SHELLNEW_TYPE_FILENAME)
570 {
571 /* Copy file */
572 if (!CopyFileW((LPWSTR)pItem->pData, wszName, FALSE))
573 ERR("Copy file failed: %ls\n", (LPWSTR)pItem->pData);
574 }
575
576 /* Show message if we failed */
577 if (bSuccess)
578 {
579 TRACE("Notifying fs %s\n", debugstr_w(wszName));
581 }
582 else
583 {
586 Message.FormatMessage(Message.GetString(), wszName);
588 }
589
590 return S_OK;
591}
592
594{
595 HRESULT hr;
596 WCHAR wszPath[MAX_PATH], wszName[MAX_PATH];
597
598 /* Get folder path */
601 return hr;
602
603 if (pItem == m_pLinkItem)
604 {
605 NewItemByNonCommand(pItem, wszName, _countof(wszName), wszPath);
606 NewItemByCommand(pItem, wszName);
607 return S_OK;
608 }
609
610 switch (pItem->Type)
611 {
613 NewItemByCommand(pItem, wszPath);
614 break;
615
619 NewItemByNonCommand(pItem, wszName, _countof(wszName), wszPath);
620 break;
621
623 ERR("Invalid type\n");
624 break;
625 }
626
627 return S_OK;
628}
629
631{
632 m_pSite = pUnkSite;
633 return S_OK;
634}
635
637{
638 return m_pSite->QueryInterface(riid, ppvSite);
639}
640
642WINAPI
644 UINT indexMenu,
645 UINT idCmdFirst,
646 UINT idCmdLast,
647 UINT uFlags)
648{
649 MENUITEMINFOW mii;
650 UINT cItems = 0;
651 WCHAR wszNew[200];
652
653 TRACE("%p %p %u %u %u %u\n", this,
654 hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
655
657 return E_FAIL;
658
660 if (!m_hSubMenu)
661 return E_FAIL;
662
663 cItems = InsertShellNewItems(m_hSubMenu, idCmdFirst, 0);
664
665 ZeroMemory(&mii, sizeof(mii));
666 mii.cbSize = sizeof(mii);
668 mii.fType = MFT_STRING;
669 mii.wID = -1;
670 mii.dwTypeData = wszNew;
671 mii.cch = wcslen(mii.dwTypeData);
672 mii.fState = MFS_ENABLED;
673 mii.hSubMenu = m_hSubMenu;
674
675 if (!InsertMenuItemW(hMenu, indexMenu, TRUE, &mii))
676 return E_FAIL;
677
678 return MAKE_HRESULT(SEVERITY_SUCCESS, 0, cItems);
679}
680
682WINAPI
684{
685 HRESULT hr = E_FAIL;
686
687 if (m_idCmdFirst + LOWORD(lpici->lpVerb) == m_idCmdFolder)
688 {
689 hr = CreateNewFolder(lpici);
690 }
691 else
692 {
694 if (pItem)
695 hr = CreateNewItem(pItem, lpici);
696 }
697
698 TRACE("CNewMenu::InvokeCommand %x\n", hr);
699 return hr;
700}
701
703WINAPI
705 UINT uType,
706 UINT *pwReserved,
707 LPSTR pszName,
708 UINT cchMax)
709{
710 FIXME("%p %lu %u %p %p %u\n", this,
711 idCmd, uType, pwReserved, pszName, cchMax );
712
713 return E_NOTIMPL;
714}
715
717WINAPI
719{
720 return HandleMenuMsg2(uMsg, wParam, lParam, NULL);
721}
722
724WINAPI
726{
727 switch (uMsg)
728 {
729 case WM_MEASUREITEM:
730 {
731 MEASUREITEMSTRUCT* lpmis = reinterpret_cast<MEASUREITEMSTRUCT*>(lParam);
732 if (!lpmis || lpmis->CtlType != ODT_MENU)
733 break;
734
737 if (lpmis->itemHeight < 16)
738 lpmis->itemHeight = 16;
739
740 if (plResult)
741 *plResult = TRUE;
742 break;
743 }
744 case WM_DRAWITEM:
745 {
746 DRAWITEMSTRUCT* lpdis = reinterpret_cast<DRAWITEMSTRUCT*>(lParam);
747 if (!lpdis || lpdis->CtlType != ODT_MENU)
748 break;
749
750 DWORD id = lpdis->itemID;
751 HICON hIcon = NULL;
752 if (id == m_idCmdFolder)
753 {
755 }
756 else if (id == m_idCmdLink)
757 {
759 }
760 else
761 {
763 if (pItem)
764 hIcon = pItem->hIcon;
765 }
766
767 if (!hIcon)
768 break;
769
770 DrawIconEx(lpdis->hDC,
771 2,
772 lpdis->rcItem.top + (lpdis->rcItem.bottom - lpdis->rcItem.top - 16) / 2,
773 hIcon,
774 16,
775 16,
776 0, NULL, DI_NORMAL);
777
778 if(plResult)
779 *plResult = TRUE;
780 }
781 }
782
783 return S_OK;
784}
785
788 IDataObject *pdtobj, HKEY hkeyProgID)
789{
791 WCHAR wszIconPath[MAX_PATH];
792 int icon_idx;
793
794 m_pidlFolder = ILClone(pidlFolder);
795
796 /* Load folder and shortcut icons */
797 if (HLM_GetIconW(IDI_SHELL_FOLDER - 1, wszIconPath, _countof(wszIconPath), &icon_idx))
798 {
799 ::ExtractIconExW(wszIconPath, icon_idx, &m_hIconFolder, NULL, 1);
801 }
802 else
803 {
805 }
806
807 if (HLM_GetIconW(IDI_SHELL_SHORTCUT - 1, wszIconPath, _countof(wszIconPath), &icon_idx))
808 {
809 ::ExtractIconExW(wszIconPath, icon_idx, &m_hIconLink, NULL, 1);
811 }
812 else
813 {
815 }
816
817 return S_OK;
818}
const WCHAR ShellNewKey[]
Definition: CNewMenu.h:26
#define shell32_hInstance
UINT cchMax
Type
Definition: Type.h:7
char ACPI_OBJECT_TYPE * Types
Definition: acdebug.h:354
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
#define IDI_SHELL_FOLDER
Definition: treeview.c:21
#define FIXME(fmt,...)
Definition: precomp.h:53
#define ERR(fmt,...)
Definition: precomp.h:57
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
#define RegCloseKey(hKey)
Definition: registry.h:49
EXTERN_C void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:818
HRESULT SelectNewItem(LONG wEventId, UINT uFlags, LPWSTR pszName, BOOL bRename)
Definition: CNewMenu.cpp:426
STDMETHOD() GetSite(REFIID riid, void **ppvSite) override
Definition: CNewMenu.cpp:636
STDMETHOD() QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override
Definition: CNewMenu.cpp:643
STDMETHOD() SetSite(IUnknown *pUnkSite) override
Definition: CNewMenu.cpp:630
UINT InsertShellNewItems(HMENU hMenu, UINT idFirst, UINT idMenu)
Definition: CNewMenu.cpp:336
STDMETHOD() GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen) override
Definition: CNewMenu.cpp:704
HICON m_hIconFolder
Definition: CNewMenu.h:63
HRESULT NewItemByNonCommand(SHELLNEW_ITEM *pItem, LPWSTR wszName, DWORD cchNameMax, LPCWSTR wszPath)
Definition: CNewMenu.cpp:537
CNewMenu()
Definition: CNewMenu.cpp:28
SHELLNEW_TYPE
Definition: CNewMenu.h:37
@ SHELLNEW_TYPE_COMMAND
Definition: CNewMenu.h:39
@ SHELLNEW_TYPE_FILENAME
Definition: CNewMenu.h:41
@ SHELLNEW_TYPE_DATA
Definition: CNewMenu.h:40
@ SHELLNEW_TYPE_NULLFILE
Definition: CNewMenu.h:42
@ SHELLNEW_TYPE_INVALID
Definition: CNewMenu.h:38
BOOL m_bCustomIconLink
Definition: CNewMenu.h:62
STDMETHOD() Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID) override
Definition: CNewMenu.cpp:787
UINT m_idCmdLink
Definition: CNewMenu.h:61
LPITEMIDLIST m_pidlFolder
Definition: CNewMenu.h:56
BOOL LoadCachedItems()
Definition: CNewMenu.cpp:261
void UnloadItem(SHELLNEW_ITEM *pItem)
Definition: CNewMenu.cpp:55
BOOL LoadAllItems()
Definition: CNewMenu.cpp:319
SHELLNEW_ITEM * m_pLinkItem
Definition: CNewMenu.h:58
BOOL m_bCustomIconFolder
Definition: CNewMenu.h:62
HICON m_hIconLink
Definition: CNewMenu.h:63
HRESULT CreateNewItem(SHELLNEW_ITEM *pItem, LPCMINVOKECOMMANDINFO lpcmi)
Definition: CNewMenu.cpp:593
STDMETHOD() HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam) override
Definition: CNewMenu.cpp:718
HMENU m_hSubMenu
Definition: CNewMenu.h:60
void UnloadAllItems()
Definition: CNewMenu.cpp:68
STDMETHOD() HandleMenuMsg2(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plResult) override
Definition: CNewMenu.cpp:725
SHELLNEW_ITEM * LoadItem(LPCWSTR pwszExt)
Definition: CNewMenu.cpp:83
SHELLNEW_ITEM * m_pItems
Definition: CNewMenu.h:57
~CNewMenu()
Definition: CNewMenu.cpp:43
UINT m_idCmdFirst
Definition: CNewMenu.h:61
UINT m_idCmdFolder
Definition: CNewMenu.h:61
STDMETHOD() InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi) override
Definition: CNewMenu.cpp:683
HRESULT NewItemByCommand(SHELLNEW_ITEM *pItem, LPCWSTR wszPath)
Definition: CNewMenu.cpp:494
HRESULT CreateNewFolder(LPCMINVOKECOMMANDINFO lpici)
Definition: CNewMenu.cpp:465
SHELLNEW_ITEM * FindItemFromIdOffset(UINT IdOffset)
Definition: CNewMenu.cpp:404
BOOL CacheItems()
Definition: CNewMenu.cpp:189
CComPtr< IUnknown > m_pSite
Definition: CNewMenu.h:59
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
ush Pos
Definition: deflate.h:92
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1931
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
LONG WINAPI RegEnumKeyW(HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cbName)
Definition: reg.c:2393
UINT uFlags
Definition: api.c:59
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define WideCharToMultiByte
Definition: compat.h:111
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:520
BOOL WINAPI CopyFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName, IN BOOL bFailIfExists)
Definition: copy.c:365
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4442
INT WINAPI DECLSPEC_HOTPATCH LoadStringW(HINSTANCE instance, UINT resource_id, LPWSTR buffer, INT buflen)
Definition: string.c:1220
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:159
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
_ACRTIMP wchar_t *__cdecl wcsstr(const wchar_t *, const wchar_t *)
Definition: wcs.c:2993
_ACRTIMP wchar_t *__cdecl _wcsdup(const wchar_t *) __WINE_DEALLOC(free) __WINE_MALLOC
Definition: wcs.c:81
#define RRF_RT_REG_SZ
Definition: driver.c:575
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:370
BOOL WINAPI PathYetAnotherMakeUniqueName(LPWSTR buffer, LPCWSTR path, LPCWSTR shortname, LPCWSTR longname)
Definition: shellpath.c:848
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1501
#define FAILED_UNEXPECTEDLY
Definition: utils.cpp:30
static const WCHAR Message[]
Definition: register.c:74
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:29
#define L(x)
Definition: resources.c:13
#define ULONG_PTR
Definition: config.h:101
#define IDS_NEWFOLDER
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
FxAutoRegKey hKey
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
UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIcons)
Definition: iconcache.cpp:855
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define debugstr_w
Definition: kernel32.h:32
#define REG_SZ
Definition: layer.c:22
#define ZeroMemory
Definition: minwinbase.h:31
LONG_PTR LPARAM
Definition: minwindef.h:175
LONG_PTR LRESULT
Definition: minwindef.h:176
UINT_PTR WPARAM
Definition: minwindef.h:174
CONST void * LPCVOID
Definition: minwindef.h:164
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define CREATE_NEW
Definition: disk.h:69
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
static HICON
Definition: imagelist.c:80
static PROCESS_INFORMATION pi
Definition: debugger.c:2303
static SYSTEM_INFO si
Definition: virtual.c:39
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
HICON hIcon
Definition: msconfig.c:44
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
_In_ HANDLE hFile
Definition: mswsock.h:90
unsigned int UINT
Definition: ndis.h:50
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
#define KEY_READ
Definition: nt_native.h:1026
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1060
#define REG_MULTI_SZ
Definition: nt_native.h:1504
#define KEY_WRITE
Definition: nt_native.h:1034
#define GENERIC_WRITE
Definition: nt_native.h:90
#define REG_EXPAND_SZ
Definition: nt_native.h:1497
#define UNICODE_NULL
#define MAKEINTRESOURCE(i)
Definition: ntverrsrc.c:25
#define LOWORD(l)
Definition: pedump.c:82
BYTE * PBYTE
Definition: pedump.c:66
long LONG
Definition: pedump.c:60
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:238
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:1051
HRESULT WINAPI SHILCreateFromPathW(LPCWSTR path, LPITEMIDLIST *ppidl, DWORD *attributes)
Definition: pidl.c:404
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:199
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1496
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
#define REFIID
Definition: guiddef.h:118
_In_opt_ _In_opt_ _In_ _In_ DWORD cbData
Definition: shlwapi.h:761
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:430
#define SHGFI_ICON
Definition: shellapi.h:164
#define SHGFI_TYPENAME
Definition: shellapi.h:167
#define SHGFI_USEFILEATTRIBUTES
Definition: shellapi.h:181
#define SHGFI_SMALLICON
Definition: shellapi.h:176
int WINAPI SHCreateDirectory(HWND hWnd, LPCWSTR path)
Definition: shlfileop.cpp:948
HRESULT hr
Definition: shlfolder.c:183
#define SHCNE_MKDIR
Definition: shlobj.h:1900
#define SHCNE_CREATE
Definition: shlobj.h:1898
#define SHCNF_FLUSH
Definition: shlobj.h:1936
#define SHCNF_PATHW
Definition: shlobj.h:1933
#define IDS_NEWITEMFORMAT
Definition: shresdef.h:141
#define FCIDM_SHVIEW_NEW
Definition: shresdef.h:138
#define FCIDM_SHVIEW_NEWFOLDER
Definition: shresdef.h:893
#define IDI_SHELL_SHORTCUT
Definition: shresdef.h:623
#define IDS_CREATEFILE_DENIED
Definition: shresdef.h:119
#define FCIDM_SHVIEW_NEWLINK
Definition: shresdef.h:892
#define IDS_CREATEFILE_CAPTION
Definition: shresdef.h:118
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
#define _countof(array)
Definition: sndvol32.h:70
#define TRACE(s)
Definition: solgame.cpp:4
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
SHELLNEW_ITEM * pNext
Definition: CNewMenu.h:53
SHELLNEW_TYPE Type
Definition: CNewMenu.h:47
WCHAR szTypeName[80]
Definition: shellapi.h:388
HICON hIcon
Definition: shellapi.h:384
ULONG_PTR dwItemData
Definition: winuser.h:3370
LPWSTR dwTypeData
Definition: winuser.h:3371
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
unsigned char * LPBYTE
Definition: typedefs.h:53
int32_t INT
Definition: typedefs.h:58
#define WINAPI
Definition: msvc.h:6
#define SEVERITY_SUCCESS
Definition: winerror.h:177
#define DI_NORMAL
Definition: wingdi.h:72
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define RegCreateKeyEx
Definition: winreg.h:508
#define RRF_RT_ANY
Definition: winreg.h:66
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define MIIM_STRING
Definition: winuser.h:738
#define MIIM_ID
Definition: winuser.h:733
#define IMAGE_ICON
Definition: winuser.h:212
#define SM_CXMENUCHECK
Definition: winuser.h:1042
HMENU WINAPI CreateMenu(void)
Definition: menu.c:829
#define SM_CYSMICON
Definition: winuser.h:1024
#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 WM_DRAWITEM
Definition: winuser.h:1673
#define MIIM_STATE
Definition: winuser.h:732
#define SM_CXSMICON
Definition: winuser.h:1023
#define MIIM_SUBMENU
Definition: winuser.h:734
#define MIIM_BITMAP
Definition: winuser.h:739
BOOL WINAPI DrawIconEx(_In_ HDC, _In_ int, _In_ int, _In_ HICON, _In_ int, _In_ int, _In_ UINT, _In_opt_ HBRUSH, _In_ UINT)
Definition: cursoricon.c:2397
#define LR_SHARED
Definition: winuser.h:1111
#define MB_ICONEXCLAMATION
Definition: winuser.h:796
#define MB_OK
Definition: winuser.h:801
#define WM_MEASUREITEM
Definition: winuser.h:1674
#define MFS_ENABLED
Definition: winuser.h:761
#define LoadImage
Definition: winuser.h:5926
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
#define MFT_STRING
Definition: winuser.h:757
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define ODT_MENU
Definition: winuser.h:2573
#define HBMMENU_CALLBACK
Definition: winuser.h:2672
int WINAPI GetSystemMetrics(_In_ int)
#define MIIM_DATA
Definition: winuser.h:737
#define MIIM_TYPE
Definition: winuser.h:736
BOOL WINAPI InsertMenuItemW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2422
#define IID_PPV_ARG(Itype, ppType)
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
char * LPSTR
Definition: xmlstorage.h:182