2015-04-20 14:26:30 +02:00
% i g n o r e n m S e r E A ;
% i g n o r e n m S e r N ;
% i g n o r e m a x S e r i a l N a m e ;
% i g n o r e g e t _ i m p o r t _ m o d u l e _ n a m e ;
% r e n a m e ( g e t _ i m p o r t _ m o d u l e _ n a m e ) p y _ g e t _ i m p o r t _ m o d u l e _ n a m e ;
% i g n o r e N A L T _ E A ;
% i g n o r e e n u m _ i m p o r t _ n a m e s ;
% r e n a m e ( e n u m _ i m p o r t _ n a m e s ) p y _ e n u m _ i m p o r t _ n a m e s ;
% i g n o r e g e t _ w i d e _ v a l u e ;
% i g n o r e s e t _ w i d e _ v a l u e ;
% i g n o r e d e l _ w i d e _ v a l u e ;
% i g n o r e g e t _ s t r i d ;
% i g n o r e _ s e t _ s t r i d ;
% i g n o r e _ d e l _ s t r i d ;
% i g n o r e s e t _ s t r i d ;
% i g n o r e d e l _ s t r i d ;
% i g n o r e x r e f p o s _ t ;
% i g n o r e g e t _ x r e f p o s ;
% i g n o r e s e t _ x r e f p o s ;
% i g n o r e d e l _ x r e f p o s ;
% i g n o r e s e t _ a f l a g s 0 ;
% i g n o r e g e t _ a f l a g s 0 ;
% i g n o r e d e l _ a f l a g s 0 ;
% i g n o r e g e t _ l i n n u m 0 ;
% i g n o r e s e t _ l i n n u m 0 ;
% i g n o r e d e l _ l i n n u m 0 ;
% i g n o r e g e t _ e n u m _ i d 0 ;
% i g n o r e s e t _ e n u m _ i d 0 ;
% i g n o r e d e l _ e n u m _ i d 0 ;
% i g n o r e g e t _ e n u m _ i d 1 ;
% i g n o r e s e t _ e n u m _ i d 1 ;
% i g n o r e d e l _ e n u m _ i d 1 ;
% i g n o r e s e t _ i n d _ p u r g e d ;
% i g n o r e g e t _ s t r _ t y p e ;
% i g n o r e s e t _ s t r _ t y p e ;
% i g n o r e d e l _ s t r _ t y p e ;
% i g n o r e _ g e t _ i t e m _ c o l o r ;
% i g n o r e _ s e t _ i t e m _ c o l o r ;
% i g n o r e _ d e l _ i t e m _ c o l o r ;
% i g n o r e g e t _ n a l t _ c m t ;
% i g n o r e s e t _ n a l t _ c m t ;
% i g n o r e d e l _ n a l t _ c m t ;
% i g n o r e g e t _ n a l t _ r p t c m t ;
% i g n o r e s e t _ n a l t _ r p t c m t ;
% i g n o r e d e l _ n a l t _ r p t c m t ;
% i g n o r e g e t _ f o p 1 ;
% i g n o r e s e t _ f o p 1 ;
% i g n o r e d e l _ f o p 1 ;
% i g n o r e g e t _ f o p 2 ;
% i g n o r e s e t _ f o p 2 ;
% i g n o r e d e l _ f o p 2 ;
% i g n o r e g e t _ f o p 3 ;
% i g n o r e s e t _ f o p 3 ;
% i g n o r e d e l _ f o p 3 ;
% i g n o r e g e t _ f o p 4 ;
% i g n o r e s e t _ f o p 4 ;
% i g n o r e d e l _ f o p 4 ;
% i g n o r e g e t _ f o p 5 ;
% i g n o r e s e t _ f o p 5 ;
% i g n o r e d e l _ f o p 5 ;
% i g n o r e g e t _ f o p 6 ;
% i g n o r e s e t _ f o p 6 ;
% i g n o r e d e l _ f o p 6 ;
% i g n o r e g e t _ m a n u a l _ i n s n 0 ;
% i g n o r e s e t _ m a n u a l _ i n s n 0 ;
% i g n o r e d e l _ m a n u a l _ i n s n 0 ;
% i g n o r e g e t _ g r a p h _ g r o u p s 0 ;
% i g n o r e s e t _ g r a p h _ g r o u p s 0 ;
% i g n o r e d e l _ g r a p h _ g r o u p s 0 ;
% i g n o r e s w i t c h _ i n f o _ t ;
% i g n o r e s w i t c h _ i n f o _ e x _ t ;
% i g n o r e g e t _ s w i t c h _ i n f o _ e x ;
% i g n o r e s e t _ s w i t c h _ i n f o _ e x ;
% i g n o r e d e l _ s w i t c h _ i n f o _ e x ;
% i g n o r e r e f i n f o _ t : : _ g e t _ t a r g e t ;
% i g n o r e r e f i n f o _ t : : _ g e t _ v a l u e ;
% i g n o r e r e f i n f o _ t : : _ g e t _ o p v a l ;
% i g n o r e c u s t o m _ r e f i n f o _ h a n d l e r _ t ;
% i g n o r e c u s t o m _ r e f i n f o _ h a n d l e r s _ t ;
% i g n o r e r e g i s t e r _ c u s t o m _ r e f i n f o ;
% i g n o r e u n r e g i s t e r _ c u s t o m _ r e f i n f o ;
% i g n o r e g e t _ c u s t o m _ r e f i n f o s ;
% i g n o r e w r i t e _ s t r u c _ p a t h ;
% i g n o r e r e a d _ s t r u c _ p a t h ;
% i g n o r e d e l _ s t r u c _ p a t h ;
% i g n o r e g e t _ s t r o f f 0 ;
% i g n o r e s e t _ s t r o f f 0 ;
% i g n o r e d e l _ s t r o f f 0 ;
% i g n o r e g e t _ s t r o f f 1 ;
% i g n o r e s e t _ s t r o f f 1 ;
% i g n o r e d e l _ s t r o f f 1 ;
% i g n o r e g e t _ _ s e g t r a n s ;
% i g n o r e s e t _ _ s e g t r a n s ;
% i g n o r e d e l _ _ s e g t r a n s ;
% i g n o r e g e t _ s w i t c h _ i n f o ;
% i g n o r e s e t _ s w i t c h _ i n f o ;
% i g n o r e d e l _ s w i t c h _ i n f o ;
% i g n o r e g e t _ t i ;
% i g n o r e s e t _ t i ;
% i g n o r e d e l _ t i ;
% i g n o r e g e t _ o p _ t i n f o ;
% i g n o r e s e t _ o p _ t i n f o ;
% i g n o r e d e l _ t i n f o ;
% i g n o r e g e t _ o p _ t i ;
% i g n o r e s e t _ o p _ t i ;
% i g n o r e d e l _ t i ;
% t e m p l a t e ( i d s _ a r r a y ) w r a p p e d _ a r r a y _ t < t i d _ t , 32 > ;
% e x t e n d s t r p a t h _ t {
w r a p p e d _ a r r a y _ t < t i d _ t , 32 > _ _ g e t I d s ( ) {
return w r a p p e d _ a r r a y _ t < t i d _ t , 32 > ( $ s e l f - > i d s ) ;
}
% p y t h o n c o d e {
i d s = property ( _ _ g e t I d s )
}
}
% i n c l u d e "nalt.hpp"
% {
//<code(py_nalt)>
//-------------------------------------------------------------------------
// callback for enumerating imports
// ea: import address
// name: import name (NULL if imported by ordinal)
// ord: import ordinal (0 for imports by name)
// param: user parameter passed to enum_import_names()
// return: 1-ok, 0-stop enumeration
static int i d a a p i p y _ i m p o r t _ e n u m _ c b (
e a _ t e a ,
c o n s t char * name ,
u v a l _ t o r d ,
void * param )
{
// If no name, try to get the name associated with the 'ea'. It may be coming from IDS
char n a m e _ b u f [ M A X S T R ] ;
if ( name = = NULL )
name = g e t _ t r u e _ n a m e ( B A D A D D R , e a , n a m e _ b u f , s i z e o f ( n a m e _ b u f ) ) ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
r e f _ t p y _ n a m e ;
if ( name = = NULL )
p y _ n a m e = b o r r e f _ t ( P y _ N o n e ) ;
else
p y _ n a m e = n e w r e f _ t ( P y S t r i n g _ F r o m S t r i n g ( name ) ) ;
n e w r e f _ t p y _ o r d ( P y _ B u i l d V a l u e ( P Y _ F M T 64 , p y u l _ t ( o r d ) ) ) ;
n e w r e f _ t p y _ e a ( P y _ B u i l d V a l u e ( P Y _ F M T 64 , p y u l _ t ( e a ) ) ) ;
n e w r e f _ t p y _ r e s u l t (
P y O b j e c t _ C a l l F u n c t i o n O b j A r g s (
( P y O b j e c t * ) param ,
p y _ e a . o ,
p y _ n a m e . o ,
p y _ o r d . o ,
NULL ) ) ;
return p y _ r e s u l t ! = NULL && PyObject_IsTrue(py_result.o) ? 1 : 0;
}
//-------------------------------------------------------------------------
s w i t c h _ i n f o _ e x _ t * s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( P y O b j e c t * self )
{
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
if ( ! P y O b j e c t _ H a s A t t r S t r i n g ( self , S _ C L I N K _ N A M E ) )
return NULL ;
s w i t c h _ i n f o _ e x _ t * r ;
n e w r e f _ t attr ( P y O b j e c t _ G e t A t t r S t r i n g ( self , S _ C L I N K _ N A M E ) ) ;
return P y C O b j e c t _ C h e c k ( attr . o ) ? ( ( s w i t c h _ i n f o _ e x _ t * ) P y C O b j e c t _ A s V o i d P t r ( attr . o ) ) : NULL ;
}
//</code(py_nalt)>
% }
% r e n a m e ( g e t _ s w i t c h _ i n f o _ e x ) p y _ g e t _ s w i t c h _ i n f o _ e x ;
% r e n a m e ( s e t _ s w i t c h _ i n f o _ e x ) p y _ s e t _ s w i t c h _ i n f o _ e x ;
% r e n a m e ( d e l _ s w i t c h _ i n f o _ e x ) p y _ d e l _ s w i t c h _ i n f o _ e x ;
% r e n a m e ( c r e a t e _ s w i t c h _ x r e f s ) p y _ c r e a t e _ s w i t c h _ x r e f s ;
% r e n a m e ( c r e a t e _ s w i t c h _ t a b l e ) p y _ c r e a t e _ s w i t c h _ t a b l e ;
% r e n a m e ( c a l c _ s w i t c h _ c a s e s ) p y _ c a l c _ s w i t c h _ c a s e s ;
% i n l i n e % {
//<inline(py_nalt)>
//-------------------------------------------------------------------------
/*
# < p y d o c >
def g e t _ i m p o r t _ m o d u l e _ n a m e ( p a t h , f n a m e , c a l l b a c k ) :
"" "
Returns t h e name of a n i m p o r t e d m o d u l e g i v e n i t s index
@ return : None or t h e m o d u l e name
"" "
p a s s
# < / p y d o c >
* /
static P y O b j e c t * p y _ g e t _ i m p o r t _ m o d u l e _ n a m e ( int m o d _ i n d e x )
{
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
char b u f [ M A X S T R ] ;
if ( ! g e t _ i m p o r t _ m o d u l e _ n a m e ( m o d _ i n d e x , b u f , s i z e o f ( b u f ) ) )
P y _ R E T U R N _ N O N E ;
return P y S t r i n g _ F r o m S t r i n g ( b u f ) ;
}
//-------------------------------------------------------------------------
/*
# < p y d o c >
def g e t _ s w i t c h _ i n f o _ e x ( e a ) :
"" "
Returns t h e a s w i t c h _ i n f o _ e x _ t s t r u c t u r e c o n t a i n i n g t h e information a b o u t t h e s w i t c h .
P l e a s e r e f e r to t h e S D K s a m p l e 'uiswitch'
@ return : None or s w i t c h _ i n f o _ e x _ t i n s t a n c e
"" "
p a s s
# < / p y d o c >
* /
P y O b j e c t * p y _ g e t _ s w i t c h _ i n f o _ e x ( e a _ t e a )
{
s w i t c h _ i n f o _ e x _ t * e x = new s w i t c h _ i n f o _ e x _ t ( ) ;
r e f _ t p y _ o b j ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
if ( : : g e t _ s w i t c h _ i n f o _ e x ( e a , e x , s i z e o f ( s w i t c h _ i n f o _ e x _ t ) ) < = 0
| | ( p y _ o b j = c r e a t e _ i d a a p i _ l i n k e d _ c l a s s _ i n s t a n c e ( S _ P Y _ S W I E X _ C L S N A M E , e x ) ) = = NULL )
{
delete e x ;
P y _ R E T U R N _ N O N E ;
}
p y _ o b j . i n c r e f ( ) ;
return p y _ o b j . o ;
}
//-------------------------------------------------------------------------
/*
# < p y d o c >
def c r e a t e _ s w i t c h _ x r e f s ( i n s n _ e a , s i ) :
"" "
T h i s function c r e a t e s x r e f s from t h e i n d i r e c t j u m p .
U s u a l l y t h e r e is no n e e d to call t h i s function d i r e c t l y b e c a u s e t h e k e r n e l
w i l l call i t for s w i t c h t a b l e s
N o t e : C u s t o m s w i t c h information a r e not s u p p o r t e d y e t .
@ param i n s n _ e a : a d d r e s s of t h e 'indirect jump' i n s t r u c t i o n
@ param s i : s w i t c h information
@ return : B o o l e a n
"" "
p a s s
# < / p y d o c >
* /
i d a m a n b o o l i d a _ e x p o r t p y _ c r e a t e _ s w i t c h _ x r e f s (
e a _ t i n s n _ e a ,
P y O b j e c t * p y _ s w i )
{
s w i t c h _ i n f o _ e x _ t * s w i = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( p y _ s w i ) ;
if ( s w i = = NULL )
return false ;
c r e a t e _ s w i t c h _ x r e f s ( i n s n _ e a , s w i ) ;
return true ;
}
//-------------------------------------------------------------------------
s t r u c t c a s e s _ a n d _ t a r g e t s _ t
{
c a s e v e c _ t c a s e s ;
e a v e c _ t t a r g e t s ;
} ;
//-------------------------------------------------------------------------
/*
# < p y d o c >
def c a l c _ s w i t c h _ c a s e s ( i n s n _ e a , s i ) :
"" "
Get information a b o u t a s w i t c h ' s c a s e s .
T h e r e t u r n e d information c a n b e u s e d as f o l l o w s :
for i d x in x r a n g e ( l e n ( r e s u l t s . c a s e s ) ) :
c u r _ c a s e = r e s u l t s . c a s e s [ i d x ]
for c i d x in x r a n g e ( l e n ( c u r _ c a s e ) ) :
p r i n t "case: %d" % c u r _ c a s e [ c i d x ]
p r i n t " goto 0x%x" % r e s u l t s . t a r g e t s [ i d x ]
@ param i n s n _ e a : a d d r e s s of t h e 'indirect jump' i n s t r u c t i o n
@ param s i : s w i t c h information
@ return : a s t r u c t u r e with 2 m e m b e r s : 'cases', and 'targets' .
"" "
p a s s
# < / p y d o c >
* /
i d a m a n c a s e s _ a n d _ t a r g e t s _ t * i d a _ e x p o r t p y _ c a l c _ s w i t c h _ c a s e s (
e a _ t i n s n _ e a ,
P y O b j e c t * p y _ s w i )
{
s w i t c h _ i n f o _ e x _ t * s w i = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( p y _ s w i ) ;
if ( s w i = = NULL )
return NULL ;
c a s e s _ a n d _ t a r g e t s _ t * c t = new c a s e s _ a n d _ t a r g e t s _ t ;
if ( ! c a l c _ s w i t c h _ c a s e s ( i n s n _ e a , s w i , &ct->cases, &ct->targets) )
{
delete c t ;
return NULL ;
}
return c t ;
}
//-------------------------------------------------------------------------
/*
# < p y d o c >
def c r e a t e _ s w i t c h _ t a b l e ( i n s n _ e a , s i ) :
"" "
Create s w i t c h table from t h e s w i t c h information
@ param i n s n _ e a : a d d r e s s of t h e 'indirect jump' i n s t r u c t i o n
@ param s i : s w i t c h information
@ return : B o o l e a n
"" "
p a s s
# < / p y d o c >
* /
i d a m a n b o o l i d a _ e x p o r t p y _ c r e a t e _ s w i t c h _ t a b l e (
e a _ t i n s n _ e a ,
P y O b j e c t * p y _ s w i )
{
s w i t c h _ i n f o _ e x _ t * s w i = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( p y _ s w i ) ;
if ( s w i = = NULL )
return false ;
c r e a t e _ s w i t c h _ t a b l e ( i n s n _ e a , s w i ) ;
return true ;
}
//-------------------------------------------------------------------------
/*
# < p y d o c >
def s e t _ s w i t c h _ i n f o _ e x ( e a , s w i t c h _ i n f o _ e x ) :
"" "
S a v e s t h e s w i t c h information in t h e database
P l e a s e r e f e r to t h e S D K s a m p l e 'uiswitch'
@ return : B o o l e a n
"" "
p a s s
# < / p y d o c >
* /
b o o l p y _ s e t _ s w i t c h _ i n f o _ e x ( e a _ t e a , P y O b j e c t * p y _ s w i )
{
s w i t c h _ i n f o _ e x _ t * s w i = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( p y _ s w i ) ;
if ( s w i = = NULL )
return false ;
s e t _ s w i t c h _ i n f o _ e x ( e a , s w i ) ;
return true ;
}
//-------------------------------------------------------------------------
/*
# < p y d o c >
def d e l _ s w i t c h _ i n f o _ e x ( e a ) :
"" "
D e l e t e s s t o r e d s w i t c h information
"" "
p a s s
# < / p y d o c >
* /
void p y _ d e l _ s w i t c h _ i n f o _ e x ( e a _ t e a )
{
d e l _ s w i t c h _ i n f o _ e x ( e a ) ;
}
//-------------------------------------------------------------------------
/*
# < p y d o c >
def e n u m _ i m p o r t _ n a m e s ( m o d _ i n d e x , c a l l b a c k ) :
"" "
E n u m e r a t e i m p o r t s from a s p e c i f i c m o d u l e .
P l e a s e r e f e r to e x _ i m p o r t s . p y e x a m p l e .
@ param m o d _ i n d e x : T h e m o d u l e index
@ param c a l l b a c k : A c a l l a b l e o b j e c t t h a t w i l l b e i n v o k e d with a n e a , name ( c o u l d b e None ) and ordinal .
@ return : 1 - f i n i s h e d ok , - 1 on error , otherwise c a l l b a c k return value ( < = 0 )
"" "
p a s s
# < / p y d o c >
* /
static int p y _ e n u m _ i m p o r t _ n a m e s ( int m o d _ i n d e x , P y O b j e c t * p y _ c b )
{
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
if ( ! P y C a l l a b l e _ C h e c k ( p y _ c b ) )
return - 1 ;
return e n u m _ i m p o r t _ n a m e s ( m o d _ i n d e x , p y _ i m p o r t _ e n u m _ c b , p y _ c b ) ;
}
//-------------------------------------------------------------------------
static P y O b j e c t * s w i t c h _ i n f o _ e x _ t _ c r e a t e ( )
{
s w i t c h _ i n f o _ e x _ t * i n s t = new s w i t c h _ i n f o _ e x _ t ( ) ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
return P y C O b j e c t _ F r o m V o i d P t r ( i n s t , NULL ) ;
}
//---------------------------------------------------------------------------
static b o o l s w i t c h _ i n f o _ e x _ t _ d e s t r o y ( P y O b j e c t * p y _ o b j )
{
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
if ( ! P y C O b j e c t _ C h e c k ( p y _ o b j ) )
return false ;
s w i t c h _ i n f o _ e x _ t * i n s t = ( s w i t c h _ i n f o _ e x _ t * ) P y C O b j e c t _ A s V o i d P t r ( p y _ o b j ) ;
delete i n s t ;
return true ;
}
static b o o l s w i t c h _ i n f o _ e x _ t _ a s s i g n ( P y O b j e c t * self , P y O b j e c t * o t h e r )
{
s w i t c h _ i n f o _ e x _ t * l h s = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
s w i t c h _ i n f o _ e x _ t * r h s = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( o t h e r ) ;
if ( l h s = = NULL | | r h s = = NULL )
return false ;
* l h s = * r h s ;
return true ;
}
//-------------------------------------------------------------------------
// Auto generated - begin
//
static P y O b j e c t * s w i t c h _ i n f o _ e x _ t _ g e t _ r e g d t y p ( P y O b j e c t * self )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
if ( l i n k = = NULL )
P y _ R E T U R N _ N O N E ;
return P y _ B u i l d V a l u e ( "b" , ( char ) l i n k - > r e g d t y p ) ;
}
static void s w i t c h _ i n f o _ e x _ t _ s e t _ r e g d t y p ( P y O b j e c t * self , P y O b j e c t * value )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
if ( l i n k = = NULL )
return ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
l i n k - > r e g d t y p = ( char ) P y I n t _ A s L o n g ( value ) ;
}
static P y O b j e c t * s w i t c h _ i n f o _ e x _ t _ g e t _ f l a g s 2 ( P y O b j e c t * self )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
if ( l i n k = = NULL )
P y _ R E T U R N _ N O N E ;
return P y _ B u i l d V a l u e ( "i" , l i n k - > f l a g s 2 ) ;
}
static void s w i t c h _ i n f o _ e x _ t _ s e t _ f l a g s 2 ( P y O b j e c t * self , P y O b j e c t * value )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
if ( l i n k = = NULL )
return ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
l i n k - > f l a g s 2 = ( int ) P y I n t _ A s L o n g ( value ) ;
}
static P y O b j e c t * s w i t c h _ i n f o _ e x _ t _ g e t _ j c a s e s ( P y O b j e c t * self )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
if ( l i n k = = NULL )
P y _ R E T U R N _ N O N E ;
return P y _ B u i l d V a l u e ( "i" , l i n k - > j c a s e s ) ;
}
static void s w i t c h _ i n f o _ e x _ t _ s e t _ j c a s e s ( P y O b j e c t * self , P y O b j e c t * value )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
if ( l i n k = = NULL )
return ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
l i n k - > j c a s e s = ( int ) P y I n t _ A s L o n g ( value ) ;
}
static P y O b j e c t * s w i t c h _ i n f o _ e x _ t _ g e t _ r e g n u m ( P y O b j e c t * self )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
if ( l i n k = = NULL )
P y _ R E T U R N _ N O N E ;
return P y _ B u i l d V a l u e ( "i" , ( int ) l i n k - > r e g n u m ) ;
}
static void s w i t c h _ i n f o _ e x _ t _ s e t _ r e g n u m ( P y O b j e c t * self , P y O b j e c t * value )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
if ( l i n k = = NULL )
return ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
l i n k - > r e g n u m = ( int ) P y I n t _ A s L o n g ( value ) ;
}
static P y O b j e c t * s w i t c h _ i n f o _ e x _ t _ g e t _ f l a g s ( P y O b j e c t * self )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
if ( l i n k = = NULL )
P y _ R E T U R N _ N O N E ;
return P y _ B u i l d V a l u e ( "H" , ( u s h o r t ) l i n k - > f l a g s ) ;
}
static void s w i t c h _ i n f o _ e x _ t _ s e t _ f l a g s ( P y O b j e c t * self , P y O b j e c t * value )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
if ( l i n k = = NULL )
return ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
l i n k - > f l a g s = ( u i n t 16 ) P y I n t _ A s L o n g ( value ) ;
}
static P y O b j e c t * s w i t c h _ i n f o _ e x _ t _ g e t _ n c a s e s ( P y O b j e c t * self )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
if ( l i n k = = NULL )
P y _ R E T U R N _ N O N E ;
return P y _ B u i l d V a l u e ( "H" , ( u i n t 16 ) l i n k - > n c a s e s ) ;
}
static void s w i t c h _ i n f o _ e x _ t _ s e t _ n c a s e s ( P y O b j e c t * self , P y O b j e c t * value )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
if ( l i n k = = NULL )
return ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
l i n k - > n c a s e s = ( u s h o r t ) P y I n t _ A s L o n g ( value ) ;
}
static P y O b j e c t * s w i t c h _ i n f o _ e x _ t _ g e t _ d e f j u m p ( P y O b j e c t * self )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
if ( l i n k = = NULL )
P y _ R E T U R N _ N O N E ;
return P y _ B u i l d V a l u e ( P Y _ F M T 64 , ( p y u l _ t ) l i n k - > d e f j u m p ) ;
}
static void s w i t c h _ i n f o _ e x _ t _ s e t _ d e f j u m p ( P y O b j e c t * self , P y O b j e c t * value )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
if ( l i n k = = NULL )
return ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
u i n t 64 v ( 0 ) ; P y W _ G e t N u m b e r ( value , &v);
l i n k - > d e f j u m p = ( p y u l _ t ) v ;
}
static P y O b j e c t * s w i t c h _ i n f o _ e x _ t _ g e t _ j u m p s ( P y O b j e c t * self )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
if ( l i n k = = NULL )
P y _ R E T U R N _ N O N E ;
return P y _ B u i l d V a l u e ( P Y _ F M T 64 , ( p y u l _ t ) l i n k - > j u m p s ) ;
}
static void s w i t c h _ i n f o _ e x _ t _ s e t _ j u m p s ( P y O b j e c t * self , P y O b j e c t * value )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
if ( l i n k = = NULL )
return ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
u i n t 64 v ( 0 ) ; P y W _ G e t N u m b e r ( value , &v);
l i n k - > j u m p s = ( p y u l _ t ) v ;
}
static P y O b j e c t * s w i t c h _ i n f o _ e x _ t _ g e t _ e l b a s e ( P y O b j e c t * self )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
if ( l i n k = = NULL )
P y _ R E T U R N _ N O N E ;
return P y _ B u i l d V a l u e ( P Y _ F M T 64 , ( p y u l _ t ) l i n k - > e l b a s e ) ;
}
static void s w i t c h _ i n f o _ e x _ t _ s e t _ e l b a s e ( P y O b j e c t * self , P y O b j e c t * value )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
if ( l i n k = = NULL )
return ;
u i n t 64 v ( 0 ) ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
P y W _ G e t N u m b e r ( value , &v);
l i n k - > e l b a s e = ( p y u l _ t ) v ;
}
static P y O b j e c t * s w i t c h _ i n f o _ e x _ t _ g e t _ s t a r t e a ( P y O b j e c t * self )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
if ( l i n k = = NULL )
P y _ R E T U R N _ N O N E ;
return P y _ B u i l d V a l u e ( P Y _ F M T 64 , ( p y u l _ t ) l i n k - > s t a r t e a ) ;
}
static void s w i t c h _ i n f o _ e x _ t _ s e t _ s t a r t e a ( P y O b j e c t * self , P y O b j e c t * value )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
if ( l i n k = = NULL )
return ;
u i n t 64 v ( 0 ) ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
P y W _ G e t N u m b e r ( value , &v);
l i n k - > s t a r t e a = ( p y u l _ t ) v ;
}
static P y O b j e c t * s w i t c h _ i n f o _ e x _ t _ g e t _ c u s t o m ( P y O b j e c t * self )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
if ( l i n k = = NULL )
P y _ R E T U R N _ N O N E ;
return P y _ B u i l d V a l u e ( P Y _ F M T 64 , ( p y u l _ t ) l i n k - > c u s t o m ) ;
}
static void s w i t c h _ i n f o _ e x _ t _ s e t _ c u s t o m ( P y O b j e c t * self , P y O b j e c t * value )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
if ( l i n k = = NULL )
return ;
u i n t 64 v ( 0 ) ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
P y W _ G e t N u m b e r ( value , &v);
l i n k - > c u s t o m = ( p y u l _ t ) v ;
}
static P y O b j e c t * s w i t c h _ i n f o _ e x _ t _ g e t _ i n d _ l o w c a s e ( P y O b j e c t * self )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
if ( l i n k = = NULL )
P y _ R E T U R N _ N O N E ;
return P y _ B u i l d V a l u e ( P Y _ F M T 64 , ( p y u l _ t ) l i n k - > i n d _ l o w c a s e ) ;
}
static void s w i t c h _ i n f o _ e x _ t _ s e t _ i n d _ l o w c a s e ( P y O b j e c t * self , P y O b j e c t * value )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
if ( l i n k = = NULL )
return ;
u i n t 64 v ( 0 ) ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
P y W _ G e t N u m b e r ( value , &v);
l i n k - > i n d _ l o w c a s e = ( p y u l _ t ) v ;
}
static P y O b j e c t * s w i t c h _ i n f o _ e x _ t _ g e t _ v a l u e s _ l o w c a s e ( P y O b j e c t * self )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
if ( l i n k = = NULL )
P y _ R E T U R N _ N O N E ;
return P y _ B u i l d V a l u e ( P Y _ F M T 64 , ( p y u l _ t ) l i n k - > values ) ;
}
static void s w i t c h _ i n f o _ e x _ t _ s e t _ v a l u e s _ l o w c a s e ( P y O b j e c t * self , P y O b j e c t * value )
{
s w i t c h _ i n f o _ e x _ t * l i n k = s w i t c h _ i n f o _ e x _ t _ g e t _ c l i n k ( self ) ;
if ( l i n k = = NULL )
return ;
u i n t 64 v ( 0 ) ;
P Y W _ G I L _ C H E C K _ L O C K E D _ S C O P E ( ) ;
P y W _ G e t N u m b e r ( value , &v);
l i n k - > values = ( p y u l _ t ) v ;
}
//
// Auto generated - end
//
//-------------------------------------------------------------------------
//</inline(py_nalt)>
% }
% p y t h o n c o d e % {
# < p y c o d e ( p y _ n a l t ) >
S W I _ S P A R S E = 0x1
"" "sparse switch ( value table present ) otherwise lowcase present" ""
S W I _ V 32 = 0x2
"" "32-bit values in table" ""
S W I _ J 32 = 0x4
"" "32-bit jump offsets" ""
S W I _ V S P L I T = 0x8
"" "value table is split (only for 32-bit values)" ""
S W I _ D E F A U L T = 0x10
"" "default case is present" ""
S W I _ E N D _ I N _ T B L = 0x20
"" "switchend in table (default entry)" ""
S W I _ J M P _ I N V = 0x40
"" "jumptable is inversed (last entry is for first entry in values table)" ""
S W I _ S H I F T _ M A S K = 0x180
"" "use formula (element*shift + elbase) to find jump targets" ""
S W I _ E L B A S E = 0x200
"" "elbase is present (if not and shift!=0, endof(jumpea) is used)" ""
S W I _ J S I Z E = 0x400
"" "jump offset expansion bit" ""
S W I _ V S I Z E = 0x800
"" "value table element size expansion bit" ""
S W I _ S E P A R A T E = 0x1000
"" "do not create an array of individual dwords" ""
S W I _ S I G N E D = 0x2000
"" "jump table entries are signed" ""
S W I _ C U S T O M = 0x4000
"" "custom jump table - ph.create_switch_xrefs will be called to create code xrefs for the table. it must return 2. custom jump table must be created by the module" ""
S W I _ E X T E N D E D = 0x8000
"" "this is switch_info_ex_t" ""
S W I 2 _ I N D I R E C T = 0x0001
"" "value table elements are used as indexes into the jump table" ""
S W I 2 _ S U B T R A C T = 0x0002
"" "table values are subtracted from the elbase instead of being addded" ""
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
class s w i t c h _ i n f o _ e x _ t ( p y _ c l i n k e d _ o b j e c t _ t ) :
def _ _ i n i t _ _ ( self , l n k = None ) :
p y _ c l i n k e d _ o b j e c t _ t . _ _ i n i t _ _ ( self , l n k )
def _ c r e a t e _ c l i n k ( self ) :
return _ i d a a p i . s w i t c h _ i n f o _ e x _ t _ c r e a t e ( )
def _ d e l _ c l i n k ( self , l n k ) :
return _ i d a a p i . s w i t c h _ i n f o _ e x _ t _ d e s t r o y ( l n k )
def assign ( self , o t h e r ) :
return _ i d a a p i . s w i t c h _ i n f o _ e x _ t _ a s s i g n ( self , o t h e r )
def i s _ i n d i r e c t ( self ) :
return ( self . f l a g s & SWI_EXTENDED) != 0 and (self.flags2 & SWI2_INDIRECT) != 0
def i s _ s u b t r a c t ( self ) :
return ( self . f l a g s & SWI_EXTENDED) != 0 and (self.flags2 & SWI2_SUBTRACT) != 0
def g e t _ j t a b l e _ s i z e ( self ) :
return self . j c a s e s if self . i s _ i n d i r e c t ( ) else self . n c a s e s
def g e t _ l o w c a s e ( self ) :
return self . i n d _ l o w c a s e if self . i s _ i n d i r e c t ( ) else self . l o w c a s e
def s e t _ e x p r ( self , r , d t ) :
self . r e g n u m = r
self . r e g d t y p = d t
def g e t _ s h i f t ( self ) :
return ( self . f l a g s & SWI_SHIFT_MASK) >> 7
def s e t _ s h i f t ( self , s h i f t ) :
self . f l a g s &= ~SWI_SHIFT_MASK
self . f l a g s | = ( ( s h i f t & 3) << 7)
def g e t _ j t a b l e _ e l e m e n t _ s i z e ( self ) :
code = self . f l a g s & (SWI_J32|SWI_JSIZE)
if code = = 0 : return 2
e l i f code = = S W I _ J 32 : return 4
e l i f code = = S W I _ J S I Z E : return 1
else : return 8
def s e t _ j t a b l e _ e l e m e n t _ s i z e ( self , size ) :
self . f l a g s &= ~(SWI_J32|SWI_JSIZE)
if size = = 4 : self . f l a g s | = S W I _ J 32
e l i f size = = 1 : self . f l a g s | = S W I _ J S I Z E
e l i f size = = 8 : self . f l a g s | = S W I _ J 32 | S W I _ J S I Z E
e l i f size ! = 2 : return False
return True
def g e t _ v t a b l e _ e l e m e n t _ s i z e ( self ) :
code = self . f l a g s & (SWI_V32|SWI_VSIZE)
if code = = 0 : return 2
e l i f code = = S W I _ V 32 : return 4
e l i f code = = S W I _ V S I Z E : return 1
return 8
def s e t _ v t a b l e _ e l e m e n t _ s i z e ( self , size ) :
self . f l a g s &= ~SWI_V32|SWI_VSIZE
if size = = 4 : self . f l a g s | = S W I _ V 32
e l i f size = = 1 : self . f l a g s | = S W I _ V S I Z E
e l i f size = = 8 : self . f l a g s | = S W I _ V 32 | S W I _ V S I Z E
e l i f size ! = 2 : return False
return True
#
# A u t o g e n e r a t e d
#
def _ _ g e t _ r e g d t y p _ _ ( self ) :
return _ i d a a p i . s w i t c h _ i n f o _ e x _ t _ g e t _ r e g d t y p ( self )
def _ _ s e t _ r e g d t y p _ _ ( self , v ) :
_ i d a a p i . s w i t c h _ i n f o _ e x _ t _ s e t _ r e g d t y p ( self , v )
def _ _ g e t _ f l a g s 2 _ _ ( self ) :
return _ i d a a p i . s w i t c h _ i n f o _ e x _ t _ g e t _ f l a g s 2 ( self )
def _ _ s e t _ f l a g s 2 _ _ ( self , v ) :
_ i d a a p i . s w i t c h _ i n f o _ e x _ t _ s e t _ f l a g s 2 ( self , v )
def _ _ g e t _ j c a s e s _ _ ( self ) :
return _ i d a a p i . s w i t c h _ i n f o _ e x _ t _ g e t _ j c a s e s ( self )
def _ _ s e t _ j c a s e s _ _ ( self , v ) :
_ i d a a p i . s w i t c h _ i n f o _ e x _ t _ s e t _ j c a s e s ( self , v )
def _ _ g e t _ r e g n u m _ _ ( self ) :
return _ i d a a p i . s w i t c h _ i n f o _ e x _ t _ g e t _ r e g n u m ( self )
def _ _ s e t _ r e g n u m _ _ ( self , v ) :
_ i d a a p i . s w i t c h _ i n f o _ e x _ t _ s e t _ r e g n u m ( self , v )
def _ _ g e t _ f l a g s _ _ ( self ) :
return _ i d a a p i . s w i t c h _ i n f o _ e x _ t _ g e t _ f l a g s ( self )
def _ _ s e t _ f l a g s _ _ ( self , v ) :
_ i d a a p i . s w i t c h _ i n f o _ e x _ t _ s e t _ f l a g s ( self , v )
def _ _ g e t _ n c a s e s _ _ ( self ) :
return _ i d a a p i . s w i t c h _ i n f o _ e x _ t _ g e t _ n c a s e s ( self )
def _ _ s e t _ n c a s e s _ _ ( self , v ) :
_ i d a a p i . s w i t c h _ i n f o _ e x _ t _ s e t _ n c a s e s ( self , v )
def _ _ g e t _ d e f j u m p _ _ ( self ) :
return _ i d a a p i . s w i t c h _ i n f o _ e x _ t _ g e t _ d e f j u m p ( self )
def _ _ s e t _ d e f j u m p _ _ ( self , v ) :
_ i d a a p i . s w i t c h _ i n f o _ e x _ t _ s e t _ d e f j u m p ( self , v )
def _ _ g e t _ j u m p s _ _ ( self ) :
return _ i d a a p i . s w i t c h _ i n f o _ e x _ t _ g e t _ j u m p s ( self )
def _ _ s e t _ j u m p s _ _ ( self , v ) :
_ i d a a p i . s w i t c h _ i n f o _ e x _ t _ s e t _ j u m p s ( self , v )
def _ _ g e t _ e l b a s e _ _ ( self ) :
return _ i d a a p i . s w i t c h _ i n f o _ e x _ t _ g e t _ e l b a s e ( self )
def _ _ s e t _ e l b a s e _ _ ( self , v ) :
_ i d a a p i . s w i t c h _ i n f o _ e x _ t _ s e t _ e l b a s e ( self , v )
def _ _ g e t _ s t a r t e a _ _ ( self ) :
return _ i d a a p i . s w i t c h _ i n f o _ e x _ t _ g e t _ s t a r t e a ( self )
def _ _ s e t _ s t a r t e a _ _ ( self , v ) :
_ i d a a p i . s w i t c h _ i n f o _ e x _ t _ s e t _ s t a r t e a ( self , v )
def _ _ g e t _ c u s t o m _ _ ( self ) :
return _ i d a a p i . s w i t c h _ i n f o _ e x _ t _ g e t _ c u s t o m ( self )
def _ _ s e t _ c u s t o m _ _ ( self , v ) :
_ i d a a p i . s w i t c h _ i n f o _ e x _ t _ s e t _ c u s t o m ( self , v )
def _ _ g e t _ i n d _ l o w c a s e _ _ ( self ) :
return _ i d a a p i . s w i t c h _ i n f o _ e x _ t _ g e t _ i n d _ l o w c a s e ( self )
def _ _ s e t _ i n d _ l o w c a s e _ _ ( self , v ) :
_ i d a a p i . s w i t c h _ i n f o _ e x _ t _ s e t _ i n d _ l o w c a s e ( self , v )
def _ _ g e t _ v a l u e s _ l o w c a s e _ _ ( self ) :
return _ i d a a p i . s w i t c h _ i n f o _ e x _ t _ g e t _ v a l u e s _ l o w c a s e ( self )
def _ _ s e t _ v a l u e s _ l o w c a s e _ _ ( self , v ) :
_ i d a a p i . s w i t c h _ i n f o _ e x _ t _ s e t _ v a l u e s _ l o w c a s e ( self , v )
r e g d t y p = property ( _ _ g e t _ r e g d t y p _ _ , _ _ s e t _ r e g d t y p _ _ )
"" "size of the switch expression register as dtyp" ""
f l a g s 2 = property ( _ _ g e t _ f l a g s 2 _ _ , _ _ s e t _ f l a g s 2 _ _ )
j c a s e s = property ( _ _ g e t _ j c a s e s _ _ , _ _ s e t _ j c a s e s _ _ )
"" "number of entries in the jump table (SWI2_INDIRECT)" ""
r e g n u m = property ( _ _ g e t _ r e g n u m _ _ , _ _ s e t _ r e g n u m _ _ )
"" "the switch expression as a register number" ""
f l a g s = property ( _ _ g e t _ f l a g s _ _ , _ _ s e t _ f l a g s _ _ )
"" "the switch expression as a register number" ""
n c a s e s = property ( _ _ g e t _ n c a s e s _ _ , _ _ s e t _ n c a s e s _ _ )
"" "number of cases (excluding default)" ""
d e f j u m p = property ( _ _ g e t _ d e f j u m p _ _ , _ _ s e t _ d e f j u m p _ _ )
"" "default jump address" ""
j u m p s = property ( _ _ g e t _ j u m p s _ _ , _ _ s e t _ j u m p s _ _ )
"" "jump table address" ""
e l b a s e = property ( _ _ g e t _ e l b a s e _ _ , _ _ s e t _ e l b a s e _ _ )
"" "element base" ""
s t a r t e a = property ( _ _ g e t _ s t a r t e a _ _ , _ _ s e t _ s t a r t e a _ _ )
"" "start of switch idiom" ""
c u s t o m = property ( _ _ g e t _ c u s t o m _ _ , _ _ s e t _ c u s t o m _ _ )
"" "information for custom tables (filled and used by modules)" ""
i n d _ l o w c a s e = property ( _ _ g e t _ i n d _ l o w c a s e _ _ , _ _ s e t _ i n d _ l o w c a s e _ _ )
values = property ( _ _ g e t _ v a l u e s _ l o w c a s e _ _ , _ _ s e t _ v a l u e s _ l o w c a s e _ _ )
l o w c a s e = property ( _ _ g e t _ v a l u e s _ l o w c a s e _ _ , _ _ s e t _ v a l u e s _ l o w c a s e _ _ )
# < / p y c o d e ( p y _ n a l t ) >
% }