Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.cpp	(revision 71088)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.cpp	(revision 71089)
@@ -38,6 +38,9 @@
 # include "CExtraDataChangedEvent.h"
 # include "CGuestMonitorChangedEvent.h"
-#include  "CGuestProcessRegisteredEvent.h"
+# include "CGuestProcessIOEvent.h"
+# include "CGuestProcessRegisteredEvent.h"
 # include "CGuestSessionRegisteredEvent.h"
+# include "CGuestProcessStateChangedEvent.h"
+# include "CGuestSessionStateChangedEvent.h"
 # include "CKeyboardLedsChangedEvent.h"
 # include "CMachineStateChangedEvent.h"
@@ -450,14 +453,21 @@
         case KVBoxEventType_OnGuestSessionStateChanged:
         {
-            emit sigGuestSessionStatedChanged();
-            break;
-        }
-        case KVBoxEventType_OnGuestProcessStateChanged:
+            CGuestSessionStateChangedEvent cEvent(pEvent);
+            emit sigGuestSessionStatedChanged(cEvent);
+            break;
+        }
         case KVBoxEventType_OnGuestProcessInputNotify:
         case KVBoxEventType_OnGuestProcessOutput:
         {
-            emit sigGuestProcessStateChanged();
-            break;
-        }
+            break;
+        }
+        case KVBoxEventType_OnGuestProcessStateChanged:
+        {
+            CGuestProcessStateChangedEvent cEvent(pEvent);
+            cEvent.GetError();
+            emit sigGuestProcessStateChanged(cEvent);
+            break;
+        }
+
         case KVBoxEventType_OnGuestFileRegistered:
         case KVBoxEventType_OnGuestFileStateChanged:
Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.h	(revision 71088)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.h	(revision 71089)
@@ -39,6 +39,6 @@
 class CEventListener;
 class CEventSource;
-
-
+class CGuestProcessStateChangedEvent;
+class CGuestSessionStateChangedEvent;
 
 /* Note: On a first look this may seems a little bit complicated.
@@ -142,6 +142,6 @@
         void sigGuestProcessRegistered(CGuestProcess guestProcess);
         void sigGuestProcessUnregistered(CGuestProcess guestProcess);
-        void sigGuestSessionStatedChanged();
-        void sigGuestProcessStateChanged();
+        void sigGuestSessionStatedChanged(const CGuestSessionStateChangedEvent &cEvent);
+        void sigGuestProcessStateChanged(const CGuestProcessStateChangedEvent &cEvent);
     /** @} */
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlConsole.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlConsole.cpp	(revision 71088)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlConsole.cpp	(revision 71089)
@@ -76,5 +76,5 @@
         startNextLine();
     }
-}
+ }
 
 void UIGuestControlConsole::keyPressEvent(QKeyEvent *pEvent)
@@ -139,5 +139,5 @@
         default:
         {
-            if(pEvent->modifiers() == Qt::ControlModifier && pEvent->key() == Qt::Key_C)
+            if (pEvent->modifiers() == Qt::ControlModifier && pEvent->key() == Qt::Key_C)
             {
                 QPlainTextEdit::keyPressEvent(pEvent);
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlInterface.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlInterface.cpp	(revision 71088)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlInterface.cpp	(revision 71089)
@@ -21,4 +21,5 @@
 
 /* GUI includes: */
+# include "UIErrorString.h"
 # include "UIGuestControlInterface.h"
 # include "VBoxGlobal.h"
@@ -38,4 +39,10 @@
 #define GCTLCMD_COMMON_OPT_SESSION_NAME     995 /**< The --sessionname option number. */
 #define GCTLCMD_COMMON_OPT_SESSION_ID       994 /**< The --sessionid option number. */
+
+#define RETURN_ERROR(strError)     \
+    {                              \
+    m_strStatus.append(strError);  \
+    return false;                  \
+    }
 
 #define GCTLCMD_COMMON_OPTION_DEFS() \
@@ -95,13 +102,17 @@
     CommandData()
         : m_bSessionIdGiven(false)
-        , m_bSessionNameGiven(false){}
+        , m_bSessionNameGiven(false)
+        , m_bCreateParentDirectories(false){}
     QString m_strUserName;
     QString m_strPassword;
     QString m_strExePath;
     QString m_strSessionName;
+    QString m_strDirectoryPath;
     ULONG   m_uSessionId;
     QString m_strDomain;
     bool    m_bSessionIdGiven;
     bool    m_bSessionNameGiven;
+    /* Create the whole path during mkdir */
+    bool    m_bCreateParentDirectories;
     QVector<QString> m_arguments;
     QVector<QString> m_environmentChanges;
@@ -121,5 +132,5 @@
                 "createsession                      [common-options]  [--sessionname <name>]\n"
                 "mkdir                           [common-options]\n"
-                "                                   [--path <path>]\n"
+                "                                   [-P|--parents] [<guest directory>\n"
                 "                                   [--sessionid <id> |  [sessionname <name>]]\n"
                 )
@@ -128,6 +139,71 @@
 }
 
