[GS修改]添加扩展DLL的方法

0050A260   . 68 6C737005   PUSH gameserv.0570736C
0050A265   . 68 746D6800   PUSH gameserv.00686D74             ; ASCII "1.02.05"
0050A26A   . 6A 00       PUSH 0
0050A26C   . 8A0D 48549A06 MOV CL,BYTE PTR DS:[69A5448]
0050A272   . 51         PUSH ECX
0050A273   . 8B15 70549A06 MOV EDX,DWORD PTR DS:[69A5470]
0050A279   . 52         PUSH EDX
0050A27A   . B9 C852D806   MOV ECX,gameserv.06D852C8
0050A27F   . E8 DF91EFFF   CALL gameserv.00403463
装载文件完毕后开始正式启动的时候加
0050A284   . E8 771D0A00   CALL gameserv.005AC000  
这里我自己添加的,直接跳转的添加DLL的代码

 

005AC000 /$ 68 40C05A00   PUSH gameserv.005AC040             ; /FileName = "PNProc.dll"

\\005AC040= "PNProc.dll"
\\其他的类同

005AC005 |. E8 4274FCFF   CALL <JMP.&KERNEL32.LoadLibraryA>     ; \LoadLibraryA
005AC00A |. 09C0       OR EAX,EAX
005AC00C |. 0F84 9B000000 JE gameserv.005AC0AD
005AC012 |. 68 50C05A00   PUSH gameserv.005AC050             ; /ProcNameOrOrdinal = "PNLoadProc"
005AC017 |. 50         PUSH EAX                       ; |hModule
005AC018 |. E8 2974FCFF   CALL <JMP.&KERNEL32.GetProcAddress>     ; \GetProcAddress

\\这个就是获取DLL中函数的API
\\我的函数名字为PNLoadProc
005AC01D |. A3 60C15A00   MOV DWORD PTR DS:[5AC160],EAX
005AC022 |. 09C0       OR EAX,EAX
005AC024 |. 0F84 83000000 JE gameserv.005AC0AD
005AC02A |. EB 65       JMP SHORT gameserv.005AC091
\\这里跳转到下面对DLL进行处理...


005AC091 |> \6A 30       PUSH 30                       ; /Style = MB_OK|MB_ICONEXCLAMATION|MB_APPLMODAL
005AC093 |. 68 D0C05A00   PUSH gameserv.005AC0D0             ; |Title = "文件加载完成..."
005AC098 |. 68 F0C05A00   PUSH gameserv.005AC0F0             ; |Text = "PNProc.dll加载完成,正在进行其它装载..."
005AC09D |. 6A 00       PUSH 0                       ; |hOwner = NULL
005AC09F |. FF15 1082D906 CALL DWORD PTR DS:[<&USER32.MessageBoxA>>; \MessageBoxA
005AC0A5 |. A1 60C15A00   MOV EAX,DWORD PTR DS:[5AC160]
005AC0AA |. FFD0       CALL EAX \\正式调用DLL中函数
005AC0AC |. C3         RETN
005AC0AD |> 6A 10       PUSH 10                       ; /Style = MB_OK|MB_ICONHAND|MB_APPLMODAL
005AC0AF |. 68 20C15A00   PUSH gameserv.005AC120             ; |Title = "发生错误!"
005AC0B4 |. 68 30C15A00   PUSH gameserv.005AC130             ; |Text = "PNProc.dll加载出错,程序不能正常运行..."
005AC0B9 |. 6A 00       PUSH 0                       ; |hOwner = NULL
005AC0BB |. FF15 1082D906 CALL DWORD PTR DS:[<&USER32.MessageBoxA>>; \MessageBoxA
005AC0C1 \. C3         RETN

本文出自 7j45 > 奇迹一条龙