首页
社区
课程
招聘
ntdll.h使用问题,玩过的都知道,小菜求教
2012-10-20 17:41 7737

ntdll.h使用问题,玩过的都知道,小菜求教

2012-10-20 17:41
7737
这个ntdll.h是让我们的程序能使用Native Api,同时避免Win DDK with SDK libs的问题。

我按照说明
vs2008编译需要ntdll.lib,复制到C:\Program Files\Microsoft Visual Studio 9.0\VC\lib下。



一个R3程序,VC 6.0 编译,需要包含ntdll.h,产生
error C2146: syntax error : missing ';' before identifier 'Information'
error C2501: 'ULONG_PTR' : missing storage-class or type specifiers
error C2501: 'Information' : missing storage-class or type specifiers
error C2146: syntax error : missing ';' before identifier 'ActiveProcessorsAffinityMask'
error C2501: 'KAFFINITY' : missing storage-class or type specifiers
等多个编译错,几乎全部是符号未定义。

解决办法:
用VS2005的include目录的BaseTsd.h文件替换VC6的相应文件即可。VS2003和2008的没有试验过。


但是我仍然得到许多符号未定义的错误。这是别人的一个工程,拿来就在VC2008上用了,所以工程属性什么都也没设置。关键是编译时报缺少ntdll.h错误,所以在网上找了个。

有知道的达人提供一些解决问题的线索吗?感谢!

阿里云助力开发者!2核2G 3M带宽不限流量!6.18限时价,开 发者可享99元/年,续费同价!

收藏
点赞0
打赏
分享
最新回复 (3)
雪    币: 41
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
tbuffay 2012-10-24 13:19
2
0
应该是版本问题。建议使用原编译器编译通过再尝试使用其他编译器,便于排除问题。
雪    币: 30
活跃值: (17)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
又迟到了 2012-10-24 14:44
3
0
我一般把要用的NATIVE API的申明拷贝到一个单独的头文件中使用的。楼主可以试下。
雪    币: 442
活跃值: (723)
能力值: ( LV7,RANK:100 )
在线值:
发帖
回帖
粉丝
wangshy 2 2012-10-24 15:34
4
0
还原VC6环境,在 #include "ntdll.h" 这前加上下面的定义

#ifndef ULONG_PTR
#define ULONG_PTR unsigned long
#endif

#ifndef KAFFINITY
#define KAFFINITY ULONG_PTR
#endif

#ifndef FORCEINLINE
#if (_MSC_VER >= 1200)
#define FORCEINLINE __forceinline
#else
#define FORCEINLINE __inline
#endif
#endif

#include "ntdll.h"
游客
登录 | 注册 方可回帖
返回