TheRealLinky How do I cheat?
Reputation: 0
Joined: 18 Jun 2009 Posts: 7
|
Posted: Thu Jul 30, 2009 4:10 pm Post subject: [Vb.net] Copymemory Problem |
|
|
My Copymemory declaration is as follows.
| Code: | | Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (ByVal Destination As Image_Dos_header, ByRef Source As Byte, ByVal Length As Int32) |
The variables in play for the actually call are.
| Code: | Dim IDH1 As Image_Dos_header = Nothing
Dim file1() As Byte |
My Image_dos_header structure is
| Code: | <StructLayout(LayoutKind.Sequential)> _
Public Structure Image_Dos_header
Public e_magic As Integer 'magic number
Public e_cblp As Integer 'bytes on last page of file
Public e_cp As Integer 'Pages in file
Public e_crlc As Integer 'Relocations
Public e_cparhdr As Integer 'Size of header in Paragraphs
Public e_minalloc As Integer 'Mn extra paragraphs needed
Public e_maxalloc As Integer 'Max extra Paragraphs needed
Public e_ss As Integer 'Initial (relative) ss value
Public e_sp As Integer 'Initial SP value
Public e_csum As Integer 'Checksum
Public e_ip As Integer 'Initial IP value
Public e_cs As Integer 'Initial (relative) cs value
Public e_lfarlc As Integer 'File Address of Relocation Table
Public e_ovno As Integer 'Overlay number
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=9)> _
Public e_res() As Integer 'Reserved Words
Public e_oemid As Integer 'Oem Identifier (for e_oeminfo)
Public e_oeminfo As Integer 'OEM Info; e_oemid specific
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=9)> _
Public e_res2() As Integer 'Reserved Words
Public e_lfanew As Long 'File Address of New Exe header
End Structure |
And my call looks like.
| Code: | | Call CopyMemory(IDH1, file1(0), 64) |
How ever nothing gets copied to IDH1. And there for the other calls fail. Ive tried marshaling. And everything i could think of.Any help guys?
Edit: Solved the Problem and Managed to read all the headers. Please Lock.
|
|