s3-spoolss: add rpccli_spoolss_getprinterdata convenience wrapper.
authorGünther Deschner <gd@samba.org>
Sat, 14 Mar 2009 00:26:27 +0000 (01:26 +0100)
committerGünther Deschner <gd@samba.org>
Tue, 17 Mar 2009 10:49:08 +0000 (11:49 +0100)
Guenther

source3/include/proto.h
source3/rpc_client/cli_spoolss.c

index f2929e8296f7cf084115795fd9340ef4cdb00ac9..6c8e4cba8cb9454a497ab07382172674ca78d97e 100644 (file)
@@ -5533,9 +5533,18 @@ WERROR rpccli_spoolss_enumprinters(struct rpc_pipe_client *cli,
                                   uint32_t offered,
                                   uint32_t *count,
                                   union spoolss_PrinterInfo **info);
+WERROR rpccli_spoolss_getprinterdata(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct policy_handle *handle,
+                                    const char *value_name,
+                                    uint32_t offered,
+                                    enum winreg_Type *type,
+                                    union spoolss_PrinterData *data);
+#if 0
 WERROR rpccli_spoolss_getprinterdata(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
                                  POLICY_HND *hnd, const char *valuename, 
                                  REGISTRY_VALUE *value);
+#endif
 WERROR rpccli_spoolss_setprinterdata(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
                                  POLICY_HND *hnd, REGISTRY_VALUE *value);
 WERROR rpccli_spoolss_enumprinterdata(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
index 76614c67eb90ae5f67f93be5faecd8b40d3f947b..f9cb48195c5576b8f830cc78c468e83d49a32062 100644 (file)
@@ -705,6 +705,47 @@ WERROR rpccli_spoolss_enumprinters(struct rpc_pipe_client *cli,
        return werror;
 }
 
+/**********************************************************************
+ convencience wrapper around rpccli_spoolss_GetPrinterData
+**********************************************************************/
+
+WERROR rpccli_spoolss_getprinterdata(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx,
+                                    struct policy_handle *handle,
+                                    const char *value_name,
+                                    uint32_t offered,
+                                    enum winreg_Type *type,
+                                    union spoolss_PrinterData *data)
+{
+       NTSTATUS status;
+       WERROR werror;
+       uint32_t needed;
+
+       status = rpccli_spoolss_GetPrinterData(cli, mem_ctx,
+                                              handle,
+                                              value_name,
+                                              offered,
+                                              type,
+                                              data,
+                                              &needed,
+                                              &werror);
+
+       if (W_ERROR_EQUAL(werror, WERR_MORE_DATA)) {
+               offered = needed;
+
+               status = rpccli_spoolss_GetPrinterData(cli, mem_ctx,
+                                                      handle,
+                                                      value_name,
+                                                      offered,
+                                                      type,
+                                                      data,
+                                                      &needed,
+                                                      &werror);
+       }
+
+       return werror;
+}
+
 /*********************************************************************
  Decode various spoolss rpc's and info levels
  ********************************************************************/