Author: hbelusca Date: Sat May 4 22:15:26 2013 New Revision: 58932
URL: http://svn.reactos.org/svn/reactos?rev=58932&view=rev Log: [CDMAKE] ISO images generated by cdmake have invalid time and date. Patch by Aleksandar Andrejevic, aka. [TheFlash]
CORE-7163 #resolve #comment Committed in revision r58932, thanks for the patch ;)
Modified: trunk/reactos/tools/cdmake/cdmake.c
Modified: trunk/reactos/tools/cdmake/cdmake.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cdmake/cdmake.c?rev=5... ============================================================================== --- trunk/reactos/tools/cdmake/cdmake.c [iso-8859-1] (original) +++ trunk/reactos/tools/cdmake/cdmake.c [iso-8859-1] Sat May 4 22:15:26 2013 @@ -1097,6 +1097,20 @@ } }
+static void get_time_string(char *str) +{ + struct tm *current; + time_t timestamp = time(NULL); + current = gmtime(×tamp); + sprintf(str, "%04d%02d%02d%02d%02d%02d00", + current->tm_year + 1900, + current->tm_mon, + current->tm_mday, + current->tm_hour, + current->tm_min, + current->tm_sec); +} + static void pass(void) { PDIR_RECORD d; @@ -1110,6 +1124,9 @@ char *old_end_source; int n; FILE *file; + char timestring[17]; + + get_time_string(timestring);
// first 16 sectors are zeros
@@ -1144,13 +1161,13 @@ write_block(37, ' '); // copyright file identifier write_block(37, ' '); // abstract file identifier write_block(37, ' '); // bibliographic file identifier - write_string("0000000000000000"); // volume creation + write_string(timestring); // volume creation write_byte(0); - write_string("0000000000000000"); // most recent modification + write_string(timestring); // most recent modification write_byte(0); - write_string("0000000000000000"); // volume expires + write_string(timestring); // volume expires write_byte(0); - write_string("0000000000000000"); // volume is effective + write_string(timestring); // volume is effective write_byte(0); write_byte(1); write_byte(0); @@ -1203,14 +1220,14 @@ write_block(37, ' '); // copyright file identifier write_block(37, ' '); // abstract file identifier write_block(37, ' '); // bibliographic file identifier - write_string("0000000000000000"); // volume creation - write_byte(0); - write_string("0000000000000000"); // most recent modification - write_byte(0); - write_string("0000000000000000"); // volume expires - write_byte(0); - write_string("0000000000000000"); // volume is effective - write_byte(0); + write_string(timestring); // volume creation + write_byte(48); + write_string(timestring); // most recent modification + write_byte(48); + write_string(timestring); // volume expires + write_byte(48); + write_string(timestring); // volume is effective + write_byte(48); write_byte(1); write_byte(0); fill_sector(); @@ -1499,6 +1516,8 @@
int main(int argc, char **argv) { + struct tm *current_time; + time_t timestamp = time(NULL); BOOL q_option = FALSE; BOOL v_option = FALSE; int i; @@ -1520,8 +1539,15 @@ error_exit("Insufficient memory");
memset(&root, 0, sizeof(root)); + current_time = gmtime(×tamp); root.level = 1; root.flags = DIRECTORY_FLAG; + root.date_and_time.year = current_time->tm_year + 1900; + root.date_and_time.month = current_time->tm_mon; + root.date_and_time.day = current_time->tm_mday; + root.date_and_time.hour = current_time->tm_hour; + root.date_and_time.minute = current_time->tm_min; + root.date_and_time.second = current_time->tm_sec;
// initialize CD-ROM write buffer