本帖最后由 cntrump 于 2011-8-14 00:54 编辑
修改说明:
强制 OD 使用主程序目录下的 UDD 和 Plugins 目录作为调试数据和插件的保存目录.
如果这两个目录不存在则会创建, 如果创建目录失败则使用当前目录.
by cntrump
2011-08-13
下面是修改过程:
为了修改方便,添加两个字符串和两个导入函数:
新增的字符串4edd28:
%s\UDD
4edd38:
%s\Plugins
新增的导入函数CreateDirectoryW: call dword ptr [0075403F]
wsprintfW: call dword ptr [00754017]
找到读取配置文件的地方:0040CC05 |. 68 7A4F5000 push OllyDbg.00504F7A ; /Arg3 = 00504F7A
0040CC0A |. 68 944E5600 push ollydbg.00564E94 ; |Arg2 = 00564E94
0040CC0F |. 68 1A465000 push ollydbg.0050461A ; |Arg1 = 0050461A
0040CC14 |. E8 1F58FFFF call ollydbg.Filefromini ; \Filefromini
0040CC19 |. 68 944E5600 push ollydbg.00564E94 ; /Arg1 = 00564E94
0040CC1E |. E8 0D8AFFFF call ollydbg.Absolutizepath ; \Absolutizepath
0040CC23 |. 833D 1C4A5600>cmp dword ptr ds:[564A1C],0
0040CC2A |. 74 26 je short ollydbg.0040CC52
0040CC2C |. 68 944E5600 push ollydbg.00564E94
0040CC31 |. FF15 1C4A5600 call dword ptr ds:[564A1C] ; shlwapi.PathIsDirectoryW
0040CC37 |. 85C0 test eax,eax
0040CC39 |. 75 17 jnz short ollydbg.0040CC52
0040CC3B |. 68 8C4C5600 push offset ollydbg._ollydir ; /Arg3 = 00564C8C
0040CC40 |. 68 04010000 push 104 ; |Arg2 = 00000104
0040CC45 |. 68 944E5600 push ollydbg.00564E94 ; |Arg1 = 00564E94
0040CC4A |. E8 0D280000 call ollydbg._StrcopyW ; \_StrcopyW
0040CC4F |. 83C4 0C add esp,0C
0040CC52 |> 68 864F5000 push ollydbg.00504F86 ; /Arg3 = 00504F86
0040CC57 |. 68 1C9A5B00 push offset ollydbg._plugindir ; |Arg2 = 005B9A1C
0040CC5C |. 68 38465000 push ollydbg.00504638 ; |Arg1 = 00504638
0040CC61 |. E8 D257FFFF call ollydbg.Filefromini ; \Filefromini
0040CC66 |. 68 1C9A5B00 push offset ollydbg._plugindir ; /Arg1 = 005B9A1C
0040CC6B |. E8 C089FFFF call ollydbg.Absolutizepath ; \Absolutizepath
0040CC70 |. 833D 1C4A5600>cmp dword ptr ds:[564A1C],0
0040CC77 |. 74 26 je short ollydbg.0040CC9F
0040CC79 |. 68 1C9A5B00 push offset ollydbg._plugindir
0040CC7E |. FF15 1C4A5600 call dword ptr ds:[564A1C] ; shlwapi.PathIsDirectoryW
0040CC84 |. 85C0 test eax,eax
0040CC86 |. 75 17 jnz short ollydbg.0040CC9F
0040CC88 |. 68 8C4C5600 push offset ollydbg._ollydir ; /Arg3 = 00564C8C
0040CC8D |. 68 04010000 push 104 ; |Arg2 = 00000104
0040CC92 |. 68 1C9A5B00 push offset ollydbg._plugindir ; |Arg1 = 005B9A1C
0040CC97 |. E8 C0270000 call ollydbg._StrcopyW ; \_StrcopyW
0040CC9C |. 83C4 0C add esp,0C
修改为:0040CC05 68 8C4C5600 push offset ollydbg._ollydir ; UNICODE "C:\Documents and Settings\cntrump"
0040CC0A 68 28DD4E00 push ollydbg.004EDD28 ; UNICODE "%s\\UDD"
0040CC0F 68 944E5600 push ollydbg.00564E94 ; UNICODE "C:\Documents and Settings\cntrump"
0040CC14 FF15 17407500 call dword ptr ds:[<&USER32.wsprintfW>] ; user32.wsprintfW
0040CC1A 68 944E5600 push ollydbg.00564E94 ; UNICODE "C:\Documents and Settings\cntrump"
0040CC1F FF15 1C4A5600 call dword ptr ds:[564A1C] ; shlwapi.PathIsDirectoryW
0040CC25 85C0 test eax,eax
0040CC27 75 29 jnz short ollydbg.0040CC52
0040CC29 6A 00 push 0
0040CC2B 68 944E5600 push ollydbg.00564E94 ; UNICODE "C:\Documents and Settings\cntrump"
0040CC30 E8 AB090E00 call <jmp.&KERNEL32.DeleteFileW>
0040CC35 68 944E5600 push ollydbg.00564E94 ; UNICODE "C:\Documents and Settings\cntrump"
0040CC3A FF15 3F407500 call dword ptr ds:[<&KERNEL32.CreateDirectoryW>] ; kernel32.CreateDirectoryW
0040CC40 85C0 test eax,eax
0040CC42 75 0E jnz short ollydbg.0040CC52
0040CC44 8D05 944E5600 lea eax,dword ptr ds:[564E94]
0040CC4A C700 2E000000 mov dword ptr ds:[eax],2E000000
0040CC50 90 nop
0040CC51 90 nop
0040CC52 68 8C4C5600 push offset ollydbg._ollydir ; UNICODE "C:\Documents and Settings\cntrump"
0040CC57 68 38DD4E00 push ollydbg.004EDD38 ; UNICODE "%s\\Plugins"
0040CC5C 68 1C9A5B00 push offset ollydbg._plugindir ; UNICODE "C:\Documents and Settings\cntrump"
0040CC61 FF15 17407500 call dword ptr ds:[<&USER32.wsprintfW>] ; user32.wsprintfW
0040CC67 68 1C9A5B00 push offset ollydbg._plugindir ; UNICODE "C:\Documents and Settings\cntrump"
0040CC6C FF15 1C4A5600 call dword ptr ds:[564A1C] ; shlwapi.PathIsDirectoryW
0040CC72 85C0 test eax,eax
0040CC74 75 29 jnz short ollydbg.0040CC9F
0040CC76 6A 00 push 0
0040CC78 68 1C9A5B00 push offset ollydbg._plugindir ; UNICODE "C:\Documents and Settings\cntrump"
0040CC7D E8 5E090E00 call <jmp.&KERNEL32.DeleteFileW>
0040CC82 68 1C9A5B00 push offset ollydbg._plugindir ; UNICODE "C:\Documents and Settings\cntrump"
0040CC87 FF15 3F407500 call dword ptr ds:[<&KERNEL32.CreateDirectoryW>] ; kernel32.CreateDirectoryW
0040CC8D 85C0 test eax,eax
0040CC8F 75 0E jnz short ollydbg.0040CC9F
0040CC91 8D05 1C9A5B00 lea eax,dword ptr ds:[_plugindir]
0040CC97 C700 2E000000 mov dword ptr ds:[eax],2E000000
0040CC9D 90 nop
0040CC9E 90 nop
|