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.

138 lines
3.4 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. bootok.c
  5. Abstract:
  6. This program will send a NotifyBootConfigStatus to the service controller
  7. to tell it that the boot is acceptable and should become the next
  8. "LastKnownGood".
  9. Author:
  10. Dan Lafferty (danl) 17 Jul-1992
  11. Environment:
  12. User Mode -Win32
  13. Revision History:
  14. --*/
  15. //
  16. // Includes
  17. //
  18. #include <nt.h> // DbgPrint prototype
  19. #include <ntrtl.h> // DbgPrint prototype
  20. #include <nturtl.h> // needed for winbase.h
  21. #include <windows.h>
  22. #include <tstr.h> // Unicode string macros
  23. #include <stdio.h> // printf
  24. //
  25. // Defines
  26. //
  27. //
  28. // DEBUG MACROS
  29. //
  30. #if DBG
  31. #define DEBUG_STATE 1
  32. #define STATIC
  33. #else
  34. #define DEBUG_STATE 0
  35. #define STATIC static
  36. #endif
  37. //
  38. // The following allow debug print syntax to look like:
  39. //
  40. // BV_LOG(DEBUG_TRACE, "An error occured %x\n",status)
  41. //
  42. #define BV_LOG0(level, string) \
  43. KdPrintEx((DPFLTR_BOOTVRFY_ID, \
  44. DEBUG_##level, \
  45. "[BootVrfy]" string))
  46. #define BV_LOG1(level, string, var1) \
  47. KdPrintEx((DPFLTR_BOOTVRFY_ID, \
  48. DEBUG_##level, \
  49. "[BootVrfy]" string, \
  50. var1))
  51. #define BV_LOG2(level, string, var1, var2) \
  52. KdPrintEx((DPFLTR_BOOTVRFY_ID, \
  53. DEBUG_##level, \
  54. "[BootVrfy]" string, \
  55. var1, \
  56. var2))
  57. //
  58. // Debug output is filtered at two levels: A global level and a component
  59. // specific level.
  60. //
  61. // Each debug output request specifies a component id and a filter level
  62. // or mask. These variables are used to access the debug print filter
  63. // database maintained by the system. The component id selects a 32-bit
  64. // mask value and the level either specified a bit within that mask or is
  65. // as mask value itself.
  66. //
  67. // If any of the bits specified by the level or mask are set in either the
  68. // component mask or the global mask, then the debug output is permitted.
  69. // Otherwise, the debug output is filtered and not printed.
  70. //
  71. // The component mask for filtering the debug output of this component is
  72. // Kd_BOOTOK_Mask and may be set via the registry or the kernel debugger.
  73. //
  74. // The global mask for filtering the debug output of all components is
  75. // Kd_WIN2000_Mask and may be set via the registry or the kernel debugger.
  76. //
  77. // The registry key for setting the mask value for this component is:
  78. //
  79. // HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\
  80. // Session Manager\Debug Print Filter\BOOTOK
  81. //
  82. // The key "Debug Print Filter" may have to be created in order to create
  83. // the component key.
  84. //
  85. // The following levels are used to filter debug output.
  86. //
  87. #define DEBUG_ERROR (0x00000001 | DPFLTR_MASK)
  88. #define DEBUG_TRACE (0x00000004 | DPFLTR_MASK)
  89. #define DEBUG_ALL (0xffffffff | DPFLTR_MASK)
  90. VOID __cdecl
  91. main(void)
  92. {
  93. BOOL success;
  94. #ifdef SC_CAP // (For Performance Testing)
  95. StartCAP();
  96. #endif // SC_CAP
  97. success = NotifyBootConfigStatus( TRUE);
  98. #ifdef SC_CAP
  99. StopCAP();
  100. DumpCAP();
  101. #endif // SC_CAP
  102. if ( success == FALSE) {
  103. DWORD error = GetLastError();
  104. BV_LOG1( TRACE, "NotifyBootConfigStatus failed, error = %d\n", error);
  105. }
  106. }