4901|12

68

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

驱动编译问题,跪求答案? [复制链接]

编译提示信息如下:
1>------ 已启动生成: 项目: Inline_ObOpenObjectByPointer.WXP, 配置: WXP checked Win32 ------
1>正在执行生成文件项目操作
1>OSR DDKBUILD.CMD V7.2 (2008-04-14) - OSR, Open Systems Resources, Inc.
1>DDKBLD: >> Setting custom environment variables [ddkbldenv.cmd] ...
1>DDKBLD: << Finished setting custom environment variables [ddkbldenv.cmd] ...
1>DDKBLD: >> Performing pre-build steps [ddkprebld.cmd] ...
1>DDKBLD: New build number is 18 ...
1>DDKBLD: << Finished pre-build steps [ddkprebld.cmd] ...
1>DDKBLD: WXP (checked) using the Windows XP DDK and %WXPBASE%
1>DDKBLD: Directory: D:\projects\INLINE~1\INLINE~1
1>DDKBLD: WXPBASE: C:\WINDDK\2600
1>DDKBLD: Run build -Ze -MI for checked version in .
1>BUILD: Object root set to: ==> objchk
1>BUILD: Adding /Y to COPYCMD so xcopy ops won't hang.
1>BUILD: /i switch ignored
1>BUILD: Using 2 child processes
1>BUILD: Compile and Link for i386
1>BUILD: Examining d:\projects\inline~1\inline~1 directory for files to compile.
1>    d:\projects\inline~1\inline~1
1>BUILD: Compiling d:\projects\inline~1\inline~1 directory
1>BUILD: Linking d:\projects\inline~1\inline~1 directory
1>1>Linking Executable - objchk\i386\inline_obopenobjectbypointer.sys for i386
1>inline_obopenobjectbypointer.obj() : error LNK2019: unresolved external symbol "__declspec(dllimport) long __stdcall ObOpenObjectByPointer(void *,unsigned long,struct _ACCESS_STATE *,unsigned long,struct _OBJECT_TYPE *,char,void * *)" (__imp_?ObOpenObjectByPointer@@YGJPAXKPAU_ACCESS_STATE@@KPAU_OBJECT_TYPE@@DPAPAX@Z) referenced in function "void __stdcall StopHook(void)" (?StopHook@@YGXXZ)
1>inline_obopenobjectbypointer.obj() : error LNK2019: unresolved external symbol "__declspec(dllimport) struct _EPROCESS * __stdcall IoThreadToProcess(struct _ETHREAD *)" (__imp_?IoThreadToProcess@@YGPAU_EPROCESS@@PAU_ETHREAD@@@Z) referenced in function "long __stdcall fake_ObOpenObjectByPointer(void *,unsigned long,struct _ACCESS_STATE *,unsigned long,struct _OBJECT_TYPE *,char,void * *)" (?fake_ObOpenObjectByPointer@@YGJPAXKPAU_ACCESS_STATE@@KPAU_OBJECT_TYPE@@DPAPAX@Z)
1>inline_obopenobjectbypointer.obj() : error LNK2001: unresolved external symbol "struct _OBJECT_TYPE * * PsThreadType" (?PsThreadType@@3PAPAU_OBJECT_TYPE@@A)
1>inline_obopenobjectbypointer.obj() : error LNK2001: unresolved external symbol "struct _OBJECT_TYPE * * PsProcessType" (?PsProcessType@@3PAPAU_OBJECT_TYPE@@A)
1>inline_obopenobjectbypointer.obj() : error LNK2019: unresolved external symbol "__declspec(dllimport) long __stdcall PsLookupProcessByProcessId(unsigned long,struct _EPROCESS * *)" (__imp_?PsLookupProcessByProcessId@@YGJKPAPAU_EPROCESS@@@Z) referenced in function _DriverEntry@8
1>inline_obopenobjectbypointer.obj() : error LNK2019: unresolved external symbol "__declspec(dllimport) long __stdcall ZwQuerySystemInformation(unsigned long,void *,unsigned long,unsigned long *)" (__imp_?ZwQuerySystemInformation@@YGJKPAXKPAK@Z) referenced in function _DriverEntry@8
1>objchk\i386\inline_obopenobjectbypointer.sys() : error LNK1120: 6 unresolved externals
1>BUILD: Done
1>    1 executable built - 7 Errors
1>DDKBLD: Build complete
1>DDKBLD: Building browse information files
1>DDKBLD: >> Performing post-build steps [ddkpostbld.cmd] ...
1>DDKBLD: << Finished post-build steps [ddkpostbld.cmd] ...
1>生成日志保存在“file://d:\projects\Inline_ObOpenObjectByPointer\Inline_ObOpenObjectByPointer\BuildLog.htm”
1>Inline_ObOpenObjectByPointer.WXP - 7 个错误,0 个警告
========== 生成: 0 已成功, 1 已失败, 0 最新, 0 已跳过 ==========

