free(pathToMatch);
void RemoveDelayedDeleteFileEntries(const char *aPathToMatch){  HKEY  hkResult;  DWORD dwErr;  DWORD dwType = REG_NONE;  DWORD oldMaxValueLen = 0;  DWORD newMaxValueLen = 0;  DWORD lenToEnd = 0;  char  *multiStr = NULL;  const char key[] = "SYSTEM\\CurrentControlSet\\Control\\Session Manager";  const char name[] = "PendingFileRenameOperations";  char  *pName;  char  *pRename;  int   nameLen, renameLen;  assert(aPathToMatch);  /* if not NT systems (win2k, winXP) return */  if (!(gSystemInfo.dwOSType & OS_NT))    return;  if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, key, 0, KEY_READ|KEY_WRITE, &hkResult) != ERROR_SUCCESS)    return;  dwErr = RegQueryValueEx(hkResult, name, 0, &dwType, NULL, &oldMaxValueLen);  if (dwErr != ERROR_SUCCESS || oldMaxValueLen == 0 || dwType != REG_MULTI_SZ)  {    /* no value, no data, or wrong type */    return;  }  multiStr = calloc(oldMaxValueLen, sizeof(BYTE));  if (!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.      lenToEnd = newMaxValueLen = oldMaxValueLen;      pName = multiStr;      while(*pName && lenToEnd > 0)      {          // find the locations and lengths of the current pair. Count the          // nulls,  we need to know how much data to skip or move          nameLen = strlen(pName) + 1;          pRename = pName + nameLen;          renameLen = strlen(pRename) + 1;          // How much remains beyond the current pair          lenToEnd -= (nameLen + renameLen);          if (*pRename == '\0')          {              // No new name, it's a delete. Is it the one we want?              if (StrStrI(pName, aPathToMatch))              {                  // It's a match--                  // delete this pair by moving the remainder on top                  memmove(pName, pRename + renameLen, lenToEnd);                  // update the total length to reflect the missing pair                  newMaxValueLen -= (nameLen + renameLen);                  // next pair is in place, continue w/out moving pName                  continue;              }          }          // on to the next pair          pName = pRename + renameLen;      }      if (newMaxValueLen != oldMaxValueLen)      {          // We've deleted something, save the changed data          RegSetValueEx(hkResult, name, 0, REG_MULTI_SZ, multiStr, newMaxValueLen);          RegFlushKey(hkResult);      }  }  RegCloseKey(hkResult);  free(multiStr);}