public void putBiometric(string biometricType, Byte[] biometric, BiometricProcessedDelegate fpBiometricProcessed) { int size = Marshal.SizeOf(biometric[0]) * biometric.Length; IntPtr pnt = Marshal.AllocHGlobal(size); try { // Copy the array to unmanaged memory. Marshal.Copy(biometric, 0, pnt, biometric.Length); RetCode ret = putBiometric(biometricType, pnt, Convert.ToUInt64(biometric.Length), fpBiometricProcessed); if (RetCode.NoError != ret) { Auxiliary.Logger._log.Error("Can't put biometric with :" + ret); throw new System.Exception("Error: put biometric data"); } } finally { Marshal.FreeHGlobal(pnt); } }
static extern RetCode putBiometric([MarshalAs(UnmanagedType.LPWStr)] string biometricType, IntPtr data, UInt64 size, [MarshalAs(UnmanagedType.FunctionPtr)] BiometricProcessedDelegate fpBiometricProcessed);