ReactOS 0.4.17-dev-683-g0dafdc5
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
129static inline HRESULT
131{
132#ifndef SRRF_RT_REG_SZ
134#endif
135 DWORD cb = cchMax * sizeof(*pszOut);
136 UINT err = SHRegGetValueW(hKey, pszPath, pszName, SRRF, NULL, pszOut, &cb);
137 return err ? HRESULT_FROM_WIN32(err) : (cb / sizeof(*pszOut));
138}
139
140static inline HRESULT
142{
143 return SHELL_RegGetStringEx(hKey, pszPath, pszName, 1 << REG_SZ, pszOut, cchMax);
144}
145
146#ifdef __cplusplus
147#if _SHELL32_ || _SHLWAPI_
148template<class T> static HRESULT
149SHELL_RegGetValueAlloc(HKEY hKey, PCWSTR pszPath, PCWSTR pszName, T &pOut, UINT SRRF = 0, DWORD *pType = NULL)
150{
151#ifndef SRRF_RT_REG_SZ
153#endif
154 pOut = NULL;
155 DWORD type, cb = 0;
156 if (!pType)
157 pType = &type;
158 UINT err = SHRegGetValueW(hKey, pszPath, pszName, SRRF, pType, NULL, &cb);
159 if (err != ERROR_SUCCESS)
160 return HRESULT_FROM_WIN32(err);
161 do
162 {
163 void *pAlloc = SHAlloc(cb);
164 if (!pAlloc)
165 return E_OUTOFMEMORY;
166 err = SHRegGetValueW(hKey, pszPath, pszName, SRRF, pType, pAlloc, &cb);
167 if (err == ERROR_SUCCESS)
168 {
169 pOut = (T)pAlloc;
170 return cb;
171 }
172 SHFree(pAlloc);
173 } while (err == ERROR_MORE_DATA);
174 return HRESULT_FROM_WIN32(err);
175}
176
177static inline HRESULT
178SHELL_RegGetStringAlloc(HKEY hKey, PCWSTR pszPath, PCWSTR pszName, PWSTR &pszOut, UINT SRRF = 1 << REG_SZ, DWORD *pType = NULL)
179{
180 return SHELL_RegGetValueAlloc(hKey, pszPath, pszName, pszOut, SRRF, pType);
181}
182#endif
183
184#ifdef DECLARE_CLASSFACTORY // ATL
185template <typename T>
186class CComCreatorCentralInstance
187{
188private:
189 static IUnknown *s_pInstance;
190
191public:
192 static HRESULT WINAPI CreateInstance(void *pv, REFIID riid, LPVOID *ppv)
193 {
194 *ppv = NULL;
195 if (pv != NULL)
197 if (!s_pInstance)
198 {
199 PVOID pObj;
200 HRESULT hr;
202 if (FAILED(hr))
203 return hr;
204 if (InterlockedCompareExchangePointer((PVOID *)&s_pInstance, pObj, NULL))
205 static_cast<IUnknown *>(pObj)->Release();
206 }
207 return s_pInstance->QueryInterface(riid, ppv);
208 }
209 static void Term()
210 {
211 if (s_pInstance)
212 {
213 s_pInstance->Release();
214 s_pInstance = NULL;
215 }
216 }
217};
218
219template <typename T>
220IUnknown *CComCreatorCentralInstance<T>::s_pInstance = NULL;
221
222#define DECLARE_CENTRAL_INSTANCE_NOT_AGGREGATABLE(x) \
223public: \
224 typedef CComCreatorCentralInstance< ATL::CComObject<x> > _CreatorClass;
225
226
227template <class Base>
228class CComDebugObject : public Base
229{
230public:
231 CComDebugObject(void * = NULL)
232 {
233#if DEBUG_CCOMOBJECT_CREATION
234 DbgPrint("%S, this=%08p\n", __FUNCTION__, static_cast<Base*>(this));
235#endif
236 _pAtlModule->Lock();
237 }
238
239 virtual ~CComDebugObject()
240 {
241 this->FinalRelease();
242 _pAtlModule->Unlock();
243 }
244
246 {
247 int rc = this->InternalAddRef();
248#if DEBUG_CCOMOBJECT_REFCOUNTING
249 DbgPrint("%s, RefCount is now %d(--)!\n", __FUNCTION__, rc);
250#endif
251 return rc;
252 }
253
255 {
256 int rc = this->InternalRelease();
257
258#if DEBUG_CCOMOBJECT_REFCOUNTING
259 DbgPrint("%s, RefCount is now %d(--)!\n", __FUNCTION__, rc);
260#endif
261
262 if (rc == 0)
263 {
264#if DEBUG_CCOMOBJECT_DESTRUCTION
265 DbgPrint("%s, RefCount reached 0 Deleting!\n", __FUNCTION__);
266#endif
267 delete this;
268 }
269 return rc;
270 }
271
272 STDMETHOD(QueryInterface)(REFIID iid, void **ppvObject)
273 {
274 return this->_InternalQueryInterface(iid, ppvObject);
275 }
276
277 static HRESULT WINAPI CreateInstance(CComDebugObject<Base> **pp)
278 {
279 CComDebugObject<Base> *newInstance;
280 HRESULT hResult;
281
282 ATLASSERT(pp != NULL);
283 if (pp == NULL)
284 return E_POINTER;
285
286 hResult = E_OUTOFMEMORY;
287 newInstance = NULL;
288 ATLTRY(newInstance = new CComDebugObject<Base>());
289 if (newInstance != NULL)
290 {
291 newInstance->SetVoid(NULL);
292 newInstance->InternalFinalConstructAddRef();
293 hResult = newInstance->_AtlInitialConstruct();
294 if (SUCCEEDED(hResult))
295 hResult = newInstance->FinalConstruct();
296 if (SUCCEEDED(hResult))
297 hResult = newInstance->_AtlFinalConstruct();
298 newInstance->InternalFinalConstructRelease();
299 if (hResult != S_OK)
300 {
301 delete newInstance;
302 newInstance = NULL;
303 }
304 }
305 *pp = newInstance;
306 return hResult;
307 }
308};
309
310#ifdef DEBUG_CCOMOBJECT
311# define _CComObject CComDebugObject
312#else
313# define _CComObject CComObject
314#endif
315
316template<class T>
317ULONG ReleaseCComPtrExpectZeroHelper(const char *file, UINT line, CComPtr<T>& cptr, BOOL forceRelease = FALSE)
318{
319 ULONG r = 0;
320 if (cptr.p != NULL)
321 {
322 T *raw = cptr.Detach();
323 int nrc = r = raw->Release();
324 if (nrc > 0)
325 Win32DbgPrint(file, line, "WARNING: Unexpected RefCount > 0 (%d)\n", nrc);
326 while (nrc > 0 && forceRelease)
327 {
328 nrc = raw->Release();
329 }
330 }
331 return r;
332}
333#define ReleaseCComPtrExpectZero(...) ReleaseCComPtrExpectZeroHelper(__FILE__, __LINE__, __VA_ARGS__)
334
335template<class T, class R>
336HRESULT inline ShellDebugObjectCreator(REFIID riid, R ** ppv)
337{
338 CComPtr<T> obj;
339 HRESULT hResult;
340
341 if (ppv == NULL)
342 return E_POINTER;
343 *ppv = NULL;
344 ATLTRY(obj = new CComDebugObject<T>);
345 if (obj.p == NULL)
346 return E_OUTOFMEMORY;
347 hResult = obj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
348 if (FAILED(hResult))
349 return hResult;
350 return S_OK;
351}
352
353template<class T>
354HRESULT inline ShellObjectCreator(CComPtr<T> &objref)
355{
356 _CComObject<T> *pobj;
357 HRESULT hResult = _CComObject<T>::CreateInstance(&pobj);
358 objref = pobj; // AddRef() gets called here
359 if (FAILED(hResult))
360 return hResult;
361 return S_OK;
362}
363
364template<class T>
365HRESULT inline ShellObjectCreator(REFIID riid, void ** ppv)
366{
367 _CComObject<T> *pobj;
368 HRESULT hResult;
369
370 hResult = _CComObject<T>::CreateInstance(&pobj);
371 if (FAILED(hResult))
372 return hResult;
373
374 pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
375
376 hResult = pobj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
377
378 pobj->Release(); /* In case of failure the object will be released */
379
380 return hResult;
381}
382
383template<class T>
384HRESULT inline ShellObjectCreatorInit(REFIID riid, void ** ppv)
385{
386 _CComObject<T> *pobj;
387 HRESULT hResult;
388
389 hResult = _CComObject<T>::CreateInstance(&pobj);
390 if (FAILED(hResult))
391 return hResult;
392
393 pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
394
395 hResult = pobj->Initialize();
396
397 if (SUCCEEDED(hResult))
398 hResult = pobj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
399
400 pobj->Release(); /* In case of failure the object will be released */
401
402 return hResult;
403}
404
405template<class T, class T1>
406HRESULT inline ShellObjectCreatorInit(T1 initArg1, REFIID riid, void ** ppv)
407{
408 _CComObject<T> *pobj;
409 HRESULT hResult;
410
411 hResult = _CComObject<T>::CreateInstance(&pobj);
412 if (FAILED(hResult))
413 return hResult;
414
415 pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
416
417 hResult = pobj->Initialize(initArg1);
418
419 if (SUCCEEDED(hResult))
420 hResult = pobj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
421
422 pobj->Release(); /* In case of failure the object will be released */
423
424 return hResult;
425}
426
427template<class T, class T1, class T2>
428HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, REFIID riid, void ** ppv)
429{
430 _CComObject<T> *pobj;
431 HRESULT hResult;
432
433 hResult = _CComObject<T>::CreateInstance(&pobj);
434 if (FAILED(hResult))
435 return hResult;
436
437 pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
438
439 hResult = pobj->Initialize(initArg1, initArg2);
440
441 if (SUCCEEDED(hResult))
442 hResult = pobj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
443
444 pobj->Release(); /* In case of failure the object will be released */
445
446 return hResult;
447}
448
449template<class T, class T1, class T2, class T3>
450HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, T3 initArg3, REFIID riid, void ** ppv)
451{
452 _CComObject<T> *pobj;
453 HRESULT hResult;
454
455 hResult = _CComObject<T>::CreateInstance(&pobj);
456 if (FAILED(hResult))
457 return hResult;
458
459 pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
460
461 hResult = pobj->Initialize(initArg1, initArg2, initArg3);
462
463 if (SUCCEEDED(hResult))
464 hResult = pobj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
465
466 pobj->Release(); /* In case of failure the object will be released */
467
468 return hResult;
469}
470
471template<class T, class T1, class T2, class T3, class T4>
472HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, T3 initArg3, T4 initArg4, REFIID riid, void ** ppv)
473{
474 _CComObject<T> *pobj;
475 HRESULT hResult;
476
477 hResult = _CComObject<T>::CreateInstance(&pobj);
478 if (FAILED(hResult))
479 return hResult;
480
481 pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
482
483 hResult = pobj->Initialize(initArg1, initArg2, initArg3, initArg4);
484
485 if (SUCCEEDED(hResult))
486 hResult = pobj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
487
488 pobj->Release(); /* In case of failure the object will be released */
489
490 return hResult;
491}
492
493template<class T, class T1, class T2, class T3, class T4, class T5>
494HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, T3 initArg3, T4 initArg4, T5 initArg5, REFIID riid, void ** ppv)
495{
496 _CComObject<T> *pobj;
497 HRESULT hResult;
498
499 hResult = _CComObject<T>::CreateInstance(&pobj);
500 if (FAILED(hResult))
501 return hResult;
502
503 pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
504
505 hResult = pobj->Initialize(initArg1, initArg2, initArg3, initArg4, initArg5);
506
507 if (SUCCEEDED(hResult))
508 hResult = pobj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
509
510 pobj->Release(); /* In case of failure the object will be released */
511
512 return hResult;
513}
514#endif // DECLARE_CLASSFACTORY (ATL)
515
516static inline HRESULT SHILClone(LPCITEMIDLIST pidl, LPITEMIDLIST *ppOut)
517{
518 LPITEMIDLIST r = *ppOut = ILClone((PIDLIST_RELATIVE)pidl);
519 return r ? S_OK : E_OUTOFMEMORY;
520}
521
522static inline HRESULT SHILCloneParent(LPCITEMIDLIST pidl, LPITEMIDLIST *ppOut)
523{
524 LPITEMIDLIST r = *ppOut = ILClone((PIDLIST_RELATIVE)pidl);
525 if (r)
526 ILRemoveLastID(r); // "c:\folder\thisitem" => "c:\folder"
527 return r ? S_OK : E_OUTOFMEMORY;
528}
529
530static inline HRESULT SHILCombine(LPCITEMIDLIST base, PCUIDLIST_RELATIVE sub, LPITEMIDLIST *ppOut)
531{
533 return r ? S_OK : E_OUTOFMEMORY;
534}
535
536static inline bool StrIsNullOrEmpty(LPCSTR str) { return !str || !*str; }
537static inline bool StrIsNullOrEmpty(LPCWSTR str) { return !str || !*str; }
538
539HRESULT inline SHSetStrRetEmpty(LPSTRRET pStrRet)
540{
541 pStrRet->uType = STRRET_CSTR;
542 pStrRet->cStr[0] = '\0';
543 return S_OK;
544}
545
546HRESULT inline SHSetStrRet(LPSTRRET pStrRet, LPCSTR pstrValue)
547{
548 pStrRet->uType = STRRET_CSTR;
549 strcpy(pStrRet->cStr, pstrValue);
550 return S_OK;
551}
552
553HRESULT inline SHSetStrRet(LPSTRRET pStrRet, LPCWSTR pwstrValue)
554{
555 SIZE_T cchr = wcslen(pwstrValue);
556 LPWSTR buffer = static_cast<LPWSTR>(CoTaskMemAlloc((cchr + 1) * sizeof(WCHAR)));
557 if (buffer == NULL)
558 return E_OUTOFMEMORY;
559
560 pStrRet->uType = STRRET_WSTR;
561 pStrRet->pOleStr = buffer;
562 wcscpy(buffer, pwstrValue);
563 return S_OK;
564}
565
566HRESULT inline SHSetStrRet(LPSTRRET pStrRet, HINSTANCE hInstance, DWORD resId)
567{
569
570 if (!LoadStringW(hInstance, resId, Buffer, MAX_PATH))
571 return E_FAIL;
572
573 return SHSetStrRet(pStrRet, Buffer);
574}
575
576static inline void DbgDumpMenuInternal(HMENU hmenu, char* padding, int padlevel)
577{
578 WCHAR label[128];
579 int i;
581
582 padding[padlevel] = '.';
583 padding[padlevel + 1] = '.';
584 padding[padlevel + 2] = 0;
585
586 for (i = 0; i < count; i++)
587 {
588 MENUITEMINFOW mii = { 0 };
589
590 mii.cbSize = sizeof(mii);
592 mii.dwTypeData = label;
593 mii.cch = _countof(label);
594
595 GetMenuItemInfoW(hmenu, i, TRUE, &mii);
596
597 if (mii.fType & MFT_BITMAP)
598 DbgPrint("%s%2d - %08x: BITMAP %08p (state=%d, has submenu=%s)\n", padding, i, mii.wID, mii.hbmpItem, mii.fState, mii.hSubMenu ? "TRUE" : "FALSE");
599 else if (mii.fType & MFT_SEPARATOR)
600 DbgPrint("%s%2d - %08x ---SEPARATOR---\n", padding, i, mii.wID);
601 else
602 DbgPrint("%s%2d - %08x: %S (state=%d, has submenu=%s)\n", padding, i, mii.wID, mii.dwTypeData, mii.fState, mii.hSubMenu ? "TRUE" : "FALSE");
603
604 if (mii.hSubMenu)
605 DbgDumpMenuInternal(mii.hSubMenu, padding, padlevel + 2);
606
607 }
608
609 padding[padlevel] = 0;
610}
611
612static __inline void DbgDumpMenu(HMENU hmenu)
613{
614 char padding[128];
615 DbgDumpMenuInternal(hmenu, padding, 0);
616}
617
618
619static inline
620void DumpIdList(LPCITEMIDLIST pcidl)
621{
622 DbgPrint("Begin IDList Dump\n");
623
624 for (; pcidl != NULL; pcidl = ILGetNext(pcidl))
625 {
626 int i;
627 int cb = pcidl->mkid.cb;
628 BYTE * sh = (BYTE*) &(pcidl->mkid);
629 if (cb == 0) // ITEMIDLISTs are terminatedwith a null SHITEMID.
630 break;
631 DbgPrint("Begin SHITEMID (cb=%d)\n", cb);
632 if ((cb & 3) != 0)
633 DbgPrint(" - WARNING: cb is not a multiple of 4\n");
634 for (i = 0; (i + 4) <= cb; i += 4)
635 {
636 DbgPrint(" - abID[%08x]: %02x %02x %02x %02x\n",
637 i,
638 sh[i + 0],
639 sh[i + 1],
640 sh[i + 2],
641 sh[i + 3]);
642 }
643 if (i < cb)
644 {
645 cb -= i;
646 if (cb == 3)
647 {
648 DbgPrint(" - abID[%08x]: %02x %02x %02x --\n",
649 i,
650 sh[i + 0],
651 sh[i + 1],
652 sh[i + 2]);
653 }
654 else if (cb == 2)
655 {
656 DbgPrint(" - abID[%08x]: %02x %02x -- --\n",
657 i,
658 sh[i + 0],
659 sh[i + 1]);
660 }
661 else if (cb == 1)
662 {
663 DbgPrint(" - abID[%08x]: %02x -- -- --\n",
664 i,
665 sh[i + 0]);
666 }
667 }
668 DbgPrint("End SHITEMID\n");
669 }
670 DbgPrint("End IDList Dump.\n");
671}
672
673template <HRESULT (WINAPI *InitFunc)(void*), void (WINAPI *UninitFunc)()>
674struct CCoInitBase
675{
676 HRESULT hr;
677 CCoInitBase() : hr(InitFunc(NULL)) { }
678 ~CCoInitBase()
679 {
680 if (SUCCEEDED(hr))
681 UninitFunc();
682 }
683};
684typedef CCoInitBase<CoInitialize, CoUninitialize> CCoInit;
685typedef CCoInitBase<OleInitialize, OleUninitialize> COleInit;
686
687class CObjectWithSiteBase :
688 public IObjectWithSite
689{
690public:
691 IUnknown* m_pUnkSite;
692
693 CObjectWithSiteBase() : m_pUnkSite(NULL) {}
694 virtual ~CObjectWithSiteBase() { SetSite(NULL); }
695
696 // IObjectWithSite
697 STDMETHODIMP SetSite(IUnknown *pUnkSite) override
698 {
699#if defined(__WINE_SHLWAPI_H) && !defined(NO_SHLWAPI)
700 IUnknown_Set(&m_pUnkSite, pUnkSite);
701#else
702 IUnknown *punkOrg = m_pUnkSite;
703 if (punkOrg)
704 punkOrg->Release();
705 m_pUnkSite = pUnkSite;
706 if (pUnkSite)
707 pUnkSite->AddRef();
708#endif
709 return S_OK;
710 }
711 STDMETHODIMP GetSite(REFIID riid, void **ppvSite) override
712 {
713 *ppvSite = NULL;
714 return m_pUnkSite ? m_pUnkSite->QueryInterface(riid, ppvSite) : E_FAIL;
715 }
716};
717
718#if defined(_INC_SHLWAPI) && !defined(NO_SHLWAPI)
719struct CScopedSetObjectWithSite
720{
721 IUnknown *m_pObj;
722 explicit CScopedSetObjectWithSite(IUnknown *pObj, IUnknown *pSite) : m_pObj(pObj)
723 {
724 if (pSite)
725 IUnknown_SetSite(pObj, pSite);
726 else
727 m_pObj = NULL;
728 }
729 ~CScopedSetObjectWithSite()
730 {
731 IUnknown_SetSite(m_pObj, NULL);
732 }
733};
734#endif
735#endif /* __cplusplus */
736
737#define S_LESSTHAN 0xffff
738#define S_EQUAL S_OK
739#define S_GREATERTHAN S_FALSE
740#define MAKE_COMPARE_HRESULT(x) ((x)>0 ? S_GREATERTHAN : ((x)<0 ? S_LESSTHAN : S_EQUAL))
741
742#ifdef _UNDOCSHELL_H
743/* The SEE_MASK_* defines that are undocumented, are defined in reactos/undocshell.h */
744#define SEE_CMIC_COMMON_BASICFLAGS (SEE_MASK_NOASYNC | SEE_MASK_ASYNCOK | SEE_MASK_UNICODE | \
745 SEE_MASK_NO_CONSOLE | SEE_MASK_FLAG_NO_UI | SEE_MASK_FLAG_SEPVDM | \
746 SEE_MASK_FLAG_LOG_USAGE | SEE_MASK_NOZONECHECKS)
747#define SEE_CMIC_COMMON_FLAGS (SEE_CMIC_COMMON_BASICFLAGS | SEE_MASK_HOTKEY | SEE_MASK_ICON | \
748 SEE_MASK_HASLINKNAME | SEE_MASK_HASTITLE)
749
750#define CmicFlagsToSeeFlags(flags) ((flags) & SEE_CMIC_COMMON_FLAGS)
751static inline UINT SeeFlagsToCmicFlags(UINT flags)
752{
755 return flags & SEE_CMIC_COMMON_FLAGS;
756}
757#endif // _UNDOCSHELL_H
758
760{
761 return uMsg == WM_MEASUREITEM || uMsg == WM_DRAWITEM ||
762 uMsg == WM_INITMENUPOPUP || uMsg == WM_MENUSELECT || uMsg == WM_MENUCHAR;
763}
764
765static inline BOOL ILIsSingle(LPCITEMIDLIST pidl)
766{
767 return pidl == ILFindLastID(pidl);
768}
769
771{
772 return (PCUIDLIST_ABSOLUTE)(((LPBYTE)pida) + (pida)->aoffset[0]);
773}
774
776{
777 return (PCUIDLIST_RELATIVE)(((LPBYTE)pida) + (pida)->aoffset[i + 1]);
778}
779
780
781#ifdef __cplusplus
782
783#if defined(CMIC_MASK_UNICODE) && defined(SEE_MASK_UNICODE)
784static inline bool IsUnicode(const CMINVOKECOMMANDINFOEX &ici)
785{
786 const UINT minsize = FIELD_OFFSET(CMINVOKECOMMANDINFOEX, ptInvoke);
787 return (ici.fMask & CMIC_MASK_UNICODE) && ici.cbSize >= minsize;
788}
789
790static inline bool IsUnicode(const CMINVOKECOMMANDINFO &ici)
791{
792 return IsUnicode(*(CMINVOKECOMMANDINFOEX*)&ici);
793}
794#endif // CMIC_MASK_UNICODE
795
796DECLSPEC_SELECTANY CLIPFORMAT g_cfHIDA = NULL;
797DECLSPEC_SELECTANY CLIPFORMAT g_cfShellIdListOffsets = NULL;
798
799// Allow to use the HIDA from an IDataObject without copying it
800struct CDataObjectHIDA
801{
802private:
803 STGMEDIUM m_medium;
804 CIDA* m_cida;
805 HRESULT m_hr;
806
807public:
808 explicit CDataObjectHIDA(IDataObject* pDataObject)
809 : m_cida(nullptr)
810 {
811 m_hr = CreateCIDA(pDataObject, &m_cida, m_medium);
812 }
813
814 ~CDataObjectHIDA()
815 {
816 DestroyCIDA(m_cida, m_medium);
817 }
818
819 static void DestroyCIDA(CIDA *pcida, STGMEDIUM &medium)
820 {
821 if (pcida)
822 ::GlobalUnlock(medium.hGlobal);
823 ReleaseStgMedium(&medium);
824 }
825
826 static HRESULT CreateCIDA(IDataObject* pDataObject, CIDA **ppcida, STGMEDIUM &medium)
827 {
828 *ppcida = NULL;
829 medium.pUnkForRelease = NULL;
830 if (g_cfHIDA == NULL)
831 g_cfHIDA = (CLIPFORMAT)RegisterClipboardFormatW(CFSTR_SHELLIDLISTW);
832
833 FORMATETC fmt = { g_cfHIDA, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
834 HRESULT hr = pDataObject->GetData(&fmt, &medium);
835 if (SUCCEEDED(hr))
836 {
837 *ppcida = (CIDA*)::GlobalLock(medium.hGlobal);
838 if (*ppcida)
839 return S_OK;
840 ReleaseStgMedium(&medium);
842 }
843 medium.tymed = TYMED_NULL;
844 return hr;
845 }
846
847 HRESULT hr() const
848 {
849 return m_hr;
850 }
851
852 operator bool() const
853 {
854 return m_cida != nullptr;
855 }
856
857 operator const CIDA* () const
858 {
859 return m_cida;
860 }
861
862 const CIDA* operator->() const
863 {
864 return m_cida;
865 }
866};
867
868inline
869HRESULT DataObject_GetData(IDataObject* pDataObject, CLIPFORMAT clipformat, PVOID pBuffer, SIZE_T dwBufferSize)
870{
871 FORMATETC fmt = { clipformat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
872 STGMEDIUM medium = { TYMED_NULL };
873
874 HRESULT hr = pDataObject->GetData(&fmt, &medium);
875 if (SUCCEEDED(hr))
876 {
877 LPVOID blob = GlobalLock(medium.hGlobal);
878 if (blob)
879 {
880 SIZE_T size = GlobalSize(medium.hGlobal);
881 if (size <= dwBufferSize)
882 {
884 hr = S_OK;
885 }
886 else
887 {
889 }
890 GlobalUnlock(medium.hGlobal);
891 }
892 else
893 {
895 }
896
897 ReleaseStgMedium(&medium);
898 }
899 return hr;
900}
901
902inline
903HRESULT DataObject_SetData(IDataObject* pDataObject, CLIPFORMAT clipformat, PVOID pBuffer, SIZE_T dwBufferSize)
904{
905 STGMEDIUM medium = { TYMED_HGLOBAL };
906
907 medium.hGlobal = GlobalAlloc(GHND, dwBufferSize);
908 if (!medium.hGlobal)
909 return E_OUTOFMEMORY;
910
912 LPVOID blob = GlobalLock(medium.hGlobal);
913 if (blob)
914 {
915 CopyMemory(blob, pBuffer, dwBufferSize);
916 GlobalUnlock(medium.hGlobal);
917
918 FORMATETC etc = { clipformat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
919 hr = pDataObject->SetData(&etc, &medium, TRUE);
920 }
921
922 if (FAILED(hr))
923 GlobalFree(medium.hGlobal);
924
925 return hr;
926}
927
928
929inline HRESULT
930DataObject_GetOffset(IDataObject *pDataObject, POINT *point)
931{
932 if (g_cfShellIdListOffsets == NULL)
933 {
934 g_cfShellIdListOffsets = (CLIPFORMAT)RegisterClipboardFormatW(CFSTR_SHELLIDLISTOFFSETW);
935 }
936
937 point->x = point->y = 0;
938
939 return DataObject_GetData(pDataObject, g_cfShellIdListOffsets, point, sizeof(point[0]));
940}
941
942inline HRESULT
943DataObject_SetOffset(IDataObject* pDataObject, POINT* point)
944{
945 if (g_cfShellIdListOffsets == NULL)
946 {
947 g_cfShellIdListOffsets = (CLIPFORMAT)RegisterClipboardFormatW(CFSTR_SHELLIDLISTOFFSETW);
948 }
949
950 return DataObject_SetData(pDataObject, g_cfShellIdListOffsets, point, sizeof(point[0]));
951}
952
953#endif // __cplusplus
954
955#ifdef __cplusplus
956struct SHELL_GetSettingImpl
957{
959 SHELL_GetSettingImpl(DWORD ssf) { SHGetSetSettings(&ss, ssf, FALSE); }
960 const SHELLSTATE* operator ->() { return &ss; }
961};
962#define SHELL_GetSetting(ssf, field) ( SHELL_GetSettingImpl(ssf)->field )
963#else
964#define SHELL_GetSetting(pss, ssf, field) ( SHGetSetSettings((pss), (ssf), FALSE), (pss)->field )
965#endif
966
967static inline void DumpIdListOneLine(LPCITEMIDLIST pidl)
968{
969 char buf[1024], *data, drive = 0;
970 for (UINT depth = 0, type; ; pidl = ILGetNext(pidl), ++depth)
971 {
972 if (!pidl || !pidl->mkid.cb)
973 {
974 if (!depth)
975 {
976 wsprintfA(buf, "%p [] (%s)", pidl, pidl ? "Empty/Desktop" : "NULL");
978 }
979 break;
980 }
981 else if (!depth)
982 {
983 wsprintfA(buf, "%p", pidl);
985 }
986 type = pidl->mkid.abID[0] & 0x7f;
987 data = (char*)&pidl->mkid.abID[0];
988 if (depth == 0 && type == 0x1f && pidl->mkid.cb == 20 && *(UINT*)(&data[2]) == 0x20D04FE0)
989 {
990 wsprintfA(buf, " [%.2x ThisPC?]", type); /* "?" because we did not check the full GUID */
991 }
992 else if (depth == 1 && type >= 0x20 && type < 0x30 && type != 0x2E && pidl->mkid.cb > 4)
993 {
994 drive = data[1];
995 wsprintfA(buf, " [%.2x %c: %ub]", type, drive, pidl->mkid.cb);
996 }
997 else if (depth >= 2 && drive && (type & 0x70) == 0x30) /* PT_FS */
998 {
999 if (type & 4)
1000 wsprintfA(buf, " [%.2x FS %.256ls %ub]", type, data + 12, pidl->mkid.cb);
1001 else
1002 wsprintfA(buf, " [%.2x FS %.256hs %ub]", type, data + 12, pidl->mkid.cb);
1003 }
1004 else
1005 {
1006 wsprintfA(buf, " [%.2x ? %ub]", type, pidl->mkid.cb);
1007 }
1009 }
1010 OutputDebugStringA("\n");
1011}
1012
1013#endif /* __ROS_SHELL_UTILS_H */
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
UINT cchMax
#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: bufpool.h:45
#define ERROR_MORE_DATA
Definition: dderror.h:13
#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
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
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
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:370
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:348
#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
FxAutoRegKey hKey
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
GLdouble s
Definition: gl.h:2039
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble GLdouble t
Definition: gl.h:2047
GLdouble n
Definition: glext.h:7729
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLfloat f
Definition: glext.h:7540
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLbitfield flags
Definition: glext.h:7161
GLfloat GLfloat p
Definition: glext.h:8902
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
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()
nsresult QueryInterface(nsIIDRef riid, void **result)
nsrefcnt 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
#define d
Definition: ke_i.h:81
#define REG_SZ
Definition: layer.c:22
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
INT SRRF
Definition: shlwapi.h:717
PVOID pBuffer
#define err(...)
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:775
static BOOL SHELL_IsContextMenuMsg(UINT uMsg)
Definition: shellutils.h:759
static HRESULT SHELL_RegGetString(HKEY hKey, PCWSTR pszPath, PCWSTR pszName, PWSTR pszOut, DWORD cchMax)
Definition: shellutils.h:141
static HRESULT SHELL_RegGetStringEx(HKEY hKey, PCWSTR pszPath, PCWSTR pszName, UINT SRRF, PWSTR pszOut, DWORD cchMax)
Definition: shellutils.h:130
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:770
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:765
static void DumpIdListOneLine(LPCITEMIDLIST pidl)
Definition: shellutils.h:967
#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
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
@ 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
uint16_t * PWSTR
Definition: typedefs.h:56
const char * LPCSTR
Definition: typedefs.h:52
const uint16_t * PCWSTR
Definition: typedefs.h:57
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 * LPDWORD
Definition: typedefs.h:59
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
WINSHLWAPI LSTATUS WINAPI SHRegGetValueW(HKEY, LPCWSTR, LPCWSTR, SRRF, LPDWORD, LPVOID, LPDWORD)
#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