; 記憶體補丁例子一:對 test.exe 進行記憶體補丁
.386
.model flat, stdcall
option casemap :none
include windows.inc
include user32.inc
include kernel32.inc
includelib user32.lib
includelib kernel32.lib
patch_position equ 00401004h ;補丁位置的線性位址
patch_bytes equ 2 ;補丁記憶體的位元組數
.data?
dboldbytes db patch_bytes dup (?) ;讀 緩衝區
ststartup startupinfo <?>
stprocinfo process_information <?>
.const
dbpatch db 74h,15h ;原內容
dbpatched db 90h,90h ;補丁內容
szexecfilename db 'test.exe',0 ;檔名
szerrexec db '無法裝載執行檔案!',0
szerrversion db '執行檔案的版本不正確,無法修正!',0
.code
start:
; 建立程序
invoke getstartupinfo,addr ststartup
invoke createprocess,offset szexecfilename,null,null,null,null,/
normal_priority_class or create_suspended,null,null,/
offset ststartup,offset stprocinfo;建立程序時使其暫停,改寫後再執行
.if eax ; 讀程序記憶體並驗證內容是否正確
invoke readprocessmemory,stprocinfo.hprocess,patch_position,/ ;讀
addr dboldbytes,patch_bytes,null
.if eax
mov ax,word ptr dboldbytes
.if ax == word ptr dbpatch ;驗證
invoke writeprocessmemory,stprocinfo.hprocess,/ ;寫
patch_position,addr dbpatched,patch_bytes,null
invoke resumethread,stprocinfo.hthread ;改寫後,使程式開始執行
.else
invoke terminateprocess,stprocinfo.hprocess,-1
invoke messagebox,null,addr szerrversion,null,mb_ok or mb_iconstop
.endif
.endif
invoke closehandle,stprocinfo.hprocess
invoke closehandle,stprocinfo.hthread
.else
invoke messagebox,null,addr szerrexec,null,mb_ok or mb_iconstop
.endif
invoke exitprocess,null
end start
乙個簡單的verlig程式 乙個簡單C程式的介紹
我們前面學了c語言的一些理論知識,今天通過乙個簡單的程式先來看一看c語言程式是什麼樣子。然後再對程式中的 進行介紹。這個語句的功能是進行有關的預處理操作。include稱為檔案包含命令,後面尖括號的內容稱為標頭檔案或首檔案。此處指包含stdio.h系統標頭檔案,在下面主函式中使用的printf 函式...
簡單的乙個程式
在練習例項35的時候看到書上寫的 太多自己不願意去寫,就像能不能換一種方法來編寫 更簡單一些 結果還真成功了 我就簡單的把握的 寫下來 option explicit private sub timer timer staic x as integer if x 8 then x 1 x x 1 i...
乙個簡單的記憶體池
為什仫要使用記憶體池?1.通常我們用new delete和malloc free來管理記憶體,可能會需要頻繁的呼叫記憶體,減少執行時間,增加效率.2.避免記憶體碎片 傳統的new delete的弊端 1.分配記憶體時要檢視空閒分割槽表,根據一定的演算法來分配,比如最佳適應演算法,最差適應演算法.然後...