Index: /trunk/src/VBox/Additions/WINNT/SharedFolders/driver/info.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/SharedFolders/driver/info.cpp	(revision 78367)
+++ /trunk/src/VBox/Additions/WINNT/SharedFolders/driver/info.cpp	(revision 78368)
@@ -22,4 +22,6 @@
 #include "vbsf.h"
 #include <iprt/err.h>
+
+extern "C" NTSTATUS NTAPI RxSetEndOfFileInfo(PRX_CONTEXT, PIRP, PFCB, PFOBX);
 
 
@@ -1833,5 +1835,5 @@
      *     db 4                    ; 75      FileCaseSensitiveInformationForceAccessCheck, - for the i/o manager, w10-1809.
      */
-    switch (RxContext->Info.FileInformationClass)
+    switch ((int)RxContext->Info.FileInformationClass)
     {
         /*
@@ -1944,5 +1946,12 @@
          *       will hide calls which does not change the size from us.  This is of course not
          *       the case for non-local file systems, as the server is the only which up-to-date
-         *       information.  Don't see an easy way of working around it, so ignoring it for now.
+         *       information.
+         *
+         *       We work around this either by modifying FCB.Header.FileSize slightly when it equals
+         *       the new size.  This is either done below in the FileEndOfFileInformation + 4096 case,
+         *       or when using older WDK libs in VBoxHookMjSetInformation.  The FCB is locked
+         *       exclusivly while we operate with the incorrect Header.FileSize value, which should
+         *       prevent anyone else from making use of it till it has been updated again.
+         *
          */
         case FileEndOfFileInformation:
@@ -1958,4 +1967,51 @@
             break;
         }
+
+#if 0 /* This only works for more recent versions of the RDBSS library, not for the one we're using (WDK 7600.16385.1). */
+        /*
+         * HACK ALERT! This is FileEndOfFileInformation after it passed thru
+         * VBoxHookMjSetInformation so we can twiddle the cached file size in
+         * the FCB to ensure the set EOF request always reaches the host.
+         *
+         * Note! We have to call thru RxSetEndOfFileInfo to benefit from its
+         *       update logic and avoid needing to replicate that code.
+         */
+        case FileEndOfFileInformation + 4096:
+        {
+            PFILE_END_OF_FILE_INFORMATION pInfo = (PFILE_END_OF_FILE_INFORMATION)RxContext->Info.Buffer;
+            Log(("VBOXSF: MrxSetFileInfo: FileEndOfFileInformation+4096: new EndOfFile 0x%RX64, FileSize = 0x%RX64\n",
+                 pInfo->EndOfFile.QuadPart, capFcb->Header.FileSize.QuadPart));
+
+            /* Undo the change from VBoxHookMjSetInformation:  */
+            Assert(RxContext->CurrentIrpSp);
+            RxContext->CurrentIrpSp->Parameters.SetFile.FileInformationClass = FileEndOfFileInformation;
+            RxContext->Info.FileInformationClass                             = FileEndOfFileInformation;
+
+            /* Tweak the size if necessary and forward the call. */
+            int64_t const cbOldSize = capFcb->Header.FileSize.QuadPart;
+            if (   pInfo->EndOfFile.QuadPart != cbOldSize
+                || !(capFcb->FcbState & FCB_STATE_PAGING_FILE))
+            {
+                Status = RxSetEndOfFileInfo(RxContext, RxContext->CurrentIrp, (PFCB)capFcb, (PFOBX)capFobx);
+                Log(("VBOXSF: MrxSetFileInfo: FileEndOfFileInformation+4096: Status 0x%08X\n",
+                     Status));
+            }
+            else
+            {
+                int64_t const cbHackedSize = cbOldSize ? cbOldSize - 1 : 1;
+                capFcb->Header.FileSize.QuadPart = cbHackedSize;
+                Status = RxSetEndOfFileInfo(RxContext, RxContext->CurrentIrp, (PFCB)capFcb, (PFOBX)capFobx);
+                if (   !NT_SUCCESS(Status)
+                    && capFcb->Header.FileSize.QuadPart == cbHackedSize)
+                    capFcb->Header.FileSize.QuadPart = cbOldSize;
+                else
+                    Assert(   capFcb->Header.FileSize.QuadPart != cbHackedSize
+                           || pVBoxFobx->Info.cbObject == cbHackedSize);
+                Log(("VBOXSF: MrxSetFileInfo: FileEndOfFileInformation+4096: Status 0x%08X (tweaked)\n",
+                     Status));
+            }
+            break;
+        }
+#endif
 
         /// @todo FileModeInformation ?
