Updating MDRawMiscInfo to support verions 3 and 4 of the MINIDUMP_MISC_INFO_N structure. Added the necessary code for swapping and string conversion from UTF-16. Found and fixed a bug in MinidumpAssertion::Read where the max string length passed to UTF16codeunits was in bytes instead of UTF-16 chars.

Tested with a minidump containing a version 3 structure to validate the string conversion routines.  Interestingly enough the time_zone names does not appear to be abbreviation as the documentation was suggesting but full names, e.g. Eastern Standard Time:

MDRawMiscInfo
  size_of_info                 = 232
  flags1                       = 0xf7
  process_id                   = 0x54c4
  process_create_time          = 0x51a9323c
  process_user_time            = 0x1
  process_kernel_time          = 0x0
  processor_max_mhz            = 3100
  processor_current_mhz        = 1891
  processor_mhz_limit          = 3100
  processor_max_idle_state     = 0x1
  processor_current_idle_state = 0x1

The new fileds follow:
  process_integrity_level      = 0x1000
  process_execute_flags        = 0x4d
  protected_process            = 0
  time_zone_id                 = 2
  time_zone.bias               = 300
  time_zone.standard_name      = Eastern Standard Time
  time_zone.daylight_name      = Eastern Daylight Time
Review URL: https://breakpad.appspot.com/617002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1204 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
ivan.penkov@gmail.com 2013-08-02 18:15:57 +00:00
parent 9c1dc68a2f
commit 1d1b36d371
3 changed files with 246 additions and 62 deletions

View file

