[PATCH v2 2/8] dhtmled.ocx: Add DLL and stub DHTMLEdit object

Alex Henrie alexhenrie24 at gmail.com
Sun Jan 21 23:01:23 CST 2018


Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
v2: Call QueryInterface from dhtml_edit_create to make sure to
return the right interface

 configure.ac                       |   1 +
 dlls/dhtmled.ocx/Makefile.in       |   8 +
 dlls/dhtmled.ocx/dhtmled.ocx.spec  |   4 +
 dlls/dhtmled.ocx/dhtmled_private.h |  19 ++
 dlls/dhtmled.ocx/dhtmled_tlb.idl   |  22 ++
 dlls/dhtmled.ocx/edit.c            | 536 +++++++++++++++++++++++++++++++++++++
 dlls/dhtmled.ocx/main.c            | 162 +++++++++++
 7 files changed, 752 insertions(+)
 create mode 100644 dlls/dhtmled.ocx/Makefile.in
 create mode 100644 dlls/dhtmled.ocx/dhtmled.ocx.spec
 create mode 100644 dlls/dhtmled.ocx/dhtmled_private.h
 create mode 100644 dlls/dhtmled.ocx/dhtmled_tlb.idl
 create mode 100644 dlls/dhtmled.ocx/edit.c
 create mode 100644 dlls/dhtmled.ocx/main.c

diff --git a/configure.ac b/configure.ac
index 9aa32280f4..e4072f0fe7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3109,6 +3109,7 @@ WINE_CONFIG_TEST(dlls/ddrawex/tests)
 WINE_CONFIG_DLL(devenum,,[clean])
 WINE_CONFIG_TEST(dlls/devenum/tests)
 WINE_CONFIG_DLL(dhcpcsvc)
+WINE_CONFIG_DLL(dhtmled.ocx)
 WINE_CONFIG_DLL(difxapi)
 WINE_CONFIG_DLL(dinput,,[clean,implib,staticimplib])
 WINE_CONFIG_TEST(dlls/dinput/tests)
