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.

78 lines
2.1 KiB

  1. #include <precomp.h>
  2. #include "ErrCtrl.h"
  3. #include "wzcutil.h"
  4. // "wzctool r"; args = "{guid} param"
  5. // requests the service to refresh any of the params
  6. void cmdR(int argc, char *argv[])
  7. {
  8. DWORD rpcStatus = RPC_S_OK;
  9. INTF_ENTRY Intf;
  10. DWORD dwFlags;
  11. struct _SUBCMDS
  12. {
  13. LPCSTR tag;
  14. DWORD flag;
  15. } subCmds[] = {
  16. {"descr", INTF_DESCR},
  17. {"ms", INTF_NDISMEDIA},
  18. {"mt", INTF_NDISMEDIA},
  19. {"pmt", INTF_NDISMEDIA},
  20. {"im", INTF_INFRAMODE},
  21. {"am", INTF_AUTHMODE},
  22. {"ws", INTF_WEPSTATUS},
  23. {"ssid", INTF_SSID},
  24. {"bssid", INTF_BSSID},
  25. {"bssidlist", INTF_BSSIDLIST},
  26. {"reop", INTF_HANDLE},
  27. {"scan", INTF_LIST_SCAN},
  28. {"all", INTF_ALL}
  29. };
  30. INT nSubCmds = sizeof(subCmds) / sizeof (struct _SUBCMDS);
  31. INT i, j;
  32. if (argc < 2)
  33. {
  34. printf("usage: wzctool r guid {");
  35. for (i = 0; i < nSubCmds; i++)
  36. {
  37. if (i != 0)
  38. printf("|");
  39. printf("%s", subCmds[i].tag);
  40. }
  41. printf("}+\n");
  42. return;
  43. }
  44. ZeroMemory(&Intf, sizeof(INTF_ENTRY));
  45. Intf.wszGuid = RpcCAlloc(sizeof(WCHAR)*strlen(argv[0])+1);
  46. wsprintf(Intf.wszGuid, L"%S", argv[0]);
  47. Intf.wszDescr = NULL;
  48. dwFlags = 0;
  49. for (i = 1; i < argc; i++)
  50. {
  51. for (j = 0; j < nSubCmds; j++)
  52. {
  53. if (!_stricmp(argv[i], subCmds[j].tag))
  54. dwFlags |= subCmds[j].flag;
  55. }
  56. }
  57. printf("Calling WZCRefreshInterface with flags 0x%x.\n", dwFlags);
  58. rpcStatus = WZCRefreshInterface(
  59. NULL,
  60. dwFlags,
  61. &Intf,
  62. &dwFlags);
  63. printf("dwOutFlags = 0x%x\n", dwFlags);
  64. if (rpcStatus != RPC_S_OK)
  65. {
  66. printf("call failed with rpcStatus=%d\n", rpcStatus);
  67. }
  68. else
  69. {
  70. printf("call succeeded.\n");
  71. }
  72. WZCDeleteIntfObj(&Intf);
  73. }