@@ -41,8 +41,8 @@ public class Module
4141 public enum SectionCategory
4242 {
4343 Unknown ,
44- Code ,
45- Data
44+ CODE ,
45+ DATA
4646 }
4747
4848 public class Section
@@ -377,20 +377,15 @@ public Section GetSectionToPointer(IntPtr address)
377377 {
378378 lock ( sections )
379379 {
380- return sections
381- . Where ( s => s . Category != SectionCategory . Unknown )
382- . Where ( s => address . InRange ( s . Start , s . End ) )
383- . FirstOrDefault ( ) ;
380+ return sections . BinaryFind ( s => address . CompareToRange ( s . Start , s . End ) ) ;
384381 }
385382 }
386383
387384 public Module GetModuleToPointer ( IntPtr address )
388385 {
389386 lock ( modules )
390387 {
391- return modules
392- . Where ( m => address . InRange ( m . Start , m . End ) )
393- . FirstOrDefault ( ) ;
388+ return modules . BinaryFind ( m => address . CompareToRange ( m . Start , m . End ) ) ;
394389 }
395390 }
396391
@@ -412,7 +407,14 @@ public string GetNamedAddress(IntPtr address)
412407 var section = GetSectionToPointer ( address ) ;
413408 if ( section != null )
414409 {
415- return $ "<{ section . Category } >{ section . ModuleName } .{ address . ToString ( "X" ) } ";
410+ if ( section . Category != SectionCategory . Unknown )
411+ {
412+ return $ "<{ section . Category } >{ section . ModuleName } .{ address . ToString ( "X" ) } ";
413+ }
414+ else if ( section . Type == NativeMethods . TypeEnum . MEM_PRIVATE )
415+ {
416+ return $ "<HEAP>{ address . ToString ( "X" ) } ";
417+ }
416418 }
417419 var module = GetModuleToPointer ( address ) ;
418420 if ( module != null )
@@ -470,13 +472,13 @@ public Task UpdateProcessInformationsAsync()
470472 {
471473 case ".text" :
472474 case "code" :
473- section . Category = SectionCategory . Code ;
475+ section . Category = SectionCategory . CODE ;
474476 break ;
475477 case ".data" :
476478 case "data" :
477479 case ".rdata" :
478480 case ".idata" :
479- section . Category = SectionCategory . Data ;
481+ section . Category = SectionCategory . DATA ;
480482 break ;
481483 }
482484 newSections . Add ( section ) ;
@@ -493,6 +495,9 @@ public Task UpdateProcessInformationsAsync()
493495 }
494496 ) ;
495497
498+ newModules . Sort ( ( m1 , m2 ) => m1 . Start . CompareTo ( m2 . Start ) ) ;
499+ newSections . Sort ( ( s1 , s2 ) => s1 . Start . CompareTo ( s2 . Start ) ) ;
500+
496501 lock ( modules )
497502 {
498503 modules . Clear ( ) ;
0 commit comments