Merge branch 'moonshot' of ssh://moonshot.suchdamage.org:822/srv/git/libeap into...
[libeap.git] / wpa_supplicant / config_winreg.c
index 48ce603..deebbd9 100644 (file)
  *
  * See README and COPYING for more details.
  *
- * This file implements a configuration backend for Windows registry.. All the
+ * This file implements a configuration backend for Windows registry. All the
  * configuration information is stored in the registry and the format for
  * network configuration fields is same as described in the sample
  * configuration file, wpa_supplicant.conf.
  *
- * Configuration data is in HKEY_LOCAL_MACHINE\SOFTWARE\wpa_supplicant\configs
+ * Configuration data is in
+ * \a HKEY_LOCAL_MACHINE\\SOFTWARE\\%wpa_supplicant\\configs
  * key. Each configuration profile has its own key under this. In terms of text
  * files, each profile would map to a separate text file with possibly multiple
  * networks. Under each profile, there is a networks key that lists all
  * network block in the configuration file. In addition, blobs subkey has
  * possible blobs as values.
  *
- * HKEY_LOCAL_MACHINE\SOFTWARE\wpa_supplicant\configs\test\networks\0000
- *    ssid="example"
- *    key_mgmt=WPA-PSK
+ * Example network configuration block:
+ * \verbatim
+HKEY_LOCAL_MACHINE\SOFTWARE\wpa_supplicant\configs\test\networks\0000
+   ssid="example"
+   key_mgmt=WPA-PSK
+\endverbatim
  */
 
 #include "includes.h"
@@ -245,9 +249,22 @@ static int wpa_config_read_global(struct wpa_config *config, HKEY hk)
                hk, TEXT("serial_number"));
        config->device_type = wpa_config_read_reg_string(
                hk, TEXT("device_type"));
+       config->config_methods = wpa_config_read_reg_string(
+               hk, TEXT("config_methods"));
        if (wpa_config_read_global_os_version(config, hk))
                errors++;
+       wpa_config_read_reg_dword(hk, TEXT("wps_cred_processing"),
+                                 &config->wps_cred_processing);
 #endif /* CONFIG_WPS */
+#ifdef CONFIG_P2P
+       config->p2p_ssid_postfix = wpa_config_read_reg_string(
+               hk, TEXT("p2p_ssid_postfix"));
+#endif /* CONFIG_P2P */
+
+       wpa_config_read_reg_dword(hk, TEXT("bss_max_count"),
+                                 (int *) &config->bss_max_count);
+       wpa_config_read_reg_dword(hk, TEXT("filter_ssids"),
+                                 &config->filter_ssids);
 
        return errors ? -1 : 0;
 }
@@ -551,7 +568,7 @@ static int wpa_config_write_global(struct wpa_config *config, HKEY hk)
                                   config->update_config,
                                   0);
 #ifdef CONFIG_WPS
-       if (is_nil_uuid(config->uuid)) {
+       if (!is_nil_uuid(config->uuid)) {
                char buf[40];
                uuid_bin2str(config->uuid, buf, sizeof(buf));
                wpa_config_write_reg_string(hk, "uuid", buf);
@@ -563,13 +580,27 @@ static int wpa_config_write_global(struct wpa_config *config, HKEY hk)
        wpa_config_write_reg_string(hk, "serial_number",
                                    config->serial_number);
        wpa_config_write_reg_string(hk, "device_type", config->device_type);
+       wpa_config_write_reg_string(hk, "config_methods",
+                                   config->config_methods);
        if (WPA_GET_BE32(config->os_version)) {
                char vbuf[10];
                os_snprintf(vbuf, sizeof(vbuf), "%08x",
                            WPA_GET_BE32(config->os_version));
                wpa_config_write_reg_string(hk, "os_version", vbuf);
        }
+       wpa_config_write_reg_dword(hk, TEXT("wps_cred_processing"),
+                                  config->wps_cred_processing, 0);
 #endif /* CONFIG_WPS */
+#ifdef CONFIG_P2P
+       wpa_config_write_reg_string(hk, "p2p_ssid_postfix",
+                                   config->p2p_ssid_postfix);
+#endif /* CONFIG_P2P */
+
+       wpa_config_write_reg_dword(hk, TEXT("bss_max_count"),
+                                  config->bss_max_count,
+                                  DEFAULT_BSS_MAX_COUNT);
+       wpa_config_write_reg_dword(hk, TEXT("filter_ssids"),
+                                  config->filter_ssids, 0);
 
        return 0;
 }