2025-02-12 00:04:30 +01:00
|
|
|
extern kernel32 {
|
2025-02-17 14:31:47 +01:00
|
|
|
VirtualAlloc(address int, length int, flags int, protection int)
|
|
|
|
VirtualFree(address *any, length int, type int) -> bool
|
2025-02-12 00:04:30 +01:00
|
|
|
}
|
|
|
|
|
2025-02-15 14:38:01 +01:00
|
|
|
const mem {
|
|
|
|
decommit 0x4000
|
|
|
|
}
|
|
|
|
|
2025-02-17 14:31:47 +01:00
|
|
|
mmap(address int, length int, protection int, flags int) -> *any {
|
2024-08-19 11:11:45 +02:00
|
|
|
return kernel32.VirtualAlloc(address, length, flags, protection)
|
2024-08-15 13:53:00 +02:00
|
|
|
}
|
|
|
|
|
2025-02-17 14:31:47 +01:00
|
|
|
munmap(address *any, length int) -> int {
|
2025-02-15 14:38:01 +01:00
|
|
|
return kernel32.VirtualFree(address, length, mem.decommit)
|
2024-08-13 19:34:54 +02:00
|
|
|
}
|