[PATCH 3/6] s3-spoolss: Add port registry functions
David Disseldorp
ddiss at suse.de
Sun Oct 30 19:11:50 MDT 2011
On Wed, 31 Aug 2011 15:03:11 -0400
Justin Chevrier <jchevrier at gmail.com> wrote:
> +WERROR winreg_get_port(TALLOC_CTX *mem_ctx,
> + struct dcerpc_binding_handle *winreg_handle,
> + const char *port,
> + struct spoolss_PortData1 **pdata1)
> +{
...
> +
> + status = dcerpc_winreg_enumvals(tmp_ctx,
> + winreg_handle,
> + &key_hnd,
> + &num_values,
> + &enum_names,
> + &enum_types,
> + &enum_data_blobs,
> + &result);
> +
> + if (!NT_STATUS_IS_OK(status)){
> + result = ntstatus_to_werror(status);
> + }
> +
There's a bit of white-space damage in this patch and others, please try
to avoid it. git diff --color=always should highlight it for you.
...
> +
> + FILL_STRING(data1, port, data1->portname);
...
> + result = winreg_enumval_to_dword(data1,
> + v,
> + "Double Spool",
> + &data1->dblspool);
> + CHECK_ERROR(result);
I'm not at all a fan of macros which affect control flow, but I notice
these are used commonly in cli_winreg_spoolss.c.
...
> +/* Enumerate the subkeys of a given key */
> +WERROR winreg_enum_ports_key(TALLOC_CTX *mem_ctx,
> + struct dcerpc_binding_handle *winreg_handle,
> + uint32_t *pnum_subkeys,
> + const char ***psubkeys)
> +{
...
> + path = TOP_LEVEL_PORT_PORTS_KEY;
> +
> + if (path == NULL) {
> + TALLOC_FREE(tmp_ctx);
> + return WERR_NOMEM;
> + }
This check is unnecessary.
> diff --git a/source3/rpc_client/cli_winreg_spoolss.h b/source3/rpc_client/cli_winreg_spoolss.h
> index aa4d98f..6cd6863 100644
> --- a/source3/rpc_client/cli_winreg_spoolss.h
> +++ b/source3/rpc_client/cli_winreg_spoolss.h
> @@ -24,6 +24,34 @@
>
...
> + * @param[out] pdata1 A pointer to store a PRINTER_INFO_2 structure.
Port data instead of printer info.
> + *
> + * @return On success WERR_OK, a corresponding DOS error is
> + * something went wrong.
I'm guessing this should be "if something went wrong". Same goes for
the others.
> + */
> +WERROR winreg_get_port(TALLOC_CTX *mem_ctx,
> + struct dcerpc_binding_handle *b,
> + const char *port,
> + struct spoolss_PortData1 **pdata1);
More information about the samba-technical
mailing list