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.

49 lines
1.4 KiB

  1. #include <tchar.h>
  2. #include <stdio.h>
  3. #include <windows.h>
  4. #define ARRAYSIZE(a) (sizeof((a))/sizeof((a)[0]))
  5. #ifdef UNICODE
  6. extern "C"
  7. {
  8. int __cdecl wmain(int argc, wchar_t* argv[])
  9. #else
  10. int __cdecl main(int argc, char* argv[])
  11. #endif
  12. {
  13. HKEY hkey;
  14. FILETIME ft = {0};
  15. SYSTEMTIME st = {0};
  16. PBYTE pb = (PBYTE)&ft;
  17. GetSystemTimeAsFileTime(&ft);
  18. if (FileTimeToSystemTime(&ft, &st))
  19. {
  20. _tprintf(TEXT("\nTime: %04d-%02d-%02d %02d:%02d:%02d:%04d\n\n"), st.wYear,
  21. st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond,
  22. st.wMilliseconds);
  23. }
  24. _tprintf(TEXT("Put this in devxprop.inx:\n"));
  25. _tprintf(TEXT("HKLM,\"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\PerHwIdStorage\",\"LastUpdateTime\",1,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x\n"),
  26. pb[0], pb[1], pb[2], pb[3], pb[4], pb[5], pb[6], pb[7]);
  27. if (ERROR_SUCCESS == RegCreateKeyEx(HKEY_CURRENT_USER,
  28. TEXT("Software\\Microsoft\\Test"), 0, NULL,
  29. REG_OPTION_VOLATILE, MAXIMUM_ALLOWED, NULL, &hkey, NULL))
  30. {
  31. if (ERROR_SUCCESS == RegSetValueEx(hkey, TEXT("LastUpdateTimeCompare"),
  32. NULL, REG_BINARY, (PBYTE)&ft, sizeof(ft)))
  33. {
  34. _tprintf(TEXT("\n> Successfully written value HKCU\\Software\\Microsoft\\Test!LastUpdateTime for comparison.\n"));
  35. }
  36. CloseHandle(hkey);
  37. }
  38. return 0;
  39. }
  40. #ifdef UNICODE
  41. }
  42. #endif