[PATCH] RegisterTypeLib: only cut off non-empty \[0-9]+$ resource-id
Fixes mis-applied patch in 5ecd6e4807d4b145a06e653dc1bb2f16678d0c14 The check was mistakenly changed to check file_name[0] when merging. The original intent was that since wcsrchr returns a pointer to the '\\', if (file_name != NULL), we already know file_name[0] != '\0' because '\\'!='\0' The check was intentionally whether the *next* character, file_name[1], was '\0', i.e. whether szFullPath ended with '\\' (was explicitly a directory). Passing a directory is incorrect input (szFullPath should be a .tlb file), but for quality-of-implemnentation it still seems wrong to have this remove two path elements, e.g. currently "path\\to\\" truncates to "path\\to" as if the last "\\" delimited a resource id, then splits the filename yielding szHelpDir == "path" and file_name == "to", rather than szHelpDir=="path\\to" and file_name == "" as seems intended (and as the originally-submitted patch would have). Signed-off-by: Kevin Puetz <PuetzKevinA(a)JohnDeere.com> --- dlls/oleaut32/typelib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index 01bb16efbc..06667850a3 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -730,7 +730,7 @@ HRESULT WINAPI RegisterTypeLib(ITypeLib *ptlib, const WCHAR *szFullPath, const W if ((disposition == REG_CREATED_NEW_KEY) && (szHelpDir == NULL)) { szHelpDir = freeHelpDir = SysAllocString(szFullPath); file_name = wcsrchr(szHelpDir, '\\'); - if (file_name && file_name[0]) { + if (file_name && file_name[1]) { /* possible remove a numeric \index (resource-id) */ WCHAR *end_ptr = file_name + 1; while ('0' <= *end_ptr && *end_ptr <= '9') end_ptr++;
participants (1)
-
Puetz Kevin A