在@H_403_4@Reactos@H_403_4@里,磁盘类的驱动程序是由@H_403_4@disk.sys@H_403_4@实现的。从文件系统上输出和读取的调用,就是需要通过这个驱动程序来实现,在这个驱动程序下面就是@H_403_4@PCIIDE@H_403_4@和@H_403_4@ATAPI@H_403_4@的驱动程序了,后面这些驱动程序,在前面已经分析过,现在来学习@H_403_4@disk@H_403_4@类驱动程序。@H_403_4@@H_403_4@
@H_403_4@
10.4.1@H_403_4@ @H_403_4@DriverEntry@H_403_4@入口函数@H_403_4@@H_403_4@
分析这个程序还是从这个驱动程序的入口函数开始,这个函数是初始化@H_403_4@SCSI@H_403_4@的硬盘类驱动程序,具体实现代码如下:@H_403_4@@H_403_4@
#001 @H_403_4@NTSTATUS@H_403_4@
#003 @H_403_4@DriverEntry(@H_403_4@
#004 @H_403_4@IN PDRIVER_OBJECT DriverObject,@H_403_4@
#005 @H_403_4@IN PUNICODE_STRING RegistryPath@H_403_4@
#010 @H_403_4@Routine Description:@H_403_4@
#012 @H_403_4@This routine initializes the SCSI hard disk class driver.@H_403_4@
#014 @H_403_4@Arguments:@H_403_4@
#016 @H_403_4@DriverObject - Pointer to driver object created by system.@H_403_4@
#018 @H_403_4@RegistryPath - Pointer to the name of the services node for this driver.@H_403_4@
#020 @H_403_4@Return Value:@H_403_4@
#022 @H_403_4@The function value is the final status from the initialization operation.@H_403_4@
#027 @H_403_4@CLASS_INIT_DATA InitializationData;@H_403_4@
#030 @H_403_4@// Zero InitData@H_403_4@
@H_403_4@
#033 @H_403_4@RtlZeroMemory (&InitializationData,sizeof(CLASS_INIT_DATA));@H_403_4@
#036 @H_403_4@// Set sizes@H_403_4@
@H_403_4@
#039 @H_403_4@InitializationData.InitializationDataSize = sizeof(CLASS_INIT_DATA);@H_403_4@
@H_403_4@
设置驱动程序使用空间的大小。@H_403_4@@H_403_4@
#040 @H_403_4@InitializationData.DeviceExtensionSize = DEVICE_EXTENSION_SIZE;@H_403_4@
@H_403_4@
指明这个驱动程序对象是磁盘驱动程序。@H_403_4@@H_403_4@
#042 @H_403_4@InitializationData.DeviceType = FILE_DEVICE_DISK;@H_403_4@
#043 @H_403_4@InitializationData.DeviceCharacteristics = 0;@H_403_4@
#046 @H_403_4@// Set entry points@H_403_4@
@H_403_4@
#049 @H_403_4@InitializationData.ClassError = ScsiDiskProcessError;@H_403_4@
#050 @H_403_4@InitializationData.ClassReadWriteVerification = ScsiDiskReadWriteVerification;@H_403_4@
#051 @H_403_4@InitializationData.ClassFindDevices = FindScsiDisks;@H_403_4@
#052 @H_403_4@InitializationData.ClassFindDeviceCallBack = ScsiDiskDeviceVerification;@H_403_4@
#053 @H_403_4@InitializationData.ClassDeviceControl = ScsiDiskDeviceControl;@H_403_4@
#054 @H_403_4@InitializationData.ClassShutdownFlush = ScsiDiskShutdownFlush;@H_403_4@
#055 @H_403_4@@H_403_4@InitializationData.ClassCreateClose = NULL;@H_403_4@
#058 @H_403_4@// Call the class init routine@H_403_4@
@H_403_4@
调用ScsiClassInitialize@H_403_4@函数初始化驱动程序对象。@H_403_4@@H_403_4@
#061 @H_403_4@return ScsiClassInitialize( DriverObject,RegistryPath,&InitializationData);@H_403_4@
#063} // end DriverEntry()@H_403_4@
原文链接:https://www.f2er.com/react/308409.html