ReactOS 0.4.17-dev-470-gf9e3448
shellutils.h
Go to the documentation of this file.
1/*
2 * Copyright 1999, 2000 Juergen Schmied
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19#ifndef __ROS_SHELL_UTILS_H
20#define __ROS_SHELL_UTILS_H
21
22#ifdef __cplusplus
23extern "C" {
24#endif /* defined(__cplusplus) */
25
26static inline ULONG
27Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...)
28{
29 char szMsg[512];
30 char *szMsgStart;
31 const char *fname;
32 va_list vl;
33
34 fname = strrchr(filename, '\\');
35 if (fname == NULL)
36 {
37 fname = strrchr(filename, '/');
38 if (fname != NULL)
39 fname++;
40 }
41 else
42 fname++;
43
44 if (fname == NULL)
45 fname = filename;
46
47 szMsgStart = szMsg + sprintf(szMsg, "%s:%d: ", fname, line);
48
49 va_start(vl, lpFormat);
50 vsprintf(szMsgStart, lpFormat, vl);
51 va_end(vl);
52
53 OutputDebugStringA(szMsg);
54
55 /* Return STATUS_SUCCESS, since we are supposed to mimic DbgPrint */
56 return 0;
57}
58
59#define DbgPrint(fmt, ...) \
60 Win32DbgPrint(__FILE__, __LINE__, fmt, ##__VA_ARGS__)
61
62#ifdef __cplusplus
63# define IID_PPV_ARG(Itype, ppType) IID_##Itype, reinterpret_cast<void**>((static_cast<Itype**>(ppType)))
64# define IID_NULL_PPV_ARG(Itype, ppType) IID_##Itype, NULL, reinterpret_cast<void**>((static_cast<Itype**>(ppType)))
65#else
66# define IID_PPV_ARG(Itype, ppType) &IID_##Itype, (void**)(ppType)
67# define IID_NULL_PPV_ARG(Itype, ppType) &IID_##Itype, NULL, (void**)(ppType)
68#endif
69
71{
72 // HRESULT_FROM_WIN32 will evaluate its parameter twice, this function will not.
73 return HRESULT_FROM_WIN32(hr);
74}
75
76#if 1
77
78static inline BOOL _ROS_FAILED_HELPER(HRESULT hr, const char* expr, const char* filename, int line)
79{
80 if (FAILED(hr))
81 {
82 Win32DbgPrint(filename, line, "Unexpected failure (%s)=%08x.\n", expr, hr);
83 return TRUE;
84 }
85 return FALSE;
86}
87
88#define FAILED_UNEXPECTEDLY(hr) _ROS_FAILED_HELPER((hr), #hr, __FILE__, __LINE__)
89#else
90#define FAILED_UNEXPECTEDLY(hr) FAILED(hr)
91#endif
92
93#ifdef __cplusplus
94} /* extern "C" */
95#endif /* defined(__cplusplus) */
96
97static inline UINT
99{
100 WCHAR buf[400];
101 UINT cch;
102
103 if (!IsWindowVisible(hwndOwner))
104 hwndOwner = NULL;
105 if (Error == ERROR_SUCCESS)
107
109 NULL, Error, 0, buf, _countof(buf), NULL);
110 if (!cch)
111 {
112 enum { user32_IDS_ERROR = 2 }; // IDS_ERROR from user32 resource.h ("Error" string)
113 cch = LoadStringW(LoadLibraryW(L"USER32"), user32_IDS_ERROR, buf, _countof(buf));
114 wsprintfW(buf + cch, L"\n\n%#x (%d)", Error, Error);
115 }
116 MessageBoxW(hwndOwner, buf, NULL, MB_OK | MB_ICONSTOP);
117 return Error;
118}
119#ifdef __cplusplus
120template<class H> static UINT
121SHELL_ErrorBox(H hwndOwner, UINT Error = GetLastError())
122{
123 return SHELL_ErrorBoxHelper(const_cast<HWND>(hwndOwner), Error);
124}
125#else
126#define SHELL_ErrorBox SHELL_ErrorBoxHelper
127#endif
128
129#ifdef __cplusplus
130#ifdef DECLARE_CLASSFACTORY // ATL
131template <typename T>
132class CComCreatorCentralInstance
133{
134private:
135 static IUnknown *s_pInstance;
136
137public:
138 static HRESULT WINAPI CreateInstance(void *pv, REFIID riid, LPVOID *ppv)
139 {
140 *ppv = NULL;
141 if (pv != NULL)
143 if (!s_pInstance)
144 {
145 PVOID pObj;
146 HRESULT hr;
148 if (FAILED(hr))
149 return hr;
150 if (InterlockedCompareExchangePointer((PVOID *)&s_pInstance, pObj, NULL))
151 static_cast<IUnknown *>(pObj)->Release();
152 }
153 return s_pInstance->QueryInterface(riid, ppv);
154 }
155 static void Term()
156 {
157 if (s_pInstance)
158 {
159 s_pInstance->Release();
160 s_pInstance = NULL;
161 }
162 }
163};
164
165template <typename T>
166IUnknown *CComCreatorCentralInstance<T>::s_pInstance = NULL;
167
168#define DECLARE_CENTRAL_INSTANCE_NOT_AGGREGATABLE(x) \
169public: \
170 typedef CComCreatorCentralInstance< ATL::CComObject<x> > _CreatorClass;
171
172
173template <class Base>
174class CComDebugObject : public Base
175{
176public:
177 CComDebugObject(void * = NULL)
178 {
179#if DEBUG_CCOMOBJECT_CREATION
180 DbgPrint("%S, this=%08p\n", __FUNCTION__, static_cast<Base*>(this));
181#endif
182 _pAtlModule->Lock();
183 }
184
185 virtual ~CComDebugObject()
186 {
187 this->FinalRelease();
188 _pAtlModule->Unlock();
189 }
190
192 {
193 int rc = this->InternalAddRef();
194#if DEBUG_CCOMOBJECT_REFCOUNTING
195 DbgPrint("%s, RefCount is now %d(--)!\n", __FUNCTION__, rc);
196#endif
197 return rc;
198 }
199
201 {
202 int rc = this->InternalRelease();
203
204#if DEBUG_CCOMOBJECT_REFCOUNTING
205 DbgPrint("%s, RefCount is now %d(--)!\n", __FUNCTION__, rc);
206#endif
207
208 if (rc == 0)
209 {
210#if DEBUG_CCOMOBJECT_DESTRUCTION
211 DbgPrint("%s, RefCount reached 0 Deleting!\n", __FUNCTION__);
212#endif
213 delete this;
214 }
215 return rc;
216 }
217
218 STDMETHOD(QueryInterface)(REFIID iid, void **ppvObject)
219 {
220 return this->_InternalQueryInterface(iid, ppvObject);
221 }
222
223 static HRESULT WINAPI CreateInstance(CComDebugObject<Base> **pp)
224 {
225 CComDebugObject<Base> *newInstance;
226 HRESULT hResult;
227
228 ATLASSERT(pp != NULL);
229 if (pp == NULL)
230 return E_POINTER;
231
232 hResult = E_OUTOFMEMORY;
233 newInstance = NULL;
234 ATLTRY(newInstance = new CComDebugObject<Base>());
235 if (newInstance != NULL)
236 {
237 newInstance->SetVoid(NULL);
238 newInstance->InternalFinalConstructAddRef();
239 hResult = newInstance->_AtlInitialConstruct();
240 if (SUCCEEDED(hResult))
241 hResult = newInstance->FinalConstruct();
242 if (SUCCEEDED(hResult))
243 hResult = newInstance->_AtlFinalConstruct();
244 newInstance->InternalFinalConstructRelease();
245 if (hResult != S_OK)
246 {
247 delete newInstance;
248 newInstance = NULL;
249 }
250 }
251 *pp = newInstance;
252 return hResult;
253 }
254};
255
256#ifdef DEBUG_CCOMOBJECT
257# define _CComObject CComDebugObject
258#else
259# define _CComObject CComObject
260#endif
261
262template<class T>
263ULONG ReleaseCComPtrExpectZeroHelper(const char *file, UINT line, CComPtr<T>& cptr, BOOL forceRelease = FALSE)
264{
265 ULONG r = 0;
266 if (cptr.p != NULL)
267 {
268 T *raw = cptr.Detach();
269 int nrc = r = raw->Release();
270 if (nrc > 0)
271 Win32DbgPrint(file, line, "WARNING: Unexpected RefCount > 0 (%d)\n", nrc);
272 while (nrc > 0 && forceRelease)
273 {
274 nrc = raw->Release();
275 }
276 }
277 return r;
278}
279#define ReleaseCComPtrExpectZero(...) ReleaseCComPtrExpectZeroHelper(__FILE__, __LINE__, __VA_ARGS__)
280
281template<class T, class R>
282HRESULT inline ShellDebugObjectCreator(REFIID riid, R ** ppv)
283{
284 CComPtr<T> obj;
285 HRESULT hResult;
286
287 if (ppv == NULL)
288 return E_POINTER;
289 *ppv = NULL;
290 ATLTRY(obj = new CComDebugObject<T>);
291 if (obj.p == NULL)
292 return E_OUTOFMEMORY;
293 hResult = obj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
294 if (FAILED(hResult))
295 return hResult;
296 return S_OK;
297}
298
299template<class T>
300HRESULT inline ShellObjectCreator(CComPtr<T> &objref)
301{
302 _CComObject<T> *pobj;
303 HRESULT hResult = _CComObject<T>::CreateInstance(&pobj);
304 objref = pobj; // AddRef() gets called here
305 if (FAILED(hResult))
306 return hResult;
307 return S_OK;
308}
309
310template<class T>
311HRESULT inline ShellObjectCreator(REFIID riid, void ** ppv)
312{
313 _CComObject<T> *pobj;
314 HRESULT hResult;
315
316 hResult = _CComObject<T>::CreateInstance(&pobj);
317 if (FAILED(hResult))
318 return hResult;
319
320 pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
321
322 hResult = pobj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
323
324 pobj->Release(); /* In case of failure the object will be released */
325
326 return hResult;
327}
328
329template<class T>
330HRESULT inline ShellObjectCreatorInit(REFIID riid, void ** ppv)
331{
332 _CComObject<T> *pobj;
333 HRESULT hResult;
334
335 hResult = _CComObject<T>::CreateInstance(&pobj);
336 if (FAILED(hResult))
337 return hResult;
338
339 pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
340
341 hResult = pobj->Initialize();
342
343 if (SUCCEEDED(hResult))
344 hResult = pobj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
345
346 pobj->Release(); /* In case of failure the object will be released */
347
348 return hResult;
349}
350
351template<class T, class T1>
352HRESULT inline ShellObjectCreatorInit(T1 initArg1, REFIID riid, void ** ppv)
353{
354 _CComObject<T> *pobj;
355 HRESULT hResult;
356
357 hResult = _CComObject<T>::CreateInstance(&pobj);
358 if (FAILED(hResult))
359 return hResult;
360
361 pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
362
363 hResult = pobj->Initialize(initArg1);
364
365 if (SUCCEEDED(hResult))
366 hResult = pobj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
367
368 pobj->Release(); /* In case of failure the object will be released */
369
370 return hResult;
371}
372
373template<class T, class T1, class T2>
374HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, REFIID riid, void ** ppv)
375{
376 _CComObject<T> *pobj;
377 HRESULT hResult;
378
379 hResult = _CComObject<T>::CreateInstance(&pobj);
380 if (FAILED(hResult))
381 return hResult;
382
383 pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
384
385 hResult = pobj->Initialize(initArg1, initArg2);
386
387 if (SUCCEEDED(hResult))
388 hResult = pobj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
389
390 pobj->Release(); /* In case of failure the object will be released */
391
392 return hResult;
393}
394
395template<class T, class T1, class T2, class T3>
396HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, T3 initArg3, REFIID riid, void ** ppv)
397{
398 _CComObject<T> *pobj;
399 HRESULT hResult;
400
401 hResult = _CComObject<T>::CreateInstance(&pobj);
402 if (FAILED(hResult))
403 return hResult;
404
405 pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
406
407 hResult = pobj->Initialize(initArg1, initArg2, initArg3);
408
409 if (SUCCEEDED(hResult))
410 hResult = pobj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
411
412 pobj->Release(); /* In case of failure the object will be released */
413
414 return hResult;
415}
416
417template<class T, class T1, class T2, class T3, class T4>
418HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, T3 initArg3, T4 initArg4, REFIID riid, void ** ppv)
419{
420 _CComObject<T> *pobj;
421 HRESULT hResult;
422
423 hResult = _CComObject<T>::CreateInstance(&pobj);
424 if (FAILED(hResult))
425 return hResult;
426
427 pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
428
429 hResult = pobj->Initialize(initArg1, initArg2, initArg3, initArg4);
430
431 if (SUCCEEDED(hResult))
432 hResult = pobj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
433
434 pobj->Release(); /* In case of failure the object will be released */
435
436 return hResult;
437}
438
439template<class T, class T1, class T2, class T3, class T4, class T5>
440HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, T3 initArg3, T4 initArg4, T5 initArg5, REFIID riid, void ** ppv)
441{
442 _CComObject<T> *pobj;
443 HRESULT hResult;
444
445 hResult = _CComObject<T>::CreateInstance(&pobj);
446 if (FAILED(hResult))
447 return hResult;
448
449 pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
450
451 hResult = pobj->Initialize(initArg1, initArg2, initArg3, initArg4, initArg5);
452
453 if (SUCCEEDED(hResult))
454 hResult = pobj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
455
456 pobj->Release(); /* In case of failure the object will be released */
457
458 return hResult;
459}
460#endif // DECLARE_CLASSFACTORY (ATL)
461
462template<class P, class R> static HRESULT SHILClone(P pidl, R *ppOut)
463{
464 R r = *ppOut = (R)ILClone((PIDLIST_RELATIVE)pidl);
465 return r ? S_OK : E_OUTOFMEMORY;
466}
467
468template<class P, class R> static HRESULT SHILCloneParent(P pidl, R *ppOut)
469{
470 R r = *ppOut = (R)ILClone((PIDLIST_RELATIVE)pidl);
471 if (r)
472 ILRemoveLastID(r); // "c:\folder\thisitem" => "c:\folder"
473 return r ? S_OK : E_OUTOFMEMORY;
474}
475
476template<class B, class R> static HRESULT SHILCombine(B base, PCUIDLIST_RELATIVE sub, R *ppOut)
477{
478 R r = *ppOut = (R)ILCombine((PCIDLIST_ABSOLUTE)base, sub);
479 return r ? S_OK : E_OUTOFMEMORY;
480}
481
482static inline bool StrIsNullOrEmpty(LPCSTR str) { return !str || !*str; }
483static inline bool StrIsNullOrEmpty(LPCWSTR str) { return !str || !*str; }
484
485HRESULT inline SHSetStrRetEmpty(LPSTRRET pStrRet)
486{
487 pStrRet->uType = STRRET_CSTR;
488 pStrRet->cStr[0] = '\0';
489 return S_OK;
490}
491
492HRESULT inline SHSetStrRet(LPSTRRET pStrRet, LPCSTR pstrValue)
493{
494 pStrRet->uType = STRRET_CSTR;
495 strcpy(pStrRet->cStr, pstrValue);
496 return S_OK;
497}
498
499HRESULT inline SHSetStrRet(LPSTRRET pStrRet, LPCWSTR pwstrValue)
500{
501 SIZE_T cchr = wcslen(pwstrValue);
502 LPWSTR buffer = static_cast<LPWSTR>(CoTaskMemAlloc((cchr + 1) * sizeof(WCHAR)));
503 if (buffer == NULL)
504 return E_OUTOFMEMORY;
505
506 pStrRet->uType = STRRET_WSTR;
507 pStrRet->pOleStr = buffer;
508 wcscpy(buffer, pwstrValue);
509 return S_OK;
510}
511
512HRESULT inline SHSetStrRet(LPSTRRET pStrRet, HINSTANCE hInstance, DWORD resId)
513{
515
516 if (!LoadStringW(hInstance, resId, Buffer, MAX_PATH))
517 return E_FAIL;
518
519 return SHSetStrRet(pStrRet, Buffer);
520}
521
522static inline void DbgDumpMenuInternal(HMENU hmenu, char* padding, int padlevel)
523{
524 WCHAR label[128];
525 int i;
527
528 padding[padlevel] = '.';
529 padding[padlevel + 1] = '.';
530 padding[padlevel + 2] = 0;
531
532 for (i = 0; i < count; i++)
533 {
534 MENUITEMINFOW mii = { 0 };
535
536 mii.cbSize = sizeof(mii);
538 mii.dwTypeData = label;
539 mii.cch = _countof(label);
540
541 GetMenuItemInfoW(hmenu, i, TRUE, &mii);
542
543 if (mii.fType & MFT_BITMAP)
544 DbgPrint("%s%2d - %08x: BITMAP %08p (state=%d, has submenu=%s)\n", padding, i, mii.wID, mii.hbmpItem, mii.fState, mii.hSubMenu ? "TRUE" : "FALSE");
545 else if (mii.fType & MFT_SEPARATOR)
546 DbgPrint("%s%2d - %08x ---SEPARATOR---\n", padding, i, mii.wID);
547 else
548 DbgPrint("%s%2d - %08x: %S (state=%d, has submenu=%s)\n", padding, i, mii.wID, mii.dwTypeData, mii.fState, mii.hSubMenu ? "TRUE" : "FALSE");
549
550 if (mii.hSubMenu)
551 DbgDumpMenuInternal(mii.hSubMenu, padding, padlevel + 2);
552
553 }
554
555 padding[padlevel] = 0;
556}
557
558static __inline void DbgDumpMenu(HMENU hmenu)
559{
560 char padding[128];
561 DbgDumpMenuInternal(hmenu, padding, 0);
562}
563
564
565static inline
566void DumpIdList(LPCITEMIDLIST pcidl)
567{
568 DbgPrint("Begin IDList Dump\n");
569
570 for (; pcidl != NULL; pcidl = ILGetNext(pcidl))
571 {
572 int i;
573 int cb = pcidl->mkid.cb;
574 BYTE * sh = (BYTE*) &(pcidl->mkid);
575 if (cb == 0) // ITEMIDLISTs are terminatedwith a null SHITEMID.
576 break;
577 DbgPrint("Begin SHITEMID (cb=%d)\n", cb);
578 if ((cb & 3) != 0)
579 DbgPrint(" - WARNING: cb is not a multiple of 4\n");
580 for (i = 0; (i + 4) <= cb; i += 4)
581 {
582 DbgPrint(" - abID[%08x]: %02x %02x %02x %02x\n",
583 i,
584 sh[i + 0],
585 sh[i + 1],
586 sh[i + 2],
587 sh[i + 3]);
588 }
589 if (i < cb)
590 {
591 cb -= i;
592 if (cb == 3)
593 {
594 DbgPrint(" - abID[%08x]: %02x %02x %02x --\n",
595 i,
596 sh[i + 0],
597 sh[i + 1],
598 sh[i + 2]);
599 }
600 else if (cb == 2)
601 {
602 DbgPrint(" - abID[%08x]: %02x %02x -- --\n",
603 i,
604 sh[i + 0],
605 sh[i + 1]);
606 }
607 else if (cb == 1)
608 {
609 DbgPrint(" - abID[%08x]: %02x -- -- --\n",
610 i,
611 sh[i + 0]);
612 }
613 }
614 DbgPrint("End SHITEMID\n");
615 }
616 DbgPrint("End IDList Dump.\n");
617}
618
619template <HRESULT (WINAPI *InitFunc)(void*), void (WINAPI *UninitFunc)()>
620struct CCoInitBase
621{
622 HRESULT hr;
623 CCoInitBase() : hr(InitFunc(NULL)) { }
624 ~CCoInitBase()
625 {
626 if (SUCCEEDED(hr))
627 UninitFunc();
628 }
629};
630typedef CCoInitBase<CoInitialize, CoUninitialize> CCoInit;
631typedef CCoInitBase<OleInitialize, OleUninitialize> COleInit;
632
633class CObjectWithSiteBase :
634 public IObjectWithSite
635{
636public:
637 IUnknown* m_pUnkSite;
638
639 CObjectWithSiteBase() : m_pUnkSite(NULL) {}
640 virtual ~CObjectWithSiteBase() { SetSite(NULL); }
641
642 // IObjectWithSite
643 STDMETHODIMP SetSite(IUnknown *pUnkSite) override
644 {
645#if defined(__WINE_SHLWAPI_H) && !defined(NO_SHLWAPI)
646 IUnknown_Set(&m_pUnkSite, pUnkSite);
647#else
648 IUnknown *punkOrg = m_pUnkSite;
649 if (punkOrg)
650 punkOrg->Release();
651 m_pUnkSite = pUnkSite;
652 if (pUnkSite)
653 pUnkSite->AddRef();
654#endif
655 return S_OK;
656 }
657 STDMETHODIMP GetSite(REFIID riid, void **ppvSite) override
658 {
659 *ppvSite = NULL;
660 return m_pUnkSite ? m_pUnkSite->QueryInterface(riid, ppvSite) : E_FAIL;
661 }
662};
663
664#if defined(_INC_SHLWAPI) && !defined(NO_SHLWAPI)
665struct CScopedSetObjectWithSite
666{
667 IUnknown *m_pObj;
668 explicit CScopedSetObjectWithSite(IUnknown *pObj, IUnknown *pSite) : m_pObj(pObj)
669 {
670 if (pSite)
671 IUnknown_SetSite(pObj, pSite);
672 else
673 m_pObj = NULL;
674 }
675 ~CScopedSetObjectWithSite()
676 {
677 IUnknown_SetSite(m_pObj, NULL);
678 }
679};
680#endif
681#endif /* __cplusplus */
682
683#define S_LESSTHAN 0xffff
684#define S_EQUAL S_OK
685#define S_GREATERTHAN S_FALSE
686#define MAKE_COMPARE_HRESULT(x) ((x)>0 ? S_GREATERTHAN : ((x)<0 ? S_LESSTHAN : S_EQUAL))
687
688#ifdef _UNDOCSHELL_H
689/* The SEE_MASK_* defines that are undocumented, are defined in reactos/undocshell.h */
690#define SEE_CMIC_COMMON_BASICFLAGS (SEE_MASK_NOASYNC | SEE_MASK_ASYNCOK | SEE_MASK_UNICODE | \
691 SEE_MASK_NO_CONSOLE | SEE_MASK_FLAG_NO_UI | SEE_MASK_FLAG_SEPVDM | \
692 SEE_MASK_FLAG_LOG_USAGE | SEE_MASK_NOZONECHECKS)
693#define SEE_CMIC_COMMON_FLAGS (SEE_CMIC_COMMON_BASICFLAGS | SEE_MASK_HOTKEY | SEE_MASK_ICON | \
694 SEE_MASK_HASLINKNAME | SEE_MASK_HASTITLE)
695
696#define CmicFlagsToSeeFlags(flags) ((flags) & SEE_CMIC_COMMON_FLAGS)
697static inline UINT SeeFlagsToCmicFlags(UINT flags)
698{
701 return flags & SEE_CMIC_COMMON_FLAGS;
702}
703#endif // _UNDOCSHELL_H
704
706{
707 return uMsg == WM_MEASUREITEM || uMsg == WM_DRAWITEM ||
708 uMsg == WM_INITMENUPOPUP || uMsg == WM_MENUSELECT || uMsg == WM_MENUCHAR;
709}
710
711static inline BOOL ILIsSingle(LPCITEMIDLIST pidl)
712{
713 return pidl == ILFindLastID(pidl);
714}
715
717{
718 return (PCUIDLIST_ABSOLUTE)(((LPBYTE)pida) + (pida)->aoffset[0]);
719}
720
722{
723 return (PCUIDLIST_RELATIVE)(((LPBYTE)pida) + (pida)->aoffset[i + 1]);
724}
725
726
727#ifdef __cplusplus
728
729#if defined(CMIC_MASK_UNICODE) && defined(SEE_MASK_UNICODE)
730static inline bool IsUnicode(const CMINVOKECOMMANDINFOEX &ici)
731{
732 const UINT minsize = FIELD_OFFSET(CMINVOKECOMMANDINFOEX, ptInvoke);
733 return (ici.fMask & CMIC_MASK_UNICODE) && ici.cbSize >= minsize;
734}
735
736static inline bool IsUnicode(const CMINVOKECOMMANDINFO &ici)
737{
738 return IsUnicode(*(CMINVOKECOMMANDINFOEX*)&ici);
739}
740#endif // CMIC_MASK_UNICODE
741
742DECLSPEC_SELECTANY CLIPFORMAT g_cfHIDA = NULL;
743DECLSPEC_SELECTANY CLIPFORMAT g_cfShellIdListOffsets = NULL;
744
745// Allow to use the HIDA from an IDataObject without copying it
746struct CDataObjectHIDA
747{
748private:
749 STGMEDIUM m_medium;
750 CIDA* m_cida;
751 HRESULT m_hr;
752
753public:
754 explicit CDataObjectHIDA(IDataObject* pDataObject)
755 : m_cida(nullptr)
756 {
757 m_hr = CreateCIDA(pDataObject, &m_cida, m_medium);
758 }
759
760 ~CDataObjectHIDA()
761 {
762 DestroyCIDA(m_cida, m_medium);
763 }
764
765 static void DestroyCIDA(CIDA *pcida, STGMEDIUM &medium)
766 {
767 if (pcida)
768 ::GlobalUnlock(medium.hGlobal);
769 ReleaseStgMedium(&medium);
770 }
771
772 static HRESULT CreateCIDA(IDataObject* pDataObject, CIDA **ppcida, STGMEDIUM &medium)
773 {
774 *ppcida = NULL;
775 medium.pUnkForRelease = NULL;
776 if (g_cfHIDA == NULL)
777 g_cfHIDA = (CLIPFORMAT)RegisterClipboardFormatW(CFSTR_SHELLIDLISTW);
778
779 FORMATETC fmt = { g_cfHIDA, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
780 HRESULT hr = pDataObject->GetData(&fmt, &medium);
781 if (SUCCEEDED(hr))
782 {
783 *ppcida = (CIDA*)::GlobalLock(medium.hGlobal);
784 if (*ppcida)
785 return S_OK;
786 ReleaseStgMedium(&medium);
788 }
789 medium.tymed = TYMED_NULL;
790 return hr;
791 }
792
793 HRESULT hr() const
794 {
795 return m_hr;
796 }
797
798 operator bool() const
799 {
800 return m_cida != nullptr;
801 }
802
803 operator const CIDA* () const
804 {
805 return m_cida;
806 }
807
808 const CIDA* operator->() const
809 {
810 return m_cida;
811 }
812};
813
814inline
815HRESULT DataObject_GetData(IDataObject* pDataObject, CLIPFORMAT clipformat, PVOID pBuffer, SIZE_T dwBufferSize)
816{
817 FORMATETC fmt = { clipformat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
818 STGMEDIUM medium = { TYMED_NULL };
819
820 HRESULT hr = pDataObject->GetData(&fmt, &medium);
821 if (SUCCEEDED(hr))
822 {
823 LPVOID blob = GlobalLock(medium.hGlobal);
824 if (blob)
825 {
826 SIZE_T size = GlobalSize(medium.hGlobal);
827 if (size <= dwBufferSize)
828 {
830 hr = S_OK;
831 }
832 else
833 {
835 }
836 GlobalUnlock(medium.hGlobal);
837 }
838 else
839 {
841 }
842
843 ReleaseStgMedium(&medium);
844 }
845 return hr;
846}
847
848inline
849HRESULT DataObject_SetData(IDataObject* pDataObject, CLIPFORMAT clipformat, PVOID pBuffer, SIZE_T dwBufferSize)
850{
851 STGMEDIUM medium = { TYMED_HGLOBAL };
852
853 medium.hGlobal = GlobalAlloc(GHND, dwBufferSize);
854 if (!medium.hGlobal)
855 return E_OUTOFMEMORY;
856
858 LPVOID blob = GlobalLock(medium.hGlobal);
859 if (blob)
860 {
861 CopyMemory(blob, pBuffer, dwBufferSize);
862 GlobalUnlock(medium.hGlobal);
863
864 FORMATETC etc = { clipformat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
865 hr = pDataObject->SetData(&etc, &medium, TRUE);
866 }
867
868 if (FAILED(hr))
869 GlobalFree(medium.hGlobal);
870
871 return hr;
872}
873
874
875inline HRESULT
876DataObject_GetOffset(IDataObject *pDataObject, POINT *point)
877{
878 if (g_cfShellIdListOffsets == NULL)
879 {
880 g_cfShellIdListOffsets = (CLIPFORMAT)RegisterClipboardFormatW(CFSTR_SHELLIDLISTOFFSETW);
881 }
882
883 point->x = point->y = 0;
884
885 return DataObject_GetData(pDataObject, g_cfShellIdListOffsets, point, sizeof(point[0]));
886}
887
888inline HRESULT
889DataObject_SetOffset(IDataObject* pDataObject, POINT* point)
890{
891 if (g_cfShellIdListOffsets == NULL)
892 {
893 g_cfShellIdListOffsets = (CLIPFORMAT)RegisterClipboardFormatW(CFSTR_SHELLIDLISTOFFSETW);
894 }
895
896 return DataObject_SetData(pDataObject, g_cfShellIdListOffsets, point, sizeof(point[0]));
897}
898
899#endif // __cplusplus
900
901#ifdef __cplusplus
902struct SHELL_GetSettingImpl
903{
905 SHELL_GetSettingImpl(DWORD ssf) { SHGetSetSettings(&ss, ssf, FALSE); }
906 const SHELLSTATE* operator ->() { return &ss; }
907};
908#define SHELL_GetSetting(ssf, field) ( SHELL_GetSettingImpl(ssf)->field )
909#else
910#define SHELL_GetSetting(pss, ssf, field) ( SHGetSetSettings((pss), (ssf), FALSE), (pss)->field )
911#endif
912
913static inline void DumpIdListOneLine(LPCITEMIDLIST pidl)
914{
915 char buf[1024], *data, drive = 0;
916 for (UINT depth = 0, type; ; pidl = ILGetNext(pidl), ++depth)
917 {
918 if (!pidl || !pidl->mkid.cb)
919 {
920 if (!depth)
921 {
922 wsprintfA(buf, "%p [] (%s)\n", pidl, pidl ? "Empty/Desktop" : "NULL");
924 }
925 break;
926 }
927 else if (!depth)
928 {
929 wsprintfA(buf, "%p", pidl);
931 }
932 type = pidl->mkid.abID[0] & 0x7f;
933 data = (char*)&pidl->mkid.abID[0];
934 if (depth == 0 && type == 0x1f && pidl->mkid.cb == 20 && *(UINT*)(&data[2]) == 0x20D04FE0)
935 {
936 wsprintfA(buf, " [%.2x ThisPC?]", type); /* "?" because we did not check the full GUID */
937 }
938 else if (depth == 1 && type >= 0x20 && type < 0x30 && type != 0x2E && pidl->mkid.cb > 4)
939 {
940 drive = data[1];
941 wsprintfA(buf, " [%.2x %c: %ub]", type, drive, pidl->mkid.cb);
942 }
943 else if (depth >= 2 && drive && (type & 0x70) == 0x30) /* PT_FS */
944 {
945 if (type & 4)
946 wsprintfA(buf, " [%.2x FS %.256ls %ub]", type, data + 12, pidl->mkid.cb);
947 else
948 wsprintfA(buf, " [%.2x FS %.256hs %ub]", type, data + 12, pidl->mkid.cb);
949 }
950 else
951 {
952 wsprintfA(buf, " [%.2x ? %ub]", type, pidl->mkid.cb);
953 }
955 }
956 OutputDebugStringA("\n");
957}
958
959#endif /* __ROS_SHELL_UTILS_H */
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
#define __inline
Definition: _wctype.cpp:15
#define ATLTRY(x)
Definition: atlcomcli.h:44
BOOL Error
Definition: chkdsk.c:66
#define STDMETHODIMP
Definition: basetyps.h:43
#define STDMETHOD_(t, m)
Definition: basetyps.h:63
#define STDMETHOD(m)
Definition: basetyps.h:62
const GUID IID_IUnknown
_In_ BOOLEAN Release
Definition: cdrom.h:920
HINSTANCE hInstance
Definition: charmap.c:19
static HRESULT WINAPI CreateInstance(void *pv, REFIID riid, LPVOID *ppv)
Definition: atlcom.h:424
Definition: ehthrow.cxx:54
Definition: bufpool.h:45
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_FAIL
Definition: ddrawi.h:102
HRESULT hr
Definition: delayimp.cpp:582
#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
#define P(row, col)
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
#define MAX_PATH
Definition: compat.h:34
#define LoadLibraryW(x)
Definition: compat.h:747
static HRESULT WINAPI DataObject_GetData(LPDATAOBJECT iface, LPFORMATETC pformatetcIn, STGMEDIUM *pmedium)
Definition: view.c:175
static HRESULT WINAPI DataObject_SetData(LPDATAOBJECT iface, LPFORMATETC pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
Definition: view.c:203
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
static MonoProfilerRuntimeShutdownBeginCallback cb
Definition: metahost.c:118
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
#define va_end(v)
Definition: stdarg.h:28
#define va_start(v, l)
Definition: stdarg.h:26
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl vsprintf(char *, const char *, va_list) __WINE_CRT_PRINTF_ATTR(2
_ACRTIMP char *__cdecl strrchr(const char *, int)
Definition: string.c:3303
char * va_list
Definition: vadefs.h:50
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2014
void WINAPI IUnknown_Set(IUnknown **dest, IUnknown *src)
Definition: main.c:209
HRESULT WINAPI IUnknown_SetSite(IUnknown *obj, IUnknown *site)
Definition: main.c:222
HRESULT SHILClone(_In_opt_ LPCITEMIDLIST pidl, _Outptr_ LPITEMIDLIST *ppidl)
Definition: utils.cpp:215
#define L(x)
Definition: resources.c:13
#define __FUNCTION__
Definition: types.h:116
POINTL point
Definition: edittest.c:50
return nullptr
Definition: expand.cpp:78
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLbitfield flags
Definition: glext.h:7161
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
#define DbgPrint
Definition: hal.h:12
unsigned int UINT
Definition: sysinfo.c:13
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090
#define ss
Definition: i386-dis.c:441
void WINAPI SHIM_OBJ_NAME() OutputDebugStringA(LPCSTR lpOutputString)
Definition: ignoredbgout.c:18
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
static CInternetFolder * CreateInstance(void)
Definition: inetfolder.c:330
HRESULT SetData([in, unique] FORMATETC *pformatetc, [in, unique] STGMEDIUM *pmedium, [in] BOOL fRelease)
HRESULT GetData([in, unique] FORMATETC *pformatetcIn, [out] STGMEDIUM *pmedium)
HRESULT GetSite([in] REFIID riid, [out, iid_is(riid)] PVOID *ppvSite)
HRESULT SetSite([in] IUnknown *pUnkSite)
ULONG AddRef()
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
ULONG Release()
#define InterlockedCompareExchangePointer
Definition: interlocked.h:144
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
const char * filename
Definition: ioapi.h:137
static ERESOURCE GlobalLock
Definition: sys_arch.c:8
if(dx< 0)
Definition: linetemp.h:194
#define HResultFromWin32
Definition: loader.cpp:14
#define CopyMemory
Definition: minwinbase.h:29
#define sprintf
Definition: sprintf.c:45
static const WCHAR label[]
Definition: itemdlg.c:1546
#define H
static HRESULT QueryInterface(REFIID, void **)
Definition: events.c:2587
static const DWORD padding[]
Definition: mciwnd.c:89
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:83
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
static HMENU hmenu
Definition: win.c:78
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2486
#define bool
Definition: nsiface.idl:72
short WCHAR
Definition: pedump.c:58
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:238
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:199
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:817
BOOL WINAPI ILRemoveLastID(LPITEMIDLIST pidl)
Definition: pidl.c:222
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
Definition: pidl.c:977
#define DECLSPEC_SELECTANY
Definition: guiddef.h:40
#define REFIID
Definition: guiddef.h:118
PVOID pBuffer
const WCHAR * str
#define T(num)
Definition: thunks.c:311
wcscpy
strcpy
Definition: string.h:131
#define LoadStringW
Definition: utils.h:64
short sh
Definition: format.c:272
#define R(b, x)
Definition: sha2.c:134
_In_ UINT _In_ UINT cch
Definition: shellapi.h:432
#define SEE_MASK_CLASSKEY
Definition: shellapi.h:26
#define SEE_MASK_CLASSNAME
Definition: shellapi.h:25
VOID WINAPI SHGetSetSettings(LPSHELLSTATE lpss, DWORD dwMask, BOOL bSet)
Definition: shellord.c:225
#define DbgPrint(fmt,...)
Definition: shellutils.h:59
static PCUIDLIST_RELATIVE HIDA_GetPIDLItem(CIDA const *pida, SIZE_T i)
Definition: shellutils.h:721
static BOOL SHELL_IsContextMenuMsg(UINT uMsg)
Definition: shellutils.h:705
static BOOL _ROS_FAILED_HELPER(HRESULT hr, const char *expr, const char *filename, int line)
Definition: shellutils.h:78
static PCUIDLIST_ABSOLUTE HIDA_GetPIDLFolder(CIDA const *pida)
Definition: shellutils.h:716
static ULONG Win32DbgPrint(const char *filename, int line, const char *lpFormat,...)
Definition: shellutils.h:27
static UINT SHELL_ErrorBoxHelper(HWND hwndOwner, UINT Error)
Definition: shellutils.h:98
static BOOL ILIsSingle(LPCITEMIDLIST pidl)
Definition: shellutils.h:711
static void DumpIdListOneLine(LPCITEMIDLIST pidl)
Definition: shellutils.h:913
#define SHELL_ErrorBox
Definition: shellutils.h:126
static const WCHAR CFSTR_SHELLIDLISTOFFSETW[]
Definition: shlobj.h:518
static const WCHAR CFSTR_SHELLIDLISTW[]
Definition: shlobj.h:516
@ STRRET_CSTR
Definition: shtypes.idl:87
@ STRRET_WSTR
Definition: shtypes.idl:85
const ITEMIDLIST_ABSOLUTE UNALIGNED * PCUIDLIST_ABSOLUTE
Definition: shtypes.idl:63
const ITEMIDLIST_RELATIVE UNALIGNED * PCUIDLIST_RELATIVE
Definition: shtypes.idl:57
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define _countof(array)
Definition: sndvol32.h:70
Definition: shlobj.h:582
LONG y
Definition: windef.h:130
LONG x
Definition: windef.h:129
char cStr[MAX_PATH]
Definition: shtypes.idl:98
UINT uType
Definition: shtypes.idl:93
LPWSTR pOleStr
Definition: shtypes.idl:96
Definition: image.c:134
Definition: query.h:86
Definition: fci.c:127
Definition: dsound.c:943
Definition: parser.c:49
LPWSTR dwTypeData
Definition: winuser.h:3377
LPCWSTR lpFormat
Definition: trayclock.cpp:32
const char * LPCSTR
Definition: typedefs.h:52
const uint16_t * LPCWSTR
Definition: typedefs.h:57
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
unsigned char * LPBYTE
Definition: typedefs.h:53
uint16_t * LPWSTR
Definition: typedefs.h:56
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG
Definition: typedefs.h:59
#define SEE_MASK_HASTITLE
Definition: undocshell.h:740
#define SEE_MASK_HASLINKNAME
Definition: undocshell.h:737
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:397
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:400
#define GHND
Definition: winbase.h:321
#define WINAPI
Definition: msvc.h:6
#define STG_E_INVALIDHANDLE
Definition: winerror.h:3664
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:3771
#define E_UNEXPECTED
Definition: winerror.h:3528
#define E_POINTER
Definition: winerror.h:3480
#define ERROR_INTERNAL_ERROR
Definition: winerror.h:1185
#define MIIM_STRING
Definition: winuser.h:738
#define MIIM_ID
Definition: winuser.h:733
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
#define MIIM_FTYPE
Definition: winuser.h:740
UINT WINAPI RegisterClipboardFormatW(_In_ 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)
int WINAPIV wsprintfA(_Out_ LPSTR, _In_ _Printf_format_string_ LPCSTR,...)
#define WM_DRAWITEM
Definition: winuser.h:1673
#define MIIM_STATE
Definition: winuser.h:732
#define MIIM_SUBMENU
Definition: winuser.h:734
#define WM_MENUCHAR
Definition: winuser.h:1776
#define WM_INITMENUPOPUP
Definition: winuser.h:1774
#define MFT_BITMAP
Definition: winuser.h:749
#define MB_OK
Definition: winuser.h:801
#define WM_MEASUREITEM
Definition: winuser.h:1674
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
#define MB_ICONSTOP
Definition: winuser.h:814
#define WM_MENUSELECT
Definition: winuser.h:1775
BOOL WINAPI IsWindowVisible(_In_ HWND)
unsigned char BYTE
Definition: xxhash.c:193