• 我们在哪一颗星上见过 ,以至如此相互思念 ;我们在哪一颗星上相互思念过,以至如此相互深爱
  • 我们在哪一颗星上分别 ,以至如此相互辉映 ;我们在哪一颗星上入睡 ,以至如此唤醒黎明
  • 认识世界 克服困难 洞悉所有 贴近生活 寻找珍爱 感受彼此

恶意代码技术理论:VBA 调试一些方法

基于语言 云涯 2年前 (2022-08-31) 892次浏览

byte转string

Private Function ByteArrayToHex(ByRef ByteArray() As Byte) As String

  Dim lb As Long, ub As Long
  Dim l As Long, strRet As String
  Dim lonRetLen As Long, lonPos As Long
  Dim strHex As String, lonLenHex As Long

  lb = LBound(ByteArray)
  ub = UBound(ByteArray)
  lonRetLen = ((ub - lb) + 1) * 3
  strRet = Space$(lonRetLen)
  lonPos = 1

  For l = lb To ub
    strHex = Hex$(ByteArray(l))
    If Len(strHex) = 1 Then strHex = "0" & strHex
    If l <> ub Then
      Mid$(strRet, lonPos, 3) = strHex & " "
      lonPos = lonPos + 3
    Else
      Mid$(strRet, lonPos, 3) = strHex
    End If
  Next l

  ByteArrayToHex = strRet

End Function

可以将数组转化为字符串

 

 


云涯历险记 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:恶意代码技术理论:VBA 调试一些方法
喜欢 (0)