/[RomCheater]/trunk/RomCheater/Docking/FloatingMemorySearcher.cs
ViewVC logotype

Diff of /trunk/RomCheater/Docking/FloatingMemorySearcher.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/RomCheater/Docking/FloatingMemorySearcher.cs	2013/06/03 02:23:04	459
+++ trunk/RomCheater/Docking/FloatingMemorySearcher.cs	2013/06/03 03:00:13	460
@@ -1426,39 +1426,50 @@
                 provider_st.Start();
                 using (GenericMemoryProvider provider = new GenericMemoryProvider((IAcceptsProcessAndConfig)this))
                 {
-                    provider.OpenProvider();
-                    int count = (int)((MemoryRangeSize - MemoryRangeStart) / STEP_SIZE);
-                    SearchResultWriter writer = new SearchResultWriter((int)(count), SearchGuid);
-                    provider.OnBytesRead += new BaseEventHandler<OnBytesReadEventArgs>(search_provider_OnBytesRead);
+                   
                     if (SearchArgs.IsFirstSearch)
                     {
+                        provider.OpenProvider();
+                        int count = (int)((MemoryRangeSize - MemoryRangeStart) / STEP_SIZE);
+                        SearchResultWriter writer = new SearchResultWriter((int)(count), SearchGuid);
+                        provider.OnBytesRead += new BaseEventHandler<OnBytesReadEventArgs>(search_provider_OnBytesRead);
                         provider.ReadProcessMemoryAtOnce(MemoryRangeStart, (MemoryRangeSize - MemoryRangeStart), writer);
+                        if (SearchWorkerThread.CancellationPending)
+                        {
+                            provider_st.Stop();
+                            st.Stop();
+                            writer.CancelRequest();
+                            writer.Dispose();
+                            writer = null;
+                            e.Result = true;
+                            provider.CloseProvider();
+                            return;
+                        }
+                        writer.Dispose();
+                        writer = null;
+                        provider.CloseProvider();
                     }
                     else
                     {
                         // need to get the address list
                         using (SearchResultReader reader = new SearchResultReader(SearchGuid))
-                        {
-                            var addresses = reader.GetResultAddresses(SearchArgs, (IAcceptsProcessAndConfig)this, resultsprogress);
-                            foreach (var address in addresses)
+                        {                        
+                            byte[] guid = SearchGuid.ToByteArray();
+                            guid[guid.Length-1]++; // increment the search guid by 1
+                            Guid new_SearchGuid = new Guid(guid);
+                            provider.OpenProvider();
+                            provider.OnBytesRead += new BaseEventHandler<OnBytesReadEventArgs>(search_provider_OnBytesRead);
+                            foreach (var item in reader.GetResults(SearchArgs, (IAcceptsProcessAndConfig)this, resultsprogress))
                             {
-                                provider.ReadProcessMemoryAtOnce(address, STEP_SIZE, writer);
+                                using (SearchResultWriter writer = new SearchResultWriter((int)(reader.ResultCount), new_SearchGuid))
+                                {
+                                    provider.ReadProcessMemoryAtOnce(item.Address, STEP_SIZE, writer);
+                                }
                             }
+                            provider.CloseProvider();
+                            SearchGuid = new_SearchGuid;
                         }
                     }
-                    provider.CloseProvider();
-                    if (SearchWorkerThread.CancellationPending)
-                    {
-                        provider_st.Stop();
-                        st.Stop();
-                        writer.CancelRequest();
-                        writer.Dispose();
-                        writer = null;
-                        e.Result = true;
-                        return;
-                    }
-                    writer.Dispose();
-                    writer = null;
                 }
                 provider_st.Stop();
                 logger.Profiler.WriteLine("It took a total of {0} seconds for the memory provider to complete it's operation(s).", provider_st.Elapsed.TotalSeconds);

 

  ViewVC Help
Powered by ViewVC 1.1.22