Index: /trunk/src/VBox/Main/src-helper-apps/VBoxExtPackHelperApp.cpp
===================================================================
--- /trunk/src/VBox/Main/src-helper-apps/VBoxExtPackHelperApp.cpp	(revision 82551)
+++ /trunk/src/VBox/Main/src-helper-apps/VBoxExtPackHelperApp.cpp	(revision 82552)
@@ -37,4 +37,5 @@
 #include <iprt/string.h>
 #include <iprt/stream.h>
+#include <iprt/thread.h>
 #include <iprt/utf16.h>
 #include <iprt/vfs.h>
@@ -221,4 +222,26 @@
 
 /**
+ * Wrapper around RTDirRename that may retry the operation for up to 15 seconds
+ * on windows to deal with AV software.
+ */
+static int CommonDirRenameWrapper(const char *pszSrc, const char *pszDst, uint32_t fFlags)
+{
+#ifdef RT_OS_WINDOWS
+    uint64_t nsNow = RTTimeNanoTS();
+    for (;;)
+    {
+        int rc = RTDirRename(pszSrc, pszDst, fFlags);
+        if (   (   rc == VERR_ACCESS_DENIED
+                || rc == VERR_SHARING_VIOLATION)
+            && RTTimeNanoTS() - nsNow < RT_NS_15SEC)
+            return rc;
+        RTThreadSleep(128);
+    }
+#else
+    return RTDirRename(pszSrc, pszDst, fFlags);
+#endif
+}
+
+/**
  * Common uninstall worker used by both uninstall and install --replace.
  *
@@ -237,5 +260,5 @@
         return RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to construct temporary extension pack path: %Rrc", rc);
 
-    rc = RTDirRename(pszExtPackDir, szExtPackUnInstDir, RTPATHRENAME_FLAGS_NO_REPLACE);
+    rc = CommonDirRenameWrapper(pszExtPackDir, szExtPackUnInstDir, RTPATHRENAME_FLAGS_NO_REPLACE);
     if (rc == VERR_ALREADY_EXISTS)
     {
@@ -245,5 +268,5 @@
            installation directory.) */
         RemoveExtPackDir(szExtPackUnInstDir, false /*fTemporary*/);
-        rc = RTDirRename(pszExtPackDir, szExtPackUnInstDir, RTPATHRENAME_FLAGS_NO_REPLACE);
+        rc = CommonDirRenameWrapper(pszExtPackDir, szExtPackUnInstDir, RTPATHRENAME_FLAGS_NO_REPLACE);
     }
     if (RT_FAILURE(rc))
@@ -752,5 +775,5 @@
     if (rcExit == RTEXITCODE_SUCCESS)
     {
-        rc = RTDirRename(szTmpPath, szFinalPath, RTPATHRENAME_FLAGS_NO_REPLACE);
+        rc = CommonDirRenameWrapper(szTmpPath, szFinalPath, RTPATHRENAME_FLAGS_NO_REPLACE);
         if (   RT_FAILURE(rc)
             && fReplace
@@ -760,5 +783,5 @@
             rcExit = CommonUninstallWorker(szFinalPath);
             if (rcExit == RTEXITCODE_SUCCESS)
-                rc = RTDirRename(szTmpPath, szFinalPath, RTPATHRENAME_FLAGS_NO_REPLACE);
+                rc = CommonDirRenameWrapper(szTmpPath, szFinalPath, RTPATHRENAME_FLAGS_NO_REPLACE);
         }
         if (RT_SUCCESS(rc))
