Index: /trunk/src/VBox/Frontends/VBoxBalloonCtrl/VBoxModAPIMonitor.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxBalloonCtrl/VBoxModAPIMonitor.cpp	(revision 41286)
+++ /trunk/src/VBox/Frontends/VBoxBalloonCtrl/VBoxModAPIMonitor.cpp	(revision 41287)
@@ -37,7 +37,8 @@
 enum GETOPTDEF_APIMON
 {
-    GETOPTDEF_APIMON_ISLN_RESPONSE = 3000,
+    GETOPTDEF_APIMON_GROUPS = 3000,
+    GETOPTDEF_APIMON_ISLN_RESPONSE,
     GETOPTDEF_APIMON_ISLN_TIMEOUT,
-    GETOPTDEF_APIMON_GROUPS
+    GETOPTDEF_APIMON_TRIGGER_TIMEOUT
 };
 
@@ -46,7 +47,8 @@
  */
 static const RTGETOPTDEF g_aAPIMonitorOpts[] = {
-    { "--apimon-isln-response",  GETOPTDEF_APIMON_ISLN_RESPONSE,  RTGETOPT_REQ_STRING },
-    { "--apimon-isln-timeout",   GETOPTDEF_APIMON_ISLN_TIMEOUT,   RTGETOPT_REQ_UINT32 },
-    { "--apimon-groups",         GETOPTDEF_APIMON_GROUPS,         RTGETOPT_REQ_STRING }
+    { "--apimon-groups",            GETOPTDEF_APIMON_GROUPS,         RTGETOPT_REQ_STRING },
+    { "--apimon-isln-response",     GETOPTDEF_APIMON_ISLN_RESPONSE,  RTGETOPT_REQ_STRING },
+    { "--apimon-isln-timeout",      GETOPTDEF_APIMON_ISLN_TIMEOUT,   RTGETOPT_REQ_UINT32 },
+    { "--apimon-trigger-timeout",   GETOPTDEF_APIMON_ISLN_TIMEOUT,   RTGETOPT_REQ_UINT32 }
 };
 
@@ -69,4 +71,5 @@
 static unsigned long                g_ulAPIMonIslnTimeoutMS = 0;
 static Bstr                         g_strAPIMonIslnLastBeat;
+static unsigned long                g_ulAPIMonTriggerTimeoutMS = 0;
 static uint64_t                     g_uAPIMonIslnLastBeatMS = 0;
 
@@ -223,5 +226,4 @@
                         {
                             /* Check if we are already paused. */
-                            MachineState_T machineState;
                             CHECK_ERROR_BREAK(console, COMGETTER(State)(&machineState));
                             /* The error code was lost by the previous instruction. */
@@ -341,5 +343,5 @@
             {
                 int rc2 = apimonMachineControl(it->first /* Uuid */,
-                                               &it->second /* Machine */, enmResp, 30 * 1000 /* 30s timeout */);
+                                               &it->second /* Machine */, enmResp, g_ulAPIMonTriggerTimeoutMS);
                 if (RT_FAILURE(rc2))
                     serviceLog("apimon: Controlling machine \"%ls\" (action: %s) failed with rc=%Rrc",
@@ -390,16 +392,4 @@
         switch (c)
         {
-            case GETOPTDEF_APIMON_ISLN_RESPONSE:
-                rc = apimonResponseToEnum(ValueUnion.psz, &g_enmAPIMonIslnResp);
-                if (RT_FAILURE(rc))
-                    rc = -1; /* Option unknown. */
-                break;
-
-            case GETOPTDEF_APIMON_ISLN_TIMEOUT:
-                g_ulAPIMonIslnTimeoutMS = ValueUnion.u32;
-                if (g_ulAPIMonIslnTimeoutMS < 1000) /* Don't allow timeouts < 1s. */
-                    g_ulAPIMonIslnTimeoutMS = 1000;
-                break;
-
             case GETOPTDEF_APIMON_GROUPS:
             {
@@ -410,4 +400,22 @@
             }
 
+            case GETOPTDEF_APIMON_ISLN_RESPONSE:
+                rc = apimonResponseToEnum(ValueUnion.psz, &g_enmAPIMonIslnResp);
+                if (RT_FAILURE(rc))
+                    rc = -1; /* Option unknown. */
+                break;
+
+            case GETOPTDEF_APIMON_ISLN_TIMEOUT:
+                g_ulAPIMonIslnTimeoutMS = ValueUnion.u32;
+                if (g_ulAPIMonIslnTimeoutMS < 1000) /* Don't allow timeouts < 1s. */
+                    g_ulAPIMonIslnTimeoutMS = 1000;
+                break;
+
+            case GETOPTDEF_APIMON_TRIGGER_TIMEOUT:
+                g_ulAPIMonTriggerTimeoutMS = ValueUnion.u32;
+                if (g_ulAPIMonTriggerTimeoutMS < 5000) /* Don't allow timeouts < 5s. */
+                    g_ulAPIMonTriggerTimeoutMS = 5000;
+                break;
+
             default:
                 rc = -1; /* We don't handle this option, skip. */
@@ -426,20 +434,4 @@
     {
         Bstr strValue;
-
-        /* Host isolation timeout (in ms). */
-        if (!g_ulAPIMonIslnTimeoutMS) /* Not set by command line? */
-        {
-            CHECK_ERROR_BREAK(g_pVirtualBox, GetExtraData(Bstr("Watchdog/APIMonitor/IsolationTimeout").raw(),
-                                                          strValue.asOutParam()));
-            if (!strValue.isEmpty())
-                g_ulAPIMonIslnTimeoutMS = Utf8Str(strValue).toUInt32();
-        }
-        if (!g_ulAPIMonIslnTimeoutMS) /* Still not set? Use a default. */
-        {
-            serviceLogVerbose(("apimon: API monitor isolation timeout not given, defaulting to 30s\n"));
-
-            /* Default is 30 seconds timeout. */
-            g_ulAPIMonIslnTimeoutMS = 30 * 1000;
-        }
 
         /* VM groups to watch for. */
@@ -454,4 +446,20 @@
                     serviceLog("apimon: Warning: API monitor groups string invalid (%ls)\n", strValue.raw());
             }
+        }
+
+        /* Host isolation timeout (in ms). */
+        if (!g_ulAPIMonIslnTimeoutMS) /* Not set by command line? */
+        {
+            CHECK_ERROR_BREAK(g_pVirtualBox, GetExtraData(Bstr("Watchdog/APIMonitor/IsolationTimeout").raw(),
+                                                          strValue.asOutParam()));
+            if (!strValue.isEmpty())
+                g_ulAPIMonIslnTimeoutMS = Utf8Str(strValue).toUInt32();
+        }
+        if (!g_ulAPIMonIslnTimeoutMS) /* Still not set? Use a default. */
+        {
+            serviceLogVerbose(("apimon: API monitor isolation timeout not given, defaulting to 30s\n"));
+
+            /* Default is 30 seconds timeout. */
+            g_ulAPIMonIslnTimeoutMS = 30 * 1000;
         }
 
@@ -469,4 +477,21 @@
             }
         }
