ReactOS 0.4.16-dev-2320-ge1853c6
wine.combase.test.c
Go to the documentation of this file.
1/*
2 * Copyright 2022 Rémi Bernon for CodeWeavers
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#if 0
20#pragma makedep testdll
21#endif
22
23#include <stdarg.h>
24#include <stddef.h>
25
26#define COBJMACROS
27#include "windef.h"
28#include "winbase.h"
29
30#include "initguid.h"
31#include "inspectable.h"
32#include "roapi.h"
33#include "winstring.h"
34
35#include "wine/debug.h"
36
38
39struct factory
40{
44};
45
47{
49}
50
52{
53 struct factory *impl = impl_from_IActivationFactory(iface);
54
55 TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
56
57 if (IsEqualGUID(iid, &IID_IUnknown)
58 || IsEqualGUID(iid, &IID_IInspectable)
59 || IsEqualGUID(iid, &IID_IAgileObject)
60 || IsEqualGUID(iid, &IID_IActivationFactory))
61 {
62#ifdef __REACTOS__
64 IInspectable_AddRef(*(IActivationFactory**)out);
65#else
66 IInspectable_AddRef((*out = &impl->IActivationFactory_iface));
67#endif
68 return S_OK;
69 }
70
71 FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
72 *out = NULL;
73 return E_NOINTERFACE;
74}
75
77{
78 struct factory *impl = impl_from_IActivationFactory(iface);
80 TRACE("iface %p increasing refcount to %lu.\n", iface, ref);
81 return ref;
82}
83
85{
86 struct factory *impl = impl_from_IActivationFactory(iface);
88 TRACE("iface %p decreasing refcount to %lu.\n", iface, ref);
89 return ref;
90}
91
92static HRESULT WINAPI factory_GetIids(IActivationFactory *iface, ULONG *iid_count, IID **iids)
93{
94 FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids);
95 return E_NOTIMPL;
96}
97
99{
100 FIXME("iface %p, class_name %p stub!\n", iface, class_name);
101 return E_NOTIMPL;
102}
103
105{
106 struct factory *impl = impl_from_IActivationFactory(iface);
107
108 FIXME("iface %p, trust_level %p stub!\n", iface, trust_level);
109
110 if (!impl->trusted) return E_NOTIMPL;
111
112 *trust_level = BaseTrust;
113 return S_OK;
114}
115
117{
118 FIXME("iface %p, instance %p stub!\n", iface, instance);
119 return E_NOTIMPL;
120}
121
122static const struct IActivationFactoryVtbl factory_vtbl =
123{
127 /* IInspectable methods */
131 /* IActivationFactory methods */
133};
134
135static struct factory class_factory = {{&factory_vtbl}, 0};
136static struct factory trusted_factory = {{&factory_vtbl}, 0, TRUE};
137
139{
140 FIXME("stub!\n");
141 return S_OK;
142}
143
145{
146 const WCHAR *buffer = WindowsGetStringRawBuffer(classid, NULL);
147
148 FIXME("class %s, factory %p stub!\n", debugstr_w(buffer), factory);
149
150 if (!wcscmp(buffer, L"Wine.Test.Class"))
151 {
152#ifdef __REACTOS__
153 *factory = &class_factory.IActivationFactory_iface;
154 IActivationFactory_AddRef(*factory);
155#else
156 IActivationFactory_AddRef((*factory = &class_factory.IActivationFactory_iface));
157#endif
158 return S_OK;
159 }
160 if (!wcscmp(buffer, L"Wine.Test.Trusted"))
161 {
162#ifdef __REACTOS__
163 *factory = &trusted_factory.IActivationFactory_iface;
164 IActivationFactory_AddRef(*factory);
165#else
166 IActivationFactory_AddRef((*factory = &trusted_factory.IActivationFactory_iface));
167#endif
168 return S_OK;
169 }
170
171 return REGDB_E_CLASSNOTREG;
172}
173
175{
176 FIXME("clsid %s, riid %s, out %p stub!\n", debugstr_guid(clsid), debugstr_guid(riid), out);
178}
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define FIXME(fmt,...)
Definition: precomp.h:53
const GUID IID_IUnknown
#define E_NOTIMPL
Definition: ddrawi.h:99
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
static HINSTANCE instance
Definition: main.c:40
LPCWSTR WINAPI WindowsGetStringRawBuffer(HSTRING str, UINT32 *len)
Definition: string.c:263
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1972
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint buffer
Definition: glext.h:5915
REFIID riid
Definition: atlbase.h:39
TrustLevel
Definition: inspectable.idl:23
@ BaseTrust
Definition: inspectable.idl:24
#define S_OK
Definition: intsafe.h:52
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_w
Definition: kernel32.h:32
const CLSID * clsid
Definition: msctf.cpp:50
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
#define TRACE(s)
Definition: solgame.cpp:4
Definition: main.c:439
IActivationFactory IActivationFactory_iface
Definition: send.c:48
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define WINAPI
Definition: msvc.h:6
static HRESULT WINAPI factory_QueryInterface(IActivationFactory *iface, REFIID iid, void **out)
static ULONG WINAPI factory_AddRef(IActivationFactory *iface)
static struct factory trusted_factory
static struct factory * impl_from_IActivationFactory(IActivationFactory *iface)
static HRESULT WINAPI factory_GetRuntimeClassName(IActivationFactory *iface, HSTRING *class_name)
static HRESULT WINAPI factory_GetTrustLevel(IActivationFactory *iface, TrustLevel *trust_level)
static HRESULT WINAPI factory_ActivateInstance(IActivationFactory *iface, IInspectable **instance)
HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out)
static HRESULT WINAPI factory_GetIids(IActivationFactory *iface, ULONG *iid_count, IID **iids)
static const struct IActivationFactoryVtbl factory_vtbl
static ULONG WINAPI factory_Release(IActivationFactory *iface)
HRESULT WINAPI DllCanUnloadNow(void)
HRESULT WINAPI DllGetActivationFactory(HSTRING classid, IActivationFactory **factory)
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:3801
#define E_NOINTERFACE
Definition: winerror.h:3479
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:3772
__wchar_t WCHAR
Definition: xmlstorage.h:180