コード例 #1
0
        private void Extract([In] IntPtr rawimage, int width, int height, int res, ref FingerprintTemplate fingerTemplate, int context)
        {
            IntPtr zero = IntPtr.Zero;

            try
            {
                int cb = 0x2710 * Marshal.SizeOf(typeof(byte));
                zero = Marshal.AllocHGlobal(cb);
                int quality = FingerprintException.CheckError(GrFingerprintProxy.GrExtract(rawimage, width, height, res, zero, ref cb, context));
                zero           = Marshal.ReAllocHGlobal(zero, (IntPtr)cb);
                fingerTemplate = new FingerprintTemplate(zero, cb, quality);
            }
            catch (OutOfMemoryException exception)
            {
                throw new FingerprintException(-7, exception);
            }
            catch (AccessViolationException exception2)
            {
                throw new FingerprintException(-113, exception2);
            }
            finally
            {
                Marshal.FreeHGlobal(zero);
            }
        }