Dan Kegel wrote:
+/* Returns size of initialized part of a particular EXCEPTION_RECORD */ +static int exception_record_size( const EXCEPTION_RECORD *rec ) +{
- return sizeof(*rec)
- (EXCEPTION_MAXIMUM_PARAMETERS-rec->NumberParameters) * sizeof(ULONG_PTR);
+}
FIELD_OFFSET exists for this exact purpose.
On Nov 16, 2007 3:06 AM, Robert Shearman rob@codeweavers.com wrote:
- return sizeof(*rec)
- (EXCEPTION_MAXIMUM_PARAMETERS-rec->NumberParameters) * sizeof(ULONG_PTR);
FIELD_OFFSET exists for this exact purpose.
OK, I'll bite: is + return FIELD_OFFSET(EXCEPTION_RECORD, ExceptionInformation) + + rec->NumberParameters * sizeof(ULONG_PTR); really clearer? - Dan
Dan Kegel wrote:
On Nov 16, 2007 3:06 AM, Robert Shearman rob@codeweavers.com wrote:
- return sizeof(*rec)
- (EXCEPTION_MAXIMUM_PARAMETERS-rec->NumberParameters) * sizeof(ULONG_PTR);
FIELD_OFFSET exists for this exact purpose.
OK, I'll bite: is
- return FIELD_OFFSET(EXCEPTION_RECORD, ExceptionInformation)
- rec->NumberParameters * sizeof(ULONG_PTR);
really clearer?
No, but this is: return FIELD_OFFSET(EXCEPTION_RECORD, ExceptionInformation[rec->NumberParameters]);