| 
			 
					阅读:1029回复:6
				 
				关于类型声名不成功
					我的C文件已包含了如下头文件:
 
							#include <ntddk.h> #include \"tdi.h\" #include \"tdikrnl.h\" 但当我加入下面这行代码: PTDI_REQUEST_KERNEL_CONNECT param = (PTDI_REQUEST_KERNEL_CONNECT)(&irps->Parameters); 时BUILD总出错,没有这名就成功。 下面是错误信息 C:\\ndriver>build BUILD: Object root set to: ==> objchk BUILD: /i switch ignored BUILD: Compile and Link for i386 BUILD: Loading D:\\NTDDK\\build.dat... BUILD: Computing Include file dependencies: BUILD: Examining c:\\ndriver directory for files to compile. c:\\ndriver - 1 source files (243 lines) BUILD: Saving D:\\NTDDK\\build.dat... BUILD: Compiling c:\\ndriver directory Compiling - myfilter.c for i386 myfilter.c(39) : error C2275: \'PTDI_REQUEST_KERNEL_CONNECT\' : illegal use of thi s type as an expression myfilter.c(39) : error C2146: syntax error : missing \';\' before identifier \'para m\' myfilter.c(39) : error C2065: \'param\' : undeclared identifier myfilter.c(39) : error C2065: \'irps\' : undeclared identifier myfilter.c(39) : error C2223: left of \'->Parameters\' must point to struct/union BUILD: Compile errors: not linking c:\\ndriver directory BUILD: Done 1 file compiled - 1 Warning - 5 Errors C:\\ndriver> 附件是我的源码?请各位前辈指点一下!  | 
	|
					
  | 
	
| 
			 沙发# 
								发布于:2005-04-05 15:50				
			
					多谢5楼arthurtu
 
							!我编译通过了。  | 
	|
| 
			 板凳# 
								发布于:2005-04-05 11:50				
			
					在函数的开始处声明变量				 
							 | 
	|
| 
			 地板# 
								发布于:2005-04-05 11:39				
			
					我现在是PTDI_REQUEST_KERNEL_CONNECT类型声名过编译不过,变量声名irps好改不是我问的。我没说清楚问什么,请大家见谅!				 
							 | 
	|
| 
			 地下室# 
								发布于:2005-04-05 11:28				
			
					PTDI_REQUEST_KERNEL_CONNECT怎么定义的。。。
 
							我这还没有装MSDN了,,,看错误好像是它不能用来声明变量的。 是常量??,,你自己查查吧,,  | 
	|
					
						
  | 
	
| 
			 5楼# 
								发布于:2005-04-05 11:17				
			
					irps应该改为pCurrentIrpStack或者pNextIrpStack,,看你自己是怎么想的,,,,
 
							还有一个就是TDI_REQUEST_KERNEL_CONNECT是个结构类型的。。 而 IO堆栈中的Parameters是个联合类型的,,, 不可以这样强制 类型转换吧。。  | 
	|
					
						
  | 
	
| 
			 6楼# 
								发布于:2005-04-05 11:10				
			
					irps没有声明吧
 
							 | 
	|