阅读:3347回复:21
ZwQuerySystemInformation,在wdm中如何使用啊。
ZwQuerySystemInformation,在wdm中如何使用啊。
定义了头文件,而在cpp中用的时候,说, test.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) long __stdcall ZwQuerySystemInformation(enum _SYSTEM_INFORMATION_CLASS,void *,unsigned long,unsigned long *)" (__imp_?ZwQuerySystemInformation@@YGJW4_SYSTEM_INFORMATION_CLAS S@@PAXKPAK@Z) |
|
沙发#
发布于:2004-07-08 23:32
d :D
|
|
板凳#
发布于:2004-07-09 00:15
用c调用
|
|
|
地板#
发布于:2004-07-09 08:08
如何用c调用,请斑竹或其他高人明示。
我只是在基本的wdm中,用这个函授。 |
|
地下室#
发布于:2004-07-09 08:14
如何用c调用,请斑竹或其他高人明示。 你的源文件的扩展名是cpp, 要把你的DDK头文件用extern "C" {括起来 #ifdef _cplusplus extern "C" { #endif #include<wdm.h> #ifdef _cplusplus } #endif |
|
|
5楼#
发布于:2004-07-09 08:32
动态获得涵数地址.
|
|
|
6楼#
发布于:2004-07-09 09:05
我正在试seaquester的方法,五分钟后就有结果了。
至于wowocock所说的动态获得涵数地址,如何办到。 |
|
7楼#
发布于:2004-07-09 12:39
.cpp文件中 ZwQuerySystemInformation应该这样声明:
#ifdef _cplusplus extern "C" { #endif #include "test.h" #ifdef _cplusplus } #endif |
|
|
8楼#
发布于:2004-07-09 12:44
我把test.cpp中的#include "test.h"
换成如下 #include <vdw.h> #ifdef _cplusplus extern "C" { #endif #include "test.h" #ifdef _cplusplus } #endif #pragma hdrstop("Test.pch") #pragma code_seg("INIT") NTSTATUS DriverEntry( IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath ) { ........ ........ 还是不行。一样的错。 Linking... test.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) long __stdcall ZwQuerySystemInformation(enum _SYSTEM_INFORMATION_CLASS,void *,unsigned long,unsigned long *)" (__imp_?ZwQuerySystemInformation@@YGJW4_SYSTEM_INFORMATION_CLAS S@@PAXKPAK@Z) .\objchk\i386\test.sys : fatal error LNK1120: 1 unresolved externals Error executing link.exe. 哪位,如果用过ZwQuerySystemInformation,我可以把我的工程发给他,帮我改好再发给我。请留下email 再次感谢 seaquester的帮助 |
|
9楼#
发布于:2004-07-09 12:47
去掉
ULONG n; ZwQuerySystemInformation(SystemModuleInformation,&n,0,&n);//此处错 这两行,就可以通过。 |
|
10楼#
发布于:2004-07-09 13:18
这是我的工程,我去掉了我的头文件定义,只是一个空的工程。
请帮我把 ZwQuerySystemInformation调用,编译通过。 请高手帮忙,搞定后结帖加分。 |
|
|
11楼#
发布于:2004-07-10 17:40
呵呵,其实seaquester说得对,只是楼主可能刚开始学驱动编程,不能正确理解罢了。
TEST.H : ---------------------------- #ifndef TEST_H #define TEST_H #ifdef _cplusplus extern "C" { #endif #include <ntddk.h> ..... // // 在这里声明未公开函数 // NTSYSAPI NTSTATUS NTAPI ZwQuerySystemInformation( IN SYSTEM_INFORMATION_CLASS SystemInformationClass, OUT PVOID SystemInformation, IN ULONG SystemInformationLength, OUT PULONG ReturnLength OPTIONAL ); #ifdef _cplusplus } #endif //.....其它变量 #endif --------------------------------- TEST.CPP ----------------- #include "Test.h" |
|
12楼#
发布于:2004-07-10 19:00
是不是我不应该用drivestudio成生simple c++ drive啊
他没有包含ntddk.h 而是#include <vdw.h> 不过,我想可能里面包了ntddk.h 希望高手,能帮我解决此问题。 我花在上面快一周时间了。 下面的代码,已经声名好。只是link不过,希望高手,下载,设置下,Link通过,发给在下。迫切希望高手,能帮助我们这样的新手。 lglee@fiberhome.com.cn 分不是问题。若有csdn账号的,我可以给他2000分。在vc/mfc版块,我是二星,有几千可用分。 只是才学驱动,希望高手带小弟一把。 |
|
|
13楼#
发布于:2004-07-10 20:00
你使用DriverStudio生成代码时选择的WDM方式,所以没有增加ntoskrnl.lib库,你在工程中增加这个库,然后把#ifdef _cplusplus去掉就可以了。
|
|
|
14楼#
发布于:2004-07-10 20:14
我是用DriverStudio生成代码,但没有选择WDM方式,是simple c++ dirve.
希望各位,下载我的程序,看一眼就行了。 而且我按楼上所说,重建了一个选wdm的drive,把#ifdef _cplusplus extern "C" { #endif 去掉了。 结果还是 Test2.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) long __stdcall ZwQuerySystemInformation(enum _SYSTEM_INFORMATION_CLASS,void *,unsigned long,unsigned long *)" (__imp_?ZwQuerySystemInformation@@YGJW4_SYSTEM_INFORMATION_CLA SS@@PAXKPAK@Z) .\objchk\i386\test2.sys : fatal error LNK1120: 1 unresolved externals Error executing link.exe. test2.sys - 2 error(s), 0 warning(s) 希望有人下载上面的例程,帮忙看一下。 [编辑 - 7/10/04 by wwwllg] |
|
15楼#
发布于:2004-07-10 20:41
我从来不使用DriverStudio的C++库开发驱动,我认为那是自找麻烦!!!
这是我的一个使用DDK开发的例子,你下载去看看。 |
|
|
16楼#
发布于:2004-07-10 21:01
我是用DriverStudio生成代码,但没有选择WDM方式,是simple c++ dirve. 兄弟,我已经按我说的修改然后编译了你的Sample,并通过了 |
|
|
17楼#
发布于:2004-07-10 21:02
谢谢了,我先下下来看看
[编辑 - 7/10/04 by wwwllg] |
|
18楼#
发布于:2004-07-10 21:04
我是用DriverStudio生成代码,但没有选择WDM方式,是simple c++ dirve. |
|
|
19楼#
发布于:2004-07-10 21:09
谢谢大家,可以通过了。
都可以了。 哈哈! 我马上给分你们。 |
|
上一页
下一页