-bool UIGuestControlInterface::handleMkdir(int, char**)
-{
+bool UIGuestControlInterface::handleMkdir(int argc , char** argv)
+{
+
+    CommandData commandData;
+
+    static const RTGETOPTDEF s_aOptions[] =
+    {
+        GCTLCMD_COMMON_OPTION_DEFS()
+        { "--sessionname",                  GCTLCMD_COMMON_OPT_SESSION_NAME,          RTGETOPT_REQ_STRING  },
+        { "--sessionid",                    GCTLCMD_COMMON_OPT_SESSION_ID,            RTGETOPT_REQ_UINT32  },
+        { "--parents",                      'P',                                      RTGETOPT_REQ_NOTHING  }
+    };
+
+    int ch;
+    bool pathFound = false;
+    RTGETOPTUNION ValueUnion;
+    RTGETOPTSTATE GetState;
+    RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1 /* ignore 0th element (command) */, 0);
+    while ((ch = RTGetOpt(&GetState, &ValueUnion)))
+    {
+        switch (ch)
+        {
+            HANDLE_COMMON_OPTION_DEFS()
+            case GCTLCMD_COMMON_OPT_SESSION_NAME:
+                commandData.m_bSessionNameGiven = true;
+                commandData.m_strSessionName  = ValueUnion.psz;
+                break;
+            case GCTLCMD_COMMON_OPT_SESSION_ID:
+                commandData.m_bSessionIdGiven = true;
+                commandData.m_uSessionId  = ValueUnion.i32;
+                break;
+            case 'P':
+                commandData.m_bCreateParentDirectories  = true;
+                break;
+            case VINF_GETOPT_NOT_OPTION:
+                if (!pathFound)
+                {
+                    commandData.m_strDirectoryPath = ValueUnion.psz;
+                    pathFound = true;
+                }
+                /* Allow only a single NOT_OPTION */
+                else
+                    RETURN_ERROR(generateErrorString(ch, ValueUnion))
+
+                break;
+            default:
+                RETURN_ERROR(generateErrorString(ch, ValueUnion))
+        }
+    }
+    if (commandData.m_strDirectoryPath.isEmpty())
+        RETURN_ERROR(QString(m_strHelp).append("Syntax error! No path is given\n"));
+
+    CGuestSession guestSession;
+    if (!findOrCreateSession(commandData, guestSession) || !guestSession.isOk())
+        return false;
+
+
+    //const QString &strErr = comProgressInstall.GetErrorInfo().GetText();
+    QVector<KDirectoryCreateFlag> creationFlags;
+    if (commandData.m_bCreateParentDirectories)
+        creationFlags.push_back(KDirectoryCreateFlag_None);
+    else
+        creationFlags.push_back(KDirectoryCreateFlag_Parents);
+
+    guestSession.DirectoryCreate(commandData.m_strDirectoryPath, 0 /*ULONG aMode*/, creationFlags);
+
+    //startProcess(commandData, guestSession);
     return true;
 }
@@ -149,5 +225,4 @@
 
     CommandData commandData;
