Jon Griffiths : oleaut32: Implement ICreateTypeLib2::SetHelpStringContext/ SetHelpStringDll.

Alexandre Julliard julliard at winehq.org
Tue Jul 8 06:11:17 CDT 2008


Module: wine
Branch: master
Commit: bc6f1b0ceb4a8ae2e32391d8f0b29715ab16834c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bc6f1b0ceb4a8ae2e32391d8f0b29715ab16834c

Author: Jon Griffiths <jon_p_griffiths at yahoo.com>
Date:   Sun Jul  6 13:23:26 2008 -0700

oleaut32: Implement ICreateTypeLib2::SetHelpStringContext/SetHelpStringDll.

---

 dlls/oleaut32/typelib2.c |   51 ++++++++++++++++++++++++++++++++++-----------
 1 files changed, 38 insertions(+), 13 deletions(-)

diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c
index 6b773dc..7b14b4f 100644
--- a/dlls/oleaut32/typelib2.c
+++ b/dlls/oleaut32/typelib2.c
@@ -152,6 +152,7 @@ typedef struct tagICreateTypeLib2Impl
     WCHAR *filename;
 
     MSFT_Header typelib_header;
+    INT helpStringDll;
     MSFT_pSeg typelib_segdir[MSFT_SEG_MAX];
     char *typelib_segment_data[MSFT_SEG_MAX];
     int typelib_segment_block_length[MSFT_SEG_MAX];
@@ -231,6 +232,7 @@ static void ctl2_init_header(
     This->typelib_header.res48 = 0x80;
     This->typelib_header.dispatchpos = -1;
     This->typelib_header.nimpinfos = 0;
+    This->helpStringDll = -1;
 }
 
 /****************************************************************************
@@ -3331,6 +3333,8 @@ static HRESULT WINAPI ICreateTypeLib2_fnSaveAllChanges(ICreateTypeLib2 * iface)
     ctl2_finalize_typeinfos(This, filepos);
 
     if (!ctl2_write_chunk(hFile, &This->typelib_header, sizeof(This->typelib_header))) return retval;
+    if (This->typelib_header.varflags & HELPDLLFLAG)
+        if (!ctl2_write_chunk(hFile, &This->helpStringDll, sizeof(This->helpStringDll))) return retval;
     if (!ctl2_write_chunk(hFile, This->typelib_typeinfo_offsets, This->typelib_header.nrtypeinfos * 4)) return retval;
     if (!ctl2_write_chunk(hFile, &This->typelib_segdir, sizeof(This->typelib_segdir))) return retval;
     if (!ctl2_write_segment(This, hFile, MSFT_SEG_TYPEINFO    )) return retval;
@@ -3401,35 +3405,56 @@ static HRESULT WINAPI ICreateTypeLib2_fnSetCustData(
  *
  *  Sets a context number for the library help string.
  *
- * RETURNS
+ * PARAMS
+ *  iface     [I] The type library to set the help string context for.
+ *  dwContext [I] The help string context.
  *
+ * RETURNS
  *  Success: S_OK
  *  Failure: E_OUTOFMEMORY or E_INVALIDARG.
  */
-static HRESULT WINAPI ICreateTypeLib2_fnSetHelpStringContext(
-	ICreateTypeLib2 * iface,   /* [I] The type library to set the help string context for. */
-	ULONG dwHelpStringContext) /* [I] The help string context. */
+static
+HRESULT WINAPI ICreateTypeLib2_fnSetHelpStringContext(ICreateTypeLib2 * iface,
+                                                      ULONG dwContext)
 {
-    FIXME("(%p,%d), stub!\n", iface, dwHelpStringContext);
-    return E_OUTOFMEMORY;
+    ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
+
+    TRACE("(%p,%d)\n", iface, dwContext);
+
+    This->typelib_header.helpstringcontext = dwContext;
+    return S_OK;
 }
 
 /******************************************************************************
  * ICreateTypeLib2_SetHelpStringDll {OLEAUT32}
  *
- *  Sets the DLL used to look up localized help strings.
+ *  Set the DLL used to look up localized help strings.
  *
- * RETURNS
+ * PARAMS
+ *  iface     [I] The type library to set the help DLL for.
+ *  szDllName [I] The name of the help DLL.
  *
+ * RETURNS
  *  Success: S_OK
  *  Failure: E_OUTOFMEMORY or E_INVALIDARG.
  */
-static HRESULT WINAPI ICreateTypeLib2_fnSetHelpStringDll(
-	ICreateTypeLib2 * iface, /* [I] The type library to set the help DLL for. */
-	LPOLESTR szFileName)     /* [I] The name of the help DLL. */
+static
+HRESULT WINAPI ICreateTypeLib2_fnSetHelpStringDll(ICreateTypeLib2 * iface,
+                                                  LPOLESTR szDllName)
 {
-    FIXME("(%p,%s), stub!\n", iface, debugstr_w(szFileName));
-    return E_OUTOFMEMORY;
+    ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
+    int offset;
+
+    TRACE("(%p,%s)\n", iface, debugstr_w(szDllName));
+    if (!szDllName)
+        return E_INVALIDARG;
+
+    offset = ctl2_alloc_string(This, szDllName);
+    if (offset == -1)
+        return E_OUTOFMEMORY;
+    This->typelib_header.varflags |= HELPDLLFLAG;
+    This->helpStringDll = offset;
+    return S_OK;
 }
 
 /*================== ITypeLib2 Implementation ===================================*/




More information about the wine-cvs mailing list