Skip to content

Instantly share code, notes, and snippets.

@samsonjs
Created January 19, 2010 03:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samsonjs/280642 to your computer and use it in GitHub Desktop.
Save samsonjs/280642 to your computer and use it in GitHub Desktop.
# Segment commands are one type of load command.
# Load commands all begin with the type of command it is, cmd,
# and the size of that command's struct in bytes.
class LoadCommand < CStruct
uint32 :cmd
uint32 :cmdsize
end
# Values for the cmd member of LoadCommand CStructs (incomplete).
LC_SEGMENT = 0x1
LC_SYMTAB = 0x2
class SegmentCommand < LoadCommand
string :segname, 16
uint32 :vmaddr
uint32 :vmsize
uint32 :fileoff
uint32 :filesize
int32 :maxprot
int32 :initprot
uint32 :nsects
uint32 :flags
end
# Values for protection fields, maxprot and initprot (incomplete).
# (These are bitwise or'd together as in C.)
VM_PROT_NONE = 0x00
VM_PROT_READ = 0x01
VM_PROT_WRITE = 0x02
VM_PROT_EXECUTE = 0x04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment