Windows NT 4.0 source code leak
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.

130 lines
2.6 KiB

4 years ago
  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. SysInit.c
  5. Abstract:
  6. This module implements the Log File Service initialization.
  7. Author:
  8. Brian Andrew [BrianAn] 20-June-1991
  9. Revision History:
  10. --*/
  11. #include "lfsprocs.h"
  12. //
  13. // The debug trace level
  14. //
  15. #define Dbg (DEBUG_TRACE_INITIALIZATION)
  16. #ifdef ALLOC_PRAGMA
  17. #pragma alloc_text(PAGE, LfsInitializeLogFileService)
  18. #endif
  19. extern USHORT LfsUsaSeqNumber;
  20. BOOLEAN
  21. LfsInitializeLogFileService (
  22. )
  23. /*++
  24. Routine Description:
  25. This routine must be called during system initialization before the
  26. first call to logging service, to allow the Log File Service to initialize
  27. its global data structures. This routine has no dependencies on other
  28. system components being initialized.
  29. This routine will initialize the global structures used by the logging
  30. service and start the Lfs worker thread.
  31. Arguments:
  32. None
  33. Return Value:
  34. TRUE if initialization was successful
  35. --*/
  36. {
  37. LARGE_INTEGER CurrentTime;
  38. PAGED_CODE();
  39. DebugTrace( +1, Dbg, "LfsInitializeLogFileService: Enter\n", 0 );
  40. //
  41. // If the structure has already been initialized then we can return
  42. // immediately.
  43. //
  44. if (LfsData.NodeTypeCode == LFS_NTC_DATA
  45. && LfsData.NodeByteSize == sizeof( LFS_DATA )
  46. && FlagOn( LfsData.Flags, LFS_DATA_INITIALIZED )) {
  47. DebugTrace( -1, Dbg, "LfsInitializeLogFileService: Exit -> %01x\n", TRUE );
  48. return TRUE;
  49. }
  50. //
  51. // Zero out the structure initially.
  52. //
  53. RtlZeroMemory( &LfsData, sizeof( LFS_DATA ));
  54. //
  55. // Assume the operation will fail.
  56. //
  57. LfsData.Flags = LFS_DATA_INIT_FAILED;
  58. //
  59. // Initialize the global structure for Lfs.
  60. //
  61. LfsData.NodeTypeCode = LFS_NTC_DATA;
  62. LfsData.NodeByteSize = sizeof( LFS_DATA );
  63. InitializeListHead( &LfsData.LfcbLinks );
  64. //
  65. // Allocate and initialize the synchronization objects.
  66. //
  67. KeInitializeEvent( &LfsData.Event,
  68. SynchronizationEvent,
  69. TRUE );
  70. //
  71. // Initialization has been successful.
  72. //
  73. ClearFlag( LfsData.Flags, LFS_DATA_INIT_FAILED );
  74. SetFlag( LfsData.Flags, LFS_DATA_INITIALIZED );
  75. //
  76. // Get a random number as a seed for the Usa sequence numbers. Use the lower
  77. // bits of the current time.
  78. //
  79. KeQuerySystemTime( &CurrentTime );
  80. LfsUsaSeqNumber = (USHORT) CurrentTime.LowPart;
  81. DebugTrace( -1, Dbg, "LfsInitializeLogFileService: Exit -> %01x\n", TRUE );
  82. return TRUE;
  83. }