From a83e13fa6a003b5901b996a6aaa2300a3281cd33 Mon Sep 17 00:00:00 2001 From: "dveditz%cruzio.com" Date: Thu, 13 May 2004 19:20:13 +0000 Subject: [PATCH] bug 243373 StrStrI not available on some widows systems r=ssu,sr=mkaply,a=mkaply git-svn-id: svn://10.0.0.236/trunk@156372 18797224-902f-48f8-a5cc-f745e15eee43 --- .../xpinstall/wizard/windows/setup/extra.c | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/mozilla/xpinstall/wizard/windows/setup/extra.c b/mozilla/xpinstall/wizard/windows/setup/extra.c index bd2f12dd03e..c89d8512fde 100644 --- a/mozilla/xpinstall/wizard/windows/setup/extra.c +++ b/mozilla/xpinstall/wizard/windows/setup/extra.c @@ -54,7 +54,6 @@ // shellapi.h is needed to build with WIN32_LEAN_AND_MEAN #include -#include #define HIDWORD(l) ((DWORD) (((ULONG) (l) >> 32) & 0xFFFF)) #define LODWORD(l) ((DWORD) (l)) @@ -548,6 +547,8 @@ void RemoveDelayedDeleteFileEntries(const char *aPathToMatch) char *multiStr = NULL; const char key[] = "SYSTEM\\CurrentControlSet\\Control\\Session Manager"; const char name[] = "PendingFileRenameOperations"; + char *pathToMatch; + char *lcName; char *pName; char *pRename; int nameLen, renameLen; @@ -572,11 +573,19 @@ void RemoveDelayedDeleteFileEntries(const char *aPathToMatch) if (!multiStr) return; + pathToMatch = strdup(aPathToMatch); + if (!pathToMatch) + { + free(multiStr); + return; + } + if (RegQueryValueEx(hkResult, name, 0, NULL, multiStr, &oldMaxValueLen) == ERROR_SUCCESS) { // The registry value consists of name/newname pairs of null-terminated // strings, with a final extra null termination. We're only interested // in files to be deleted, which are indicated by a null newname. + CharLower(pathToMatch); lenToEnd = newMaxValueLen = oldMaxValueLen; pName = multiStr; while(*pName && lenToEnd > 0) @@ -593,7 +602,11 @@ void RemoveDelayedDeleteFileEntries(const char *aPathToMatch) if (*pRename == '\0') { // No new name, it's a delete. Is it the one we want? - if (StrStrI(pName, aPathToMatch)) + lcName = strdup(pName); + if (lcName) + { + CharLower(lcName); + if (strstr(lcName, pathToMatch)) { // It's a match-- // delete this pair by moving the remainder on top @@ -603,8 +616,11 @@ void RemoveDelayedDeleteFileEntries(const char *aPathToMatch) newMaxValueLen -= (nameLen + renameLen); // next pair is in place, continue w/out moving pName + free(lcName); continue; } + free(lcName); + } } // on to the next pair pName = pRename + renameLen; @@ -620,6 +636,7 @@ void RemoveDelayedDeleteFileEntries(const char *aPathToMatch) RegCloseKey(hkResult); free(multiStr); + free(pathToMatch); }