首页
社区
课程
招聘
[求助]hook ZwCreateFile后office、rar等软件打不开
发表于: 2010-9-28 13:40 4207

[求助]hook ZwCreateFile后office、rar等软件打不开

2010-9-28 13:40
4207
hook ZwCreateFile后office、rar和vs2003等软件打不开,而一些小软件不受影响,例如记事本,上网等,不知道为什么。用Dbgview查看了一下,运行office、rar和vs2003并没有拦截。代码如下
NTSTATUS NewZwCreateFile( 
								  OUT PHANDLE FileHandle, 
								  IN ACCESS_MASK DesiredAccess, 
								  IN POBJECT_ATTRIBUTES ObjectAttributes, 
								  OUT PIO_STATUS_BLOCK IoStatusBlock, 
								  IN PLARGE_INTEGER AllocationSize  OPTIONAL, 
								  IN ULONG FileAttributes, 
								  IN ULONG ShareAccess, 
								  IN ULONG CreateDisposition, 
								  IN ULONG CreateOptions, 
								  IN PVOID EaBuffer  OPTIONAL, 
								  IN ULONG EaLength 
								  )
{
	NTSTATUS nStatus = STATUS_SUCCESS;
	UNICODE_STRING yyo;
	ANSI_STRING tbb;
	RtlUnicodeStringToAnsiString(&tbb,ObjectAttributes->ObjectName,TRUE);
	if((strstr(tbb.Buffer,"共享")!=NULL)&((CreateDisposition == FILE_CREATE)||(CreateDisposition == FILE_OPEN_IF)||(CreateDisposition==FILE_OVERWRITE_IF)))
	{
		DbgPrint("符合规则\n");
		DbgPrint("%s\n",tbb.Buffer);
		return STATUS_OBJECT_NAME_NOT_FOUND;   //返回失败
	}
	else
	{
		//DbgPrint("不符合规则\n");
		nStatus=((_ZWCREATEFILE)( Old_ZwCreateFile))(FileHandle,DesiredAccess,ObjectAttributes,IoStatusBlock,AllocationSize,FileAttributes,ShareAccess,CreateDisposition,CreateOptions,EaBuffer,EaLength );//不然给原函数执行
	}
	return STATUS_SUCCESS;
}

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

收藏
免费 0
支持
分享
最新回复 (1)
雪    币: 19
活跃值: (10)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
2
自己解决了,忘记返回值了
2010-9-28 14:09
0
游客
登录 | 注册 方可回帖
返回
//