@@ -71,7 +71,7 @@ private void push(object val)
7171
7272 public void Run ( int Offset )
7373 {
74- object [ ] LocalVariables = new object [ 0 ] ;
74+ object [ ] LocalVariables = new object [ 512 ] ;
7575 while ( true )
7676 {
7777 byte curByte = Marshal . ReadByte ( IntPtr . Add ( MemoryPointer , CodeSectionOffset + Offset ++ ) ) ;
@@ -109,33 +109,76 @@ public void Run(int Offset)
109109 }
110110 case 0x41 : //Call C# Method
111111 {
112- var method = typeof ( System . Windows . Forms . MessageBox ) . GetMethod ( "Show" , new Type [ ] { typeof ( String ) } ) ;
113- var rez = method . Invoke ( null , new [ ] { pop ( ) } ) ;
112+ byte [ ] temp = new byte [ Marshal . ReadInt32 ( MemoryPointer , CodeSectionOffset + Offset + 4 ) ] ;
113+ Marshal . Copy (
114+ IntPtr . Add ( MemoryPointer ,
115+ CSharpTypesSectionOffset + Marshal . ReadInt32 ( MemoryPointer , Offset ) ) , temp , 0 ,
116+ temp . Length ) ;
117+ string type = Encoding . UTF8 . GetString ( temp ) ;
118+ temp = new byte [ Marshal . ReadInt32 ( MemoryPointer , CodeSectionOffset + Offset + 12 ) ] ;
119+ Marshal . Copy (
120+ IntPtr . Add ( MemoryPointer ,
121+ TextSectionOffset + Marshal . ReadInt32 ( MemoryPointer , CodeSectionOffset + Offset + 8 ) ) ,
122+ temp , 0 , temp . Length ) ;
123+ string voidname = Encoding . UTF8 . GetString ( temp ) ;
124+ int argcount = Marshal . ReadInt32 ( MemoryPointer , CodeSectionOffset + Offset + 16 ) ;
125+ Type [ ] types = new Type [ argcount ] ;
126+ object [ ] arguments = new object [ argcount ] ;
127+ for ( int i = 0 ; i < argcount ; i ++ )
128+ {
129+ Console . WriteLine ( CodeSectionOffset + Offset + 20 + i * 4 ) ;
130+ temp = new byte [ Marshal . ReadInt32 ( MemoryPointer , CodeSectionOffset + Offset + 20 + i * 4 ) ] ;
131+ Marshal . Copy (
132+ IntPtr . Add ( MemoryPointer ,
133+ CSharpTypesSectionOffset + Marshal . ReadInt32 ( MemoryPointer ,
134+ CodeSectionOffset + Offset + 24 + i * 4 ) ) , temp , 0 , temp . Length ) ;
135+ types [ i ] = Type . GetType ( Encoding . UTF8 . GetString ( temp ) ) ;
136+ arguments [ i ] = pop ( ) ;
137+ }
138+
139+ var method = Type . GetType ( type ) . GetMethod ( voidname , types ) ;
140+
141+ var rez = method . Invoke ( null , arguments ) ;
114142 if ( rez != typeof ( void ) )
115143 {
116144 push ( rez ) ;
117145 }
146+
118147 break ;
119148 }
120- case 0x91 :
149+ case 0x91 : //Pop
121150 {
122151 pop ( ) ;
123152 break ;
124153 }
125- case 0x93 :
126- {
154+ case 0x93 : //Push Top stack object to Global Variables
155+ {
127156 int index = Marshal . ReadInt32 ( MemoryPointer , CodeSectionOffset + Offset ) ;
128157 Offset += 4 ;
129158 GlobalVariables [ index ] = pop ( ) ;
130159 break ;
131160 }
132- case 0x94 :
133- {
161+ case 0x94 : // Load Global Variable to Stack
162+ {
134163 int index = Marshal . ReadInt32 ( MemoryPointer , CodeSectionOffset + Offset ) ;
135164 Offset += 4 ;
136165 push ( GlobalVariables [ index ] ) ;
137166 break ;
138167 }
168+ case 0x95 : //Push Top stack object to Local Variables
169+ {
170+ int index = Marshal . ReadInt32 ( MemoryPointer , CodeSectionOffset + Offset ) ;
171+ Offset += 4 ;
172+ LocalVariables [ index ] = pop ( ) ;
173+ break ;
174+ }
175+ case 0x96 : // Load Local Variable to Stack
176+ {
177+ int index = Marshal . ReadInt32 ( MemoryPointer , CodeSectionOffset + Offset ) ;
178+ Offset += 4 ;
179+ push ( LocalVariables [ index ] ) ;
180+ break ;
181+ }
139182 case 0x22 :
140183 {
141184 return ;
0 commit comments