2 * WPA Supplicant / Configuration backend: Windows registry
3 * Copyright (c) 2003-2008, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
8 * This file implements a configuration backend for Windows registry. All the
9 * configuration information is stored in the registry and the format for
10 * network configuration fields is same as described in the sample
11 * configuration file, wpa_supplicant.conf.
13 * Configuration data is in
14 * \a HKEY_LOCAL_MACHINE\\SOFTWARE\\%wpa_supplicant\\configs
15 * key. Each configuration profile has its own key under this. In terms of text
16 * files, each profile would map to a separate text file with possibly multiple
17 * networks. Under each profile, there is a networks key that lists all
18 * networks as a subkey. Each network has set of values in the same way as
19 * network block in the configuration file. In addition, blobs subkey has
20 * possible blobs as values.
22 * Example network configuration block:
24 HKEY_LOCAL_MACHINE\SOFTWARE\wpa_supplicant\configs\test\networks\0000
37 #define WPA_KEY_ROOT HKEY_LOCAL_MACHINE
39 #ifndef WPA_KEY_PREFIX
40 #define WPA_KEY_PREFIX TEXT("SOFTWARE\\wpa_supplicant")
50 static int wpa_config_read_blobs(struct wpa_config *config, HKEY hk)
52 struct wpa_config_blob *blob;
58 ret = RegOpenKeyEx(hk, TEXT("blobs"), 0, KEY_QUERY_VALUE, &bhk);
59 if (ret != ERROR_SUCCESS) {
60 wpa_printf(MSG_DEBUG, "Could not open wpa_supplicant config "
62 return 0; /* assume no blobs */
69 DWORD namelen, datalen, type;
72 datalen = sizeof(data);
73 ret = RegEnumValue(bhk, i, name, &namelen, NULL, &type,
74 (LPBYTE) data, &datalen);
76 if (ret == ERROR_NO_MORE_ITEMS)
79 if (ret != ERROR_SUCCESS) {
80 wpa_printf(MSG_DEBUG, "RegEnumValue failed: 0x%x",
85 if (namelen >= TNAMELEN)
86 namelen = TNAMELEN - 1;
87 name[namelen] = TEXT('\0');
88 wpa_unicode2ascii_inplace(name);
90 if (datalen >= sizeof(data))
91 datalen = sizeof(data) - 1;
93 wpa_printf(MSG_MSGDUMP, "blob %d: field='%s' len %d",
94 (int) i, name, (int) datalen);
96 blob = os_zalloc(sizeof(*blob));
101 blob->name = os_strdup((char *) name);
102 blob->data = os_malloc(datalen);
103 if (blob->name == NULL || blob->data == NULL) {
104 wpa_config_free_blob(blob);
108 os_memcpy(blob->data, data, datalen);
111 wpa_config_set_blob(config, blob);
116 return errors ? -1 : 0;
120 static int wpa_config_read_reg_dword(HKEY hk, const TCHAR *name, int *_val)
125 buflen = sizeof(val);
126 ret = RegQueryValueEx(hk, name, NULL, NULL, (LPBYTE) &val, &buflen);
127 if (ret == ERROR_SUCCESS && buflen == sizeof(val)) {
128 wpa_printf(MSG_DEBUG, TSTR "=%d", name, (int) val);
137 static char * wpa_config_read_reg_string(HKEY hk, const TCHAR *name)
144 ret = RegQueryValueEx(hk, name, NULL, NULL, NULL, &buflen);
145 if (ret != ERROR_SUCCESS)
147 val = os_malloc(buflen);
151 ret = RegQueryValueEx(hk, name, NULL, NULL, (LPBYTE) val, &buflen);
152 if (ret != ERROR_SUCCESS) {
157 wpa_unicode2ascii_inplace(val);
158 wpa_printf(MSG_DEBUG, TSTR "=%s", name, (char *) val);
164 static int wpa_config_read_global_uuid(struct wpa_config *config, HKEY hk)
169 str = wpa_config_read_reg_string(hk, TEXT("uuid"));
173 if (uuid_str2bin(str, config->uuid))
182 static int wpa_config_read_global_os_version(struct wpa_config *config,
188 str = wpa_config_read_reg_string(hk, TEXT("os_version"));
192 if (hexstr2bin(str, config->os_version, 4))
199 #endif /* CONFIG_WPS */
202 static int wpa_config_read_global(struct wpa_config *config, HKEY hk)
207 wpa_config_read_reg_dword(hk, TEXT("ap_scan"), &config->ap_scan);
208 wpa_config_read_reg_dword(hk, TEXT("fast_reauth"),
209 &config->fast_reauth);
210 wpa_config_read_reg_dword(hk, TEXT("dot11RSNAConfigPMKLifetime"),
211 (int *) &config->dot11RSNAConfigPMKLifetime);
212 wpa_config_read_reg_dword(hk,
213 TEXT("dot11RSNAConfigPMKReauthThreshold"),
215 &config->dot11RSNAConfigPMKReauthThreshold);
216 wpa_config_read_reg_dword(hk, TEXT("dot11RSNAConfigSATimeout"),
217 (int *) &config->dot11RSNAConfigSATimeout);
218 wpa_config_read_reg_dword(hk, TEXT("update_config"),
219 &config->update_config);
221 if (wpa_config_read_reg_dword(hk, TEXT("eapol_version"),
222 &config->eapol_version) == 0) {
223 if (config->eapol_version < 1 ||
224 config->eapol_version > 2) {
225 wpa_printf(MSG_ERROR, "Invalid EAPOL version (%d)",
226 config->eapol_version);
231 config->ctrl_interface = wpa_config_read_reg_string(
232 hk, TEXT("ctrl_interface"));
235 if (wpa_config_read_global_uuid(config, hk))
237 config->device_name = wpa_config_read_reg_string(
238 hk, TEXT("device_name"));
239 config->manufacturer = wpa_config_read_reg_string(
240 hk, TEXT("manufacturer"));
241 config->model_name = wpa_config_read_reg_string(
242 hk, TEXT("model_name"));
243 config->serial_number = wpa_config_read_reg_string(
244 hk, TEXT("serial_number"));
246 char *t = wpa_config_read_reg_string(
247 hk, TEXT("device_type"));
248 if (t && wps_dev_type_str2bin(t, config->device_type))
252 config->config_methods = wpa_config_read_reg_string(
253 hk, TEXT("config_methods"));
254 if (wpa_config_read_global_os_version(config, hk))
256 wpa_config_read_reg_dword(hk, TEXT("wps_cred_processing"),
257 &config->wps_cred_processing);
258 #endif /* CONFIG_WPS */
260 config->p2p_ssid_postfix = wpa_config_read_reg_string(
261 hk, TEXT("p2p_ssid_postfix"));
262 wpa_config_read_reg_dword(hk, TEXT("p2p_group_idle"),
263 (int *) &config->p2p_group_idle);
264 #endif /* CONFIG_P2P */
266 wpa_config_read_reg_dword(hk, TEXT("bss_max_count"),
267 (int *) &config->bss_max_count);
268 wpa_config_read_reg_dword(hk, TEXT("filter_ssids"),
269 &config->filter_ssids);
270 wpa_config_read_reg_dword(hk, TEXT("max_num_sta"),
271 (int *) &config->max_num_sta);
272 wpa_config_read_reg_dword(hk, TEXT("disassoc_low_ack"),
273 (int *) &config->disassoc_low_ack);
275 wpa_config_read_reg_dword(hk, TEXT("okc"), &config->okc);
276 wpa_config_read_reg_dword(hk, TEXT("pmf"), &val);
279 return errors ? -1 : 0;
283 static struct wpa_ssid * wpa_config_read_network(HKEY hk, const TCHAR *netw,
289 struct wpa_ssid *ssid;
292 ret = RegOpenKeyEx(hk, netw, 0, KEY_QUERY_VALUE, &nhk);
293 if (ret != ERROR_SUCCESS) {
294 wpa_printf(MSG_DEBUG, "Could not open wpa_supplicant config "
295 "network '" TSTR "'", netw);
299 wpa_printf(MSG_MSGDUMP, "Start of a new network '" TSTR "'", netw);
300 ssid = os_zalloc(sizeof(*ssid));
307 wpa_config_set_network_defaults(ssid);
310 TCHAR name[255], data[1024];
311 DWORD namelen, datalen, type;
314 datalen = sizeof(data);
315 ret = RegEnumValue(nhk, i, name, &namelen, NULL, &type,
316 (LPBYTE) data, &datalen);
318 if (ret == ERROR_NO_MORE_ITEMS)
321 if (ret != ERROR_SUCCESS) {
322 wpa_printf(MSG_ERROR, "RegEnumValue failed: 0x%x",
329 name[namelen] = TEXT('\0');
333 data[datalen] = TEXT('\0');
335 wpa_unicode2ascii_inplace(name);
336 wpa_unicode2ascii_inplace(data);
337 if (wpa_config_set(ssid, (char *) name, (char *) data, 0) < 0)
343 if (ssid->passphrase) {
345 wpa_printf(MSG_ERROR, "Both PSK and passphrase "
346 "configured for network '" TSTR "'.", netw);
349 wpa_config_update_psk(ssid);
352 if ((ssid->group_cipher & WPA_CIPHER_CCMP) &&
353 !(ssid->pairwise_cipher & WPA_CIPHER_CCMP) &&
354 !(ssid->pairwise_cipher & WPA_CIPHER_NONE)) {
355 /* Group cipher cannot be stronger than the pairwise cipher. */
356 wpa_printf(MSG_DEBUG, "Removed CCMP from group cipher "
357 "list since it was not allowed for pairwise "
358 "cipher for network '" TSTR "'.", netw);
359 ssid->group_cipher &= ~WPA_CIPHER_CCMP;
363 wpa_config_free_ssid(ssid);
371 static int wpa_config_read_networks(struct wpa_config *config, HKEY hk)
374 struct wpa_ssid *ssid, *tail = NULL, *head = NULL;
379 ret = RegOpenKeyEx(hk, TEXT("networks"), 0, KEY_ENUMERATE_SUB_KEYS,
381 if (ret != ERROR_SUCCESS) {
382 wpa_printf(MSG_ERROR, "Could not open wpa_supplicant networks "
392 ret = RegEnumKeyEx(nhk, i, name, &namelen, NULL, NULL, NULL,
395 if (ret == ERROR_NO_MORE_ITEMS)
398 if (ret != ERROR_SUCCESS) {
399 wpa_printf(MSG_DEBUG, "RegEnumKeyEx failed: 0x%x",
406 name[namelen] = '\0';
408 ssid = wpa_config_read_network(nhk, name, i);
410 wpa_printf(MSG_ERROR, "Failed to parse network "
411 "profile '%s'.", name);
421 if (wpa_config_add_prio_network(config, ssid)) {
422 wpa_printf(MSG_ERROR, "Failed to add network profile "
423 "'%s' to priority list.", name);
433 return errors ? -1 : 0;
437 struct wpa_config * wpa_config_read(const char *name)
441 struct wpa_config *config;
445 config = wpa_config_alloc_empty(NULL, NULL);
448 wpa_printf(MSG_DEBUG, "Reading configuration profile '%s'", name);
451 _snwprintf(buf, 256, WPA_KEY_PREFIX TEXT("\\configs\\%S"), name);
453 os_snprintf(buf, 256, WPA_KEY_PREFIX TEXT("\\configs\\%s"), name);
456 ret = RegOpenKeyEx(WPA_KEY_ROOT, buf, 0, KEY_QUERY_VALUE, &hk);
457 if (ret != ERROR_SUCCESS) {
458 wpa_printf(MSG_ERROR, "Could not open wpa_supplicant "
459 "configuration registry HKLM\\" TSTR, buf);
464 if (wpa_config_read_global(config, hk))
467 if (wpa_config_read_networks(config, hk))
470 if (wpa_config_read_blobs(config, hk))
473 wpa_config_debug_dump_networks(config);
478 wpa_config_free(config);
486 static int wpa_config_write_reg_dword(HKEY hk, const TCHAR *name, int val,
493 RegDeleteValue(hk, name);
497 ret = RegSetValueEx(hk, name, 0, REG_DWORD, (LPBYTE) &_val,
499 if (ret != ERROR_SUCCESS) {
500 wpa_printf(MSG_ERROR, "WINREG: Failed to set %s=%d: error %d",
501 name, val, (int) GetLastError());
509 static int wpa_config_write_reg_string(HKEY hk, const char *name,
515 _name = wpa_strdup_tchar(name);
520 RegDeleteValue(hk, _name);
525 _val = wpa_strdup_tchar(val);
530 ret = RegSetValueEx(hk, _name, 0, REG_SZ, (BYTE *) _val,
531 (os_strlen(val) + 1) * sizeof(TCHAR));
532 if (ret != ERROR_SUCCESS) {
533 wpa_printf(MSG_ERROR, "WINREG: Failed to set %s='%s': "
534 "error %d", name, val, (int) GetLastError());
546 static int wpa_config_write_global(struct wpa_config *config, HKEY hk)
548 #ifdef CONFIG_CTRL_IFACE
549 wpa_config_write_reg_string(hk, "ctrl_interface",
550 config->ctrl_interface);
551 #endif /* CONFIG_CTRL_IFACE */
553 wpa_config_write_reg_dword(hk, TEXT("eapol_version"),
554 config->eapol_version,
555 DEFAULT_EAPOL_VERSION);
556 wpa_config_write_reg_dword(hk, TEXT("ap_scan"), config->ap_scan,
558 wpa_config_write_reg_dword(hk, TEXT("fast_reauth"),
559 config->fast_reauth, DEFAULT_FAST_REAUTH);
560 wpa_config_write_reg_dword(hk, TEXT("dot11RSNAConfigPMKLifetime"),
561 config->dot11RSNAConfigPMKLifetime, 0);
562 wpa_config_write_reg_dword(hk,
563 TEXT("dot11RSNAConfigPMKReauthThreshold"),
564 config->dot11RSNAConfigPMKReauthThreshold,
566 wpa_config_write_reg_dword(hk, TEXT("dot11RSNAConfigSATimeout"),
567 config->dot11RSNAConfigSATimeout, 0);
568 wpa_config_write_reg_dword(hk, TEXT("update_config"),
569 config->update_config,
572 if (!is_nil_uuid(config->uuid)) {
574 uuid_bin2str(config->uuid, buf, sizeof(buf));
575 wpa_config_write_reg_string(hk, "uuid", buf);
577 wpa_config_write_reg_string(hk, "device_name", config->device_name);
578 wpa_config_write_reg_string(hk, "manufacturer", config->manufacturer);
579 wpa_config_write_reg_string(hk, "model_name", config->model_name);
580 wpa_config_write_reg_string(hk, "model_number", config->model_number);
581 wpa_config_write_reg_string(hk, "serial_number",
582 config->serial_number);
584 char _buf[WPS_DEV_TYPE_BUFSIZE], *buf;
585 buf = wps_dev_type_bin2str(config->device_type,
587 wpa_config_write_reg_string(hk, "device_type", buf);
589 wpa_config_write_reg_string(hk, "config_methods",
590 config->config_methods);
591 if (WPA_GET_BE32(config->os_version)) {
593 os_snprintf(vbuf, sizeof(vbuf), "%08x",
594 WPA_GET_BE32(config->os_version));
595 wpa_config_write_reg_string(hk, "os_version", vbuf);
597 wpa_config_write_reg_dword(hk, TEXT("wps_cred_processing"),
598 config->wps_cred_processing, 0);
599 #endif /* CONFIG_WPS */
601 wpa_config_write_reg_string(hk, "p2p_ssid_postfix",
602 config->p2p_ssid_postfix);
603 wpa_config_write_reg_dword(hk, TEXT("p2p_group_idle"),
604 config->p2p_group_idle, 0);
605 #endif /* CONFIG_P2P */
607 wpa_config_write_reg_dword(hk, TEXT("bss_max_count"),
608 config->bss_max_count,
609 DEFAULT_BSS_MAX_COUNT);
610 wpa_config_write_reg_dword(hk, TEXT("filter_ssids"),
611 config->filter_ssids, 0);
612 wpa_config_write_reg_dword(hk, TEXT("max_num_sta"),
613 config->max_num_sta, DEFAULT_MAX_NUM_STA);
614 wpa_config_write_reg_dword(hk, TEXT("disassoc_low_ack"),
615 config->disassoc_low_ack, 0);
617 wpa_config_write_reg_dword(hk, TEXT("okc"), config->okc, 0);
618 wpa_config_write_reg_dword(hk, TEXT("pmf"), config->pmf, 0);
624 static int wpa_config_delete_subkeys(HKEY hk, const TCHAR *key)
630 ret = RegOpenKeyEx(hk, key, 0, KEY_ENUMERATE_SUB_KEYS | DELETE, &nhk);
631 if (ret != ERROR_SUCCESS) {
632 wpa_printf(MSG_DEBUG, "WINREG: Could not open key '" TSTR
633 "' for subkey deletion: error 0x%x (%d)", key,
634 (unsigned int) ret, (int) GetLastError());
643 ret = RegEnumKeyEx(nhk, i, name, &namelen, NULL, NULL, NULL,
646 if (ret == ERROR_NO_MORE_ITEMS)
649 if (ret != ERROR_SUCCESS) {
650 wpa_printf(MSG_DEBUG, "RegEnumKeyEx failed: 0x%x (%d)",
651 (unsigned int) ret, (int) GetLastError());
657 name[namelen] = TEXT('\0');
659 ret = RegDeleteKey(nhk, name);
660 if (ret != ERROR_SUCCESS) {
661 wpa_printf(MSG_DEBUG, "RegDeleteKey failed: 0x%x (%d)",
662 (unsigned int) ret, (int) GetLastError());
669 return errors ? -1 : 0;
673 static void write_str(HKEY hk, const char *field, struct wpa_ssid *ssid)
675 char *value = wpa_config_get(ssid, field);
678 wpa_config_write_reg_string(hk, field, value);
683 static void write_int(HKEY hk, const char *field, int value, int def)
688 os_snprintf(val, sizeof(val), "%d", value);
689 wpa_config_write_reg_string(hk, field, val);
693 static void write_bssid(HKEY hk, struct wpa_ssid *ssid)
695 char *value = wpa_config_get(ssid, "bssid");
698 wpa_config_write_reg_string(hk, "bssid", value);
703 static void write_psk(HKEY hk, struct wpa_ssid *ssid)
705 char *value = wpa_config_get(ssid, "psk");
708 wpa_config_write_reg_string(hk, "psk", value);
713 static void write_proto(HKEY hk, struct wpa_ssid *ssid)
717 if (ssid->proto == DEFAULT_PROTO)
720 value = wpa_config_get(ssid, "proto");
724 wpa_config_write_reg_string(hk, "proto", value);
729 static void write_key_mgmt(HKEY hk, struct wpa_ssid *ssid)
733 if (ssid->key_mgmt == DEFAULT_KEY_MGMT)
736 value = wpa_config_get(ssid, "key_mgmt");
740 wpa_config_write_reg_string(hk, "key_mgmt", value);
745 static void write_pairwise(HKEY hk, struct wpa_ssid *ssid)
749 if (ssid->pairwise_cipher == DEFAULT_PAIRWISE)
752 value = wpa_config_get(ssid, "pairwise");
756 wpa_config_write_reg_string(hk, "pairwise", value);
761 static void write_group(HKEY hk, struct wpa_ssid *ssid)
765 if (ssid->group_cipher == DEFAULT_GROUP)
768 value = wpa_config_get(ssid, "group");
772 wpa_config_write_reg_string(hk, "group", value);
777 static void write_auth_alg(HKEY hk, struct wpa_ssid *ssid)
781 if (ssid->auth_alg == 0)
784 value = wpa_config_get(ssid, "auth_alg");
788 wpa_config_write_reg_string(hk, "auth_alg", value);
793 #ifdef IEEE8021X_EAPOL
794 static void write_eap(HKEY hk, struct wpa_ssid *ssid)
798 value = wpa_config_get(ssid, "eap");
803 wpa_config_write_reg_string(hk, "eap", value);
806 #endif /* IEEE8021X_EAPOL */
809 static void write_wep_key(HKEY hk, int idx, struct wpa_ssid *ssid)
811 char field[20], *value;
813 os_snprintf(field, sizeof(field), "wep_key%d", idx);
814 value = wpa_config_get(ssid, field);
816 wpa_config_write_reg_string(hk, field, value);
822 static int wpa_config_write_network(HKEY hk, struct wpa_ssid *ssid, int id)
829 ret = RegOpenKeyEx(hk, TEXT("networks"), 0, KEY_CREATE_SUB_KEY, &nhk);
830 if (ret != ERROR_SUCCESS) {
831 wpa_printf(MSG_DEBUG, "WINREG: Could not open networks key "
832 "for subkey addition: error 0x%x (%d)",
833 (unsigned int) ret, (int) GetLastError());
838 wsprintf(name, L"%04d", id);
840 os_snprintf(name, sizeof(name), "%04d", id);
842 ret = RegCreateKeyEx(nhk, name, 0, NULL, 0, KEY_WRITE, NULL, &netw,
845 if (ret != ERROR_SUCCESS) {
846 wpa_printf(MSG_DEBUG, "WINREG: Could not add network key '%s':"
848 name, (unsigned int) ret, (int) GetLastError());
852 #define STR(t) write_str(netw, #t, ssid)
853 #define INT(t) write_int(netw, #t, ssid->t, 0)
854 #define INTe(t) write_int(netw, #t, ssid->eap.t, 0)
855 #define INT_DEF(t, def) write_int(netw, #t, ssid->t, def)
856 #define INT_DEFe(t, def) write_int(netw, #t, ssid->eap.t, def)
860 write_bssid(netw, ssid);
861 write_psk(netw, ssid);
862 write_proto(netw, ssid);
863 write_key_mgmt(netw, ssid);
864 write_pairwise(netw, ssid);
865 write_group(netw, ssid);
866 write_auth_alg(netw, ssid);
867 #ifdef IEEE8021X_EAPOL
868 write_eap(netw, ssid);
870 STR(anonymous_identity);
876 STR(private_key_passwd);
879 STR(altsubject_match);
884 STR(private_key2_passwd);
887 STR(altsubject_match2);
903 INT_DEF(eapol_flags, DEFAULT_EAPOL_FLAGS);
904 #endif /* IEEE8021X_EAPOL */
905 for (i = 0; i < 4; i++)
906 write_wep_key(netw, i, ssid);
909 #ifdef IEEE8021X_EAPOL
910 INT_DEF(eap_workaround, DEFAULT_EAP_WORKAROUND);
912 INT_DEFe(fragment_size, DEFAULT_FRAGMENT_SIZE);
913 #endif /* IEEE8021X_EAPOL */
915 write_int(netw, "proactive_key_caching", ssid->proactive_key_caching,
919 #ifdef CONFIG_IEEE80211W
920 write_int(netw, "ieee80211w", ssid->ieee80211w,
921 MGMT_FRAME_PROTECTION_DEFAULT);
922 #endif /* CONFIG_IEEE80211W */
931 return errors ? -1 : 0;
935 static int wpa_config_write_blob(HKEY hk, struct wpa_config_blob *blob)
941 ret = RegCreateKeyEx(hk, TEXT("blobs"), 0, NULL, 0, KEY_WRITE, NULL,
943 if (ret != ERROR_SUCCESS) {
944 wpa_printf(MSG_DEBUG, "WINREG: Could not add blobs key: "
946 (unsigned int) ret, (int) GetLastError());
950 name = wpa_strdup_tchar(blob->name);
951 ret = RegSetValueEx(bhk, name, 0, REG_BINARY, blob->data,
953 if (ret != ERROR_SUCCESS) {
954 wpa_printf(MSG_ERROR, "WINREG: Failed to set blob %s': "
955 "error 0x%x (%d)", blob->name, (unsigned int) ret,
956 (int) GetLastError());
969 int wpa_config_write(const char *name, struct wpa_config *config)
975 struct wpa_ssid *ssid;
976 struct wpa_config_blob *blob;
979 wpa_printf(MSG_DEBUG, "Writing configuration file '%s'", name);
982 _snwprintf(buf, 256, WPA_KEY_PREFIX TEXT("\\configs\\%S"), name);
984 os_snprintf(buf, 256, WPA_KEY_PREFIX TEXT("\\configs\\%s"), name);
987 ret = RegOpenKeyEx(WPA_KEY_ROOT, buf, 0, KEY_SET_VALUE | DELETE, &hk);
988 if (ret != ERROR_SUCCESS) {
989 wpa_printf(MSG_ERROR, "Could not open wpa_supplicant "
990 "configuration registry %s: error %d", buf,
991 (int) GetLastError());
995 if (wpa_config_write_global(config, hk)) {
996 wpa_printf(MSG_ERROR, "Failed to write global configuration "
1001 wpa_config_delete_subkeys(hk, TEXT("networks"));
1002 for (ssid = config->ssid, id = 0; ssid; ssid = ssid->next, id++) {
1003 if (ssid->key_mgmt == WPA_KEY_MGMT_WPS)
1004 continue; /* do not save temporary WPS networks */
1005 if (wpa_config_write_network(hk, ssid, id))
1009 RegDeleteKey(hk, TEXT("blobs"));
1010 for (blob = config->blobs; blob; blob = blob->next) {
1011 if (wpa_config_write_blob(hk, blob))
1017 wpa_printf(MSG_DEBUG, "Configuration '%s' written %ssuccessfully",
1018 name, errors ? "un" : "");
1019 return errors ? -1 : 0;