最新回复

如果用.c文件,要按照C语言的语法,变量只能在函数开头定义,如果不方便改,就还用cpp好了。 你用cpp文件添加了extern "C"之后错误信息完全一样吗?把文件开头部分贴出来看看。  详情 回复 发表于 2008-10-6 22:32
点赞 关注

回复
举报

57

帖子

0

TA的资源

一粒金砂(初级)

沙发
 
如何查找函数属于哪个库文件和头文件?
 
 

回复

79

帖子

0

TA的资源

一粒金砂(初级)

板凳
 
extern "C" {
这里写#include <头文件>
}
 
 
 

回复

74

帖子

0

TA的资源

一粒金砂(初级)

4
 
我是这么写的,应该没问题的呀
#ifdef __cplusplus
extern "C" {
#endif
#include "ntddk.h"
#include
#include
#ifdef __cplusplus
}; // extern "C"
#endif
 
 
 

回复

69

帖子

0

TA的资源

一粒金砂(初级)

5
 
你把#ifdef和#endif都去掉试试。
 
 
 

回复

71

帖子

0

TA的资源

一粒金砂(初级)

6
 
都去掉了还是一样
 
 
 

回复

70

帖子

0

TA的资源

一粒金砂(初级)

7
 
是不是每加某个库文件?
 
 
 

回复

83

帖子

0

TA的资源

一粒金砂(初级)

8
 
谢谢cnzdgs帮我解决问题
 
 
 

回复

69

帖子

0

TA的资源

一粒金砂(初级)

9
 
你是不是有多个cpp文件?每个文件都要这样包含头文件。
DDK中的lib主要都是C语言的形式,从错误信息可以看出你是以C++的形式包含的头文件。
 
 
 

回复

76

帖子

0

TA的资源

一粒金砂(初级)

10
 
如果实在不行,你把文件扩展名都改成.c试试。
 
 
 

回复

67

帖子

0

TA的资源

一粒金砂(初级)

11
 
