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.

152 lines
3.4 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1995
  5. //
  6. // File: dchannel.cxx
  7. //
  8. // Contents: Ole NTSD extension routines to display the RPC channel
  9. // associated with a remote handler. This includes the
  10. // interestiong pieces of CRpcChannelBuffer, CRpcService and
  11. // CEndPoint.
  12. //
  13. // Functions: channelHelp
  14. // displayChannel
  15. //
  16. //
  17. // History: 06-01-95 BruceMa Created
  18. //
  19. //
  20. //--------------------------------------------------------------------------
  21. #include <ole2int.h>
  22. #include <windows.h>
  23. #include "ole.h"
  24. #include "dipid.h"
  25. #include "dchannel.h"
  26. #include "dstdid.h"
  27. void FormatCLSID(REFGUID rguid, LPSTR lpsz);
  28. //+-------------------------------------------------------------------------
  29. //
  30. // Function: channelHelp
  31. //
  32. // Synopsis: Display a menu for the command 'ch'
  33. //
  34. // Arguments: -
  35. //
  36. // Returns: -
  37. //
  38. // History: 07-Mar-95 BruceMa Created
  39. //
  40. //--------------------------------------------------------------------------
  41. void channelHelp(PNTSD_EXTENSION_APIS lpExtensionApis)
  42. {
  43. Printf("\nch addr - Display a CRpcChannelBuffer object:\n");
  44. Printf("refs stdid state clientThread processLocal? handle OXID IPID destCtx\n");
  45. }
  46. //+-------------------------------------------------------------------------
  47. //
  48. // Function: displayChannel
  49. //
  50. // Synopsis: Display an RPC channel starting from the address of the
  51. // CRpcChannelBuffer object
  52. //
  53. // Arguments: [hProcess] - Handle of this process
  54. // [lpExtensionApis] - Table of extension functions
  55. // [pChnlBfr] - Address of channel buffer
  56. //
  57. // Returns: -
  58. //
  59. // History: 07-Mar-95 BruceMa Created
  60. //
  61. //--------------------------------------------------------------------------
  62. void displayChannel(HANDLE hProcess,
  63. PNTSD_EXTENSION_APIS lpExtensionApis,
  64. ULONG pChannel,
  65. char *arg)
  66. {
  67. SRpcChannelBuffer chnlBfr;
  68. SStdIdentity stdid;
  69. SOXIDEntry oxid;
  70. SIPIDEntry ipid;
  71. char szClsid[CLSIDSTR_MAX];
  72. // Check for help
  73. if (arg[0] == '?')
  74. {
  75. Printf("refs stdid state clientThread processLocal? handle OXID IPID destCtx\n");
  76. return;
  77. }
  78. // Read the rpc channel buffer
  79. ReadMem(&chnlBfr, pChannel, sizeof(SRpcChannelBuffer));
  80. // References
  81. Printf("%d ", chnlBfr.ref_count);
  82. // Standard identity object address
  83. Printf("%x ", chnlBfr.pStdId);
  84. // State
  85. switch (chnlBfr.state)
  86. {
  87. case client_cs:
  88. Printf("client_cs ");
  89. break;
  90. case proxy_cs:
  91. Printf("proxy_cs ");
  92. break;
  93. case server_cs:
  94. Printf("server_cs ");
  95. break;
  96. case freethreaded_cs:
  97. Printf("freethreaded_cs ");
  98. break;
  99. default:
  100. Printf("unknown ");
  101. break;
  102. }
  103. // Client thread
  104. Printf("%3x ", chnlBfr.client_thread);
  105. // Process local
  106. if (chnlBfr.process_local)
  107. {
  108. Printf("local ");
  109. }
  110. else
  111. {
  112. Printf("not-local ");
  113. }
  114. // Handle
  115. Printf("%x ", chnlBfr.handle);
  116. // OXID entry address
  117. Printf("%x ", chnlBfr.pOXIDEntry);
  118. // IPID entry address
  119. Printf("%x ", chnlBfr.pIPIDEntry);
  120. // Destination context
  121. Printf("%x\n", chnlBfr.iDestCtx);
  122. }