阅读:3217回复:11
安装passthru.sys出现问题,说没有经过mfc数字签名
各位大虾:
我在安装passthru.sys出现问题,弹出一个对话框, 说sample filter miniport没有经过mfc数字签名。我 选择继续安装,这个框老是出现,那么我怎么才能不让 这个框出现呢?怎么才能正确安装呢? 我选择不继续是不是也可以正确安装? 谢谢 |
|
|
沙发#
发布于:2001-08-10 13:37
然后,我在passthru的driverentry()中使用
#define DEVICE_NAME L"\\DEVICE\\PASSTHRU" #define DEVICE_SYMBOL L"\\??\\PASSTHRUSYM" RtlInitUnicodeString((PUNICODE_STRING)DeviceName,(PCWSTR)DEVICE_NAME); RtlInitUnicodeString((PUNICODE_STRING)SymbolicName,(PCWSTR)DEVICE_SYMBOL); NdisMRegisterDevice(WrapperHandle,DeviceName,SymbolicName,MajorFunctions,pDeviceObject,NdisDeviceHandle); 注册了。我现在编写了一个win32应用程序,来用createFile() 打开passthru。 HANDLE hDevice; hDevice=CreateFile("\\\\.\\PASSTHRUSYM", GENERIC_WRITE | GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0 ); DWORD error=GetLastError(); 可是返回的error=2,应该是没有找到设备。这是为什么呢? 在上一片的问题我选择了不继续安装,但是网络属性中已经有了 sample filter这项服务。那么,我是因为passthru没有安装成功 还是因为createfile()调用的不对呢?请大侠们多多指点!谢谢 |
|
|
板凳#
发布于:2001-08-10 14:59
没有签名就没有吧,你要想要的话还得去找那个“帐单之门”(Bill Gates),继续就是了。
你在Passthru中又有没有创建如下例程,这个程序是不受Win32及其它内核驱动的调用的: DiverObject->MajorFunction[IRP_MJ_CREATE] = PassthruCreate; ... ... ... 想与它通信可不是简单创建一个名字就可以的,你还是先再看看DDK吧! |
|
地板#
发布于:2001-08-10 16:04
我选择继续的话,这个对话框老是出现!真是郁闷
我有定义create亚。 DriverObject->DriverStartIo=PassthruStartIo; MajorFunctions[IRP_MJ_CREATE]=PASSTHRUCREATE; MajorFunctions[IRP_MJ_READ]=PassthruRead; NdisMRegisterDevice(WrapperHandle,DeviceName,SymbolicName,MajorFunctions,pDeviceObject,NdisDeviceHandle); NTSTATUS PASSTHRUCREATE(PDEVICE_OBJECT fdo,PIRP Irp) { PIO_STACK_LOCATION IrpStack=IoGetCurrentIrpStackLocation(Irp); return CompleteIrp(Irp,STATUS_SUCCESS,0); } NTSTATUS CompleteIrp(PIRP Irp ,NTSTATUS status , ULONG info) { Irp->IoStatus.Status=status; Irp->IoStatus.Information=info; IoCompleteRequest(Irp,IO_NO_INCREMENT); return status; } 真的很奇怪。看来可能是没有安装好 |
|
|
地下室#
发布于:2001-08-10 16:34
看看这部分代码先:
DriverObject->MajorFunction[IRP_MJ_CREATE] = PacketOpen; DriverObject->MajorFunction[IRP_MJ_CLOSE] = PacketClose; DriverObject->MajorFunction[IRP_MJ_READ] = PacketRead; DriverObject->MajorFunction[IRP_MJ_WRITE] = PacketWrite; DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = PacketIoControl; DriverObject->DriverUnload = PacketUnload; |
|
|
5楼#
发布于:2001-08-10 21:34
各位大侠:我在passthru的基础上进行编程,我发现如果我加入
下面两句://RtlInitUnicodeString(&DeviceName,DEVICE_NAME); //RtlInitUnicodeString(&SymbolicName,DEVICE_SYMBOL); 我一旦舔加这个passthru.sys这个服务,系统马上down机,这是为什么呢?我真的是很郁闷,请各位大侠多多指点,我的 部分代码如下: #define DEVICE_NAME L"\\DEVICE\\PASSTHRU" #define DEVICE_SYMBOL L"\\DosDevices\\passthruSymbolic" NTSTATUS DriverEntry( IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath ) { NDIS_STATUS Status; NDIS_PROTOCOL_CHARACTERISTICS PChars; NDIS_MINIPORT_CHARACTERISTICS MChars; PNDIS_CONFIGURATION_PARAMETER Param; NDIS_STRING Name; NDIS_HANDLE WrapperHandle; UNICODE_STRING DeviceName; UNICODE_STRING SymbolicName; PDRIVER_DISPATCH MajorFunctions[IRP_MJ_MAXIMUM_FUNCTION]; PDEVICE_OBJECT *pDeviceObject=NULL; NDIS_HANDLE *NdisDeviceHandle=NULL; //RtlInitUnicodeString(&DeviceName,DEVICE_NAME); //RtlInitUnicodeString(&SymbolicName,DEVICE_SYMBOL); NdisMInitializeWrapper(&WrapperHandle, DriverObject, RegistryPath, NULL); MajorFunctions[IRP_MJ_CREATE]=PASSTHRUCREATE; MajorFunctions[IRP_MJ_READ]=PassthruRead; //NdisMRegisterDevice(WrapperHandle,&DeviceName,&SymbolicName,MajorFunctions,pDeviceObject,NdisDeviceHandle); } NTSTATUS PASSTHRUCREATE(PDEVICE_OBJECT fdo,PIRP Irp) { PIO_STACK_LOCATION IrpStack=IoGetCurrentIrpStackLocation(Irp); return STATUS_SUCCESS; //return CompleteIrp(Irp,STATUS_SUCCESS,0); } NTSTATUS CompleteIrp(PIRP Irp ,NTSTATUS status , ULONG info) { Irp->IoStatus.Status=status; Irp->IoStatus.Information=info; IoCompleteRequest(Irp,IO_NO_INCREMENT); return status; } |
|
|
6楼#
发布于:2001-08-11 15:09
PDRIVER_DISPATCH MajorFunctions[IRP_MJ_MAXIMUM_FUNCTION+1];
:PDEVICE_OBJECT *pDeviceObject=NULL; :NDIS_HANDLE *NdisDeviceHandle=NULL; PDEVICE_OBJECT pDeviceObject=NULL; NDIS_HANDLE NdisDeviceHandle=NULL; RtlInitUnicodeString没错 多多交流,我也才学 |
|
7楼#
发布于:2001-08-11 18:17
是呀,我也是正在学习,希望能多多交流。
现在我发现好像是Status=NdisMRegisterDevice(WrapperHandle,NULL,&SymbolicName,MajorFunctions,&pDeviceObject,&NdisDeviceHandle); 这条语句的问题,我现在一把这句话加上,已安装就down机。 对了,pDeviceObject好像应该设成全局变量把,因为 以后象create等都要这个变量作参数 |
|
|
8楼#
发布于:2001-08-14 14:36
就是Status=NdisMRegisterDevice(WrapperHandle,NULL,&SymbolicName,MajorFunctions,&pDeviceObject,&NdisDeviceHandle);
这条语句的问题, 因为你的定义不对!!! 见前我的定义! PDRIVER_DISPATCH MajorFunctions[IRP_MJ_MAXIMUM_FUNCTION+1]; ERROR:PDEVICE_OBJECT *pDeviceObject=NULL; ERROR:NDIS_HANDLE *NdisDeviceHandle=NULL; PDEVICE_OBJECT pDeviceObject=NULL; NDIS_HANDLE NdisDeviceHandle=NULL; |
|
9楼#
发布于:2001-08-14 16:01
我现在按照你的代码加上去,可是还是不行亚。
请问你有没有测试过的代码,发给我看一看, 非常感谢,我的e_mail是:baijbupt@263.net 我现在也是遇见这个问题,现在可以判断的是 ndismregisterdevice和NdisIMRegisterLayeredMiniport 之间的问题,如果在程序中现运行ndismregisterdevice,那么 可以成功,但是,当运行到NdisIMRegisterLayeredMiniport 时就失败了。如果程序中把NdisIMRegisterLayeredMiniport放在 ndismregisterdevice,那么NdisIMRegisterLayeredMiniport 可以成功,但是ndismregisterdevice失败 NTSTATUS DriverEntry( IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath ) { NDIS_STATUS Status; NDIS_PROTOCOL_CHARACTERISTICS PChars; NDIS_MINIPORT_CHARACTERISTICS MChars; PNDIS_CONFIGURATION_PARAMETER Param; NDIS_STRING Name; NDIS_HANDLE WrapperHandle; PDEVICE_OBJECT deviceObject=NULL; NDIS_HANDLE ndisDeviceHandle=NULL; UNICODE_STRING DeviceName; UNICODE_STRING SymbolicName; PDRIVER_DISPATCH MajorFunctions[IRP_MJ_MAXIMUM_FUNCTION+1]; RtlInitUnicodeString(&DeviceName,NT_DEVICE_NAME); RtlInitUnicodeStrin(&SymbolicName,DOS_DEVICE_NAME);// NdisMInitializeWrapper(&WrapperHandle, DriverObject, RegistryPath, NULL); DBGPRINT("\n\nDriverEntry\n"); MajorFunctions[IRP_MJ_CREATE]=PASSTHRUCREATE; MajorFunctions[IRP_MJ_READ]=PassthruRead; NdisZeroMemory(&MChars, sizeof(NDIS_MINIPORT_CHARACTERISTICS)); //MChars.MajorNdisVersion = 5; MChars.MajorNdisVersion = 4; MChars.MinorNdisVersion = 0; MChars.InitializeHandler = MPInitialize; MChars.QueryInformationHandler = MPQueryInformation; MChars.SetInformationHandler = MPSetInformation; MChars.ResetHandler = MPReset; MChars.TransferDataHandler = MPTransferData; MChars.HaltHandler = MPHalt; MChars.CheckForHangHandler = NULL; MChars.SendHandler = MPSend; MChars.ReturnPacketHandler = MPReturnPacket; Status = NdisIMRegisterLayeredMiniport(WrapperHandle,&MChars,sizeof(MChars),&DriverHandle); //ASSERT(Status == NDIS_STATUS_SUCCESS); if(Status != NDIS_STATUS_SUCCESS) { DBGPRINT("NdisIMRegisterLayeredMiniport 166 fail!\n"); return Status; } ********** ///////////NEW ADDING Status=NdisMRegisterDevice(WrapperHandle,&DeviceName,&SymbolicName,MajorFunctions, &deviceObject,&ndisDeviceHandle); if(NT_SUCCESS(Status)) { DBGPRINT("NdisMRegisterDevice fail!\n"); // NdisMDeregisterDevice(NdisDeviceHandle); // return Status; } else { DBGPRINT("NdisMRegisterDevice Success!\n"); deviceObject->Flags |= DO_BUFFERED_IO; pDeviceObject = deviceObject; NdisDeviceHandle=ndisDeviceHandle; } /////////////////////////////////////////// NdisMRegisterUnloadHandler(WrapperHandle, PtUnload); // // Now register the protocol. // NdisZeroMemory(&PChars, sizeof(NDIS_PROTOCOL_CHARACTERISTICS)); PChars.MajorNdisVersion = 4; PChars.MinorNdisVersion = 0; NdisInitUnicodeString(&Name, L"SFilter"); // Protocol name PChars.Name = Name; PChars.OpenAdapterCompleteHandler = PtOpenAdapterComplete; PChars.CloseAdapterCompleteHandler = PtCloseAdapterComplete; PChars.SendCompleteHandler = PtSendComplete; PChars.TransferDataCompleteHandler = PtTransferDataComplete; PChars.ResetCompleteHandler = PtResetComplete; PChars.RequestCompleteHandler = PtRequestComplete; PChars.ReceiveHandler = PtReceive; PChars.ReceiveCompleteHandler = PtReceiveComplete; PChars.StatusHandler = PtStatus; PChars.StatusCompleteHandler = PtStatusComplete; PChars.BindAdapterHandler = PtBindAdapter; PChars.UnbindAdapterHandler = PtUnbindAdapter; PChars.UnloadHandler = NULL; PChars.ReceivePacketHandler = PtReceivePacket; PChars.PnPEventHandler= PtPNPHandler; NdisRegisterProtocol(&Status, &ProtHandle, &PChars, sizeof(NDIS_PROTOCOL_CHARACTERISTICS)); if(Status != NDIS_STATUS_SUCCESS) { DBGPRINT("NdisRegisterProtocol 208 fail!\n"); return Status; } NdisIMAssociateMiniport(DriverHandle, ProtHandle); return(Status); } |
|
|
10楼#
发布于:2001-08-14 17:22
非常谢谢qsc的指点。我将尽快给你专家分(因为
我现在还不会给!:)) 上篇的代码基本是正确的,只要改动: if(NT_SUCCESS(Status)) { DBGPRINT("NdisMRegisterDevice fail!\n"); // NdisMDeregisterDevice(NdisDeviceHandle); // return Status; } else { DBGPRINT("NdisMRegisterDevice Success!\n"); deviceObject->Flags |= DO_BUFFERED_IO; pDeviceObject = deviceObject; NdisDeviceHandle=ndisDeviceHandle; } 把if 和lelse的内容对调一下就可以了。另外,提醒一下, 这个源代码有create的处理但是没有closehandle的处理。 要正常使用要加上close的dispatch irp |
|
|
11楼#
发布于:2001-08-30 16:18
你将系统的配子改一下就好了,我是这样做的
|
|
|