Leaked source code of windows server 2003
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.

140 lines
2.3 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. ominit.c
  5. Abstract:
  6. Initialization module for Object Manager
  7. Author:
  8. John Vert (jvert) 16-Feb-1996
  9. Revision History:
  10. --*/
  11. #include "omp.h"
  12. //
  13. // Local data
  14. //
  15. BOOL OmInited = FALSE;
  16. #if OM_TRACE_REF
  17. extern LIST_ENTRY gDeadListHead;
  18. #endif
  19. DWORD
  20. OmInitialize(
  21. VOID
  22. )
  23. /*++
  24. Routine Description:
  25. Initializes the object manager
  26. Arguments:
  27. None
  28. Return Value:
  29. ERROR_SUCCESS if successful.
  30. Win32 error code otherwise.
  31. --*/
  32. {
  33. DWORD Status = ERROR_SUCCESS;
  34. if ( OmInited ) {
  35. return(ERROR_DUPLICATE_SERVICE_NAME);
  36. }
  37. //
  38. // Initialize locks
  39. //
  40. InitializeCriticalSection(&OmpObjectTypeLock);
  41. #if OM_TRACE_REF
  42. InitializeListHead(&gDeadListHead);
  43. #endif
  44. //
  45. // open the log and write a start record
  46. //
  47. OmpOpenObjectLog();
  48. OmpLogStartRecord();
  49. OmInited = TRUE;
  50. return(Status);
  51. }
  52. VOID
  53. OmShutdown(
  54. VOID
  55. )
  56. /*++
  57. Routine Description:
  58. Shuts down the object manager
  59. Arguments:
  60. None
  61. Return Value:
  62. None.
  63. --*/
  64. {
  65. OmInited = FALSE;
  66. #if OM_TRACE_REF
  67. {
  68. POM_HEADER pHeader;
  69. PLIST_ENTRY pListEntry;
  70. ClRtlLogPrint(LOG_NOISE, "[OM] Scanning for objects on deadlist\r\n");
  71. //SS: dump the objects and their ref counts
  72. pListEntry = gDeadListHead.Flink;
  73. while (pListEntry != &gDeadListHead)
  74. {
  75. pHeader = CONTAINING_RECORD(pListEntry, OM_HEADER, DeadListEntry);
  76. ClRtlLogPrint(LOG_NOISE, "[OM] ObjBody= %1!lx! RefCnt=%2!d! ObjName=%3!ws! ObjId=%4!ws!\n",
  77. &pHeader->Body, pHeader->RefCount,pHeader->Name, pHeader->Id);
  78. /*
  79. if (pHeader->Name)
  80. {
  81. ClRtlLogPrint(LOG_NOISE, "[OM] ObjectName=%1!ws!\r\n", pHeader->Name);
  82. }
  83. */
  84. pListEntry = pListEntry->Flink;
  85. }
  86. }
  87. #endif
  88. //
  89. // Maybe we should check that the object type table is empty and
  90. // deallocate ObjectType blocks if it isn't empty!
  91. // However, since we are shutting down and presumably exiting, this
  92. // really doesn't matter that much.
  93. //
  94. ZeroMemory( &OmpObjectTypeTable, sizeof(OmpObjectTypeTable) );
  95. return;
  96. }