已经把相关的.h和.lib包含,但编译时候还出现下面错误
hookndis.obj() : error LNK2001: unresolved external symbol "__declspec(dllimport) long __stdcall ZwQuerySystemInformation(unsigned long,void *,unsigned long,unsigned long *)" (__imp_?ZwQuerySystemInformation@@YGJKPAXKPAK@Z)
objchk\i386\sys.sys() : error LNK1120: 1 unresolved externals什么原因?如何解决?
谢谢
hookndis.obj() : error LNK2001: unresolved external symbol "__declspec(dllimport) long __stdcall ZwQuerySystemInformation(unsigned long,void *,unsigned long,unsigned long *)" (__imp_?ZwQuerySystemInformation@@YGJKPAXKPAK@Z)
objchk\i386\sys.sys() : error LNK1120: 1 unresolved externals什么原因?如何解决?
谢谢
解决方案 »
- 为什么我用FindWindow找不到杀毒软件相关的句柄
- 如何给CRichEditCtrl中一段文字设置背景色
- 怎样遍历一个文件夹文件
- 如何判断某个窗口是否在最前面?
- 请问vc中突然看不到类表是为什么?
- 怎样能设计出象 WinAmp 哪样带子级菜单的系统菜单!
- 要打开一个文件,用什么控件
- 主对话框中访问属性页(子对话框)上的控件
- COM服务器中如何调用客户端的回调函数,急急急!!!!
- 新手求大佬
- 问一个关于CEdit控件的问题。如我想在CEdit框中,一敲入字符,就让按钮激活, 而立刻把CEdit框中的字符删去,又把按钮变会。 这个过程抓
- Visual Studio初始化有问题无法继续工作,恳请您来帮忙!
then GetProcAddress("ZwQuerySysemInformation"...)
//ntdll.lib可以在Windows 2000 DDK中找到
在ntdll.lib里面有,利用他可以hook系统核心的apimasterz,你的方法不行,我已经把这些库包含进去了~~
对了,是系统的函数都用不了,都有这种错误~~~
#include <windows.h>
#include <stdio.h>#define NTAPI __stdcalltypedef LONG NTSTATUS;
typedef LONG KPRIORITY;#define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0)#define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L)
#define SystemTimeInformation 3typedef struct _SYSTEM_TIME_INFORMATION
{
LARGE_INTEGER liKeBootTime;
LARGE_INTEGER liKeSystemTime;
LARGE_INTEGER liExpTimeZoneBias;
ULONG uCurrentTimeZoneId;
DWORD dwReserved;
} SYSTEM_TIME_INFORMATION;extern "C"
NTSYSAPI
NTSTATUS
NTAPI
ZwQuerySystemInformation(
IN UINT SystemInformationClass,
IN OUT PVOID SystemInformation,
IN ULONG SystemInformationLength,
OUT PULONG ReturnLength OPTIONAL
);#pragma comment(lib, "ntdll.lib")void main(int argc,char * argv[])
{
SYSTEM_TIME_INFORMATION Sti;
NTSTATUS Status;
FILETIME ftSystemBoot;
SYSTEMTIME stSystemBoot; Status = ZwQuerySystemInformation(SystemTimeInformation,&Sti,sizeof(Sti),0);
if (Status!=NO_ERROR)
return; ftSystemBoot = *(FILETIME *)&(Sti.liKeBootTime); FileTimeToLocalFileTime(&ftSystemBoot,&ftSystemBoot);
FileTimeToSystemTime(&ftSystemBoot,&stSystemBoot); printf("System Reboot Date: %02d-%02d-%04d\nTime: %02d:%02d:%02d\n",
stSystemBoot.wMonth,stSystemBoot.wDay,stSystemBoot.wYear,
stSystemBoot.wHour,stSystemBoot.wMinute,stSystemBoot.wSecond);
}
用这个函数怎么hook系统api?