wined3d: Rename gen_ffp_frag_op().
[wine.git] / dlls / dhtmled.ocx / main.c
bloba0acd8b620b46f9bcc3267456cac01ca009ecb9a
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 /******************************************************************
100 * DllMain (dhtmled.ocx.@)
102 BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, VOID *reserved)
104 TRACE("(%p, %u, %p)\n", instance, reason, reserved);
106 switch (reason)
108 case DLL_PROCESS_ATTACH:
109 DisableThreadLibraryCalls(instance);
110 break;
111 case DLL_PROCESS_DETACH:
112 if (reserved) break;
113 release_typelib();
114 break;
117 return TRUE;
120 /***********************************************************************
121 * DllGetClassObject (dhtmled.ocx.@)
123 HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, LPVOID *out)
125 static ClassFactoryImpl dhtml_edit_cf = { {&ClassFactoryVtbl}, dhtml_edit_create };
127 TRACE("(%s, %s, %p)\n", debugstr_guid(clsid), debugstr_guid(iid), out);
129 if (IsEqualGUID(clsid, &CLSID_DHTMLEdit))
130 return IClassFactory_QueryInterface(&dhtml_edit_cf.IClassFactory_iface, iid, out);
132 FIXME("no class for %s\n", debugstr_guid(clsid));
133 return CLASS_E_CLASSNOTAVAILABLE;