patchlib

package
v0.6.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package patchlib provides common functions related to patching binaries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Patcher

type Patcher struct {
	// contains filtered or unexported fields
}

Patcher applies patches to a byte array. All operations are done starting from cur.

func NewPatcher

func NewPatcher(in []byte) *Patcher

NewPatcher creates a new Patcher.

func (*Patcher) BaseAddress

func (p *Patcher) BaseAddress(offset int32) error

BaseAddress moves cur to an offset. The offset starts at 0.

func (*Patcher) FindBaseAddress

func (p *Patcher) FindBaseAddress(find []byte) error

FindBaseAddress moves cur to the offset of a sequence of bytes.

func (*Patcher) FindBaseAddressString

func (p *Patcher) FindBaseAddressString(find string) error

FindBaseAddressString moves cur to the offset of a string.

func (*Patcher) GetBytes

func (p *Patcher) GetBytes() []byte

GetBytes returns the current content of the Patcher.

func (*Patcher) ReplaceBytes

func (p *Patcher) ReplaceBytes(offset int32, find, replace []byte) error

ReplaceBytes replaces the first occurrence of a sequence of bytes with another of the same length.

func (*Patcher) ReplaceFloat

func (p *Patcher) ReplaceFloat(offset int32, find, replace float64) error

ReplaceFloat replaces the first occurrence of a float.

func (*Patcher) ReplaceInt

func (p *Patcher) ReplaceInt(offset int32, find, replace uint8) error

ReplaceInt replaces the first occurrence of an integer between 0 and 255 inclusively.

func (*Patcher) ReplaceString

func (p *Patcher) ReplaceString(offset int32, find, replace string) error

ReplaceString replaces the first occurrence of a string with another of the same length.

func (*Patcher) ResetBaseAddress

func (p *Patcher) ResetBaseAddress()

ResetBaseAddress moves cur to 0.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL