2025-02-21 13:47:56 +01:00
|
|
|
extern kernel32 {
|
|
|
|
VirtualAlloc(address int, size uint, flags uint32, protection uint32) -> *any
|
|
|
|
}
|
2024-08-19 17:25:51 +02:00
|
|
|
|
2025-02-21 11:27:45 +01:00
|
|
|
alloc(length int) -> []byte {
|
2025-02-21 13:47:56 +01:00
|
|
|
x := kernel32.VirtualAlloc(0, length+8, mem.commit|mem.reserve, page.readwrite)
|
2025-02-09 14:14:41 +01:00
|
|
|
|
2025-02-09 14:38:01 +01:00
|
|
|
if x < 0x1000 {
|
2025-02-09 14:14:41 +01:00
|
|
|
return x
|
|
|
|
}
|
|
|
|
|
|
|
|
store(x, 8, length)
|
|
|
|
return x + 8
|
2024-08-19 17:25:51 +02:00
|
|
|
}
|