-    //parseCommonOptions(argc, argv, commandData);
 
     static const RTGETOPTDEF s_aOptions[] =
@@ -186,36 +261,32 @@
                 break;
             default:
-            {
-                emit sigOutputString(generateErrorString(ch, ValueUnion));
-                return false;
-            }
+                RETURN_ERROR(generateErrorString(ch, ValueUnion))
         }
     }
     if (commandData.m_strExePath.isEmpty())
-    {
-        emit sigOutputString(QString(m_strHelp).append("Syntax error! No executable is given\n"));
-        return false;
-    }
-
+        RETURN_ERROR(QString(m_strHelp).append("Syntax error! No executable is given\n"))
+
+    CGuestSession guestSession;
+    if (!findOrCreateSession(commandData, guestSession) || !guestSession.isOk())
+        return false;
+    startProcess(commandData, guestSession);
+    return true;
+}
+
+bool UIGuestControlInterface::findOrCreateSession(const CommandData &commandData, CGuestSession &outGuestSession)
+{
     if (commandData.m_bSessionNameGiven && commandData.m_strSessionName.isEmpty())
-    {
-        emit sigOutputString(QString(m_strHelp).append("'Session Name' is not name valid\n"));
-        return false;
-    }
-
-    CGuestSession guestSession;
+        RETURN_ERROR(QString(m_strHelp).append("'Session Name' is not name valid\n"))
+
     /* Check if sessionname and sessionid are both supplied */
     if (commandData.m_bSessionIdGiven && commandData.m_bSessionNameGiven)
-    {
-        emit sigOutputString(QString(m_strHelp).append("Both 'Session Name' and 'Session Id' are supplied\n"));
-        return false;
-    }
+        RETURN_ERROR(QString(m_strHelp).append("Both 'Session Name' and 'Session Id' are supplied\n"))
+
     /* If sessionid is given then look for the session. if not found return without starting the process: */
     else if (commandData.m_bSessionIdGiven && !commandData.m_bSessionNameGiven)
     {
-        if (!findSession(commandData.m_uSessionId, guestSession))
-        {
-            emit sigOutputString(QString(m_strHelp).append("No session with id %1 found.\n").arg(commandData.m_uSessionId));
-            return false;
+        if (!findSession(commandData.m_uSessionId, outGuestSession))
+        {
+            RETURN_ERROR(QString(m_strHelp).append("No session with id %1 found.\n").arg(commandData.m_uSessionId))
         }
     }
@@ -223,11 +294,8 @@
     else if (!commandData.m_bSessionIdGiven && commandData.m_bSessionNameGiven)
     {
-        if (!findSession(commandData.m_strSessionName, guestSession))
-        {
-            if (!createSession(commandData, guestSession))
-            {
-                emit sigOutputString(QString("Guest session could not be created"));
+        if (!findSession(commandData.m_strSessionName, outGuestSession))
+        {
+            if (!createSession(commandData, outGuestSession))
                 return false;
-            }
         }
     }
@@ -235,14 +303,7 @@
     else
     {
-        if (!createSession(commandData, guestSession))
-        {
-            emit sigOutputString(QString("Guest session could not be created"));
+        if (!createSession(commandData, outGuestSession))
             return false;
-        }
-
-    }
-    if (!guestSession.isOk())
-        return false;
-    startProcess(commandData, guestSession);
+    }
     return true;
 }
@@ -277,6 +338,5 @@
                 if (commandData.m_strSessionName.isEmpty())
                 {
-                    emit sigOutputString(QString("'Session Name' is not name valid\n").append(m_strHelp));
-                    return false;
+                    RETURN_ERROR(QString("'Session Name' is not name valid\n").append(m_strHelp))
                 }
                 break;
@@ -325,5 +385,5 @@
     QByteArray array = strCommand.toLocal8Bit();
     RTGetOptArgvFromString(&argv, &argc, array.data(), RTGETOPTARGV_CNV_QUOTE_BOURNE_SH, 0);
-
+    m_strStatus.clear();
     static const RTGETOPTDEF s_aOptions[] =
     {
@@ -351,4 +411,6 @@
                          (this->*(iterator.value()))(argc, argv);
                          RTGetOptArgvFree(argv);
+                         if (!m_strStatus.isEmpty())
+                             emit sigOutputString(m_strStatus);
                          return;
                      }
@@ -365,5 +427,7 @@
                  break;
          }
