@@ -23,6 +23,36 @@ public MainWindow()
2323 {
2424 InitializeComponent ( ) ;
2525 instance = this ;
26+
27+ AssemblyHandler handler = new AssemblyHandler ( ) ;
28+ InitProcess ( ) ;
29+
30+ handler . SetRegisters ( "xor eax,eax" , pi ) ;
31+ handler . SetRegisters ( "xor ebx,ebx" , pi ) ;
32+ handler . SetRegisters ( "xor ecx,ecx" , pi ) ;
33+ }
34+
35+ private void InitProcess ( )
36+ {
37+ API . STARTUPINFO si = new API . STARTUPINFO ( ) ;
38+ pi = new API . PROCESS_INFORMATION ( ) ;
39+
40+ bool createproc = API . CreateProcess (
41+ AppDomain . CurrentDomain . FriendlyName ,
42+ null ,
43+ IntPtr . Zero ,
44+ IntPtr . Zero ,
45+ false ,
46+ 0x00000002 ,
47+ IntPtr . Zero ,
48+ null ,
49+ ref si , out pi ) ;
50+
51+ if ( ! createproc )
52+ {
53+ MessageBox . Show ( "ERROR! CreateProcess Failed" ) ;
54+ this . Close ( ) ;
55+ }
2656 }
2757
2858 #region Buttons
@@ -50,16 +80,21 @@ private void addBtn_Click(object sender, RoutedEventArgs e)
5080 if ( string . IsNullOrEmpty ( instruction ) )
5181 return ;
5282
53- Console . WriteLine ( instruction ) ;
54-
5583 Instructions instructions = new Instructions ( ) ;
5684 AssemblyHandler handler = new AssemblyHandler ( ) ;
5785
5886 instructions . instruction = instruction ;
59-
6087 instructionGrid . Items . Add ( instructions ) ;
6188
62- Console . WriteLine ( handler . Assembler ( instruction ) ) ;
89+ handler . SetRegisters ( instruction , pi ) ;
90+
91+ instructionTxt . SelectAll ( ) ;
92+ }
93+
94+ private void instructionTxt_KeyDown ( object sender , KeyEventArgs e )
95+ {
96+ if ( e . Key == Key . Enter )
97+ addBtn_Click ( sender , e ) ;
6398 }
6499 }
65100
0 commit comments