diff --git a/dlls/dhtmled.ocx/Makefile.in b/dlls/dhtmled.ocx/Makefile.in
new file mode 100644
index 0000000000..17850f8107
--- /dev/null
+++ b/dlls/dhtmled.ocx/Makefile.in
@@ -0,0 +1,8 @@
+MODULE    = dhtmled.ocx
+IMPORTS   = uuid
+
+C_SRCS = \
+	edit.c \
+	main.c
+
+IDL_SRCS = dhtmled_tlb.idl
diff --git a/dlls/dhtmled.ocx/dhtmled.ocx.spec b/dlls/dhtmled.ocx/dhtmled.ocx.spec
new file mode 100644
index 0000000000..b16365d0c9
--- /dev/null
+++ b/dlls/dhtmled.ocx/dhtmled.ocx.spec
@@ -0,0 +1,4 @@
+@ stdcall -private DllCanUnloadNow()
+@ stdcall -private DllGetClassObject(ptr ptr ptr)
+@ stdcall -private DllRegisterServer()
+@ stdcall -private DllUnregisterServer()
diff --git a/dlls/dhtmled.ocx/dhtmled_private.h b/dlls/dhtmled.ocx/dhtmled_private.h
new file mode 100644
index 0000000000..5a9e89b997
--- /dev/null
+++ b/dlls/dhtmled.ocx/dhtmled_private.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2017 Alex Henrie
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+extern HRESULT dhtml_edit_create(REFIID iid, void **out);
diff --git a/dlls/dhtmled.ocx/dhtmled_tlb.idl b/dlls/dhtmled.ocx/dhtmled_tlb.idl
new file mode 100644
index 0000000000..96a9444a13
--- /dev/null
+++ b/dlls/dhtmled.ocx/dhtmled_tlb.idl
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2017 Alex Henrie
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#pragma makedep register
+#pragma makedep regtypelib
+
+#include "dhtmled.idl"
diff --git a/dlls/dhtmled.ocx/edit.c b/dlls/dhtmled.ocx/edit.c
new file mode 100644
index 0000000000..428fd7af30
--- /dev/null
+++ b/dlls/dhtmled.ocx/edit.c
@@ -0,0 +1,536 @@
+/*
+ * Copyright 2017 Alex Henrie
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define COBJMACROS
+
+#include "dhtmled.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(dhtmled);
+
+typedef struct
+{
+    IDHTMLEdit IDHTMLEdit_iface;
+    LONG ref;
+} DHTMLEditImpl;
+
+static inline DHTMLEditImpl *impl_from_IDHTMLEdit(IDHTMLEdit *iface)
+{
+    return CONTAINING_RECORD(iface, DHTMLEditImpl, IDHTMLEdit_iface);
+}
+
+static HRESULT WINAPI DHTMLEdit_QueryInterface(IDHTMLEdit *iface, REFIID iid, void **out)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+
+    TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(iid), out);
+
+    if (IsEqualGUID(iid, &IID_IUnknown) ||
+        IsEqualGUID(iid, &IID_IDispatch) ||
+        IsEqualGUID(iid, &IID_IDHTMLSafe) ||
+        IsEqualGUID(iid, &IID_IDHTMLEdit))
+    {
+        IUnknown_AddRef(iface);
+        *out = iface;
+        return S_OK;
+    }
+
+    *out = NULL;
+    ERR("no interface for %s\n", debugstr_guid(iid));
+    return E_NOINTERFACE;
+}
+
+static ULONG WINAPI DHTMLEdit_AddRef(IDHTMLEdit *iface)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    LONG ref = InterlockedIncrement(&This->ref);
+
+    TRACE("(%p) ref=%d\n", This, ref);
+
+    return ref;
+}
+
+static ULONG WINAPI DHTMLEdit_Release(IDHTMLEdit *iface)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    LONG ref = InterlockedDecrement(&This->ref);
+
+    TRACE("(%p) ref=%d\n", This, ref);
+
+    if (!ref)
+        HeapFree(GetProcessHeap(), 0, This);
+
+    return ref;
+}
+
+static HRESULT WINAPI DHTMLEdit_GetTypeInfoCount(IDHTMLEdit *iface, UINT *count)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p) stub\n", This, count);
+    *count = 0;
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_GetTypeInfo(IDHTMLEdit *iface, UINT type_index, LCID lcid, ITypeInfo **type_info)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%u, %08x, %p) stub\n", This, type_index, lcid, type_info);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_GetIDsOfNames(IDHTMLEdit *iface, REFIID iid, OLECHAR **names, UINT name_count,
+                                              LCID lcid, DISPID *disp_ids)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%s, %p, %u, %08x, %p) stub\n", This, debugstr_guid(iid), names, name_count, lcid, disp_ids);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_Invoke(IDHTMLEdit *iface, DISPID member, REFIID iid, LCID lcid, WORD flags,
+                                       DISPPARAMS *params, VARIANT *ret, EXCEPINFO *exception_info, UINT *error_index)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%d, %s, %08x, 0x%x, %p, %p, %p, %p) stub\n",
+          This, member, debugstr_guid(iid), lcid, flags, params, ret, exception_info, error_index);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_ExecCommand(IDHTMLEdit *iface, DHTMLEDITCMDID cmd_id, OLECMDEXECOPT options,
+                                            VARIANT *code_in, VARIANT *code_out)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%u, %u, %s, %p) stub\n", This, cmd_id, options, debugstr_variant(code_in), code_out);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_QueryStatus(IDHTMLEdit *iface, DHTMLEDITCMDID cmd_id, DHTMLEDITCMDF *status)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%u, %p) stub\n", This, cmd_id, status);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_SetContextMenu(IDHTMLEdit *iface, VARIANT *strings, VARIANT *states)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p, %p) stub\n", This, strings, states);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_NewDocument(IDHTMLEdit *iface)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->() stub\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_LoadURL(IDHTMLEdit *iface, BSTR url)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%s)\n", This, debugstr_w(url));
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_FilterSourceCode(IDHTMLEdit *iface, BSTR in, BSTR *out)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%s, %p)\n", This, debugstr_w(in), out);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_Refresh(IDHTMLEdit *iface)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->() stub\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_DOM(IDHTMLEdit *iface, IHTMLDocument2 **value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_DocumentHTML(IDHTMLEdit *iface, BSTR *value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_DocumentHTML(IDHTMLEdit *iface, BSTR html)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%s) stub\n", This, debugstr_w(html));
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_ActivateApplets(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_ActivateApplets(IDHTMLEdit *iface, VARIANT_BOOL value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%04x) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_ActivateActiveXControls(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_ActivateActiveXControls(IDHTMLEdit *iface, VARIANT_BOOL value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%04x) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_ActivateDTCs(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_ActivateDTCs(IDHTMLEdit *iface, VARIANT_BOOL value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%04x) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_ShowDetails(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_ShowDetails(IDHTMLEdit *iface, VARIANT_BOOL value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%04x) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_ShowBorders(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_ShowBorders(IDHTMLEdit *iface, VARIANT_BOOL value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%04x) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_Appearance(IDHTMLEdit *iface, DHTMLEDITAPPEARANCE *value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_Appearance(IDHTMLEdit *iface, DHTMLEDITAPPEARANCE value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%u) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_Scrollbars(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_Scrollbars(IDHTMLEdit *iface, VARIANT_BOOL value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%04x) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_ScrollbarAppearance(IDHTMLEdit *iface, DHTMLEDITAPPEARANCE *value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_ScrollbarAppearance(IDHTMLEdit *iface, DHTMLEDITAPPEARANCE value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%u) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_SourceCodePreservation(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_SourceCodePreservation(IDHTMLEdit *iface, VARIANT_BOOL value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%04x) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_AbsoluteDropMode(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_AbsoluteDropMode(IDHTMLEdit *iface, VARIANT_BOOL value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%04x) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_SnapToGridX(IDHTMLEdit *iface, LONG *value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_SnapToGridX(IDHTMLEdit *iface, LONG value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%d) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_SnapToGridY(IDHTMLEdit *iface, LONG *value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_SnapToGridY(IDHTMLEdit *iface, LONG value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%d) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_SnapToGrid(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_SnapToGrid(IDHTMLEdit *iface, VARIANT_BOOL value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%04x) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_IsDirty(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_CurrentDocumentPath(IDHTMLEdit *iface, BSTR *value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_BaseURL(IDHTMLEdit *iface, BSTR *value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_BaseURL(IDHTMLEdit *iface, BSTR value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%s) stub\n", This, debugstr_w(value));
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_DocumentTitle(IDHTMLEdit *iface, BSTR *value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_UseDivOnCarriageReturn(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_UseDivOnCarriageReturn(IDHTMLEdit *iface, VARIANT_BOOL value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%04x) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_Busy(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_LoadDocument(IDHTMLEdit *iface, VARIANT *path, VARIANT *prompt)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%s, %s) stub\n", This, debugstr_variant(path), debugstr_variant(prompt));
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_SaveDocument(IDHTMLEdit *iface, VARIANT *path, VARIANT *prompt)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%s, %s) stub\n", This, debugstr_variant(path), debugstr_variant(prompt));
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_PrintDocument(IDHTMLEdit *iface, VARIANT *prompt)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%s) stub\n", This, debugstr_variant(prompt));
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_get_BrowseMode(IDHTMLEdit *iface, VARIANT_BOOL *value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%p) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DHTMLEdit_put_BrowseMode(IDHTMLEdit *iface, VARIANT_BOOL value)
+{
+    DHTMLEditImpl *This = impl_from_IDHTMLEdit(iface);
+    FIXME("(%p)->(%04x) stub\n", This, value);
+    return E_NOTIMPL;
+}
+
+static const IDHTMLEditVtbl DHTMLEditVtbl = {
+    DHTMLEdit_QueryInterface,
+    DHTMLEdit_AddRef,
+    DHTMLEdit_Release,
+    DHTMLEdit_GetTypeInfoCount,
+    DHTMLEdit_GetTypeInfo,
+    DHTMLEdit_GetIDsOfNames,
+    DHTMLEdit_Invoke,
+    DHTMLEdit_ExecCommand,
+    DHTMLEdit_QueryStatus,
+    DHTMLEdit_SetContextMenu,
+    DHTMLEdit_NewDocument,
+    DHTMLEdit_LoadURL,
+    DHTMLEdit_FilterSourceCode,
+    DHTMLEdit_Refresh,
+    DHTMLEdit_get_DOM,
+    DHTMLEdit_get_DocumentHTML,
+    DHTMLEdit_put_DocumentHTML,
+    DHTMLEdit_get_ActivateApplets,
+    DHTMLEdit_put_ActivateApplets,
+    DHTMLEdit_get_ActivateActiveXControls,
+    DHTMLEdit_put_ActivateActiveXControls,
+    DHTMLEdit_get_ActivateDTCs,
+    DHTMLEdit_put_ActivateDTCs,
+    DHTMLEdit_get_ShowDetails,
+    DHTMLEdit_put_ShowDetails,
+    DHTMLEdit_get_ShowBorders,
+    DHTMLEdit_put_ShowBorders,
+    DHTMLEdit_get_Appearance,
+    DHTMLEdit_put_Appearance,
+    DHTMLEdit_get_Scrollbars,
+    DHTMLEdit_put_Scrollbars,
+    DHTMLEdit_get_ScrollbarAppearance,
+    DHTMLEdit_put_ScrollbarAppearance,
+    DHTMLEdit_get_SourceCodePreservation,
+    DHTMLEdit_put_SourceCodePreservation,
+    DHTMLEdit_get_AbsoluteDropMode,
+    DHTMLEdit_put_AbsoluteDropMode,
+    DHTMLEdit_get_SnapToGridX,
+    DHTMLEdit_put_SnapToGridX,
+    DHTMLEdit_get_SnapToGridY,
+    DHTMLEdit_put_SnapToGridY,
+    DHTMLEdit_get_SnapToGrid,
+    DHTMLEdit_put_SnapToGrid,
+    DHTMLEdit_get_IsDirty,
+    DHTMLEdit_get_CurrentDocumentPath,
+    DHTMLEdit_get_BaseURL,
+    DHTMLEdit_put_BaseURL,
+    DHTMLEdit_get_DocumentTitle,
+    DHTMLEdit_get_UseDivOnCarriageReturn,
+    DHTMLEdit_put_UseDivOnCarriageReturn,
+    DHTMLEdit_get_Busy,
+    DHTMLEdit_LoadDocument,
+    DHTMLEdit_SaveDocument,
+    DHTMLEdit_PrintDocument,
+    DHTMLEdit_get_BrowseMode,
+    DHTMLEdit_put_BrowseMode
+};
+
+HRESULT dhtml_edit_create(REFIID iid, void **out)
+{
+    DHTMLEditImpl *This;
+    HRESULT ret;
+
+    TRACE("(%s, %p)\n", debugstr_guid(iid), out);
+
+    *out = NULL;
+
+    This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
+    if (!This)
+        return E_OUTOFMEMORY;
+
+    This->IDHTMLEdit_iface.lpVtbl = &DHTMLEditVtbl;
+    This->ref = 1;
+
+    ret = IDHTMLEdit_QueryInterface(&This->IDHTMLEdit_iface, iid, out);
+    IDHTMLEdit_Release(&This->IDHTMLEdit_iface);
+    return ret;
+}
diff --git a/dlls/dhtmled.ocx/main.c b/dlls/dhtmled.ocx/main.c
new file mode 100644
index 0000000000..4640884934
--- /dev/null
+++ b/dlls/dhtmled.ocx/main.c
@@ -0,0 +1,162 @@
+/*
+ * Dynamic HyperText Markup Language Editing Control
+ *
+ * Copyright 2017 Alex Henrie
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define COBJMACROS
+
+#include "initguid.h"
+#include "dhtmled.h"
+#include "dhtmled_private.h"
+#include "rpcproxy.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(dhtmled);
+
+typedef struct
+{
+    IClassFactory IClassFactory_iface;
+    HRESULT (*create)(REFIID iid, void **out);
+} ClassFactoryImpl;
+
+static inline ClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
+{
+    return CONTAINING_RECORD(iface, ClassFactoryImpl, IClassFactory_iface);
+}
+
+static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID iid, void **out)
+{
+    TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(iid), out);
+
+    if (IsEqualGUID(&IID_IUnknown, iid) || IsEqualGUID(&IID_IClassFactory, iid))
+    {
+        *out = iface;
+        IClassFactory_AddRef(iface);
+        return S_OK;
+    }
+
+    *out = NULL;
+    WARN("no interface for %s\n", debugstr_guid(iid));
+    return E_NOINTERFACE;
+}
+
+static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
+{
+    return 2; /* non-heap based object */
+}
+
+static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
+{
+    return 1; /* non-heap based object */
+}
+
+static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID iid, void **out)
+{
+    ClassFactoryImpl *This = impl_from_IClassFactory(iface);
+
+    TRACE("(%p)->(%p, %s, %p)\n", iface, outer, debugstr_guid(iid), out);
+
+    if (outer)
+        return CLASS_E_NOAGGREGATION;
+
+    return This->create(iid, out);
+}
+
+static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL lock)
+{
+    TRACE("(%p)->(%x)\n", iface, lock);
+    return S_OK;
+}
+
+static const IClassFactoryVtbl ClassFactoryVtbl = {
+    ClassFactory_QueryInterface,
+    ClassFactory_AddRef,
+    ClassFactory_Release,
+    ClassFactory_CreateInstance,
+    ClassFactory_LockServer
+};
+
+static HINSTANCE dhtmled_instance;
+
+/******************************************************************
+ *          DllMain (dhtmled.ocx.@)
+ */
+BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, VOID *reserved)
+{
+    TRACE("(%p, %u, %p)\n", instance, reason, reserved);
+
+    switch (reason)
+    {
+        case DLL_WINE_PREATTACH:
+            /* Applications that use dhtmled.ocx usually install and register it
+             * themselves, but do not install its dependency triedit.dll.
+             * Because Wine's (currently nonexistent) triedit.dll implementation
+             * is not sufficient for native dhtmled.ocx, prefer our own. */
+            return TRUE;
+        case DLL_PROCESS_ATTACH:
+            DisableThreadLibraryCalls(instance);
+            dhtmled_instance = instance;
+            break;
+    }
+
+    return TRUE;
+}
+
+/***********************************************************************
+ *          DllGetClassObject (dhtmled.ocx.@)
+ */
+HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, LPVOID *out)
+{
+    static ClassFactoryImpl dhtml_edit_cf = { {&ClassFactoryVtbl}, dhtml_edit_create };
+
+    TRACE("(%s, %s, %p)\n", debugstr_guid(clsid), debugstr_guid(iid), out);
+
+    if (IsEqualGUID(clsid, &CLSID_DHTMLEdit))
+        return IClassFactory_QueryInterface(&dhtml_edit_cf.IClassFactory_iface, iid, out);
+
+    FIXME("no class for %s\n", debugstr_guid(clsid));
+    return CLASS_E_CLASSNOTAVAILABLE;
+}
+
+/***********************************************************************
+ *          DllCanUnloadNow (dhtmled.ocx.@)
+ */
+HRESULT WINAPI DllCanUnloadNow(void)
+{
+    TRACE("()\n");
+    return S_FALSE;
+}
+
+/***********************************************************************
+ *          DllRegisterServer (dhtmled.ocx.@)
+ */
+HRESULT WINAPI DllRegisterServer(void)
+{
+    TRACE("()\n");
+    return __wine_register_resources(dhtmled_instance);
+}
+
+/***********************************************************************
+ *          DllUnregisterServer (dhtmled.ocx.@)
+ */
+HRESULT WINAPI DllUnregisterServer(void)
+{
+    TRACE("()\n");
+    return __wine_unregister_resources(dhtmled_instance);
+}
-- 
2.16.0




More information about the wine-devel mailing list