|
[求助]ZwMapViewOfSection中获取视图数据内容大小的问题
是不是用RtlInitAnsiString 未手动分配内存有问题啊 |
|
[求助]关于MapViewOfFile返回值的问题,请大家帮忙
已经解决,问题出在我在打印BaseAddress时,应该加上*,定义的时候 是IN OUT PVOID *BaseAddress。 自己太大意了 |
|
[求助]关于MapViewOfFile返回值的问题,请大家帮忙
memfile.exe就是应用层使用mapviewoffile进行内存映射的程序,映射的是一个txt文件 截图显示 打印出的BaseAddress值并不固定,而且都没有拦截到0xca0000这个地址。在驱动中指定0xca0000地址打印出来的数据是“北京是中国的首都”,证明已经映射成功。而试图打印BaseAddress地址上的数据也打不出来,应该为空 |
|
[求助]关于MapViewOfFile返回值的问题,请大家帮忙
NTSTATUS HookZwMapViewOfSection( IN HANDLE SectionHandle, IN HANDLE ProcessHandle, IN OUT PVOID *BaseAddress, IN ULONG_PTR ZeroBits, IN SIZE_T CommitSize, IN OUT PLARGE_INTEGER SectionOffset OPTIONAL, IN OUT PSIZE_T ViewSize, IN SECTION_INHERIT InheritDisposition, IN ULONG AllocationType, IN ULONG Win32Protect ) { NTSTATUS Status; ANSI_STRING AsiProcessName; UNICODE_STRING UniProcessName; UNICODE_STRING UniWinword; ANSI_STRING Content; PVOID *temp = BaseAddress; PVOID lpbase = (PVOID)0xca0000;//这里指定了0xca0000这个内存地址 // 打印进程信息 PEPROCESS pEProcess = PsGetCurrentProcess(); PTSTR ProcessName = (PTSTR)((ULONG)pEProcess + 0x174); RtlInitAnsiString(&AsiProcessName,ProcessName); DbgPrint(":: ZwMapViewOfSection ProcessName = %s",ProcessName); UniProcessName.Buffer = (PWCHAR)ExAllocatePool(NonPagedPool,1024); if(UniProcessName.Buffer == NULL) { DbgPrint("BIG ERROR"); Status = STATUS_INSUFFICIENT_RESOURCES;// errror code return Status;//return error code } UniProcessName.MaximumLength = 1024; RtlAnsiStringToUnicodeString(&UniProcessName,&AsiProcessName,FALSE); RtlInitUnicodeString(&UniWinword,TARGETPROCESS);//TARGETPROCESS暂时定义为memfile.exe //调用原系统ZwMapViewOfSection函数 Status = OldZwMapViewOfSection(SectionHandle,ProcessHandle, BaseAddress, ZeroBits,CommitSize, SectionOffset, ViewSize, InheritDisposition, AllocationType, Win32Protect); if(!RtlCompareUnicodeString(&UniProcessName,&UniWinword,TRUE)) //如果是memfile进程,则打印输出信息。 { DbgPrint(" %s",(PSTR)lpbase);//如果是memfile进程,试图打印0xca0000内存地址上的内容 } ExFreePool(UniProcessName.Buffer); UniProcessName.Buffer = NULL; UniProcessName.MaximumLength = 0; //打印ZwMapViewOfSection函数各参数值,进行分析 DbgPrint("SectionHandle =%p, ProcessHandle =%p,BaseAddress =%x, ZeroBits =%u, CommitSize = %u, SectionOffset =%L, ViewSize =%x\n",SectionHandle,ProcessHandle,BaseAddress,ZeroBits,CommitSize,&SectionOffset,*ViewSize); DbgPrint("2222222222content:"); DbgPrint("%s",(PSTR)temp);//打印BaseAddress地址上的数据 return Status; } |
|
[求助]关于MapViewOfFile返回值的问题,请大家帮忙
感谢楼上的兄弟,的确在用winhex打开目标进程之前,目标经常已经unmap了视图,修改之后,在winhex中可以看到内存0xca0000上记事本中的内容了。 现在,我进行第二步,在驱动程序中hook ZwMapViewOfSection这个内核函数,我想在驱动上拦截memfile.exe进程内存映射的过程,如果正常情况下ZwMapViewOfSection也会返回一个视图地址BaseAddress,这个地址与应用层中mapviewoffile返回的地址应该是一样的。 现在我遇到的问题是:我把memfile .exe调用到的ZwMapViewOfSection函数视图地址BaseAddress都打印出来,但是没有拦截到与mapviewoffile返回值相同的地址。开始以为没有映射成功,后来我在驱动中直接打印 0xca0000 (mapviewoffile返回值)这个内存地址,却得到了记事本文档的内容,证明已经映射成功。 既然已经映射成功,ZwMapViewOfSection中BaseAddress返回的地址为什么没有 0xca0000 ?有很多其他地址都打印出来了,唯独没有这个,感到很疑惑 请大侠们指点迷津 |
|
[求助]关于内存映射的一些问题ZwMapViewOfSection
还在等候大家的高见!!! 我的程序结构 hookZwMapViewOfSection(………………) { PCHAR *temp = BaseAddress; ………………………… //调用原来系统的ZwMapViewOfSection Status = OldZwMapViewOfSection(SectionHandle,ProcessHandle, BaseAddress, ZeroBits,CommitSize, SectionOffset, ViewSize, InheritDisposition, AllocationType, Win32Protect); //输出函数参数进行分析 DbgPrint("SectionHandle =%p, ProcessHandle =%p,BaseAddress =%p, ZeroBits =%u, CommitSize = %u, SectionOffset =%L, ViewSize =%u\n",SectionHandle,ProcessHandle,BaseAddress,ZeroBits,CommitSize,&SectionOffset,*ViewSize); ……………… //打印视图基址内容,输出5个字节 DbgPrint("content:"); for (i = 0; i < 5; i ++) { DbgPrint("%c",temp+'0'); temp++; } } 我输出了ZwMapViewOfSection的各个参数,发现BaseAddress 基址很小像007f814,而viewsize却很大2997005648. 想请教各位,我直接打印BaseAddress的内容是否能得到记事本的内容?我这样写代码DbgPrint("%c",(PCHAR)temp+'0');是否正确?包括我输出的参数值,是我没写好代码,还是就是这样的。 等候答复,谢谢 |
|
[求助]关于内存映射的一些问题ZwMapViewOfSection
恩 楼上说的这个 我也有考虑 其实现在我hook ZwMapViewOfSection之前,我就已经把文件IO的几个函数都hook,包括zwcreatefie,zwopenfile, zwreadfile zwwritefile,刚开始我只hook这些IO函数,发现对记事本加密没有,查看资料之后,才知道记事本文件和office文件都是采用的文件映射方法。 现在我hook ZwMapViewOfSection,ZwCreateSection两个关于内存映射的函数,主要研究ZwMapViewOfSection,想找到打开文件的数据内容。 我在hook ZwMapViewOfSection中都打印了当前进程,所以我可以确定哪些是notepad.exe输出的相关数据,如baseaddress,viewsize等ZwMapViewOfSection的参数。 现在我遇到的问题是,我输出不了文件的数据内容,不清楚怎样根据baseaddress找到数据内容。 请大家再帮小弟看看,一直都很着急,很长时间没进展了, 谢了。 |
|
[求助]关于内存映射的一些问题ZwMapViewOfSection
论坛里发帖的人真积极,帖一下沉了 我把问题补充一下吧。 我现在想从BaseAddress访问内存,ddk文档写ZwMapViewOfSection的参数N OUT PVOID *BaseAddress,是指向映射区视图的基地址,我现在想输出这个视图的内容,我直接打印了 PVOID *temp = BaseAddress; for (i = 0; i < 2; i ++) { DbgPrint("%C",(PUCHAR)temp); temp++; } 结果并不如我所愿,获取不了当前打开的记事本内容,输出的都是无意义字符,所以现在我很疑惑,不知这个基地址意味着什么。 我搜索了论坛里的相关帖子,有的截取对pe可执行文件进行内存映射,这个地址就执行了这个可执行文件的PE结构,我现在是对数据文件的截取,并想获取数据内容,是不是也有这样的类似结构呢? |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值