VirtualAlloc function Null safety kernel32

Pointer<NativeType> VirtualAlloc(
  1. Pointer<NativeType> lpAddress,
  2. int dwSize,
  3. int flAllocationType,
  4. int flProtect

Reserves, commits, or changes the state of a region of pages in the virtual address space of the calling process. Memory allocated by this function is automatically initialized to zero.

LPVOID VirtualAlloc(
  LPVOID lpAddress,
  SIZE_T dwSize,
  DWORD  flAllocationType,
  DWORD  flProtect


Pointer VirtualAlloc(
    Pointer lpAddress, int dwSize, int flAllocationType, int flProtect) {
  final _VirtualAlloc = _kernel32.lookupFunction<
      Pointer Function(Pointer lpAddress, IntPtr dwSize,
          Uint32 flAllocationType, Uint32 flProtect),
      Pointer Function(Pointer lpAddress, int dwSize, int flAllocationType,
          int flProtect)>('VirtualAlloc');
  return _VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect);