Página 1 de 1

Funcion AddBytes

Publicado: 25 Feb 2014, 17:50
por Pink
Hola, Bueno como muchos sabéis hace ya mucho que no programo malware ni nada relacionado. (quizás vuelve algún día) aqui les traigo esta funcion que arme hace mucho cuando necesitaba agregar bytes a un Array pasandole cadenas, longs, bytes o arrays.

Private Sub AddBytes(ByRef bArray() As Byte, Data As Variant)

Dim ArraySize As Long
Dim iType As Integer
Dim SizeData As Integer
Dim StrBytes() As Byte

If ((Not bArray) = -1) Then
ArraySize = 0
Else
ArraySize = UBound(bArray()) + 1
End If


iType = VarType(Data)

Select Case iType
Case Is = vbByte, vbInteger
SizeData = 1
ReDim Preserve bArray((ArraySize + SizeData) - 1)
CopyMemory bArray(ArraySize), CByte(Data), SizeData
Exit Sub

Case Is = vbLong
SizeData = 4
ReDim Preserve bArray((ArraySize + SizeData) - 1)
CopyMemory bArray(ArraySize), CLng(Data), SizeData
Exit Sub

Case Is = 8209
StrBytes() = Data
SizeData = UBound(StrBytes()) + 1
ReDim Preserve bArray((ArraySize + SizeData) - 1)
CopyMemory bArray(ArraySize), StrBytes(0), SizeData
Exit Sub


Case Is = vbString
StrBytes() = StrConv(CStr(Data), vbFromUnicode)
SizeData = UBound(StrBytes()) + 1
ReDim Preserve bArray((ArraySize + SizeData) - 1)
CopyMemory bArray(ArraySize), StrBytes(0), SizeData

Exit Sub
Case Else
Exit Sub
End Select

End Sub

Saludos

Re: Funcion AddBytes

Publicado: 26 Feb 2014, 13:41
por comand
Gracias Pink, a mí me sirve de lujo.

Re: Funcion AddBytes

Publicado: 26 Feb 2014, 14:23
por CrypterHacker
Gracias Pink

Re: Funcion AddBytes

Publicado: 26 Feb 2014, 22:25
por Naker90
Me gustó, Gracias bro

Re: Funcion AddBytes

Publicado: 26 Feb 2014, 22:38
por 13truco12
GRACIAS pink
pero q manicomio es ese.?? dnd te conectas xP