|
[讨论]关于hot patch的问题
写好了程序敢不敢自己运行一下! bRet = VirtualProtect(memInfoTarget.BaseAddress, memInfoTarget.RegionSize, PAGE_EXECUTE_READWRITE, &dwOldProtectTarget); bRet = VirtualProtect(memInfoHook.BaseAddress, memInfoHook.RegionSize, PAGE_EXECUTE_READWRITE, &dwOldProtectHook); 改成这个就好了,出问题的主要是第二个,因为hook stub和当前指令在同一个页里 第二个问题 你这不是hot patch,只是个普通的inline hook而已...好歹主题是hot patch啊... |
|
[推荐]翻译下api 和 汇编 好在OD中 Ctrl+F1 显示帮助
翻译这东西花的时间比学会那些基本英文的时间要长 |
|
[求助]SetUnhandledExceptionFilter时怎么SetThreadContext
ExceptionInfo->ContextRecord,这就是一个CONTEXT结构,内容是异常发生时的线程上下文,你修改好了后返回EXCEPTION_CONTINUE_EXECUTION系统就会自动载入这里设置的线程上下文 |
|
[求助]我想问下4G内存总共有多少地址。
这都是基础,而且你有些概念都没搞清楚,所以一句话也解释不来,好好看书吧 |
|
[讨论]关于hot patch的问题
我都说了那个代码只是一个大致的样子,只是证明这个函数不需要像你那样写的那么庞大,我自己都没试着编译这块代码 看了下楼主其他的几个回帖,明显感觉基础有待加强,也懒的多说,花了点时间把代码整理出来,你自己开调试器对照着看吧 只把这里讨论到的函数用C写了一遍 |
|
[原创]看雪论坛刷Kx程序
这玩意直接vbs写不就好了,连编译器都不用 on error resume next Set xmlhttp = CreateObject("microsoft.xmlhttp") sURL = URLEncode("http://bbs.pediy.com/") while true xmlhttp.open "GET",sURL,False xmlhttp.send WScript.Sleep 60000 wend WScript.Quit 0 Function URLEncode(vstrIn) strReturn = "" For i = 1 To Len(vstrIn) ThisChr = Mid(vStrIn,i,1) If Abs(Asc(ThisChr)) < &HFF Then strReturn = strReturn & ThisChr Else innerCode = Asc(ThisChr) If innerCode < 0 Then innerCode = innerCode + &H10000 End If Hight8 = (innerCode And &HFF00)\ &HFF Low8 = innerCode And &HFF strReturn = strReturn & "%" & Hex(Hight8) & "%" & Hex(Low8) End If Next URLEncode = strReturn End Function 稍微自己改改就能加入登录功能 |
|
[讨论]关于hot patch的问题
不太清楚你是为什么想要知道call是近跳转还是远跳转,这个只对调用者有意义,被调用者是不用管的 如果是我来实现这个函数我大概会采用下面的做法 int WINAPI NewWSAStartup( _In_ WORD wVersionRequested, _Out_ LPWSADATA lpWSAData ){ int ReturnValue; _asm { push lpWSAData push wVersionRequested push 14h call next_step_addr mov ReturnValue,eax } //用C干你想干的事情 return ReturnValue; } 大致就是这个样子,也许有些地方需要修改,不过应该没错 |
|
|
|
[讨论]关于hot patch的问题
我个人的处理办法 如果函数有Ansi/Unicode两个版本而且只需要监视Ansi版本的话,自己做字符串转换的操作(如果挂钩Unicode自己执行Ansi的话Ansi版本内部会调用Unicode版本形成死循环) 如果函数很简单(比如GetCommandLine直接就返回内存一块固定区域的地址),自己手动实现一遍 很复杂的函数的话就必须要备份函数头部,这样就跟普通的inline hook没有太大差别了,你可以参阅这方面的文章 最近正好写了点和Hot patch相关的东西,还有什么问题可以向我询问 顺带一提在win64平台上没有对应的Hot patch技术,所以如果对可移植性有要求的话(hook肯定是hook别人的程序,而别人可能用的就是64位程序),建议早点换成一个通用的hook方案有助于提高代码的可维护性 |
|
[原创]白话windows之四 异常处理机制(VEH、SEH、TopLevelEH...)
UnhandledExceptionFilter处理不了还会再一次交给VEH处理,但是这个句柄是用AddVectoredContinueHandler注册的 不过Win7下这个又有了一些变化,详见https://blogs.msdn.com/b/zhanli/archive/2010/06/25/c-tips-addvectoredexceptionhandler-addvectoredcontinuehandler-and-setunhandledexceptionfilter.aspx?Redirected=true |
|
|
|
[讨论]关于UTF-8编码方式的一个深度问题。
UTF8是Unicode的一种编码表达方式,他们两者的关系就类似二进制和十进制一样,从何而来的Unicode无法解决多语言混用而UTF8就可以 |
|
|
|
[求助]关于call相对地址转换为绝对地址的问题
这是我以前写Hot Patch时的一段代码,作用是将绝对地址转换成相对地址 ;******************************************************************** ;写入远程跳转 ;bJmpFar db 0E9h ;******************************************************************** mov eax,0E9h cld stosb ;******************************************************************** ;计算Jmp的偏移 ;******************************************************************** mov eax,_lpNew ;_lpNew是将要跳转到的绝对地址 sub eax,edi ;edi指向的是将要写入的地址,前面已经放了一个E9,这里只需要放置偏移量 sub eax,4 ;偏移量要减去偏移量自身的长度,上面减法后是相对E9的偏移,而不是指令末尾的偏移,因为跳转都是针对EIP操作的 cld stosd 所以你的代码感觉有很多不必要的操作了,整个的操作应该就是 mov eax,dword ptr [代码所在的地址] add eax,4 add eax,代码在内存内的地址 这就完成了相对地址转换为绝对地址,如果是直接修改运行中的二进制文件上面两个地址是一样的,不然就要你自己考虑了 不要忘记x86是小尾模式,所以如果一个数字看上去是反着的那么直接读取就可以了 mov edx,0 lea ebx,Code Hex_Code: lea eax,[ecx+edx] mov al,byte ptr Array[eax] mov [ebx],al inc ebx inc edx cmp edx,4 jnz Hex_Code 我说的就是这个 其他的代码看不懂再说什么...或者说看懂了但是不知道到底在干什么,PData感觉还是莫名其妙 |
|
[求助]为什么在win7 X64系统中,通过SetFileTime()函数无法修改文件时间?
我自己写的一个每日自动更新小说的软件就是使用这个函数修改文件夹的时间以方便按照最后更新时间进行排序 同样是win7x64,我就没有碰到任何问题 检查你自己的代码吧,估计是FILETIME的问题 To prevent file operations using the given handle from modifying the last access time, call SetFileTime immediately after opening the file handle and pass a FILETIME structure whose dwLowDateTime and dwHighDateTime members are both set to 0xFFFFFFFF. |
操作理由
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 }}
勋章
兑换勋章
证书
证书查询 >
能力值