Example #1
0
func main() {
	//To make this work, you need to find a process ID and a memory address to grab from
	processHex := "006B0E0"
	memoryHex := "00287B08"

	//Convert hex address to uint32
	processAddr, err := w32.HexToUint32(processHex)
	if err != nil {
		fmt.Println("Error with process address:", err.Error())
		return
	}

	//Open a process handle for reading
	handle, err := w32.OpenProcess(w32.PROCESS_VM_READ, false, processAddr)
	if err != nil {
		fmt.Println("Error opening process:", err.Error())
		return
	}

	//Convert hex address to uint32
	memoryAddr, err := w32.HexToUint32(memoryHex)
	if err != nil {
		fmt.Println("Error with memory address:", err.Error())
		return
	}

	//Read memory and place into data
	data, err := w32.ReadProcessMemoryAsUint32(handle, memoryAddr)
	if err != nil {
		fmt.Println("Error Reading memory:", err.Error())
		return
	} else {
		fmt.Println("Success! Read memory:", data)
	}
}
Example #2
0
//This is an example to show how to read process memory and convert it to a struct
func main() {
	for {
		processAddr, err := w32.HexToUint32("00BEF28")
		if err != nil {
			fmt.Println("Error with process address:", err.Error())
			return
		}

		handle, err := w32.OpenProcess(w32.PROCESS_VM_READ, false, processAddr)
		if err != nil {
			fmt.Println("Error opening process:", err.Error())
			return
		}
		player := GetPlayerMemory(handle, "37F7E868")
		fmt.Println("State:", player.SitState, "Name:", player.GetFirstName(), "LastName:", player.GetLastName(), "HP:", player.CurHP, "/", player.MaxHP, "SP:", player.CurSP, "/", player.MaxSP)
		time.Sleep(1 * time.Second)
	}
}