Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I can get DOS header by doing this

   Public Structure IMAGEDOSHEADER
       Dim e_magic As Short
       Dim e_cblp As Short
       Dim e_cp As Short
       Dim e_crlc As Short
       Dim e_cparhdr As Short
       Dim e_minalloc As Short
       Dim e_maxalloc As Short
       Dim e_ss As Short
       Dim e_sp As Short
       Dim e_csum As Short
       Dim e_ip As Short
       Dim e_cs As Short
       Dim e_lfarlc As Short
       Dim e_ovno As Short
       <VBFixedArray(3)> Dim e_res() As Short
       Dim e_oemid As Short
       Dim e_oeminfo As Short
       <VBFixedArray(9)> Dim e_res2() As Short
       Dim e_lfanew As Integer
       Public Sub Initialize()
           ReDim e_res(3)
           ReDim e_res2(9)
       End Sub
   End Structure

Private Const MZSIGNATURE As Integer = &H5A4D

   Private sub getvalues(ByVal StrFileName As String)
       Dim rFree As Integer
       Dim IDH As New IMAGEDOSHEADER
       rFree = FreeFile()
       FileOpen(rFree, StrFileName, OpenMode.Binary, OpenAccess.Read)
       FileGet(rFree, IDH)
       If (IDH.e_magic = MZSIGNATURE) Then
       msgbox("file has dos header")
       End If
       FileClose(rFree)
   End Function

 

But how do I do if I like to get NT optional headers and virtual size of

sections?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...