home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 4_2005-2006.ISO / data / Zips / PEInfO1935569262005.psc / Form1.frm < prev    next >
Text File  |  2005-09-26  |  14KB  |  335 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  4. Begin VB.Form fPEinfO 
  5.    BorderStyle     =   1  'Fixed Single
  6.    Caption         =   "[ PEinfO ] by Sangaletti Federico"
  7.    ClientHeight    =   5655
  8.    ClientLeft      =   60
  9.    ClientTop       =   450
  10.    ClientWidth     =   7455
  11.    ControlBox      =   0   'False
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   5655
  16.    ScaleWidth      =   7455
  17.    StartUpPosition =   2  'CenterScreen
  18.    Begin MSComctlLib.ImageList ImageList2 
  19.       Left            =   6600
  20.       Top             =   840
  21.       _ExtentX        =   1005
  22.       _ExtentY        =   1005
  23.       BackColor       =   16777215
  24.       ImageWidth      =   72
  25.       ImageHeight     =   72
  26.       MaskColor       =   16711935
  27.       _Version        =   393216
  28.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  29.          NumListImages   =   4
  30.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  31.             Picture         =   "Form1.frx":0000
  32.             Key             =   ""
  33.          EndProperty
  34.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  35.             Picture         =   "Form1.frx":3D12
  36.             Key             =   ""
  37.          EndProperty
  38.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  39.             Picture         =   "Form1.frx":728C
  40.             Key             =   ""
  41.          EndProperty
  42.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  43.             Picture         =   "Form1.frx":AF9E
  44.             Key             =   ""
  45.          EndProperty
  46.       EndProperty
  47.    End
  48.    Begin MSComDlg.CommonDialog CommonDialog1 
  49.       Left            =   3240
  50.       Top             =   480
  51.       _ExtentX        =   847
  52.       _ExtentY        =   847
  53.       _Version        =   393216
  54.    End
  55.    Begin MSComctlLib.ImageList ImageList1 
  56.       Left            =   3840
  57.       Top             =   360
  58.       _ExtentX        =   1005
  59.       _ExtentY        =   1005
  60.       BackColor       =   -2147483643
  61.       ImageWidth      =   48
  62.       ImageHeight     =   48
  63.       MaskColor       =   16711935
  64.       _Version        =   393216
  65.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  66.          NumListImages   =   4
  67.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  68.             Picture         =   "Form1.frx":ECB0
  69.             Key             =   ""
  70.          EndProperty
  71.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  72.             Picture         =   "Form1.frx":10802
  73.             Key             =   ""
  74.          EndProperty
  75.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  76.             Picture         =   "Form1.frx":12354
  77.             Key             =   ""
  78.          EndProperty
  79.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  80.             Picture         =   "Form1.frx":13EA6
  81.             Key             =   ""
  82.          EndProperty
  83.       EndProperty
  84.    End
  85.    Begin MSComctlLib.Toolbar Toolbar1 
  86.       Align           =   1  'Align Top
  87.       Height          =   1050
  88.       Left            =   0
  89.       TabIndex        =   0
  90.       Top             =   0
  91.       Width           =   7455
  92.       _ExtentX        =   13150
  93.       _ExtentY        =   1852
  94.       ButtonWidth     =   2011
  95.       ButtonHeight    =   1799
  96.       Appearance      =   1
  97.       Style           =   1
  98.       ImageList       =   "ImageList1"
  99.       _Version        =   393216
  100.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  101.          NumButtons      =   4
  102.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  103.             Caption         =   "Analyze PE"
  104.             Key             =   "kLoad"
  105.             Object.ToolTipText     =   "Load and analyze PE"
  106.             ImageIndex      =   1
  107.          EndProperty
  108.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  109.             Caption         =   "Hdrs structure"
  110.             Object.ToolTipText     =   "Headers structure"
  111.             ImageIndex      =   2
  112.             Style           =   5
  113.             BeginProperty ButtonMenus {66833FEC-8583-11D1-B16A-00C0F0283628} 
  114.                NumButtonMenus  =   7
  115.                BeginProperty ButtonMenu1 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  116.                   Key             =   "kDosHeader"
  117.                   Text            =   "IMAGE_DOS_HEADER"
  118.                EndProperty
  119.                BeginProperty ButtonMenu2 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  120.                   Key             =   "kNTHeaders"
  121.                   Text            =   "IMAGE_NT_HEADERS"
  122.                EndProperty
  123.                BeginProperty ButtonMenu3 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  124.                   Key             =   "kFileHeader"
  125.                   Text            =   "IMAGE_FILE_HEADER"
  126.                EndProperty
  127.                BeginProperty ButtonMenu4 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  128.                   Key             =   "kOptionalHeader"
  129.                   Text            =   "IMAGE_OPTIONAL_HEADER"
  130.                EndProperty
  131.                BeginProperty ButtonMenu5 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  132.                   Key             =   "kSectionHeader"
  133.                   Text            =   "IMAGE_SECTION_HEADER"
  134.                EndProperty
  135.                BeginProperty ButtonMenu6 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  136.                   Key             =   "kExportDir"
  137.                   Text            =   "IMAGE_EXPORT_DIRECTORY"
  138.                EndProperty
  139.                BeginProperty ButtonMenu7 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  140.                   Key             =   "kImportDescr"
  141.                   Text            =   "IMAGE_IMPORT_DECRIPTOR"
  142.                EndProperty
  143.             EndProperty
  144.          EndProperty
  145.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  146.             Caption         =   "Tools"
  147.             Object.ToolTipText     =   "Tools"
  148.             ImageIndex      =   3
  149.             Style           =   5
  150.             BeginProperty ButtonMenus {66833FEC-8583-11D1-B16A-00C0F0283628} 
  151.                NumButtonMenus  =   4
  152.                BeginProperty ButtonMenu1 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  153.                   Key             =   "kRvaToOffset"
  154.                   Text            =   "RVA to Offset"
  155.                EndProperty
  156.                BeginProperty ButtonMenu2 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  157.                   Key             =   "kAlignedSize"
  158.                   Text            =   "Aligned size"
  159.                EndProperty
  160.                BeginProperty ButtonMenu3 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  161.                   Key             =   "kDec2Hex"
  162.                   Text            =   "Dec to Hex"
  163.                EndProperty
  164.                BeginProperty ButtonMenu4 {66833FEE-8583-11D1-B16A-00C0F0283628} 
  165.                   Key             =   "kHex2Dec"
  166.                   Text            =   "Hex to Dec"
  167.                EndProperty
  168.             EndProperty
  169.          EndProperty
  170.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  171.             Caption         =   "Exit"
  172.             Key             =   "kExit"
  173.             ImageIndex      =   4
  174.          EndProperty
  175.       EndProperty
  176.       BorderStyle     =   1
  177.    End
  178.    Begin MSComctlLib.ListView lstReport 
  179.       Height          =   4335
  180.       Left            =   120
  181.       TabIndex        =   1
  182.       Top             =   1200
  183.       Width           =   7215
  184.       _ExtentX        =   12726
  185.       _ExtentY        =   7646
  186.       LabelEdit       =   1
  187.       LabelWrap       =   -1  'True
  188.       HideSelection   =   0   'False
  189.       PictureAlignment=   3
  190.       _Version        =   393217
  191.       Icons           =   "ImageList2"
  192.       ForeColor       =   -2147483640
  193.       BackColor       =   16777215
  194.       BorderStyle     =   1
  195.       Appearance      =   0
  196.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  197.          Name            =   "Courier"
  198.          Size            =   9.75
  199.          Charset         =   0
  200.          Weight          =   400
  201.          Underline       =   0   'False
  202.          Italic          =   0   'False
  203.          Strikethrough   =   0   'False
  204.       EndProperty
  205.       NumItems        =   0
  206.       Picture         =   "Form1.frx":159F8
  207.    End
  208. End
  209. Attribute VB_Name = "fPEinfO"
  210. Attribute VB_GlobalNameSpace = False
  211. Attribute VB_Creatable = False
  212. Attribute VB_PredeclaredId = True
  213. Attribute VB_Exposed = False
  214. '##########################################################
  215. '##########################################################
  216. '######## Title:. PEInfO [26/09/05]                ########
  217. '######## Author: Sangaletti Federico              ########
  218. '######## e-mail: sangaletti@aliceposta.it         ########
  219. '########------------------------------------------########
  220. '########   !IF YOU LIKE THIS CODE PLEASE VOTE!    ########
  221. '########------------------------------------------########
  222. '##########################################################
  223. '##########################################################
  224.  
  225.  
  226. Private Sub Form_Load()
  227.     Load fShowInfo
  228. End Sub
  229.  
  230. Private Sub Form_Unload(Cancel As Integer)
  231.     Unload fShowInfo
  232. End Sub
  233.  
  234. Private Sub lstReport_DblClick()
  235.     On Error Resume Next
  236.     Select Case lstReport.SelectedItem.Key
  237.         Case "kDOSHeader":
  238.             fShowInfo.Caption = "IMAGE_DOS_HEADER"
  239.             fShowInfo.txtInfo = DOS_HEADER_INFO
  240.             fShowInfo.Show
  241.         
  242.         Case "kNTHeaders":
  243.             fShowInfo.Caption = "IMAGE_NT_HEADERS"
  244.             fShowInfo.txtInfo = NT_HEADERS_INFO
  245.             fShowInfo.Show
  246.             
  247.         Case "kSectionHeader":
  248.             fShowInfo.Caption = "IMAGE_SECTION_HEADER"
  249.             fShowInfo.txtInfo = SECTION_TABLE
  250.             fShowInfo.Show
  251.             
  252.         Case "kExportTable":
  253.             fShowInfo.Caption = "IMAGE_EXPORT_DIRECTORY"
  254.             fShowInfo.txtInfo = EXPORT_TABLE
  255.             fShowInfo.Show
  256.             
  257.         Case "kImportTable"
  258.             fShowInfo.Caption = "IMAGE_IMPORT_DESCRIPTOR"
  259.             fShowInfo.txtInfo = IMPORT_TABLE
  260.             fShowInfo.Show
  261.     End Select
  262. End Sub
  263.  
  264. Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
  265.     Select Case Button.Key
  266.         Case "kLoad":
  267.             CommonDialog1.FileName = vbNullString
  268.             CommonDialog1.Filter = "PE [Portable Executable]|*.exe;*.dll;*.ocx"
  269.             CommonDialog1.ShowOpen
  270.             If CommonDialog1.FileName <> vbNullString Then GetPEInfo CommonDialog1.FileName
  271.         
  272.         Case "kExit":
  273.             MsgBox "If you like this code please vote for it.", vbInformation
  274.             End
  275.     End Select
  276. End Sub
  277.  
  278. Private Sub Toolbar1_ButtonMenuClick(ByVal ButtonMenu As MSComctlLib.ButtonMenu)
  279.     Select Case ButtonMenu.Key
  280.         Case "kDosHeader":
  281.             fShowInfo.Caption = "IMAGE_DOS_HEADER Structure (C syntax)"
  282.             fShowInfo.txtInfo = TXT_IMAGE_DOS_HEADER
  283.             fShowInfo.Show
  284.             
  285.         Case "kNTHeaders":
  286.             fShowInfo.Caption = "IMAGE_NT_HEADERS Structure (C syntax)"
  287.             fShowInfo.txtInfo = TXT_IMAGE_NT_HEADERS
  288.             fShowInfo.Show
  289.         
  290.         Case "kFileHeader":
  291.             fShowInfo.Caption = "IMAGE_FILE_HEADER Structure (C syntax)"
  292.             fShowInfo.txtInfo = TXT_IMAGE_FILE_HEADER
  293.             fShowInfo.Show
  294.             
  295.         Case "kOptionalHeader":
  296.             fShowInfo.Caption = "IMAGE_OPTIONAL_HEADER Structure (C syntax)"
  297.             fShowInfo.txtInfo = TXT_IMAGE_OPTIONAL_HEADER
  298.             fShowInfo.Show
  299.             
  300.         Case "kSectionHeader":
  301.             fShowInfo.Caption = "IMAGE_SECTION_HEADER Structure (C syntax)"
  302.             fShowInfo.txtInfo = TXT_IMAGE_SECTION_HEADER
  303.             fShowInfo.Show
  304.             
  305.         Case "kExportDir":
  306.             fShowInfo.Caption = "IMAGE_EXPORT_DIRECTORY Structure (C syntax)"
  307.             fShowInfo.txtInfo = TXT_IMAGE_EXPORT_DIRECTORY
  308.             fShowInfo.Show
  309.             
  310.         Case "kImportDescr":
  311.             fShowInfo.Caption = "IMAGE_IMPORT_DESCRIPTOR Structure (C syntax)"
  312.             fShowInfo.txtInfo = TXT_IMAGE_IMPORT_DESCRIPTOR
  313.             fShowInfo.Show
  314.             
  315.             
  316.             
  317.         
  318.         Case "kRvaToOffset":
  319.             If SECTION_TABLE <> "" Then
  320.                 MsgBox "Offset is 0x" & Hex$(RVAToOffset(SectionHeaders, CLng("&H" & InputBox("Type a RVA (Relative Virtual Address) in hexadecimal.")))), vbInformation
  321.             Else
  322.                 MsgBox "Open and analyze a PE first!", vbExclamation
  323.             End If
  324.         
  325.         Case "kAlignedSize":
  326.             MsgBox "Aligned size is 0x" & Hex$(GetAlignedSize(CLng("&H" & InputBox("Type real size in hex value.")), CLng("&H" & InputBox("Type alignment in hex value")))), vbInformation
  327.             
  328.         Case "kDec2Hex":
  329.             MsgBox "Hexadecimal value is 0x" & Hex$(Val(InputBox("Type a decimal value."))), vbInformation
  330.             
  331.         Case "kHex2Dec":
  332.             MsgBox "Decimal value is " & CLng("&H" & InputBox("Type an hexadecimal value.")), vbInformation
  333.     End Select
  334. End Sub
  335.