我只有一个C++文件,我改成C后问题跟多了,如下:
1>1>Compiling - inline_obopenobjectbypointer.c for i386
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(284) : error C2275: 'NTSTATUS' : illegal use of this type as an expression
1>c:\winddk\2600\inc\wxp\ntdef.h(557) : error see declaration of 'NTSTATUS'
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(284) : error C2146: syntax error : missing ';' before identifier 'ntStatus'
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(284) : error C2144: syntax error : '' should be preceded by ''
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(284) : error C2144: syntax error : '' should be preceded by ''
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(284) : error C2143: syntax error : missing ';' before 'identifier'
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(284) : error C2065: 'ntStatus' : undeclared identifier
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(285) : error C2143: syntax error : missing ';' before 'type'
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(286) : error C2275: 'ULONG' : illegal use of this type as an expression
1>c:\winddk\2600\inc\wxp\ntdef.h(411) : error see declaration of 'ULONG'
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(286) : error C2146: syntax error : missing ';' before identifier 'cbBuffer'
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(286) : error C2144: syntax error : '' should be preceded by ''
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(286) : error C2144: syntax error : '' should be preceded by ''
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(286) : error C2143: syntax error : missing ';' before 'identifier'
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(286) : error C2065: 'cbBuffer' : undeclared identifier
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(287) : error C2275: 'PSYSTEM_PROCESS_INFORMATION' : illegal use of this type as an expression
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.h(153) : error see declaration of 'PSYSTEM_PROCESS_INFORMATION'
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(287) : error C2146: syntax error : missing ';' before identifier 'pInfo'
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(287) : error C2144: syntax error : '' should be preceded by ''
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(287) : error C2144: syntax error : '' should be preceded by ''
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(287) : error C2143: syntax error : missing ';' before 'identifier'
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(287) : error C2065: 'pInfo' : undeclared identifier
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(288) : error C2143: syntax error : missing ';' before 'type'
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(290) : error C2065: 'pBuffer' : undeclared identifier
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(290) : error C4047: '=' : 'int' differs in levels of indirection from 'PVOID'
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(291) : error C4047: '==' : 'int' differs in levels of indirection from 'void *'
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(295) : error C4022: 'ZwQuerySystemInformation' : pointer mismatch for actual parameter 2
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(299) : error C4022: 'ExFreePoolWithTag' : pointer mismatch for actual parameter 1
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(303) : error C4047: '=' : 'int' differs in levels of indirection from 'PSYSTEM_PROCESS_INFORMATION'
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(306) : error C2223: left of '->ProcessName' must point to struct/union
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(310) : error C2065: 'ProcessName' : undeclared identifier
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(310) : error C4047: 'function' : 'char *' differs in levels of indirection from 'int'
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(312) : error C4047: 'function' : 'const char *' differs in levels of indirection from 'int'
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(314) : error C2223: left of '->ProcessId' must point to struct/union
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(315) : error C2223: left of '->ProcessId' must point to struct/union
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(319) : error C2223: left of '->NextEntryDelta' must point to struct/union
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(322) : error C2223: left of '->NextEntryDelta' must point to struct/union
1>d:\projects\inline_obopenobjectbypointer\inline_obopenobjectbypointer\inline_obopenobjectbypointer.c(324) : error C4022: 'ExFreePoolWithTag' : pointer mismatch for actual parameter 1
1>BUILD: Compile errors: not linking d:\projects\inline~1\inline~1 directory
1>BUILD: Done
1>    2 files compiled - 38 Errors
1>DDKBLD: ================ Build warnings =======================
1>d:\projects\Inline_ObOpenObjectByPointer\Inline_ObOpenObjectByPointer\Inline_ObOpenObjectByPointer.c(284) : error C2275: 'NTSTATUS' : illegal use of this type as an expression
1>d:\projects\Inline_ObOpenObjectByPointer\Inline_ObOpenObjectByPointer\Inline_ObOpenObjectByPointer.c(284) : error C2146: syntax error : missing ';' before identifier 'ntStatus'
1>d:\projects\Inline_ObOpenObjectByPointer\Inline_ObOpenObjectByPointer\Inline_ObOpenObjectByPointer.c(284) : error C2144: syntax error : '' should be preceded by ''
1>d:\projects\Inline_ObOpenObjectByPointer\Inline_ObOpenObjectByPointer\Inline_ObOpenObjectByPointer.c(284) : error C2144: syntax error : '' should be preceded by ''
1>d:\projects\Inline_ObOpenObjectByPointer\Inline_ObOpenObjectByPointer\Inline_ObOpenObjectByPointer.c(284) : error C2143: syntax error : missing ';' before 'identifier'

...........
 
 
 

回复

74

帖子

0

TA的资源

一粒金砂(初级)

12
 
搞定了,应该用c文件,而且变量声明放在函数开始
 
 
 

回复

70

帖子

0

TA的资源

一粒金砂(初级)

13
 
如果用.c文件,要按照C语言的语法,变量只能在函数开头定义,如果不方便改,就还用cpp好了。

你用cpp文件添加了extern "C"之后错误信息完全一样吗?把文件开头部分贴出来看看。
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/8 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表