Index: /trunk/src/VBox/Additions/WINNT/SharedFolders/driver/vbsf.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/SharedFolders/driver/vbsf.cpp	(revision 78367)
+++ /trunk/src/VBox/Additions/WINNT/SharedFolders/driver/vbsf.cpp	(revision 78368)
@@ -492,4 +492,103 @@
 }
 
+/**
+ * Intercepts IRP_MJ_SET_INFORMATION to workaround a RDBSS quirk in the
+ * FileEndOfFileInformation handling.
+ *
+ * We will add 4096 to the FileEndOfFileInformation function value and pick it
+ * up in VBoxMRxSetFileInfo after RxCommonSetInformation has done the necessary
+ * locking.  If we find that the desired file size matches the cached one, just
+ * issue the call directly, otherwise subtract 4096 and call the
+ * RxSetEndOfFileInfo worker.
+ */
+static NTSTATUS VBoxHookMjSetInformation(PDEVICE_OBJECT pDevObj, PIRP pIrp)
+{
+    PMRX_VBOX_DEVICE_EXTENSION  pDevExt  = (PMRX_VBOX_DEVICE_EXTENSION)((PBYTE)pDevObj + sizeof(RDBSS_DEVICE_OBJECT));
+    PIO_STACK_LOCATION          pStack   = IoGetCurrentIrpStackLocation(pIrp);
+    PFILE_OBJECT                pFileObj = pStack->FileObject;
+    NTSTATUS                    rcNt;
+
+    Log(("VBOXSF: VBoxHookMjSetInformation: pDevObj %p, pDevExt %p, pFileObj %p, FileInformationClass %d, Length %#x\n",
+         pDevObj, pDevObj->DeviceExtension, pFileObj, pStack->Parameters.SetFile.FileInformationClass, pStack->Parameters.SetFile.Length));
+    if (pFileObj)
+        Log2(("VBOXSF: VBoxHookMjSetInformation: FileName=%.*ls\n", pFileObj->FileName.Length / sizeof(WCHAR), pFileObj->FileName.Buffer));
+
+    /*
+     * Setting EOF info?
+     */
+    if (pStack->Parameters.SetFile.FileInformationClass == FileEndOfFileInformation)
+    {
+#if 0 /* This only works for more recent versions of the RDBSS library, not for the one we're using (WDK 7600.16385.1). */
+        pStack->Parameters.SetFile.FileInformationClass = (FILE_INFORMATION_CLASS)(FileEndOfFileInformation + 4096);
+        rcNt = pDevExt->pfnRDBSSSetInformation(pDevObj, pIrp);
+        Log(("VBOXSF: VBoxHookMjSetInformation: returns %#x (hacked)\n", rcNt));
+        return rcNt;
+#else
+        /*
+         * For the older WDK, we have to detect the same-size situation up front and hack
+         * it here instead of in VBoxMRxSetFileInfo.  This means we need to lock the FCB
+         * before modifying the Fcb.Header.FileSize value and ASSUME the locking is
+         * reentrant and nothing else happens during RDBSS dispatching wrt that...
+         */
+        PMRX_FCB pFcb = (PMRX_FCB)pFileObj->FsContext;
+        if (   (NODE_TYPE_CODE)pFcb->Header.NodeTypeCode == RDBSS_NTC_STORAGE_TYPE_FILE
+            && pIrp->AssociatedIrp.SystemBuffer != NULL
+            && pStack->Parameters.SetFile.Length >= sizeof(FILE_END_OF_FILE_INFORMATION))
+        {
+            LONGLONG cbFileNew = -42;
+            __try
+            {
+                cbFileNew = ((PFILE_END_OF_FILE_INFORMATION)pIrp->AssociatedIrp.SystemBuffer)->EndOfFile.QuadPart;
+            }
+            __except(EXCEPTION_EXECUTE_HANDLER)
+            {
+                cbFileNew = -42;
+            }
+            if (   cbFileNew >= 0
+                && pFcb->Header.FileSize.QuadPart == cbFileNew
+                && !(pFcb->FcbState & FCB_STATE_PAGING_FILE))
+            {
+                /* Now exclusivly lock the FCB like RxCommonSetInformation would do
+                   to reduce chances of races and of anyone else grabbing the value
+                   while it's incorrect on purpose. */
+                NTSTATUS rcNtLock = RxAcquireExclusiveFcb(NULL, (PFCB)pFcb);
+                if (NT_SUCCESS(rcNtLock))
+                {
+                    if (pFcb->Header.FileSize.QuadPart == cbFileNew)
+                    {
+                        int64_t const cbHackedSize = cbFileNew ? cbFileNew - 1 : 1;
+                        pFcb->Header.FileSize.QuadPart = cbHackedSize;
+                        rcNt = pDevExt->pfnRDBSSSetInformation(pDevObj, pIrp);
+                        if (   !NT_SUCCESS(rcNt)
+                            && pFcb->Header.FileSize.QuadPart == cbHackedSize)
+                            pFcb->Header.FileSize.QuadPart = cbFileNew;
+# ifdef VBOX_STRICT
+                        else
+                        {
+                            PMRX_FOBX pFobx = (PMRX_FOBX)pFileObj->FsContext2;
+                            PMRX_VBOX_FOBX pVBoxFobX = VBoxMRxGetFileObjectExtension(pFobx);
+                            Assert(   pFcb->Header.FileSize.QuadPart != cbHackedSize
+                                   || (pVBoxFobX && pVBoxFobX->Info.cbObject == cbHackedSize));
+                        }
+# endif
+                        RxReleaseFcb(NULL, pFcb);
+                        Log(("VBOXSF: VBoxHookMjSetInformation: returns %#x (hacked, cbFileNew=%#RX64)\n", rcNt, cbFileNew));
+                        return rcNt;
+                    }
+                    RxReleaseFcb(NULL, pFcb);
+                }
+            }
+        }
+#endif
+    }
+
+    /*
+     * No hack needed.
+     */
+    rcNt = pDevExt->pfnRDBSSSetInformation(pDevObj, pIrp);
+    Log(("VBOXSF: VBoxHookMjSetInformation: returns %#x\n", rcNt));
+    return rcNt;
+}
+
 NTSTATUS DriverEntry(IN PDRIVER_OBJECT  DriverObject,
                      IN PUNICODE_STRING RegistryPath)
