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.

94 lines
1.6 KiB

  1. /*++
  2. Copyright (c) 1991-2001 Microsoft Corporation
  3. Module Name:
  4. erdirty.cpp
  5. Abstract:
  6. This module contains the code to report pending dirty shutdown
  7. events at logon after dirty reboot.
  8. Author:
  9. Ian Service (ianserv) 29-May-2001
  10. Environment:
  11. User mode at logon.
  12. Revision History:
  13. --*/
  14. #include "savedump.h"
  15. BOOL
  16. DirtyShutdownEventHandler(
  17. IN BOOL NotifyPcHealth
  18. )
  19. /*++
  20. Routine Description:
  21. This is the boot time routine to handle pending dirty shutdown event.
  22. Arguments:
  23. NotifyPcHealth - TRUE if we should report event to PC Health, FALSE otherwise.
  24. Return Value:
  25. TRUE if dirty shutdown event found and reported to PC Health, FALSE otherwise.
  26. --*/
  27. {
  28. HKEY Key;
  29. ULONG WinStatus;
  30. ULONG Length;
  31. ULONG Type;
  32. WCHAR DumpName[MAX_PATH];
  33. BOOLEAN Status;
  34. Status = FALSE;
  35. //
  36. // Open the Reliability key.
  37. //
  38. WinStatus = RegOpenKey(HKEY_LOCAL_MACHINE,
  39. SUBKEY_RELIABILITY,
  40. &Key);
  41. if (WinStatus != ERROR_SUCCESS)
  42. {
  43. return FALSE;
  44. }
  45. Length = sizeof (DumpName);
  46. WinStatus = RegQueryValueEx(Key,
  47. L"ShutDownStateSnapShot",
  48. NULL,
  49. &Type,
  50. (LPBYTE)&DumpName,
  51. &Length);
  52. if (ERROR_SUCCESS == WinStatus)
  53. {
  54. if (NotifyPcHealth)
  55. {
  56. PCHPFNotifyFault(eetShutdown, DumpName, NULL);
  57. Status = TRUE;
  58. }
  59. RegDeleteValue(Key, L"ShutDownStateSnapShot");
  60. RegCloseKey (Key);
  61. }
  62. return Status;
  63. }