ReadProcessMemory is a wrapper for the same WIN32 API function https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-readprocessmemory
(hProcess windows.Handle, lpBaseAddress uintptr, nSize uintptr)
| 135 | // ReadProcessMemory is a wrapper for the same WIN32 API function |
| 136 | // https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-readprocessmemory |
| 137 | func ReadProcessMemory(hProcess windows.Handle, lpBaseAddress uintptr, nSize uintptr) (data []byte, err error) { |
| 138 | data = make([]byte, nSize) |
| 139 | var lpNumberOfBytesRead uint32 = 0 |
| 140 | ret, _, err := syscall.Syscall6(procReadProcessMemory.Addr(), 5, uintptr(hProcess), lpBaseAddress, uintptr(unsafe.Pointer(&data[0])), nSize, uintptr(unsafe.Pointer(&lpNumberOfBytesRead)), 0) |
| 141 | if ret == 0 { |
| 142 | return nil, err |
| 143 | } |
| 144 | |
| 145 | return data, nil |
| 146 | } |
| 147 | |
| 148 | // CreateMutex is a wrapper for CreateMutexW WIN32 API function |
| 149 | // https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createmutexw |