@@ -649,4 +748,12 @@
     pDeviceExtension->pfnRDBSSCreate = DriverObject->MajorFunction[IRP_MJ_CREATE];
     DriverObject->MajorFunction[IRP_MJ_CREATE] = VBoxHookMjCreate;
+
+    /* Intercept IRP_MJ_SET_INFORMATION to ensure we call the host for all
+     * FileEndOfFileInformation requestes, even if the new size matches the
+     * old one.  We don't know if someone else might have modified the file
+     * size cached in the FCB since the last time we update it.
+     */
+    pDeviceExtension->pfnRDBSSSetInformation = DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION];
+    DriverObject->MajorFunction[IRP_MJ_SET_INFORMATION] = VBoxHookMjSetInformation;
 
 
Index: /trunk/src/VBox/Additions/WINNT/SharedFolders/driver/vbsf.h
===================================================================
--- /trunk/src/VBox/Additions/WINNT/SharedFolders/driver/vbsf.h	(revision 78367)
+++ /trunk/src/VBox/Additions/WINNT/SharedFolders/driver/vbsf.h	(revision 78368)
@@ -82,4 +82,6 @@
     /** Saved pointer to the original IRP_MJ_CREATE handler. */
     NTSTATUS (NTAPI * pfnRDBSSCreate)(PDEVICE_OBJECT pDevObj, PIRP pIrp);
+    /** Saved pointer to the original IRP_MJ_SET_INFORMATION handler. */
+    NTSTATUS (NTAPI * pfnRDBSSSetInformation)(PDEVICE_OBJECT pDevObj, PIRP pIrp);
 
 } MRX_VBOX_DEVICE_EXTENSION, *PMRX_VBOX_DEVICE_EXTENSION;
