diff --git a/reactos/tools/cdmake/cdmake.c b/reactos/tools/cdmake/cdmake.c index 622226b78cc..751c588da68 100644 --- a/reactos/tools/cdmake/cdmake.c +++ b/reactos/tools/cdmake/cdmake.c @@ -1097,6 +1097,20 @@ static void get_file_specifications(PDIR_RECORD d) } } +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 @@ static void pass(void) char *old_end_source; int n; FILE *file; + char timestring[17]; + + get_time_string(timestring); // first 16 sectors are zeros @@ -1144,13 +1161,13 @@ static void pass(void) 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 @@ static void pass(void) 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 @@ Program execution starts here. 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 @@ int main(int argc, char **argv) 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