阅读:1364回复:6
还是编译问题。。。。郁闷啊!!IoConnectInterrupt()函数的调用。。。。。 我的源码中如此调用 NTSTATUS status=IoConnectInterrupt(&pdx->InterruptObject, Isr, pdx, NULL, pdx->Vector, pdx->IRQL, NULL, Latched, TRUE, pdx->Affinity, FALSE); 相应的头文件定义了 KIRQL IRQL; PKSPIN_LOCK spinlock; ULONG Vector; KAFFINITY Affinity; PKINTERRUPT InterruptObject; 提示错误: pnp.cpp(370) : error C2664: 'IoConnectInterrupt' : cannot convert parameter 2 from 'unsigned char (struct _KINTERRUPT *__ptr64 ,struct DEVICE_EXTENSION *__ptr64 )' to 'unsigned char (__cdecl *__ptr64 )(struct _KINTERRUPT *__ptr64 ,void *__ptr64 )' 郁闷啊!总觉得没有什么错误啊??为什么还报错? |
|
|
沙发#
发布于:2005-01-18 11:38
你的Isr的声明是什么? |
|
|
板凳#
发布于:2005-01-18 11:54
BOOLEAN Isr(PKINTERRUPT InterruptObject, PDEVICE_EXTENSION pdx); 应该没有问题吧? |
|
|
地板#
发布于:2005-01-18 13:34
在IoConnectInterrupt的声明中,第二个参数类型是PKSERVICE_ROUTINE,也就是BOOLEAN*。你将Irp改成&Irp试一下。
NTKERNELAPI NTSTATUS IoConnectInterrupt( OUT PKINTERRUPT *InterruptObject, IN PKSERVICE_ROUTINE ServiceRoutine, IN PVOID ServiceContext, IN PKSPIN_LOCK SpinLock OPTIONAL, IN ULONG Vector, IN KIRQL Irql, IN KIRQL SynchronizeIrql, IN KINTERRUPT_MODE InterruptMode, IN BOOLEAN ShareVector, IN KAFFINITY ProcessorEnableMask, IN BOOLEAN FloatingSave ); typedef BOOLEAN (*PKSERVICE_ROUTINE) ( IN struct _KINTERRUPT *Interrupt, IN PVOID ServiceContext ); |
|
|
地下室#
发布于:2005-01-18 17:54
Isr参数改为&Isr后编译还是错误
提示如下: pnp.cpp(370) : error C2664: 'IoConnectInterrupt' : cannot convert parameter 2 from 'unsigned char (__cdecl *__ptr64 )(struct _KINTERRUPT *__ptr64 ,struct DEVICE_EXTENSION *__ptr64 )' to 'unsigned char (__cdecl *__ptr64 )(struct _KINTERRUPT *__ptr64 ,void *__ptr64 )' 我觉得就应该是原来的那样声明参数, 应该没有问题的,(就是Isr) 又看了看有的例子 也都是这样用 的, 真不知道错在哪里啊?? 极度郁闷! :mad: :mad: |
|
|
5楼#
发布于:2005-01-18 19:58
1、BOOLEAN Isr(PKINTERRUPT InterruptObject, PVOID pdx);
在函数里面强制类型转换成struct DEVICE_EXTENSION * 参数不符合嘛 2、unsigned char (__cdecl *__ptr64 )(struct _KINTERRUPT *__ptr64 ,void *__ptr64 ) __cdecl?!驱动都用的__stdcall,怎么回事? |
|
6楼#
发布于:2005-01-18 22:29
1、BOOLEAN Isr(PKINTERRUPT InterruptObject, PVOID pdx); 大侠!! 我服您了!! 问题搞定。。。。 :D :D 以后有问题请大侠多帮小弟一把啊。。。 非常感谢!!! |
|
|