@@ -31,75 +31,78 @@ protected int AddComment(DrawContext view, int x, int y, float fvalue, IntPtr iv
31
31
}
32
32
}
33
33
34
- var namedAddress = view . Process . GetNamedAddress ( ivalue ) ;
35
- if ( ! string . IsNullOrEmpty ( namedAddress ) )
34
+ if ( ivalue != IntPtr . Zero )
36
35
{
37
- if ( view . Settings . ShowCommentPointer )
36
+ var namedAddress = view . Process . GetNamedAddress ( ivalue ) ;
37
+ if ( ! string . IsNullOrEmpty ( namedAddress ) )
38
38
{
39
- x = AddText ( view , x , y , view . Settings . OffsetColor , HotSpot . NoneId , "->" ) + view . Font . Width ;
40
- x = AddText ( view , x , y , view . Settings . OffsetColor , HotSpot . ReadOnlyId , namedAddress ) + view . Font . Width ;
41
- }
42
-
43
- if ( view . Settings . ShowCommentRtti )
44
- {
45
- var rtti = view . Process . ReadRemoteRuntimeTypeInformation ( ivalue ) ;
46
- if ( ! string . IsNullOrEmpty ( rtti ) )
39
+ if ( view . Settings . ShowCommentPointer )
47
40
{
48
- x = AddText ( view , x , y , view . Settings . OffsetColor , HotSpot . ReadOnlyId , rtti ) + view . Font . Width ;
41
+ x = AddText ( view , x , y , view . Settings . OffsetColor , HotSpot . NoneId , "->" ) + view . Font . Width ;
42
+ x = AddText ( view , x , y , view . Settings . OffsetColor , HotSpot . ReadOnlyId , namedAddress ) + view . Font . Width ;
49
43
}
50
- }
51
44
52
- if ( view . Settings . ShowCommentSymbol )
53
- {
54
- var module = view . Process . GetModuleToPointer ( ivalue ) ;
55
- if ( module != null )
45
+ if ( view . Settings . ShowCommentRtti )
56
46
{
57
- var symbols = view . Process . Symbols . GetSymbolsForModule ( module ) ;
58
- var symbol = symbols ? . GetSymbolString ( ivalue , module ) ;
59
- if ( ! string . IsNullOrEmpty ( symbol ) )
47
+ var rtti = view . Process . ReadRemoteRuntimeTypeInformation ( ivalue ) ;
48
+ if ( ! string . IsNullOrEmpty ( rtti ) )
60
49
{
61
- x = AddText ( view , x , y , view . Settings . OffsetColor , HotSpot . ReadOnlyId , symbol ) + view . Font . Width ;
50
+ x = AddText ( view , x , y , view . Settings . OffsetColor , HotSpot . ReadOnlyId , rtti ) + view . Font . Width ;
62
51
}
63
52
}
64
- }
65
53
66
- if ( view . Settings . ShowCommentString )
67
- {
68
- var data = view . Process . ReadRemoteMemory ( ivalue , 64 ) ;
69
-
70
- var isWideString = false ;
71
- string text = null ;
72
-
73
- // First check if it could be an UTF8 string and if not try UTF16.
74
- if ( data . Take ( IntPtr . Size ) . InterpretAsSingleByteCharacter ( ) . IsPrintableData ( ) )
54
+ if ( view . Settings . ShowCommentSymbol )
75
55
{
76
- text = new string ( Encoding . UTF8 . GetChars ( data ) . TakeWhile ( c => c != 0 ) . ToArray ( ) ) ;
56
+ var module = view . Process . GetModuleToPointer ( ivalue ) ;
57
+ if ( module != null )
58
+ {
59
+ var symbols = view . Process . Symbols . GetSymbolsForModule ( module ) ;
60
+ var symbol = symbols ? . GetSymbolString ( ivalue , module ) ;
61
+ if ( ! string . IsNullOrEmpty ( symbol ) )
62
+ {
63
+ x = AddText ( view , x , y , view . Settings . OffsetColor , HotSpot . ReadOnlyId , symbol ) + view . Font . Width ;
64
+ }
65
+ }
77
66
}
78
- else if ( data . Take ( IntPtr . Size * 2 ) . InterpretAsDoubleByteCharacter ( ) . IsPrintableData ( ) )
67
+
68
+ if ( view . Settings . ShowCommentString )
79
69
{
80
- isWideString = true ;
70
+ var data = view . Process . ReadRemoteMemory ( ivalue , 64 ) ;
81
71
82
- text = new string ( Encoding . Unicode . GetChars ( data ) . TakeWhile ( c => c != 0 ) . ToArray ( ) ) ;
83
- }
72
+ var isWideString = false ;
73
+ string text = null ;
84
74
85
- if ( text != null )
86
- {
87
- x = AddText ( view , x , y , view . Settings . TextColor , HotSpot . NoneId , isWideString ? "L'" : "'" ) ;
88
- x = AddText ( view , x , y , view . Settings . TextColor , HotSpot . ReadOnlyId , text ) ;
89
- x = AddText ( view , x , y , view . Settings . TextColor , HotSpot . NoneId , "'" ) + view . Font . Width ;
90
- }
91
- }
75
+ // First check if it could be an UTF8 string and if not try UTF16.
76
+ if ( data . Take ( IntPtr . Size ) . InterpretAsSingleByteCharacter ( ) . IsPrintableData ( ) )
77
+ {
78
+ text = new string ( Encoding . UTF8 . GetChars ( data ) . TakeWhile ( c => c != 0 ) . ToArray ( ) ) ;
79
+ }
80
+ else if ( data . Take ( IntPtr . Size * 2 ) . InterpretAsDoubleByteCharacter ( ) . IsPrintableData ( ) )
81
+ {
82
+ isWideString = true ;
92
83
93
- if ( view . Settings . ShowCommentPluginInfo )
94
- {
95
- var nodeAddress = view . Address + Offset ;
84
+ text = new string ( Encoding . Unicode . GetChars ( data ) . TakeWhile ( c => c != 0 ) . ToArray ( ) ) ;
85
+ }
86
+
87
+ if ( text != null )
88
+ {
89
+ x = AddText ( view , x , y , view . Settings . TextColor , HotSpot . NoneId , isWideString ? "L'" : "'" ) ;
90
+ x = AddText ( view , x , y , view . Settings . TextColor , HotSpot . ReadOnlyId , text ) ;
91
+ x = AddText ( view , x , y , view . Settings . TextColor , HotSpot . NoneId , "'" ) + view . Font . Width ;
92
+ }
93
+ }
96
94
97
- foreach ( var reader in NodeInfoReader )
95
+ if ( view . Settings . ShowCommentPluginInfo )
98
96
{
99
- var info = reader . ReadNodeInfo ( this , view . Process , view . Memory , nodeAddress , ivalue ) ;
100
- if ( info != null )
97
+ var nodeAddress = view . Address + Offset ;
98
+
99
+ foreach ( var reader in NodeInfoReader )
101
100
{
102
- x = AddText ( view , x , y , view . Settings . PluginColor , HotSpot . ReadOnlyId , info ) + view . Font . Width ;
101
+ var info = reader . ReadNodeInfo ( this , view . Process , view . Memory , nodeAddress , ivalue ) ;
102
+ if ( info != null )
103
+ {
104
+ x = AddText ( view , x , y , view . Settings . PluginColor , HotSpot . ReadOnlyId , info ) + view . Font . Width ;
105
+ }
103
106
}
104
107
}
105
108
}
0 commit comments