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.

178 lines
3.9 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1991 - 1999
  3. Module Name:
  4. epmap.c
  5. Abstract:
  6. This file contains the EP Mapper startup code and process wide globals.
  7. Author:
  8. Bharat Shah (barats) 17-2-92
  9. Revision History:
  10. 06-16-95 MarioGo Much of the code replaced by ..\wrapper\start.c
  11. Renamed from server.c
  12. Jan 2000 KamenM Add debugging support
  13. --*/
  14. #include <sysinc.h>
  15. #include <wincrypt.h>
  16. #include <rpc.h>
  17. #include <winsvc.h>
  18. #include "epmp.h"
  19. #include "eptypes.h"
  20. #include "local.h"
  21. #include <DbgComn.h>
  22. #include <DbgIdl.h>
  23. #include <DbgSvr.hxx>
  24. #if DBG && !defined(DEBUGRPC)
  25. #define DEBUGRPC
  26. #endif
  27. /*// Endpoint related functions
  28. RPC_STATUS InitializeEndpointManager(VOID);
  29. DWORD StartEndpointMapper(VOID);
  30. USHORT GetProtseqIdAnsi(PSTR Protseq);
  31. USHORT GetProtseqId(PWSTR Protseq);
  32. PWSTR GetProtseq(USHORT ProtseqId);
  33. PWSTR GetEndpoint(USHORT ProtseqId);
  34. RPC_STATUS UseProtseqIfNecessary(USHORT id);
  35. RPC_STATUS DelayedUseProtseq(USHORT id);
  36. VOID CompleteDelayedUseProtseqs();
  37. BOOL IsLocal(USHORT ProtseqId);
  38. */
  39. extern RPC_STATUS InitializeIpPortManager();
  40. //
  41. // Endpoint Mapper Globals
  42. //
  43. HANDLE hEpMapperHeap;
  44. CRITICAL_SECTION EpCritSec;
  45. PIFOBJNode IFObjList = NULL;
  46. PSAVEDCONTEXT GlobalContextList = NULL;
  47. unsigned long cTotalEpEntries = 0L;
  48. unsigned long GlobalIFOBJid = 0xFFL;
  49. unsigned long GlobalEPid = 0x00FFFFFFL;
  50. UUID NilUuid = { 0L, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0} };
  51. DWORD
  52. StartEndpointMapper(
  53. void
  54. )
  55. /*++
  56. Routine Description:
  57. Called during dcomss startup. Should call Updatestatus()
  58. if something will take very long.
  59. Arguments:
  60. None
  61. Return Value:
  62. 0 - success
  63. non-0 - will cause the service to fail.
  64. --*/
  65. {
  66. extern void RPC_ENTRY UpdateAddresses( PVOID arg );
  67. RPC_STATUS status = RPC_S_OK;
  68. BOOL fAuthInfoNotRegistered = FALSE;
  69. InitializeCriticalSectionAndSpinCount(&EpCritSec, PREALLOCATE_EVENT_MASK);
  70. hEpMapperHeap = GetProcessHeap();
  71. if (hEpMapperHeap == 0)
  72. {
  73. ASSERT(GetLastError() != 0);
  74. return(GetLastError());
  75. }
  76. // register snego & kerberos. During clean install, this code can
  77. // legally fail, as Rpcss is started before there are any
  78. // security providers. Therefore, we cannot fail Rpcss init if this
  79. // fails - we just don't register the debug interface, who is the
  80. // only user of this
  81. status = RpcServerRegisterAuthInfo(NULL, RPC_C_AUTHN_GSS_NEGOTIATE, NULL, NULL);
  82. if (status != RPC_S_OK)
  83. {
  84. fAuthInfoNotRegistered = TRUE;
  85. }
  86. status = RpcServerRegisterAuthInfo(NULL, RPC_C_AUTHN_GSS_KERBEROS, NULL, NULL);
  87. if (status != RPC_S_OK)
  88. {
  89. fAuthInfoNotRegistered = TRUE;
  90. }
  91. status = RpcServerRegisterIf(epmp_ServerIfHandle,
  92. 0,
  93. 0);
  94. if (status != RPC_S_OK)
  95. {
  96. return(status);
  97. }
  98. status = RpcServerRegisterIf(localepmp_ServerIfHandle,
  99. 0,
  100. 0);
  101. if (status != RPC_S_OK)
  102. {
  103. return(status);
  104. }
  105. if (fAuthInfoNotRegistered == FALSE)
  106. {
  107. status = RpcServerRegisterIfEx(DbgIdl_ServerIfHandle,
  108. 0,
  109. 0,
  110. 0,
  111. RPC_C_PROTSEQ_MAX_REQS_DEFAULT,
  112. DebugServerSecurityCallback);
  113. if (status != RPC_S_OK)
  114. {
  115. return(status);
  116. }
  117. }
  118. status = I_RpcServerRegisterForwardFunction( GetForwardEp );
  119. #ifndef DOSWIN32RPC
  120. if (status == RPC_S_OK)
  121. {
  122. status = InitializeIpPortManager();
  123. ASSERT(status == RPC_S_OK);
  124. }
  125. #endif
  126. status = I_RpcServerSetAddressChangeFn( UpdateAddresses );
  127. ASSERT( 0 == status );
  128. return(status);
  129. }