1. WDK7600里的ramdisk示例只实现1M的虚拟内存,改了ramdisk.inx和ramdisk.h里的内存设置,比如32M,还是不行。
2. 想实现加密存储,为了查看效果,先试图在写文件时加密,修改ramdisk.c中的RamDiskEvtIoWrite函数,但加载后蓝屏。
VOIDRamDiskEvtIoWrite( IN WDFQUEUE Queue, IN WDFREQUEST Request, IN size_t Length ){ PDEVICE_EXTENSION devExt = QueueGetExtension(Queue)->DeviceExtension; NTSTATUS Status = STATUS_INVALID_PARAMETER; WDF_REQUEST_PARAMETERS Parameters; LARGE_INTEGER ByteOffset; WDFMEMORY hMemory; //时间2010年4月21日12:52:03 PVOID buf_XOR_13=0; unsigned char *p_Byte=0; unsigned int count=0;
__analysis_assume(Length > 0);
WDF_REQUEST_PARAMETERS_INIT(&Parameters); WdfRequestGetParameters(Request, &Parameters);
ByteOffset.QuadPart = Parameters.Parameters.Write.DeviceOffset;
if (RamDiskCheckParameters(devExt, ByteOffset, Length)) {
Status = WdfRequestRetrieveInputMemory(Request, &hMemory); if(NT_SUCCESS(Status)){ //时间 2010年4月21日12:44:25 //写入时加密,异或0x13H
//Status = WdfMemoryCopyToBuffer(hMemory, // Source // 0, // offset in Source memory where the copy has to start // devExt->DiskImage + ByteOffset.LowPart, // destination // Length); buf_XOR_13=ExAllocatePoolWithTag(NonPagedPool, Length, RAMDISK_TAG); Status = WdfMemoryCopyToBuffer(hMemory, // Source 0, // offset in Source memory where the copy has to start buf_XOR_13, // destination Length); p_Byte=(unsigned char*)buf_XOR_13; //怀疑真正写的长度很小,故Length改为3 for(count=0;count<3;count++) { *p_Byte = (*p_Byte) ^ 0x13; p_Byte++; } Status = WdfMemoryCopyToBuffer((WDFMEMORY)buf_XOR_13, // Source 0, // offset in Source memory where the copy has to start devExt->DiskImage + ByteOffset.LowPart, // destination Length); //释放内存 ExFreePool(buf_XOR_13); }
}
WdfRequestCompleteWithInformation(Request, Status, (ULONG_PTR)Length);}
1. WDK7600里的ramdisk示例,能够在Vista下运行,但在Windows 7 下只成功过一次,后来重装了两三次Win7的虚拟机,总是不成功,显示【本地磁盘R:】0字节,不能读写
请问有谁在Windows 7 下试验成功了,相互切磋?
请问一下第1个问题现在解决了么。。。我也碰到这个问题了啊