16 lines
280 B
Plaintext
16 lines
280 B
Plaintext
alloc(length int) -> []byte {
|
|
x := kernel32.VirtualAlloc(0, length+8, mem.commit|mem.reserve, page.readwrite)
|
|
|
|
if x < 0x1000 {
|
|
return x
|
|
}
|
|
|
|
[x] = length
|
|
return x + 8
|
|
}
|
|
|
|
extern {
|
|
kernel32 {
|
|
VirtualAlloc(address int, size uint, flags uint32, protection uint32) -> *any
|
|
}
|
|
} |