- Timestamp:
- Apr 26, 2019 2:45:38 PM (6 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/SharedFolders/driver
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/file.cpp
r78321 r78326 302 302 ByteCount = ctx.cbData; 303 303 304 Status = VBoxErrorToNTStatus(vrc);304 Status = vbsfNtVBoxStatusToNt(vrc); 305 305 306 306 if (Status != STATUS_SUCCESS) … … 418 418 ByteCount = ctx.cbData; 419 419 420 Status = VBoxErrorToNTStatus(vrc);420 Status = vbsfNtVBoxStatusToNt(vrc); 421 421 422 422 if (Status != STATUS_SUCCESS) … … 516 516 LowIoContext->ParamsFor.Locks.ByteOffset, LowIoContext->ParamsFor.Locks.Length, fu32Lock); 517 517 518 Status = VBoxErrorToNTStatus(vrc);518 Status = vbsfNtVBoxStatusToNt(vrc); 519 519 520 520 Log(("VBOXSF: MRxLocks: Returned 0x%08X\n", Status)); … … 547 547 vrc = VbglR0SfFlush(&g_SfClient, &pNetRootExtension->map, pVBoxFobx->hFile); 548 548 549 Status = VBoxErrorToNTStatus(vrc);549 Status = vbsfNtVBoxStatusToNt(vrc); 550 550 551 551 Log(("VBOXSF: MRxFlush: Returned 0x%08X\n", Status)); … … 553 553 } 554 554 555 NTSTATUS vbsf SetEndOfFile(IN OUT struct _RX_CONTEXT * RxContext,555 NTSTATUS vbsfNtSetEndOfFile(IN OUT struct _RX_CONTEXT * RxContext, 556 556 IN OUT PLARGE_INTEGER pNewFileSize, 557 557 OUT PLARGE_INTEGER pNewAllocationSize) … … 569 569 int vrc; 570 570 571 Log(("VBOXSF: vbsf SetEndOfFile: New size = %RX64 (%p), pNewAllocationSize = %p\n",571 Log(("VBOXSF: vbsfNtSetEndOfFile: New size = %RX64 (%p), pNewAllocationSize = %p\n", 572 572 pNewFileSize->QuadPart, pNewFileSize, pNewAllocationSize)); 573 573 … … 575 575 576 576 cbBuffer = sizeof(SHFLFSOBJINFO); 577 pObjInfo = (SHFLFSOBJINFO *)vbsf AllocNonPagedMem(cbBuffer);577 pObjInfo = (SHFLFSOBJINFO *)vbsfNtAllocNonPagedMem(cbBuffer); 578 578 if (!pObjInfo) 579 579 { … … 588 588 SHFL_INFO_SET | SHFL_INFO_SIZE, &cbBuffer, (PSHFLDIRINFO)pObjInfo); 589 589 590 Log(("VBOXSF: vbsf SetEndOfFile: VbglR0SfFsInfo returned %Rrc\n", vrc));591 592 Status = VBoxErrorToNTStatus(vrc);590 Log(("VBOXSF: vbsfNtSetEndOfFile: VbglR0SfFsInfo returned %Rrc\n", vrc)); 591 592 Status = vbsfNtVBoxStatusToNt(vrc); 593 593 if (Status == STATUS_SUCCESS) 594 594 { 595 Log(("VBOXSF: vbsf SetEndOfFile: VbglR0SfFsInfo new allocation size = %RX64\n",595 Log(("VBOXSF: vbsfNtSetEndOfFile: VbglR0SfFsInfo new allocation size = %RX64\n", 596 596 pObjInfo->cbAllocated)); 597 597 … … 601 601 602 602 if (pObjInfo) 603 vbsf FreeNonPagedMem(pObjInfo);604 605 Log(("VBOXSF: vbsf SetEndOfFile: Returned 0x%08X\n", Status));603 vbsfNtFreeNonPagedMem(pObjInfo); 604 605 Log(("VBOXSF: vbsfNtSetEndOfFile: Returned 0x%08X\n", Status)); 606 606 return Status; 607 607 } … … 618 618 RT_NOREF(RxContext); 619 619 620 /* Note: On Windows hosts vbsf SetEndOfFile returns ACCESS_DENIED if the file has been620 /* Note: On Windows hosts vbsfNtSetEndOfFile returns ACCESS_DENIED if the file has been 621 621 * opened in APPEND mode. Writes to a file will extend it anyway, therefore it is 622 622 * better to not call the host at all and tell the caller that the file was extended. -
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/info.cpp
r78321 r78326 95 95 cbHGCMBuffer)); 96 96 97 pHGCMBuffer = (uint8_t *)vbsf AllocNonPagedMem(cbHGCMBuffer);97 pHGCMBuffer = (uint8_t *)vbsfNtAllocNonPagedMem(cbHGCMBuffer); 98 98 if (!pHGCMBuffer) 99 99 { … … 134 134 Log(("VBOXSF: MrxQueryDirectory: ParsedPathSize = %d\n", ParsedPathSize)); 135 135 136 ParsedPath = (PSHFLSTRING)vbsf AllocNonPagedMem(ParsedPathSize);136 ParsedPath = (PSHFLSTRING)vbsfNtAllocNonPagedMem(ParsedPathSize); 137 137 if (!ParsedPath) 138 138 { … … 226 226 227 227 default: 228 Status = VBoxErrorToNTStatus(vrc);228 Status = vbsfNtVBoxStatusToNt(vrc); 229 229 Log(("VBOXSF: MrxQueryDirectory: Error %Rrc from CallDirInfo (cFiles=%d)!\n", 230 230 vrc, cFiles)); … … 510 510 end: 511 511 if (pHGCMBuffer) 512 vbsf FreeNonPagedMem(pHGCMBuffer);512 vbsfNtFreeNonPagedMem(pHGCMBuffer); 513 513 514 514 if (ParsedPath) 515 vbsf FreeNonPagedMem(ParsedPath);515 vbsfNtFreeNonPagedMem(ParsedPath); 516 516 517 517 Log(("VBOXSF: MrxQueryDirectory: Returned 0x%08X\n", … … 596 596 /* Query serial number. */ 597 597 cbHGCMBuffer = sizeof(SHFLVOLINFO); 598 pHGCMBuffer = (uint8_t *)vbsf AllocNonPagedMem(cbHGCMBuffer);598 pHGCMBuffer = (uint8_t *)vbsfNtAllocNonPagedMem(cbHGCMBuffer); 599 599 if (!pHGCMBuffer) 600 600 { … … 608 608 if (vrc != VINF_SUCCESS) 609 609 { 610 Status = VBoxErrorToNTStatus(vrc);611 vbsf FreeNonPagedMem(pHGCMBuffer);610 Status = vbsfNtVBoxStatusToNt(vrc); 611 vbsfNtFreeNonPagedMem(pHGCMBuffer); 612 612 break; 613 613 } … … 615 615 pShflVolInfo = (PSHFLVOLINFO)pHGCMBuffer; 616 616 pInfo->VolumeSerialNumber = pShflVolInfo->ulSerial; 617 vbsf FreeNonPagedMem(pHGCMBuffer);617 vbsfNtFreeNonPagedMem(pHGCMBuffer); 618 618 619 619 pInfo->VolumeCreationTime.QuadPart = 0; … … 769 769 770 770 cbHGCMBuffer = sizeof(SHFLVOLINFO); 771 pHGCMBuffer = (uint8_t *)vbsf AllocNonPagedMem(cbHGCMBuffer);771 pHGCMBuffer = (uint8_t *)vbsfNtAllocNonPagedMem(cbHGCMBuffer); 772 772 if (!pHGCMBuffer) 773 773 { … … 781 781 if (vrc != VINF_SUCCESS) 782 782 { 783 Status = VBoxErrorToNTStatus(vrc);784 vbsf FreeNonPagedMem(pHGCMBuffer);783 Status = vbsfNtVBoxStatusToNt(vrc); 784 vbsfNtFreeNonPagedMem(pHGCMBuffer); 785 785 break; 786 786 } … … 814 814 } 815 815 816 vbsf FreeNonPagedMem(pHGCMBuffer);816 vbsfNtFreeNonPagedMem(pHGCMBuffer); 817 817 818 818 Status = STATUS_SUCCESS; … … 1089 1089 else 1090 1090 { 1091 Status = VBoxErrorToNTStatus(vrc);1091 Status = vbsfNtVBoxStatusToNt(vrc); 1092 1092 VbglR0PhysHeapFree(pReq); 1093 1093 break; … … 1372 1372 1373 1373 cbBuffer = sizeof(SHFLFSOBJINFO); 1374 pHGCMBuffer = (uint8_t *)vbsf AllocNonPagedMem(cbBuffer);1374 pHGCMBuffer = (uint8_t *)vbsfNtAllocNonPagedMem(cbBuffer); 1375 1375 AssertReturn(pHGCMBuffer, STATUS_INSUFFICIENT_RESOURCES); 1376 1376 RtlZeroMemory(pHGCMBuffer, cbBuffer); … … 1418 1418 else 1419 1419 { 1420 Status = VBoxErrorToNTStatus(vrc);1420 Status = vbsfNtVBoxStatusToNt(vrc); 1421 1421 goto end; 1422 1422 } … … 1432 1432 1433 1433 if (pInfo->DeleteFile && capFcb->OpenCount == 1) 1434 Status = vbsf Remove(RxContext);1434 Status = vbsfNtRemove(RxContext); 1435 1435 else 1436 1436 Status = STATUS_SUCCESS; … … 1469 1469 /* Treat the request as a EndOfFile update. */ 1470 1470 LARGE_INTEGER NewAllocationSize; 1471 Status = vbsf SetEndOfFile(RxContext, &pInfo->AllocationSize, &NewAllocationSize);1471 Status = vbsfNtSetEndOfFile(RxContext, &pInfo->AllocationSize, &NewAllocationSize); 1472 1472 } 1473 1473 … … 1483 1483 pInfo->EndOfFile.QuadPart, capFcb->Header.FileSize.QuadPart)); 1484 1484 1485 Status = vbsf SetEndOfFile(RxContext, &pInfo->EndOfFile, &NewAllocationSize);1485 Status = vbsfNtSetEndOfFile(RxContext, &pInfo->EndOfFile, &NewAllocationSize); 1486 1486 1487 1487 Log(("VBOXSF: MrxSetFileInfo: FileEndOfFileInformation: AllocSize = 0x%RX64, Status 0x%08X\n", … … 1511 1511 #endif 1512 1512 1513 Status = vbsf Rename(RxContext, FileRenameInformation, pInfoBuffer, RxContext->Info.Length);1513 Status = vbsfNtRename(RxContext, FileRenameInformation, pInfoBuffer, RxContext->Info.Length); 1514 1514 break; 1515 1515 } … … 1524 1524 end: 1525 1525 if (pHGCMBuffer) 1526 vbsf FreeNonPagedMem(pHGCMBuffer);1526 vbsfNtFreeNonPagedMem(pHGCMBuffer); 1527 1527 1528 1528 Log(("VBOXSF: MrxSetFileInfo: Returned 0x%08X\n", Status)); -
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/net.cpp
r78321 r78326 201 201 RootNameLength, RootNameLength / sizeof(WCHAR), pRootName)); 202 202 203 Status = vbsf ShflStringFromUnicodeAlloc(&ParsedPath, pRootName, (uint16_t)RootNameLength);203 Status = vbsfNtShflStringFromUnicodeAlloc(&ParsedPath, pRootName, (uint16_t)RootNameLength); 204 204 if (Status != STATUS_SUCCESS) 205 205 { … … 208 208 209 209 vrc = VbglR0SfMapFolder(&g_SfClient, ParsedPath, &pNetRootExtension->map); 210 vbsf FreeNonPagedMem(ParsedPath);210 vbsfNtFreeNonPagedMem(ParsedPath); 211 211 if (RT_SUCCESS(vrc)) 212 212 { -
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/path.cpp
r78321 r78326 141 141 142 142 /* Initialize create parameters. */ 143 pCreateParms = (SHFLCREATEPARMS *)vbsf AllocNonPagedMem(sizeof(SHFLCREATEPARMS));143 pCreateParms = (SHFLCREATEPARMS *)vbsfNtAllocNonPagedMem(sizeof(SHFLCREATEPARMS)); 144 144 if (!pCreateParms) 145 145 { … … 265 265 if (!bf.SlashHack) 266 266 { 267 Status = vbsf ShflStringFromUnicodeAlloc(&ParsedPath, RemainingName->Buffer, RemainingName->Length);267 Status = vbsfNtShflStringFromUnicodeAlloc(&ParsedPath, RemainingName->Buffer, RemainingName->Length); 268 268 if (Status != STATUS_SUCCESS) 269 269 goto failure; … … 272 272 { 273 273 /* Add back the slash we had to hide from RDBSS. */ 274 Status = vbsf ShflStringFromUnicodeAlloc(&ParsedPath, NULL, RemainingName->Length + sizeof(RTUTF16));274 Status = vbsfNtShflStringFromUnicodeAlloc(&ParsedPath, NULL, RemainingName->Length + sizeof(RTUTF16)); 275 275 if (Status != STATUS_SUCCESS) 276 276 goto failure; … … 288 288 vrc = VbglR0SfCreate(&g_SfClient, &pNetRootExtension->map, ParsedPath, pCreateParms); 289 289 290 vbsf FreeNonPagedMem(ParsedPath);290 vbsfNtFreeNonPagedMem(ParsedPath); 291 291 } 292 292 … … 321 321 { 322 322 *pulCreateAction = FILE_DOES_NOT_EXIST; 323 Status = VBoxErrorToNTStatus(vrc);323 Status = vbsfNtVBoxStatusToNt(vrc); 324 324 goto failure; 325 325 } … … 436 436 *pInfo = pCreateParms->Info; 437 437 438 vbsf FreeNonPagedMem(pCreateParms);438 vbsfNtFreeNonPagedMem(pCreateParms); 439 439 440 440 return Status; … … 452 452 453 453 if (pCreateParms) 454 vbsf FreeNonPagedMem(pCreateParms);454 vbsfNtFreeNonPagedMem(pCreateParms); 455 455 456 456 return Status; … … 689 689 690 690 cbBuffer = sizeof(SHFLFSOBJINFO); 691 pHGCMBuffer = (uint8_t *)vbsf AllocNonPagedMem(cbBuffer);691 pHGCMBuffer = (uint8_t *)vbsfNtAllocNonPagedMem(cbBuffer); 692 692 if (!pHGCMBuffer) 693 693 { … … 714 714 715 715 if (vrc != VINF_SUCCESS) 716 Status = VBoxErrorToNTStatus(vrc);716 Status = vbsfNtVBoxStatusToNt(vrc); 717 717 718 718 if (pHGCMBuffer) 719 vbsf FreeNonPagedMem(pHGCMBuffer);719 vbsfNtFreeNonPagedMem(pHGCMBuffer); 720 720 721 721 Log(("VBOXSF: vbsfSetFileInfo: Returned 0x%08X\n", Status)); … … 761 761 762 762 if (vrc != VINF_SUCCESS) 763 Status = VBoxErrorToNTStatus(vrc);763 Status = vbsfNtVBoxStatusToNt(vrc); 764 764 765 765 Log(("VBOXSF: vbsfCloseFileHandle: Returned 0x%08X\n", Status)); … … 811 811 /* Remove file or directory if delete action is pending. */ 812 812 if (capFcb->OpenCount == 0) 813 Status = vbsf Remove(RxContext);813 Status = vbsfNtRemove(RxContext); 814 814 } 815 815 … … 817 817 } 818 818 819 NTSTATUS vbsf Remove(IN PRX_CONTEXT RxContext)819 NTSTATUS vbsfNtRemove(IN PRX_CONTEXT RxContext) 820 820 { 821 821 NTSTATUS Status = STATUS_SUCCESS; … … 832 832 PSHFLSTRING ParsedPath = NULL; 833 833 834 Log(("VBOXSF: vbsf Remove: Delete %.*ls. open count = %d\n",834 Log(("VBOXSF: vbsfNtRemove: Delete %.*ls. open count = %d\n", 835 835 RemainingName->Length / sizeof(WCHAR), RemainingName->Buffer, capFcb->OpenCount)); 836 836 … … 839 839 vbsfCloseFileHandle(pNetRootExtension, pVBoxFobx); 840 840 841 Log(("VBOXSF: vbsf Remove: RemainingName->Length %d\n", RemainingName->Length));842 Status = vbsf ShflStringFromUnicodeAlloc(&ParsedPath, RemainingName->Buffer, RemainingName->Length);841 Log(("VBOXSF: vbsfNtRemove: RemainingName->Length %d\n", RemainingName->Length)); 842 Status = vbsfNtShflStringFromUnicodeAlloc(&ParsedPath, RemainingName->Buffer, RemainingName->Length); 843 843 if (Status != STATUS_SUCCESS) 844 844 return Status; … … 850 850 851 851 if (ParsedPath) 852 vbsf FreeNonPagedMem(ParsedPath);852 vbsfNtFreeNonPagedMem(ParsedPath); 853 853 854 854 if (vrc == VINF_SUCCESS) 855 855 SetFlag(capFobx->pSrvOpen->Flags, SRVOPEN_FLAG_FILE_DELETED); 856 856 857 Status = VBoxErrorToNTStatus(vrc);857 Status = vbsfNtVBoxStatusToNt(vrc); 858 858 if (vrc != VINF_SUCCESS) 859 Log(("VBOXSF: vbsf Remove: VbglR0SfRemove failed with %Rrc\n", vrc));860 861 Log(("VBOXSF: vbsf Remove: Returned 0x%08X\n", Status));859 Log(("VBOXSF: vbsfNtRemove: VbglR0SfRemove failed with %Rrc\n", vrc)); 860 861 Log(("VBOXSF: vbsfNtRemove: Returned 0x%08X\n", Status)); 862 862 return Status; 863 863 } 864 864 865 NTSTATUS vbsf Rename(IN PRX_CONTEXT RxContext,865 NTSTATUS vbsfNtRename(IN PRX_CONTEXT RxContext, 866 866 IN FILE_INFORMATION_CLASS FileInformationClass, 867 867 IN PVOID pBuffer, … … 888 888 Assert(FileInformationClass == FileRenameInformation); 889 889 890 Log(("VBOXSF: vbsf Rename: FileName = %.*ls\n",890 Log(("VBOXSF: vbsfNtRename: FileName = %.*ls\n", 891 891 RenameInformation->FileNameLength / sizeof(WCHAR), &RenameInformation->FileName[0])); 892 892 … … 898 898 SetFlag(pSrvOpen->Flags, SRVOPEN_FLAG_FILE_RENAMED); 899 899 900 Log(("VBOXSF: vbsf Rename: RenameInformation->FileNameLength = %d\n", RenameInformation->FileNameLength));901 Status = vbsf ShflStringFromUnicodeAlloc(&DestPath, RenameInformation->FileName, (uint16_t)RenameInformation->FileNameLength);900 Log(("VBOXSF: vbsfNtRename: RenameInformation->FileNameLength = %d\n", RenameInformation->FileNameLength)); 901 Status = vbsfNtShflStringFromUnicodeAlloc(&DestPath, RenameInformation->FileName, (uint16_t)RenameInformation->FileNameLength); 902 902 if (Status != STATUS_SUCCESS) 903 903 return Status; 904 904 905 Log(("VBOXSF: vbsf Rename: Destination path = %.*ls\n",905 Log(("VBOXSF: vbsfNtRename: Destination path = %.*ls\n", 906 906 DestPath->u16Length / sizeof(WCHAR), &DestPath->String.ucs2[0])); 907 907 908 Log(("VBOXSF: vbsf Rename: RemainingName->Length = %d\n", RemainingName->Length));909 Status = vbsf ShflStringFromUnicodeAlloc(&SrcPath, RemainingName->Buffer, RemainingName->Length);908 Log(("VBOXSF: vbsfNtRename: RemainingName->Length = %d\n", RemainingName->Length)); 909 Status = vbsfNtShflStringFromUnicodeAlloc(&SrcPath, RemainingName->Buffer, RemainingName->Length); 910 910 if (Status != STATUS_SUCCESS) 911 911 { 912 vbsf FreeNonPagedMem(DestPath);912 vbsfNtFreeNonPagedMem(DestPath); 913 913 return Status; 914 914 } 915 915 916 Log(("VBOXSF: vbsf Rename: Source path = %.*ls\n",916 Log(("VBOXSF: vbsfNtRename: Source path = %.*ls\n", 917 917 SrcPath->u16Length / sizeof(WCHAR), &SrcPath->String.ucs2[0])); 918 918 … … 922 922 flags |= SHFL_RENAME_REPLACE_IF_EXISTS; 923 923 924 Log(("VBOXSF: vbsf Rename: Calling VbglR0SfRename\n"));924 Log(("VBOXSF: vbsfNtRename: Calling VbglR0SfRename\n")); 925 925 vrc = VbglR0SfRename(&g_SfClient, &pNetRootExtension->map, SrcPath, DestPath, flags); 926 926 927 vbsf FreeNonPagedMem(SrcPath);928 vbsf FreeNonPagedMem(DestPath);929 930 Status = VBoxErrorToNTStatus(vrc);927 vbsfNtFreeNonPagedMem(SrcPath); 928 vbsfNtFreeNonPagedMem(DestPath); 929 930 Status = vbsfNtVBoxStatusToNt(vrc); 931 931 if (vrc != VINF_SUCCESS) 932 Log(("VBOXSF: vbsf Rename: VbglR0SfRename failed with %Rrc\n", vrc));933 934 Log(("VBOXSF: vbsf Rename: Returned 0x%08X\n", Status));932 Log(("VBOXSF: vbsfNtRename: VbglR0SfRename failed with %Rrc\n", vrc)); 933 934 Log(("VBOXSF: vbsfNtRename: Returned 0x%08X\n", Status)); 935 935 return Status; 936 936 } -
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/vbsf.cpp
r78321 r78326 76 76 PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation(Irp); 77 77 Log(("VBOXSF: MRxFsdDispatch: major %d, minor %d: %s\n", 78 IrpSp->MajorFunction, IrpSp->MinorFunction, MajorFunctionString(IrpSp->MajorFunction, IrpSp->MinorFunction)));78 IrpSp->MajorFunction, IrpSp->MinorFunction, vbsfNtMajorFunctionName(IrpSp->MajorFunction, IrpSp->MinorFunction))); 79 79 #endif 80 80 … … 752 752 { 753 753 Log(("VBOXSF: MRxDevFcbXXXControlFile: IOCTL_MRX_VBOX_ADDCONN\n")); 754 Status = vbsf CreateConnection(RxContext, &RxContext->PostRequest);754 Status = vbsfNtCreateConnection(RxContext, &RxContext->PostRequest); 755 755 break; 756 756 } … … 759 759 { 760 760 Log(("VBOXSF: MRxDevFcbXXXControlFile: IOCTL_MRX_VBOX_DELCONN\n")); 761 Status = vbsf DeleteConnection(RxContext, &RxContext->PostRequest);761 Status = vbsfNtDeleteConnection(RxContext, &RxContext->PostRequest); 762 762 break; 763 763 } … … 851 851 else 852 852 { 853 Status = VBoxErrorToNTStatus(vrc);853 Status = vbsfNtVBoxStatusToNt(vrc); 854 854 Log(("VBOXSF: MRxDevFcbXXXControlFile: IOCTL_MRX_VBOX_GETGLOBALLIST failed: 0x%08X\n", 855 855 Status)); … … 969 969 970 970 /* Allocate empty string where the host can store cbRemoteName bytes. */ 971 Status = vbsf ShflStringFromUnicodeAlloc(&pString, NULL, (uint16_t)cbRemoteName);971 Status = vbsfNtShflStringFromUnicodeAlloc(&pString, NULL, (uint16_t)cbRemoteName); 972 972 if (Status != STATUS_SUCCESS) 973 973 break; … … 999 999 } 1000 1000 1001 vbsf FreeNonPagedMem(pString);1001 vbsfNtFreeNonPagedMem(pString); 1002 1002 1003 1003 break; … … 1272 1272 } 1273 1273 1274 NTSTATUS vbsf CreateConnection(IN PRX_CONTEXT RxContext, OUT PBOOLEAN PostToFsp)1274 NTSTATUS vbsfNtCreateConnection(IN PRX_CONTEXT RxContext, OUT PBOOLEAN PostToFsp) 1275 1275 { 1276 1276 NTSTATUS Status = STATUS_SUCCESS; … … 1287 1287 BOOLEAN fMutexAcquired = FALSE; 1288 1288 1289 Log(("VBOXSF: vbsf CreateConnection\n"));1289 Log(("VBOXSF: vbsfNtCreateConnection\n")); 1290 1290 1291 1291 if (!BooleanFlagOn(RxContext->Flags, RX_CONTEXT_FLAG_WAIT)) 1292 1292 { 1293 Log(("VBOXSF: vbsf CreateConnection: post to file system process\n"));1293 Log(("VBOXSF: vbsfNtCreateConnection: post to file system process\n")); 1294 1294 *PostToFsp = TRUE; 1295 1295 return STATUS_PENDING; … … 1306 1306 if (cbConnectName == 0 || !pwcConnectName) 1307 1307 { 1308 Log(("VBOXSF: vbsf CreateConnection: Connection name / length is invalid!\n"));1308 Log(("VBOXSF: vbsfNtCreateConnection: Connection name / length is invalid!\n")); 1309 1309 return STATUS_INVALID_PARAMETER; 1310 1310 } … … 1312 1312 __try 1313 1313 { 1314 Log(("VBOXSF: vbsf CreateConnection: Name = %.*ls, Len = %d\n",1314 Log(("VBOXSF: vbsfNtCreateConnection: Name = %.*ls, Len = %d\n", 1315 1315 cbConnectName / sizeof(WCHAR), pwcConnectName, cbConnectName)); 1316 1316 … … 1347 1347 if (idx >= RTL_NUMBER_OF(pDeviceExtension->cLocalConnections)) 1348 1348 { 1349 Log(("VBOXSF: vbsf CreateConnection: Index 0x%x is invalid!\n",1349 Log(("VBOXSF: vbsfNtCreateConnection: Index 0x%x is invalid!\n", 1350 1350 idx)); 1351 1351 Status = STATUS_BAD_NETWORK_NAME; … … 1358 1358 if (pDeviceExtension->wszLocalConnectionName[idx] != NULL) 1359 1359 { 1360 Log(("VBOXSF: vbsf CreateConnection: LocalConnectionName at index %d is NOT empty!\n",1360 Log(("VBOXSF: vbsfNtCreateConnection: LocalConnectionName at index %d is NOT empty!\n", 1361 1361 idx)); 1362 1362 } 1363 1363 1364 pDeviceExtension->wszLocalConnectionName[idx] = (PUNICODE_STRING)vbsf AllocNonPagedMem(sizeof(UNICODE_STRING) + cbConnectName);1364 pDeviceExtension->wszLocalConnectionName[idx] = (PUNICODE_STRING)vbsfNtAllocNonPagedMem(sizeof(UNICODE_STRING) + cbConnectName); 1365 1365 1366 1366 if (!pDeviceExtension->wszLocalConnectionName[idx]) 1367 1367 { 1368 Log(("VBOXSF: vbsf CreateConnection: LocalConnectionName at index %d NOT allocated!\n",1368 Log(("VBOXSF: vbsfNtCreateConnection: LocalConnectionName at index %d NOT allocated!\n", 1369 1369 idx)); 1370 1370 Status = STATUS_INSUFFICIENT_RESOURCES; … … 1379 1379 RtlCopyMemory(&pRemoteName->Buffer[0], pwc+2, pRemoteName->Length); 1380 1380 1381 Log(("VBOXSF: vbsf CreateConnection: RemoteName %.*ls, Len = %d\n",1381 Log(("VBOXSF: vbsfNtCreateConnection: RemoteName %.*ls, Len = %d\n", 1382 1382 pRemoteName->Length / sizeof(WCHAR), pRemoteName->Buffer, pRemoteName->Length)); 1383 1383 … … 1392 1392 else 1393 1393 { 1394 Log(("VBOXSF: vbsf CreateConnection: bad format\n"));1394 Log(("VBOXSF: vbsfNtCreateConnection: bad format\n")); 1395 1395 Status = STATUS_BAD_NETWORK_NAME; 1396 1396 } … … 1398 1398 else 1399 1399 { 1400 Log(("VBOXSF: vbsf CreateConnection: connection was not found\n"));1400 Log(("VBOXSF: vbsfNtCreateConnection: connection was not found\n")); 1401 1401 Status = STATUS_BAD_NETWORK_NAME; 1402 1402 } … … 1416 1416 } 1417 1417 1418 NTSTATUS vbsf DeleteConnection(IN PRX_CONTEXT RxContext, OUT PBOOLEAN PostToFsp)1418 NTSTATUS vbsfNtDeleteConnection(IN PRX_CONTEXT RxContext, OUT PBOOLEAN PostToFsp) 1419 1419 { 1420 1420 NTSTATUS Status; … … 1428 1428 BOOLEAN fMutexAcquired = FALSE; 1429 1429 1430 Log(("VBOXSF: vbsf DeleteConnection\n"));1430 Log(("VBOXSF: vbsfNtDeleteConnection\n")); 1431 1431 1432 1432 if (!BooleanFlagOn(RxContext->Flags, RX_CONTEXT_FLAG_WAIT)) 1433 1433 { 1434 Log(("VBOXSF: vbsf DeleteConnection: post to file system process\n"));1434 Log(("VBOXSF: vbsfNtDeleteConnection: post to file system process\n")); 1435 1435 *PostToFsp = TRUE; 1436 1436 return STATUS_PENDING; … … 1447 1447 __try 1448 1448 { 1449 Log(("VBOXSF: vbsf DeleteConnection: pwcConnectName = %.*ls\n",1449 Log(("VBOXSF: vbsfNtDeleteConnection: pwcConnectName = %.*ls\n", 1450 1450 cbConnectName / sizeof(WCHAR), pwcConnectName)); 1451 1451 … … 1460 1460 Status = ObReferenceObjectByHandle(Handle, 0L, NULL, KernelMode, (PVOID *)&pFileObject, NULL); 1461 1461 1462 Log(("VBOXSF: vbsf DeleteConnection: ObReferenceObjectByHandle Status 0x%08X\n",1462 Log(("VBOXSF: vbsfNtDeleteConnection: ObReferenceObjectByHandle Status 0x%08X\n", 1463 1463 Status)); 1464 1464 … … 1466 1466 { 1467 1467 PFOBX Fobx = (PFOBX)pFileObject->FsContext2; 1468 Log(("VBOXSF: vbsf DeleteConnection: Fobx %p\n", Fobx));1468 Log(("VBOXSF: vbsfNtDeleteConnection: Fobx %p\n", Fobx)); 1469 1469 1470 1470 if (Fobx && NodeType(Fobx) == RDBSS_NTC_V_NETROOT) … … 1480 1480 else 1481 1481 { 1482 Log(("VBOXSF: vbsf DeleteConnection: wrong FsContext2\n"));1482 Log(("VBOXSF: vbsfNtDeleteConnection: wrong FsContext2\n")); 1483 1483 Status = STATUS_INVALID_DEVICE_REQUEST; 1484 1484 } … … 1515 1515 if (idx >= RTL_NUMBER_OF(pDeviceExtension->cLocalConnections)) 1516 1516 { 1517 Log(("VBOXSF: vbsf DeleteConnection: Index 0x%x is invalid!\n",1517 Log(("VBOXSF: vbsfNtDeleteConnection: Index 0x%x is invalid!\n", 1518 1518 idx)); 1519 1519 Status = STATUS_BAD_NETWORK_NAME; … … 1529 1529 if (pDeviceExtension->wszLocalConnectionName[idx]) 1530 1530 { 1531 vbsf FreeNonPagedMem(pDeviceExtension->wszLocalConnectionName[idx]);1531 vbsfNtFreeNonPagedMem(pDeviceExtension->wszLocalConnectionName[idx]); 1532 1532 pDeviceExtension->wszLocalConnectionName[idx] = NULL; 1533 1533 } … … 1536 1536 fMutexAcquired = FALSE; 1537 1537 1538 Log(("VBOXSF: vbsf DeleteConnection: deleted index 0x%x\n",1538 Log(("VBOXSF: vbsfNtDeleteConnection: deleted index 0x%x\n", 1539 1539 idx)); 1540 1540 } … … 1543 1543 else 1544 1544 { 1545 Log(("VBOXSF: vbsf CreateConnection: bad format\n"));1545 Log(("VBOXSF: vbsfNtCreateConnection: bad format\n")); 1546 1546 Status = STATUS_BAD_NETWORK_NAME; 1547 1547 } … … 1560 1560 } 1561 1561 1562 Log(("VBOXSF: vbsf DeleteConnection: Status 0x%08X\n", Status));1562 Log(("VBOXSF: vbsfNtDeleteConnection: Status 0x%08X\n", Status)); 1563 1563 return Status; 1564 1564 } -
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/vbsf.h
r78321 r78326 213 213 * @{ 214 214 */ 215 NTSTATUS vbsf DeleteConnection(IN PRX_CONTEXT RxContext,216 OUT PBOOLEAN PostToFsp);217 NTSTATUS vbsf CreateConnection(IN PRX_CONTEXT RxContext,218 OUT PBOOLEAN PostToFsp);219 220 NTSTATUS vbsf SetEndOfFile(IN OUT struct _RX_CONTEXT * RxContext,221 IN OUT PLARGE_INTEGER pNewFileSize,222 OUT PLARGE_INTEGER pNewAllocationSize);223 NTSTATUS vbsf Rename(IN PRX_CONTEXT RxContext,224 IN FILE_INFORMATION_CLASS FileInformationClass,225 IN PVOID pBuffer,226 IN ULONG BufferLength);227 NTSTATUS vbsf Remove(IN PRX_CONTEXT RxContext);215 NTSTATUS vbsfNtDeleteConnection(IN PRX_CONTEXT RxContext, 216 OUT PBOOLEAN PostToFsp); 217 NTSTATUS vbsfNtCreateConnection(IN PRX_CONTEXT RxContext, 218 OUT PBOOLEAN PostToFsp); 219 220 NTSTATUS vbsfNtSetEndOfFile(IN OUT struct _RX_CONTEXT * RxContext, 221 IN OUT PLARGE_INTEGER pNewFileSize, 222 OUT PLARGE_INTEGER pNewAllocationSize); 223 NTSTATUS vbsfNtRename(IN PRX_CONTEXT RxContext, 224 IN FILE_INFORMATION_CLASS FileInformationClass, 225 IN PVOID pBuffer, 226 IN ULONG BufferLength); 227 NTSTATUS vbsfNtRemove(IN PRX_CONTEXT RxContext); 228 228 229 229 void vbsfNtCopyInfoToLegacy(PMRX_VBOX_FOBX pVBoxFobx, PCSHFLFSOBJINFO pInfo); … … 231 231 232 232 233 NTSTATUS vbsfHlpCreateDriveLetter(WCHAR Letter, UNICODE_STRING *pDeviceName); 234 NTSTATUS vbsfHlpDeleteDriveLetter(WCHAR Letter); 235 NTSTATUS VBoxErrorToNTStatus(int vrc); 236 237 PVOID vbsfAllocNonPagedMem(ULONG ulSize); 238 void vbsfFreeNonPagedMem(PVOID lpMem); 233 NTSTATUS vbsfNtVBoxStatusToNt(int vrc); 234 235 PVOID vbsfNtAllocNonPagedMem(ULONG ulSize); 236 void vbsfNtFreeNonPagedMem(PVOID lpMem); 239 237 240 238 #if defined(DEBUG) || defined(LOG_ENABLED) 241 PCHAR MajorFunctionString(UCHAR MajorFunction, LONG MinorFunction);239 const char *vbsfNtMajorFunctionName(UCHAR MajorFunction, LONG MinorFunction); 242 240 #endif 243 241 244 NTSTATUS vbsf ShflStringFromUnicodeAlloc(PSHFLSTRING *ppShflString, const WCHAR *pwc, uint16_t cb);242 NTSTATUS vbsfNtShflStringFromUnicodeAlloc(PSHFLSTRING *ppShflString, const WCHAR *pwc, uint16_t cb); 245 243 246 244 /** -
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/vbsfhlp.cpp
r78321 r78326 28 28 *********************************************************************************************************************************/ 29 29 #ifdef DEBUG 30 static int s_iAllocRefCount= 0;30 static int volatile g_cAllocations = 0; 31 31 #endif 32 32 33 34 NTSTATUS vbsfHlpCreateDriveLetter(WCHAR Letter, UNICODE_STRING *pDeviceName)35 {36 UNICODE_STRING driveName;37 RtlInitUnicodeString(&driveName,L"\\??\\_:" );38 39 /* Replace '_' with actual drive letter */40 driveName.Buffer[driveName.Length/sizeof(WCHAR) - 2] = Letter;41 42 return IoCreateSymbolicLink(&driveName, pDeviceName);43 }44 45 NTSTATUS vbsfHlpDeleteDriveLetter(WCHAR Letter)46 {47 UNICODE_STRING driveName;48 RtlInitUnicodeString(&driveName,L"\\??\\_:" );49 50 /* Replace '_' with actual drive letter */51 driveName.Buffer[driveName.Length/sizeof(WCHAR) - 2] = Letter;52 53 return IoDeleteSymbolicLink(&driveName);54 }55 33 56 34 /** … … 61 39 * 62 40 */ 63 NTSTATUS VBoxErrorToNTStatus(int vrc)41 NTSTATUS vbsfNtVBoxStatusToNt(int vrc) 64 42 { 65 43 NTSTATUS Status; … … 147 125 148 126 default: 149 /** @todo error handling */150 127 Status = STATUS_INVALID_PARAMETER; 151 128 Log(("Unexpected vbox error %Rrc\n", … … 156 133 } 157 134 158 PVOID vbsfAllocNonPagedMem(ULONG ulSize) 159 { 160 PVOID pMemory = NULL; 161 135 /** 136 * Wrapper around ExAllocatePoolWithTag. 137 */ 138 PVOID vbsfNtAllocNonPagedMem(ULONG cbMemory) 139 { 140 /* Tag is reversed (a.k.a "SHFL") to display correctly in debuggers, so search for "SHFL" */ 141 PVOID pMemory = ExAllocatePoolWithTag(NonPagedPool, cbMemory, 'LFHS'); 142 if (NULL != pMemory) 143 { 144 RtlZeroMemory(pMemory, cbMemory); 162 145 #ifdef DEBUG 163 s_iAllocRefCount = s_iAllocRefCount +1;164 Log(("vbsfAllocNonPagedMem: RefCnt after incrementing: %d\n", s_iAllocRefCount));146 int const cAllocations = g_cAllocations += 1; 147 Log(("vbsfNtAllocNonPagedMem: Allocated %u bytes of memory at %p (g_iAllocRefCount=%d)\n", cbMemory, pMemory, cAllocations)); 165 148 #endif 166 167 /* Tag is reversed (a.k.a "SHFL") to display correctly in debuggers, so search for "SHFL" */ 168 pMemory = ExAllocatePoolWithTag(NonPagedPool, ulSize, 'LFHS'); 169 170 if (NULL != pMemory) 171 { 172 RtlZeroMemory(pMemory, ulSize); 149 } 173 150 #ifdef DEBUG 174 Log(("vbsfAllocNonPagedMem: Allocated %d bytes of memory at %p.\n", ulSize, pMemory)); 151 else 152 Log(("vbsfNtAllocNonPagedMem: ERROR: Could not allocate %u bytes of memory!\n", cbMemory)); 175 153 #endif 154 return pMemory; 155 } 156 157 /** 158 * Wrapper around ExFreePoolWithTag. 159 */ 160 void vbsfNtFreeNonPagedMem(PVOID pvMemory) 161 { 162 #ifdef DEBUG 163 int cAllocations = g_cAllocations -= 1; 164 Log(("vbsfNtFreeNonPagedMem: %p (g_cAllocations=%d)\n", pvMemory, cAllocations)); 165 #endif 166 AssertPtr(pvMemory); 167 168 /* Tagged allocations must be freed using the same tag as used when allocating the memory. */ 169 ExFreePoolWithTag(pvMemory, 'LFHS'); 170 } 171 172 /** Allocate and initialize a SHFLSTRING from a UNICODE string. 173 * 174 * @param ppShflString Where to store the pointer to the allocated SHFLSTRING structure. 175 * The structure must be deallocated with vbsfNtFreeNonPagedMem. 176 * @param pwc The UNICODE string. If NULL then SHFL is only allocated. 177 * @param cb Size of the UNICODE string in bytes without the trailing nul. 178 * 179 * @return Status code. 180 */ 181 NTSTATUS vbsfNtShflStringFromUnicodeAlloc(PSHFLSTRING *ppShflString, const WCHAR *pwc, uint16_t cb) 182 { 183 NTSTATUS Status; 184 185 /* Calculate length required for the SHFL structure: header + chars + nul. */ 186 ULONG const cbShflString = SHFLSTRING_HEADER_SIZE + cb + sizeof(WCHAR); 187 PSHFLSTRING pShflString = (PSHFLSTRING)vbsfNtAllocNonPagedMem(cbShflString); 188 if (pShflString) 189 { 190 if (ShflStringInitBuffer(pShflString, cbShflString)) 191 { 192 if (pwc) 193 { 194 RtlCopyMemory(pShflString->String.ucs2, pwc, cb); 195 pShflString->String.ucs2[cb / sizeof(WCHAR)] = 0; 196 pShflString->u16Length = cb; /* without terminating null */ 197 AssertMsg(pShflString->u16Length + sizeof(WCHAR) == pShflString->u16Size, 198 ("u16Length %d, u16Size %d\n", pShflString->u16Length, pShflString->u16Size)); 199 } 200 else 201 { 202 /** @todo r=bird: vbsfNtAllocNonPagedMem already zero'ed it... */ 203 RtlZeroMemory(pShflString->String.ucs2, cb + sizeof(WCHAR)); 204 pShflString->u16Length = 0; /* without terminating null */ 205 AssertMsg(pShflString->u16Size >= sizeof(WCHAR), 206 ("u16Size %d\n", pShflString->u16Size)); 207 } 208 209 *ppShflString = pShflString; 210 Status = STATUS_SUCCESS; 211 } 212 else 213 { 214 vbsfNtFreeNonPagedMem(pShflString); 215 Status = STATUS_INSUFFICIENT_RESOURCES; 216 } 176 217 } 177 218 else 178 { 179 #ifdef DEBUG 180 Log(("vbsfAllocNonPagedMem: ERROR: Could not allocate %d bytes of memory!\n", ulSize)); 181 #endif 182 } 183 184 return pMemory; 185 } 186 187 void vbsfFreeNonPagedMem(PVOID lpMem) 188 { 189 #ifdef DEBUG 190 s_iAllocRefCount = s_iAllocRefCount - 1; 191 Log(("vbsfFreeNonPagedMem: RefCnt after decrementing: %d\n", s_iAllocRefCount)); 192 #endif 193 194 Assert(lpMem); 195 196 /* MSDN: The ExFreePoolWithTag routine issues a bug check if the specified value for Tag does not match the tag value passed 197 to the routine that originally allocated the memory block. Otherwise, the behavior of this routine is identical to ExFreePool. */ 198 ExFreePoolWithTag(lpMem, 'LFHS'); 199 lpMem = NULL; 200 } 201 202 #if 0 //def DEBUG 203 /** 204 * Callback for RTLogFormatV which writes to the backdoor. 205 * See PFNLOGOUTPUT() for details. 206 */ 207 static DECLCALLBACK(size_t) rtLogBackdoorOutput(void *pv, const char *pachChars, size_t cbChars) 208 { 209 RTLogWriteUser(pachChars, cbChars); 210 return cbChars; 211 } 212 213 int RTLogBackdoorPrintf1(const char *pszFormat, ...) 214 { 215 va_list args; 216 217 LARGE_INTEGER time; 218 219 KeQueryTickCount(&time); 220 221 RTLogBackdoorPrintf("T=%RX64 ", time.QuadPart); 222 va_start(args, pszFormat); 223 RTLogFormatV(rtLogBackdoorOutput, NULL, pszFormat, args); 224 va_end(args); 225 226 return 0; 227 } 228 #endif 219 Status = STATUS_INSUFFICIENT_RESOURCES; 220 221 return Status; 222 } 229 223 230 224 #if defined(DEBUG) || defined(LOG_ENABLED) 231 225 232 static PCHAR PnPMinorFunctionString(LONG MinorFunction) 226 /** Debug routine for translating a minor PNP function to a string. */ 227 static const char *vbsfNtMinorPnpFunctionName(LONG MinorFunction) 233 228 { 234 229 switch (MinorFunction) … … 285 280 } 286 281 287 PCHAR MajorFunctionString(UCHAR MajorFunction, LONG MinorFunction) 282 /** Debug routine for translating a major+minor IPR function to a string. */ 283 const char *vbsfNtMajorFunctionName(UCHAR MajorFunction, LONG MinorFunction) 288 284 { 289 285 switch (MajorFunction) 290 286 { 291 case IRP_MJ_CREATE: 292 return "IRP_MJ_CREATE"; 293 case IRP_MJ_CREATE_NAMED_PIPE: 294 return "IRP_MJ_CREATE_NAMED_PIPE"; 295 case IRP_MJ_CLOSE: 296 return "IRP_MJ_CLOSE"; 297 case IRP_MJ_READ: 298 return "IRP_MJ_READ"; 299 case IRP_MJ_WRITE: 300 return "IRP_MJ_WRITE"; 301 case IRP_MJ_QUERY_INFORMATION: 302 return "IRP_MJ_QUERY_INFORMATION"; 303 case IRP_MJ_SET_INFORMATION: 304 return "IRP_MJ_SET_INFORMATION"; 305 case IRP_MJ_QUERY_EA: 306 return "IRP_MJ_QUERY_EA"; 307 case IRP_MJ_SET_EA: 308 return "IRP_MJ_SET_EA"; 309 case IRP_MJ_FLUSH_BUFFERS: 310 return "IRP_MJ_FLUSH_BUFFERS"; 311 case IRP_MJ_QUERY_VOLUME_INFORMATION: 312 return "IRP_MJ_QUERY_VOLUME_INFORMATION"; 313 case IRP_MJ_SET_VOLUME_INFORMATION: 314 return "IRP_MJ_SET_VOLUME_INFORMATION"; 315 case IRP_MJ_DIRECTORY_CONTROL: 316 return "IRP_MJ_DIRECTORY_CONTROL"; 317 case IRP_MJ_FILE_SYSTEM_CONTROL: 318 return "IRP_MJ_FILE_SYSTEM_CONTROL"; 319 case IRP_MJ_DEVICE_CONTROL: 320 return "IRP_MJ_DEVICE_CONTROL"; 321 case IRP_MJ_INTERNAL_DEVICE_CONTROL: 322 return "IRP_MJ_INTERNAL_DEVICE_CONTROL"; 323 case IRP_MJ_SHUTDOWN: 324 return "IRP_MJ_SHUTDOWN"; 325 case IRP_MJ_LOCK_CONTROL: 326 return "IRP_MJ_LOCK_CONTROL"; 327 case IRP_MJ_CLEANUP: 328 return "IRP_MJ_CLEANUP"; 329 case IRP_MJ_CREATE_MAILSLOT: 330 return "IRP_MJ_CREATE_MAILSLOT"; 331 case IRP_MJ_QUERY_SECURITY: 332 return "IRP_MJ_QUERY_SECURITY"; 333 case IRP_MJ_SET_SECURITY: 334 return "IRP_MJ_SET_SECURITY"; 335 case IRP_MJ_POWER: 336 return "IRP_MJ_POWER"; 337 case IRP_MJ_SYSTEM_CONTROL: 338 return "IRP_MJ_SYSTEM_CONTROL"; 339 case IRP_MJ_DEVICE_CHANGE: 340 return "IRP_MJ_DEVICE_CHANGE"; 341 case IRP_MJ_QUERY_QUOTA: 342 return "IRP_MJ_QUERY_QUOTA"; 343 case IRP_MJ_SET_QUOTA: 344 return "IRP_MJ_SET_QUOTA"; 287 RT_CASE_RET_STR(IRP_MJ_CREATE); 288 RT_CASE_RET_STR(IRP_MJ_CREATE_NAMED_PIPE); 289 RT_CASE_RET_STR(IRP_MJ_CLOSE); 290 RT_CASE_RET_STR(IRP_MJ_READ); 291 RT_CASE_RET_STR(IRP_MJ_WRITE); 292 RT_CASE_RET_STR(IRP_MJ_QUERY_INFORMATION); 293 RT_CASE_RET_STR(IRP_MJ_SET_INFORMATION); 294 RT_CASE_RET_STR(IRP_MJ_QUERY_EA); 295 RT_CASE_RET_STR(IRP_MJ_SET_EA); 296 RT_CASE_RET_STR(IRP_MJ_FLUSH_BUFFERS); 297 RT_CASE_RET_STR(IRP_MJ_QUERY_VOLUME_INFORMATION); 298 RT_CASE_RET_STR(IRP_MJ_SET_VOLUME_INFORMATION); 299 RT_CASE_RET_STR(IRP_MJ_DIRECTORY_CONTROL); 300 RT_CASE_RET_STR(IRP_MJ_FILE_SYSTEM_CONTROL); 301 RT_CASE_RET_STR(IRP_MJ_DEVICE_CONTROL); 302 RT_CASE_RET_STR(IRP_MJ_INTERNAL_DEVICE_CONTROL); 303 RT_CASE_RET_STR(IRP_MJ_SHUTDOWN); 304 RT_CASE_RET_STR(IRP_MJ_LOCK_CONTROL); 305 RT_CASE_RET_STR(IRP_MJ_CLEANUP); 306 RT_CASE_RET_STR(IRP_MJ_CREATE_MAILSLOT); 307 RT_CASE_RET_STR(IRP_MJ_QUERY_SECURITY); 308 RT_CASE_RET_STR(IRP_MJ_SET_SECURITY); 309 RT_CASE_RET_STR(IRP_MJ_POWER); 310 RT_CASE_RET_STR(IRP_MJ_SYSTEM_CONTROL); 311 RT_CASE_RET_STR(IRP_MJ_DEVICE_CHANGE); 312 RT_CASE_RET_STR(IRP_MJ_QUERY_QUOTA); 313 RT_CASE_RET_STR(IRP_MJ_SET_QUOTA); 345 314 case IRP_MJ_PNP: 346 return PnPMinorFunctionString(MinorFunction); 347 315 return vbsfNtMinorPnpFunctionName(MinorFunction); 348 316 default: 349 return " unknown_pnp_irp";317 return "IRP_MJ_UNKNOWN"; 350 318 } 351 319 } … … 353 321 #endif /* DEBUG || LOG_ENABLED */ 354 322 355 /** Allocate and initialize a SHFLSTRING from a UNICODE string.356 *357 * @param ppShflString Where to store the pointer to the allocated SHFLSTRING structure.358 * The structure must be deallocated with vbsfFreeNonPagedMem.359 * @param pwc The UNICODE string. If NULL then SHFL is only allocated.360 * @param cb Size of the UNICODE string in bytes without the trailing nul.361 *362 * @return Status code.363 */364 NTSTATUS vbsfShflStringFromUnicodeAlloc(PSHFLSTRING *ppShflString, const WCHAR *pwc, uint16_t cb)365 {366 NTSTATUS Status = STATUS_SUCCESS;367 368 PSHFLSTRING pShflString;369 ULONG cbShflString;370 371 /* Calculate length required for the SHFL structure: header + chars + nul. */372 cbShflString = SHFLSTRING_HEADER_SIZE + cb + sizeof(WCHAR);373 pShflString = (PSHFLSTRING)vbsfAllocNonPagedMem(cbShflString);374 if (pShflString)375 {376 if (ShflStringInitBuffer(pShflString, cbShflString))377 {378 if (pwc)379 {380 RtlCopyMemory(pShflString->String.ucs2, pwc, cb);381 pShflString->String.ucs2[cb / sizeof(WCHAR)] = 0;382 pShflString->u16Length = cb; /* without terminating null */383 AssertMsg(pShflString->u16Length + sizeof(WCHAR) == pShflString->u16Size,384 ("u16Length %d, u16Size %d\n", pShflString->u16Length, pShflString->u16Size));385 }386 else387 {388 /** @todo r=bird: vbsfAllocNonPagedMem already zero'ed it... */389 RtlZeroMemory(pShflString->String.ucs2, cb + sizeof(WCHAR));390 pShflString->u16Length = 0; /* without terminating null */391 AssertMsg(pShflString->u16Size >= sizeof(WCHAR),392 ("u16Size %d\n", pShflString->u16Size));393 }394 395 *ppShflString = pShflString;396 }397 else398 {399 vbsfFreeNonPagedMem(pShflString);400 Status = STATUS_INSUFFICIENT_RESOURCES;401 }402 }403 else404 {405 Status = STATUS_INSUFFICIENT_RESOURCES;406 }407 408 return Status;409 }
Note:
See TracChangeset
for help on using the changeset viewer.