@@ -167,7 +167,8 @@ def symname(value):
167
167
('Name' , ('scalar' , '<8s' , symname )),
168
168
('Value' , ('scalar' , '<L' , '%d' )),
169
169
('SectionNumber' , ('scalar' , '<H' , '%d' )),
170
- ('SimpleType' , ('enum' , '<B' , '%d' , {
170
+ ('_Type' , ('scalar' , '<H' , None )),
171
+ ('SimpleType' , ('enum' , '& _Type 15' , '%d' , {
171
172
0 : 'IMAGE_SYM_TYPE_NULL' ,
172
173
1 : 'IMAGE_SYM_TYPE_VOID' ,
173
174
2 : 'IMAGE_SYM_TYPE_CHAR' ,
@@ -184,8 +185,8 @@ def symname(value):
184
185
13 : 'IMAGE_SYM_TYPE_WORD' ,
185
186
14 : 'IMAGE_SYM_TYPE_UINT' ,
186
187
15 : 'IMAGE_SYM_TYPE_DWORD' ,
187
- })),
188
- ('ComplexType' , ('enum' , '<B ' , '%d' , {
188
+ })), # (Type & 0xF0) >> 4
189
+ ('ComplexType' , ('enum' , '>> & _Type 240 4 ' , '%d' , {
189
190
0 : 'IMAGE_SYM_DTYPE_NULL' ,
190
191
1 : 'IMAGE_SYM_DTYPE_POINTER' ,
191
192
2 : 'IMAGE_SYM_DTYPE_FUNCTION' ,
@@ -317,7 +318,7 @@ def print_binary_data(size):
317
318
write ("%s|%s|\n " % (bytes , text ))
318
319
return value
319
320
320
- idlit = re .compile ("[a-zA-Z ][a-zA-Z0-9_-]*" )
321
+ idlit = re .compile ("[a-zA-Z_ ][a-zA-Z0-9_-]*" )
321
322
numlit = re .compile ("[0-9]+" )
322
323
323
324
def read_value (expr ):
@@ -335,11 +336,6 @@ def eval():
335
336
if expr == 'false' :
336
337
return False
337
338
338
- if len (token ) > 1 and token [0 ] in ('=' , '@' , '<' , '!' , '>' ):
339
- val = read (expr )
340
- assert (len (val ) == 1 )
341
- return val [0 ]
342
-
343
339
if token == '+' :
344
340
return eval () + eval ()
345
341
if token == '-' :
@@ -348,6 +344,19 @@ def eval():
348
344
return eval () * eval ()
349
345
if token == '/' :
350
346
return eval () / eval ()
347
+ if token == '&' :
348
+ return eval () & eval ()
349
+ if token == '|' :
350
+ return eval () | eval ()
351
+ if token == '>>' :
352
+ return eval () >> eval ()
353
+ if token == '<<' :
354
+ return eval () << eval ()
355
+
356
+ if len (token ) > 1 and token [0 ] in ('=' , '@' , '<' , '!' , '>' ):
357
+ val = read (expr )
358
+ assert (len (val ) == 1 )
359
+ return val [0 ]
351
360
352
361
if idlit .match (token ):
353
362
return Fields [token ]
@@ -373,6 +382,8 @@ def write_value(format,value):
373
382
elif format_type is types .TupleType :
374
383
Fields ['this' ] = value
375
384
handle_element (format )
385
+ elif format_type is types .NoneType :
386
+ pass
376
387
else :
377
388
raise RuntimeError ("unexpected type: %s" % repr (format_type ))
378
389
@@ -448,11 +459,13 @@ def handle_struct(entry):
448
459
name = member [0 ]
449
460
type = member [1 ]
450
461
451
- write ("%s = " % name .ljust (24 ))
462
+ if name [0 ] != "_" :
463
+ write ("%s = " % name .ljust (24 ))
452
464
453
465
value = handle_element (type )
454
466
455
- write ("\n " )
467
+ if name [0 ] != "_" :
468
+ write ("\n " )
456
469
457
470
Fields [name ] = value
458
471
newFields [name ] = value
0 commit comments