46 wprintf(
L"Failed to bind to parent: 0x%x\n",
hr);
52 wprintf(
L"Failed to query IDataObject: 0x%x\n",
hr);
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);
154 wprintf(
L"All windows closed (ignoring console window)\n");
165 wprintf(
L"Propsheet failed to pass lParam, got: 0x%Ix\n",
lParam);
177 if (*
cmd ==
':' || *
cmd ==
'=')
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");
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");
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
#define GetProcAddress(x, y)
HWND WINAPI DECLSPEC_HOTPATCH GetConsoleWindow(VOID)
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
#define check(expected, result)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
struct _PSP * HPROPSHEETPAGE
const GUID IID_IDataObject
HRESULT WINAPI SHParseDisplayName(LPCWSTR pszName, IBindCtx *pbc, LPITEMIDLIST *ppidl, SFGAOF sfgaoIn, SFGAOF *psfgaoOut)
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
#define ICC_STANDARD_CLASSES
_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)
static BOOL CALLBACK cb_AddPage(HPROPSHEETPAGE page, LPARAM lParam)
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
static bool isCmdWithArg(int argc, WCHAR **argv, int &n, PCWSTR check, PCWSTR &arg)
CSimpleArray< HWND > g_Windows
static bool isCmd(int argc, WCHAR **argv, int n, PCWSTR check)
HRESULT LoadAndInitialize(REFIID riid, LPVOID *ppv)
bool g_bIShellPropSheetExt
HRESULT CreateIDataObject(CComHeapPtr< ITEMIDLIST > &pidl, CComPtr< IDataObject > &dataObject, PCWSTR FileName)
CSimpleArray< HPROPSHEETPAGE > g_Pages
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
DWORD WINAPI GetLastError(void)
DWORD WINAPI GetCurrentProcessId(void)
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC lpEnumFunc, _In_ LPARAM lParam)
#define IID_PPV_ARG(Itype, ppType)