Obtener dirección y Tamaño de #strings
(1/1)
Keyen Night:
Más descriptivo el titulo es imposible :laugh: como puedo obtener el offset y el size de la tabla de metada #strings en un assembly de .net?, creo que tiene que ver con el ManifestModule al cargar un assembly pero no tengo nada concreto...
Keyen Night:
No se si sea la forma más facil pero así calcule el offset de #strings XD
Código
Dim fStream As New FileStream("C:\Ejemplo.exe", FileMode.Open, FileAccess.ReadWrite)
Dim Table As New String(String.Empty)
Do While Table <> "35126"
Table = fStream.ReadByte.ToString & fStream.ReadByte.ToString
Loop
Dim MainTableOffset As Long = (fStream.Position - 2)
Dim StringsTableOffset As Long = 0
Dim Bytes As New List(Of String)
Do While fStream.Position <> MainTableOffset + 2 + 5
Dim CurrentByte As Long = fStream.ReadByte
If CurrentByte <> 0 Then
If CurrentByte.ToString.Length = 1 Then
Bytes.Add("0" & CurrentByte.ToString("X"))
Else
Bytes.Add(CurrentByte.ToString("X"))
End If
End If
Loop
Bytes.Reverse()
Dim Hex As New String(String.Empty)
For Each y As String In Bytes
Hex += y
Next
StringsTableOffset = CInt("&H" & Hex) + MainTableOffset - &H2C + 4
fStream.Close()
[D4N93R]:
Código
'No es necesario
Dim Table As New String(String.Empty)
'Puedes hacer
Dim Table = String.Empty
Como te acabo de poner en el otro post, Mete eso dentro de un try catch finally y en el finally cierras el Stream.
PD: No crees doble-posts por favor.
Un saludo!
Keyen Night:
Disculpa por el doble post :-[ Gracias por la recomendación.
Navegación