Remove more uses of global_loadparm.
[abartlet/samba.git/.git] / source4 / lib / registry / patchfile_dotreg.c
index ebcafc92af4b9f1f2a0fb379644a687d08f41132..46ea7c0008bce1f2be05449c0e8968e19317bd6f 100644 (file)
@@ -26,6 +26,7 @@
 #include "lib/registry/patchfile.h"
 #include "lib/registry/registry.h"
 #include "system/filesys.h"
+#include "param/param.h"
 
 /**
  * @file
@@ -36,6 +37,7 @@
 
 struct dotreg_data {
        int fd;
+       struct smb_iconv_convenience *iconv_convenience;
 };
 
 static WERROR reg_dotreg_diff_add_key(void *_data, const char *key_name)
@@ -64,7 +66,7 @@ static WERROR reg_dotreg_diff_set_value(void *_data, const char *path,
 
        fdprintf(data->fd, "\"%s\"=%s:%s\n",
                        value_name, str_regtype(value_type),
-                       reg_val_data_string(NULL, value_type, value));
+                       reg_val_data_string(NULL, data->iconv_convenience, value_type, value));
 
        return WERR_OK;
 }
@@ -107,6 +109,8 @@ _PUBLIC_ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
        data = talloc_zero(ctx, struct dotreg_data);
        *callback_data = data;
 
+       data->iconv_convenience = lp_iconv_convenience(global_loadparm);
+
        if (filename) {
                data->fd = open(filename, O_CREAT, 0755);
                if (data->fd == -1) {
@@ -135,6 +139,7 @@ _PUBLIC_ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
  * Load diff file
  */
 _PUBLIC_ WERROR reg_dotreg_diff_load(int fd,
+                                    struct smb_iconv_convenience *iconv_convenience,
                                     const struct reg_diff_callbacks *callbacks,
                                     void *callback_data)
 {
@@ -239,7 +244,8 @@ _PUBLIC_ WERROR reg_dotreg_diff_load(int fd,
                        q++;
                }
 
-               reg_string_to_val(line, q?p:"REG_SZ", q?q:p,
+               reg_string_to_val(line, iconv_convenience, 
+                                 q?p:"REG_SZ", q?q:p,
                                  &value_type, &value);
 
                error = callbacks->set_value(callback_data, curkey, line,