ReactOS  0.4.15-dev-5463-g138eb58
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
23 extern "C" {
24 #endif /* defined(__cplusplus) */
25 
26 inline ULONG
27 Win32DbgPrint(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 
70 #if 1
71 
72 inline BOOL _ROS_FAILED_HELPER(HRESULT hr, const char* expr, const char* filename, int line)
73 {
74  if (FAILED(hr))
75  {
76  Win32DbgPrint(filename, line, "Unexpected failure (%s)=%08x.\n", expr, hr);
77  return TRUE;
78  }
79  return FALSE;
80 }
81 
82 #define FAILED_UNEXPECTEDLY(hr) _ROS_FAILED_HELPER((hr), #hr, __FILE__, __LINE__)
83 #else
84 #define FAILED_UNEXPECTEDLY(hr) FAILED(hr)
85 #endif
86 
87 #ifdef __cplusplus
88 } /* extern "C" */
89 #endif /* defined(__cplusplus) */
90 
91 #ifdef __cplusplus
92 template <typename T>
93 class CComCreatorCentralInstance
94 {
95 private:
96  static IUnknown *s_pInstance;
97 
98 public:
99  static HRESULT WINAPI CreateInstance(void *pv, REFIID riid, LPVOID *ppv)
100  {
101  *ppv = NULL;
102  if (pv != NULL)
103  return CLASS_E_NOAGGREGATION;
104  if (!s_pInstance)
105  {
106  PVOID pObj;
107  HRESULT hr;
109  if (FAILED(hr))
110  return hr;
111  if (InterlockedCompareExchangePointer((PVOID *)&s_pInstance, pObj, NULL))
112  static_cast<IUnknown *>(pObj)->Release();
113  }
114  return s_pInstance->QueryInterface(riid, ppv);
115  }
116  static void Term()
117  {
118  if (s_pInstance)
119  {
120  s_pInstance->Release();
121  s_pInstance = NULL;
122  }
123  }
124 };
125 
126 template <typename T>
127 IUnknown *CComCreatorCentralInstance<T>::s_pInstance = NULL;
128 
129 #define DECLARE_CENTRAL_INSTANCE_NOT_AGGREGATABLE(x) \
130 public: \
131  typedef CComCreatorCentralInstance< ATL::CComObject<x> > _CreatorClass;
132 
133 
134 template <class Base>
135 class CComDebugObject : public Base
136 {
137 public:
138  CComDebugObject(void * = NULL)
139  {
140 #if DEBUG_CCOMOBJECT_CREATION
141  DbgPrint("%S, this=%08p\n", __FUNCTION__, static_cast<Base*>(this));
142 #endif
143  _pAtlModule->Lock();
144  }
145 
146  virtual ~CComDebugObject()
147  {
148  this->FinalRelease();
149  _pAtlModule->Unlock();
150  }
151 
153  {
154  int rc = this->InternalAddRef();
155 #if DEBUG_CCOMOBJECT_REFCOUNTING
156  DbgPrint("%s, RefCount is now %d(--)!\n", __FUNCTION__, rc);
157 #endif
158  return rc;
159  }
160 
162  {
163  int rc = this->InternalRelease();
164 
165 #if DEBUG_CCOMOBJECT_REFCOUNTING
166  DbgPrint("%s, RefCount is now %d(--)!\n", __FUNCTION__, rc);
167 #endif
168 
169  if (rc == 0)
170  {
171 #if DEBUG_CCOMOBJECT_DESTRUCTION
172  DbgPrint("%s, RefCount reached 0 Deleting!\n", __FUNCTION__);
173 #endif
174  delete this;
175  }
176  return rc;
177  }
178 
180  {
181  return this->_InternalQueryInterface(iid, ppvObject);
182  }
183 
184  static HRESULT WINAPI CreateInstance(CComDebugObject<Base> **pp)
185  {
186  CComDebugObject<Base> *newInstance;
187  HRESULT hResult;
188 
189  ATLASSERT(pp != NULL);
190  if (pp == NULL)
191  return E_POINTER;
192 
193  hResult = E_OUTOFMEMORY;
194  newInstance = NULL;
195  ATLTRY(newInstance = new CComDebugObject<Base>());
196  if (newInstance != NULL)
197  {
198  newInstance->SetVoid(NULL);
199  newInstance->InternalFinalConstructAddRef();
200  hResult = newInstance->_AtlInitialConstruct();
201  if (SUCCEEDED(hResult))
202  hResult = newInstance->FinalConstruct();
203  if (SUCCEEDED(hResult))
204  hResult = newInstance->_AtlFinalConstruct();
205  newInstance->InternalFinalConstructRelease();
206  if (hResult != S_OK)
207  {
208  delete newInstance;
209  newInstance = NULL;
210  }
211  }
212  *pp = newInstance;
213  return hResult;
214  }
215 };
216 
217 #ifdef DEBUG_CCOMOBJECT
218 # define _CComObject CComDebugObject
219 #else
220 # define _CComObject CComObject
221 #endif
222 
223 template<class T>
224 void ReleaseCComPtrExpectZero(CComPtr<T>& cptr, BOOL forceRelease = FALSE)
225 {
226  if (cptr.p != NULL)
227  {
228  T *raw = cptr.Detach();
229  int nrc = raw->Release();
230  if (nrc > 0)
231  {
232  DbgPrint("WARNING: Unexpected RefCount > 0 (%d)!\n", nrc);
233  if (forceRelease)
234  {
235  while (nrc > 0)
236  {
237  nrc = raw->Release();
238  }
239  }
240  }
241  }
242 }
243 
244 template<class T, class R>
245 HRESULT inline ShellDebugObjectCreator(REFIID riid, R ** ppv)
246 {
247  CComPtr<T> obj;
248  HRESULT hResult;
249 
250  if (ppv == NULL)
251  return E_POINTER;
252  *ppv = NULL;
253  ATLTRY(obj = new CComDebugObject<T>);
254  if (obj.p == NULL)
255  return E_OUTOFMEMORY;
256  hResult = obj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
257  if (FAILED(hResult))
258  return hResult;
259  return S_OK;
260 }
261 
262 template<class T>
263 HRESULT inline ShellObjectCreator(REFIID riid, void ** ppv)
264 {
265  _CComObject<T> *pobj;
266  HRESULT hResult;
267 
268  hResult = _CComObject<T>::CreateInstance(&pobj);
269  if (FAILED(hResult))
270  return hResult;
271 
272  pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
273 
274  hResult = pobj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
275 
276  pobj->Release(); /* In case of failure the object will be released */
277 
278  return hResult;
279 }
280 
281 template<class T>
282 HRESULT inline ShellObjectCreatorInit(REFIID riid, void ** ppv)
283 {
284  _CComObject<T> *pobj;
285  HRESULT hResult;
286 
287  hResult = _CComObject<T>::CreateInstance(&pobj);
288  if (FAILED(hResult))
289  return hResult;
290 
291  pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
292 
293  hResult = pobj->Initialize();
294 
295  if (SUCCEEDED(hResult))
296  hResult = pobj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
297 
298  pobj->Release(); /* In case of failure the object will be released */
299 
300  return hResult;
301 }
302 
303 template<class T, class T1>
304 HRESULT inline ShellObjectCreatorInit(T1 initArg1, REFIID riid, void ** ppv)
305 {
306  _CComObject<T> *pobj;
307  HRESULT hResult;
308 
309  hResult = _CComObject<T>::CreateInstance(&pobj);
310  if (FAILED(hResult))
311  return hResult;
312 
313  pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
314 
315  hResult = pobj->Initialize(initArg1);
316 
317  if (SUCCEEDED(hResult))
318  hResult = pobj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
319 
320  pobj->Release(); /* In case of failure the object will be released */
321 
322  return hResult;
323 }
324 
325 template<class T, class T1, class T2>
326 HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, REFIID riid, void ** ppv)
327 {
328  _CComObject<T> *pobj;
329  HRESULT hResult;
330 
331  hResult = _CComObject<T>::CreateInstance(&pobj);
332  if (FAILED(hResult))
333  return hResult;
334 
335  pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
336 
337  hResult = pobj->Initialize(initArg1, initArg2);
338 
339  if (SUCCEEDED(hResult))
340  hResult = pobj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
341 
342  pobj->Release(); /* In case of failure the object will be released */
343 
344  return hResult;
345 }
346 
347 template<class T, class T1, class T2, class T3>
348 HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, T3 initArg3, REFIID riid, void ** ppv)
349 {
350  _CComObject<T> *pobj;
351  HRESULT hResult;
352 
353  hResult = _CComObject<T>::CreateInstance(&pobj);
354  if (FAILED(hResult))
355  return hResult;
356 
357  pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
358 
359  hResult = pobj->Initialize(initArg1, initArg2, initArg3);
360 
361  if (SUCCEEDED(hResult))
362  hResult = pobj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
363 
364  pobj->Release(); /* In case of failure the object will be released */
365 
366  return hResult;
367 }
368 
369 template<class T, class T1, class T2, class T3, class T4>
370 HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, T3 initArg3, T4 initArg4, REFIID riid, void ** ppv)
371 {
372  _CComObject<T> *pobj;
373  HRESULT hResult;
374 
375  hResult = _CComObject<T>::CreateInstance(&pobj);
376  if (FAILED(hResult))
377  return hResult;
378 
379  pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
380 
381  hResult = pobj->Initialize(initArg1, initArg2, initArg3, initArg4);
382 
383  if (SUCCEEDED(hResult))
384  hResult = pobj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
385 
386  pobj->Release(); /* In case of failure the object will be released */
387 
388  return hResult;
389 }
390 
391 template<class T, class T1, class T2, class T3, class T4, class T5>
392 HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, T3 initArg3, T4 initArg4, T5 initArg5, REFIID riid, void ** ppv)
393 {
394  _CComObject<T> *pobj;
395  HRESULT hResult;
396 
397  hResult = _CComObject<T>::CreateInstance(&pobj);
398  if (FAILED(hResult))
399  return hResult;
400 
401  pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
402 
403  hResult = pobj->Initialize(initArg1, initArg2, initArg3, initArg4, initArg5);
404 
405  if (SUCCEEDED(hResult))
406  hResult = pobj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
407 
408  pobj->Release(); /* In case of failure the object will be released */
409 
410  return hResult;
411 }
412 
413 HRESULT inline SHSetStrRet(LPSTRRET pStrRet, LPCSTR pstrValue)
414 {
415  pStrRet->uType = STRRET_CSTR;
416  strcpy(pStrRet->cStr, pstrValue);
417  return S_OK;
418 }
419 
420 HRESULT inline SHSetStrRet(LPSTRRET pStrRet, LPCWSTR pwstrValue)
421 {
422  SIZE_T cchr = wcslen(pwstrValue);
423  LPWSTR buffer = static_cast<LPWSTR>(CoTaskMemAlloc((cchr + 1) * sizeof(WCHAR)));
424  if (buffer == NULL)
425  return E_OUTOFMEMORY;
426 
427  pStrRet->uType = STRRET_WSTR;
428  pStrRet->pOleStr = buffer;
429  wcscpy(buffer, pwstrValue);
430  return S_OK;
431 }
432 
433 HRESULT inline SHSetStrRet(LPSTRRET pStrRet, HINSTANCE hInstance, DWORD resId)
434 {
436 
437  if (!LoadStringW(hInstance, resId, Buffer, MAX_PATH))
438  return E_FAIL;
439 
440  return SHSetStrRet(pStrRet, Buffer);
441 }
442 
443 static inline void DbgDumpMenuInternal(HMENU hmenu, char* padding, int padlevel)
444 {
445  WCHAR label[128];
446  int i;
448 
449  padding[padlevel] = '.';
450  padding[padlevel + 1] = '.';
451  padding[padlevel + 2] = 0;
452 
453  for (i = 0; i < count; i++)
454  {
455  MENUITEMINFOW mii = { 0 };
456 
457  mii.cbSize = sizeof(mii);
459  mii.dwTypeData = label;
460  mii.cch = _countof(label);
461 
462  GetMenuItemInfoW(hmenu, i, TRUE, &mii);
463 
464  if (mii.fType & MFT_BITMAP)
465  DbgPrint("%s%2d - %08x: BITMAP %08p (state=%d, has submenu=%s)\n", padding, i, mii.wID, mii.hbmpItem, mii.fState, mii.hSubMenu ? "TRUE" : "FALSE");
466  else if (mii.fType & MFT_SEPARATOR)
467  DbgPrint("%s%2d - %08x ---SEPARATOR---\n", padding, i, mii.wID);
468  else
469  DbgPrint("%s%2d - %08x: %S (state=%d, has submenu=%s)\n", padding, i, mii.wID, mii.dwTypeData, mii.fState, mii.hSubMenu ? "TRUE" : "FALSE");
470 
471  if (mii.hSubMenu)
472  DbgDumpMenuInternal(mii.hSubMenu, padding, padlevel + 2);
473 
474  }
475 
476  padding[padlevel] = 0;
477 }
478 
479 static __inline void DbgDumpMenu(HMENU hmenu)
480 {
481  char padding[128];
482  DbgDumpMenuInternal(hmenu, padding, 0);
483 }
484 
485 
486 static inline
487 void DumpIdList(LPCITEMIDLIST pcidl)
488 {
489  DbgPrint("Begin IDList Dump\n");
490 
491  for (; pcidl != NULL; pcidl = ILGetNext(pcidl))
492  {
493  int i;
494  int cb = pcidl->mkid.cb;
495  BYTE * sh = (BYTE*) &(pcidl->mkid);
496  if (cb == 0) // ITEMIDLISTs are terminatedwith a null SHITEMID.
497  break;
498  DbgPrint("Begin SHITEMID (cb=%d)\n", cb);
499  if ((cb & 3) != 0)
500  DbgPrint(" - WARNING: cb is not a multiple of 4\n");
501  for (i = 0; (i + 4) <= cb; i += 4)
502  {
503  DbgPrint(" - abID[%08x]: %02x %02x %02x %02x\n",
504  i,
505  sh[i + 0],
506  sh[i + 1],
507  sh[i + 2],
508  sh[i + 3]);
509  }
510  if (i < cb)
511  {
512  cb -= i;
513  if (cb == 3)
514  {
515  DbgPrint(" - abID[%08x]: %02x %02x %02x --\n",
516  i,
517  sh[i + 0],
518  sh[i + 1],
519  sh[i + 2]);
520  }
521  else if (cb == 2)
522  {
523  DbgPrint(" - abID[%08x]: %02x %02x -- --\n",
524  i,
525  sh[i + 0],
526  sh[i + 1]);
527  }
528  else if (cb == 1)
529  {
530  DbgPrint(" - abID[%08x]: %02x -- -- --\n",
531  i,
532  sh[i + 0]);
533  }
534  }
535  DbgPrint("End SHITEMID\n");
536  }
537  DbgPrint("End IDList Dump.\n");
538 }
539 
540 struct CCoInit
541 {
542  CCoInit()
543  {
544  hr = CoInitialize(NULL);
545  }
546  ~CCoInit()
547  {
548  if (SUCCEEDED(hr))
549  {
550  CoUninitialize();
551  }
552  }
553  HRESULT hr;
554 };
555 
556 #endif /* __cplusplus */
557 
558 #define S_LESSTHAN 0xffff
559 #define S_EQUAL S_OK
560 #define S_GREATERTHAN S_FALSE
561 #define MAKE_COMPARE_HRESULT(x) ((x)>0 ? S_GREATERTHAN : ((x)<0 ? S_LESSTHAN : S_EQUAL))
562 
563 
564 static inline PCUIDLIST_ABSOLUTE HIDA_GetPIDLFolder(CIDA const* pida)
565 {
566  return (PCUIDLIST_ABSOLUTE)(((LPBYTE)pida) + (pida)->aoffset[0]);
567 }
568 
569 static inline PCUIDLIST_RELATIVE HIDA_GetPIDLItem(CIDA const* pida, SIZE_T i)
570 {
571  return (PCUIDLIST_RELATIVE)(((LPBYTE)pida) + (pida)->aoffset[i + 1]);
572 }
573 
574 
575 #ifdef __cplusplus
576 
577 DECLSPEC_SELECTANY CLIPFORMAT g_cfHIDA = NULL;
578 DECLSPEC_SELECTANY CLIPFORMAT g_cfShellIdListOffsets = NULL;
579 
580 // Allow to use the HIDA from an IDataObject without copying it
581 struct CDataObjectHIDA
582 {
583 private:
584  STGMEDIUM m_medium;
585  CIDA* m_cida;
586  HRESULT m_hr;
587 
588 public:
589  explicit CDataObjectHIDA(IDataObject* pDataObject)
590  : m_cida(nullptr)
591  {
592  m_medium.tymed = TYMED_NULL;
593 
594  if (g_cfHIDA == NULL)
595  {
596  g_cfHIDA = (CLIPFORMAT)RegisterClipboardFormatW(CFSTR_SHELLIDLISTW);
597  }
598  FORMATETC fmt = { g_cfHIDA, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
599 
600  m_hr = pDataObject->GetData(&fmt, &m_medium);
601  if (FAILED(m_hr))
602  {
603  m_medium.tymed = TYMED_NULL;
604  return;
605  }
606 
607  m_cida = (CIDA*)::GlobalLock(m_medium.hGlobal);
608  if (m_cida == nullptr)
609  {
610  m_hr = E_UNEXPECTED;
611  }
612  }
613 
614  ~CDataObjectHIDA()
615  {
616  if (m_cida)
617  ::GlobalUnlock(m_cida);
618 
619  ReleaseStgMedium(&m_medium);
620  }
621 
622  HRESULT hr() const
623  {
624  return m_hr;
625  }
626 
627  operator bool() const
628  {
629  return m_cida != nullptr;
630  }
631 
632  operator const CIDA* () const
633  {
634  return m_cida;
635  }
636 
637  const CIDA* operator->() const
638  {
639  return m_cida;
640  }
641 };
642 
643 inline
644 HRESULT DataObject_GetData(IDataObject* pDataObject, CLIPFORMAT clipformat, PVOID pBuffer, SIZE_T dwBufferSize)
645 {
646  FORMATETC fmt = { clipformat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
647  STGMEDIUM medium = { TYMED_NULL };
648 
649  HRESULT hr = pDataObject->GetData(&fmt, &medium);
650  if (SUCCEEDED(hr))
651  {
652  LPVOID blob = GlobalLock(medium.hGlobal);
653  if (blob)
654  {
655  SIZE_T size = GlobalSize(medium.hGlobal);
656  if (size <= dwBufferSize)
657  {
659  hr = S_OK;
660  }
661  else
662  {
663  hr = E_OUTOFMEMORY;
664  }
665  GlobalUnlock(medium.hGlobal);
666  }
667  else
668  {
670  }
671 
672  ReleaseStgMedium(&medium);
673  }
674  return hr;
675 }
676 
677 inline
678 HRESULT DataObject_SetData(IDataObject* pDataObject, CLIPFORMAT clipformat, PVOID pBuffer, SIZE_T dwBufferSize)
679 {
680  STGMEDIUM medium = { TYMED_HGLOBAL };
681 
682  medium.hGlobal = GlobalAlloc(GHND, dwBufferSize);
683  if (!medium.hGlobal)
684  return E_OUTOFMEMORY;
685 
687  LPVOID blob = GlobalLock(medium.hGlobal);
688  if (blob)
689  {
690  CopyMemory(blob, pBuffer, dwBufferSize);
691  GlobalUnlock(medium.hGlobal);
692 
693  FORMATETC etc = { clipformat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
694  hr = pDataObject->SetData(&etc, &medium, TRUE);
695  }
696 
697  if (FAILED(hr))
698  GlobalFree(medium.hGlobal);
699 
700  return hr;
701 }
702 
703 
704 inline HRESULT
705 DataObject_GetOffset(IDataObject *pDataObject, POINT *point)
706 {
707  if (g_cfShellIdListOffsets == NULL)
708  {
709  g_cfShellIdListOffsets = (CLIPFORMAT)RegisterClipboardFormatW(CFSTR_SHELLIDLISTOFFSETW);
710  }
711 
712  point->x = point->y = 0;
713 
714  return DataObject_GetData(pDataObject, g_cfShellIdListOffsets, point, sizeof(point[0]));
715 }
716 
717 inline HRESULT
718 DataObject_SetOffset(IDataObject* pDataObject, POINT* point)
719 {
720  if (g_cfShellIdListOffsets == NULL)
721  {
722  g_cfShellIdListOffsets = (CLIPFORMAT)RegisterClipboardFormatW(CFSTR_SHELLIDLISTOFFSETW);
723  }
724 
725  return DataObject_SetData(pDataObject, g_cfShellIdListOffsets, point, sizeof(point[0]));
726 }
727 
728 #endif
729 
730 
731 #endif /* __ROS_SHELL_UTILS_H */
#define ATLTRY(x)
Definition: atlcomcli.h:44
#define R(b, x)
Definition: sha2.c:134
#define MIIM_FTYPE
Definition: winuser.h:724
#define REFIID
Definition: guiddef.h:118
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
HRESULT hr
Definition: shlfolder.c:183
static HMENU hmenu
Definition: win.c:66
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
Definition: image.c:133
static HRESULT WINAPI CreateInstance(void *pv, REFIID riid, LPVOID *ppv)
Definition: atlcom.h:419
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
#define DbgPrint(fmt,...)
Definition: shellutils.h:59
#define TRUE
Definition: types.h:120
REFIID riid
Definition: precomp.h:44
UINT WINAPI RegisterClipboardFormatW(_In_ LPCWSTR)
GLuint GLuint GLsizei count
Definition: gl.h:1545
static HRESULT QueryInterface(REFIID, void **)
Definition: events.c:2587
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2427
static PCUIDLIST_RELATIVE HIDA_GetPIDLItem(CIDA const *pida, SIZE_T i)
Definition: shellutils.h:569
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
Definition: pidl.c:851
REFIID LPVOID * ppv
Definition: atlbase.h:39
LPWSTR pOleStr
Definition: shtypes.idl:96
HRESULT GetData([in, unique] FORMATETC *pformatetcIn, [out] STGMEDIUM *pmedium)
GLuint buffer
Definition: glext.h:5915
LPWSTR dwTypeData
Definition: winuser.h:3259
#define MFT_BITMAP
Definition: winuser.h:733
#define DECLSPEC_SELECTANY
Definition: guiddef.h:40
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
const char * filename
Definition: ioapi.h:137
#define STG_E_INVALIDHANDLE
Definition: winerror.h:2569
#define E_FAIL
Definition: ddrawi.h:102
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
Definition: query.h:86
POINTL point
Definition: edittest.c:50
#define T
Definition: mbstring.h:31
#define STDMETHOD(m)
Definition: basetyps.h:62
LONG y
Definition: windef.h:330
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
#define sprintf(buf, format,...)
Definition: sprintf.c:55
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090
#define GHND
Definition: winbase.h:297
char cStr[MAX_PATH]
Definition: shtypes.idl:98
HINSTANCE hInstance
Definition: charmap.c:19
#define MIIM_SUBMENU
Definition: winuser.h:718
unsigned char * LPBYTE
Definition: typedefs.h:53
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define va_end(ap)
Definition: acmsvcex.h:90
#define FALSE
Definition: types.h:117
#define MIIM_STATE
Definition: winuser.h:716
unsigned int BOOL
Definition: ntddk_ex.h:94
if SUCCEEDED(hr)
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
ULONG Release()
static const WCHAR CFSTR_SHELLIDLISTW[]
Definition: shlobj.h:433
PVOID pBuffer
static const WCHAR CFSTR_SHELLIDLISTOFFSETW[]
Definition: shlobj.h:435
Definition: parser.c:48
HRESULT SetData([in, unique] FORMATETC *pformatetc, [in, unique] STGMEDIUM *pmedium, [in] BOOL fRelease)
char * va_list
Definition: acmsvcex.h:78
Definition: bufpool.h:45
const char * LPCSTR
Definition: xmlstorage.h:183
#define MIIM_ID
Definition: winuser.h:717
BOOL _ROS_FAILED_HELPER(HRESULT hr, const char *expr, const char *filename, int line)
Definition: shellutils.h:72
typedef bool(CARDLIBPROC *pCanDragProc)(CardRegion &stackobj
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
static HRESULT WINAPI DataObject_SetData(LPDATAOBJECT iface, LPFORMATETC pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
Definition: view.c:203
unsigned int padding
Definition: isohybrid.c:50
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define _countof(array)
Definition: sndvol32.h:68
const GUID IID_IUnknown
#define MAX_PATH
Definition: compat.h:34
#define WINAPI
Definition: msvc.h:6
#define CopyMemory
Definition: winbase.h:1668
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG x
Definition: windef.h:329
va_start(ap, x)
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
static HRESULT WINAPI DataObject_GetData(LPDATAOBJECT iface, LPFORMATETC pformatetcIn, STGMEDIUM *pmedium)
Definition: view.c:175
#define MFT_SEPARATOR
Definition: winuser.h:739
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
REFIID LPVOID * ppvObject
Definition: precomp.h:44
LPCWSTR lpFormat
Definition: trayclock.cpp:32
static PCUIDLIST_ABSOLUTE HIDA_GetPIDLFolder(CIDA const *pida)
Definition: shellutils.h:564
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662
uint8_t label[11]
Definition: fsck.fat.h:65
unsigned char BYTE
Definition: xxhash.c:193
short sh
Definition: format.c:272
#define MIIM_STRING
Definition: winuser.h:722
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define S_OK
Definition: intsafe.h:52
_In_ BOOLEAN Release
Definition: cdrom.h:920
ULONG Win32DbgPrint(const char *filename, int line, const char *lpFormat,...)
Definition: shellutils.h:27
const ITEMIDLIST_ABSOLUTE UNALIGNED * PCUIDLIST_ABSOLUTE
Definition: shtypes.idl:63
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
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
Definition: sprintf.c:733
#define NULL
Definition: types.h:112
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define E_UNEXPECTED
Definition: winerror.h:2456
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
const ITEMIDLIST_RELATIVE UNALIGNED * PCUIDLIST_RELATIVE
Definition: shtypes.idl:57
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
unsigned int ULONG
Definition: retypes.h:1
WCHAR * LPWSTR
Definition: xmlstorage.h:184
UINT uType
Definition: shtypes.idl:93
#define STDMETHOD_(t, m)
Definition: basetyps.h:63
#define E_POINTER
Definition: winerror.h:2365
#define __FUNCTION__
Definition: types.h:112
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
Definition: dsound.c:943
void WINAPI SHIM_OBJ_NAME() OutputDebugStringA(LPCSTR lpOutputString)
Definition: ignoredbgout.c:18
Definition: shlobj.h:498