Index: /trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h
===================================================================
--- /trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h	(revision 42529)
+++ /trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h	(revision 42530)
@@ -72,4 +72,6 @@
 typedef std::vector <Utf8Str> ProcessArguments;
 
+class GuestProcessStreamBlock;
+
 
 /**
@@ -116,4 +118,5 @@
     int                         mRC;
 };
+
 
 /*
@@ -174,4 +177,5 @@
 };
 
+
 /*
  * Class representing a guest control process event.
@@ -207,4 +211,5 @@
 };
 
+
 /**
  * Simple structure mantaining guest credentials.
@@ -217,4 +222,5 @@
 };
 
+
 typedef std::vector <Utf8Str> GuestEnvironmentArray;
 class GuestEnvironment
@@ -259,4 +265,37 @@
 
     std::map <Utf8Str, Utf8Str> mEnvironment;
+};
+
+
+/**
+ * Structure representing information of a
+ * file system object.
+ */
+struct GuestFsObjData
+{
+    /** Helper function to extract the data from
+     *  a guest stream block. */
+    int From(const GuestProcessStreamBlock &strmBlk);
+
+    int64_t              mAccessTime;
+    int64_t              mAllocatedSize;
+    int64_t              mBirthTime;
+    int64_t              mChangeTime;
+    uint32_t             mDeviceNumber;
+    Utf8Str              mFileAttrs;
+    uint32_t             mGenerationID;
+    uint32_t             mGID;
+    Utf8Str              mGroupName;
+    uint32_t             mNumHardLinks;
+    int64_t              mModificationTime;
+    Utf8Str              mName;
+    int64_t              mNodeID;
+    uint32_t             mNodeIDDevice;
+    int64_t              mObjectSize;
+    FsObjType_T          mType;
+    uint32_t             mUID;
+    uint32_t             mUserFlags;
+    Utf8Str              mUserName;
+    Utf8Str              mACL;
 };
 
@@ -281,4 +320,5 @@
 };
 
+
 /**
  * Class representing the "value" side of a "key=value" pair.
@@ -313,9 +353,7 @@
 public:
 
-    GuestProcessStreamBlock();
-
-    //GuestProcessStreamBlock(GuestProcessStreamBlock &);
-
-    virtual ~GuestProcessStreamBlock();
+    GuestProcessStreamBlock(void);
+
+    virtual ~GuestProcessStreamBlock(void);
 
 public:
@@ -327,15 +365,15 @@
 #endif
 
-    int GetInt64Ex(const char *pszKey, int64_t *piVal);
-
-    int64_t GetInt64(const char *pszKey);
-
-    size_t GetCount();
-
-    const char* GetString(const char *pszKey);
-
-    int GetUInt32Ex(const char *pszKey, uint32_t *puVal);
-
-    uint32_t GetUInt32(const char *pszKey);
+    int GetInt64Ex(const char *pszKey, int64_t *piVal) const;
+
+    int64_t GetInt64(const char *pszKey) const;
+
+    size_t GetCount(void) const;
+
+    const char* GetString(const char *pszKey) const;
+
+    int GetUInt32Ex(const char *pszKey, uint32_t *puVal) const;
+
+    uint32_t GetUInt32(const char *pszKey) const;
 
     int SetValue(const char *pszKey, const char *pszValue);
Index: /trunk/src/VBox/Main/include/GuestFsObjInfoImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/GuestFsObjInfoImpl.h	(revision 42529)
+++ /trunk/src/VBox/Main/include/GuestFsObjInfoImpl.h	(revision 42530)
@@ -21,4 +21,5 @@
 
 #include "VirtualBoxBase.h"
+#include "GuestCtrlImplPrivate.h"
 
 /**
@@ -78,27 +79,5 @@
 private:
 
-    struct Data
-    {
-        LONG64               mAccessTime;
-        LONG64               mAllocatedSize;
-        LONG64               mBirthTime;
-        LONG64               mChangeTime;
-        ULONG                mDeviceNumber;
-        Utf8Str              mFileAttrs;
-        ULONG                mGenerationID;
-        ULONG                mGID;
-        Utf8Str              mGroupName;
-        ULONG                mNumHardLinks;
-        LONG64               mModificationTime;
-        Utf8Str              mName;
-        LONG64               mNodeID;
-        ULONG                mNodeIDDevice;
-        LONG64               mObjectSize;
-        FsObjType            mType;
-        ULONG                mUID;
-        ULONG                mUserFlags;
-        Utf8Str              mUserName;
-        Utf8Str              mACL;
-    } mData;
+    GuestFsObjData mData;
 };
 
Index: /trunk/src/VBox/Main/include/GuestSessionImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/GuestSessionImpl.h	(revision 42529)
+++ /trunk/src/VBox/Main/include/GuestSessionImpl.h	(revision 42530)
@@ -127,4 +127,6 @@
     int                     dispatchToProcess(uint32_t uContextID, uint32_t uFunction, void *pvData, size_t cbData);
     int                     fileClose(ComObjPtr<GuestFile> pFile);
+    int                     fileQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData);
+    int                     fileQuerySizeInternal(const Utf8Str &strPath, int64_t *pllSize);
     const GuestCredentials &getCredentials(void);
     const GuestEnvironment &getEnvironment(void);
Index: /trunk/src/VBox/Main/src-client/GuestCtrlPrivate.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/GuestCtrlPrivate.cpp	(revision 42529)
+++ /trunk/src/VBox/Main/src-client/GuestCtrlPrivate.cpp	(revision 42530)
@@ -586,4 +586,32 @@
 }
 
+int GuestFsObjData::From(const GuestProcessStreamBlock &strmBlk)
+{
+    int rc = VINF_SUCCESS;
+
+    try
+    {
+        Utf8Str strType(strmBlk.GetString("ftype"));
+        if (strType.equalsIgnoreCase("-"))
+            mType = FsObjType_File;
+        else if (strType.equalsIgnoreCase("d"))
+            mType = FsObjType_Directory;
+        /** @todo Add more types! */
+        else
+            mType = FsObjType_Undefined;
+
+        rc = strmBlk.GetInt64Ex("st_size", &mObjectSize);
+        if (RT_FAILURE(rc)) throw rc;
+
+        /** @todo Add complete GuestFsObjData info! */
+    }
+    catch (int rc2)
+    {
+        rc = rc2;
+    }
+
+    return rc;
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -621,5 +649,5 @@
  * @return  IPRT status code.
  */
