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.

85 lines
2.9 KiB

  1. /*---------------------------------------------------------------------------
  2. | WINVER.C - Windows Version program
  3. |
  4. | History:
  5. | 03/08/89 Toddla Created
  6. |
  7. *--------------------------------------------------------------------------*/
  8. #include <nt.h>
  9. #include <ntrtl.h>
  10. #include <nturtl.h>
  11. #include <windows.h>
  12. #include <port1632.h>
  13. #include <stdio.h>
  14. #include "winverp.h"
  15. #include <shellapi.h>
  16. void FileTimeToDateTimeString(
  17. LPFILETIME pft,
  18. LPTSTR pszBuf,
  19. UINT cchBuf)
  20. {
  21. SYSTEMTIME st;
  22. int cch;
  23. FileTimeToLocalFileTime(pft, pft);
  24. FileTimeToSystemTime(pft, &st);
  25. cch = GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, pszBuf, cchBuf);
  26. cchBuf -= cch;
  27. pszBuf += cch - 1;
  28. *pszBuf++ = TEXT(' ');
  29. *pszBuf = 0; // (in case GetTimeFormat doesn't add anything)
  30. cchBuf--;
  31. GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, NULL, pszBuf, cchBuf);
  32. }
  33. /*----------------------------------------------------------------------------*\
  34. | WinMain( hInst, hPrev, lpszCmdLine, cmdShow ) |
  35. | |
  36. | Description: |
  37. | The main procedure for the App. After initializing, it just goes |
  38. | into a message-processing loop until it gets a WM_QUIT message |
  39. | (meaning the app was closed). |
  40. | |
  41. | Arguments: |
  42. | hInst instance handle of this instance of the app |
  43. | hPrev instance handle of previous instance, NULL if first |
  44. | lpszCmdLine ->null-terminated command line |
  45. | cmdShow specifies how the window is initially displayed |
  46. | |
  47. | Returns: |
  48. | The exit code as specified in the WM_QUIT message. |
  49. | |
  50. \*----------------------------------------------------------------------------*/
  51. INT
  52. __cdecl
  53. ModuleEntry()
  54. {
  55. TCHAR szTitle[32];
  56. LARGE_INTEGER Time = USER_SHARED_DATA->SystemExpirationDate;
  57. LoadString(GetModuleHandle(NULL), IDS_APPTITLE, szTitle, 32);
  58. if (Time.QuadPart) {
  59. TCHAR szExtra[128];
  60. TCHAR szTime[128];
  61. FileTimeToDateTimeString((PFILETIME)&Time, szTime, 128);
  62. LoadString(GetModuleHandle(NULL), IDS_EVALUATION, szExtra, 128);
  63. lstrcat(szExtra, szTime);
  64. ShellAbout(NULL, szTitle, szExtra, NULL);
  65. } else {
  66. ShellAbout(NULL, szTitle, NULL, NULL);
  67. }
  68. return 0;
  69. }