Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
2.4 KiB

  1. /*
  2. * Program to make verdep.h
  3. Owner:
  4. Lei Jin(leijin)
  5. Borrowed from Access team.(Andrew)
  6. */
  7. #pragma hdrstop
  8. #include <time.h>
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11. #include <string.h>
  12. #include "windows.h"
  13. main()
  14. {
  15. // need to collect the current date, the version number, the version
  16. // type, and the volume label.
  17. struct tm *tmTime;
  18. char szVersNum[120];
  19. char szbuf[256];
  20. char *szMakeType, *szUserName;
  21. time_t tt;
  22. static char *szMonth[] =
  23. {
  24. "January",
  25. "February",
  26. "March",
  27. "April",
  28. "May",
  29. "June",
  30. "July",
  31. "August",
  32. "September",
  33. "October",
  34. "November",
  35. "December"
  36. };
  37. // Get the time
  38. time(&tt);
  39. tmTime = localtime(&tt);
  40. // Get the types from environment
  41. szMakeType = getenv("MAKETYPE");
  42. if (!szMakeType)
  43. szMakeType = "Unknown";
  44. // Get the user name
  45. szUserName = getenv("USERNAME");
  46. if (!szUserName)
  47. {
  48. //unsigned long dw;
  49. if (!GetVolumeInformation(NULL, szbuf, 255, NULL, NULL, NULL, NULL, 0))
  50. szUserName = "NOBODY";
  51. else
  52. szUserName = szbuf;
  53. }
  54. // Get the version number from stdin
  55. //gets(szVersNum);
  56. sprintf(szVersNum, "2");
  57. printf("#define vszMakeDate\t\"%s %d, 19%d\"\n", szMonth[tmTime->tm_mon], tmTime->tm_mday, tmTime->tm_year);
  58. printf("#define vszMakeVers\t\"Version %s - %s - %s\"\n", szVersNum, szMakeType, szUserName);
  59. printf("#define vszVersNum\t\"%s\"\n", szVersNum, szMakeType);
  60. printf("#define vszCopyright\t\"Copyright \251 1996 Microsoft Corp.\"\n");
  61. printf("#define vszVersName\t\"%s (%s)\"\n", szUserName, szMakeType);
  62. printf("#define vszMakeSerial\t\"%02d-%02d-%02d-%02d%02d%02d\"\n", tmTime->tm_mon + 1, tmTime->tm_mday, tmTime->tm_year,
  63. tmTime->tm_hour, tmTime->tm_min, tmTime->tm_sec);
  64. printf("#define vszDenaliVersion\t%s.%02d.%02d.0\n", szVersNum, (tmTime->tm_year - 96)*12 + tmTime->tm_mon + 1, tmTime->tm_mday);
  65. printf("#define vszDenaliVersionNULL\t\"%s.%02d.%02d.0\\0\"\n", szVersNum, (tmTime->tm_year - 96)*12 + tmTime->tm_mon + 1, tmTime->tm_mday);
  66. // the following block is for the version stamp resource
  67. {
  68. #include <string.h>
  69. char *sz;
  70. // major
  71. if(sz = strtok(szVersNum, ".\n \t"))
  72. printf("#define rmj\t\t%0u\n", atoi(sz));
  73. // minor
  74. if(sz = strtok(NULL, ".\n \t"))
  75. printf("#define rmm\t\t%01u\n", atoi(sz));
  76. else
  77. printf("#define rmm\t\t0\n");
  78. // release
  79. if(sz = strtok(NULL, ""))
  80. printf("#define rup\t\t%0u\n", atoi(sz));
  81. else
  82. printf("#define rup\t\t0\n");
  83. }
  84. return 0;
  85. }