儲存庫 vbox 的更動 40532
- 時間撮記:
- 2012-3-19 上午11:18:53 (13 年 以前)
- 位置:
- trunk/src/VBox/Additions/WINNT/SharedFolders/driver
- 檔案:
-
- 修改 4 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/Makefile.kmk
r40269 r40532 5 5 6 6 # 7 # Copyright (C) 2006-20 07Oracle Corporation7 # Copyright (C) 2006-2012 Oracle Corporation 8 8 # 9 9 # This file is part of VirtualBox Open Source Edition (OSE), as -
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/info.c
r40278 r40532 1434 1434 { 1435 1435 pVBoxFobx->fKeepCreationTime = TRUE; 1436 pVBoxFobx->SetFileInfoOnCloseFlags |= VBOX_FOBX_F_INFO_CREATION_TIME; 1436 1437 } 1437 1438 if (pInfo->LastAccessTime.QuadPart == -1) 1438 1439 { 1439 1440 pVBoxFobx->fKeepLastAccessTime = TRUE; 1441 pVBoxFobx->SetFileInfoOnCloseFlags |= VBOX_FOBX_F_INFO_LASTACCESS_TIME; 1440 1442 } 1441 1443 if (pInfo->LastWriteTime.QuadPart == -1) 1442 1444 { 1443 1445 pVBoxFobx->fKeepLastWriteTime = TRUE; 1446 pVBoxFobx->SetFileInfoOnCloseFlags |= VBOX_FOBX_F_INFO_LASTWRITE_TIME; 1444 1447 } 1445 1448 if (pInfo->ChangeTime.QuadPart == -1) 1446 1449 { 1447 1450 pVBoxFobx->fKeepChangeTime = TRUE; 1451 pVBoxFobx->SetFileInfoOnCloseFlags |= VBOX_FOBX_F_INFO_CHANGE_TIME; 1448 1452 } 1449 1453 … … 1465 1469 { 1466 1470 RTTimeSpecSetNtTime(&pSHFLFileInfo->BirthTime, pInfo->CreationTime.QuadPart); 1471 pVBoxFobx->SetFileInfoOnCloseFlags |= VBOX_FOBX_F_INFO_CREATION_TIME; 1467 1472 } 1468 1473 if (pInfo->LastAccessTime.QuadPart && !pVBoxFobx->fKeepLastAccessTime) 1469 1474 { 1470 1475 RTTimeSpecSetNtTime(&pSHFLFileInfo->AccessTime, pInfo->LastAccessTime.QuadPart); 1476 pVBoxFobx->SetFileInfoOnCloseFlags |= VBOX_FOBX_F_INFO_LASTACCESS_TIME; 1471 1477 } 1472 1478 if (pInfo->LastWriteTime.QuadPart && !pVBoxFobx->fKeepLastWriteTime) 1473 1479 { 1474 1480 RTTimeSpecSetNtTime(&pSHFLFileInfo->ModificationTime, pInfo->LastWriteTime.QuadPart); 1481 pVBoxFobx->SetFileInfoOnCloseFlags |= VBOX_FOBX_F_INFO_LASTWRITE_TIME; 1475 1482 } 1476 1483 if (pInfo->ChangeTime.QuadPart && !pVBoxFobx->fKeepChangeTime) 1477 1484 { 1478 1485 RTTimeSpecSetNtTime(&pSHFLFileInfo->ChangeTime, pInfo->ChangeTime.QuadPart); 1486 pVBoxFobx->SetFileInfoOnCloseFlags |= VBOX_FOBX_F_INFO_CHANGE_TIME; 1479 1487 } 1480 1488 if (pInfo->FileAttributes) -
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/path.c
r40269 r40532 587 587 } 588 588 589 Log(("VBOXSF: MRxCreate: FileBasicInformation: CreationTime %RX64\n", FileBasicInfo.CreationTime.QuadPart)); 590 Log(("VBOXSF: MRxCreate: FileBasicInformation: LastAccessTime %RX64\n", FileBasicInfo.LastAccessTime.QuadPart)); 591 Log(("VBOXSF: MRxCreate: FileBasicInformation: LastWriteTime %RX64\n", FileBasicInfo.LastWriteTime.QuadPart)); 592 Log(("VBOXSF: MRxCreate: FileBasicInformation: ChangeTime %RX64\n", FileBasicInfo.ChangeTime.QuadPart)); 593 Log(("VBOXSF: MRxCreate: FileBasicInformation: FileAttributes %RX32\n", FileBasicInfo.FileAttributes)); 594 589 595 pVBoxFobx->hFile = Handle; 590 596 pVBoxFobx->pSrvCall = RxContext->Create.pSrvCall; … … 595 601 pVBoxFobx->fKeepLastWriteTime = FALSE; 596 602 pVBoxFobx->fKeepChangeTime = FALSE; 603 pVBoxFobx->SetFileInfoOnCloseFlags = 0; 597 604 598 605 if (!RxIsFcbAcquiredExclusive(capFcb)) … … 655 662 Log(("VBOXSF: MRxForceClosed\n")); 656 663 return STATUS_NOT_IMPLEMENTED; 664 } 665 666 NTSTATUS vbsfSetFileInfo(PMRX_VBOX_DEVICE_EXTENSION pDeviceExtension, 667 PMRX_VBOX_NETROOT_EXTENSION pNetRootExtension, 668 PMRX_VBOX_FOBX pVBoxFobx, 669 PFILE_BASIC_INFORMATION pInfo, 670 BYTE SetAttrFlags) 671 { 672 NTSTATUS Status = STATUS_SUCCESS; 673 674 int vboxRC; 675 PSHFLFSOBJINFO pSHFLFileInfo; 676 677 uint8_t *pHGCMBuffer = NULL; 678 uint32_t cbBuffer = 0; 679 680 Log(("VBOXSF: vbsfSetFileInfo: SetAttrFlags 0x%02X\n", SetAttrFlags)); 681 Log(("VBOXSF: vbsfSetFileInfo: FileBasicInformation: CreationTime %RX64\n", pInfo->CreationTime.QuadPart)); 682 Log(("VBOXSF: vbsfSetFileInfo: FileBasicInformation: LastAccessTime %RX64\n", pInfo->LastAccessTime.QuadPart)); 683 Log(("VBOXSF: vbsfSetFileInfo: FileBasicInformation: LastWriteTime %RX64\n", pInfo->LastWriteTime.QuadPart)); 684 Log(("VBOXSF: vbsfSetFileInfo: FileBasicInformation: ChangeTime %RX64\n", pInfo->ChangeTime.QuadPart)); 685 Log(("VBOXSF: vbsfSetFileInfo: FileBasicInformation: FileAttributes %RX32\n", pInfo->FileAttributes)); 686 687 if (SetAttrFlags == 0) 688 { 689 Log(("VBOXSF: vbsfSetFileInfo: nothing to set\n")); 690 return STATUS_SUCCESS; 691 } 692 693 cbBuffer = sizeof(SHFLFSOBJINFO); 694 pHGCMBuffer = (uint8_t *)vbsfAllocNonPagedMem(cbBuffer); 695 if (pHGCMBuffer == NULL) 696 { 697 AssertFailed(); 698 return STATUS_INSUFFICIENT_RESOURCES; 699 } 700 RtlZeroMemory(pHGCMBuffer, cbBuffer); 701 pSHFLFileInfo = (PSHFLFSOBJINFO)pHGCMBuffer; 702 703 /* The properties, that need to be changed, are set to something other than zero */ 704 if (pInfo->CreationTime.QuadPart && (SetAttrFlags & VBOX_FOBX_F_INFO_CREATION_TIME) != 0) 705 { 706 RTTimeSpecSetNtTime(&pSHFLFileInfo->BirthTime, pInfo->CreationTime.QuadPart); 707 } 708 if (pInfo->LastAccessTime.QuadPart && (SetAttrFlags & VBOX_FOBX_F_INFO_LASTACCESS_TIME) != 0) 709 { 710 RTTimeSpecSetNtTime(&pSHFLFileInfo->AccessTime, pInfo->LastAccessTime.QuadPart); 711 } 712 if (pInfo->LastWriteTime.QuadPart && (SetAttrFlags & VBOX_FOBX_F_INFO_LASTWRITE_TIME) != 0) 713 { 714 RTTimeSpecSetNtTime(&pSHFLFileInfo->ModificationTime, pInfo->LastWriteTime.QuadPart); 715 } 716 if (pInfo->ChangeTime.QuadPart && (SetAttrFlags & VBOX_FOBX_F_INFO_CHANGE_TIME) != 0) 717 { 718 RTTimeSpecSetNtTime(&pSHFLFileInfo->ChangeTime, pInfo->ChangeTime.QuadPart); 719 } 720 if (pInfo->FileAttributes && (SetAttrFlags & VBOX_FOBX_F_INFO_ATTRIBUTES) != 0) 721 { 722 pSHFLFileInfo->Attr.fMode = NTToVBoxFileAttributes(pInfo->FileAttributes); 723 } 724 725 vboxRC = vboxCallFSInfo(&pDeviceExtension->hgcmClient, &pNetRootExtension->map, pVBoxFobx->hFile, 726 SHFL_INFO_SET | SHFL_INFO_FILE, &cbBuffer, (PSHFLDIRINFO)pSHFLFileInfo); 727 728 if (vboxRC != VINF_SUCCESS) 729 { 730 Status = VBoxErrorToNTStatus(vboxRC); 731 } 732 733 if (pHGCMBuffer) 734 { 735 vbsfFreeNonPagedMem(pHGCMBuffer); 736 } 737 738 Log(("VBOXSF: vbsfSetFileInfo: Returned 0x%08X\n", 739 Status)); 740 return Status; 741 } 742 743 /* 744 * Closes an opened file handle of a MRX_VBOX_FOBX. 745 * Updates file attributes if necessary. 746 */ 747 NTSTATUS vbsfCloseFileHandle(PMRX_VBOX_DEVICE_EXTENSION pDeviceExtension, 748 PMRX_VBOX_NETROOT_EXTENSION pNetRootExtension, 749 PMRX_VBOX_FOBX pVBoxFobx) 750 { 751 NTSTATUS Status = STATUS_SUCCESS; 752 753 int vboxRC; 754 755 if (pVBoxFobx->hFile == SHFL_HANDLE_NIL) 756 { 757 Log(("VBOXSF: vbsfCloseFileHandle: SHFL_HANDLE_NIL\n")); 758 return STATUS_SUCCESS; 759 } 760 761 Log(("VBOXSF: vbsfCloseFileHandle: 0x%RX64, on close info 0x%02X\n", 762 pVBoxFobx->hFile, pVBoxFobx->SetFileInfoOnCloseFlags)); 763 764 if (pVBoxFobx->SetFileInfoOnCloseFlags) 765 { 766 /* If the file timestamps were set by the user, then update them before closing the handle, 767 * to cancel any effect of the file read/write operations on the host. 768 */ 769 Status = vbsfSetFileInfo(pDeviceExtension, 770 pNetRootExtension, 771 pVBoxFobx, 772 &pVBoxFobx->FileBasicInfo, 773 pVBoxFobx->SetFileInfoOnCloseFlags); 774 } 775 776 vboxRC = vboxCallClose(&pDeviceExtension->hgcmClient, 777 &pNetRootExtension->map, 778 pVBoxFobx->hFile); 779 780 pVBoxFobx->hFile = SHFL_HANDLE_NIL; 781 782 if (vboxRC != VINF_SUCCESS) 783 { 784 Status = VBoxErrorToNTStatus(vboxRC); 785 } 786 787 Log(("VBOXSF: vbsfCloseFileHandle: Returned 0x%08X\n", 788 Status)); 789 return Status; 657 790 } 658 791 … … 697 830 if (pVBoxFobx->hFile != SHFL_HANDLE_NIL) 698 831 { 699 vboxRC = vboxCallClose(&pDeviceExtension->hgcmClient, &pNetRootExtension->map, pVBoxFobx->hFile); 700 pVBoxFobx->hFile = SHFL_HANDLE_NIL; 832 vbsfCloseFileHandle(pDeviceExtension, pNetRootExtension, pVBoxFobx); 701 833 } 702 834 … … 739 871 if (pVBoxFobx->hFile != SHFL_HANDLE_NIL) 740 872 { 741 vboxRC = vboxCallClose(&pDeviceExtension->hgcmClient, &pNetRootExtension->map, pVBoxFobx->hFile); 742 pVBoxFobx->hFile = SHFL_HANDLE_NIL; 873 vbsfCloseFileHandle(pDeviceExtension, pNetRootExtension, pVBoxFobx); 743 874 } 744 875 … … 820 951 if (pVBoxFobx->hFile != SHFL_HANDLE_NIL) 821 952 { 822 vboxRC = vboxCallClose(&pDeviceExtension->hgcmClient, &pNetRootExtension->map, pVBoxFobx->hFile); 823 pVBoxFobx->hFile = SHFL_HANDLE_NIL; 953 vbsfCloseFileHandle(pDeviceExtension, pNetRootExtension, pVBoxFobx); 824 954 } 825 955 -
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/vbsf.h
r40269 r40532 83 83 VBSFMAP map; 84 84 } MRX_VBOX_NETROOT_EXTENSION, *PMRX_VBOX_NETROOT_EXTENSION; 85 86 #define VBOX_FOBX_F_INFO_CREATION_TIME 0x01 87 #define VBOX_FOBX_F_INFO_LASTACCESS_TIME 0x02 88 #define VBOX_FOBX_F_INFO_LASTWRITE_TIME 0x04 89 #define VBOX_FOBX_F_INFO_CHANGE_TIME 0x08 90 #define VBOX_FOBX_F_INFO_ATTRIBUTES 0x10 85 91 86 92 /* … … 97 103 BOOLEAN fKeepLastWriteTime; 98 104 BOOLEAN fKeepChangeTime; 105 BYTE SetFileInfoOnCloseFlags; 99 106 } MRX_VBOX_FOBX, *PMRX_VBOX_FOBX; 100 107 … … 195 202 IN ULONG BufferLength); 196 203 NTSTATUS vbsfRemove(IN PRX_CONTEXT RxContext); 204 NTSTATUS vbsfCloseFileHandle(PMRX_VBOX_DEVICE_EXTENSION pDeviceExtension, 205 PMRX_VBOX_NETROOT_EXTENSION pNetRootExtension, 206 PMRX_VBOX_FOBX pVBoxFobx); 197 207 198 208 #endif /* VBSF_H */
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器