阅读:2347回复:1
求助自写虚拟磁盘 回应MOUNTMGR的IOCTL_MOUNTDEV_QUERY_DEVICE_NAME
自写虚拟磁盘 回应MOUNTMGR的IOCTL_MOUNTDEV_QUERY_DEVICE_NAME 但是MOUNTMGR并不给予足够长BUFFER为什么?
代码如下 case IOCTL_MOUNTDEV_QUERY_DEVICE_NAME: { PMOUNTDEV_NAME mountName = Irp->AssociatedIrp.SystemBuffer; ULONG Retlength = 0; WCHAR tmp[256] = {0}; UNICODE_STRING ntUnicodeString; if (irpSp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(MOUNTDEV_NAME)) return DouboxRequestComplete(DeviceObject, Irp, STATUS_BUFFER_OVERFLOW, sizeof (MOUNTDEV_NAME)); G_SptDynamicFunction.sptSnwprintf( tmp, 256, L"\\DosDevices\\%wc:", volumeDeviceExtension->driveLetter); RtlInitUnicodeString (&ntUnicodeString, tmp); mountName->NameLength = ntUnicodeString.Length; Retlength = ntUnicodeString.Length + sizeof(USHORT); if (irpSp->Parameters.DeviceIoControl.OutputBufferLength < Retlength) { return DouboxRequestComplete(DeviceObject, Irp, STATUS_BUFFER_OVERFLOW, sizeof (MOUNTDEV_NAME)); } RtlCopyMemory ((PCHAR)mountName->Name,ntUnicodeString.Buffer, ntUnicodeString.Length); return DouboxRequestComplete(DeviceObject, Irp, STATUS_SUCCESS, Retlength); } 每次给予的OUTBUFFER长度都是4 |
|
沙发#
发布于:2012-02-13 10:48
飘过
|
|