Index: /trunk/src/VBox/Main/idl/VirtualBox.xidl
===================================================================
--- /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 42524)
+++ /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 42525)
@@ -9245,5 +9245,5 @@
   <interface
     name="IGuestSession" extends="$unknown"
-    uuid="47a344ec-8495-49ad-bfab-8cd0ff8eb3cf"
+    uuid="89f39320-d86c-4705-a376-d083f3c5c4e3"
     wsmap="managed"
     >
@@ -9372,5 +9372,5 @@
     </method>
     
-    <method name="DirectoryCreate">
+    <method name="directoryCreate">
       <desc>
         TODO
@@ -9386,5 +9386,5 @@
         <desc>TODO</desc>
       </param>
-      <param name="flags" type="unsigned long" dir="in">
+      <param name="flags" type="DirectoryCreateFlag" dir="in" safearray="yes">
         <desc>TODO</desc>
       </param>
Index: /trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h
===================================================================
--- /trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h	(revision 42524)
+++ /trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h	(revision 42525)
@@ -268,4 +268,7 @@
 struct GuestProcessInfo
 {
+    /** The process' friendly name. */
+    Utf8Str                     mName;
+    /** The actual command to execute. */
     Utf8Str                     mCommand;
     ProcessArguments            mArguments;
@@ -275,4 +278,5 @@
     ProcessPriority_T           mPriority;
     ProcessAffinity             mAffinity;
+
 };
 
Index: /trunk/src/VBox/Main/include/GuestDirectoryImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/GuestDirectoryImpl.h	(revision 42524)
+++ /trunk/src/VBox/Main/include/GuestDirectoryImpl.h	(revision 42525)
@@ -22,4 +22,6 @@
 #include "VirtualBoxBase.h"
 
+class GuestSession;
+
 /**
  * TODO
@@ -41,5 +43,5 @@
     DECLARE_EMPTY_CTOR_DTOR(GuestDirectory)
 
-    HRESULT init(void);
+    int     init(GuestSession *aSession, const Utf8Str &strPath);
     void    uninit(void);
     HRESULT FinalConstruct(void);
@@ -51,5 +53,5 @@
     STDMETHOD(COMGETTER(DirectoryName))(BSTR *aName);
 
-    STDMETHOD(Read)(IGuestFsObjInfo **aInfo);
+    STDMETHOD(Read)(IFsObjInfo **aInfo);
     /** @}  */
 
@@ -63,4 +65,5 @@
     struct Data
     {
+        GuestSession           *mParent;
         Utf8Str                 mName;
         ComPtr<IGuestFsObjInfo> mFsObjInfo;
Index: /trunk/src/VBox/Main/include/GuestProcessImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/GuestProcessImpl.h	(revision 42524)
+++ /trunk/src/VBox/Main/include/GuestProcessImpl.h	(revision 42525)
@@ -116,6 +116,4 @@
         /** All related callbacks to this process. */
         GuestCtrlCallbacks       mCallbacks;
-        /** The process' name. */
-        Utf8Str                  mName;
         /** The process start information. */
         GuestProcessInfo         mProcess;
Index: /trunk/src/VBox/Main/include/GuestSessionImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/GuestSessionImpl.h	(revision 42524)
+++ /trunk/src/VBox/Main/include/GuestSessionImpl.h	(revision 42525)
@@ -73,5 +73,5 @@
     STDMETHOD(CopyFrom)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(ULONG, aFlags), IProgress **aProgress);
     STDMETHOD(CopyTo)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(ULONG, aFlags), IProgress **aProgress);
-    STDMETHOD(DirectoryCreate)(IN_BSTR aPath, ULONG aMode, ULONG aFlags, IGuestDirectory **aDirectory);
+    STDMETHOD(DirectoryCreate)(IN_BSTR aPath, ULONG aMode, ComSafeArrayIn(DirectoryCreateFlag_T, aFlags), IGuestDirectory **aDirectory);
     STDMETHOD(DirectoryCreateTemp)(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aName, IGuestDirectory **aDirectory);
     STDMETHOD(DirectoryExists)(IN_BSTR aPath, BOOL *aExists);