@ -347,7 +347,7 @@ typedef enum {
typedef struct {
uint32_t length; /* Length of buffer in bytes (not characters),
* excluding 0-terminator */
* excluding 0-terminator */
uint16_t buffer[1]; /* UTF-16-encoded, 0-terminated */
} MDString; /* MINIDUMP_STRING */
@ -658,6 +658,55 @@ typedef enum {
MD_OS_NACL = 0x8205 /* Native Client (NaCl) */
} MDOSPlatform;
typedef struct {
uint16_t year;
uint16_t month;
uint16_t day_of_week;
uint16_t day;
uint16_t hour;
uint16_t minute;
uint16_t second;
uint16_t milliseconds;
} MDSystemTime; /* SYSTEMTIME */
typedef struct {
/* Required field. The bias is the difference, in minutes, between
* Coordinated Universal Time (UTC) and local time.
* Formula: UTC = local time + bias */
int32_t bias;
/* A description for standard time. For example, "EST" could indicate Eastern
* Standard Time. In practice this contains the full time zone names. This
* string can be empty. */
uint16_t standard_name[32]; /* UTF-16-encoded, 0-terminated */
/* A MDSystemTime structure that contains a date and local time when the
* transition from daylight saving time to standard time occurs on this
* operating system. If the time zone does not support daylight saving time,
* the month member in the MDSystemTime structure is zero. */
MDSystemTime standard_date;
/* The bias value to be used during local time translations that occur during
* standard time. */
int32_t standard_bias;
/* A description for daylight saving time. For example, "PDT" could indicate
* Pacific Daylight Time. In practice this contains the full time zone names.
* This string can be empty. */
uint16_t daylight_name[32]; /* UTF-16-encoded, 0-terminated */
/* A MDSystemTime structure that contains a date and local time when the
* transition from standard time to daylight saving time occurs on this
* operating system. If the time zone does not support daylight saving time,
* the month member in the MDSystemTime structure is zero.*/
MDSystemTime daylight_date;
/* The bias value to be used during local time translations that occur during
* daylight saving time. */
int32_t daylight_bias;
} MDTimeZoneInformation; /* TIME_ZONE_INFORMATION */
/* MAX_PATH from windef.h */
#define MD_MAX_PATH 260
/* The miscellaneous information stream contains a variety
* of small pieces of information. A member is valid if
* it's within the available size and its corresponding
* bit is set. */
typedef struct {
uint32_t size_of_info; /* Length of entire MDRawMiscInfo structure. */
uint32_t flags1;
@ -673,8 +722,8 @@ typedef struct {
uint32_t process_kernel_time; /* seconds of kernel CPU time */
/* The following fields are not present in MINIDUMP_MISC_INFO but are
* in MINIDUMP_MISC_INFO_2. When this struct is populated, these values
* may not be set. Use flags1 or sizeOfInfo to determine whether these
* in MINIDUMP_MISC_INFO_2. When this struct is populated, these value
* may not be set. Use flags1 or size_of_info to determine whether these
* values are present. These are only valid when flags1 contains
* MD_MISCINFO_FLAGS1_PROCESSOR_POWER_INFO. */
uint32_t processor_max_mhz;
@ -682,20 +731,66 @@ typedef struct {
uint32_t processor_mhz_limit;
uint32_t processor_max_idle_state;
uint32_t processor_current_idle_state;
} MDRawMiscInfo; /* MINIDUMP_MISC_INFO, MINIDUMP_MISC_INFO2 */
#define MD_MISCINFO_SIZE 24
#define MD_MISCINFO2_SIZE 44
/* The following fields are not present in MINIDUMP_MISC_INFO_2 but are
* in MINIDUMP_MISC_INFO_3. When this struct is populated, these value
* may not be set. Use flags1 or size_of_info to determine whether these
* values are present. */
/* The following field is only valid if flags1 contains
* MD_MISCINFO_FLAGS1_PROCESS_INTEGRITY. */
uint32_t process_integrity_level;
/* The following field is only valid if flags1 contains
* MD_MISCINFO_FLAGS1_PROCESS_EXECUTE_FLAGS. */
uint32_t process_execute_flags;
/* The following field is only valid if flags1 contains
* MD_MISCINFO_FLAGS1_PROTECTED_PROCESS. */
uint32_t protected_process;
/* The following 2 fields are only valid if flags1 contains
* MD_MISCINFO_FLAGS1_TIMEZONE. */
uint32_t time_zone_id;
MDTimeZoneInformation time_zone;
/* The following fields are not present in MINIDUMP_MISC_INFO_3 but are
* in MINIDUMP_MISC_INFO_4. When this struct is populated, these value
* may not be set. Use size_of_info to determine whether these values are
* present. */
/* The following 2 fields are only valid if
* size_of_info is >= MD_MISCINFO4_SIZE */
uint16_t build_string[MD_MAX_PATH]; /* UTF-16-encoded, 0-terminated */
uint16_t dbg_bld_str[40]; /* UTF-16-encoded, 0-terminated */
} MDRawMiscInfo; /* MINIDUMP_MISC_INFO, MINIDUMP_MISC_INFO2,
* MINIDUMP_MISC_INFO3, MINIDUMP_MISC_INFO4 */
static const size_t MD_MISCINFO_SIZE =
offsetof(MDRawMiscInfo, processor_max_mhz);
static const size_t MD_MISCINFO2_SIZE =
offsetof(MDRawMiscInfo, process_integrity_level);
static const size_t MD_MISCINFO3_SIZE =
offsetof(MDRawMiscInfo, build_string[0]);
static const size_t MD_MISCINFO4_SIZE = sizeof(MDRawMiscInfo);
/* For (MDRawMiscInfo).flags1. These values indicate which fields in the
* MDRawMiscInfoStructure are valid. */
typedef enum {
MD_MISCINFO_FLAGS1_PROCESS_ID = 0x00000001,
MD_MISCINFO_FLAGS1_PROCESS_ID = 0x00000001,
/* MINIDUMP_MISC1_PROCESS_ID */
MD_MISCINFO_FLAGS1_PROCESS_TIMES = 0x00000002,
MD_MISCINFO_FLAGS1_PROCESS_TIMES = 0x00000002,
/* MINIDUMP_MISC1_PROCESS_TIMES */
MD_MISCINFO_FLAGS1_PROCESSOR_POWER_INFO = 0x00000004
MD_MISCINFO_FLAGS1_PROCESSOR_POWER_INFO = 0x00000004,
/* MINIDUMP_MISC1_PROCESSOR_POWER_INFO */
MD_MISCINFO_FLAGS1_PROCESS_INTEGRITY = 0x00000010,
/* MINIDUMP_MISC3_PROCESS_INTEGRITY */
MD_MISCINFO_FLAGS1_PROCESS_EXECUTE_FLAGS = 0x00000020,
/* MINIDUMP_MISC3_PROCESS_EXECUTE_FLAGS */
MD_MISCINFO_FLAGS1_TIMEZONE = 0x00000040,
/* MINIDUMP_MISC3_TIMEZONE */
MD_MISCINFO_FLAGS1_PROTECTED_PROCESS = 0x00000080,
/* MINIDUMP_MISC3_PROTECTED_PROCESS */
} MDMiscInfoFlags1;
/*