[shell32_apitest]
[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_MenuDeskBar, 0xECD4FC4F, 0x521C, 0x11D0, 0xB7, 0x92, 0x00, 0xA0, 0xC9, 0x03, 0x12, 0xE1);
29 DEFINE_GUID(CLSID_MenuBandSite, 0xE13EF4E4, 0xD2F2, 0x11D0, 0x98, 0x16, 0x00, 0xC0, 0x4F, 0xD9, 0x19, 0x72);
30
31 template<typename Interface>
32 class CUnknownBase : public Interface
33 {
34 LONG m_lRef;
35 protected:
36 virtual const QITAB* GetQITab() = 0;
37 public:
38
39 CUnknownBase()
40 {
41 m_lRef = 0;
42 }
43
44 ULONG STDMETHODCALLTYPE AddRef ()
45 {
46 return InterlockedIncrement( &m_lRef );
47 }
48
49 ULONG STDMETHODCALLTYPE Release()
50 {
51 long newref = InterlockedDecrement( &m_lRef );
52 if (newref<=0) delete this;
53 return newref;
54 }
55
56 HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppv)
57 {
58 HRESULT hresult = QISearch(this, GetQITab(), riid, ppv);
59 if(SUCCEEDED(hresult)) AddRef();
60 return hresult;
61 }
62
63 virtual ~CUnknownBase() {}
64 };
65