ReactOS 0.4.16-dev-1338-g8aab5a9
shlextdbg.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: shlextdbg
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Shell extension debug utility
5 * COPYRIGHT: Copyright 2017 Mark Jansen (mark.jansen@reactos.org)
6 */
7
8#include <windows.h>
9#include <shlobj.h>
10#include <shlwapi.h>
11#include <atlbase.h> // thanks gcc
12#include <atlcom.h> // thanks gcc
13#include <atlstr.h>
14#include <atlsimpcoll.h>
15#include <conio.h>
16#include <shellutils.h>
17#include <shlwapi_undoc.h>
18
19static void PrintHelp(PCWSTR ExtraLine = NULL)
20{
21 if (ExtraLine)
22 wprintf(L"%s\n\n", ExtraLine);
23
24 wprintf(L"shlextdbg /clsid={clsid} [/dll=dllname] /IShellExtInit=filename |shlextype| |waitoptions|\n");
25 wprintf(L" {clsid}: The CLSID or ProgID of the object to create\n");
26 wprintf(L" dll: Optional dllname to create the object from, instead of CoCreateInstance\n");
27 wprintf(L" filename: The filename to pass to IShellExtInit->Initialze\n");
28 wprintf(L" shlextype: The type of shell extention to run:\n");
29 wprintf(L" /IShellPropSheetExt to create a property sheet\n");
30 wprintf(L" /IContextMenu=verb to activate the specified verb\n");
31 wprintf(L" waitoptions: Specify how to wait:\n");
32 wprintf(L" /explorerinstance: Wait for SHGetInstanceExplorer (Default)\n");
33 wprintf(L" /infinite: Keep on waiting infinitely\n");
34 wprintf(L" /openwindows: Wait for all windows from the current application to close\n");
35 wprintf(L" /input: Wait for input\n");
36 wprintf(L" /nowait\n");
37 wprintf(L"\n");
38 wprintf(L"shlextdbg /shgfi=path\n");
39 wprintf(L" Call SHGetFileInfo. Prefix path with $ to parse as a pidl.\n");
40 wprintf(L"\n");
41 wprintf(L"shlextdbg /assocq <[{bhid}]path> <string|data|key> <type> <initflags> <queryflags> <initstring> [extra] [maxsize]\n");
42 wprintf(L" Uses the default implementation from AssocCreate if path is empty.\n");
43 wprintf(L"\n");
44 wprintf(L"shlextdbg /shellexec=path [/see] [verb] [class]\n");
45 wprintf(L"\n");
46 wprintf(L"shlextdbg /dumpmenu=[{clsid}]path [/cmf]\n");
47}
48
49/*
50Examples:
51
52/clsid={513D916F-2A8E-4F51-AEAB-0CBC76FB1AF8} /IShellExtInit=C:\RosBE\Uninstall.exe /IShellPropSheetExt
53/clsid=CompressedFolder /IShellExtInit=e:\test.zip /IContextMenu=extract /openwindows
54/clsid=CompressedFolder /IShellExtInit=e:\test.zip /IContextMenu=extract /openwindows /dll=R:\build\dev\devenv\dll\shellext\zipfldr\Debug\zipfldr.dll
55/shgfi=c:\freeldr.ini
56/assocq "" string 1 0 0 .txt
57/assocq "" string friendlytypename 0x400 0 .txt "" 10
58/openwindows /shellexec=c: /invoke properties
59/dumpmenu=%windir%\explorer.exe /extended
60/dumpmenu {D969A300-E7FF-11d0-A93B-00A0C90F2719}c:
61
62*/
63
65{
66 PWCHAR end;
67 LONG v = wcstol(in, &end, 0);
68 return (end > in) ? v : 0;
69}
70
71static int ErrMsg(int Error)
72{
73 WCHAR buf[400];
74 for (UINT e = Error, cch; ;)
75 {
76 lstrcpynW(buf, L"?", _countof(buf));
78 while (cch && buf[cch - 1] <= ' ')
79 buf[--cch] = UNICODE_NULL; // Remove trailing newlines
80 if (cch || HIWORD(e) != HIWORD(HRESULT_FROM_WIN32(1)))
81 break;
82 e = HRESULT_CODE(e); // "WIN32_FROM_HRESULT"
83 }
84 wprintf(Error < 0 ? L"Error 0x%.8X %s\n" : L"Error %d %s\n", Error, buf);
85 return Error;
86}
87
88template<class T>
89static bool CLSIDPrefix(T& String, CLSID& Clsid)
90{
91 WCHAR buf[38 + 1];
92 if (String[0] == '{')
93 {
95 if (SUCCEEDED(CLSIDFromString(buf, &Clsid)))
96 {
97 String = String + 38;
98 return true;
99 }
100 }
101 return false;
102}
103
105{
107 {
108 static const QITAB c_tab[] =
109 {
111 { NULL }
112 };
113 return ::QISearch(this, c_tab, riid, ppv);
114 }
115 ULONG WINAPI AddRef() override { return 1; }
116 ULONG WINAPI Release() override { return 1; }
117
119 {
120 WCHAR szCls[42], szIid[42];
121 wprintf(L"INFO: QS %ls:%ls\n",
122 StringFromGUID2(rcls, szCls, _countof(szCls)) ? szCls : L"?",
123 StringFromGUID2(riid, szIid, _countof(szIid)) ? szIid : L"?");
124 if (ppv)
125 *ppv = NULL;
126 return E_NOINTERFACE;
127 }
128};
129
131{
132 static CLoggingServiceProvider g_SP;
133 return &g_SP;
134}
135
137{
138 CComPtr<IShellFolder> shellFolder;
140 HRESULT hr = SHBindToParent(pidl, IID_PPV_ARG(IShellFolder, &shellFolder), &child);
141 if (SUCCEEDED(hr))
142 hr = shellFolder->GetUIObjectOf(NULL, 1, &child, riid, NULL, ppv);
143 return hr;
144}
145
147{
148 PIDLIST_ABSOLUTE pidl = NULL;
149 HRESULT hr = SHParseDisplayName(Path, NULL, &pidl, 0, NULL);
150 if (SUCCEEDED(hr))
151 {
152 hr = SHCreateShellItem(NULL, NULL, pidl, ppSI);
153 SHFree(pidl);
154 }
155 return hr;
156}
157
159{
160 hKey = NULL;
161 IQueryAssociations* pQA;
162 if (SUCCEEDED(GetUIObjectOfAbsolute(pidl, IID_PPV_ARG(IQueryAssociations, &pQA))))
163 {
164 pQA->GetKey(0, ASSOCKEY_CLASS, NULL, &hKey); // Not implemented in ROS
165 pQA->Release();
166 }
167 if (!hKey)
168 {
169 DWORD cb;
173 info.dwAttributes = 0;
175 if (info.dwAttributes & SFGAO_FOLDER)
176 {
177 ext = const_cast<LPWSTR>(L"Directory");
178 }
179 else if (info.dwAttributes & SFGAO_BROWSABLE)
180 {
181 ext = const_cast<LPWSTR>(L"Folder"); // Best guess
182 }
183 else
184 {
185 cb = sizeof(buf);
187 {
189 }
190 }
191 if (!hKey)
192 {
194 }
195 }
196}
197
198static void DumpBytes(const void *Data, SIZE_T cb)
199{
200 for (SIZE_T i = 0; i < cb; ++i)
201 {
202 wprintf(L"%s%.2X", i ? L" " : L"", ((LPCBYTE)Data)[i]);
203 }
204 wprintf(L"\n");
205}
206
208{
209 if (cchMax < 1) return E_INVALIDARG;
210 *buf = UNICODE_NULL;
211
212 // First try to retrieve the UNICODE string directly
213 HRESULT hr = CM.GetCommandString(Id, Type | GCS_UNICODE, 0, (char*)buf, cchMax);
214 if (FAILED(hr))
215 {
216 // It failed, try to retrieve an ANSI string instead then convert it to UNICODE
217 STRRET sr;
218 sr.uType = STRRET_CSTR;
219 hr = CM.GetCommandString(Id, Type & ~GCS_UNICODE, 0, sr.cStr, _countof(sr.cStr));
220 if (SUCCEEDED(hr))
221 hr = StrRetToBufW(&sr, NULL, buf, cchMax);
222 }
223 return hr;
224}
225
226static void DumpMenu(HMENU hMenu, UINT IdOffset, IContextMenu* pCM, BOOL FakeInit, UINT Indent)
227{
228 bool recurse = Indent != UINT(-1);
230 MENUITEMINFOW mii;
231 mii.cbSize = FIELD_OFFSET(MENUITEMINFOW, hbmpItem);
232
233 for (UINT i = 0, defid = GetMenuDefaultItem(hMenu, FALSE, 0); ; ++i)
234 {
235 mii.fMask = MIIM_STRING;
236 mii.dwTypeData = buf;
237 mii.cch = _countof(buf);
238 *buf = UNICODE_NULL;
239 if (!GetMenuItemInfo(hMenu, i, TRUE, &mii))
240 lstrcpynW(buf, L"?", _countof(buf)); // Tolerate string failure
242 mii.hSubMenu = NULL;
243 mii.dwTypeData = NULL;
244 mii.cch = 0;
245 if (!GetMenuItemInfo(hMenu, i, TRUE, &mii))
246 break;
247
248 BOOL sep = mii.fType & MFT_SEPARATOR;
249 wprintf(L"%-4d", (sep || mii.wID == UINT(-1)) ? mii.wID : (mii.wID - IdOffset));
250 for (UINT j = 0; j < Indent && recurse; ++j)
251 wprintf(L" ");
252 wprintf(L"%s%s", mii.hSubMenu ? L">" : L"|", sep ? L"----------" : buf);
253 if (!sep && pCM && SUCCEEDED(GetCommandString(*pCM, mii.wID - IdOffset,
254 GCS_VERB, buf, _countof(buf))))
255 {
256 wprintf(L" [%s]", buf);
257 }
258 wprintf(L"%s\n", (defid == mii.wID && defid != UINT(-1)) ? L" (Default)" : L"");
259 if (mii.hSubMenu && recurse)
260 {
261 if (FakeInit)
263 DumpMenu(mii.hSubMenu, IdOffset, pCM, FakeInit, Indent + 1);
264 }
265 }
266}
267
268static int SHGFI(PCWSTR Path)
269{
270 PIDLIST_ABSOLUTE pidl = NULL;
271 UINT flags = 0, ret = 0;
272
273 if (*Path == L'$')
274 {
275 HRESULT hr = SHParseDisplayName(++Path, NULL, &pidl, 0, NULL);
276 if (FAILED(hr))
277 return ErrMsg(hr);
278 flags |= SHGFI_PIDL;
279 Path = (LPCWSTR)pidl;
280 }
282 {
284 }
286 if (!SHGetFileInfoW(Path, 0, &info, sizeof(info), flags |
288 {
289 info.szDisplayName[0] = info.szTypeName[0] = UNICODE_NULL;
290 info.dwAttributes = 0;
292 }
293 wprintf(L"Display: %s\n", info.szDisplayName);
294 wprintf(L"Attributes: 0x%x\n", info.dwAttributes);
295 wprintf(L"Type: %s\n", info.szTypeName);
296
297 if (!SHGetFileInfoW(Path, 0, &info, sizeof(info), flags | SHGFI_ICONLOCATION))
298 {
299 info.szDisplayName[0] = UNICODE_NULL;
300 info.iIcon = -1;
301 }
302 wprintf(L"Icon: %s,%d\n", info.szDisplayName, info.iIcon);
303
304 if (!SHGetFileInfoW(Path, 0, &info, sizeof(info), flags | SHGFI_SYSICONINDEX))
305 {
306 info.iIcon = -1;
307 }
308 wprintf(L"Index: %d\n", info.iIcon);
309 SHFree(pidl);
310 return ret;
311}
312
314{
315 UINT qtype = StrToNum(argv[2]);
316 ASSOCF iflags = StrToNum(argv[3]);
317 ASSOCF qflags = StrToNum(argv[4]);
318 PCWSTR extra = (argc > 6 && *argv[6]) ? argv[6] : NULL;
319 WCHAR buf[MAX_PATH * 2];
320 DWORD maxSize = (argc > 7 && *argv[7]) ? StrToNum(argv[7]) : sizeof(buf);
321
322 HRESULT hr;
324 PWSTR path = argv[0];
325 if (*path)
326 {
327 CLSID clsid, *pclsid = NULL;
328 if (CLSIDPrefix(path, clsid))
329 pclsid = &clsid;
332 {
333 hr = si->BindToHandler(NULL, pclsid ? *pclsid : BHID_AssociationArray, IID_PPV_ARG(IQueryAssociations, &qa));
334 if (FAILED(hr) && !pclsid)
335 hr = si->BindToHandler(NULL, BHID_SFUIObject, IID_PPV_ARG(IQueryAssociations, &qa));
336 }
337 }
338 else
339 {
340 hr = AssocCreate(CLSID_QueryAssociations, IID_PPV_ARG(IQueryAssociations, &qa));
341 }
342 if (FAILED(hr))
343 return ErrMsg(hr);
344 hr = qa->Init(iflags, argv[5], NULL, NULL);
345 if (FAILED(hr))
346 return ErrMsg(hr);
347
348 DWORD size = maxSize;
349 if (!_wcsicmp(argv[1], L"string"))
350 {
351 if (!_wcsicmp(argv[2], L"COMMAND"))
352 qtype = ASSOCSTR_COMMAND;
353 if (!_wcsicmp(argv[2], L"EXECUTABLE"))
354 qtype = ASSOCSTR_EXECUTABLE;
355 if (!_wcsicmp(argv[2], L"FRIENDLYDOCNAME") || !_wcsicmp(argv[2], L"FriendlyTypeName"))
357 if (!_wcsicmp(argv[2], L"DEFAULTICON"))
358 qtype = ASSOCSTR_DEFAULTICON;
359
360 buf[0] = UNICODE_NULL;
361 size /= sizeof(buf[0]); // Convert to number of characters
362 hr = qa->GetString(qflags, (ASSOCSTR)qtype, extra, buf, &size);
363 size *= sizeof(buf[0]); // Convert back to bytes
364 if (SUCCEEDED(hr) ||
366 {
367 wprintf(L"0x%.8X: %s\n", hr, buf);
368 }
369 else
370 {
371 wprintf(size != maxSize ? L"%u " : L"", size);
372 ErrMsg(hr);
373 }
374 }
375 else if (!_wcsicmp(argv[1], L"data"))
376 {
377 if (!_wcsicmp(argv[2], L"EDITFLAGS"))
378 qtype = ASSOCDATA_EDITFLAGS;
379 if (!_wcsicmp(argv[2], L"VALUE"))
380 qtype = ASSOCDATA_VALUE;
381
382 hr = qa->GetData(qflags, (ASSOCDATA)qtype, extra, buf, &size);
383 if (SUCCEEDED(hr))
384 {
385 wprintf(L"0x%.8X: %u byte(s) ", hr, size);
386 DumpBytes(buf, min(size, maxSize));
387 }
388 else
389 {
390 wprintf(size != maxSize ? L"%u " : L"", size);
391 ErrMsg(hr);
392 }
393 }
394 else if (!_wcsicmp(argv[1], L"key"))
395 {
396 HKEY hKey = NULL;
397 hr = qa->GetKey(qflags, (ASSOCKEY)qtype, extra, &hKey);
398 if (SUCCEEDED(hr))
399 {
400 wprintf(L"0x%.8X: hKey %p\n", hr, hKey);
401 RegQueryValueExW(hKey, L"shlextdbg", 0, NULL, NULL, NULL); // Filter by this in Process Monitor
403 }
404 else
405 {
406 ErrMsg(hr);
407 }
408 }
409 else
410 {
411 PrintHelp(L"Unknown query");
413 }
414 return hr;
415}
416
418{
424};
425
432
434{
436 if (!SUCCEEDED(hr))
437 {
438 wprintf(L"Failed to create pidl from '%s': 0x%x\n", FileName, hr);
439 return hr;
440 }
441
442 CComPtr<IShellFolder> shellFolder;
443 PCUITEMID_CHILD childs;
444 hr = SHBindToParent(pidl, IID_PPV_ARG(IShellFolder, &shellFolder), &childs);
445 if (!SUCCEEDED(hr))
446 {
447 wprintf(L"Failed to bind to parent: 0x%x\n", hr);
448 return hr;
449 }
450 hr = shellFolder->GetUIObjectOf(NULL, 1, &childs, IID_IDataObject, NULL, (PVOID*)&dataObject);
451 if (!SUCCEEDED(hr))
452 {
453 wprintf(L"Failed to query IDataObject: 0x%x\n", hr);
454 }
455 return hr;
456}
457
459{
460 CComPtr<IShellExtInit> spShellExtInit;
461 HRESULT hr;
462 if (g_DLL.IsEmpty())
463 {
464 hr = CoCreateInstance(g_CLSID, NULL, CLSCTX_ALL, IID_PPV_ARG(IShellExtInit, &spShellExtInit));
465 if (!SUCCEEDED(hr))
466 {
467 WCHAR Buffer[100];
469 wprintf(L"Failed to Create %s:IShellExtInit: 0x%x\n", Buffer, hr);
470 return hr;
471 }
472 }
473 else
474 {
475 typedef HRESULT (STDAPICALLTYPE *tDllGetClassObject)(REFCLSID rclsid, REFIID riid, LPVOID *ppv);
477 if (!mod)
478 {
479 wprintf(L"Failed to Load %s:(0x%x)\n", g_DLL.GetString(), GetLastError());
480 return E_FAIL;
481 }
482 tDllGetClassObject DllGet = (tDllGetClassObject)GetProcAddress(mod, "DllGetClassObject");
483 if (!DllGet)
484 {
485 wprintf(L"%s does not export DllGetClassObject\n", g_DLL.GetString());
486 return E_FAIL;
487 }
488 CComPtr<IClassFactory> spClassFactory;
489 hr = DllGet(g_CLSID, IID_PPV_ARG(IClassFactory, &spClassFactory));
490 if (!SUCCEEDED(hr))
491 {
492 wprintf(L"Failed to create IClassFactory: 0x%x\n", hr);
493 return hr;
494 }
495 hr = spClassFactory->CreateInstance(NULL, IID_PPV_ARG(IShellExtInit, &spShellExtInit));
496 if (!SUCCEEDED(hr))
497 {
498 wprintf(L"Failed to Request IShellExtInit from IClassFactory: 0x%x\n", hr);
499 return hr;
500 }
501 }
502
503 CComPtr<IDataObject> spDataObject;
505 hr = CreateIDataObject(pidl, spDataObject, g_ShellExtInit.GetString());
506 if (!SUCCEEDED(hr))
507 return hr;
508
509 HKEY hKey = NULL;
511 hr = spShellExtInit->Initialize(pidl, spDataObject, hKey);
512 if (hKey)
514 if (!SUCCEEDED(hr))
515 {
516 wprintf(L"IShellExtInit->Initialize failed: 0x%x\n", hr);
517 return hr;
518 }
519 hr = spShellExtInit->QueryInterface(riid, ppv);
520 if (!SUCCEEDED(hr))
521 {
522 WCHAR Buffer[100];
524 wprintf(L"Failed to query %s from IShellExtInit: 0x%x\n", Buffer, hr);
525 }
526 return hr;
527}
528
529
533{
534 if (hwnd != g_ConsoleWindow)
535 {
536 DWORD pid = 0;
538 if (pid == GetCurrentProcessId())
539 {
540 g_Windows.Add(hwnd);
541 }
542 }
543 return TRUE;
544}
545
547{
548 /* Give the windows some time to spawn */
549 Sleep(2000);
551 while (true)
552 {
553 g_Windows.RemoveAll();
555 if (g_Windows.GetSize() == 0)
556 break;
557 Sleep(500);
558 }
559 wprintf(L"All windows closed (ignoring console window)\n");
560}
561
563{
565 volatile LONG m_rc;
566
569 {
570 static const QITAB rgqit[] = { { 0 } };
571 return QISearch(this, rgqit, riid, ppv);
572 }
574 {
576 wprintf(L"INFO: SHGetInstanceExplorer\n");
577 return InterlockedIncrement(&m_rc);
578 }
580 {
582 wprintf(L"INFO: Release ExplorerInstance\n");
584 if (!r)
586 return r;
587 }
588 void Wait()
589 {
592 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL);
593 BOOL loop = InterlockedDecrement(&m_rc) != 0;
594 MSG msg;
595 while (loop && (int)GetMessage(&msg, NULL, 0, 0) > 0)
596 {
597 if (msg.hwnd == m_hWnd && msg.message == WM_CLOSE)
598 PostMessage(m_hWnd, WM_QUIT, 0, 0);
600 }
601 }
603
604static void Wait()
605{
606 LPCWSTR nag = L"(Please use SHGetInstanceExplorer in your code instead)";
607 switch (g_Wait)
608 {
609 case Wait_None:
610 break;
611 case Wait_Infinite:
612 _putws(nag);
613 while (true)
614 Sleep(1000);
615 break;
616 case Wait_OpenWindows:
617 _putws(nag);
618 WaitWindows();
619 break;
620 case Wait_Input:
621 wprintf(L"Press any key to continue... %s\n", nag);
622 _getch();
623 break;
625 g_EI.Wait();
626 break;
627 }
628}
629
632{
633 g_Pages.Add(page);
634 if (lParam != (LPARAM)&g_Pages)
635 {
636 wprintf(L"Propsheet failed to pass lParam, got: 0x%Ix\n", lParam);
637 }
638 return TRUE;
639}
640
641static bool isCmdWithArg(int argc, WCHAR** argv, int& n, PCWSTR check, PCWSTR &arg)
642{
643 arg = NULL;
644 size_t len = wcslen(check);
645 if (!_wcsnicmp(argv[n] + 1, check, len))
646 {
647 PCWSTR cmd = argv[n] + len + 1;
648 if (*cmd == ':' || *cmd == '=')
649 {
650 arg = cmd + 1;
651 return true;
652 }
653 if (n + 1 < argc)
654 {
655 arg = argv[n+1];
656 n++;
657 return true;
658 }
659 wprintf(L"Command %s has no required argument!\n", check);
660 return false;
661 }
662 return false;
663}
664
665static bool isCmd(int argc, WCHAR** argv, int n, PCWSTR check)
666{
667 return !_wcsicmp(argv[n] + 1, check);
668}
669
670extern "C" // and another hack for gcc
671int wmain(int argc, WCHAR **argv)
672{
676 SHSetInstanceExplorer(static_cast<IUnknown*>(&g_EI));
677
678 bool failArgs = false;
679 for (int n = 1; n < argc; ++n)
680 {
681 WCHAR* cmd = argv[n];
682 if (cmd[0] == '-' || cmd[0] == '/')
683 {
684 PCWSTR arg;
685 if (isCmdWithArg(argc, argv, n, L"shgfi", arg))
686 {
687 failArgs = true;
688 if (*arg)
689 return SHGFI(arg);
690 }
691 else if (isCmd(argc, argv, n, L"assocq"))
692 {
693 failArgs = true;
694 if (argc - (n + 1) >= 6 && argc - (n + 1) <= 8)
695 return AssocQ(argc - (n + 1), &argv[(n + 1)]);
696 }
697 else if (isCmdWithArg(argc, argv, n, L"shellexec", arg))
698 {
699 PIDLIST_ABSOLUTE pidl = NULL;
700 HRESULT hr = SHParseDisplayName(arg, NULL, &pidl, 0, NULL);
701 if (FAILED(hr))
702 return ErrMsg(hr);
703 SHELLEXECUTEINFOW sei = { sizeof(sei), SEE_MASK_IDLIST | SEE_MASK_UNICODE };
704 sei.lpIDList = pidl;
705 sei.nShow = SW_SHOW;
706 while (++n < argc)
707 {
708 if (argv[n][0] != '-' && argv[n][0] != '/')
709 break;
710 else if (isCmd(argc, argv, n, L"MIN"))
712 else if (isCmd(argc, argv, n, L"MAX"))
714 else if (isCmd(argc, argv, n, L"INVOKE"))
716 else if (isCmd(argc, argv, n, L"NOUI"))
718 else if (isCmd(argc, argv, n, L"ASYNCOK"))
719 sei.fMask |= SEE_MASK_ASYNCOK ;
720 else if (isCmd(argc, argv, n, L"NOASYNC"))
721 sei.fMask |= SEE_MASK_NOASYNC;
722 else if (isCmd(argc, argv, n, L"NOCONSOLE"))
724 else if (isCmd(argc, argv, n, L"1000"))
725 sei.fMask |= 0x00001000; // Unknown flag
726 else if (isCmd(argc, argv, n, L"NOHOOKS"))
727 sei.fMask |= 0x00002000;
728 else if (isCmd(argc, argv, n, L"SITE"))
729 {
730 sei.fMask |= 0x08000000; // SEE_MASK_FLAG_HINST_IS_SITE
732 }
733 else if (isCmd(argc, argv, n, L"FILL"))
734 {
735 sei.hInstApp = (HINSTANCE)UlongToHandle(0xCAFE);
736 sei.hProcess = UlongToHandle(0xDEADF00D);
737 }
738 else
739 wprintf(L"WARN: Ignoring switch %s\n", argv[n]);
740 }
741 if (n < argc && *argv[n++])
742 {
743 sei.lpVerb = argv[n - 1];
744 }
745 if (n < argc && *argv[n++])
746 {
747 sei.lpClass = argv[n - 1];
749 }
750 UINT succ = ShellExecuteExW(&sei), gle = GetLastError();
751 SHFree(pidl);
752 if (!succ)
753 return ErrMsg(gle);
754 Wait();
755 return 0;
756 }
757 else if (isCmdWithArg(argc, argv, n, L"dumpmenu", arg))
758 {
759 HRESULT hr;
761 if (CLSIDPrefix(arg, g_CLSID))
762 {
765 }
766 else
767 {
770 if (SUCCEEDED(hr))
771 hr = si->BindToHandler(NULL, BHID_SFUIObject, IID_PPV_ARG(IContextMenu, &cm));
772 }
773 if (SUCCEEDED(hr))
774 {
775 UINT first = 10, last = 9000;
776 UINT cmf = 0, nosub = 0, fakeinit = 0;
777 while (++n < argc)
778 {
779 if (argv[n][0] != '-' && argv[n][0] != '/')
780 break;
781 else if (isCmd(argc, argv, n, L"DEFAULTONLY"))
782 cmf |= CMF_DEFAULTONLY;
783 else if (isCmd(argc, argv, n, L"NODEFAULT"))
784 cmf |= CMF_NODEFAULT;
785 else if (isCmd(argc, argv, n, L"DONOTPICKDEFAULT"))
786 cmf |= CMF_DONOTPICKDEFAULT;
787 else if (isCmd(argc, argv, n, L"EXTENDED") || isCmd(argc, argv, n, L"EXTENDEDVERBS"))
788 cmf |= CMF_EXTENDEDVERBS;
789 else if (isCmd(argc, argv, n, L"SYNCCASCADEMENU"))
790 cmf |= CMF_SYNCCASCADEMENU;
791 else if (isCmd(argc, argv, n, L"EXPLORE"))
792 cmf |= CMF_EXPLORE;
793 else if (isCmd(argc, argv, n, L"VERBSONLY"))
794 cmf |= CMF_VERBSONLY;
795 else if (isCmd(argc, argv, n, L"NOVERBS"))
796 cmf |= CMF_NOVERBS;
797 else if (isCmd(argc, argv, n, L"DISABLEDVERBS"))
798 cmf |= CMF_DISABLEDVERBS;
799 else if (isCmd(argc, argv, n, L"OPTIMIZEFORINVOKE"))
800 cmf |= CMF_OPTIMIZEFORINVOKE;
801 else if (isCmd(argc, argv, n, L"CANRENAME"))
802 cmf |= CMF_CANRENAME;
803 else if (isCmd(argc, argv, n, L"NOSUBMENU"))
804 nosub++;
805 else if (isCmd(argc, argv, n, L"INITMENUPOPUP"))
806 fakeinit++; // Tickle async submenus
807 else
808 wprintf(L"WARN: Ignoring switch %s\n", argv[n]);
809 }
810 HMENU hMenu = CreatePopupMenu();
811 hr = cm->QueryContextMenu(hMenu, 0, first, last, cmf);
812 if (SUCCEEDED(hr))
813 {
814 DumpMenu(hMenu, first, cm, fakeinit, nosub ? -1 : 0);
815 }
816 DestroyMenu(hMenu);
817 }
818 if (FAILED(hr))
819 return ErrMsg(hr);
820 return 0;
821 }
822 else if (isCmdWithArg(argc, argv, n, L"clsid", arg))
823 {
825 if (!SUCCEEDED(hr))
826 {
827 wprintf(L"Failed to convert %s to CLSID\n", arg);
828 failArgs = true;
829 }
830 }
831 else if (isCmdWithArg(argc, argv, n, L"dll", arg))
832 {
833 g_DLL = arg;
834 }
835 else if (isCmdWithArg(argc, argv, n, L"IShellExtInit", arg))
836 {
838 }
839 else if (isCmd(argc, argv, n, L"IShellPropSheetExt"))
840 {
842 }
843 else if (isCmdWithArg(argc, argv, n, L"IContextMenu", arg))
844 {
846 }
847 else if (isCmd(argc, argv, n, L"infinite"))
848 {
850 }
851 else if (isCmd(argc, argv, n, L"openwindows"))
852 {
854 }
855 else if (isCmd(argc, argv, n, L"input"))
856 {
858 }
859 else if (isCmd(argc, argv, n, L"explorerinstance"))
860 {
862 }
863 else if (isCmd(argc, argv, n, L"nowait"))
864 {
866 }
867 else
868 {
869 wprintf(L"Unknown argument: %s\n", cmd);
870 failArgs = true;
871 }
872 }
873 }
874
875 if (failArgs)
876 {
878 return E_INVALIDARG;
879 }
880
881 CLSID EmptyCLSID = { 0 };
882 if (EmptyCLSID == g_CLSID)
883 {
884 PrintHelp(L"No CLSID specified");
885 return E_INVALIDARG;
886 }
887
889 {
890 PrintHelp(L"No filename specified");
891 return E_INVALIDARG;
892 }
893
894 HRESULT hr;
896 {
899 if (!SUCCEEDED(hr))
900 return hr;
901
902 hr = spSheetExt->AddPages(cb_AddPage, (LPARAM)&g_Pages);
903 if (!SUCCEEDED(hr))
904 {
905 wprintf(L"IShellPropSheetExt->AddPages failed: 0x%x\n", hr);
906 return hr;
907 }
908
909 USHORT ActivePage = HRESULT_CODE(hr);
910 PROPSHEETHEADERW psh = { 0 };
911
912 psh.dwSize = sizeof(psh);
914 psh.pszCaption = L"shlextdbg";
915 psh.phpage = g_Pages.GetData();
916 psh.nPages = g_Pages.GetSize();
917 psh.nStartPage = ActivePage ? (ActivePage-1) : 0;
918 hr = PropertySheetW(&psh);
919
920 wprintf(L"PropertySheetW returned: 0x%x\n", hr);
921 }
922 if (!g_ContextMenu.IsEmpty())
923 {
924 CComPtr<IContextMenu> spContextMenu;
925 hr = LoadAndInitialize(IID_PPV_ARG(IContextMenu, &spContextMenu));
926 if (!SUCCEEDED(hr))
927 return hr;
928
929 // FIXME: Must call QueryContextMenu before InvokeCommand?
930
931 CMINVOKECOMMANDINFO cm = { sizeof(cm), 0 };
932 cm.lpVerb = g_ContextMenu.GetString();
933 cm.nShow = SW_SHOW;
934 hr = spContextMenu->InvokeCommand(&cm);
935
936 if (!SUCCEEDED(hr))
937 {
938 wprintf(L"IContextMenu->InvokeCommand failed: 0x%x\n", hr);
939 return hr;
940 }
941 wprintf(L"IContextMenu->InvokeCommand returned: 0x%x\n", hr);
942 }
943
944 Wait();
945 return 0;
946}
DWORD Id
EXTERN_C HRESULT WINAPI SHCreateShellItem(PCIDLIST_ABSOLUTE pidlParent, IShellFolder *psfParent, PCUITEMID_CHILD pidl, IShellItem **ppsi)
Definition: CShellItem.cpp:264
std::map< E_MODULE, HMODULE > mod
Definition: LocaleTests.cpp:66
PRTL_UNICODE_STRING_BUFFER Path
static int argc
Definition: ServiceArgs.c:12
UINT cchMax
Type
Definition: Type.h:7
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define msg(x)
Definition: auth_time.c:54
BOOL Error
Definition: chkdsk.c:66
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
#define RegCloseKey(hKey)
Definition: registry.h:49
bool IsEmpty() const noexcept
Definition: atlsimpstr.h:394
PXSTR GetString() noexcept
Definition: atlsimpstr.h:367
Definition: bufpool.h:45
LPARAM lParam
Definition: combotst.c:139
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:904
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
#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
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
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2916
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define GetProcAddress(x, y)
Definition: compat.h:753
#define MAX_PATH
Definition: compat.h:34
#define CALLBACK
Definition: compat.h:35
#define LoadLibraryW(x)
Definition: compat.h:747
#define lstrcpynW
Definition: compat.h:738
static const WCHAR *const ext[]
Definition: module.c:53
HWND WINAPI GetConsoleWindow(void)
Definition: console.c:1102
HRESULT WINAPI QISearch(void *base, const QITAB *table, REFIID riid, void **obj)
Definition: main.c:421
LPWSTR WINAPI PathFindExtensionW(const WCHAR *path)
Definition: path.c:1217
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2338
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:337
HRESULT WINAPI AssocCreate(CLSID clsid, REFIID refiid, void **lpInterface)
Definition: assoc.c:99
DWORD WINAPI SHGetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
Definition: reg.c:1236
HRESULT WINAPI StrRetToBufW(LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT len)
Definition: string.c:1530
#define check(expected, result)
Definition: dplayx.c:32
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
#define STDAPICALLTYPE
Definition: guid.c:3
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
const GLdouble * v
Definition: gl.h:2040
GLuint GLuint end
Definition: gl.h:1545
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble n
Definition: glext.h:7729
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint in
Definition: glext.h:9616
GLbitfield flags
Definition: glext.h:7161
const GLint * first
Definition: glext.h:5794
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
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 GLint GLint j
Definition: glfuncs.h:250
@ extra
Definition: id3.c:95
_Check_return_opt_ _CRTIMP int __cdecl _putws(_In_z_ const wchar_t *_Str)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
HRESULT GetCommandString([in] UINT_PTR idCmd, [in] UINT uType, [out] UINT *pwReserved, [out, size_is(cchMax)] LPSTR pszName, [in] UINT cchMax)
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define TEXT(s)
Definition: k32.h:28
#define e
Definition: ke_i.h:82
if(dx< 0)
Definition: linetemp.h:194
void PrintHelp()
Definition: appwiz.c:21
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:202
static UINT UINT last
Definition: font.c:45
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
static HWND child
Definition: cursoricon.c:298
#define min(a, b)
Definition: monoChain.cc:55
#define argv
Definition: mplay32.c:18
REFCLSID clsid
Definition: msctf.c:82
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
unsigned int UINT
Definition: ndis.h:50
#define KEY_READ
Definition: nt_native.h:1023
#define UNICODE_NULL
const GUID IID_IDataObject
#define LOWORD(l)
Definition: pedump.c:82
#define WS_POPUP
Definition: pedump.c:616
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
HRESULT WINAPI SHParseDisplayName(LPCWSTR pszName, IBindCtx *pbc, LPITEMIDLIST *ppidl, SFGAOF sfgaoIn, SFGAOF *psfgaoOut)
Definition: pidl.c:1542
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1498
#define PSH_PROPTITLE
Definition: prsht.h:40
#define ICC_STANDARD_CLASSES
Definition: commctrl.h:73
#define ICC_LINK_CLASS
Definition: commctrl.h:74
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
int wmain()
HRESULT WINAPI SHForwardContextMenuMsg(IUnknown *pUnk, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pResult, BOOL useIContextMenu2)
Definition: rosordinal.c:11
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:430
#define SHGFI_SYSICONINDEX
Definition: shellapi.h:171
#define SHGFI_ICONLOCATION
Definition: shellapi.h:169
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:166
#define SEE_MASK_UNICODE
Definition: shellapi.h:40
#define SHGFI_TYPENAME
Definition: shellapi.h:167
#define SHGFI_USEFILEATTRIBUTES
Definition: shellapi.h:181
#define SEE_MASK_CLASSNAME
Definition: shellapi.h:25
#define SHGFI_ATTRIBUTES
Definition: shellapi.h:168
#define SEE_MASK_ASYNCOK
Definition: shellapi.h:43
#define SEE_MASK_IDLIST
Definition: shellapi.h:27
#define SEE_MASK_NOASYNC
Definition: shellapi.h:35
#define SHGFI_PIDL
Definition: shellapi.h:180
#define SEE_MASK_INVOKEIDLIST
Definition: shellapi.h:28
#define SEE_MASK_FLAG_NO_UI
Definition: shellapi.h:38
#define SEE_MASK_NO_CONSOLE
Definition: shellapi.h:41
VOID WINAPI SHSetInstanceExplorer(LPUNKNOWN lpUnknown)
Definition: shellord.c:1694
int _getch()
Definition: getch.c:16
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2552
CLSID g_CLSID
Definition: shlextdbg.cpp:426
CStringA g_ContextMenu
Definition: shlextdbg.cpp:430
static BOOL CALLBACK cb_AddPage(HPROPSHEETPAGE page, LPARAM lParam)
Definition: shlextdbg.cpp:631
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
Definition: shlextdbg.cpp:532
static void Wait()
Definition: shlextdbg.cpp:604
static IServiceProvider * GetLoggingServiceProvider()
Definition: shlextdbg.cpp:130
WaitType g_Wait
Definition: shlextdbg.cpp:431
ExplorerInstance g_EI
static void GetAssocClass(LPCWSTR Path, LPCITEMIDLIST pidl, HKEY &hKey)
Definition: shlextdbg.cpp:158
WaitType
Definition: shlextdbg.cpp:418
@ Wait_OpenWindows
Definition: shlextdbg.cpp:421
@ Wait_Input
Definition: shlextdbg.cpp:422
@ Wait_Infinite
Definition: shlextdbg.cpp:420
@ Wait_ExplorerInstance
Definition: shlextdbg.cpp:423
@ Wait_None
Definition: shlextdbg.cpp:419
static HRESULT GetCommandString(IContextMenu &CM, UINT Id, UINT Type, LPWSTR buf, UINT cchMax)
Definition: shlextdbg.cpp:207
static bool isCmdWithArg(int argc, WCHAR **argv, int &n, PCWSTR check, PCWSTR &arg)
Definition: shlextdbg.cpp:641
static void DumpMenu(HMENU hMenu, UINT IdOffset, IContextMenu *pCM, BOOL FakeInit, UINT Indent)
Definition: shlextdbg.cpp:226
static HRESULT GetUIObjectOfAbsolute(LPCITEMIDLIST pidl, REFIID riid, void **ppv)
Definition: shlextdbg.cpp:136
CSimpleArray< HWND > g_Windows
Definition: shlextdbg.cpp:530
static bool CLSIDPrefix(T &String, CLSID &Clsid)
Definition: shlextdbg.cpp:89
static bool isCmd(int argc, WCHAR **argv, int n, PCWSTR check)
Definition: shlextdbg.cpp:665
static LONG StrToNum(PCWSTR in)
Definition: shlextdbg.cpp:64
CStringW g_ShellExtInit
Definition: shlextdbg.cpp:428
HRESULT LoadAndInitialize(REFIID riid, LPVOID *ppv)
Definition: shlextdbg.cpp:458
static void DumpBytes(const void *Data, SIZE_T cb)
Definition: shlextdbg.cpp:198
bool g_bIShellPropSheetExt
Definition: shlextdbg.cpp:429
static HRESULT CreateShellItemFromParse(PCWSTR Path, IShellItem **ppSI)
Definition: shlextdbg.cpp:146
HWND g_ConsoleWindow
Definition: shlextdbg.cpp:531
HRESULT CreateIDataObject(CComHeapPtr< ITEMIDLIST > &pidl, CComPtr< IDataObject > &dataObject, PCWSTR FileName)
Definition: shlextdbg.cpp:433
CSimpleArray< HPROPSHEETPAGE > g_Pages
Definition: shlextdbg.cpp:630
static int SHGFI(PCWSTR Path)
Definition: shlextdbg.cpp:268
static int ErrMsg(int Error)
Definition: shlextdbg.cpp:71
CStringW g_DLL
Definition: shlextdbg.cpp:427
void WaitWindows()
Definition: shlextdbg.cpp:546
static HRESULT AssocQ(int argc, WCHAR **argv)
Definition: shlextdbg.cpp:313
HRESULT hr
Definition: shlfolder.c:183
ASSOCDATA
Definition: shlwapi.h:641
@ ASSOCDATA_EDITFLAGS
Definition: shlwapi.h:646
@ ASSOCDATA_VALUE
Definition: shlwapi.h:647
ASSOCSTR
Definition: shlwapi.h:611
@ ASSOCSTR_COMMAND
Definition: shlwapi.h:612
@ ASSOCSTR_FRIENDLYDOCNAME
Definition: shlwapi.h:614
@ ASSOCSTR_EXECUTABLE
Definition: shlwapi.h:613
@ ASSOCSTR_DEFAULTICON
Definition: shlwapi.h:626
ASSOCKEY
Definition: shlwapi.h:632
@ ASSOCKEY_CLASS
Definition: shlwapi.h:635
#define QITABENT(Cthis, Ifoo)
Definition: shlwapi.h:2150
DWORD ASSOCF
Definition: shlwapi.h:608
@ STRRET_CSTR
Definition: shtypes.idl:87
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
Definition: shtypes.idl:70
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define _countof(array)
Definition: sndvol32.h:70
ULONG WINAPI AddRef() override
Definition: shlextdbg.cpp:115
HRESULT WINAPI QueryInterface(REFIID riid, void **ppv) override
Definition: shlextdbg.cpp:106
HRESULT WINAPI QueryService(REFGUID rcls, REFIID riid, void **ppv) override
Definition: shlextdbg.cpp:118
ULONG WINAPI Release() override
Definition: shlextdbg.cpp:116
volatile LONG m_rc
Definition: shlextdbg.cpp:565
virtual ULONG STDMETHODCALLTYPE AddRef()
Definition: shlextdbg.cpp:573
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppv)
Definition: shlextdbg.cpp:568
virtual ULONG STDMETHODCALLTYPE Release()
Definition: shlextdbg.cpp:579
Definition: scsiwmi.h:51
DWORD dwSize
Definition: prsht.h:293
DWORD dwFlags
Definition: prsht.h:294
HPROPSHEETPAGE * phpage
Definition: prsht.h:309
UINT nStartPage
Definition: prsht.h:304
LPCWSTR pszCaption
Definition: prsht.h:301
HINSTANCE hInstApp
Definition: shellapi.h:342
char cStr[MAX_PATH]
Definition: shtypes.idl:98
UINT uType
Definition: shtypes.idl:93
Definition: ftp_var.h:139
Definition: module.h:576
LPWSTR dwTypeData
Definition: winuser.h:3345
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
HANDLE HINSTANCE
Definition: typedefs.h:77
uint16_t * PWSTR
Definition: typedefs.h:56
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
#define wprintf(...)
Definition: whoami.c:18
#define FormatMessage
Definition: winbase.h:3836
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define GetFileAttributes
Definition: winbase.h:3856
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:453
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1158
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:456
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
void * arg
Definition: msvc.h:10
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define HRESULT_CODE(hr)
Definition: winerror.h:76
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
const BYTE * LPCBYTE
Definition: winscard.h:34
#define HWND_MESSAGE
Definition: winuser.h:1221
#define CreateWindowEx
Definition: winuser.h:5840
#define SW_SHOWMAXIMIZED
Definition: winuser.h:784
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:838
UINT WINAPI GetMenuDefaultItem(_In_ HMENU hMenu, _In_ UINT fByPos, _In_ UINT gmdiFlags)
#define WM_CLOSE
Definition: winuser.h:1640
#define MIIM_STRING
Definition: winuser.h:738
#define WM_QUIT
Definition: winuser.h:1642
#define MIIM_ID
Definition: winuser.h:733
#define MIIM_FTYPE
Definition: winuser.h:740
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define MFT_SEPARATOR
Definition: winuser.h:755
#define GetMessage
Definition: winuser.h:5875
#define MIIM_SUBMENU
Definition: winuser.h:734
#define WM_INITMENUPOPUP
Definition: winuser.h:1765
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC lpEnumFunc, _In_ LPARAM lParam)
#define PostMessage
Definition: winuser.h:5917
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define SW_SHOW
Definition: winuser.h:786
#define DispatchMessage
Definition: winuser.h:5850
#define GetMenuItemInfo
Definition: winuser.h:5873
#define SW_SHOWMINNOACTIVE
Definition: winuser.h:788
#define IID_PPV_ARG(Itype, ppType)
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185