Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * WPA Supplicant / WinMain() function for Windows-based applications
  3. * Copyright (c) 2006, Jouni Malinen <j@w1.fi>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. *
  9. * Alternatively, this software may be distributed under the terms of BSD
  10. * license.
  11. *
  12. * See README and COPYING for more details.
  13. */
  14. #include "includes.h"
  15. #include "common.h"
  16. #include "wpa_supplicant_i.h"
  17. #ifdef _WIN32_WCE
  18. #define CMDLINE LPWSTR
  19. #else /* _WIN32_WCE */
  20. #define CMDLINE LPSTR
  21. #endif /* _WIN32_WCE */
  22. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  23. CMDLINE lpCmdLine, int nShowCmd)
  24. {
  25. int i;
  26. struct wpa_interface *ifaces, *iface;
  27. int iface_count, exitcode = -1;
  28. struct wpa_params params;
  29. struct wpa_global *global;
  30. if (os_program_init())
  31. return -1;
  32. os_memset(&params, 0, sizeof(params));
  33. params.wpa_debug_level = MSG_MSGDUMP;
  34. params.wpa_debug_file_path = "\\Temp\\wpa_supplicant-log.txt";
  35. params.wpa_debug_show_keys = 1;
  36. iface = ifaces = os_zalloc(sizeof(struct wpa_interface));
  37. if (ifaces == NULL)
  38. return -1;
  39. iface_count = 1;
  40. iface->confname = "default";
  41. iface->driver = "ndis";
  42. iface->ifname = "";
  43. exitcode = 0;
  44. global = wpa_supplicant_init(&params);
  45. if (global == NULL) {
  46. printf("Failed to initialize wpa_supplicant\n");
  47. exitcode = -1;
  48. }
  49. for (i = 0; exitcode == 0 && i < iface_count; i++) {
  50. if ((ifaces[i].confname == NULL &&
  51. ifaces[i].ctrl_interface == NULL) ||
  52. ifaces[i].ifname == NULL) {
  53. if (iface_count == 1 && (params.ctrl_interface ||
  54. params.dbus_ctrl_interface))
  55. break;
  56. exitcode = -1;
  57. break;
  58. }
  59. if (wpa_supplicant_add_iface(global, &ifaces[i]) == NULL)
  60. exitcode = -1;
  61. }
  62. if (exitcode == 0)
  63. exitcode = wpa_supplicant_run(global);
  64. wpa_supplicant_deinit(global);
  65. os_free(ifaces);
  66. os_program_deinit();
  67. return exitcode;
  68. }