2 * WPA Supplicant / WinMain() function for Windows-based applications
3 * Copyright (c) 2006, Jouni Malinen <j@w1.fi>
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.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
18 #include "wpa_supplicant_i.h"
21 #define CMDLINE LPWSTR
22 #else /* _WIN32_WCE */
24 #endif /* _WIN32_WCE */
27 int WINAPI
WinMain(HINSTANCE hInstance
, HINSTANCE hPrevInstance
,
28 CMDLINE lpCmdLine
, int nShowCmd
)
31 struct wpa_interface
*ifaces
, *iface
;
32 int iface_count
, exitcode
= -1;
33 struct wpa_params params
;
34 struct wpa_global
*global
;
36 if (os_program_init())
39 os_memset(¶ms
, 0, sizeof(params
));
40 params
.wpa_debug_level
= MSG_MSGDUMP
;
41 params
.wpa_debug_file_path
= "\\Temp\\wpa_supplicant-log.txt";
42 params
.wpa_debug_show_keys
= 1;
44 iface
= ifaces
= os_zalloc(sizeof(struct wpa_interface
));
49 iface
->confname
= "default";
50 iface
->driver
= "ndis";
54 global
= wpa_supplicant_init(¶ms
);
56 printf("Failed to initialize wpa_supplicant\n");
60 for (i
= 0; exitcode
== 0 && i
< iface_count
; i
++) {
61 if ((ifaces
[i
].confname
== NULL
&&
62 ifaces
[i
].ctrl_interface
== NULL
) ||
63 ifaces
[i
].ifname
== NULL
) {
64 if (iface_count
== 1 && (params
.ctrl_interface
||
65 params
.dbus_ctrl_interface
))
70 if (wpa_supplicant_add_iface(global
, &ifaces
[i
]) == NULL
)
75 exitcode
= wpa_supplicant_run(global
);
77 wpa_supplicant_deinit(global
);