This makes RSSedit to work, no error dialog is shown.
Signed-off-by: Vijay Kiran Kamuju infyquest@gmail.com --- dlls/dhtmled.ocx/Makefile.in | 2 +- dlls/dhtmled.ocx/dhtmled_private.h | 1 + dlls/dhtmled.ocx/edit.c | 112 ++++++++++++++++++++++++++--- dlls/dhtmled.ocx/main.c | 3 + 4 files changed, 108 insertions(+), 10 deletions(-)
diff --git a/dlls/dhtmled.ocx/Makefile.in b/dlls/dhtmled.ocx/Makefile.in index bbe397dc401..47d57f5b1f9 100644 --- a/dlls/dhtmled.ocx/Makefile.in +++ b/dlls/dhtmled.ocx/Makefile.in @@ -1,5 +1,5 @@ MODULE = dhtmled.ocx -IMPORTS = uuid ole32 user32 gdi32 +IMPORTS = uuid ole32 oleaut32 user32 gdi32
EXTRADLLFLAGS = -mno-cygwin
diff --git a/dlls/dhtmled.ocx/dhtmled_private.h b/dlls/dhtmled.ocx/dhtmled_private.h index 5a9e89b9977..763f1f4fd1b 100644 --- a/dlls/dhtmled.ocx/dhtmled_private.h +++ b/dlls/dhtmled.ocx/dhtmled_private.h @@ -17,3 +17,4 @@ */
extern HRESULT dhtml_edit_create(REFIID iid, void **out); +void release_typelib(void); diff --git a/dlls/dhtmled.ocx/edit.c b/dlls/dhtmled.ocx/edit.c index b96630c73e5..4d39f247be0 100644 --- a/dlls/dhtmled.ocx/edit.c +++ b/dlls/dhtmled.ocx/edit.c @@ -25,6 +25,78 @@
WINE_DEFAULT_DEBUG_CHANNEL(dhtmled);
+typedef enum tid_t { + NULL_tid, + IDHTMLEdit_tid, + LAST_tid +} tid_t; + +static ITypeLib *typelib; +static ITypeInfo *typeinfos[LAST_tid]; + +static REFIID tid_ids[] = { + &IID_NULL, + &IID_IDHTMLEdit +}; + +static HRESULT load_typelib(void) +{ + ITypeLib *tl; + HRESULT hr; + + hr = LoadRegTypeLib(&LIBID_DHTMLEDLib, 1, 0, LOCALE_SYSTEM_DEFAULT, &tl); + if (FAILED(hr)) { + ERR("LoadRegTypeLib failed: %08x\n", hr); + return hr; + } + + if (InterlockedCompareExchangePointer((void**)&typelib, tl, NULL)) + ITypeLib_Release(tl); + return hr; +} + +void release_typelib(void) +{ + unsigned i; + + if (!typelib) + return; + + for (i = 0; i < ARRAY_SIZE(typeinfos); i++) + if (typeinfos[i]) + ITypeInfo_Release(typeinfos[i]); + + ITypeLib_Release(typelib); +} + +static HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo) +{ + HRESULT hr; + + if (!typelib) + hr = load_typelib(); + if (!typelib) + return hr; + + if (!typeinfos[tid]) + { + ITypeInfo *ti; + + hr = ITypeLib_GetTypeInfoOfGuid(typelib, tid_ids[tid], &ti); + if (FAILED(hr)) + { + ERR("GetTypeInfoOfGuid(%s) failed: %08x\n", debugstr_guid(tid_ids[tid]), hr); + return hr; + } + + if (InterlockedCompareExchangePointer((void**)(typeinfos+tid), ti, NULL)) + ITypeInfo_Release(ti); + } + + *typeinfo = typeinfos[tid]; + return S_OK; +} + typedef struct { IDHTMLEdit IDHTMLEdit_iface; @@ -239,33 +311,55 @@ static ULONG WINAPI DHTMLEdit_Release(IDHTMLEdit *iface) 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; + TRACE("(%p)->(%p)\n", This, count); + *count = 1; + return S_OK; }
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; + HRESULT hr; + + TRACE("(%p)->(%u, %08x, %p)\n", This, type_index, lcid, type_info); + + hr = get_typeinfo(IDHTMLEdit_tid, type_info); + if (SUCCEEDED(hr)) + ITypeInfo_AddRef(*type_info); + return hr; }
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; + ITypeInfo *ti; + HRESULT hr; + + TRACE("(%p)->(%s, %p, %u, %08x, %p)\n", This, debugstr_guid(iid), names, name_count, lcid, disp_ids); + + hr = get_typeinfo(IDHTMLEdit_tid, &ti); + if (FAILED(hr)) + return hr; + + return ITypeInfo_GetIDsOfNames(ti, names, name_count, disp_ids); }
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", + ITypeInfo *ti; + HRESULT hr; + + TRACE("(%p)->(%d, %s, %08x, 0x%x, %p, %p, %p, %p)\n", This, member, debugstr_guid(iid), lcid, flags, params, ret, exception_info, error_index); - return E_NOTIMPL; + + hr = get_typeinfo(IDHTMLEdit_tid, &ti); + if (FAILED(hr)) + return hr; + + return ITypeInfo_Invoke(ti, iface, member, flags, params, ret, exception_info, error_index); }
static HRESULT WINAPI DHTMLEdit_ExecCommand(IDHTMLEdit *iface, DHTMLEDITCMDID cmd_id, OLECMDEXECOPT options, diff --git a/dlls/dhtmled.ocx/main.c b/dlls/dhtmled.ocx/main.c index b7409cf61a5..e4be35dd14b 100644 --- a/dlls/dhtmled.ocx/main.c +++ b/dlls/dhtmled.ocx/main.c @@ -107,6 +107,9 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, VOID *reserved) DisableThreadLibraryCalls(instance); dhtmled_instance = instance; break; + case DLL_PROCESS_DETACH: + release_typelib(); + break; }
return TRUE;
Signed-off-by: Vijay Kiran Kamuju infyquest@gmail.com --- dlls/dhtmled.ocx/edit.c | 101 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 99 insertions(+), 2 deletions(-)
diff --git a/dlls/dhtmled.ocx/edit.c b/dlls/dhtmled.ocx/edit.c index 4d39f247be0..a24a886ebc8 100644 --- a/dlls/dhtmled.ocx/edit.c +++ b/dlls/dhtmled.ocx/edit.c @@ -97,7 +97,17 @@ static HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo) return S_OK; }
-typedef struct +typedef struct DHTMLEditImpl DHTMLEditImpl; +typedef struct ConnectionPoint ConnectionPoint; + +struct ConnectionPoint +{ + IConnectionPoint IConnectionPoint_iface; + DHTMLEditImpl *dhed; + const IID *riid; +}; + +struct DHTMLEditImpl { IDHTMLEdit IDHTMLEdit_iface; IOleObject IOleObject_iface; @@ -113,9 +123,10 @@ typedef struct IServiceProvider IServiceProvider_iface;
IOleClientSite *client_site; + ConnectionPoint conpt; SIZEL extent; LONG ref; -} DHTMLEditImpl; +};
static inline DHTMLEditImpl *impl_from_IDHTMLEdit(IDHTMLEdit *iface) { @@ -1592,6 +1603,88 @@ static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl = ConnectionPointContainer_FindConnectionPoint };
+static inline ConnectionPoint *impl_from_IConnectionPoint(IConnectionPoint *iface) +{ + return CONTAINING_RECORD(iface, ConnectionPoint, IConnectionPoint_iface); +} + +static HRESULT WINAPI ConnectionPoint_QueryInterface(IConnectionPoint *iface, REFIID iid, LPVOID *out) +{ + ConnectionPoint *This = impl_from_IConnectionPoint(iface); + + if (IsEqualGUID(&IID_IUnknown, iid) || IsEqualGUID(&IID_IConnectionPoint, iid)) + { + *out = &This->IConnectionPoint_iface; + DHTMLEdit_AddRef(&This->dhed->IDHTMLEdit_iface); + return S_OK; + } + + *out = NULL; + WARN("Unsupported interface %s\n", debugstr_guid(iid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI ConnectionPoint_AddRef(IConnectionPoint *iface) +{ + ConnectionPoint *This = impl_from_IConnectionPoint(iface); + return IConnectionPointContainer_AddRef(&This->dhed->IConnectionPointContainer_iface); +} + +static ULONG WINAPI ConnectionPoint_Release(IConnectionPoint *iface) +{ + ConnectionPoint *This = impl_from_IConnectionPoint(iface); + return IConnectionPointContainer_AddRef(&This->dhed->IConnectionPointContainer_iface); +} + +static HRESULT WINAPI ConnectionPoint_GetConnectionInterface(IConnectionPoint *iface, IID *iid) +{ + ConnectionPoint *This = impl_from_IConnectionPoint(iface); + FIXME("%p, %p\n", This, iid); + return E_NOTIMPL; +} + +static HRESULT WINAPI ConnectionPoint_GetConnectionPointContainer(IConnectionPoint *iface, + IConnectionPointContainer **container) +{ + ConnectionPoint *This = impl_from_IConnectionPoint(iface); + FIXME("%p, %p\n", This, container); + return E_NOTIMPL; +} + +static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *unk_sink, + DWORD *cookie) +{ + ConnectionPoint *This = impl_from_IConnectionPoint(iface); + FIXME("%p, %p, %p\n", This, unk_sink, cookie); + return E_NOTIMPL; +} + +static HRESULT WINAPI ConnectionPoint_Unadvise(IConnectionPoint *iface, DWORD cookie) +{ + ConnectionPoint *This = impl_from_IConnectionPoint(iface); + FIXME("%p, %d\n", This, cookie); + return E_NOTIMPL; +} + +static HRESULT WINAPI ConnectionPoint_EnumConnections(IConnectionPoint *iface, + IEnumConnections **points) +{ + ConnectionPoint *This = impl_from_IConnectionPoint(iface); + FIXME("%p, %p\n", This, points); + return E_NOTIMPL; +} + +static const IConnectionPointVtbl ConnectionPointVtbl = { + ConnectionPoint_QueryInterface, + ConnectionPoint_AddRef, + ConnectionPoint_Release, + ConnectionPoint_GetConnectionInterface, + ConnectionPoint_GetConnectionPointContainer, + ConnectionPoint_Advise, + ConnectionPoint_Unadvise, + ConnectionPoint_EnumConnections +}; + static HRESULT WINAPI DataObject_QueryInterface(IDataObject *iface, REFIID iid, LPVOID *out) { return dhtml_edit_qi(impl_from_IDataObject(iface), iid, out); @@ -1752,6 +1845,10 @@ HRESULT dhtml_edit_create(REFIID iid, void **out) This->client_site = NULL; This->ref = 1;
+ This->conpt.dhed = This; + This->conpt.riid = &DIID__DHTMLEditEvents; + This->conpt.IConnectionPoint_iface.lpVtbl = &ConnectionPointVtbl; + hdc = GetDC(0); dpi_x = GetDeviceCaps(hdc, LOGPIXELSX); dpi_y = GetDeviceCaps(hdc, LOGPIXELSY);
Signed-off-by: Jacek Caban jacek@codeweavers.com
Signed-off-by: Vijay Kiran Kamuju infyquest@gmail.com --- dlls/dhtmled.ocx/edit.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/dlls/dhtmled.ocx/edit.c b/dlls/dhtmled.ocx/edit.c index a24a886ebc8..37c585b8a64 100644 --- a/dlls/dhtmled.ocx/edit.c +++ b/dlls/dhtmled.ocx/edit.c @@ -1587,10 +1587,23 @@ static HRESULT WINAPI ConnectionPointContainer_EnumConnectionPoints(IConnectionP }
static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPointContainer *iface, - REFIID riid, IConnectionPoint **ppCP) + REFIID riid, IConnectionPoint **point) { DHTMLEditImpl *This = impl_from_IConnectionPointContainer(iface); - FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppCP); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), point); + + if (!point) + return E_POINTER; + + if (IsEqualGUID(riid, This->conpt.riid)) + { + *point = &This->conpt.IConnectionPoint_iface; + IConnectionPoint_AddRef(*point); + return S_OK; + } + + FIXME("unsupported connection point %s\n", debugstr_guid(riid)); return CONNECT_E_NOCONNECTION; }
@@ -1815,7 +1828,6 @@ static const IServiceProviderVtbl ServiceProviderVtbl = { ServiceProvider_QueryService };
- HRESULT dhtml_edit_create(REFIID iid, void **out) { DHTMLEditImpl *This;
Signed-off-by: Jacek Caban jacek@codeweavers.com
Signed-off-by: Vijay Kiran Kamuju infyquest@gmail.com --- dlls/dhtmled.ocx/edit.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/dhtmled.ocx/edit.c b/dlls/dhtmled.ocx/edit.c index 37c585b8a64..9e08a4f5c95 100644 --- a/dlls/dhtmled.ocx/edit.c +++ b/dlls/dhtmled.ocx/edit.c @@ -1336,9 +1336,10 @@ static HRESULT WINAPI ViewObjectEx_GetViewStatus(IViewObjectEx *iface, DWORD *st { DHTMLEditImpl *This = impl_from_IViewObjectEx(iface);
- FIXME("(%p)->(%p)\n", This, status); + TRACE("(%p)->(%p)\n", This, status);
- return E_NOTIMPL; + *status = VIEWSTATUS_OPAQUE | VIEWSTATUS_SOLIDBKGND; + return S_OK; }
static HRESULT WINAPI ViewObjectEx_QueryHitPoint(IViewObjectEx *iface, DWORD aspect, const RECT *bounds,
Signed-off-by: Jacek Caban jacek@codeweavers.com