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.

186 lines
4.5 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1995
  5. //
  6. // File: dstdid.cxx
  7. //
  8. // Contents: Ole NTSD extension routines to display CStdIdentity table
  9. //
  10. // Functions: stdidHelp
  11. // displayStdid
  12. //
  13. //
  14. // History: 06-01-95 BruceMa Created
  15. //
  16. //
  17. //--------------------------------------------------------------------------
  18. #include <ole2int.h>
  19. #include <windows.h>
  20. #include "ole.h"
  21. #include "dipid.h"
  22. #include "dchannel.h"
  23. #include "dstdid.h"
  24. void FormatCLSID(REFGUID rguid, LPSTR lpsz);
  25. ULONG ScanAddr(char *lpsz);
  26. //+-------------------------------------------------------------------------
  27. //
  28. // Function: stdidHelp
  29. //
  30. // Synopsis: Display a menu for the command 'id'
  31. //
  32. // Arguments: -
  33. //
  34. // Returns: -
  35. //
  36. // History: 07-Mar-95 BruceMa Created
  37. //
  38. //--------------------------------------------------------------------------
  39. void stdidHelp(PNTSD_EXTENSION_APIS lpExtensionApis)
  40. {
  41. Printf("\nid - Display entire CStdIdentity table:\n");
  42. Printf("addr oid tid pUnkControl\n");
  43. Printf("...\n\n");
  44. Printf("\nid <stdidAdr> - Display CStdIdentity entry:\n");
  45. Printf("oid mrshlFlags 1stIPID chnlBfr nestedCalls mrshlTime pUnkOuter [pIEC] strongRefs\n");
  46. Printf("...\n\n");
  47. }
  48. //+-------------------------------------------------------------------------
  49. //
  50. // Function: displayStdid
  51. //
  52. // Synopsis: Display the CStdIdentify table
  53. //
  54. // Arguments: [hProcess] - Handle of this process
  55. // [lpExtensionApis] - Table of extension functions
  56. //
  57. // Returns: -
  58. //
  59. // History: 07-Mar-95 BruceMa Created
  60. //
  61. //--------------------------------------------------------------------------
  62. void displayStdid(HANDLE hProcess,
  63. PNTSD_EXTENSION_APIS lpExtensionApis,
  64. ULONG p)
  65. {
  66. SIDArray stdidtbl;
  67. int nEnt;
  68. IDENTRY *pStdEntries;
  69. IDENTRY stdEntry;
  70. SStdIdentity stdid;
  71. char szOID[CLSIDSTR_MAX];
  72. SRpcChannelBuffer chanBfr;
  73. // Read the standard identity table
  74. ReadMem(&stdidtbl, p, sizeof(SIDArray));
  75. // Do over entries in this table
  76. for (nEnt = 0, pStdEntries = (IDENTRY *) stdidtbl.m_afv.m_pData;
  77. nEnt < stdidtbl.m_afv.m_nSize;
  78. nEnt++, pStdEntries++)
  79. {
  80. // Read the next entry
  81. ReadMem(&stdEntry, pStdEntries, sizeof(IDENTRY));
  82. // CStdIdentity address
  83. Printf("%x ", stdEntry.m_pStdID);
  84. // Display the object identifier
  85. FormatCLSID(stdEntry.m_oid, szOID);
  86. Printf("%s ", szOID);
  87. // The thread ID
  88. Printf("%3x ", stdEntry.m_tid);
  89. // pUnkControl
  90. Printf("%x\n", stdEntry.m_pUnkControl);
  91. }
  92. Printf("\n");
  93. }
  94. //+-------------------------------------------------------------------------
  95. //
  96. // Function: displayStdidEntry
  97. //
  98. // Synopsis: Display an entry in the CStdIdentify table
  99. //
  100. // Arguments: [hProcess] - Handle of this process
  101. // [lpExtensionApis] - Table of extension functions
  102. //
  103. // Returns: -
  104. //
  105. // History: 07-Mar-95 BruceMa Created
  106. //
  107. //--------------------------------------------------------------------------
  108. void displayStdidEntry(HANDLE hProcess,
  109. PNTSD_EXTENSION_APIS lpExtensionApis,
  110. ULONG p,
  111. char *arg)
  112. {
  113. ULONG pAdr;
  114. SStdIdentity stdid;
  115. char szOID[CLSIDSTR_MAX];
  116. // Check for help
  117. if (arg[0] == '?')
  118. {
  119. Printf("oid mrshlFlags 1stIPID chnlBfr nestedCalls mrshlTime pUnkOuter [pIEC] strongRefs\n");
  120. return;
  121. }
  122. // Read the standard identity entry
  123. pAdr = ScanAddr(arg);
  124. ReadMem(&stdid, pAdr, sizeof(SStdIdentity));
  125. // Display the object identifier
  126. FormatCLSID(stdid.m_oid, szOID);
  127. Printf("%s ", szOID);
  128. // Marshal flags
  129. Printf("%08x ", stdid._dwFlags);
  130. // First IPID
  131. Printf("%d.%d ", stdid._iFirstIPID >> 16, stdid._iFirstIPID & 0xffff);
  132. // Address of CRpcChannelBuffer
  133. Printf("%x ", stdid._pChnl);
  134. // Count of nested calls
  135. Printf("%d ", stdid._cNestedCalls);
  136. // Marshal time
  137. Printf("%d ", stdid._dwMarshalTime);
  138. // Address of pUnkOuter
  139. Printf("%x ", stdid.m_pUnkOuter);
  140. // Address of IExternalConnection (if present)
  141. if (stdid.m_pIEC)
  142. {
  143. Printf("%x ", stdid.m_pIEC);
  144. }
  145. // Count of strong references
  146. Printf("%d\n", stdid.m_cStrongRefs);
  147. }