From e10e59fa0e2ac33a8a174a12bcb23c32cddb7a1e Mon Sep 17 00:00:00 2001 From: Kevin Puetz Date: Wed, 25 Sep 2019 16:09:41 +0200 Subject: [PATCH] oleaut32: Fix RegisterTypeLib prototype. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- 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 b13f6dccf8f..d7c5c977c6b 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 32b3b463bc8..cc50f189475 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);