2

Basically I us IDA Pro 6.1 on Windows 32 bit, dealing with binaries from SPEC 2006.

I use IDA Pro to generate asm code from the binaries, and in the .data section, I see data define like this:

GS_ExceptionRecord _EXCEPTION_RECORD  <?>
GS_ContextRecord _CONTEXT  <?>
lclcritsects    _RTL_CRITICAL_SECTION 0Eh dup(<?>)
 .....
DoubleFormat    FpFormatDescriptor <400h, 0FFFFFC01h, 35h, 0Bh, 40h, 3FFh>
FloatFormat     FpFormatDescriptor <80h, 0FFFFFF81h, 18h, 8, 20h, 7Fh>  

Basically I can not find the definition of _EXCEPTION_RECORD ,_CONTEXT ,_RTL_CRITICAL_SECTION, FpFormatDescriptor in the generated asm code.

And in the code, they will be used like:

mov     edi, DoubleFormat.precision
mov     eax, DoubleFormat.min_exp
sub     ecx, DoubleFormat.precision

mov     edi, FloatFormat.precision

mov     edi, offset lclcritsects

mov     GS_ContextRecord._Eax, eax
mov     word ptr GS_ContextRecord.SegSs, ss
pop     GS_ContextRecord.EFlags

So basically my questions are:

  1. How can I find the definition of these stuff?

  2. Basically I use File-->Produce File-->Create ASM File to generate asm code for analysis, then how can I dump these definitions from IDA Pro's Structures window into this asm code?

And what's more, it seems that I can not find the definition in Structures window even if I expand them....

enter image description here

4

As far as I know IDA doesn't dump structure layouts as part of generated assembly listings. It does however know about all the structures that you mention. Go to the structures window, press "Insert" and name the new structure CONTEXT, EXCEPTION_RECORD or RTL_CRITICAL_SECTION and IDA will show the layout in the structures window.

You can then open the "Local Types" windows and dump all of the structure layouts as a C header file (right click "Export to header file". It still doesn't get you the assembly syntax you want, but it is about as close as I know how to make IDA get to what you want.

  • Hi, Chris, Thank you a lot for your answer and I find the definition of CONTEXT EXCEPTION_RECORD and ** RTL_CRITICAL_SECTION**, but I still can not find FpFormatDescriptor.. Do you know where it is..? – lllllllllllll Feb 19 '14 at 15:35
  • I'm not sure where IDA is picking up the definition of FpFormatDescriptor. It does not seem to be listed in any of the til files that ship with my IDA install. – Chris Eagle Feb 21 '14 at 8:49
1

_EXCEPTION_RECORD, _CONTEXT, and _RTL_CRITICAL_SECTION are all well-defined structures. Their documentation can be found on MSDN (http://msdn.microsoft.com/en-us/library/windows/desktop/aa363082(v=vs.85).aspx, etc.) and their layouts can also be found in IDA's Structures window.

Your other questions aren't clear. Please rephrase them.

  • Hi Jason, thank you and I modified my questions, could you please give me a hand...? – lllllllllllll Feb 18 '14 at 21:48
0

seems to be a struct from some internal microsoft floating point conversion code possibly from windbg source tree

seems to be defined like

typedef struct { 
int max_exp; // maximum base 2 exponent (reserved for special values) 
int min_exp; // minimum base 2 exponent (reserved for denormals) 
int precision; // bits of precision carried in the mantissa 
int exp_width; // number of bits for exponent
int format_width; // format width in bits 
int bias;  // exponent bias 
} FpFormatDescriptor; 

Double

static FpFormatDescriptor 
DoubleFormat = { 
0x7ff - 0x3ff, //  1024, maximum base 2 exponent (reserved for special values)
0x0 - 0x3ff, // -1023, minimum base 2 exponent (reserved for denormals) 
53, // bits of precision carried in the mantissa 
11, // number of bits for exponent 
64, // format width in bits 
0x3ff,  // exponent bias 
}; 

Float

static FpFormatDescriptor 
FloatFormat = { 
0xff - 0x7f, //  128, maximum base 2 exponent(reserved for special values) 
0x0 - 0x7f, // -127, minimum base 2 exponent (reserved for denormals) 
24, // bits of precision carried in the mantissa 
8,   // number of bits for exponent 
32, // format width in bits 
0x7f,  // exponent bias 
}; 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.