rasapi32: Update spec file.
[wine/zf.git] / dlls / dhtmled.ocx / main.c
blob999341d43cff7f42b05f3ad721cdf4552196a2ae
1 /*
2 * Dynamic HyperText Markup Language Editing Control
4 * Copyright 2017 Alex Henrie
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #define COBJMACROS
23 #include "oaidl.h"
24 #include "ocidl.h"
25 #include "docobj.h"
26 #include "mshtml.h"
27 #include "rpcproxy.h"
28 #include "initguid.h"
29 #include "dhtmled.h"
30 #include "dhtmled_private.h"
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(dhtmled);
36 typedef struct
38 IClassFactory IClassFactory_iface;
39 HRESULT (*create)(REFIID iid, void **out);
40 } ClassFactoryImpl;
42 static inline ClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
44 return CONTAINING_RECORD(iface, ClassFactoryImpl, IClassFactory_iface);
47 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID iid, void **out)
49 TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(iid), out);
51 if (IsEqualGUID(&IID_IUnknown, iid) || IsEqualGUID(&IID_IClassFactory, iid))
53 *out = iface;
54 IClassFactory_AddRef(iface);
55 return S_OK;
58 *out = NULL;
59 WARN("no interface for %s\n", debugstr_guid(iid));
60 return E_NOINTERFACE;
63 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
65 return 2; /* non-heap based object */
68 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
70 return 1; /* non-heap based object */
73 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID iid, void **out)
75 ClassFactoryImpl *This = impl_from_IClassFactory(iface);
77 TRACE("(%p)->(%p, %s, %p)\n", iface, outer, debugstr_guid(iid), out);
79 if (outer)
80 return CLASS_E_NOAGGREGATION;
82 return This->create(iid, out);
85 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL lock)
87 TRACE("(%p)->(%x)\n", iface, lock);
88 return S_OK;
91 static const IClassFactoryVtbl ClassFactoryVtbl = {
92 ClassFactory_QueryInterface,
93 ClassFactory_AddRef,
94 ClassFactory_Release,
95 ClassFactory_CreateInstance,
96 ClassFactory_LockServer
99 static HINSTANCE dhtmled_instance;
101 /******************************************************************
102 * DllMain (dhtmled.ocx.@)
104 BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, VOID *reserved)
106 TRACE("(%p, %u, %p)\n", instance, reason, reserved);
108 switch (reason)
110 case DLL_PROCESS_ATTACH:
111 DisableThreadLibraryCalls(instance);
112 dhtmled_instance = instance;
113 break;
114 case DLL_PROCESS_DETACH:
115 if (reserved) break;
116 release_typelib();
117 break;
120 return TRUE;
123 /***********************************************************************
124 * DllGetClassObject (dhtmled.ocx.@)
126 HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, LPVOID *out)
128 static ClassFactoryImpl dhtml_edit_cf = { {&ClassFactoryVtbl}, dhtml_edit_create };
130 TRACE("(%s, %s, %p)\n", debugstr_guid(clsid), debugstr_guid(iid), out);
132 if (IsEqualGUID(clsid, &CLSID_DHTMLEdit))
133 return IClassFactory_QueryInterface(&dhtml_edit_cf.IClassFactory_iface, iid, out);
135 FIXME("no class for %s\n", debugstr_guid(clsid));
136 return CLASS_E_CLASSNOTAVAILABLE;
139 /***********************************************************************
140 * DllCanUnloadNow (dhtmled.ocx.@)
142 HRESULT WINAPI DllCanUnloadNow(void)
144 TRACE("()\n");
145 return S_FALSE;
148 /***********************************************************************
149 * DllRegisterServer (dhtmled.ocx.@)
151 HRESULT WINAPI DllRegisterServer(void)
153 TRACE("()\n");
154 return __wine_register_resources(dhtmled_instance);
157 /***********************************************************************
158 * DllUnregisterServer (dhtmled.ocx.@)
160 HRESULT WINAPI DllUnregisterServer(void)
162 TRACE("()\n");
163 return __wine_unregister_resources(dhtmled_instance);