VirtualBox

Changeset 78338 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 26, 2019 10:08:31 PM (6 years ago)
Author:
vboxsync
Message:

winnt/vboxsf: Started cleaning up VBoxMRxSetFileInfo. bugref:9172

Location:
trunk/src/VBox/Additions/WINNT/SharedFolders/driver
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/SharedFolders/driver/file.cpp

    r78329 r78338  
    555555
    556556NTSTATUS vbsfNtSetEndOfFile(IN OUT struct _RX_CONTEXT * RxContext,
    557                           IN OUT PLARGE_INTEGER pNewFileSize,
    558                           OUT PLARGE_INTEGER pNewAllocationSize)
     557                            IN uint64_t cbNewFileSize)
    559558{
    560559    NTSTATUS Status = STATUS_SUCCESS;
     
    570569    int vrc;
    571570
    572     Log(("VBOXSF: vbsfNtSetEndOfFile: New size = %RX64 (%p), pNewAllocationSize = %p\n",
    573          pNewFileSize->QuadPart, pNewFileSize, pNewAllocationSize));
     571    Log(("VBOXSF: vbsfNtSetEndOfFile: New size = %RX64\n",
     572         cbNewFileSize));
    574573
    575574    Assert(pVBoxFobx && pNetRootExtension);
     
    584583
    585584    RtlZeroMemory(pObjInfo, cbBuffer);
    586     pObjInfo->cbObject = pNewFileSize->QuadPart;
     585    pObjInfo->cbObject = cbNewFileSize;
    587586
    588587    vrc = VbglR0SfFsInfo(&g_SfClient, &pNetRootExtension->map, pVBoxFobx->hFile,
     
    597596             pObjInfo->cbAllocated));
    598597
    599         /* Return new allocation size */
    600         pNewAllocationSize->QuadPart = pObjInfo->cbAllocated;
     598        /** @todo update the file stats! */
    601599    }
    602600
  • trunk/src/VBox/Additions/WINNT/SharedFolders/driver/info.cpp

    r78326 r78338  
    962962
    963963
     964/**
     965 * Handle NtQueryInformationFile and similar requests.
     966 */
    964967NTSTATUS VBoxMRxQueryFileInfo(IN PRX_CONTEXT RxContext)
    965968{
     
    12701273}
    12711274
     1275static NTSTATUS vbsfNtSetBasicInfo(PMRX_VBOX_FOBX pVBoxFobx, PMRX_VBOX_NETROOT_EXTENSION pNetRootExtension,
     1276                                   PFILE_BASIC_INFORMATION pBasicInfo)
     1277{
     1278    PSHFLFSOBJINFO          pSHFLFileInfo;
     1279    uint8_t                *pHGCMBuffer = NULL;
     1280    uint32_t                cbBuffer = 0;
     1281    uint32_t                fModified;
     1282    int                     vrc;
     1283
     1284    Log(("VBOXSF: MRxSetFileInfo: FileBasicInformation: CreationTime   %RX64\n", pBasicInfo->CreationTime.QuadPart));
     1285    Log(("VBOXSF: MRxSetFileInfo: FileBasicInformation: LastAccessTime %RX64\n", pBasicInfo->LastAccessTime.QuadPart));
     1286    Log(("VBOXSF: MRxSetFileInfo: FileBasicInformation: LastWriteTime  %RX64\n", pBasicInfo->LastWriteTime.QuadPart));
     1287    Log(("VBOXSF: MRxSetFileInfo: FileBasicInformation: ChangeTime     %RX64\n", pBasicInfo->ChangeTime.QuadPart));
     1288    Log(("VBOXSF: MRxSetFileInfo: FileBasicInformation: FileAttributes %RX32\n", pBasicInfo->FileAttributes));
     1289
     1290    /*
     1291     * Note! If a timestamp value is non-zero, the client disables implicit updating of
     1292     *       that timestamp via this handle when reading, writing and changing attributes.
     1293     *       The special -1 value is used to just disable implicit updating without
     1294     *       modifying the timestamp.  While the value is allowed for the CreationTime
     1295     *       field, it will be treated as zero.
     1296     *
     1297     *       More clues can be found here:
     1298     * https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/16023025-8a78-492f-8b96-c873b042ac50
     1299     * https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/d4bc551b-7aaf-4b4f-ba0e-3a75e7c528f0#Appendix_A_86
     1300     */
     1301
     1302    /** @todo r=bird: The attempt at implementing the disable-timestamp-update
     1303     *        behaviour here needs a little adjusting.  I'll get to that later.
     1304     *
     1305     * Reminders:
     1306     *
     1307     *  1. Drop VBOX_FOBX_F_INFO_CREATION_TIME.
     1308     *
     1309     *  2. Drop unused VBOX_FOBX_F_INFO_ATTRIBUTES.
     1310     *
     1311     *  3. Only act on VBOX_FOBX_F_INFO_CHANGE_TIME if modified attributes or grown
     1312     *     the file (?) so we don't cancel out updates by other parties (like the
     1313     *     host).
     1314     *
     1315     *  4. Only act on VBOX_FOBX_F_INFO_LASTWRITE_TIME if we've written to the file.
     1316     *
     1317     *  5. Only act on VBOX_FOBX_F_INFO_LASTACCESS_TIME if we've read from the file
     1318     *     or done whatever else might modify the access time.
     1319     *
     1320     *  6. Don't bother calling the host if there are only zeros and -1 values.
     1321     *
     1322     *  7. Client application should probably be allowed to modify the timestamps
     1323     *     explicitly using this API after disabling updating, given the wording of
     1324     *     the footnote referenced above.
     1325     *
     1326     *  8. Extend the host interface to let the host handle this crap instead as it
     1327     *     can do a better job, like on windows it's done implicitly if we let -1
     1328     *     pass thru IPRT.
     1329     *
     1330     * One worry here is that we hide timestamp updates made by the host or other
     1331     * guest side processes.  This could account for some of the issues we've been
     1332     * having with the guest not noticing host side changes.
     1333     */
     1334
     1335    if (pBasicInfo->CreationTime.QuadPart == -1)
     1336    {
     1337        pVBoxFobx->fKeepCreationTime = TRUE;
     1338        pVBoxFobx->SetFileInfoOnCloseFlags |= VBOX_FOBX_F_INFO_CREATION_TIME;
     1339    }
     1340    if (pBasicInfo->LastAccessTime.QuadPart == -1)
     1341    {
     1342        pVBoxFobx->fKeepLastAccessTime = TRUE;
     1343        pVBoxFobx->SetFileInfoOnCloseFlags |= VBOX_FOBX_F_INFO_LASTACCESS_TIME;
     1344    }
     1345    if (pBasicInfo->LastWriteTime.QuadPart == -1)
     1346    {
     1347        pVBoxFobx->fKeepLastWriteTime = TRUE;
     1348        pVBoxFobx->SetFileInfoOnCloseFlags |= VBOX_FOBX_F_INFO_LASTWRITE_TIME;
     1349    }
     1350    if (pBasicInfo->ChangeTime.QuadPart == -1)
     1351    {
     1352        pVBoxFobx->fKeepChangeTime = TRUE;
     1353        pVBoxFobx->SetFileInfoOnCloseFlags |= VBOX_FOBX_F_INFO_CHANGE_TIME;
     1354    }
     1355
     1356    cbBuffer = sizeof(SHFLFSOBJINFO);
     1357    pHGCMBuffer = (uint8_t *)vbsfNtAllocNonPagedMem(cbBuffer);
     1358    AssertReturn(pHGCMBuffer, STATUS_INSUFFICIENT_RESOURCES);
     1359    RtlZeroMemory(pHGCMBuffer, cbBuffer);
     1360    pSHFLFileInfo = (PSHFLFSOBJINFO)pHGCMBuffer;
     1361
     1362    Log(("VBOXSF: MrxSetFileInfo: FileBasicInformation: keeps %d %d %d %d\n",
     1363         pVBoxFobx->fKeepCreationTime, pVBoxFobx->fKeepLastAccessTime, pVBoxFobx->fKeepLastWriteTime, pVBoxFobx->fKeepChangeTime));
     1364
     1365    /* The properties, that need to be changed, are set to something other than zero */
     1366    fModified = 0;
     1367    if (pBasicInfo->CreationTime.QuadPart && !pVBoxFobx->fKeepCreationTime)
     1368    {
     1369        RTTimeSpecSetNtTime(&pSHFLFileInfo->BirthTime, pBasicInfo->CreationTime.QuadPart);
     1370        fModified |= VBOX_FOBX_F_INFO_CREATION_TIME;
     1371    }
     1372    /** @todo FsPerf need to check what is supposed to happen if modified
     1373     *        against after -1 is specified.  */
     1374    if (pBasicInfo->LastAccessTime.QuadPart && !pVBoxFobx->fKeepLastAccessTime)
     1375    {
     1376        RTTimeSpecSetNtTime(&pSHFLFileInfo->AccessTime, pBasicInfo->LastAccessTime.QuadPart);
     1377        fModified |= VBOX_FOBX_F_INFO_LASTACCESS_TIME;
     1378    }
     1379    if (pBasicInfo->LastWriteTime.QuadPart && !pVBoxFobx->fKeepLastWriteTime)
     1380    {
     1381        RTTimeSpecSetNtTime(&pSHFLFileInfo->ModificationTime, pBasicInfo->LastWriteTime.QuadPart);
     1382        fModified |= VBOX_FOBX_F_INFO_LASTWRITE_TIME;
     1383    }
     1384    if (pBasicInfo->ChangeTime.QuadPart && !pVBoxFobx->fKeepChangeTime)
     1385    {
     1386        RTTimeSpecSetNtTime(&pSHFLFileInfo->ChangeTime, pBasicInfo->ChangeTime.QuadPart);
     1387        fModified |= VBOX_FOBX_F_INFO_CHANGE_TIME;
     1388    }
     1389    if (pBasicInfo->FileAttributes)
     1390        pSHFLFileInfo->Attr.fMode = NTToVBoxFileAttributes(pBasicInfo->FileAttributes);
     1391
     1392    Assert(pVBoxFobx && pNetRootExtension);
     1393    vrc = VbglR0SfFsInfo(&g_SfClient, &pNetRootExtension->map, pVBoxFobx->hFile,
     1394                         SHFL_INFO_SET | SHFL_INFO_FILE, &cbBuffer, (PSHFLDIRINFO)pSHFLFileInfo);
     1395
     1396    NTSTATUS Status;
     1397    if (RT_SUCCESS(vrc))
     1398    {
     1399        vbsfNtCopyInfo(pVBoxFobx, pSHFLFileInfo, fModified);
     1400        pVBoxFobx->SetFileInfoOnCloseFlags |= fModified;
     1401        Status = STATUS_SUCCESS;
     1402    }
     1403    else
     1404        Status = vbsfNtVBoxStatusToNt(vrc);
     1405    vbsfNtFreeNonPagedMem(pHGCMBuffer);
     1406    return Status;
     1407}
     1408
    12721409NTSTATUS VBoxMRxSetFileInfo(IN PRX_CONTEXT RxContext)
    12731410{
    1274     NTSTATUS Status = STATUS_SUCCESS;
    1275 
    12761411    RxCaptureFcb;
    12771412    RxCaptureFobx;
    1278 
    12791413    PMRX_VBOX_NETROOT_EXTENSION pNetRootExtension = VBoxMRxGetNetRootExtension(capFcb->pNetRoot);
    1280     PMRX_VBOX_FOBX pVBoxFobx = VBoxMRxGetFileObjectExtension(capFobx);
    1281 
    1282     FILE_INFORMATION_CLASS FunctionalityRequested = RxContext->Info.FileInformationClass;
    1283     PVOID pInfoBuffer = (PVOID)RxContext->Info.Buffer;
    1284 
    1285     int vrc;
    1286 
    1287     uint8_t *pHGCMBuffer = NULL;
    1288     uint32_t cbBuffer = 0;
    1289 
    1290     Log(("VBOXSF: MrxSetFileInfo: pInfoBuffer %p\n",
    1291          pInfoBuffer));
    1292 
    1293     switch (FunctionalityRequested)
     1414    PMRX_VBOX_FOBX              pVBoxFobx         = VBoxMRxGetFileObjectExtension(capFobx);
     1415    NTSTATUS                    Status            = STATUS_SUCCESS;
     1416
     1417    Log(("VBOXSF: MrxSetFileInfo: Buffer=%p Length=%#x\n",
     1418         RxContext->Info.Buffer, RxContext->Info.Length));
     1419
     1420    switch (RxContext->Info.FileInformationClass)
    12941421    {
    12951422        case FileBasicInformation:
    12961423        {
    1297             PFILE_BASIC_INFORMATION pInfo = (PFILE_BASIC_INFORMATION)pInfoBuffer;
    1298             PSHFLFSOBJINFO pSHFLFileInfo;
    1299             uint32_t fModified;
    1300 
    1301             Log(("VBOXSF: MRxSetFileInfo: FileBasicInformation: CreationTime   %RX64\n", pInfo->CreationTime.QuadPart));
    1302             Log(("VBOXSF: MRxSetFileInfo: FileBasicInformation: LastAccessTime %RX64\n", pInfo->LastAccessTime.QuadPart));
    1303             Log(("VBOXSF: MRxSetFileInfo: FileBasicInformation: LastWriteTime  %RX64\n", pInfo->LastWriteTime.QuadPart));
    1304             Log(("VBOXSF: MRxSetFileInfo: FileBasicInformation: ChangeTime     %RX64\n", pInfo->ChangeTime.QuadPart));
    1305             Log(("VBOXSF: MRxSetFileInfo: FileBasicInformation: FileAttributes %RX32\n", pInfo->FileAttributes));
    1306 
    1307             /*
    1308              * Note! If a timestamp value is non-zero, the client disables implicit updating of
    1309              *       that timestamp via this handle when reading, writing and changing attributes.
    1310              *       The special -1 value is used to just disable implicit updating without
    1311              *       modifying the timestamp.  While the value is allowed for the CreationTime
    1312              *       field, it will be treated as zero.
    1313              *
    1314              *       More clues can be found here:
    1315              * https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/16023025-8a78-492f-8b96-c873b042ac50
    1316              * https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/d4bc551b-7aaf-4b4f-ba0e-3a75e7c528f0#Appendix_A_86
    1317              */
    1318 
    1319             /** @todo r=bird: The attempt at implementing the disable-timestamp-update
    1320              *        behaviour here needs a little adjusting.  I'll get to that later.
    1321              *
    1322              * Reminders:
    1323              *
    1324              *  1. Drop VBOX_FOBX_F_INFO_CREATION_TIME.
    1325              *
    1326              *  2. Drop unused VBOX_FOBX_F_INFO_ATTRIBUTES.
    1327              *
    1328              *  3. Only act on VBOX_FOBX_F_INFO_CHANGE_TIME if modified attributes or grown
    1329              *     the file (?) so we don't cancel out updates by other parties (like the
    1330              *     host).
    1331              *
    1332              *  4. Only act on VBOX_FOBX_F_INFO_LASTWRITE_TIME if we've written to the file.
    1333              *
    1334              *  5. Only act on VBOX_FOBX_F_INFO_LASTACCESS_TIME if we've read from the file
    1335              *     or done whatever else might modify the access time.
    1336              *
    1337              *  6. Don't bother calling the host if there are only zeros and -1 values.
    1338              *
    1339              *  7. Client application should probably be allowed to modify the timestamps
    1340              *     explicitly using this API after disabling updating, given the wording of
    1341              *     the footnote referenced above.
    1342              *
    1343              *  8. Extend the host interface to let the host handle this crap instead as it
    1344              *     can do a better job, like on windows it's done implicitly if we let -1
    1345              *     pass thru IPRT.
    1346              *
    1347              * One worry here is that we hide timestamp updates made by the host or other
    1348              * guest side processes.  This could account for some of the issues we've been
    1349              * having with the guest not noticing host side changes.
    1350              */
    1351 
    1352             if (pInfo->CreationTime.QuadPart == -1)
    1353             {
    1354                 pVBoxFobx->fKeepCreationTime = TRUE;
    1355                 pVBoxFobx->SetFileInfoOnCloseFlags |= VBOX_FOBX_F_INFO_CREATION_TIME;
    1356             }
    1357             if (pInfo->LastAccessTime.QuadPart == -1)
    1358             {
    1359                 pVBoxFobx->fKeepLastAccessTime = TRUE;
    1360                 pVBoxFobx->SetFileInfoOnCloseFlags |= VBOX_FOBX_F_INFO_LASTACCESS_TIME;
    1361             }
    1362             if (pInfo->LastWriteTime.QuadPart == -1)
    1363             {
    1364                 pVBoxFobx->fKeepLastWriteTime = TRUE;
    1365                 pVBoxFobx->SetFileInfoOnCloseFlags |= VBOX_FOBX_F_INFO_LASTWRITE_TIME;
    1366             }
    1367             if (pInfo->ChangeTime.QuadPart == -1)
    1368             {
    1369                 pVBoxFobx->fKeepChangeTime = TRUE;
    1370                 pVBoxFobx->SetFileInfoOnCloseFlags |= VBOX_FOBX_F_INFO_CHANGE_TIME;
    1371             }
    1372 
    1373             cbBuffer = sizeof(SHFLFSOBJINFO);
    1374             pHGCMBuffer = (uint8_t *)vbsfNtAllocNonPagedMem(cbBuffer);
    1375             AssertReturn(pHGCMBuffer, STATUS_INSUFFICIENT_RESOURCES);
    1376             RtlZeroMemory(pHGCMBuffer, cbBuffer);
    1377             pSHFLFileInfo = (PSHFLFSOBJINFO)pHGCMBuffer;
    1378 
    1379             Log(("VBOXSF: MrxSetFileInfo: FileBasicInformation: keeps %d %d %d %d\n",
    1380                  pVBoxFobx->fKeepCreationTime, pVBoxFobx->fKeepLastAccessTime, pVBoxFobx->fKeepLastWriteTime, pVBoxFobx->fKeepChangeTime));
    1381 
    1382             /* The properties, that need to be changed, are set to something other than zero */
    1383             fModified = 0;
    1384             if (pInfo->CreationTime.QuadPart && !pVBoxFobx->fKeepCreationTime)
    1385             {
    1386                 RTTimeSpecSetNtTime(&pSHFLFileInfo->BirthTime, pInfo->CreationTime.QuadPart);
    1387                 fModified |= VBOX_FOBX_F_INFO_CREATION_TIME;
    1388             }
    1389             /** @todo FsPerf need to check what is supposed to happen if modified
    1390              *        against after -1 is specified.  */
    1391             if (pInfo->LastAccessTime.QuadPart && !pVBoxFobx->fKeepLastAccessTime)
    1392             {
    1393                 RTTimeSpecSetNtTime(&pSHFLFileInfo->AccessTime, pInfo->LastAccessTime.QuadPart);
    1394                 fModified |= VBOX_FOBX_F_INFO_LASTACCESS_TIME;
    1395             }
    1396             if (pInfo->LastWriteTime.QuadPart && !pVBoxFobx->fKeepLastWriteTime)
    1397             {
    1398                 RTTimeSpecSetNtTime(&pSHFLFileInfo->ModificationTime, pInfo->LastWriteTime.QuadPart);
    1399                 fModified |= VBOX_FOBX_F_INFO_LASTWRITE_TIME;
    1400             }
    1401             if (pInfo->ChangeTime.QuadPart && !pVBoxFobx->fKeepChangeTime)
    1402             {
    1403                 RTTimeSpecSetNtTime(&pSHFLFileInfo->ChangeTime, pInfo->ChangeTime.QuadPart);
    1404                 fModified |= VBOX_FOBX_F_INFO_CHANGE_TIME;
    1405             }
    1406             if (pInfo->FileAttributes)
    1407                 pSHFLFileInfo->Attr.fMode = NTToVBoxFileAttributes(pInfo->FileAttributes);
    1408 
    1409             Assert(pVBoxFobx && pNetRootExtension);
    1410             vrc = VbglR0SfFsInfo(&g_SfClient, &pNetRootExtension->map, pVBoxFobx->hFile,
    1411                                  SHFL_INFO_SET | SHFL_INFO_FILE, &cbBuffer, (PSHFLDIRINFO)pSHFLFileInfo);
    1412 
    1413             if (RT_SUCCESS(vrc))
    1414             {
    1415                 vbsfNtCopyInfo(pVBoxFobx, pSHFLFileInfo, fModified);
    1416                 pVBoxFobx->SetFileInfoOnCloseFlags |= fModified;
    1417             }
    1418             else
    1419             {
    1420                 Status = vbsfNtVBoxStatusToNt(vrc);
    1421                 goto end;
    1422             }
     1424            Assert(RxContext->Info.Length >= sizeof(FILE_BASIC_INFORMATION));
     1425            Status = vbsfNtSetBasicInfo(pVBoxFobx, pNetRootExtension, (PFILE_BASIC_INFORMATION)RxContext->Info.Buffer);
    14231426            break;
    14241427        }
     
    14261429        case FileDispositionInformation:
    14271430        {
    1428             PFILE_DISPOSITION_INFORMATION pInfo = (PFILE_DISPOSITION_INFORMATION)pInfoBuffer;
    1429 
     1431            PFILE_DISPOSITION_INFORMATION pInfo = (PFILE_DISPOSITION_INFORMATION)RxContext->Info.Buffer;
    14301432            Log(("VBOXSF: MrxSetFileInfo: FileDispositionInformation: Delete = %d\n",
    14311433                 pInfo->DeleteFile));
     
    14381440        }
    14391441
    1440         case FilePositionInformation:
    1441         {
    1442 #ifdef LOG_ENABLED
    1443             PFILE_POSITION_INFORMATION pInfo = (PFILE_POSITION_INFORMATION)pInfoBuffer;
    1444             Log(("VBOXSF: MrxSetFileInfo: FilePositionInformation: CurrentByteOffset = 0x%RX64. Unsupported!\n",
    1445                  pInfo->CurrentByteOffset.QuadPart));
    1446 #endif
    1447 
    1448             Status = STATUS_INVALID_PARAMETER;
    1449             break;
    1450         }
    1451 
     1442        /*
     1443         * Change the allocation size, leaving the EOF alone unless the file shrinks.
     1444         *
     1445         * There is no shared folder operation for this, so we only need to care
     1446         * about adjusting EOF if the file shrinks.
     1447         *
     1448         * https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/d4bc551b-7aaf-4b4f-ba0e-3a75e7c528f0#Appendix_A_83
     1449         */
    14521450        case FileAllocationInformation:
    14531451        {
    1454             PFILE_ALLOCATION_INFORMATION pInfo = (PFILE_ALLOCATION_INFORMATION)pInfoBuffer;
    1455 
     1452            PFILE_ALLOCATION_INFORMATION pInfo = (PFILE_ALLOCATION_INFORMATION)RxContext->Info.Buffer;
    14561453            Log(("VBOXSF: MrxSetFileInfo: FileAllocationInformation: new AllocSize = 0x%RX64, FileSize = 0x%RX64\n",
    14571454                 pInfo->AllocationSize.QuadPart, capFcb->Header.FileSize.QuadPart));
    14581455
    1459             /* Check if the new allocation size changes the file size. */
    1460             if (pInfo->AllocationSize.QuadPart > capFcb->Header.FileSize.QuadPart)
    1461             {
    1462                 /* Ignore this request and return success. Shared folders do not distinguish between
    1463                  * AllocationSize and FileSize.
    1464                  */
     1456            if (pInfo->AllocationSize.QuadPart >= capFcb->Header.FileSize.QuadPart)
    14651457                Status = STATUS_SUCCESS;
    1466             }
    14671458            else
    14681459            {
    1469                 /* Treat the request as a EndOfFile update. */
    1470                 LARGE_INTEGER NewAllocationSize;
    1471                 Status = vbsfNtSetEndOfFile(RxContext, &pInfo->AllocationSize, &NewAllocationSize);
    1472             }
    1473 
     1460                /** @todo get up to date EOF from host?  We may risk accidentally growing the
     1461                 *        file here if the host (or someone else) truncated it. */
     1462                Status = vbsfNtSetEndOfFile(RxContext, pInfo->AllocationSize.QuadPart);
     1463            }
    14741464            break;
    14751465        }
     
    14771467        case FileEndOfFileInformation:
    14781468        {
    1479             PFILE_END_OF_FILE_INFORMATION pInfo = (PFILE_END_OF_FILE_INFORMATION)pInfoBuffer;
    1480             LARGE_INTEGER NewAllocationSize;
    1481 
     1469            PFILE_END_OF_FILE_INFORMATION pInfo = (PFILE_END_OF_FILE_INFORMATION)RxContext->Info.Buffer;
    14821470            Log(("VBOXSF: MrxSetFileInfo: FileEndOfFileInformation: new EndOfFile 0x%RX64, FileSize = 0x%RX64\n",
    14831471                 pInfo->EndOfFile.QuadPart, capFcb->Header.FileSize.QuadPart));
    14841472
    1485             Status = vbsfNtSetEndOfFile(RxContext, &pInfo->EndOfFile, &NewAllocationSize);
    1486 
    1487             Log(("VBOXSF: MrxSetFileInfo: FileEndOfFileInformation: AllocSize = 0x%RX64, Status 0x%08X\n",
    1488                  NewAllocationSize.QuadPart, Status));
    1489 
     1473            Status = vbsfNtSetEndOfFile(RxContext, pInfo->EndOfFile.QuadPart);
     1474
     1475            Log(("VBOXSF: MrxSetFileInfo: FileEndOfFileInformation: Status 0x%08X\n",
     1476                 Status));
    14901477            break;
    14911478        }
     
    14941481        {
    14951482#ifdef LOG_ENABLED
    1496             PFILE_LINK_INFORMATION pInfo = (PFILE_LINK_INFORMATION )pInfoBuffer;
     1483            PFILE_LINK_INFORMATION pInfo = (PFILE_LINK_INFORMATION )RxContext->Info.Buffer;
    14971484            Log(("VBOXSF: MrxSetFileInfo: FileLinkInformation: ReplaceIfExists = %d, RootDirectory = 0x%x = [%.*ls]. Not implemented!\n",
    14981485                 pInfo->ReplaceIfExists, pInfo->RootDirectory, pInfo->FileNameLength / sizeof(WCHAR), pInfo->FileName));
     
    15061493        {
    15071494#ifdef LOG_ENABLED
    1508             PFILE_RENAME_INFORMATION pInfo = (PFILE_RENAME_INFORMATION)pInfoBuffer;
     1495            PFILE_RENAME_INFORMATION pInfo = (PFILE_RENAME_INFORMATION)RxContext->Info.Buffer;
    15091496            Log(("VBOXSF: MrxSetFileInfo: FileRenameInformation: ReplaceIfExists = %d, RootDirectory = 0x%x = [%.*ls]\n",
    15101497                 pInfo->ReplaceIfExists, pInfo->RootDirectory, pInfo->FileNameLength / sizeof(WCHAR), pInfo->FileName));
    15111498#endif
    15121499
    1513             Status = vbsfNtRename(RxContext, FileRenameInformation, pInfoBuffer, RxContext->Info.Length);
    1514             break;
    1515         }
     1500            Status = vbsfNtRename(RxContext, FileRenameInformation, RxContext->Info.Buffer, RxContext->Info.Length);
     1501            break;
     1502        }
     1503
     1504        /* The file position is handled by the RDBSS library (RxSetPositionInfo)
     1505           and we should never see this request. */
     1506        case FilePositionInformation:
     1507            AssertMsgFailed(("VBOXSF: MrxSetFileInfo: FilePositionInformation: CurrentByteOffset = 0x%RX64. Unsupported!\n",
     1508                             ((PFILE_POSITION_INFORMATION)RxContext->Info.Buffer)->CurrentByteOffset.QuadPart));
     1509            Status = STATUS_INVALID_PARAMETER;
     1510            break;
    15161511
    15171512        default:
    1518             Log(("VBOXSF: MrxSetFileInfo: Not supported FunctionalityRequested %d!\n",
    1519                  FunctionalityRequested));
     1513            Log(("VBOXSF: MrxSetFileInfo: Not supported FileInformationClass: %d!\n",
     1514                 RxContext->Info.FileInformationClass));
    15201515            Status = STATUS_INVALID_PARAMETER;
    15211516            break;
    15221517    }
    1523 
    1524 end:
    1525     if (pHGCMBuffer)
    1526         vbsfNtFreeNonPagedMem(pHGCMBuffer);
    15271518
    15281519    Log(("VBOXSF: MrxSetFileInfo: Returned 0x%08X\n", Status));
  • trunk/src/VBox/Additions/WINNT/SharedFolders/driver/vbsf.h

    r78330 r78338  
    221221
    222222NTSTATUS vbsfNtSetEndOfFile(IN OUT struct _RX_CONTEXT * RxContext,
    223                             IN OUT PLARGE_INTEGER pNewFileSize,
    224                             OUT PLARGE_INTEGER pNewAllocationSize);
     223                            IN uint64_t cbNewFileSize);
    225224NTSTATUS vbsfNtRename(IN PRX_CONTEXT RxContext,
    226225                      IN FILE_INFORMATION_CLASS FileInformationClass,
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette