home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 6_2008-2009.ISO / data / zips / EliteXp®_P21651610152009.psc / OptionalHeader.cls < prev    next >
Text File  |  2009-10-15  |  3KB  |  86 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "OptionalHeader"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. Dim st As IMAGE_OPTIONAL_HEADER, fOwner As NtHeader
  15. Private Type Objects
  16.     FileHeader As FileHeader
  17. End Type
  18. Dim Objs As Objects
  19. Friend Property Get Struct() As IMAGE_OPTIONAL_HEADER
  20. Struct = st
  21. End Property
  22. Friend Property Let Struct(n As IMAGE_OPTIONAL_HEADER)
  23. Dim hdr As IMAGE_NT_HEADERS
  24. hdr = Owner.Struct
  25. st = n
  26. hdr.OptionalHeader = st
  27. Owner.Struct = hdr
  28. End Property
  29. Friend Sub SetOwner(cOwner As NtHeader)
  30. Set fOwner = cOwner
  31. End Sub
  32. Friend Property Get Owner() As NtHeader
  33. Set Owner = fOwner
  34. End Property
  35. '***********************************************************************
  36. '**********Common Routines For Memory Mapping**************************
  37. Property Get Length() As Long
  38. Length = Len(st)
  39. End Property
  40. Property Get Pointer() As Long
  41. Pointer = VarPtr(st)
  42. End Property
  43. Function Fill(ByVal hMem As Long) As Boolean
  44. On Error Resume Next
  45. If IsBadCodePtr(hMem) Then Exit Function
  46. CopyMemory ByVal Pointer, ByVal hMem, Length
  47. End Function
  48. '***************End Of Common Routine**************************************
  49. '**************************************************************************
  50. Property Get EntryPoint() As Long
  51. EntryPoint = st.AddressOfEntryPoint
  52. End Property
  53. Property Get CodeBase() As Long
  54.     CodeBase = st.BaseOfCode
  55. End Property
  56. Property Get DataBase() As Long
  57. DataBase = st.BaseOfData
  58. End Property
  59. Property Get ImageBase() As Long
  60. ImageBase = st.ImageBase
  61. End Property
  62. Property Get CheckSum() As Long
  63. CheckSum = st.CheckSum
  64. End Property
  65. Property Get FileAlignment() As Long
  66. FileAlignment = st.FileAlignment
  67. End Property
  68. Property Get SectionAlignment() As Long
  69. SectionAlignment = st.SectionAlignment
  70. End Property
  71. Property Get CodeSize() As Long
  72. CodeSize = st.SizeOfCode
  73. End Property
  74. Property Get ImageSize() As Long
  75. ImageSize = st.SizeOfImage
  76. End Property
  77. Property Get HeaderSize() As Long
  78. HeaderSize = st.SizeOfHeaders
  79. End Property
  80. Property Get InitializedDataSize() As Long
  81. InitializedDataSize = st.SizeOfInitializedData
  82. End Property
  83. Property Get UnInitializedDataSize() As Long
  84. UnInitializedDataSize = st.SizeOfUninitializedData
  85. End Property
  86.