-
-
[求助][求助]关于RtlPrefixUnicodeString 的问题
-
发表于:
2009-4-23 10:25
6353
-
[求助][求助]关于RtlPrefixUnicodeString 的问题
我hook了ZwCreateFile,实现对特定文件夹的保护。防止在这个文件夹内所有的文件创建操作。
得到ZwCreateFile请求的路径后,我使用RtlPrefixUnicodeString与我指定的UNICODE_STRING进行比较(\\??\\E:\\zion),但是在调用RtlPrefixUnicodeString的时候总是返回STATUC_ACCESS_VIOLATION,哪位大侠帮我看下,谢谢了
下面是先关代码,而且总是在红色的地方出错。
__try{
if (ObjectAttributes->RootDirectory)
{
Status = ObReferenceObjectByHandle(
ObjectAttributes->RootDirectory,
0,
NULL,
KernelMode,
&Object,
NULL);
if (!NT_SUCCESS(Status))
{。。。。。}
Status = ObQueryNameString(Object,NULL,0,&PathLength);
NameInfo2 = (POBJECT_NAME_INFORMATION)ExAllocatePool(PagedPool,PathLength);
if (NameInfo2 == NULL)
{。。。。。。}
Status = ObQueryNameString( Object,NameInfo2PathLength,&PathLength);
if (!NT_SUCCESS(Status))
{。。。。。。}
KdPrint(("[NewZwCreateFile]file to operate is: %S\n", NameInfo2->Name.Buffer));
//to compare
if(RtlPrefixUnicodeString(&File2Protect,&NameInfo->Name,TRUE)){
IoStatusBlock->Information = FILE_DOES_NOT_EXIST;
Status = OldNtCreateFile(
0,
DesiredAccess,
ObjectAttributes,
IoStatusBlock,
AllocationSize,
FileAttributes,
ShareAccess,
CreateDisposition,
CreateOptions,
EaBuffer,
EaLength);
}else goto OriginalCall;
}__except(EXCEPTION_EXECUTE_HANDLER){
Status = GetExceptionCode();
KdPrint(("NewNtCreateFile exception occurred,%.8x\n",Status));
goto Exit;
}
[课程]FART 脱壳王!加量不加价!FART作者讲授!