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 /******************************************************************
100 * DllMain (dhtmled.ocx.@)
102 BOOL WINAPI
DllMain(HINSTANCE instance
, DWORD reason
, VOID
*reserved
)
104 TRACE("(%p, %lu, %p)\n", instance
, reason
, reserved
);
108 case DLL_PROCESS_ATTACH
:
109 DisableThreadLibraryCalls(instance
);
111 case DLL_PROCESS_DETACH
:
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
;