pykd
1#
2#
3#
4
5import sys
6from pykd import *
7
8def cr0( value = 0 ):
9
10if value == 0:
11value = reg( "cr0" )
12
13dprintln( "CR0: %x (" % value + "".join( [ ( value & ( 1 << ( 31 - i ) ) ) and "1" or "0" for i in range(0,32) ] ) + ")" )
14
15for i in range (0, 32):
16bits = { 0 : "PE", 1 : "MP", 2 : "EM", 3 : "TS", 4 : "ET", 5 : "NE", 16 : "WP", 18 : "AM", 29 : "NW", 30 : "CD", 31 : "PG" }
17if ( ( 1 << ( 31 -i ) ) & value ) and 31-i in bits:
18dprint( " " + bits[31-i] )
19
20dprintln("")
21
22
23if __name__ == "__main__":
24
25if not isWindbgExt():
26print "script is launch out of windbg"
27quit( 0 )
28
29if ( len( sys.argv ) > 1 ):
30cr0( int( sys.argv[1], 16 ) )
31else:
32cr0()
33