-     }
+    }
+    if (!m_strStatus.isEmpty())
+        emit sigOutputString(m_strStatus);
 
     RTGetOptArgvFree(argv);
@@ -406,17 +470,14 @@
                                                           commandData.m_strDomain,
                                                           commandData.m_strSessionName);
+
     if (!guestSession.isOk())
-    {
-        emit sigOutputString(QString("Guest session could not be created"));
-        return false;
-    }
+        return false;
+
     /* Wait session to start: */
     const ULONG waitTimeout = 2000;
     KGuestSessionWaitResult waitResult = guestSession.WaitFor(KGuestSessionWaitForFlag_Start, waitTimeout);
     if (waitResult != KGuestSessionWaitResult_Start)
-    {
-        emit sigOutputString("Guest Session has not started yet");
-        return false;
-    }
+        return false;
+
     outSession = guestSession;
     return true;
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlInterface.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlInterface.h	(revision 71088)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlInterface.h	(revision 71089)
@@ -56,4 +56,7 @@
     typedef bool (UIGuestControlInterface::*HandleFuncPtr)(int, char**);
 
+    /** findOrCreateSession parses command options and determines if an existing session
+        to be returned or a new one to be created */
+    bool findOrCreateSession(const CommandData &commandData, CGuestSession &guestSession);
     bool findSession(const QString& strSessionName, CGuestSession& outSession);
     bool findSession(ULONG strSessionId, CGuestSession& outSession);
@@ -62,4 +65,5 @@
     void prepareSubCommandHandlers();
     bool startProcess(const CommandData &commandData, CGuestSession &guestSession);
+    bool createDirectory(const CommandData &commandData, CGuestSession &guestSession);
 
     /* Handles the 'start' process command */
@@ -74,4 +78,5 @@
     CGuest        m_comGuest;
     const QString m_strHelp;
+    QString  m_strStatus;
     /* A map of function pointers to handleXXXX functions */
     QMap<QString, HandleFuncPtr> m_subCommandHandlers;
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlTreeItem.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlTreeItem.cpp	(revision 71088)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlTreeItem.cpp	(revision 71089)
@@ -28,4 +28,6 @@
 # include "CGuest.h"
 # include "CEventSource.h"
+# include "CGuestProcessStateChangedEvent.h"
+# include "CGuestSessionStateChangedEvent.h"
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
@@ -250,6 +252,14 @@
 }
 
-void UIGuestSessionTreeItem::sltGuestSessionUpdated()
-{
+void UIGuestSessionTreeItem::sltGuestSessionUpdated(const CGuestSessionStateChangedEvent& cEvent)
+{
+    if (cEvent.isOk() && m_comGuestSession.isOk() && m_comGuestSession.GetStatus() == KGuestSessionStatus_Error)
+    {
+        CVirtualBoxErrorInfo cErrorInfo = cEvent.GetError();
+        if (cErrorInfo.isOk() && cErrorInfo.GetResultCode() != S_OK)
+        {
+            emit sigGuestSessionErrorText(cErrorInfo.GetText());
+        }
+    }
     setColumnText();
     emit sigGuessSessionUpdated();
@@ -271,5 +281,12 @@
         << QString("Process Status: %1").arg(processStatusString(guestProcess.GetStatus()));
 
-    /*UIGuestProcessTreeItem *newItem = */new UIGuestProcessTreeItem(this, guestProcess, strList);
+    UIGuestProcessTreeItem *newItem = new UIGuestProcessTreeItem(this, guestProcess, strList);
+    connect(newItem, &UIGuestProcessTreeItem::sigGuestProcessErrorText,
+            this, &UIGuestSessionTreeItem::sigGuestSessionErrorText);
+}
+
+void UIGuestSessionTreeItem::errorString(QString strError)
+{
+    emit sigGuestSessionErrorText(strError);
 }
 
@@ -342,6 +359,21 @@
 }
 
