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.

138 lines
3.4 KiB

  1. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Copyright (c) 1989-1999 Microsoft Corporation
  3. Module Name:
  4. sdesc.cxx
  5. Abstract:
  6. stub descriptor manager implementation.
  7. Notes:
  8. History:
  9. Nov-02-1993 VibhasC Created
  10. ----------------------------------------------------------------------------*/
  11. /****************************************************************************
  12. * include files
  13. ***************************************************************************/
  14. #include "becls.hxx"
  15. #pragma hdrstop
  16. /****************************************************************************
  17. * local definitions
  18. ***************************************************************************/
  19. /****************************************************************************
  20. * local data
  21. ***************************************************************************/
  22. /****************************************************************************
  23. * externs
  24. ***************************************************************************/
  25. /****************************************************************************/
  26. SDESC *
  27. SDESCMGR::Register(
  28. PNAME AllocRtnName,
  29. PNAME FreeRtnName,
  30. PNAME RundownRtnName )
  31. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  32. Routine Description:
  33. The constructor.
  34. Arguments:
  35. AllocRtnName - The allocator rtn name.
  36. FreeRtnName - Free rtn name
  37. InterfaceName - interface name without any mangling.
  38. RundownRtnName - The context handle rundown in case necessary.
  39. Return Value:
  40. NA
  41. Notes:
  42. Make an entry into the dictionary if it does not exist.
  43. ----------------------------------------------------------------------------*/
  44. {
  45. SDESC NewDesc;
  46. SDESC * pNewDesc;
  47. Dict_Status Status;
  48. NewDesc.AllocRtnName = AllocRtnName;
  49. NewDesc.FreeRtnName = FreeRtnName;
  50. NewDesc.RundownRtnName = RundownRtnName;
  51. Status = Dict_Find( &NewDesc );
  52. switch( Status )
  53. {
  54. case EMPTY_DICTIONARY:
  55. case ITEM_NOT_FOUND:
  56. pNewDesc = new SDESC;
  57. pNewDesc->AllocRtnName = AllocRtnName;
  58. pNewDesc->FreeRtnName = FreeRtnName;
  59. pNewDesc->RundownRtnName = RundownRtnName;
  60. pNewDesc->ResetEmitted();
  61. Dict_Insert( (pUserType)pNewDesc );
  62. return pNewDesc;
  63. default:
  64. return (SDESC *)Dict_Curr_Item();
  65. }
  66. }
  67. SSIZE_T
  68. SDESCMGR::Compare(
  69. pUserType pFirst,
  70. pUserType pSecond )
  71. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  72. Routine Description:
  73. Compare stub descriptors.
  74. Arguments:
  75. pFirst - A pointer to the first stub descriptor.
  76. pSecond - A pointer to the second stub descriptor.
  77. Return Value:
  78. Notes:
  79. WE MAKE AN ASSUMPTION THAT THE ALLOC AND FREE AND RUNDOWN ROUTINE NAMES
  80. WILL NEVER BE NULL POINTERS. IF NOTHING, THEY MUST POINT TO NULL STRINGS
  81. ----------------------------------------------------------------------------*/
  82. {
  83. SDESC * p1 = (SDESC *)pFirst;
  84. SDESC * p2 = (SDESC *)pSecond;
  85. int Result;
  86. if( (Result = strcmp( (const char *)p1->AllocRtnName,
  87. (const char *)p2->AllocRtnName ) ) == 0 )
  88. {
  89. if( (Result = strcmp( (const char *)p1->FreeRtnName,
  90. (const char *)p2->FreeRtnName ) ) == 0 )
  91. {
  92. Result = strcmp( (const char *)p1->RundownRtnName,
  93. (const char *)p2->RundownRtnName );
  94. }
  95. }
  96. return Result;
  97. }
  98. void
  99. PrintSDesc( void * ) { }