阅读:2658回复:11
winbase.h 怎么不能用呀????怎么用???急!!
我用driverstudio在win2000下,开发wdm驱动程序,能不能用基本的API函数?
如果能,为什么我加了winbase.h之后,就会出错!而且,错误都是winbase.h中的诸如此类错误: c:\\NTDDK\\inc\\winbase.h(222) : error C2146: syntax error : missing \';\' before identifier \'Offset\' c:\\NTDDK\\inc\\winbase.h(222) : error C2501: \'DWORD\' : missing storage-class or type specifiers c:\\NTDDK\\inc\\winbase.h(222) : error C2501: \'Offset\' : missing storage-class or type specifiers c:\\NTDDK\\inc\\winbase.h(223) : error C2146: syntax error : missing \';\' before identifier \'OffsetHigh\' c:\\NTDDK\\inc\\winbase.h(223) : error C2501: \'DWORD\' : missing storage-class or type specifiers c:\\NTDDK\\inc\\winbase.h(223) : error C2501: \'OffsetHigh\' : missing storage-class or type specifiers c:\\NTDDK\\inc\\winbase.h(228) : error C2146: syntax error : missing \';\' before identifier \'nLength\' c:\\NTDDK\\inc\\winbase.h(228) : error C2501: \'DWORD\' : missing storage-class or type specifiers c:\\NTDDK\\inc\\winbase.h(228) : error C2501: \'nLength\' : missing storage-class or type specifiers c:\\NTDDK\\inc\\winbase.h(229) : error C2146: syntax error : missing \';\' before identifier \'lpSecurityDescriptor\' c:\\NTDDK\\inc\\winbase.h(229) : error C2501: \'LPVOID\' : missing storage-class or type specifiers c:\\NTDDK\\inc\\winbase.h(229) : error C2501: \'lpSecurityDescriptor\' : missing storage-class or type specifiers c:\\NTDDK\\inc\\winbase.h(230) : error C2146: syntax error : missing \';\' before identifier \'bInheritHandle\' 有那位高手指点一下!急!谢谢!! |
|
|
沙发#
发布于:2002-07-03 16:13
。。。不能用。。。
|
|
板凳#
发布于:2002-07-03 16:23
不能用,可他包含在ntddk的头文件里???
能否解释一下,为什么不能用????????????????/ |
|
|
地板#
发布于:2002-07-03 16:26
不能用winbase.h文件,ntddk.h文件中包含了ntdef.h文件,并没有包含winbase.h文件。
|
|
|
地下室#
发布于:2002-07-03 16:27
不能用winbase.h文件,ntddk.h文件中包含了ntdef.h文件,并没有包含winbase.h文件。
不能用的原因是winbase.h定义的是应用层用的基本数据类型宏及相关结构。而ntdef.h文件定义了内核中使用的 |
|
|
5楼#
发布于:2002-07-03 16:51
看看是不是少了分号;
只要前面少了一个分号,后面回出几十个错误,甚至更多, 仔细再查查。 以上结论根据本人多年经验得到 |
|
6楼#
发布于:2002-07-03 16:55
哦!我明白了!非常感谢!!!
但是,也有一些函数在应用层能用的在内核也能用呀!比如说,我曾经在我的程序里用memset函数???是什么原因那? |
|
|
7楼#
发布于:2002-07-03 16:55
这种错误一般是因为在你的程序里有类似缺少分号的错误造成的。
|
|
|
8楼#
发布于:2002-07-03 17:21
哦!我明白了!非常感谢!!! ntddk/inc also have a set of stdio. stdlib. although the prototype is same with platform sdk, the lib itself is different. the native version is RtlCopyMemory... |
|
9楼#
发布于:2002-07-03 17:27
这并不奇怪,应用层的许多函数内核也是可以用的。一个函数能不能用,不管是在内核还是在应用层,都要满足最基本的两个条件:
1.有原形声明(在调用这前声明或定义 ) 2.有函数体的定义,如果是包含在动态库中或其它的组件中,则一定要保证能顺利连接。 一些应用层能用而内核层不能用的函数主要是C的运行时函数,特别是涉及到内存动态分配的函数一定不能用。内核中不支持new,delete等操作。所以用应用程序的函数是不安全的大部分在此。不涉及内存动态分配的函数在两种场合都可以通用,关键你要知道,你要使用的函数体内是否使用了动态内存分配。 |
|
|
10楼#
发布于:2002-07-03 17:31
非常感谢@!!非常感谢!!!非常感谢!!!
对了,我还不知道怎么给分那?? |
|
|
11楼#
发布于:2002-07-03 17:34
起始贴下面有给分按钮
|
|
|