-void UIGuestProcessTreeItem::sltGuestProcessUpdated()
-{
+void UIGuestProcessTreeItem::sltGuestProcessUpdated(const CGuestProcessStateChangedEvent &cEvent)
+{
+    if (cEvent.isOk() && m_comGuestProcess.isOk() && m_comGuestProcess.GetStatus() == KProcessStatus_Error)
+    {
+        CVirtualBoxErrorInfo cErrorInfo = cEvent.GetError();
+        if (cErrorInfo.isOk() && cErrorInfo.GetResultCode() != S_OK)
+        {
+            /* For some reason I am yet to find this emit is not working.
+               Thus we are calling the parent's function directly: */
+            //emit sigGuestProcessErrorText(cErrorInfo.GetText());
+            UIGuestSessionTreeItem *sessionParent = dynamic_cast<UIGuestSessionTreeItem*>(QTreeWidgetItem::parent());
+            if (sessionParent)
+            {
+                sessionParent->errorString(cErrorInfo.GetText().toStdString().c_str());
+            }
+        }
+    }
     setColumnText();
 }
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlTreeItem.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlTreeItem.h	(revision 71088)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlTreeItem.h	(revision 71089)
@@ -29,4 +29,6 @@
 /* Forward declarations: */
 class CEventSource;
+class CGuestProcessStateChangedEvent;
+class CGuestSessionStateChangedEvent;
 
 /** QITreeWidgetItem extension serving as a base class
@@ -37,10 +39,5 @@
     Q_OBJECT;
 
-signals:
-
-    void sigGuessSessionUpdated();
-
 public:
-
 
     UIGuestControlTreeItem(QITreeWidget *pTreeWidget, const QStringList &strings = QStringList());
@@ -76,4 +73,9 @@
     Q_OBJECT;
 
+signals:
+
+    void sigGuessSessionUpdated();
+    void sigGuestSessionErrorText(QString strError);
+
 public:
 
@@ -82,4 +84,5 @@
     virtual ~UIGuestSessionTreeItem();
     const CGuestSession& guestSession() const;
+    void errorString(QString strError);
 
 protected:
@@ -90,7 +93,8 @@
 private slots:
 
-    void sltGuestSessionUpdated();
+    void sltGuestSessionUpdated(const CGuestSessionStateChangedEvent& cEvent);
     void sltGuestProcessRegistered(CGuestProcess guestProcess);
     void sltGuestProcessUnregistered(CGuestProcess guestProcess);
+
 
 private:
@@ -112,4 +116,8 @@
     Q_OBJECT;
 
+signals:
+
+    void sigGuestProcessErrorText(QString strError);
+
 public:
 
@@ -127,5 +135,5 @@
 private slots:
 
-    void sltGuestProcessUpdated();
+    void sltGuestProcessUpdated(const CGuestProcessStateChangedEvent &cEvent);
 
 private:
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIInformationGuestSession.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIInformationGuestSession.cpp	(revision 71088)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIInformationGuestSession.cpp	(revision 71089)
@@ -378,4 +378,14 @@
     connect(sessionTreeItem, &UIGuestSessionTreeItem::sigGuessSessionUpdated,
             this, &UIInformationGuestSession::sltTreeItemUpdated);
+    connect(sessionTreeItem, &UIGuestSessionTreeItem::sigGuestSessionErrorText,
+            this, &UIInformationGuestSession::sltGuestControlErrorText);
+}
+
+void UIInformationGuestSession::sltGuestControlErrorText(QString strError)
+{
+    if (m_pConsole)
+    {
+        m_pConsole->putOutput(strError);
+    }
 }
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIInformationGuestSession.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIInformationGuestSession.h	(revision 71088)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIInformationGuestSession.h	(revision 71089)
@@ -57,4 +57,5 @@
     void sltGuestSessionRegistered(CGuestSession guestSession);
     void sltGuestSessionUnregistered(CGuestSession guestSession);
+    void sltGuestControlErrorText(QString strError);
 
     void sltTreeItemUpdated();
