-
Notifications
You must be signed in to change notification settings - Fork 8
/
superdwrapper.go
33 lines (27 loc) · 935 Bytes
/
superdwrapper.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package superdeye
import (
"unsafe"
"golang.org/x/sys/windows"
)
func NtAllocateVirtualMemory(handle windows.Handle, address uintptr, size uintptr, alloctype uint32, protect uint32) (value uintptr, NTSTATUS uint32, err error) {
var baseAddr uintptr
NTSTATUS, err = SuperdSyscall("NtAllocateVirtualMemory",
uintptr(handle),
uintptr(unsafe.Pointer(&baseAddr)),
uintptr(unsafe.Pointer(nil)),
uintptr(unsafe.Pointer(&size)),
uintptr(alloctype),
uintptr(protect),
)
return baseAddr, NTSTATUS, err
}
func NtWriteVirtualMemory(handle windows.Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesWritten *uintptr) (NTSTATUS uint32, err error) {
NTSTATUS, err = SuperdSyscall("NtWriteVirtualMemory",
uintptr(handle),
baseAddress,
uintptr(unsafe.Pointer(buffer)),
uintptr(size),
uintptr(unsafe.Pointer(numberOfBytesWritten)),
)
return NTSTATUS, err
}