毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> 嵌入式 >> 正文

NtMapViewOfSection防止DLL注入源代码

更新时间:2013-2-13:  来源:毕业论文

NtMapViewOfSection防止DLL注入源代码
为了防止DLL注入 SSDT HOOK 了NtMapViewOfSection函数:
NTSTATUS MyNtMapViewOfSection(                               __in HANDLE SectionHandle,                               __in HANDLE ProcessHandle,                               __inout PVOID *BaseAddress,                               __in ULONG_PTR ZeroBits,                               __in SIZE_T CommitSize,                               __inout_opt PLARGE_INTEGER SectionOffset,                               __inout PSIZE_T ViewSize,                               __in SECTION_INHERIT InheritDisposition,                               __in ULONG AllocationType,                               __in ULONG Win32Protect                               ) {     PSECTION Section;     PEPROCESS Process;     NTSTATUS status;     if (ObReferenceObjectByHandle (ProcessHandle,0,*PsProcessType,0,(PVOID *)&Process,NULL) == 0)     {         if (strstr((char*)PsGetProcessImageFileName(Process),"taskmgr"))         {             if (ObReferenceObjectByHandle (SectionHandle,0,0,0,(PVOID*)&Section,NULL) == 0)             {                 if (Section->Segment->ControlArea!=0 && Section->Segment->ControlArea->FilePointer!=0)                 {                     if (Section->Segment->ControlArea->FilePointer->FileName.Buffer!=0)                     {                         if (wcsstr(Section->Segment->ControlArea->FilePointer->FileName.Buffer,L"npggNT.des"))                         {                             ObDereferenceObject(Section);                             ObDereferenceObject(Process);                             return STATUS_ACCESS_DENIED;                         }                     }                 }                   ObDereferenceObject(Section);             }                     }         ObDereferenceObject(Process);     }     __asm     {         push Win32Protect         push AllocationType         push InheritDisposition         push ViewSize         push SectionOffset         push CommitSize         push ZeroBits         push BaseAddress         push ProcessHandle         push SectionHandle         call [g_MapViewOfSectionCall]         mov status ,eax     }     return status; }

是防止了注入 但是有时候蓝屏 蓝在 if (Section->Segment->ControlArea->FilePointer->FileName.Buffer!=0) 这句
反复思考觉得可能是调用OpenFileMapping MapViewOfFile...函数映射文件导致的
不熟悉 _SECTION_OBJECT这对象。。。
请问怎么判断调用此函数是不是为了加载DLL

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。