#include <windows.h>
#include <shlobj.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlstr.h>
#include <atlsimpcoll.h>
#include <conio.h>
#include <shellutils.h>
Go to the source code of this file.
|
HRESULT | CreateIDataObject (CComHeapPtr< ITEMIDLIST > &pidl, CComPtr< IDataObject > &dataObject, PCWSTR FileName) |
|
HRESULT | LoadAndInitialize (REFIID riid, LPVOID *ppv) |
|
BOOL CALLBACK | EnumWindowsProc (HWND hwnd, LPARAM lParam) |
|
void | WaitWindows () |
|
static BOOL CALLBACK | cb_AddPage (HPROPSHEETPAGE page, LPARAM lParam) |
|
static bool | isCmdWithArg (int argc, WCHAR **argv, int &n, PCWSTR check, PCWSTR &arg) |
|
static bool | isCmd (int argc, WCHAR **argv, int n, PCWSTR check) |
|
static void | PrintHelp (PCWSTR ExtraLine) |
|
int | wmain (int argc, WCHAR **argv) |
|
◆ WaitType
Enumerator |
---|
Wait_None | |
Wait_Infinite | |
Wait_OpenWindows | |
Wait_Input | |
Definition at line 17 of file shlextdbg.cpp.
◆ cb_AddPage()
◆ CreateIDataObject()
Definition at line 32 of file shlextdbg.cpp.
46 wprintf(
L"Failed to bind to parent: 0x%x\n",
hr);
52 wprintf(
L"Failed to query IDataObject: 0x%x\n",
hr);
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
const GUID IID_IDataObject
#define IID_PPV_ARG(Itype, ppType)
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
HRESULT WINAPI SHParseDisplayName(LPCWSTR pszName, IBindCtx *pbc, LPITEMIDLIST *ppidl, SFGAOF sfgaoIn, SFGAOF *psfgaoOut)
Referenced by LoadAndInitialize().
◆ EnumWindowsProc()
Definition at line 127 of file shlextdbg.cpp.
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
CSimpleArray< HWND > g_Windows
DWORD WINAPI GetWindowThreadProcessId(HWND, PDWORD)
DWORD WINAPI GetCurrentProcessId(VOID)
Referenced by WaitWindows().
◆ isCmd()
◆ isCmdWithArg()
Definition at line 170 of file shlextdbg.cpp.
177 if (*
cmd ==
':' || *
cmd ==
'=')
_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)
void check(CONTEXT *pContext)
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
Referenced by wmain().
◆ LoadAndInitialize()
Definition at line 57 of file shlextdbg.cpp.
81 tDllGetClassObject DllGet = (tDllGetClassObject)
GetProcAddress(
mod,
"DllGetClassObject");
91 wprintf(
L"Failed to create IClassFactory: 0x%x\n",
hr);
97 wprintf(
L"Failed to Request IShellExtInit from IClassFactory: 0x%x\n",
hr);
108 hr = spShellExtInit->Initialize(pidl, spDataObject,
NULL);
111 wprintf(
L"IShellExtInit->Initialize failed: 0x%x\n",
hr);
114 hr = spShellExtInit->QueryInterface(
riid,
ppv);
DWORD WINAPI GetLastError(VOID)
#define IID_PPV_ARG(Itype, ppType)
HRESULT CreateIDataObject(CComHeapPtr< ITEMIDLIST > &pidl, CComPtr< IDataObject > &dataObject, PCWSTR FileName)
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
#define GetProcAddress(x, y)
Referenced by wmain().
◆ PrintHelp()
Definition at line 199 of file shlextdbg.cpp.
204 wprintf(
L"shlextdbg /clsid={clsid} [/dll=dllname] /IShellExtInit=filename |shlextype| |waitoptions|\n");
205 wprintf(
L" {clsid}: The CLSID or ProgID of the object to create\n");
206 wprintf(
L" dll: Optional dllname to create the object from, instead of CoCreateInstance\n");
207 wprintf(
L" filename: The filename to pass to IShellExtInit->Initialze\n");
208 wprintf(
L" shlextype: The type of shell extention to run:\n");
209 wprintf(
L" /IShellPropSheetExt to create a property sheet\n");
210 wprintf(
L" /IContextMenu=verb to activate the specified verb\n");
211 wprintf(
L" waitoptions: Specify how to wait:\n");
212 wprintf(
L" /infinite: Keep on waiting infinitely\n");
213 wprintf(
L" /openwindows: Wait for all windows from the current application to close\n");
214 wprintf(
L" /input: Wait for input\n");
Referenced by wmain().
◆ WaitWindows()
Definition at line 141 of file shlextdbg.cpp.
154 wprintf(
L"All windows closed (ignoring console window)\n");
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
CSimpleArray< HWND > g_Windows
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC, _In_ LPARAM)
HWND WINAPI DECLSPEC_HOTPATCH GetConsoleWindow(VOID)
Referenced by wmain().
◆ wmain()
Definition at line 227 of file shlextdbg.cpp.
229 bool failArgs =
false;
233 if (
cmd[0] ==
'-' ||
cmd[0] ==
'/')
288 CLSID EmptyCLSID = { 0 };
316 wprintf(
L"IShellPropSheetExt->AddPages failed: 0x%x\n",
hr);
328 psh.
nStartPage = ActivePage ? (ActivePage-1) : 0;
331 wprintf(
L"PropertySheetW returned: 0x%x\n",
hr);
340 CMINVOKECOMMANDINFO cm = {
sizeof(cm), 0 };
343 hr = spContextMenu->InvokeCommand(&cm);
347 wprintf(
L"IContextMenu->InvokeCommand failed: 0x%x\n",
hr);
350 wprintf(
L"IContextMenu->InvokeCommand returned: 0x%x\n",
hr);
366 wprintf(
L"Press any key to continue...\n");
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
static bool isCmd(int argc, WCHAR **argv, int n, PCWSTR check)
static bool isCmdWithArg(int argc, WCHAR **argv, int &n, PCWSTR check, PCWSTR &arg)
static void PrintHelp(PCWSTR ExtraLine)
#define IID_PPV_ARG(Itype, ppType)
bool g_bIShellPropSheetExt
HRESULT LoadAndInitialize(REFIID riid, LPVOID *ppv)
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
static BOOL CALLBACK cb_AddPage(HPROPSHEETPAGE page, LPARAM lParam)
CSimpleArray< HPROPSHEETPAGE > g_Pages
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
#define ICC_STANDARD_CLASSES
◆ g_bIShellPropSheetExt
◆ g_CLSID
◆ g_ConsoleWindow
◆ g_ContextMenu
◆ g_DLL
◆ g_Pages
◆ g_ShellExtInit
◆ g_Wait
◆ g_Windows