2 * WPA Supplicant / WinMain() function for Windows-based applications
3 * Copyright (c) 2006, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
12 #include "wpa_supplicant_i.h"
15 #define CMDLINE LPWSTR
16 #else /* _WIN32_WCE */
18 #endif /* _WIN32_WCE */
21 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
22 CMDLINE lpCmdLine, int nShowCmd)
25 struct wpa_interface *ifaces, *iface;
26 int iface_count, exitcode = -1;
27 struct wpa_params params;
28 struct wpa_global *global;
30 if (os_program_init())
33 os_memset(¶ms, 0, sizeof(params));
34 params.wpa_debug_level = MSG_MSGDUMP;
35 params.wpa_debug_file_path = "\\Temp\\wpa_supplicant-log.txt";
36 params.wpa_debug_show_keys = 1;
38 iface = ifaces = os_zalloc(sizeof(struct wpa_interface));
43 iface->confname = "default";
44 iface->driver = "ndis";
48 global = wpa_supplicant_init(¶ms);
50 printf("Failed to initialize wpa_supplicant\n");
54 for (i = 0; exitcode == 0 && i < iface_count; i++) {
55 if ((ifaces[i].confname == NULL &&
56 ifaces[i].ctrl_interface == NULL) ||
57 ifaces[i].ifname == NULL) {
58 if (iface_count == 1 && (params.ctrl_interface ||
59 params.dbus_ctrl_interface))
64 if (wpa_supplicant_add_iface(global, &ifaces[i]) == NULL)
69 exitcode = wpa_supplicant_run(global);
71 wpa_supplicant_deinit(global);