Question

I'm working on a fingerprint recognition software on c#, WPF Visual Studio 2012, I'm using secugen hamster to take the fingerprints, the software is all done, I can register the fingerprints correctly to the database and succesfull retrieve and compare them for the user access, but sometimes when the software is matching the stored fingerprint with the one just taken of the user, the method MatchIsoTemplate generates an error 'attempt to read or write protected memory. this is often an indication that other memory damaged' and the program stops, I tried to catch this with a try catch but It doesn't work, no matter what the program stops there, this is the code I'm using according to the example of secugen sdk

SGFPMISOTemplateInfo sample_info = new SGFPMISOTemplateInfo();
                            Int32 err = m_FPM.GetIsoTemplateInfo(customer.Huella, sample_info);
                            bool matched = false;
                            for (int i = 0; i < sample_info.TotalSamples; i++)
                            {
                                try
                                {
                                    m_FPM.MatchIsoTemplate(customer.Huella, i, m_VrfMin, 0, m_SecurityLevel, ref matched);
                                }
                                catch (Exception)
                                {
                                    MessageBox.Show("Try Again", "Aviso", MessageBoxButton.OK, MessageBoxImage.Hand);
                                }


                                if (matched)
                                {
                                    //fill data
Was it helpful?

Solution

I answer my own question, finally I discover how to do it, i just need to wrap the method around the [HandleProcessCorruptedStateExceptions] from System.Runtime.ExceptionServices and use a Try Catch in the correct part of the method, like this

[HandleProcessCorruptedStateExceptions]
        void myFunction()
        {
try
{
    switch (sequence)
    {
        case 0:
            sequence++;
            m_FPMAux.MatchIsoTemplate(customer.Huella, i, m_VrfMin, 0, m_SecurityLevel, ref matched);
            break;
            case 1:
            sequence++;
            m_FPMAux.MatchIsoTemplate(m_VrfMin, 0, customer.Huella, i, m_SecurityLevel, ref matched);  .......
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top