s3-spoolss: add registry_value_to_printer_enum_value.
authorGünther Deschner <gd@samba.org>
Wed, 18 Mar 2009 10:25:15 +0000 (11:25 +0100)
committerGünther Deschner <gd@samba.org>
Wed, 18 Mar 2009 10:55:54 +0000 (11:55 +0100)
Guenther

source3/rpc_server/srv_spoolss_nt.c

index c9cb5d11ad2810f91aa53b1062401b7c2bd6a683..97223c90ff290e461a5d54cfdd2a929ab02dbfa7 100644 (file)
@@ -8982,6 +8982,37 @@ WERROR _spoolss_DeletePrinterKey(pipes_struct *p,
        return status;
 }
 
+/****************************************************************
+****************************************************************/
+
+static WERROR registry_value_to_printer_enum_value(TALLOC_CTX *mem_ctx,
+                                                  REGISTRY_VALUE *v,
+                                                  struct spoolss_PrinterEnumValues *r)
+{
+       WERROR result;
+
+       r->data = TALLOC_ZERO_P(mem_ctx, union spoolss_PrinterData);
+       W_ERROR_HAVE_NO_MEMORY(r->data);
+
+       r->value_name   = talloc_strdup(mem_ctx, regval_name(v));
+       W_ERROR_HAVE_NO_MEMORY(r->value_name);
+
+       r->type         = regval_type(v);
+       r->data_length  = regval_size(v);
+
+       if (r->data_length) {
+               DATA_BLOB blob = data_blob_const(regval_data_p(v),
+                                                regval_size(v));
+               result = pull_spoolss_PrinterData(mem_ctx, &blob,
+                                                 r->data,
+                                                 r->type);
+               if (!W_ERROR_IS_OK(result)) {
+                       return result;
+               }
+       }
+
+       return WERR_OK;
+}
 
 /********************************************************************
  * spoolss_enumprinterdataex