static void walChecksumBytes(bool nativeChecksum, WalIndexHeader header, byte[] checksum, byte[] checksumOut) { int size = Marshal.SizeOf(header); var b = new byte[size]; var p = Marshal.AllocHGlobal(size); Marshal.StructureToPtr(header, p, true); Marshal.Copy(p, b, 0, size); Marshal.FreeHGlobal(p); walChecksumBytes(nativeChecksum, b, size, checksum, checksumOut); }