Kevin Puetz : oleaut32: Fix RegisterTypeLib prototype.

Alexandre Julliard julliard at winehq.org
Wed Sep 25 16:45:19 CDT 2019


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

Author: Kevin Puetz <PuetzKevinA at JohnDeere.com>
Date:   Wed Sep 25 16:09:41 2019 +0200

oleaut32: Fix RegisterTypeLib prototype.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/oleaut32/typelib.c | 15 ++++-----------
 include/oleauto.h       |  2 +-
 2 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index b13f6dccf8..d7c5c977c6 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -643,11 +643,7 @@ static void TLB_register_interface(TLIBATTR *libattr, LPOLESTR name, TYPEATTR *t
  *    Success: S_OK
  *    Failure: Status
  */
-HRESULT WINAPI RegisterTypeLib(
-     ITypeLib * ptlib,     /* [in] Pointer to the library*/
-     OLECHAR * szFullPath, /* [in] full Path of the library*/
-     OLECHAR * szHelpDir)  /* [in] dir to the helpfile for the library,
-							 may be NULL*/
+HRESULT WINAPI RegisterTypeLib(ITypeLib *ptlib, const WCHAR *szFullPath, const WCHAR *szHelpDir)
 {
     HRESULT res;
     TLIBATTR *attr;
@@ -725,19 +721,18 @@ HRESULT WINAPI RegisterTypeLib(
         if (res == S_OK && RegCreateKeyExW(key, HELPDIRW, 0, NULL, 0,
             KEY_WRITE, NULL, &subKey, &disposition) == ERROR_SUCCESS)
         {
-            BOOL freeHelpDir = FALSE;
+            BSTR freeHelpDir = NULL;
             OLECHAR* pIndexStr;
 
             /* if we created a new key, and helpDir was null, set the helpdir
                to the directory which contains the typelib. However,
                if we just opened an existing key, we leave the helpdir alone */
             if ((disposition == REG_CREATED_NEW_KEY) && (szHelpDir == NULL)) {
-                szHelpDir = SysAllocString(szFullPath);
+                szHelpDir = freeHelpDir = SysAllocString(szFullPath);
                 pIndexStr = wcsrchr(szHelpDir, '\\');
                 if (pIndexStr) {
                     *pIndexStr = 0;
                 }
-                freeHelpDir = TRUE;
             }
 
             /* if we have an szHelpDir, set it! */
@@ -748,10 +743,8 @@ HRESULT WINAPI RegisterTypeLib(
                 }
             }
 
-            /* tidy up */
-            if (freeHelpDir) SysFreeString(szHelpDir);
+            SysFreeString(freeHelpDir);
             RegCloseKey(subKey);
-
         } else {
             res = E_FAIL;
         }
diff --git a/include/oleauto.h b/include/oleauto.h
index 32b3b463bc..cc50f18947 100644
--- a/include/oleauto.h
+++ b/include/oleauto.h
@@ -752,7 +752,7 @@ HRESULT WINAPI LoadRegTypeLib(REFGUID,WORD,WORD,LCID,ITypeLib**);
 HRESULT WINAPI LoadTypeLib(const OLECHAR*,ITypeLib**);
 HRESULT WINAPI LoadTypeLibEx(LPCOLESTR,REGKIND,ITypeLib**);
 HRESULT WINAPI QueryPathOfRegTypeLib(REFGUID,WORD,WORD,LCID,LPBSTR);
-HRESULT WINAPI RegisterTypeLib(ITypeLib*,OLECHAR*,OLECHAR*);
+HRESULT WINAPI RegisterTypeLib(ITypeLib*,LPCOLESTR,LPCOLESTR);
 HRESULT WINAPI UnRegisterTypeLib(REFGUID,WORD,WORD,LCID,SYSKIND);
 HRESULT WINAPI RegisterTypeLibForUser(ITypeLib*,OLECHAR*,OLECHAR*);
 HRESULT WINAPI UnRegisterTypeLibForUser(REFGUID,WORD,WORD,LCID,SYSKIND);




More information about the wine-cvs mailing list