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
30 #include "dhtmled_private.h"
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(dhtmled
);
38 IClassFactory IClassFactory_iface
;
39 HRESULT (*create
)(REFIID iid
, void **out
);
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
))
54 IClassFactory_AddRef(iface
);
59 WARN("no interface for %s\n", debugstr_guid(iid
));
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
);
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
);
91 static const IClassFactoryVtbl ClassFactoryVtbl
= {
92 ClassFactory_QueryInterface
,
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
);
110 case DLL_PROCESS_ATTACH
:
111 DisableThreadLibraryCalls(instance
);
112 dhtmled_instance
= instance
;
114 case DLL_PROCESS_DETACH
:
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)
148 /***********************************************************************
149 * DllRegisterServer (dhtmled.ocx.@)
151 HRESULT WINAPI
DllRegisterServer(void)
154 return __wine_register_resources(dhtmled_instance
);
157 /***********************************************************************
158 * DllUnregisterServer (dhtmled.ocx.@)
160 HRESULT WINAPI
DllUnregisterServer(void)
163 return __wine_unregister_resources(dhtmled_instance
);