-void GuestProcessStreamBlock::Clear()
+void GuestProcessStreamBlock::Clear(void)
 {
     m_mapPairs.clear();
@@ -627,5 +655,5 @@
 
 #ifdef DEBUG
-void GuestProcessStreamBlock::Dump()
+void GuestProcessStreamBlock::Dump(void)
 {
     LogFlowFunc(("Dumping contents of stream block=0x%p (%ld items):\n",
@@ -647,5 +675,5 @@
  * @param  piVal                Pointer to value to return.
  */
-int GuestProcessStreamBlock::GetInt64Ex(const char *pszKey, int64_t *piVal)
+int GuestProcessStreamBlock::GetInt64Ex(const char *pszKey, int64_t *piVal) const
 {
     AssertPtrReturn(pszKey, VERR_INVALID_POINTER);
@@ -666,5 +694,5 @@
  * @param   pszKey              Name of key to get the value for.
  */
-int64_t GuestProcessStreamBlock::GetInt64(const char *pszKey)
+int64_t GuestProcessStreamBlock::GetInt64(const char *pszKey) const
 {
     int64_t iVal;
@@ -679,5 +707,5 @@
  * @return  uint32_t            Current number of stream pairs.
  */
-size_t GuestProcessStreamBlock::GetCount()
+size_t GuestProcessStreamBlock::GetCount(void) const
 {
     return m_mapPairs.size();
@@ -690,5 +718,5 @@
  * @param   pszKey              Name of key to get the value for.
  */
-const char* GuestProcessStreamBlock::GetString(const char *pszKey)
+const char* GuestProcessStreamBlock::GetString(const char *pszKey) const
 {
     AssertPtrReturn(pszKey, NULL);
@@ -714,5 +742,5 @@
  * @param  puVal                Pointer to value to return.
  */
-int GuestProcessStreamBlock::GetUInt32Ex(const char *pszKey, uint32_t *puVal)
+int GuestProcessStreamBlock::GetUInt32Ex(const char *pszKey, uint32_t *puVal) const
 {
     AssertPtrReturn(pszKey, VERR_INVALID_POINTER);
@@ -733,5 +761,5 @@
  * @param   pszKey              Name of key to get the value for.
  */
-uint32_t GuestProcessStreamBlock::GetUInt32(const char *pszKey)
+uint32_t GuestProcessStreamBlock::GetUInt32(const char *pszKey) const
 {
     uint32_t uVal;
Index: /trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp	(revision 42529)
+++ /trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp	(revision 42530)
@@ -504,4 +504,86 @@
 }
 
+/* Note: Will work on directories and others, too. */
+int GuestSession::fileQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData)
+{
+    LogFlowThisFunc(("strPath=%s\n", strPath.c_str()));
+
+    GuestProcessInfo procInfo;
+    procInfo.mName    = Utf8StrFmt(tr("Querying info for \"%s\"", strPath.c_str()));
+    procInfo.mCommand = Utf8Str(VBOXSERVICE_TOOL_STAT);
+    procInfo.mFlags   = ProcessCreateFlag_WaitForStdOut;
+
+    /* Construct arguments. */
+    procInfo.mArguments.push_back(Utf8Str("--machinereadable"));
+    procInfo.mArguments.push_back(strPath);
+
+    GuestProcessStream streamOut;
+
+    ComObjPtr<GuestProcess> pProcess;
+    int rc = processCreateExInteral(procInfo, pProcess);
+    if (RT_SUCCESS(rc))
+    {
+        GuestProcessWaitResult waitRes;
+        BYTE byBuf[_64K];
+        size_t cbRead;
+
+        for (;;)
+        {
+            rc = pProcess->waitFor(ProcessWaitForFlag_StdOut,
+                                   30 * 1000 /* Timeout */, waitRes);
+            if (   RT_FAILURE(rc)
+                || waitRes.mResult != ProcessWaitResult_StdOut)
+            {
+                break;
+            }
+
+            rc = pProcess->readData(OUTPUT_HANDLE_ID_STDOUT, sizeof(byBuf),
+                                    30 * 1000 /* Timeout */, byBuf, sizeof(byBuf),
+                                    &cbRead);
+            if (RT_FAILURE(rc))
+                break;
+
+            rc = streamOut.AddData(byBuf, cbRead);
+            if (RT_FAILURE(rc))
+                break;
+        }
+
+        LogFlowThisFunc(("rc=%Rrc, cbRead=%RU32, cbStreamOut=%RU32\n",
+                         rc, cbRead, streamOut.GetSize()));
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+        GuestProcessStreamBlock streamBlock;
+        rc = streamOut.ParseBlock(streamBlock);
+        if (RT_SUCCESS(rc))
+        {
+            rc = objData.From(streamBlock);
+        }
+        else
+            AssertMsgFailed(("Parsing stream block failed: %Rrc\n", rc));
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+int GuestSession::fileQuerySizeInternal(const Utf8Str &strPath, int64_t *pllSize)
+{
+    AssertPtrReturn(pllSize, VERR_INVALID_POINTER);
+
+    GuestFsObjData objData;
+    int rc = fileQueryInfoInternal(strPath, objData);
+    if (RT_SUCCESS(rc))
+    {
+        if (objData.mType == FsObjType_File)
+            *pllSize = objData.mObjectSize;
+        else
+            rc = VERR_NOT_A_FILE;
+    }
+
+    return rc;
+}
+
 const GuestCredentials& GuestSession::getCredentials(void)
 {
@@ -1082,8 +1164,32 @@
     LogFlowThisFuncEnter();
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    ReturnComNotImplemented();
+    if (RT_UNLIKELY((aPath) == NULL || *(aPath) == '\0'))
+        return setError(E_INVALIDARG, tr("No file to query size for specified"));
+    CheckComArgOutPointerValid(aSize);
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    HRESULT hr = S_OK;
+
+    int64_t llSize;
+    int rc = fileQuerySizeInternal(Utf8Str(aPath), &llSize);
+    if (RT_SUCCESS(rc))
+    {
+        *aSize = llSize;
+    }
+    else
+    {
+        switch (rc)
+        {
+            /** @todo Add more errors here! */
+
+            default:
+               hr = setError(VBOX_E_IPRT_ERROR, tr("Querying file size failed: %Rrc"), rc);
+               break;
+        }
+    }
+
+    return hr;
 #endif /* VBOX_WITH_GUEST_CONTROL */
 }
