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
25 #include "dhtmled_private.h"
28 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(dhtmled
);
34 IClassFactory IClassFactory_iface
;
35 HRESULT (*create
)(REFIID iid
, void **out
);
38 static inline ClassFactoryImpl
*impl_from_IClassFactory(IClassFactory
*iface
)
40 return CONTAINING_RECORD(iface
, ClassFactoryImpl
, IClassFactory_iface
);
43 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID iid
, void **out
)
45 TRACE("(%p)->(%s, %p)\n", iface
, debugstr_guid(iid
), out
);
47 if (IsEqualGUID(&IID_IUnknown
, iid
) || IsEqualGUID(&IID_IClassFactory
, iid
))
50 IClassFactory_AddRef(iface
);
55 WARN("no interface for %s\n", debugstr_guid(iid
));
59 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
61 return 2; /* non-heap based object */
64 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
66 return 1; /* non-heap based object */
69 static HRESULT WINAPI
ClassFactory_CreateInstance(IClassFactory
*iface
, IUnknown
*outer
, REFIID iid
, void **out
)
71 ClassFactoryImpl
*This
= impl_from_IClassFactory(iface
);
73 TRACE("(%p)->(%p, %s, %p)\n", iface
, outer
, debugstr_guid(iid
), out
);
76 return CLASS_E_NOAGGREGATION
;
78 return This
->create(iid
, out
);
81 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL lock
)
83 TRACE("(%p)->(%x)\n", iface
, lock
);
87 static const IClassFactoryVtbl ClassFactoryVtbl
= {
88 ClassFactory_QueryInterface
,
91 ClassFactory_CreateInstance
,
92 ClassFactory_LockServer
95 static HINSTANCE dhtmled_instance
;
97 /******************************************************************
98 * DllMain (dhtmled.ocx.@)
100 BOOL WINAPI
DllMain(HINSTANCE instance
, DWORD reason
, VOID
*reserved
)
102 TRACE("(%p, %u, %p)\n", instance
, reason
, reserved
);
106 case DLL_PROCESS_ATTACH
:
107 DisableThreadLibraryCalls(instance
);
108 dhtmled_instance
= instance
;
115 /***********************************************************************
116 * DllGetClassObject (dhtmled.ocx.@)
118 HRESULT WINAPI
DllGetClassObject(REFCLSID clsid
, REFIID iid
, LPVOID
*out
)
120 static ClassFactoryImpl dhtml_edit_cf
= { {&ClassFactoryVtbl
}, dhtml_edit_create
};
122 TRACE("(%s, %s, %p)\n", debugstr_guid(clsid
), debugstr_guid(iid
), out
);
124 if (IsEqualGUID(clsid
, &CLSID_DHTMLEdit
))
125 return IClassFactory_QueryInterface(&dhtml_edit_cf
.IClassFactory_iface
, iid
, out
);
127 FIXME("no class for %s\n", debugstr_guid(clsid
));
128 return CLASS_E_CLASSNOTAVAILABLE
;
131 /***********************************************************************
132 * DllCanUnloadNow (dhtmled.ocx.@)
134 HRESULT WINAPI
DllCanUnloadNow(void)
140 /***********************************************************************
141 * DllRegisterServer (dhtmled.ocx.@)
143 HRESULT WINAPI
DllRegisterServer(void)
146 return __wine_register_resources(dhtmled_instance
);
149 /***********************************************************************
150 * DllUnregisterServer (dhtmled.ocx.@)
152 HRESULT WINAPI
DllUnregisterServer(void)
155 return __wine_unregister_resources(dhtmled_instance
);