Add generation for remaining, fix invalid fseek().
diff --git a/generator/gen-utils.c b/generator/gen-utils.c
index a0f6e3c..1ab318f 100644
--- a/generator/gen-utils.c
+++ b/generator/gen-utils.c
@@ -25,6 +25,19 @@
return bytes;
}
+//Creates a valid common CPER error section, given the start of the error section.
+//Clears reserved bits.
+void create_valid_error_section(UINT8* start)
+{
+ //Fix reserved bits.
+ UINT64* error_section = (UINT64*)start;
+ *error_section &= ~0xFF; //Reserved bits 0-7.
+ *error_section &= 0x7FFFFF; //Reserved bits 23-63
+
+ //Ensure error type has a valid value.
+ *(start + 1) = CPER_ERROR_TYPES_KEYS[rand() % (sizeof(CPER_ERROR_TYPES_KEYS) / sizeof(int))];
+}
+
//Initializes the random seed for rand() using the current time.
void init_random()
{