安全中国首页 > 文章中心 > 编释语言
 
安全中国网友投稿专用上传FTP空间:
Ftp服务器:download.anqn.com
Ftp端口:21
用户名:anqn
密 码:anqn.com
 

《加密解密 技术内幕》 完全用VB进行ASM编程的示例

更新时间:2008-4-3 0:18:21
责任编辑:流火
热 点:

   ’tell cpuid what we want

   EAX = 0

   

   ’get address of Machine Code

   VarAddr = VarPtr(MachineCode(0))

   

   ’get address of Sub Dummy

   FunctAddr = GetAddress(AddressOf Dummy)

   

   ’copy the Machine Code to where it can be called

   CopyMemory ByVal FunctAddr, ByVal VarAddr, 35 ’35 bytes machine code

   

   ’call it

   On Error Resume Next ’apparently it gets a stack pointer error when in P-Code but i dont know why

     CallWindowProc FunctAddr, EAX, VarPtr(CPUName(1)), VarPtr(CPUName(9)), VarPtr(CPUName(5))

     ’Debug.Print Err; Err.Description

     ’MsgBox Err & Err.Description

   On Error GoTo 0

   

   GetCpuName = StrConv(CPUName(), vbUnicode) ’UnicodeName

   

End Function

 

Private Function GetAddress(Address As Long) As Long

 

   GetAddress = Address

 

End Function

 

Private Sub Dummy()

 

 ’the code below just reserves some space to copy the machine code into

 ’it is never executed

 

   x = 0

   x = 1

   x = 2

   x = 3

   x = 4

   x = 5

   x = 6

   x = 7

   x = 8

   x = 9

   x = 10

   x = 0

   x = 1

   x = 2

   x = 3

   x = 4

   x = 5

   x = 6

   x = 7

   x = 8

   x = 9

   x = 10

  

End Sub

上一页 1 2 3 

 
相关文章
一日一文章
 
一日一软件
一日一动画