private void GetBiometricDisplay(FingerprintTemplate tptQuery, IntPtr rawImage, int width, int height, int res, IntPtr hdc, ref IntPtr handle, int matchContext) { IntPtr zero = IntPtr.Zero; try { zero = Marshal.AllocHGlobal(tptQuery.Size); Marshal.Copy(tptQuery.Buffer, 0, zero, tptQuery.Size); int errorCode = 0; try { errorCode = GrFingerprintProxy.GrBiometricDisplay(zero, rawImage, width, height, res, hdc, ref handle, matchContext); } catch (AccessViolationException exception) { FingerprintException exception2 = new FingerprintException(-113, exception); throw exception2; } FingerprintException.CheckError(errorCode); } catch (OutOfMemoryException exception3) { throw new FingerprintException(-7, exception3); } finally { Marshal.FreeHGlobal(zero); } }