@@ -9,12 +9,12 @@ impl Emu {
99 self . threads [ self . current_thread_id ] . veh = value;
1010 }
1111
12- pub fn ueh ( & self ) -> u64 {
13- self . threads [ self . current_thread_id ] . ueh
12+ pub fn uef ( & self ) -> u64 {
13+ self . threads [ self . current_thread_id ] . uef
1414 }
1515
16- pub fn set_ueh ( & mut self , value : u64 ) {
17- self . threads [ self . current_thread_id ] . ueh = value;
16+ pub fn set_uef ( & mut self , value : u64 ) {
17+ self . threads [ self . current_thread_id ] . uef = value;
1818 }
1919
2020 pub fn eh_ctx ( & self ) -> u32 {
@@ -52,7 +52,7 @@ impl Emu {
5252 } ;
5353
5454 // No handled exceptions
55- if self . seh ( ) == 0 && self . veh ( ) == 0 && self . ueh ( ) == 0 {
55+ if self . seh ( ) == 0 && self . veh ( ) == 0 && self . uef ( ) == 0 {
5656 log:: info!(
5757 "exception without any SEH handler nor vector configured. pos = {} rip = {:x}" ,
5858 self . pos,
@@ -67,6 +67,8 @@ impl Emu {
6767 }
6868
6969 if self . veh ( ) > 0 {
70+ // VEH
71+
7072 addr = self . veh ( ) ;
7173
7274 exception:: enter ( self , ex_type) ;
@@ -77,36 +79,33 @@ impl Emu {
7779 self . set_eip ( addr, false ) ;
7880 }
7981
82+ } else if self . seh ( ) > 0 {
83+ // SEH
8084
81- } else if self . seh ( ) == 0 {
82- } else if self . ueh ( ) > 0 {
83- addr = self . ueh ( ) ;
84-
85- exception:: enter ( self , ex_type) ;
85+
8686 if self . cfg . is_64bits {
87- self . set_rip ( addr, false ) ;
87+ // 64bits seh
88+
89+ unimplemented ! ( "check .pdata if exists" ) ;
90+
8891 } else {
89- self . set_eip ( addr, false ) ;
92+ // 32bits seh
93+ next = match self . maps . read_dword ( self . seh ( ) ) {
94+ Some ( value) => value. into ( ) ,
95+ None => {
96+ log:: info!( "exception wihout correct SEH" ) ;
97+ return ;
98+ }
99+ } ;
100+
101+ addr = match self . maps . read_dword ( self . seh ( ) + 4 ) {
102+ Some ( value) => value. into ( ) ,
103+ None => {
104+ log:: info!( "exception without correct SEH." ) ;
105+ return ;
106+ }
107+ } ;
90108 }
91- } else {
92-
93- // SEH
94-
95- next = match self . maps . read_dword ( self . seh ( ) ) {
96- Some ( value) => value. into ( ) ,
97- None => {
98- log:: info!( "exception wihout correct SEH" ) ;
99- return ;
100- }
101- } ;
102-
103- addr = match self . maps . read_dword ( self . seh ( ) + 4 ) {
104- Some ( value) => value. into ( ) ,
105- None => {
106- log:: info!( "exception without correct SEH." ) ;
107- return ;
108- }
109- } ;
110109
111110 let con = Console :: new ( ) ;
112111 if self . running_script {
@@ -131,6 +130,22 @@ impl Emu {
131130 self . set_eip ( addr, false ) ;
132131 }
133132 }
133+
134+
135+ } else if self . uef ( ) > 0 {
136+ // UEF
137+
138+ addr = self . uef ( ) ;
139+
140+ exception:: enter ( self , ex_type) ;
141+ if self . cfg . is_64bits {
142+ self . set_rip ( addr, false ) ;
143+ } else {
144+ self . set_eip ( addr, false ) ;
145+ }
146+
147+ } else {
148+ unreachable ! ( ) ;
134149 }
135150 }
136151
0 commit comments