#DIM ALL '申明所有
#REGISTER ALL '注册所有
#COMPILE DLL "ProjectOK.DLL" '生成文件类型及名字
#INCLUDE "WIN32API.INC" '引用API
''''''''''''''''''''''''''' 注入程序 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
FUNCTION FuncIn ALIAS "FuncIn" (BYVAL Func AS DWORD POINTER) EXPORT AS LONG
WriteProcessMemory(hProcess, BYVAL ThreadAdd, @Func, 4096, 0&)
hThread = CreateRemoteThread(hProcess, BYVAL 0&, 0, ThreadAdd, BYVAL 0&, 0, 0&)
WaitForSingleObject(hThread, %INFINITE)
CloseHandle(hThread)
FUNCTION = -1&
END FUNCTION
FUNCTION UseSkills ALIAS "UseSkills" () EXPORT AS LONG
FuncIn(CODEPTR(UseSkillsCall))
FUNCTION = -1&
END FUNCTION
'''''''''''''''''''' CallType使用技能 ''''''''''''''''''''''''''''''''''''
FUNCTION UseSkillsCall ALIAS "UseSkillsCall" () EXPORT AS LONG
DIM Address AS LONG
DIM x AS LONG
DIM y AS LONG
DIM m AS LONG
DIM d AS LONG
Address = &H00531010
x = &H12C
y = &H1C2
m = 0
d = &H15
!pushad
!PUSH x
!PUSH y
!PUSH m
!PUSH d
!mov EDX, dword ptr [&H9A0FC4]
!mov ecx, dword ptr [EDX-&H8]
!call Address
!popad
END FUNCTION
===========================================
VB的代码:
Public Declare Function UseSkills Lib "ProjectOK.Dll" () As Long
Private Sub Command1_Click()
Call UseSkills
End Sub
VB伪代码 //为你的函数增加参数 FUNCTION UseSkillsCall ALIAS "UseSkillsCall" (x AS LONG,y AS LONG,m AS LONG,d AS LONG) EXPORT AS LONG
之后修改你的函数代码
FUNCTION UseSkillsCall ALIAS "UseSkillsCall" (x AS LONG,y AS LONG,m AS LONG,d AS LONG) EXPORT AS LONG DIM Address AS LONG ; DIM x AS LONG //删除这几行,避免重复声明 ; DIM y AS LONG ; DIM m AS LONG ; DIM d AS LONG
Address = &H00531010 ; x = &H12C //删除,不进行赋值 ; y = &H1C2 ; m = 0 ; d = &H15 !pushad !PUSH x !PUSH y !PUSH m !PUSH d !mov EDX, dword ptr [&H9A0FC4] !mov ecx, dword ptr [EDX-&H8] !call Address !popad END FUNCTION
修改你的调用代码:
Public Declare Function UseSkills Lib "ProjectOK.Dll" (x AS LONG,y AS LONG,m AS LONG,d AS LONG) As Long
Private Sub Command1_Click() UseSkills (1,2,3,4) //直接提交参数 End Sub