Module: wine Branch: master Commit: 5ecd6e4807d4b145a06e653dc1bb2f16678d0c14 URL: https://source.winehq.org/git/wine.git/?a=commit;h=5ecd6e4807d4b145a06e653dc... Author: Kevin Puetz <PuetzKevinA(a)JohnDeere.com> Date: Mon Feb 10 14:56:39 2020 +0100 oleaut32: Fix handling resource IDs in paths when registering typelib helpdir. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/oleaut32/typelib.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index a65f432af0..89d3940980 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -722,17 +722,26 @@ HRESULT WINAPI RegisterTypeLib(ITypeLib *ptlib, const WCHAR *szFullPath, const W KEY_WRITE, NULL, &subKey, &disposition) == ERROR_SUCCESS) { BSTR freeHelpDir = NULL; - OLECHAR* pIndexStr; + WCHAR *file_name; /* 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 = freeHelpDir = SysAllocString(szFullPath); - pIndexStr = wcsrchr(szHelpDir, '\\'); - if (pIndexStr) { - *pIndexStr = 0; + file_name = wcsrchr(szHelpDir, '\\'); + if (file_name && file_name[0]) { + /* possible remove a numeric \index (resource-id) */ + WCHAR *end_ptr = file_name + 1; + while ('0' <= *end_ptr && *end_ptr <= '9') end_ptr++; + if (!*end_ptr) + { + *file_name = 0; + file_name = wcsrchr(szHelpDir, '\\'); + } } + if (file_name) + *file_name = 0; } /* if we have an szHelpDir, set it! */