From 30e18aadc3710116c74c47563c6476d520685cfc Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 12 Feb 2009 22:06:54 +0100 Subject: s3-rpcclient: use rpccli_spoolss_GetPrinterDataEx. Guenther --- source3/rpcclient/cmd_spoolss.c | 44 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c index c3fd463271..b4dcad5187 100644 --- a/source3/rpcclient/cmd_spoolss.c +++ b/source3/rpcclient/cmd_spoolss.c @@ -784,11 +784,17 @@ static WERROR cmd_spoolss_getprinterdataex(struct rpc_pipe_client *cli, { POLICY_HND pol; WERROR result; + NTSTATUS status; bool opened_hnd = False; fstring printername; const char *valuename, *keyname; REGISTRY_VALUE value; + uint32_t type; + uint8_t *buffer = NULL; + uint32_t offered = 0; + uint32_t needed; + if (argc != 4) { printf("Usage: %s \n", argv[0]); @@ -819,8 +825,37 @@ static WERROR cmd_spoolss_getprinterdataex(struct rpc_pipe_client *cli, /* Get printer info */ - result = rpccli_spoolss_getprinterdataex(cli, mem_ctx, &pol, keyname, - valuename, &value); + status = rpccli_spoolss_GetPrinterDataEx(cli, mem_ctx, + &pol, + keyname, + valuename, + &type, + buffer, + offered, + &needed, + &result); + if (W_ERROR_EQUAL(result, WERR_MORE_DATA)) { + offered = needed; + buffer = talloc_array(mem_ctx, uint8_t, needed); + status = rpccli_spoolss_GetPrinterDataEx(cli, mem_ctx, + &pol, + keyname, + valuename, + &type, + buffer, + offered, + &needed, + &result); + } + + if (!NT_STATUS_IS_OK(status)) { + goto done; + } + + if (!W_ERROR_IS_OK(result)) { + goto done; + } + if (!W_ERROR_IS_OK(result)) goto done; @@ -828,8 +863,11 @@ static WERROR cmd_spoolss_getprinterdataex(struct rpc_pipe_client *cli, /* Display printer data */ fstrcpy(value.valuename, valuename); - display_reg_value(value); + value.type = type; + value.size = needed; + value.data_p = buffer; + display_reg_value(value); done: if (opened_hnd) -- cgit