Partial merge of condrv_restructure branch r65657.
[reactos.git] / rostests / apitests / shell32 / shelltest.h
1 #define WIN32_NO_STATUS
2 #define _INC_WINDOWS
3 #define COM_NO_WINDOWS_H
4
5 #include <stdio.h>
6 #include <wine/test.h>
7
8
9 #include <winuser.h>
10 #include <winreg.h>
11
12 #include <commctrl.h>
13 #include <shellapi.h>
14 #include <shlobj.h>
15 #include <shlwapi.h>
16
17 #include <stdlib.h>
18 #include <malloc.h>
19 #include <memory.h>
20 #include <string.h>
21 #include <tchar.h>
22
23 #include <initguid.h>
24
25 #define test_S_OK(hres, message) ok(hres == S_OK, "%s (0x%lx instead of S_OK)\n",message, hResult);
26 #define test_HRES(hres, hresExpected, message) ok(hres == hresExpected, "%s (0x%lx instead of 0x%lx)\n",message, hResult,hresExpected);
27
28 DEFINE_GUID(CLSID_MenuBandSite, 0xE13EF4E4, 0xD2F2, 0x11D0, 0x98, 0x16, 0x00, 0xC0, 0x4F, 0xD9, 0x19, 0x72);
29
30 template<typename Interface>
31 class CUnknownBase : public Interface
32 {
33 LONG m_lRef;
34 protected:
35 virtual const QITAB* GetQITab() = 0;
36 public:
37
38 CUnknownBase()
39 {
40 m_lRef = 0;
41 }
42
43 ULONG STDMETHODCALLTYPE AddRef ()
44 {
45 return InterlockedIncrement( &m_lRef );
46 }
47
48 ULONG STDMETHODCALLTYPE Release()
49 {
50 long newref = InterlockedDecrement( &m_lRef );
51 if (newref<=0) delete this;
52 return newref;
53 }
54
55 HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppv)
56 {
57 HRESULT hresult = QISearch(this, GetQITab(), riid, ppv);
58 if(SUCCEEDED(hresult)) AddRef();
59 return hresult;
60 }
61
62 virtual ~CUnknownBase() {}
63 };
64