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.

97 lines
2.2 KiB

  1. #include "inc.h"
  2. VOID
  3. HandleAddress(
  4. LONG lNumArgs,
  5. PWCHAR rgpwszArgs[]
  6. )
  7. {
  8. DWORD dwResult, i;
  9. PMIB_IPADDRTABLE pTable;
  10. //
  11. // Get the address table
  12. //
  13. dwResult = AllocateAndGetIpAddrTableFromStack(&pTable,
  14. TRUE,
  15. GetProcessHeap(),
  16. HEAP_NO_SERIALIZE);
  17. if(dwResult isnot NO_ERROR)
  18. {
  19. PWCHAR pwszEntry;
  20. pwszEntry = MakeString(STR_ADDRTABLE);
  21. if(pwszEntry)
  22. {
  23. DisplayMessage(EMSG_RETRIEVAL_ERROR1,
  24. dwResult,
  25. pwszEntry);
  26. FreeString(pwszEntry);
  27. }
  28. else
  29. {
  30. DisplayMessage(EMSG_RETRIEVAL_ERROR2,
  31. dwResult);
  32. }
  33. return;
  34. }
  35. if(pTable->dwNumEntries is 0)
  36. {
  37. PWCHAR pwszEntryType;
  38. pwszEntryType = MakeString(TOKEN_ADDRESS);
  39. if(pwszEntryType)
  40. {
  41. DisplayMessage(EMSG_NO_ENTRIES1,
  42. pwszEntryType);
  43. FreeString(pwszEntryType);
  44. }
  45. else
  46. {
  47. DisplayMessage(EMSG_NO_ENTRIES2);
  48. }
  49. HeapFree(GetProcessHeap(),
  50. HEAP_NO_SERIALIZE,
  51. pTable);
  52. return;
  53. }
  54. DisplayMessage(MSG_ADDRTABLE_HDR);
  55. for(i = 0; i < pTable->dwNumEntries; i++)
  56. {
  57. ADDR_STRING rgwcAddr, rgwcMask;
  58. PWCHAR pwszBCast;
  59. NetworkToUnicode(pTable->table[i].dwAddr,
  60. rgwcAddr);
  61. NetworkToUnicode(pTable->table[i].dwMask,
  62. rgwcMask);
  63. pwszBCast = (pTable->table[i].dwBCastAddr)?L"255.255.255.255":L"0.0.0.0";
  64. wprintf(L"%-15s\t%-15s\t%-15s\t\t%-4d\t%d\n",
  65. rgwcAddr,
  66. rgwcMask,
  67. pwszBCast,
  68. pTable->table[i].dwIndex,
  69. pTable->table[i].dwReasmSize);
  70. }
  71. HeapFree(GetProcessHeap(),
  72. HEAP_NO_SERIALIZE,
  73. pTable);
  74. }