Index: /trunk/src/VBox/Additions/WINNT/tools/VBoxCertUtil.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/tools/VBoxCertUtil.cpp	(revision 67934)
+++ /trunk/src/VBox/Additions/WINNT/tools/VBoxCertUtil.cpp	(revision 67935)
@@ -29,4 +29,5 @@
 #include <iprt/initterm.h>
 #include <iprt/message.h>
+#include <iprt/path.h>
 #include <iprt/stream.h>
 #include <iprt/string.h>
@@ -390,7 +391,5 @@
         }
         else
-        {
             RTMsgError("Path not implemented at line %d\n",  __LINE__);
-        }
 
         CertCloseStore(hDstStore, CERT_CLOSE_STORE_CHECK_FLAG);
@@ -592,5 +591,5 @@
 {
     /*
-     * Parse arguments.
+     * Parse arguments and execute imports as we move along.
      */
     static const RTGETOPTDEF s_aOptions[] =
@@ -599,11 +598,10 @@
     };
 
-    const char *pszRootCert    = NULL;
-    const char *pszTrustedCert = NULL;
-
-    int             rc;
-    RTGETOPTUNION   ValueUnion;
-    RTGETOPTSTATE   GetState;
-    RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, 0);
+    RTEXITCODE          rcExit = RTEXITCODE_SUCCESS;
+    unsigned            cImports = 0;
+    RTGETOPTUNION       ValueUnion;
+    RTGETOPTSTATE       GetState;
+    int rc = RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, 0);
+    AssertRC(rc);
     while ((rc = RTGetOpt(&GetState, &ValueUnion)))
     {
@@ -619,18 +617,29 @@
 
             case 'r':
-                if (pszRootCert)
-                    return RTMsgErrorExit(RTEXITCODE_SUCCESS,
-                                          "You've already specified '%s' as root certificate.",
-                                          pszRootCert);
-                pszRootCert = ValueUnion.psz;
+            case VINF_GETOPT_NOT_OPTION:
+            {
+                const char * const  pszStoreNm   = rc == 'r' ? "Root" : "TrustedPublisher";
+                const char * const  pszStoreDesc = rc == 'r' ? "root" : "trusted publisher";
+                PCRTPATHGLOBENTRY   pResultHead;
+                rc = RTPathGlob(ValueUnion.psz, RTPATHGLOB_F_NO_DIRS, &pResultHead, NULL);
+                if (RT_SUCCESS(rc))
+                {
+                    for (PCRTPATHGLOBENTRY pCur = pResultHead; pCur; pCur = pCur->pNext)
+                    {
+                        if (addCertToStore(CERT_SYSTEM_STORE_LOCAL_MACHINE, pszStoreNm, pCur->szPath, CERT_STORE_ADD_NEW))
+                            RTMsgInfo("Successfully added '%s' as %s", pCur->szPath, pszStoreDesc);
+                        else
+                            rcExit = RTEXITCODE_FAILURE;
+                        cImports++;
+                    }
+                    RTPathGlobFree(pResultHead);
+                }
+                else
+                {
+                    rcExit = RTMsgErrorExit(RTEXITCODE_SUCCESS, "glob failed on '%s': %Rrc", ValueUnion.psz, rc);
+                    cImports++;
+                }
                 break;
-
-            case VINF_GETOPT_NOT_OPTION:
-                if (pszTrustedCert)
-                    return RTMsgErrorExit(RTEXITCODE_SUCCESS,
-                                          "You've already specified '%s' as trusted certificate.",
-                                          pszTrustedCert);
-                pszTrustedCert = ValueUnion.psz;
-                break;
+            }
 
             default:
@@ -638,26 +647,7 @@
         }
     }
-    if (!pszTrustedCert)
-        return RTMsgErrorExit(RTEXITCODE_SUCCESS, "No trusted certificate specified.");
-
-    /*
-     * Do the job.
-     */
-    /** @todo The root-cert part needs to be made more flexible. */
-    if (   pszRootCert
-        && !addCertToStore(CERT_SYSTEM_STORE_LOCAL_MACHINE, "Root", pszRootCert, CERT_STORE_ADD_NEW))
-        return RTEXITCODE_FAILURE;
-
-    if (!addCertToStore(CERT_SYSTEM_STORE_LOCAL_MACHINE, "TrustedPublisher", pszTrustedCert, CERT_STORE_ADD_NEW))
-        return RTEXITCODE_FAILURE;
-
-    if (g_cVerbosityLevel > 0)
-    {
-        if (pszRootCert)
-            RTMsgInfo("Successfully added '%s' as root and '%s' as trusted publisher", pszRootCert, pszTrustedCert);
-        else
-            RTMsgInfo("Successfully added '%s' as trusted publisher", pszTrustedCert);
-    }
-    return RTEXITCODE_SUCCESS;
+    if (cImports == 0)
+        return RTMsgErrorExit(RTEXITCODE_SUCCESS, "No trusted or root certificates specified.");
+    return rcExit;
 }
 
