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.

101 lines
2.8 KiB

  1. #include "pch.h"
  2. #pragma hdrstop
  3. #include "modset.h"
  4. #include "persist.h"
  5. EXTERN_C
  6. VOID
  7. __cdecl
  8. wmain (
  9. IN INT argc,
  10. IN PCWSTR argv[])
  11. {
  12. CModuleTree Tree;
  13. const CModuleTreeEntry* pEntry;
  14. CModuleList::const_iterator iter;
  15. const CModule* pMod;
  16. HrLoadModuleTree (&Tree);
  17. for (pEntry = Tree.begin(); pEntry != Tree.end(); pEntry++)
  18. {
  19. printf("%8d %-16s %-16s %s\n",
  20. pEntry->m_pModule->m_cbFileSize,
  21. pEntry->m_pModule->m_pszFileName,
  22. pEntry->m_pImportModule->m_pszFileName,
  23. (pEntry->m_dwFlags & MTE_DELAY_LOADED) ? "delayed" : "static");
  24. }
  25. // List modules only imported by one other module.
  26. //
  27. CModuleList List;
  28. const CModuleTreeEntry* pScan;
  29. printf("\nModules only imported by one other module:\n");
  30. printf("--------------------------------------------------\n");
  31. for (pEntry = Tree.begin(); pEntry != Tree.end(); pEntry++)
  32. {
  33. UINT CountImported = 1;
  34. for (pScan = Tree.begin(); pScan != Tree.end(); pScan++)
  35. {
  36. if (pScan == pEntry)
  37. {
  38. continue;
  39. }
  40. if (pScan->m_pImportModule == pEntry->m_pImportModule)
  41. {
  42. CountImported++;
  43. break;
  44. }
  45. }
  46. if (1 == CountImported)
  47. {
  48. printf("%-16s only imported by %-16s %s\n",
  49. pEntry->m_pImportModule->m_pszFileName,
  50. pEntry->m_pModule->m_pszFileName,
  51. (pEntry->m_dwFlags & MTE_DELAY_LOADED) ? "delayed" : "static");
  52. }
  53. }
  54. // List modules with circular references to other modules.
  55. //
  56. printf("\nModules with circular references to other modules:\n");
  57. printf("--------------------------------------------------\n");
  58. for (pEntry = Tree.begin(); pEntry != Tree.end(); pEntry++)
  59. {
  60. pScan = Tree.PBinarySearchEntry (
  61. pEntry->m_pImportModule,
  62. pEntry->m_pModule, NULL);
  63. if (pScan != Tree.end())
  64. {
  65. Assert (pScan->m_pModule == pEntry->m_pImportModule);
  66. Assert (pScan->m_pImportModule == pEntry->m_pModule);
  67. printf("%-16s <-> %-16s %s\n",
  68. pEntry->m_pModule->m_pszFileName,
  69. pEntry->m_pImportModule->m_pszFileName,
  70. (pEntry->m_dwFlags & MTE_DELAY_LOADED) ? "delayed" : "static");
  71. }
  72. }
  73. /*
  74. CModuleListSet Set;
  75. for (iter = Tree.Modules.begin();
  76. iter != Tree.Modules.end();
  77. iter++)
  78. {
  79. pMod = *iter;
  80. Assert (pMod);
  81. Tree.HrGetModuleBindings (pMod, GMBF_ADD_TO_MLSET, &Set);
  82. }
  83. Set.DumpSetToConsole();
  84. */
  85. }