ReactOS 0.4.15-dev-8058-ga7cbb60
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
26inline 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
78inline 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
97#ifdef __cplusplus
98template <typename T>
99class CComCreatorCentralInstance
100{
101private:
102 static IUnknown *s_pInstance;
103
104public:
105 static HRESULT WINAPI CreateInstance(void *pv, REFIID riid, LPVOID *ppv)
106 {
107 *ppv = NULL;
108 if (pv != NULL)
110 if (!s_pInstance)
111 {
112 PVOID pObj;
113 HRESULT hr;
115 if (FAILED(hr))
116 return hr;
117 if (InterlockedCompareExchangePointer((PVOID *)&s_pInstance, pObj, NULL))
118 static_cast<IUnknown *>(pObj)->Release();
119 }
120 return s_pInstance->QueryInterface(riid, ppv);
121 }
122 static void Term()
123 {
124 if (s_pInstance)
125 {
126 s_pInstance->Release();
127 s_pInstance = NULL;
128 }
129 }
130};
131
132template <typename T>
133IUnknown *CComCreatorCentralInstance<T>::s_pInstance = NULL;
134
135#define DECLARE_CENTRAL_INSTANCE_NOT_AGGREGATABLE(x) \
136public: \
137 typedef CComCreatorCentralInstance< ATL::CComObject<x> > _CreatorClass;
138
139
140template <class Base>
141class CComDebugObject : public Base
142{
143public:
144 CComDebugObject(void * = NULL)
145 {
146#if DEBUG_CCOMOBJECT_CREATION
147 DbgPrint("%S, this=%08p\n", __FUNCTION__, static_cast<Base*>(this));
148#endif
149 _pAtlModule->Lock();
150 }
151
152 virtual ~CComDebugObject()
153 {
154 this->FinalRelease();
155 _pAtlModule->Unlock();
156 }
157
159 {
160 int rc = this->InternalAddRef();
161#if DEBUG_CCOMOBJECT_REFCOUNTING
162 DbgPrint("%s, RefCount is now %d(--)!\n", __FUNCTION__, rc);
163#endif
164 return rc;
165 }
166
168 {
169 int rc = this->InternalRelease();
170
171#if DEBUG_CCOMOBJECT_REFCOUNTING
172 DbgPrint("%s, RefCount is now %d(--)!\n", __FUNCTION__, rc);
173#endif
174
175 if (rc == 0)
176 {
177#if DEBUG_CCOMOBJECT_DESTRUCTION
178 DbgPrint("%s, RefCount reached 0 Deleting!\n", __FUNCTION__);
179#endif
180 delete this;
181 }
182 return rc;
183 }
184
186 {
187 return this->_InternalQueryInterface(iid, ppvObject);
188 }
189
190 static HRESULT WINAPI CreateInstance(CComDebugObject<Base> **pp)
191 {
192 CComDebugObject<Base> *newInstance;
193 HRESULT hResult;
194
195 ATLASSERT(pp != NULL);
196 if (pp == NULL)
197 return E_POINTER;
198
199 hResult = E_OUTOFMEMORY;
200 newInstance = NULL;
201 ATLTRY(newInstance = new CComDebugObject<Base>());
202 if (newInstance != NULL)
203 {
204 newInstance->SetVoid(NULL);
205 newInstance->InternalFinalConstructAddRef();
206 hResult = newInstance->_AtlInitialConstruct();
207 if (SUCCEEDED(hResult))
208 hResult = newInstance->FinalConstruct();
209 if (SUCCEEDED(hResult))
210 hResult = newInstance->_AtlFinalConstruct();
211 newInstance->InternalFinalConstructRelease();
212 if (hResult != S_OK)
213 {
214 delete newInstance;
215 newInstance = NULL;
216 }
217 }
218 *pp = newInstance;
219 return hResult;
220 }
221};
222
223#ifdef DEBUG_CCOMOBJECT
224# define _CComObject CComDebugObject
225#else
226# define _CComObject CComObject
227#endif
228
229template<class T>
230ULONG ReleaseCComPtrExpectZeroHelper(const char *file, UINT line, CComPtr<T>& cptr, BOOL forceRelease = FALSE)
231{
232 ULONG r = 0;
233 if (cptr.p != NULL)
234 {
235 T *raw = cptr.Detach();
236 int nrc = r = raw->Release();
237 if (nrc > 0)
238 Win32DbgPrint(file, line, "WARNING: Unexpected RefCount > 0 (%d)\n", nrc);
239 while (nrc > 0 && forceRelease)
240 {
241 nrc = raw->Release();
242 }
243 }
244 return r;
245}
246#define ReleaseCComPtrExpectZero(...) ReleaseCComPtrExpectZeroHelper(__FILE__, __LINE__, __VA_ARGS__)
247
248template<class T, class R>
249HRESULT inline ShellDebugObjectCreator(REFIID riid, R ** ppv)
250{
251 CComPtr<T> obj;
252 HRESULT hResult;
253
254 if (ppv == NULL)
255 return E_POINTER;
256 *ppv = NULL;
257 ATLTRY(obj = new CComDebugObject<T>);
258 if (obj.p == NULL)
259 return E_OUTOFMEMORY;
260 hResult = obj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
261 if (FAILED(hResult))
262 return hResult;
263 return S_OK;
264}
265
266template<class T>
267HRESULT inline ShellObjectCreator(REFIID riid, void ** ppv)
268{
269 _CComObject<T> *pobj;
270 HRESULT hResult;
271
272 hResult = _CComObject<T>::CreateInstance(&pobj);
273 if (FAILED(hResult))
274 return hResult;
275
276 pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
277
278 hResult = pobj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
279
280 pobj->Release(); /* In case of failure the object will be released */
281
282 return hResult;
283}
284
285template<class T>
286HRESULT inline ShellObjectCreatorInit(REFIID riid, void ** ppv)
287{
288 _CComObject<T> *pobj;
289 HRESULT hResult;
290
291 hResult = _CComObject<T>::CreateInstance(&pobj);
292 if (FAILED(hResult))
293 return hResult;
294
295 pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
296
297 hResult = pobj->Initialize();
298
299 if (SUCCEEDED(hResult))
300 hResult = pobj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
301
302 pobj->Release(); /* In case of failure the object will be released */
303
304 return hResult;
305}
306
307template<class T, class T1>
308HRESULT inline ShellObjectCreatorInit(T1 initArg1, REFIID riid, void ** ppv)
309{
310 _CComObject<T> *pobj;
311 HRESULT hResult;
312
313 hResult = _CComObject<T>::CreateInstance(&pobj);
314 if (FAILED(hResult))
315 return hResult;
316
317 pobj->AddRef(); /* CreateInstance returns object with 0 ref count */
318
319 hResult = pobj->Initialize(initArg1);
320
321 if (SUCCEEDED(hResult))
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, class T1, class T2>
330HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, 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(initArg1, initArg2);
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, class T2, class T3>
352HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, T3 initArg3, 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, initArg2, initArg3);
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, class T3, class T4>
374HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, T3 initArg3, T4 initArg4, 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, initArg3, initArg4);
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, class T4, class T5>
396HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, T3 initArg3, T4 initArg4, T5 initArg5, 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, initArg4, initArg5);
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 P, class R> static HRESULT SHILClone(P pidl, R *ppOut)
418{
419 R r = *ppOut = (R)ILClone((PIDLIST_RELATIVE)pidl);
420 return r ? S_OK : E_OUTOFMEMORY;
421}
422
423template<class B, class R> static HRESULT SHILCombine(B base, PCUIDLIST_RELATIVE sub, R *ppOut)
424{
425 R r = *ppOut = (R)ILCombine((PCIDLIST_ABSOLUTE)base, sub);
426 return r ? S_OK : E_OUTOFMEMORY;
427}
428
429HRESULT inline SHSetStrRet(LPSTRRET pStrRet, LPCSTR pstrValue)
430{
431 pStrRet->uType = STRRET_CSTR;
432 strcpy(pStrRet->cStr, pstrValue);
433 return S_OK;
434}
435
436HRESULT inline SHSetStrRet(LPSTRRET pStrRet, LPCWSTR pwstrValue)
437{
438 SIZE_T cchr = wcslen(pwstrValue);
439 LPWSTR buffer = static_cast<LPWSTR>(CoTaskMemAlloc((cchr + 1) * sizeof(WCHAR)));
440 if (buffer == NULL)
441 return E_OUTOFMEMORY;
442
443 pStrRet->uType = STRRET_WSTR;
444 pStrRet->pOleStr = buffer;
445 wcscpy(buffer, pwstrValue);
446 return S_OK;
447}
448
449HRESULT inline SHSetStrRet(LPSTRRET pStrRet, HINSTANCE hInstance, DWORD resId)
450{
452
453 if (!LoadStringW(hInstance, resId, Buffer, MAX_PATH))
454 return E_FAIL;
455
456 return SHSetStrRet(pStrRet, Buffer);
457}
458
459static inline void DbgDumpMenuInternal(HMENU hmenu, char* padding, int padlevel)
460{
461 WCHAR label[128];
462 int i;
464
465 padding[padlevel] = '.';
466 padding[padlevel + 1] = '.';
467 padding[padlevel + 2] = 0;
468
469 for (i = 0; i < count; i++)
470 {
471 MENUITEMINFOW mii = { 0 };
472
473 mii.cbSize = sizeof(mii);
475 mii.dwTypeData = label;
476 mii.cch = _countof(label);
477
478 GetMenuItemInfoW(hmenu, i, TRUE, &mii);
479
480 if (mii.fType & MFT_BITMAP)
481 DbgPrint("%s%2d - %08x: BITMAP %08p (state=%d, has submenu=%s)\n", padding, i, mii.wID, mii.hbmpItem, mii.fState, mii.hSubMenu ? "TRUE" : "FALSE");
482 else if (mii.fType & MFT_SEPARATOR)
483 DbgPrint("%s%2d - %08x ---SEPARATOR---\n", padding, i, mii.wID);
484 else
485 DbgPrint("%s%2d - %08x: %S (state=%d, has submenu=%s)\n", padding, i, mii.wID, mii.dwTypeData, mii.fState, mii.hSubMenu ? "TRUE" : "FALSE");
486
487 if (mii.hSubMenu)
488 DbgDumpMenuInternal(mii.hSubMenu, padding, padlevel + 2);
489
490 }
491
492 padding[padlevel] = 0;
493}
494
495static __inline void DbgDumpMenu(HMENU hmenu)
496{
497 char padding[128];
498 DbgDumpMenuInternal(hmenu, padding, 0);
499}
500
501
502static inline
503void DumpIdList(LPCITEMIDLIST pcidl)
504{
505 DbgPrint("Begin IDList Dump\n");
506
507 for (; pcidl != NULL; pcidl = ILGetNext(pcidl))
508 {
509 int i;
510 int cb = pcidl->mkid.cb;
511 BYTE * sh = (BYTE*) &(pcidl->mkid);
512 if (cb == 0) // ITEMIDLISTs are terminatedwith a null SHITEMID.
513 break;
514 DbgPrint("Begin SHITEMID (cb=%d)\n", cb);
515 if ((cb & 3) != 0)
516 DbgPrint(" - WARNING: cb is not a multiple of 4\n");
517 for (i = 0; (i + 4) <= cb; i += 4)
518 {
519 DbgPrint(" - abID[%08x]: %02x %02x %02x %02x\n",
520 i,
521 sh[i + 0],
522 sh[i + 1],
523 sh[i + 2],
524 sh[i + 3]);
525 }
526 if (i < cb)
527 {
528 cb -= i;
529 if (cb == 3)
530 {
531 DbgPrint(" - abID[%08x]: %02x %02x %02x --\n",
532 i,
533 sh[i + 0],
534 sh[i + 1],
535 sh[i + 2]);
536 }
537 else if (cb == 2)
538 {
539 DbgPrint(" - abID[%08x]: %02x %02x -- --\n",
540 i,
541 sh[i + 0],
542 sh[i + 1]);
543 }
544 else if (cb == 1)
545 {
546 DbgPrint(" - abID[%08x]: %02x -- -- --\n",
547 i,
548 sh[i + 0]);
549 }
550 }
551 DbgPrint("End SHITEMID\n");
552 }
553 DbgPrint("End IDList Dump.\n");
554}
555
556struct CCoInit
557{
558 CCoInit()
559 {
561 }
562 ~CCoInit()
563 {
564 if (SUCCEEDED(hr))
565 {
567 }
568 }
569 HRESULT hr;
570};
571
572#endif /* __cplusplus */
573
574#define S_LESSTHAN 0xffff
575#define S_EQUAL S_OK
576#define S_GREATERTHAN S_FALSE
577#define MAKE_COMPARE_HRESULT(x) ((x)>0 ? S_GREATERTHAN : ((x)<0 ? S_LESSTHAN : S_EQUAL))
578
579static inline BOOL ILIsSingle(LPCITEMIDLIST pidl)
580{
581 return pidl == ILFindLastID(pidl);
582}
583
585{
586 return (PCUIDLIST_ABSOLUTE)(((LPBYTE)pida) + (pida)->aoffset[0]);
587}
588
590{
591 return (PCUIDLIST_RELATIVE)(((LPBYTE)pida) + (pida)->aoffset[i + 1]);
592}
593
594
595#ifdef __cplusplus
596
597DECLSPEC_SELECTANY CLIPFORMAT g_cfHIDA = NULL;
598DECLSPEC_SELECTANY CLIPFORMAT g_cfShellIdListOffsets = NULL;
599
600// Allow to use the HIDA from an IDataObject without copying it
601struct CDataObjectHIDA
602{
603private:
604 STGMEDIUM m_medium;
605 CIDA* m_cida;
606 HRESULT m_hr;
607
608public:
609 explicit CDataObjectHIDA(IDataObject* pDataObject)
610 : m_cida(nullptr)
611 {
612 m_medium.tymed = TYMED_NULL;
613
614 if (g_cfHIDA == NULL)
615 {
616 g_cfHIDA = (CLIPFORMAT)RegisterClipboardFormatW(CFSTR_SHELLIDLISTW);
617 }
618 FORMATETC fmt = { g_cfHIDA, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
619
620 m_hr = pDataObject->GetData(&fmt, &m_medium);
621 if (FAILED(m_hr))
622 {
623 m_medium.tymed = TYMED_NULL;
624 return;
625 }
626
627 m_cida = (CIDA*)::GlobalLock(m_medium.hGlobal);
628 if (m_cida == nullptr)
629 {
630 m_hr = E_UNEXPECTED;
631 }
632 }
633
634 ~CDataObjectHIDA()
635 {
636 if (m_cida)
637 ::GlobalUnlock(m_cida);
638
639 ReleaseStgMedium(&m_medium);
640 }
641
642 HRESULT hr() const
643 {
644 return m_hr;
645 }
646
647 operator bool() const
648 {
649 return m_cida != nullptr;
650 }
651
652 operator const CIDA* () const
653 {
654 return m_cida;
655 }
656
657 const CIDA* operator->() const
658 {
659 return m_cida;
660 }
661};
662
663inline
664HRESULT DataObject_GetData(IDataObject* pDataObject, CLIPFORMAT clipformat, PVOID pBuffer, SIZE_T dwBufferSize)
665{
666 FORMATETC fmt = { clipformat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
667 STGMEDIUM medium = { TYMED_NULL };
668
669 HRESULT hr = pDataObject->GetData(&fmt, &medium);
670 if (SUCCEEDED(hr))
671 {
672 LPVOID blob = GlobalLock(medium.hGlobal);
673 if (blob)
674 {
675 SIZE_T size = GlobalSize(medium.hGlobal);
676 if (size <= dwBufferSize)
677 {
679 hr = S_OK;
680 }
681 else
682 {
684 }
685 GlobalUnlock(medium.hGlobal);
686 }
687 else
688 {
690 }
691
692 ReleaseStgMedium(&medium);
693 }
694 return hr;
695}
696
697inline
698HRESULT DataObject_SetData(IDataObject* pDataObject, CLIPFORMAT clipformat, PVOID pBuffer, SIZE_T dwBufferSize)
699{
700 STGMEDIUM medium = { TYMED_HGLOBAL };
701
702 medium.hGlobal = GlobalAlloc(GHND, dwBufferSize);
703 if (!medium.hGlobal)
704 return E_OUTOFMEMORY;
705
707 LPVOID blob = GlobalLock(medium.hGlobal);
708 if (blob)
709 {
710 CopyMemory(blob, pBuffer, dwBufferSize);
711 GlobalUnlock(medium.hGlobal);
712
713 FORMATETC etc = { clipformat, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
714 hr = pDataObject->SetData(&etc, &medium, TRUE);
715 }
716
717 if (FAILED(hr))
718 GlobalFree(medium.hGlobal);
719
720 return hr;
721}
722
723
724inline HRESULT
725DataObject_GetOffset(IDataObject *pDataObject, POINT *point)
726{
727 if (g_cfShellIdListOffsets == NULL)
728 {
729 g_cfShellIdListOffsets = (CLIPFORMAT)RegisterClipboardFormatW(CFSTR_SHELLIDLISTOFFSETW);
730 }
731
732 point->x = point->y = 0;
733
734 return DataObject_GetData(pDataObject, g_cfShellIdListOffsets, point, sizeof(point[0]));
735}
736
737inline HRESULT
738DataObject_SetOffset(IDataObject* pDataObject, POINT* point)
739{
740 if (g_cfShellIdListOffsets == NULL)
741 {
742 g_cfShellIdListOffsets = (CLIPFORMAT)RegisterClipboardFormatW(CFSTR_SHELLIDLISTOFFSETW);
743 }
744
745 return DataObject_SetData(pDataObject, g_cfShellIdListOffsets, point, sizeof(point[0]));
746}
747
748#endif
749
750
751#endif /* __ROS_SHELL_UTILS_H */
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
#define ATLTRY(x)
Definition: atlcomcli.h:44
#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
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define P(row, col)
#define MAX_PATH
Definition: compat.h:34
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
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
#define __FUNCTION__
Definition: types.h:116
POINTL point
Definition: edittest.c:50
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLsizeiptr size
Definition: glext.h:5919
GLuint buffer
Definition: glext.h:5915
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
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
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
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
void WINAPI SHIM_OBJ_NAME() OutputDebugStringA(LPCSTR lpOutputString)
Definition: ignoredbgout.c:18
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
Definition: sprintf.c:733
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
HRESULT SetData([in, unique] FORMATETC *pformatetc, [in, unique] STGMEDIUM *pmedium, [in] BOOL fRelease)
HRESULT GetData([in, unique] FORMATETC *pformatetcIn, [out] STGMEDIUM *pmedium)
ULONG AddRef()
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
ULONG Release()
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
#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
#define T
Definition: mbstring.h:31
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static const WCHAR label[]
Definition: itemdlg.c:1546
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
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:90
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
unsigned int UINT
Definition: ndis.h:50
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2439
#define bool
Definition: nsiface.idl:72
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:237
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:198
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:712
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
Definition: pidl.c:864
#define DECLSPEC_SELECTANY
Definition: guiddef.h:40
#define REFIID
Definition: guiddef.h:118
PVOID pBuffer
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
short sh
Definition: format.c:272
#define R(b, x)
Definition: sha2.c:134
ULONG Win32DbgPrint(const char *filename, int line, const char *lpFormat,...)
Definition: shellutils.h:27
#define DbgPrint(fmt,...)
Definition: shellutils.h:59
static PCUIDLIST_RELATIVE HIDA_GetPIDLItem(CIDA const *pida, SIZE_T i)
Definition: shellutils.h:589
HRESULT HResultFromWin32(DWORD hr)
Definition: shellutils.h:70
static PCUIDLIST_ABSOLUTE HIDA_GetPIDLFolder(CIDA const *pida)
Definition: shellutils.h:584
static BOOL ILIsSingle(LPCITEMIDLIST pidl)
Definition: shellutils.h:579
BOOL _ROS_FAILED_HELPER(HRESULT hr, const char *expr, const char *filename, int line)
Definition: shellutils.h:78
HRESULT hr
Definition: shlfolder.c:183
static const WCHAR CFSTR_SHELLIDLISTOFFSETW[]
Definition: shlobj.h:501
static const WCHAR CFSTR_SHELLIDLISTW[]
Definition: shlobj.h:499
@ 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:68
Definition: shlobj.h:565
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
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:87
Definition: fci.c:127
Definition: dsound.c:943
Definition: parser.c:49
LPWSTR dwTypeData
Definition: winuser.h:3269
LPCWSTR lpFormat
Definition: trayclock.cpp:32
unsigned char * LPBYTE
Definition: typedefs.h:53
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG
Definition: typedefs.h:59
static HMENU hmenu
Definition: win.c:66
#define CopyMemory
Definition: winbase.h:1710
#define GHND
Definition: winbase.h:297
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
#define WINAPI
Definition: msvc.h:6
#define STG_E_INVALIDHANDLE
Definition: winerror.h:2569
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662
#define E_UNEXPECTED
Definition: winerror.h:2456
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define E_POINTER
Definition: winerror.h:2365
#define MIIM_STRING
Definition: winuser.h:727
#define MIIM_ID
Definition: winuser.h:722
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define MIIM_FTYPE
Definition: winuser.h:729
UINT WINAPI RegisterClipboardFormatW(_In_ LPCWSTR)
#define MFT_SEPARATOR
Definition: winuser.h:744
#define MIIM_STATE
Definition: winuser.h:721
#define MIIM_SUBMENU
Definition: winuser.h:723
#define MFT_BITMAP
Definition: winuser.h:738
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
const char * LPCSTR
Definition: xmlstorage.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
unsigned char BYTE
Definition: xxhash.c:193