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.

109 lines
3.0 KiB

  1. #include <precomp.h>
  2. #include "ErrCtrl.h"
  3. #include "wzcutil.h"
  4. // "wzctool q"; args = "{guid}"
  5. // prints all the info available on the interface "{guid}"
  6. void cmdQ(int argc, char *argv[])
  7. {
  8. DWORD rpcStatus = RPC_S_OK;
  9. INTF_ENTRY Intf;
  10. DWORD dwOutFlags;
  11. // expect "{guid}"
  12. if (argc < 1)
  13. {
  14. printf("usage: wzctool q guid\n");
  15. return;
  16. }
  17. ZeroMemory(&Intf, sizeof(INTF_ENTRY));
  18. Intf.wszGuid = RpcCAlloc(sizeof(WCHAR)*strlen(argv[0])+1);
  19. wsprintf(Intf.wszGuid, L"%S", argv[0]);
  20. Intf.wszDescr = NULL;
  21. rpcStatus = WZCQueryInterface(
  22. NULL,
  23. INTF_ALL,
  24. &Intf,
  25. &dwOutFlags);
  26. if (rpcStatus != RPC_S_OK)
  27. {
  28. printf("call failed with rpcStatus=%d\n", rpcStatus);
  29. }
  30. else
  31. {
  32. // print Descr
  33. printf("Description: %S\n", (dwOutFlags & INTF_DESCR) ? Intf.wszDescr : L"Err");
  34. // print Media State
  35. printf("MediaState: ");
  36. if (dwOutFlags & INTF_NDISMEDIA)
  37. printf("%d\n", Intf.ulMediaState);
  38. else
  39. printf("#Err#\n");
  40. // print Media Type
  41. printf("MediaType: ");
  42. if (dwOutFlags & INTF_NDISMEDIA)
  43. printf("%d\n", Intf.ulMediaType);
  44. else
  45. printf("#Err#\n");
  46. // print Physical Media Type
  47. printf("PhysicalMediaType: ");
  48. if (dwOutFlags & INTF_NDISMEDIA)
  49. printf("%d\n", Intf.ulPhysicalMediaType);
  50. else
  51. printf("#Err#\n");
  52. // print Configuration Mode
  53. printf("ControlFlags: ");
  54. if (dwOutFlags & INTF_ALL_FLAGS)
  55. printf("0x%08x\n", Intf.dwCtlFlags);
  56. else
  57. printf("#Err#\n");
  58. // print Infrastructure Mode
  59. printf("InfrastructureMode: ");
  60. if (dwOutFlags & INTF_INFRAMODE)
  61. printf("%d\n", Intf.nInfraMode);
  62. else
  63. printf("#Err#\n");
  64. // print Authentication Mode
  65. printf("AuthenticationMode: ");
  66. if (dwOutFlags & INTF_AUTHMODE)
  67. printf("%d\n", Intf.nAuthMode);
  68. else
  69. printf("#Err#\n");
  70. // printf WEP Status
  71. printf("WEP Status: ");
  72. if (dwOutFlags & INTF_WEPSTATUS)
  73. printf("%d\n", Intf.nWepStatus);
  74. else
  75. printf("#Err#\n");
  76. // print BSSID
  77. printf("BSSID: ");
  78. PrintMACAddress(&Intf.rdBSSID, !(dwOutFlags & INTF_BSSID));
  79. printf("\n");
  80. // print SSID
  81. printf("SSID: ");
  82. PrintSSID(&Intf.rdSSID, !(dwOutFlags & INTF_SSID));
  83. printf("\n");
  84. // print BSSIDList
  85. printf("Visible networks: ");
  86. PrintConfigList(&Intf.rdBSSIDList, !(dwOutFlags & INTF_BSSIDLIST));
  87. printf("\n");
  88. // print StSSIDList;
  89. printf("Preferred networks: ");
  90. PrintConfigList(&Intf.rdStSSIDList, !(dwOutFlags & INTF_PREFLIST));
  91. printf("\n");
  92. }
  93. WZCDeleteIntfObj(&Intf);
  94. }