skymartin
驱动牛犊
驱动牛犊
  • 注册日期2004-07-12
  • 最后登录2005-03-04
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:3025回复:5

PsSetCreateProcessNotifyRoutine一问

楼主#
更多 发布于:2004-07-12 15:53
我的环境为xp操作系统, vc6, 装了NTDDK

想问问如何解决下面的错误,

分数够可以再加, 急着解决问题~~~~~


#define _X86_
#include <ntddk.h>

VOID ProcessCreateMon ( IN HANDLE hParentId, IN HANDLE PId,IN BOOLEAN bCreate )
{
return;
}

int main()
{
NTSTATUS status = PsSetCreateProcessNotifyRoutine( ProcessCreateMon, FALSE );
    if (!NT_SUCCESS( status ))
    {
        return 0;
    }    

return 0;
}
上面这段程序出现错误
--------------------Configuration: proc_mon - Win32 Debug--------------------
Compiling...
main.cpp
Linking...
main.obj : error LNK2001: unresolved external symbol "long __cdecl PsSetCreateProcessNotifyRoutine(void (__cdecl*)(void *,void *,unsigned char),unsigned char)" (?PsSetCreateProcessNotifyRoutine@@YAJP6AXPAX0E@ZE@Z)
Debug/proc_mon.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.


但是如果去掉#define _X86_(我看别人的例子中也没有这个)就出现如下错误:


--------------------Configuration: proc_mon - Win32 Debug--------------------
Compiling...
main.cpp
d:\program files\ntddk\inc\ddk\ntddk.h(7914) : error C2146: syntax error : missing ';' before identifier 'InterruptTime'
d:\program files\ntddk\inc\ddk\ntddk.h(7914) : error C2501: 'InterruptTime' : missing storage-class or type specifiers
d:\program files\ntddk\inc\ddk\ntddk.h(7928) : error C2146: syntax error : missing ';' before identifier 'SystemTime'
d:\program files\ntddk\inc\ddk\ntddk.h(7928) : error C2086: 'KSYSTEM_TIME' : redefinition
d:\program files\ntddk\inc\ddk\ntddk.h(7928) : error C2501: 'SystemTime' : missing storage-class or type specifiers
d:\program files\ntddk\inc\ddk\ntddk.h(7935) : error C2146: syntax error : missing ';' before identifier 'TimeZoneBias'
d:\program files\ntddk\inc\ddk\ntddk.h(7935) : error C2086: 'KSYSTEM_TIME' : redefinition
d:\program files\ntddk\inc\ddk\ntddk.h(7935) : error C2501: 'TimeZoneBias' : missing storage-class or type specifiers
d:\program files\ntddk\inc\ddk\ntddk.h(9101) : error C2146: syntax error : missing ';' before identifier 'ContextRecord'
d:\program files\ntddk\inc\ddk\ntddk.h(9101) : error C2501: 'PCONTEXT' : missing storage-class or type specifiers
d:\program files\ntddk\inc\ddk\ntddk.h(9101) : error C2501: 'ContextRecord' : missing storage-class or type specifiers
d:\program files\ntddk\inc\ddk\ntddk.h(10051) : error C2146: syntax error : missing ';' before identifier 'KeTickCount'
d:\program files\ntddk\inc\ddk\ntddk.h(10051) : fatal error C1004: unexpected end of file found
Error executing cl.exe.

proc_mon.exe - 13 error(s), 0 warning(s)
wowocock
VIP专家组
VIP专家组
  • 注册日期2002-04-08
  • 最后登录2016-01-09
  • 粉丝16
  • 关注2
  • 积分601分
  • 威望1651点
  • 贡献值1点
  • 好评度1227点
  • 原创分1分
  • 专家分0分
沙发#
发布于:2004-07-12 16:17
extern "C"
PsSetCreateProcessNotifyRoutine@@YAJP6AXPAX0E@ZE@Z
明显不对,应该是
_PsSetCreateProcessNotifyRoutine@8
没事别老用CPP来写驱动,用C不是很好吗????

[编辑 -  7/12/04 by  wowocock]
花开了,然后又会凋零,星星是璀璨的,可那光芒也会消失。在这样 一瞬间,人降生了,笑者,哭着,战斗,伤害,喜悦,悲伤憎恶,爱。一切都只是刹那间的邂逅,而最后都要归入死亡的永眠
skymartin
驱动牛犊
驱动牛犊
  • 注册日期2004-07-12
  • 最后登录2005-03-04
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2004-07-12 17:33
把cpp改成c了,但是还是不行.错误代码如下:

我主要是想写一个监视windows中进程的创建与销毁的监视器.

--------------------Configuration: proc_mon - Win32 Debug--------------------
Compiling...
main.c
Linking...
main.obj : error LNK2001: unresolved external symbol _PsSetCreateProcessNotifyRoutine
Debug/proc_mon.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
wowocock
VIP专家组
VIP专家组
  • 注册日期2002-04-08
  • 最后登录2016-01-09
  • 粉丝16
  • 关注2
  • 积分601分
  • 威望1651点
  • 贡献值1点
  • 好评度1227点
  • 原创分1分
  • 专家分0分
地板#
发布于:2004-07-12 20:15
网上有现成的例子的......
花开了,然后又会凋零,星星是璀璨的,可那光芒也会消失。在这样 一瞬间,人降生了,笑者,哭着,战斗,伤害,喜悦,悲伤憎恶,爱。一切都只是刹那间的邂逅,而最后都要归入死亡的永眠
qiangguo64
驱动牛犊
驱动牛犊
  • 注册日期2005-01-12
  • 最后登录2009-08-28
  • 粉丝0
  • 关注0
  • 积分144分
  • 威望15点
  • 贡献值1点
  • 好评度14点
  • 原创分0分
  • 专家分0分
地下室#
发布于:2007-11-20 11:46
--------------------Configuration: proc_mon - Win32 Debug--------------------

显然不能在win32中调用PsSetCreateProcessNotifyRoutine 嘛
Aiscii
驱动牛犊
驱动牛犊
  • 注册日期2003-01-21
  • 最后登录2016-01-09
  • 粉丝0
  • 关注0
  • 积分131分
  • 威望23点
  • 贡献值0点
  • 好评度13点
  • 原创分0分
  • 专家分0分
5楼#
发布于:2007-11-23 09:15
这种活
wmi就可以了。
游客

返回顶部