EnumProcessModules function Null safety kernel32

int EnumProcessModules(
  1. int hProcess,
  2. Pointer<IntPtr> lphModule,
  3. int cb,
  4. Pointer<Uint32> lpcbNeeded
)

Retrieves a handle for each module in the specified process.

BOOL K32EnumProcessModules(
  HANDLE  hProcess,
  HMODULE *lphModule,
  DWORD   cb,
  LPDWORD lpcbNeeded
);

Implementation

int EnumProcessModules(int hProcess, Pointer<IntPtr> lphModule, int cb,
    Pointer<Uint32> lpcbNeeded) {
  final _EnumProcessModules = _kernel32.lookupFunction<
      Int32 Function(IntPtr hProcess, Pointer<IntPtr> lphModule, Uint32 cb,
          Pointer<Uint32> lpcbNeeded),
      int Function(int hProcess, Pointer<IntPtr> lphModule, int cb,
          Pointer<Uint32> lpcbNeeded)>('K32EnumProcessModules');
  return _EnumProcessModules(hProcess, lphModule, cb, lpcbNeeded);
}