memory

package
v0.0.0-...-f4c32f8 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2021 License: GPL-2.0, GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_MODULE_NAME32        = 255
	MAX_PATH                 = 260
	TH32CS_SNAPHEAPLIST      = 0x00000001
	TH32CS_SNAPPROCESS       = 0x00000002
	TH32CS_SNAPTHREAD        = 0x00000004
	TH32CS_SNAPMODULE        = 0x00000008
	TH32CS_SNAPMODULE32      = 0x00000010
	TH32CS_INHERIT           = 0x80000000
	TH32CS_SNAPALL           = TH32CS_SNAPHEAPLIST | TH32CS_SNAPMODULE | TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD
	STANDARD_RIGHTS_REQUIRED = 0x000F0000
	SYNCHRONIZE              = 0x00100000
	PROCESS_ALL_ACCESS       = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xffff
)

Variables

This section is empty.

Functions

func AdjustTokenPrivileges

func AdjustTokenPrivileges(tokenHandle HANDLE, disableAllPrivileges BOOL, newState *w32.TOKEN_PRIVILEGES, bufferLength uint32, previousState *w32.TOKEN_PRIVILEGES, returnLength *uint32) bool

func ByteToFloat32

func ByteToFloat32(data []byte) float32

func ByteToFloats32

func ByteToFloats32(data []byte) []float32

func ByteToInt

func ByteToInt(data []byte) int

func ByteToIntPtr

func ByteToIntPtr(data []byte) uintptr

func ByteToInts

func ByteToInts(data []byte) []int

func CloseHandle

func CloseHandle(hObject HANDLE) bool

func EnumProcessModules

func EnumProcessModules(hProcess HANDLE, cb uintptr, lpcbNeeded uintptr) (uintptr, []uint16, error)

func Float32ToByte

func Float32ToByte(f float32) []byte

func Floats32ToByte

func Floats32ToByte(f []float32) []byte

func GetAsyncKeyState

func GetAsyncKeyState(vKey int) uint16

func GetLastError

func GetLastError() uint32

func IntToByte

func IntToByte(i int) []byte

func IntsToByte

func IntsToByte(i []int) []byte

func Module32First

func Module32First(hSnapshot HANDLE, me *MODULEENTRY32) bool

func Module32Next

func Module32Next(hSnapshot HANDLE, me *MODULEENTRY32) bool

func OffsetAddr

func OffsetAddr(hProcess HANDLE, baseAddr uintptr, offAddrs []uintptr) uintptr

func OpenProcessToken

func OpenProcessToken(processHandle HANDLE, desiredAccess uint32, tokenHandle *HANDLE) bool

func Process32First

func Process32First(hSnapshot HANDLE, pe *PROCESSENTRY32) bool

func Process32Next

func Process32Next(hSnapshot HANDLE, pe *PROCESSENTRY32) bool

func ReadProcessMemory

func ReadProcessMemory(hProcess HANDLE, lpBaseAddress LPCVOID, lpBuffer unsafe.Pointer, nSize uint) error

func WriteProcessMemory

func WriteProcessMemory(hProcess HANDLE, lpBaseAddress uintptr, data []byte) error

Types

type BOOL

type BOOL = int32

type HANDLE

type HANDLE uintptr

func CreateToolhelp32Snapshot

func CreateToolhelp32Snapshot(dwFlags uintptr, th32ProcessID uint32) HANDLE

func OpenProcess

func OpenProcess(dwDesiredAccess uint32, bInheritHandle bool, dwProcessId uint32) (HANDLE, error)

type HMODULE

type HMODULE HANDLE

func GetModuleHandle

func GetModuleHandle(lpModuleName string) HMODULE

type LPCVOID

type LPCVOID unsafe.Pointer

type MODULEENTRY32

type MODULEENTRY32 struct {
	DwSize        uint32
	Th32ModuleID  uint32
	Th32ProcessID uint32
	GlblcntUsage  uint32
	ProccntUsage  uint32
	ModBaseAddr   *uintptr
	ModBaseSize   uint32
	HModule       HMODULE
	SzModule      [MAX_MODULE_NAME32 + 1]uint8
	SzExePath     [MAX_PATH]uint8
}

func GetModule

func GetModule(module string, PID uint32) (MODULEENTRY32, bool, unsafe.Pointer)

type Module

type Module struct {
	Name        string
	BaseSize    uint32
	BaseAddress uintptr
}

type PROCESSENTRY32

type PROCESSENTRY32 struct {
	DwSize              uint32
	CntUsage            uint32
	Th32ProcessID       uint32
	Th32DefaultHeapID   uintptr
	Th32ModuleID        uint32
	CntThreads          uint32
	Th32ParentProcessID uint32
	PcPriClassBase      uint32
	DwFlags             uint32
	SzExeFile           [MAX_PATH]uint8
}

type Process

type Process struct {
	Name        string
	Id          uint32
	BaseSize    uint32
	BaseAddress uintptr
	Handle      HANDLE
	Modules     map[string]Module
}

func GetProcess

func GetProcess(PID uint32) (Process, error)

func GetProcessByName

func GetProcessByName(process string) (Process, bool)

func (*Process) OpenProcess

func (p *Process) OpenProcess()

func (Process) ReadBytes

func (p Process) ReadBytes(address uintptr, size uint) ([]byte, error)

func (Process) ReadFloat32

func (p Process) ReadFloat32(address uintptr) (float32, error)

func (Process) ReadFloats32

func (p Process) ReadFloats32(address uintptr, howMuchFloats int) ([]float32, error)

func (Process) ReadInt

func (p Process) ReadInt(address uintptr) (int, error)

func (Process) ReadIntPtr

func (p Process) ReadIntPtr(address uintptr) (uintptr, error)

func (Process) ReadInts

func (p Process) ReadInts(address uintptr, howMuchInts int) ([]int, error)

func (Process) WriteBytes

func (p Process) WriteBytes(address uintptr, data []byte) error

func (Process) WriteFloat32

func (p Process) WriteFloat32(address uintptr, float float32) error

func (Process) WriteFloats32

func (p Process) WriteFloats32(address uintptr, floats []float32) error

func (Process) WriteInt

func (p Process) WriteInt(address uintptr, integer int) error

func (Process) WriteInts

func (p Process) WriteInts(address uintptr, integers []int) error

Jump to

Keyboard shortcuts

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