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.

654 lines
20 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Remoting support.
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999-2002.
  6. //
  7. //----------------------------------------------------------------------------
  8. #ifndef __DBGRPC_HPP__
  9. #define __DBGRPC_HPP__
  10. #include <wincrypt.h>
  11. #include <security.h>
  12. #ifdef _WIN32_WCE
  13. #include <winsock.h>
  14. #else
  15. #include <winsock2.h>
  16. #include <schannel.h>
  17. #endif
  18. #include <pparse.hpp>
  19. #include <portio.h>
  20. #define DEBUG_SERVER_KEY "Software\\Microsoft\\Debug Engine\\Servers"
  21. #define INT_ALIGN2(Val, Pow2) \
  22. (((Val) + (Pow2) - 1) & ~((Pow2) - 1))
  23. #define PTR_ALIGN2(Type, Ptr, Pow2) \
  24. ((Type)INT_ALIGN2((ULONG64)(Ptr), Pow2))
  25. #define DBGRPC_MAX_IDENTITY 128
  26. typedef ULONG64 DbgRpcObjectId;
  27. //
  28. // Stub functions are indexed out of per-interface tables.
  29. // The function indices are encoded as part interface index
  30. // and part method index.
  31. //
  32. #define DBGRPC_STUB_INDEX_INTERFACE_SHIFT 8
  33. #define DBGRPC_STUB_INDEX_INTERFACE_MAX \
  34. ((1 << (8 * sizeof(USHORT) - DBGRPC_STUB_INDEX_INTERFACE_SHIFT)) - 1)
  35. #define DBGRPC_STUB_INDEX_METHOD_MAX \
  36. ((1 << DBGRPC_STUB_INDEX_INTERFACE_SHIFT) - 1)
  37. #define DBGRPC_STUB_INDEX(Interface, Method) \
  38. ((USHORT)(((Interface) << DBGRPC_STUB_INDEX_INTERFACE_SHIFT) | (Method)))
  39. #define DBGRPC_STUB_INDEX_INTERFACE(StubIndex) \
  40. ((StubIndex) >> DBGRPC_STUB_INDEX_INTERFACE_SHIFT)
  41. #define DBGRPC_STUB_INDEX_METHOD(StubIndex) \
  42. ((StubIndex) & DBGRPC_STUB_INDEX_METHOD_MAX)
  43. //
  44. // Interface indices for stub indices are given here
  45. // rather than generated as they must stay constant
  46. // for compatibility.
  47. //
  48. // IMPORTANT: New interfaces must be added at the end of
  49. // the section for that header. New headers must be
  50. // well separated from each other to allow expansion.
  51. //
  52. enum
  53. {
  54. // The first dbgeng interface must always be zero.
  55. DBGRPC_SIF_IDebugAdvanced,
  56. DBGRPC_SIF_IDebugBreakpoint,
  57. DBGRPC_SIF_IDebugClient,
  58. DBGRPC_SIF_IDebugControl,
  59. DBGRPC_SIF_IDebugDataSpaces,
  60. DBGRPC_SIF_IDebugEventCallbacks,
  61. DBGRPC_SIF_IDebugInputCallbacks,
  62. DBGRPC_SIF_IDebugOutputCallbacks,
  63. DBGRPC_SIF_IDebugRegisters,
  64. DBGRPC_SIF_IDebugSymbolGroup,
  65. DBGRPC_SIF_IDebugSymbols,
  66. DBGRPC_SIF_IDebugSystemObjects,
  67. DBGRPC_SIF_IDebugClient2,
  68. DBGRPC_SIF_IDebugControl2,
  69. DBGRPC_SIF_IDebugDataSpaces2,
  70. DBGRPC_SIF_IDebugSymbols2,
  71. DBGRPC_SIF_IDebugSystemObjects2,
  72. DBGRPC_SIF_IDebugClient3,
  73. DBGRPC_SIF_IDebugSystemObjects3,
  74. DBGRPC_SIF_IDebugControl3,
  75. DBGRPC_SIF_IDebugDataSpaces3,
  76. DBGRPC_SIF_IDebugClient4,
  77. // Add new dbgeng interfaces here.
  78. DBGRPC_SIF_DBGENG_AFTER_LAST,
  79. DBGRPC_SIF_IUserDebugServices = 192,
  80. // Add new dbgsvc interfaces here.
  81. DBGRPC_SIF_DBGSVC_AFTER_LAST,
  82. };
  83. #define DBGRPC_SIF_DBGENG_FIRST 0
  84. #define DBGRPC_SIF_DBGENG_LAST (DBGRPC_SIF_DBGENG_AFTER_LAST - 1)
  85. #define DBGRPC_SIF_DBGSVC_FIRST DBGRPC_SIF_IUserDebugServices
  86. #define DBGRPC_SIF_DBGSVC_LAST (DBGRPC_SIF_DBGSVC_AFTER_LAST - 1)
  87. #define DBGRPC_RETURN 0x0001
  88. #define DBGRPC_NO_RETURN 0x0002
  89. #define DBGRPC_LOCKED 0x0004
  90. struct DbgRpcCall
  91. {
  92. DbgRpcObjectId ObjectId;
  93. USHORT StubIndex;
  94. USHORT Flags;
  95. ULONG InSize;
  96. ULONG OutSize;
  97. HRESULT Status;
  98. ULONG Sequence;
  99. ULONG Reserved1;
  100. };
  101. //
  102. // These functions and tables are automatically generated.
  103. //
  104. typedef HRESULT (*DbgRpcStubFunction)
  105. (IUnknown* If, class DbgRpcConnection* Conn, DbgRpcCall* Call,
  106. PUCHAR InData, PUCHAR OutData);
  107. struct DbgRpcStubFunctionTable
  108. {
  109. DbgRpcStubFunction* Functions;
  110. ULONG Count;
  111. };
  112. // These functions are provided by a caller of dbgrpc with
  113. // implementations specific to the caller.
  114. void DbgRpcInitializeClient(void);
  115. DbgRpcStubFunction DbgRpcGetStub(USHORT StubIndex);
  116. #if DBG
  117. PCSTR DbgRpcGetStubName(USHORT StubIndex);
  118. #endif
  119. HRESULT DbgRpcPreallocProxy(REFIID InterfaceId, PVOID* Interface,
  120. class DbgRpcProxy** Proxy, PULONG IfUnique);
  121. void DbgRpcDeleteProxy(class DbgRpcProxy* Proxy);
  122. HRESULT DbgRpcServerThreadInitialize(void);
  123. void DbgRpcServerThreadUninitialize(void);
  124. void DbgRpcError(char* Format, ...);
  125. //----------------------------------------------------------------------------
  126. //
  127. // DbgRpcTransport.
  128. //
  129. //----------------------------------------------------------------------------
  130. #define MAX_SERVER_NAME MAX_PARAM_VALUE
  131. #define MAX_PASSWORD_BUFFER 32
  132. enum
  133. {
  134. TRANS_TCP,
  135. TRANS_NPIPE,
  136. TRANS_SSL,
  137. TRANS_SPIPE,
  138. TRANS_1394,
  139. TRANS_COM,
  140. TRANS_COUNT
  141. };
  142. extern PCSTR g_DbgRpcTransportNames[TRANS_COUNT];
  143. class DbgRpcTransport : public ParameterStringParser
  144. {
  145. public:
  146. DbgRpcTransport(void)
  147. {
  148. m_ServerName[0] = 0;
  149. m_PasswordGiven = FALSE;
  150. m_Hidden = FALSE;
  151. m_ClientConnect = FALSE;
  152. m_ClientConnectAttempts = 0;
  153. }
  154. virtual ~DbgRpcTransport(void);
  155. virtual ULONG GetNumberParameters(void);
  156. virtual void GetParameter(ULONG Index,
  157. PSTR Name, ULONG NameSize,
  158. PSTR Value, ULONG ValueSize);
  159. virtual void ResetParameters(void);
  160. virtual BOOL SetParameter(PCSTR Name, PCSTR Value);
  161. virtual DbgRpcTransport* Clone(void) = 0;
  162. virtual HRESULT CreateServer(void) = 0;
  163. virtual HRESULT AcceptConnection(DbgRpcTransport** ClientTrans,
  164. PSTR Identity, ULONG IdentitySize) = 0;
  165. virtual HRESULT ConnectServer(void) = 0;
  166. virtual ULONG Read(ULONG Seq, PVOID Buffer, ULONG Len) = 0;
  167. virtual ULONG Write(ULONG Seq, PVOID Buffer, ULONG Len) = 0;
  168. void CloneData(DbgRpcTransport* Trans);
  169. char m_ServerName[MAX_SERVER_NAME];
  170. BOOL m_PasswordGiven;
  171. BOOL m_Hidden;
  172. BOOL m_ClientConnect;
  173. ULONG m_ClientConnectAttempts;
  174. UCHAR m_HashedPassword[MAX_PASSWORD_BUFFER];
  175. };
  176. class DbgRpcTcpTransport : public DbgRpcTransport
  177. {
  178. public:
  179. DbgRpcTcpTransport(void);
  180. virtual ~DbgRpcTcpTransport(void);
  181. // DbgRpcTransport.
  182. virtual ULONG GetNumberParameters(void);
  183. virtual void GetParameter(ULONG Index,
  184. PSTR Name, ULONG NameSize,
  185. PSTR Value, ULONG ValueSize);
  186. virtual void ResetParameters(void);
  187. virtual BOOL SetParameter(PCSTR Name, PCSTR Value);
  188. virtual DbgRpcTransport* Clone(void);
  189. virtual HRESULT CreateServer(void);
  190. virtual HRESULT AcceptConnection(DbgRpcTransport** ClientTrans,
  191. PSTR Identity, ULONG IdentitySize);
  192. virtual HRESULT ConnectServer(void);
  193. virtual ULONG Read(ULONG Seq, PVOID Buffer, ULONG Len);
  194. virtual ULONG Write(ULONG Seq, PVOID Buffer, ULONG Len);
  195. HRESULT InitOl(void);
  196. void GetAddressIdentity(PSOCKADDR_STORAGE Addr,
  197. int AddrLength,
  198. PSTR Identity,
  199. ULONG IdentitySize);
  200. HRESULT CreateServerSocket(void);
  201. HRESULT AcceptSocketConnection(SOCKET ServSock);
  202. HRESULT ConnectSocket(void);
  203. SOCKADDR_STORAGE m_Addr;
  204. int m_AddrLength;
  205. SOCKET m_Sock;
  206. WSAOVERLAPPED m_OlRead, m_OlWrite;
  207. ULONG m_TopPort;
  208. char m_ClientConnectName[MAX_SERVER_NAME];
  209. SOCKADDR_STORAGE m_ClientConnectAddr;
  210. int m_ClientConnectAddrLength;
  211. };
  212. #ifndef _WIN32_WCE
  213. class DbgRpcNamedPipeTransport : public DbgRpcTransport
  214. {
  215. public:
  216. DbgRpcNamedPipeTransport(void)
  217. {
  218. m_Name = g_DbgRpcTransportNames[TRANS_NPIPE];
  219. m_Handle = NULL;
  220. ZeroMemory(&m_ReadOlap, sizeof(m_ReadOlap));
  221. ZeroMemory(&m_WriteOlap, sizeof(m_WriteOlap));
  222. }
  223. virtual ~DbgRpcNamedPipeTransport(void);
  224. // DbgRpcTransport.
  225. virtual ULONG GetNumberParameters(void);
  226. virtual void GetParameter(ULONG Index,
  227. PSTR Name, ULONG NameSize,
  228. PSTR Value, ULONG ValueSize);
  229. virtual void ResetParameters(void);
  230. virtual BOOL SetParameter(PCSTR Name, PCSTR Value);
  231. virtual DbgRpcTransport* Clone(void);
  232. virtual HRESULT CreateServer(void);
  233. virtual HRESULT AcceptConnection(DbgRpcTransport** ClientTrans,
  234. PSTR Identity, ULONG IdentitySize);
  235. virtual HRESULT ConnectServer(void);
  236. virtual ULONG Read(ULONG Seq, PVOID Buffer, ULONG Len);
  237. virtual ULONG Write(ULONG Seq, PVOID Buffer, ULONG Len);
  238. char m_Pipe[MAX_PARAM_VALUE];
  239. HANDLE m_Handle;
  240. OVERLAPPED m_ReadOlap, m_WriteOlap;
  241. };
  242. // This class is a generic schannel-based wrapper for
  243. // a normal transport.
  244. #define DBGRPC_SCHAN_BUFFER 16384
  245. class DbgRpcSecureChannelTransport : public DbgRpcTransport
  246. {
  247. public:
  248. DbgRpcSecureChannelTransport(ULONG ThisTransport,
  249. ULONG BaseTransport);
  250. virtual ~DbgRpcSecureChannelTransport(void);
  251. // DbgRpcTransport.
  252. virtual ULONG GetNumberParameters(void);
  253. virtual void GetParameter(ULONG Index,
  254. PSTR Name, ULONG NameSize,
  255. PSTR Value, ULONG ValueSize);
  256. virtual void ResetParameters(void);
  257. virtual BOOL SetParameter(PCSTR Name, PCSTR Value);
  258. virtual DbgRpcTransport* Clone(void);
  259. virtual HRESULT CreateServer(void);
  260. virtual HRESULT AcceptConnection(DbgRpcTransport** ClientTrans,
  261. PSTR Identity, ULONG IdentitySize);
  262. virtual HRESULT ConnectServer(void);
  263. virtual ULONG Read(ULONG Seq, PVOID Buffer, ULONG Len);
  264. virtual ULONG Write(ULONG Seq, PVOID Buffer, ULONG Len);
  265. // DbgRpcSecureChannelTransport.
  266. HRESULT GetSizes(void);
  267. HRESULT AuthenticateClientConnection(void);
  268. HRESULT InitiateServerConnection(LPSTR pszServerName);
  269. HRESULT AuthenticateServerConnection(void);
  270. void GetNewClientCredentials(void);
  271. void DisconnectFromClient(void);
  272. void DisconnectFromServer(void);
  273. ULONG StreamRead(ULONG Seq, PVOID Buffer, ULONG MaxSize)
  274. {
  275. ULONG Size;
  276. if (m_Stream->Read(Seq, &Size, sizeof(Size)) != sizeof(Size) ||
  277. Size > MaxSize)
  278. {
  279. return 0;
  280. }
  281. return m_Stream->Read(Seq, Buffer, Size);
  282. }
  283. ULONG StreamWrite(ULONG Seq, PVOID Buffer, ULONG Size)
  284. {
  285. if (m_Stream->Write(Seq, &Size, sizeof(Size)) != sizeof(Size))
  286. {
  287. return 0;
  288. }
  289. return m_Stream->Write(Seq, Buffer, Size);
  290. }
  291. ULONG m_ThisTransport;
  292. ULONG m_BaseTransport;
  293. DbgRpcTransport* m_Stream;
  294. SCHANNEL_CRED m_ScCreds;
  295. CredHandle m_Creds;
  296. BOOL m_OwnCreds;
  297. CtxtHandle m_Context;
  298. BOOL m_OwnContext;
  299. ULONG m_Protocol;
  300. char m_User[64];
  301. BOOL m_MachineStore;
  302. UCHAR m_Buffer[DBGRPC_SCHAN_BUFFER];
  303. ULONG m_BufferUsed;
  304. SecPkgContext_StreamSizes m_Sizes;
  305. ULONG m_MaxChunk;
  306. BOOL m_Server;
  307. };
  308. class DbgRpc1394Transport : public DbgRpcTransport
  309. {
  310. public:
  311. DbgRpc1394Transport(void)
  312. {
  313. m_Name = g_DbgRpcTransportNames[TRANS_1394];
  314. m_Handle = NULL;
  315. }
  316. virtual ~DbgRpc1394Transport(void);
  317. // DbgRpcTransport.
  318. virtual ULONG GetNumberParameters(void);
  319. virtual void GetParameter(ULONG Index,
  320. PSTR Name, ULONG NameSize,
  321. PSTR Value, ULONG ValueSize);
  322. virtual void ResetParameters(void);
  323. virtual BOOL SetParameter(PCSTR Name, PCSTR Value);
  324. virtual DbgRpcTransport* Clone(void);
  325. virtual HRESULT CreateServer(void);
  326. virtual HRESULT AcceptConnection(DbgRpcTransport** ClientTrans,
  327. PSTR Identity, ULONG IdentitySize);
  328. virtual HRESULT ConnectServer(void);
  329. virtual ULONG Read(ULONG Seq, PVOID Buffer, ULONG Len);
  330. virtual ULONG Write(ULONG Seq, PVOID Buffer, ULONG Len);
  331. ULONG m_AcceptChannel;
  332. ULONG m_StreamChannel;
  333. HANDLE m_Handle;
  334. };
  335. class DbgRpcComTransport : public DbgRpcTransport
  336. {
  337. public:
  338. DbgRpcComTransport(void)
  339. {
  340. m_Name = g_DbgRpcTransportNames[TRANS_COM];
  341. m_Handle = NULL;
  342. ZeroMemory(&m_ReadOlap, sizeof(m_ReadOlap));
  343. ZeroMemory(&m_WriteOlap, sizeof(m_WriteOlap));
  344. m_Timeout = INFINITE;
  345. }
  346. virtual ~DbgRpcComTransport(void);
  347. // DbgRpcTransport.
  348. virtual ULONG GetNumberParameters(void);
  349. virtual void GetParameter(ULONG Index,
  350. PSTR Name, ULONG NameSize,
  351. PSTR Value, ULONG ValueSize);
  352. virtual void ResetParameters(void);
  353. virtual BOOL SetParameter(PCSTR Name, PCSTR Value);
  354. virtual DbgRpcTransport* Clone(void);
  355. virtual HRESULT CreateServer(void);
  356. virtual HRESULT AcceptConnection(DbgRpcTransport** ClientTrans,
  357. PSTR Identity, ULONG IdentitySize);
  358. virtual HRESULT ConnectServer(void);
  359. virtual ULONG Read(ULONG Seq, PVOID Buffer, ULONG Len);
  360. virtual ULONG Write(ULONG Seq, PVOID Buffer, ULONG Len);
  361. USHORT ScanQueue(UCHAR Chan, PVOID Buffer, USHORT Len);
  362. USHORT ScanPort(UCHAR Chan, PVOID Buffer, USHORT Len,
  363. BOOL ScanForAck, UCHAR AckChan);
  364. USHORT ChanRead(UCHAR Chan, PVOID Buffer, USHORT Len);
  365. USHORT ChanWrite(UCHAR Chan, PVOID Buffer, USHORT Len);
  366. char m_PortName[MAX_PARAM_VALUE];
  367. ULONG m_BaudRate;
  368. UCHAR m_AcceptChannel;
  369. UCHAR m_StreamChannel;
  370. HANDLE m_Handle;
  371. OVERLAPPED m_ReadOlap, m_WriteOlap;
  372. COM_PORT_TYPE m_PortType;
  373. ULONG m_Timeout;
  374. static HRESULT InitializeChannels(void);
  375. static BOOL s_ChanInitialized;
  376. static CRITICAL_SECTION s_QueueLock;
  377. static HANDLE s_QueueChangedEvent;
  378. static LONG s_PortReadOwned;
  379. static CRITICAL_SECTION s_PortWriteLock;
  380. static CRITICAL_SECTION s_WriteAckLock;
  381. static HANDLE s_WriteAckEvent;
  382. static struct DbgRpcComQueue* s_QueueHead;
  383. static struct DbgRpcComQueue* s_QueueTail;
  384. };
  385. #endif // #ifndef _WIN32_WCE
  386. //----------------------------------------------------------------------------
  387. //
  388. // DbgRpcConnection.
  389. //
  390. //----------------------------------------------------------------------------
  391. // Special value indicating no data was actually allocated.
  392. // NULL is not used to make it easy to catch access.
  393. #define DBGRPC_NO_DATA ((PUCHAR)(ULONG64)-1)
  394. #define DBGRPC_CONN_BUFFER_SIZE 4096
  395. #define DBGRPC_CONN_BUFFER_ALIGN 16
  396. #define DBGRPC_CONN_BUFFER_DYNAMIC_LIMIT 1024
  397. #define DBGRPC_IN_ASYNC_CALL 0x00000001
  398. #define DBGRPC_FULL_REMOTE_UNKNOWN 0x00000002
  399. class DbgRpcConnection
  400. {
  401. public:
  402. DbgRpcConnection(class DbgRpcTransport* Trans);
  403. ~DbgRpcConnection(void);
  404. PUCHAR StartCall(DbgRpcCall* Call, DbgRpcObjectId ObjectId,
  405. ULONG StubIndex, ULONG InSize, ULONG OutSize);
  406. HRESULT SendReceive(DbgRpcCall* Call, PUCHAR* InOutData);
  407. void FreeData(PUCHAR Data)
  408. {
  409. if (Data != NULL && Data != DBGRPC_NO_DATA)
  410. {
  411. Free(Data);
  412. }
  413. }
  414. PVOID MallocAligned(ULONG Size);
  415. void FreeAligned(PVOID Ptr);
  416. PVOID Alloc(ULONG Size);
  417. void Free(PVOID Ptr);
  418. void Disconnect(void);
  419. class DbgRpcTransport* m_Trans;
  420. DbgRpcConnection* m_Next;
  421. ULONG m_ThreadId;
  422. UCHAR m_UnalignedBuffer[DBGRPC_CONN_BUFFER_SIZE +
  423. DBGRPC_CONN_BUFFER_ALIGN];
  424. PUCHAR m_Buffer;
  425. ULONG m_BufferUsed;
  426. ULONG m_Flags;
  427. ULONG m_Objects;
  428. };
  429. //----------------------------------------------------------------------------
  430. //
  431. // DbgRpcProxy.
  432. //
  433. //----------------------------------------------------------------------------
  434. class DbgRpcProxy
  435. {
  436. public:
  437. DbgRpcProxy(ULONG InterfaceIndex);
  438. ~DbgRpcProxy(void);
  439. IUnknown* InitializeProxy(DbgRpcConnection* Conn,
  440. DbgRpcObjectId ObjectId,
  441. IUnknown* ExistingProxy);
  442. DbgRpcConnection* m_Conn;
  443. DbgRpcObjectId m_ObjectId;
  444. ULONG m_InterfaceIndex;
  445. ULONG m_OwningThread;
  446. ULONG m_LocalRefs, m_RemoteRefs;
  447. };
  448. //----------------------------------------------------------------------------
  449. //
  450. // DbgRpcClientObject.
  451. //
  452. //----------------------------------------------------------------------------
  453. class DbgRpcClientObject
  454. {
  455. public:
  456. virtual HRESULT RpcInitialize(PSTR ClientIdentity, PSTR TransIdentity,
  457. PVOID* Interface) = 0;
  458. // Base implementation does nothing.
  459. virtual void RpcFinalize(void);
  460. virtual void RpcUninitialize(void) = 0;
  461. };
  462. //----------------------------------------------------------------------------
  463. //
  464. // DbgRpcClientObjectFactory.
  465. //
  466. //----------------------------------------------------------------------------
  467. class DbgRpcClientObjectFactory
  468. {
  469. public:
  470. virtual HRESULT CreateInstance(const GUID* DesiredObject,
  471. DbgRpcClientObject** Object) = 0;
  472. virtual void GetServerTypeName(PSTR Buffer, ULONG BufferSize) = 0;
  473. };
  474. #define DBGRPC_SIMPLE_FACTORY(Class, Guid, Name, CtorArgs) \
  475. class Class##Factory : public DbgRpcClientObjectFactory \
  476. { \
  477. public: \
  478. virtual HRESULT CreateInstance(const GUID* DesiredObject, \
  479. DbgRpcClientObject** Object); \
  480. virtual void GetServerTypeName(PSTR Buffer, ULONG BufferSize); \
  481. }; \
  482. HRESULT \
  483. Class##Factory::CreateInstance(const GUID* DesiredObject, \
  484. DbgRpcClientObject** Object) \
  485. { \
  486. if (DbgIsEqualIID(Guid, *DesiredObject)) \
  487. { \
  488. *Object = (DbgRpcClientObject*)new Class CtorArgs; \
  489. return *Object != NULL ? S_OK : E_OUTOFMEMORY; \
  490. } \
  491. else \
  492. { \
  493. return E_NOINTERFACE; \
  494. } \
  495. } \
  496. void \
  497. Class##Factory::GetServerTypeName(PSTR Buffer, ULONG BufferSize) \
  498. { \
  499. CopyString(Buffer, Name, BufferSize); \
  500. }
  501. //----------------------------------------------------------------------------
  502. //
  503. // Functions.
  504. //
  505. //----------------------------------------------------------------------------
  506. extern CRITICAL_SECTION g_DbgRpcLock;
  507. DbgRpcTransport*
  508. DbgRpcNewTransport(ULONG Trans);
  509. DbgRpcTransport*
  510. DbgRpcInitializeTransport(PCSTR Options);
  511. PVOID
  512. DbgRpcEnumActiveServers(PVOID Cookie,
  513. PULONG Id, PSTR Buffer, ULONG BufferSize);
  514. HRESULT
  515. DbgRpcDisableServer(ULONG Id);
  516. void
  517. DbgRpcDeregisterServers(void);
  518. HRESULT
  519. DbgRpcCreateServerConnection(DbgRpcTransport* Trans,
  520. const GUID* DesiredObject,
  521. IUnknown** ClientObject);
  522. HRESULT
  523. DbgRpcCreateServer(PCSTR Options, DbgRpcClientObjectFactory* Factory,
  524. BOOL Wait);
  525. HRESULT
  526. DbgRpcConnectServer(PCSTR Options, const GUID* DesiredObject,
  527. IUnknown** ClientObject);
  528. DbgRpcConnection*
  529. DbgRpcGetConnection(ULONG ThreadId);
  530. #define DRPC_ERR(Args) g_NtDllCalls.DbgPrint Args
  531. #if 0
  532. #define DBG_RPC
  533. #define DRPC(Args) g_NtDllCalls.DbgPrint Args
  534. #else
  535. #define DRPC(Args)
  536. #endif
  537. #if 0
  538. #define DRPC_REF(Args) g_NtDllCalls.DbgPrint Args
  539. #else
  540. #define DRPC_REF(Args)
  541. #endif
  542. #endif // #ifndef __DBGRPC_HPP__