@@ -124,4 +124,5 @@
      * @{ */
     int                     directoryClose(ComObjPtr<GuestDirectory> pDirectory);
+    int                     directoryCreateInternal(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, ComObjPtr<GuestDirectory> &pDirectory);
     int                     dispatchToProcess(uint32_t uContextID, uint32_t uFunction, void *pvData, size_t cbData);
     int                     fileClose(ComObjPtr<GuestFile> pFile);
Index: /trunk/src/VBox/Main/src-client/GuestDirectoryImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/GuestDirectoryImpl.cpp	(revision 42524)
+++ /trunk/src/VBox/Main/src-client/GuestDirectoryImpl.cpp	(revision 42525)
@@ -52,5 +52,5 @@
 /////////////////////////////////////////////////////////////////////////////
 
-HRESULT GuestDirectory::init(void)
+int GuestDirectory::init(GuestSession *aSession, const Utf8Str &strPath)
 {
     /* Enclose the state transition NotReady->InInit->Ready. */
@@ -58,8 +58,11 @@
     AssertReturn(autoInitSpan.isOk(), E_FAIL);
 
+    mData.mParent = aSession;
+    mData.mName = strPath;
+
     /* Confirm a successful initialization when it's the case. */
     autoInitSpan.setSucceeded();
 
-    return S_OK;
+    return VINF_SUCCESS;
 }
 
@@ -100,5 +103,5 @@
 /////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP GuestDirectory::Read(IGuestFsObjInfo **aInfo)
+STDMETHODIMP GuestDirectory::Read(IFsObjInfo **aInfo)
 {
 #ifndef VBOX_WITH_GUEST_CONTROL
Index: /trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp	(revision 42524)
+++ /trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp	(revision 42525)
@@ -266,5 +266,5 @@
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData.mName.cloneTo(aName);
+    mData.mProcess.mName.cloneTo(aName);
 
     LogFlowFuncLeaveRC(S_OK);
Index: /trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp	(revision 42524)
+++ /trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp	(revision 42525)
@@ -378,4 +378,84 @@
 }
 
+int GuestSession::directoryCreateInternal(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, ComObjPtr<GuestDirectory> &pDirectory)
+{
+    LogFlowThisFunc(("strPath=%s, uMode=%x, uFlags=%x\n",
+                     strPath.c_str(), uMode, uFlags));
+
+    GuestProcessInfo procInfo;
+    procInfo.mName    = Utf8StrFmt(tr("Creating directory \"%s\"", strPath.c_str()));
+    procInfo.mCommand = Utf8Str(VBOXSERVICE_TOOL_MKDIR);
+
+    int rc = VINF_SUCCESS;
+
+    /* Construct arguments. */
+    if (uFlags & DirectoryCreateFlag_Parents)
+        procInfo.mArguments.push_back(Utf8Str("--parents")); /* We also want to create the parent directories. */
+    if (uMode)
+    {
+        procInfo.mArguments.push_back(Utf8Str("--mode")); /* Set the creation mode. */
+
+        char szMode[16];
+        if (RTStrPrintf(szMode, sizeof(szMode), "%o", uMode))
+        {
+            procInfo.mArguments.push_back(Utf8Str(szMode));
+        }
+        else
+            rc = VERR_INVALID_PARAMETER;
+    }
+    procInfo.mArguments.push_back(strPath); /* The directory we want to create. */
+
+    ComObjPtr<GuestProcess> pProcess;
+    rc = processCreateExInteral(procInfo, pProcess);
+    if (RT_SUCCESS(rc))
+    {
+        GuestProcessWaitResult waitRes;
+        rc = pProcess->waitFor(ProcessWaitForFlag_Terminate, 30 * 1000 /* Timeout */, waitRes);
+        if (RT_SUCCESS(rc))
+        {
+            ProcessStatus_T procStatus;
+            HRESULT hr = pProcess->COMGETTER(Status)(&procStatus);
+            ComAssertComRC(hr);
+            if (procStatus == ProcessStatus_TerminatedNormally)
+            {
+                LONG lExitCode;
+                pProcess->COMGETTER(ExitCode)(&lExitCode);
+                if (lExitCode != 0)
+                    return VERR_CANT_CREATE;
+            }
+            else
+                rc = VERR_BROKEN_PIPE; /** @todo Find a better rc. */
+        }
+    }
+
+    if (RT_FAILURE(rc))
+        return rc;
+
+    try
+    {
+        /* Create the directory object. */
+        HRESULT hr = pDirectory.createObject();
+        if (FAILED(hr)) throw VERR_COM_UNEXPECTED;
+
+        /* Note: There will be a race between creating and getting/initing the directory
+                 object here. */
+        rc = pDirectory->init(this /* Parent */, strPath);
+        if (RT_FAILURE(rc)) throw rc;
+
+        /* Add the created directory to our vector. */
+        mData.mDirectories.push_back(pDirectory);
+
+        LogFlowFunc(("Added new directory (Session: %RU32) with process ID=%RU32\n",
+                     mData.mId, mData.mNextProcessID));
+    }
+    catch (int rc2)
+    {
+        rc = rc2;
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
 int GuestSession::dispatchToProcess(uint32_t uContextID, uint32_t uFunction, void *pvData, size_t cbData)
 {
@@ -504,5 +584,5 @@
             break; /* Don't try too hard. */
     }
-    if (RT_FAILURE(rc)) throw rc;
+    if (RT_FAILURE(rc)) return rc;
 
     try
@@ -643,15 +723,71 @@
 }
 
-STDMETHODIMP GuestSession::DirectoryCreate(IN_BSTR aPath, ULONG aMode, ULONG aFlags, IGuestDirectory **aProgress)
-{
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    LogFlowThisFuncEnter();
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    ReturnComNotImplemented();
+STDMETHODIMP GuestSession::DirectoryCreate(IN_BSTR aPath, ULONG aMode,
+                                           ComSafeArrayIn(DirectoryCreateFlag_T, aFlags), IGuestDirectory **aDirectory)
+{
+#ifndef VBOX_WITH_GUEST_CONTROL
+    ReturnComNotImplemented();
+#else
+    LogFlowThisFuncEnter();
+
+    if (RT_UNLIKELY((aPath) == NULL || *(aPath) == '\0'))
+        return setError(E_INVALIDARG, tr("No directory to create specified"));
+    /* aDirectory is optional. */
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    uint32_t fFlags = DirectoryCreateFlag_None;
+    if (aFlags)
+    {
+        com::SafeArray<DirectoryCreateFlag_T> flags(ComSafeArrayInArg(aFlags));
+        for (size_t i = 0; i < flags.size(); i++)
+            fFlags |= flags[i];
+
+        if (!(fFlags & DirectoryCreateFlag_Parents))
+            return setError(E_INVALIDARG, tr("Unknown flags (%#x)"), fFlags);
+    }
+
+    HRESULT hr = S_OK;
+
+    ComObjPtr <GuestDirectory> pDirectory;
+    int rc = directoryCreateInternal(Utf8Str(aPath), (uint32_t)aMode, (uint32_t)aFlags, pDirectory);
+    if (RT_SUCCESS(rc))
+    {
+        if (aDirectory)
+        {
+            /* Return directory object to the caller. */
+            hr = pDirectory.queryInterfaceTo(aDirectory);
+        }
+        else
+        {
+            rc = directoryClose(pDirectory);
+            if (RT_FAILURE(rc))
+                hr = setError(VBOX_E_IPRT_ERROR, tr("Unable to close directory object, rc=%Rrc"), rc);
+        }
+    }
+    else
+    {
+        switch (rc)
+        {
+            case VERR_INVALID_PARAMETER:
+               hr = setError(VBOX_E_IPRT_ERROR, tr("Directory creation failed: Invalid parameters given"));
+               break;
+
+            case VERR_BROKEN_PIPE:
+               hr = setError(VBOX_E_IPRT_ERROR, tr("Directory creation failed: Unexpectedly aborted"));
+               break;
+
+            case VERR_CANT_CREATE:
+               hr = setError(VBOX_E_IPRT_ERROR, tr("Directory creation failed: Could not create directory"));
+               break;
+
+            default:
+               hr = setError(VBOX_E_IPRT_ERROR, tr("Directory creation failed: %Rrc"), rc);
+               break;
+        }
+    }
+
+    return hr;
 #endif /* VBOX_WITH_GUEST_CONTROL */
 }
