예제 #1
0
        //Get ready to scan the memory for the string value.
        public void StartScanForString(string stringValue, int maxResults = -1)
        {
            //Check if the thread is already defined or not.
            if (thread != null)
            {
                //If the thread is already defined and is Alive,
                if (thread.IsAlive)
                {
                    //raise the event that shows that the last scan task is canceled
                    //(because a new task is going to be started as wanted),
                    ScanCanceledEventArgs cancelEventArgs = new ScanCanceledEventArgs();
                    ScanCanceled(this, cancelEventArgs);

                    //and then abort the alive thread and so cancel last scan task.
                    thread.Abort();
                }
            }
            //Set the thread object as a new instant of the Thread class and pass
            //a new ParameterizedThreadStart class object with the needed method passed to it
            //to run in the new thread.
            thread = new Thread(new ParameterizedThreadStart(StringScanner));
            thread.IsBackground = true;

            //Start the new thread and set the 32 bit value to look for.
            ScanThreadParams newParameters = new ScanThreadParams();

            newParameters.target     = stringValue;
            newParameters.maxResults = maxResults;
            thread.Start(newParameters);
        }
예제 #2
0
        //Cancel the scan started.
        public void CancelScan()
        {
            //Raise the event that shows that the last scan task is canceled as user asked,
            ScanCanceledEventArgs cancelEventArgs = new ScanCanceledEventArgs();

            ScanCanceled(this, cancelEventArgs);

            //and then abort the thread that scanes the memory.
            thread.Abort();
        }
예제 #3
0
 void scan_ScanCanceled(object sender, ScanCanceledEventArgs e)
 {
     ui.InitButtonStatusChanged(true);
 }