+
+        /* Trigger timeout (in ms). */
+        if (!g_ulAPIMonTriggerTimeoutMS) /* Not set by command line? */
+        {
+            CHECK_ERROR_BREAK(g_pVirtualBox, GetExtraData(Bstr("Watchdog/APIMonitor/TriggerTimeout").raw(),
+                                                          strValue.asOutParam()));
+            if (!strValue.isEmpty())
+                g_ulAPIMonTriggerTimeoutMS = Utf8Str(strValue).toUInt32();
+        }
+        if (!g_ulAPIMonTriggerTimeoutMS) /* Still not set? Use a default. */
+        {
+            serviceLogVerbose(("apimon: API monitor trigger timeout not given, defaulting to 30s\n"));
+
+            /* Default is 30 seconds timeout. */
+            g_ulAPIMonTriggerTimeoutMS = 30 * 1000;
+        }
+
     } while (0);
 
@@ -579,10 +604,13 @@
     0 /* Not used */,
     /* pszUsage. */
+    " [--apimon-groups=<string>]\n"
     " [--apimon-isln-response=<cmd>] [--apimon-isln-timeout=<ms>]\n"
-    " [--apimon-groups=<string>]\n",
+    " [--apimon-trigger-timeout=<ms>]",
     /* pszOptions. */
+    "--apimon-groups        Sets the VM groups for monitoring (none).\n"
     "--apimon-isln-response Sets the isolation response (shutdown VM).\n"
     "--apimon-isln-timeout  Sets the isolation timeout in ms (30s).\n"
-    "--apimon-groups        Sets the VM groups for monitoring (none).\n",
+    "--apimon-trigger-timeout\n"
+    "                       Sets the trigger timeout in ms (30s).\n",
     /* methods. */
     VBoxModAPIMonitorPreInit,
Index: /trunk/src/VBox/Frontends/VBoxBalloonCtrl/VBoxWatchdog.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VBoxBalloonCtrl/VBoxWatchdog.cpp	(revision 41286)
+++ /trunk/src/VBox/Frontends/VBoxBalloonCtrl/VBoxWatchdog.cpp	(revision 41287)
@@ -399,5 +399,5 @@
             if (g_aModules[j].fEnabled)
             {
-                int rc2 = g_aModules[j].pDesc->pfnOnMachineRegistered(strUuid);
+                rc2 = g_aModules[j].pDesc->pfnOnMachineRegistered(strUuid);
                 if (RT_FAILURE(rc2))
                     serviceLog("OnMachineRegistered: Module '%s' reported an error: %Rrc\n",
@@ -1087,5 +1087,4 @@
         if (RT_FAILURE(rc))
             return RTMsgErrorExit(RTEXITCODE_FAILURE, "failed to open release log (%s, %Rrc)", szError, rc);
-        AssertPtr(pLoggerReleaseFile);
     }
 #endif
