资源描述:
《delphi编写的虚拟磁盘开发源码分析报告》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、.Delphi编写的虚拟磁盘开发源码分析一、虚拟光驱驱动(C语言编写)1、Vcd文件夹(1)、DeviceThread.h//设备的处理线程VOIDDeviceThread(INPVOIDContext);(2)、DeviceThread.c#include#include#include#include#include#include#include#include#include////////////
2、//////////////////////////////////////////////////////////////NTSTATUSVCDOpenFile(INPDEVICE_OBJECTDeviceObject,INPIRPIrp){PDEVICE_EXTENSIONdevice_extension;PCHARfilename;UCHARafile_name[MAX_PATH]={0};UNICODE_STRINGufile_name;NTSTATUSstatus;OBJECT_ATTRIBUTESobject_attributes;FILE_END_OF_FILE_INFORM
3、ATIONfile_eof;FILE_BASIC_INFORMATIONfile_basic;FILE_STANDARD_INFORMATIONfile_standard;FILE_ALIGNMENT_INFORMATIONfile_alignment;DbgPrint("VCDOpenFile");device_extension=(PDEVICE_EXTENSION)DeviceObject->DeviceExtension;...filename=(PCHAR)Irp->AssociatedIrp.SystemBuffer;RtlCopyMemory(device_extensi
4、on->oldfile_name,filename,MAX_PATH);if(filename[0]=='\'){if(filename[1]=='\')//\serversharepathXXX.iso->??UNC\serversharepathXXX.iso{strcpy(afile_name,"\??\UNC");strcat(afile_name,filename);}else//DeviceHarddisk0Partition1pathXXX.iso不变{strcpy(afile_name,filename);}}else//c:path
5、XXX.iso->??c:pathXXX.iso{strcpy(afile_name,"\??\");strcat(afile_name,filename);}device_extension->file_name.Length=(USHORT)strlen(afile_name);device_extension->file_name.MaximumLength=device_extension->file_name.Length;device_extension->file_name.Buffer=ExAllocatePool(NonPagedPool,device_ex
6、tension->file_name.Length);RtlCopyMemory(device_extension->file_name.Buffer,afile_name,device_extension->file_name.Length);status=RtlAnsiStringToUnicodeString(&ufile_name,&device_extension->file_name,TRUE);if(!NT_SUCCESS(status))...{ExFreePool(device_extension->file_name.Buffer);Irp->IoStatus.Stat
7、us=status;Irp->IoStatus.Information=0;returnstatus;}InitializeObjectAttributes(&object_attributes,&ufile_name,OBJ_CASE_INSENSITIVE,NULL,NULL);status=ZwCreateFile(&device_extension->file_handle,GENERIC_READ,&objec