MCPcopy Create free account
hub / github.com/bobranten/Ext4Fsd / Ex2ProcessMountPoint

Function Ex2ProcessMountPoint

Ext4Fsd/devctl.c:695–753  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

693}
694
695NTSTATUS
696Ex2ProcessMountPoint(
697 IN PEXT2_IRP_CONTEXT IrpContext,
698 IN PEXT2_MOUNT_POINT MountPoint,
699 IN ULONG Length
700)
701{
702 UNICODE_STRING Link;
703 UNICODE_STRING Target;
704 WCHAR Buffer[] = L"\\DosDevices\\Global\\Z:";
705 NTSTATUS status = STATUS_SUCCESS;
706
707 PDEVICE_OBJECT DeviceObject = NULL;
708
709 __try {
710
711 ASSERT(IrpContext != NULL);
712 ASSERT((IrpContext->Identifier.Type == EXT2ICX) &&
713 (IrpContext->Identifier.Size == sizeof(EXT2_IRP_CONTEXT)));
714
715 DeviceObject = IrpContext->DeviceObject;
716 if (!IsExt2FsDevice(DeviceObject)) {
717 status = STATUS_INVALID_PARAMETER;
718 __leave;
719 }
720
721 if (Length != sizeof(EXT2_MOUNT_POINT) ||
722 MountPoint->Magic != EXT2_APP_MOUNTPOINT_MAGIC) {
723 status = STATUS_INVALID_PARAMETER;
724 __leave;
725 }
726
727 RtlInitUnicodeString(&Link, Buffer);
728 Buffer[12] = MountPoint->Link[0];
729
730 switch (MountPoint->Command) {
731
732 case APP_CMD_ADD_DOS_SYMLINK:
733 RtlInitUnicodeString(&Target, &MountPoint->Name[0]);
734 status = IoCreateSymbolicLink(&Link, &Target);
735 break;
736
737 case APP_CMD_DEL_DOS_SYMLINK:
738 status = IoDeleteSymbolicLink(&Link);
739 break;
740
741 default:
742 status = STATUS_INVALID_PARAMETER;
743 }
744
745 } __finally {
746
747 if (!IrpContext->ExceptionInProgress) {
748 Ext2CompleteIrpContext(IrpContext, status);
749 }
750 }
751
752 return status;

Callers 1

Ext2DeviceControlFunction · 0.85

Calls 1

Ext2CompleteIrpContextFunction · 0.85

Tested by

no test coverage detected