首页
社区
课程
招聘
[求助][求助]变态的KMUTEX
发表于: 2010-9-13 14:09 5122

[求助][求助]变态的KMUTEX

2010-9-13 14:09
5122
KMUTEX  g_Mutex1;
KMUTEX  g_Mutex2;
KMUTEX  g_Mutex3;
KMUTEX  g_Mutex4;
KMUTEX  g_Mutex5;

KeInitializeMutex( &g_Mutex1, 0 );
KeInitializeMutex( &g_Mutex2, 0 );
KeInitializeMutex( &g_Mutex3, 0 );
KeInitializeMutex( &g_Mutex4, 0 );

KeInitializeMutex( &g_Mutex5, 0 );

LONG lState = KeReadStateMutex(&g_Mutex4);
// 如果把KeInitializeMutex( &g_Mutex5, 0 );注释掉,则lState=1,否则是0xee90a840

KeWaitForMutexObject( &g_Mutex4, Executive, KernelMode, FALSE, NULL )
// 如果lState=1,则顺利,如果是大于1的值,则停在这里了,不下去了
请问大家是什么原因。

是因为不能申请这么多变量?

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
免费 0
支持
分享
最新回复 (1)
雪    币: 204
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
搞定了。。。。。。。

PKMUTEX  g_pMutex1 = NULL;
PKMUTEX  g_pMutex2 = NULL;
PKMUTEX  g_pMutex3 = NULL;
PKMUTEX  g_pMutex4 = NULL;
PKMUTEX  g_pMutex5 = NULL;

KeInitializeMutex( g_pMutex1, 0 );
KeInitializeMutex( g_pMutex2, 0 );
KeInitializeMutex( g_pMutex3, 0 );
KeInitializeMutex( g_pMutex4, 0 );
KeInitializeMutex( g_pMutex5, 0 );

g_Mutex1 = (PKMUTEX)ExAllocatePoolWithTag(NonPagedPool, sizeof(KMUTEX),'TSET');
g_Mutex2 = (PKMUTEX)ExAllocatePoolWithTag(NonPagedPool, sizeof(KMUTEX),'TSET');
g_Mutex3 = (PKMUTEX)ExAllocatePoolWithTag(NonPagedPool, sizeof(KMUTEX),'TSET');
g_Mutex4 = (PKMUTEX)ExAllocatePoolWithTag(NonPagedPool, sizeof(KMUTEX),'TSET');
g_Mutex5 = (PKMUTEX)ExAllocatePoolWithTag(NonPagedPool, sizeof(KMUTEX),'TSET');
2010-9-13 15:28
0
游客
登录 | 注册 方可回帖
返回
//