/[RomCheater]/trunk/Win32/Sojaner.MemoryScanner/PEReader.cs
ViewVC logotype

Diff of /trunk/Win32/Sojaner.MemoryScanner/PEReader.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 160 by william, Mon May 28 05:30:14 2012 UTC revision 161 by william, Mon May 28 05:55:59 2012 UTC
# Line 30  namespace Sojaner.MemoryScanner Line 30  namespace Sojaner.MemoryScanner
30                  size = Marshal.SizeOf(typeof(IMAGE_DOS_HEADER));                  size = Marshal.SizeOf(typeof(IMAGE_DOS_HEADER));
31                  data = br.ReadBytes(size);                  data = br.ReadBytes(size);
32                  pinnedPacket = GCHandle.Alloc(data, GCHandleType.Pinned);                  pinnedPacket = GCHandle.Alloc(data, GCHandleType.Pinned);
33                  IMAGE_DOS_HEADER IMAGE_DOS_HEADER = (IMAGE_DOS_HEADER)Marshal.PtrToStructure(pinnedPacket.AddrOfPinnedObject(), typeof(IMAGE_DOS_HEADER));                  IMAGE_DOS_HEADER DOS_HEADER = (IMAGE_DOS_HEADER)Marshal.PtrToStructure(pinnedPacket.AddrOfPinnedObject(), typeof(IMAGE_DOS_HEADER));
34                  pinnedPacket.Free();                  pinnedPacket.Free();
35                  #endregion                  #endregion
36    
37                  // skip the old dos stub                  // skip the old dos stub
38                  br.BaseStream.Seek(IMAGE_DOS_HEADER.e_lfanew, SeekOrigin.Begin);                  br.BaseStream.Seek(DOS_HEADER.e_lfanew, SeekOrigin.Begin);
39    
40                  #region IMAGE_NT_HEADERS                  #region IMAGE_NT_HEADERS
41                  size = Marshal.SizeOf(typeof(IMAGE_NT_HEADERS));                  size = Marshal.SizeOf(typeof(IMAGE_NT_HEADERS));
42                  data = br.ReadBytes(size);                  data = br.ReadBytes(size);
43                  pinnedPacket = GCHandle.Alloc(data, GCHandleType.Pinned);                  pinnedPacket = GCHandle.Alloc(data, GCHandleType.Pinned);
44                  IMAGE_NT_HEADERS IMAGE_NT_HEADERS = (IMAGE_NT_HEADERS)Marshal.PtrToStructure(pinnedPacket.AddrOfPinnedObject(), typeof(IMAGE_NT_HEADERS));                  IMAGE_NT_HEADERS NT_HEADER = (IMAGE_NT_HEADERS)Marshal.PtrToStructure(pinnedPacket.AddrOfPinnedObject(), typeof(IMAGE_NT_HEADERS));
45                  pinnedPacket.Free();                  pinnedPacket.Free();
46                  #endregion                  #endregion
47    
48    
   
49                  br.Close();                  br.Close();
50              }              }
51    
# Line 61  namespace Sojaner.MemoryScanner Line 60  namespace Sojaner.MemoryScanner
60          {          {
61              public UInt32 VirtualAddress;              public UInt32 VirtualAddress;
62              public UInt32 Size;              public UInt32 Size;
63                public bool HasAddress { get { return (VirtualAddress != 0); } }
64                public bool HasSize { get { return (Size > 0); } }
65          }          }
66          #endregion          #endregion
67          #region IMAGE_FILE_HEADER          #region IMAGE_FILE_HEADER

Legend:
Removed from v.160  
changed lines
  Added in v.161

  ViewVC Help
Powered by ViewVC 1.1.22