mirror of
https://github.com/Binject/debug
synced 2026-06-08 10:28:33 +00:00
Fixes issue #26, where DOS Stubs were being zeroed out incorrectly.
Thanks to kulinacs for the issue report!
This commit is contained in:
+3
-3
@@ -98,7 +98,7 @@ func newFileInternal(r io.ReaderAt, memoryMode bool) (*File, error) {
|
||||
|
||||
binary.Read(sr, binary.LittleEndian, &f.DosHeader)
|
||||
dosHeaderSize := binary.Size(f.DosHeader)
|
||||
if dosHeaderSize > int(f.DosHeader.AddressOfNewExeHeader) {
|
||||
if dosHeaderSize < int(f.DosHeader.AddressOfNewExeHeader) {
|
||||
binary.Read(sr, binary.LittleEndian, &f.DosStub)
|
||||
f.DosExists = true
|
||||
} else {
|
||||
@@ -441,7 +441,7 @@ func (e *FormatError) Error() string {
|
||||
return "unknown error"
|
||||
}
|
||||
|
||||
//RVAToFileOffset Converts a Relative offset to the actual offset in the file.
|
||||
// RVAToFileOffset Converts a Relative offset to the actual offset in the file.
|
||||
func (f *File) RVAToFileOffset(rva uint32) uint32 {
|
||||
var offset uint32
|
||||
for _, section := range f.Sections {
|
||||
@@ -452,7 +452,7 @@ func (f *File) RVAToFileOffset(rva uint32) uint32 {
|
||||
return offset
|
||||
}
|
||||
|
||||
//IsManaged returns true if the loaded PE file references the CLR header (aka is a .net exe)
|
||||
// IsManaged returns true if the loaded PE file references the CLR header (aka is a .net exe)
|
||||
func (f *File) IsManaged() bool {
|
||||
switch v := f.OptionalHeader.(type) {
|
||||
case *OptionalHeader32:
|
||||
|
||||
Reference in New Issue
Block a user