From 11bea731aebc57a63e5fbc6bc0655b50a3815539 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=BCnther=20Deschner?= Date: Fri, 17 Jul 2009 15:38:40 +0200 Subject: [PATCH] spoolss: fill in spoolss_Create/DeletePrinterIC + rerun make samba3-idl. Guenther --- librpc/gen_ndr/cli_spoolss.c | 9 +++++ librpc/gen_ndr/cli_spoolss.h | 4 ++ librpc/gen_ndr/ndr_spoolss.c | 87 ++++++++++++++++++++++++++++++++++++++++++++ librpc/gen_ndr/spoolss.h | 11 ++++++ librpc/gen_ndr/srv_spoolss.c | 17 +++++++++ librpc/idl/spoolss.idl | 8 +++- 6 files changed, 134 insertions(+), 2 deletions(-) diff --git a/librpc/gen_ndr/cli_spoolss.c b/librpc/gen_ndr/cli_spoolss.c index 66083e68567..38031b615de 100644 --- a/librpc/gen_ndr/cli_spoolss.c +++ b/librpc/gen_ndr/cli_spoolss.c @@ -2006,12 +2006,17 @@ NTSTATUS rpccli_spoolss_DeletePort(struct rpc_pipe_client *cli, NTSTATUS rpccli_spoolss_CreatePrinterIC(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + struct policy_handle *handle /* [in] [ref] */, + struct policy_handle *gdi_handle /* [out] [ref] */, + struct spoolss_DevmodeContainer *devmode_ctr /* [in] [ref] */, WERROR *werror) { struct spoolss_CreatePrinterIC r; NTSTATUS status; /* In parameters */ + r.in.handle = handle; + r.in.devmode_ctr = devmode_ctr; if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(spoolss_CreatePrinterIC, &r); @@ -2036,6 +2041,7 @@ NTSTATUS rpccli_spoolss_CreatePrinterIC(struct rpc_pipe_client *cli, } /* Return variables */ + *gdi_handle = *r.out.gdi_handle; /* Return result */ if (werror) { @@ -2088,12 +2094,14 @@ NTSTATUS rpccli_spoolss_PlayGDIScriptOnPrinterIC(struct rpc_pipe_client *cli, NTSTATUS rpccli_spoolss_DeletePrinterIC(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + struct policy_handle *gdi_handle /* [in,out] [ref] */, WERROR *werror) { struct spoolss_DeletePrinterIC r; NTSTATUS status; /* In parameters */ + r.in.gdi_handle = gdi_handle; if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterIC, &r); @@ -2118,6 +2126,7 @@ NTSTATUS rpccli_spoolss_DeletePrinterIC(struct rpc_pipe_client *cli, } /* Return variables */ + *gdi_handle = *r.out.gdi_handle; /* Return result */ if (werror) { diff --git a/librpc/gen_ndr/cli_spoolss.h b/librpc/gen_ndr/cli_spoolss.h index baf5d61e2a8..b171c69fbd8 100644 --- a/librpc/gen_ndr/cli_spoolss.h +++ b/librpc/gen_ndr/cli_spoolss.h @@ -294,12 +294,16 @@ NTSTATUS rpccli_spoolss_DeletePort(struct rpc_pipe_client *cli, WERROR *werror); NTSTATUS rpccli_spoolss_CreatePrinterIC(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + struct policy_handle *handle /* [in] [ref] */, + struct policy_handle *gdi_handle /* [out] [ref] */, + struct spoolss_DevmodeContainer *devmode_ctr /* [in] [ref] */, WERROR *werror); NTSTATUS rpccli_spoolss_PlayGDIScriptOnPrinterIC(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); NTSTATUS rpccli_spoolss_DeletePrinterIC(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + struct policy_handle *gdi_handle /* [in,out] [ref] */, WERROR *werror); NTSTATUS rpccli_spoolss_AddPrinterConnection(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, diff --git a/librpc/gen_ndr/ndr_spoolss.c b/librpc/gen_ndr/ndr_spoolss.c index a1be2fd92c5..b5d9f1739c9 100644 --- a/librpc/gen_ndr/ndr_spoolss.c +++ b/librpc/gen_ndr/ndr_spoolss.c @@ -23702,8 +23702,20 @@ _PUBLIC_ void ndr_print_spoolss_DeletePort(struct ndr_print *ndr, const char *na static enum ndr_err_code ndr_push_spoolss_CreatePrinterIC(struct ndr_push *ndr, int flags, const struct spoolss_CreatePrinterIC *r) { if (flags & NDR_IN) { + if (r->in.handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle)); + if (r->in.devmode_ctr == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_spoolss_DevmodeContainer(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.devmode_ctr)); } if (flags & NDR_OUT) { + if (r->out.gdi_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.gdi_handle)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -23711,9 +23723,37 @@ static enum ndr_err_code ndr_push_spoolss_CreatePrinterIC(struct ndr_push *ndr, static enum ndr_err_code ndr_pull_spoolss_CreatePrinterIC(struct ndr_pull *ndr, int flags, struct spoolss_CreatePrinterIC *r) { + TALLOC_CTX *_mem_save_handle_0; + TALLOC_CTX *_mem_save_gdi_handle_0; + TALLOC_CTX *_mem_save_devmode_ctr_0; if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.handle); + } + _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.devmode_ctr); + } + _mem_save_devmode_ctr_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.devmode_ctr, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_spoolss_DevmodeContainer(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.devmode_ctr)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_devmode_ctr_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.gdi_handle); + ZERO_STRUCTP(r->out.gdi_handle); } if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.gdi_handle); + } + _mem_save_gdi_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.gdi_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.gdi_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_gdi_handle_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; @@ -23729,11 +23769,23 @@ _PUBLIC_ void ndr_print_spoolss_CreatePrinterIC(struct ndr_print *ndr, const cha if (flags & NDR_IN) { ndr_print_struct(ndr, "in", "spoolss_CreatePrinterIC"); ndr->depth++; + ndr_print_ptr(ndr, "handle", r->in.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->in.handle); + ndr->depth--; + ndr_print_ptr(ndr, "devmode_ctr", r->in.devmode_ctr); + ndr->depth++; + ndr_print_spoolss_DevmodeContainer(ndr, "devmode_ctr", r->in.devmode_ctr); + ndr->depth--; ndr->depth--; } if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "spoolss_CreatePrinterIC"); ndr->depth++; + ndr_print_ptr(ndr, "gdi_handle", r->out.gdi_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "gdi_handle", r->out.gdi_handle); + ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; } @@ -23784,8 +23836,16 @@ _PUBLIC_ void ndr_print_spoolss_PlayGDIScriptOnPrinterIC(struct ndr_print *ndr, static enum ndr_err_code ndr_push_spoolss_DeletePrinterIC(struct ndr_push *ndr, int flags, const struct spoolss_DeletePrinterIC *r) { if (flags & NDR_IN) { + if (r->in.gdi_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.gdi_handle)); } if (flags & NDR_OUT) { + if (r->out.gdi_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.gdi_handle)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -23793,9 +23853,28 @@ static enum ndr_err_code ndr_push_spoolss_DeletePrinterIC(struct ndr_push *ndr, static enum ndr_err_code ndr_pull_spoolss_DeletePrinterIC(struct ndr_pull *ndr, int flags, struct spoolss_DeletePrinterIC *r) { + TALLOC_CTX *_mem_save_gdi_handle_0; if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.gdi_handle); + } + _mem_save_gdi_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.gdi_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.gdi_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_gdi_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.gdi_handle); + *r->out.gdi_handle = *r->in.gdi_handle; } if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.gdi_handle); + } + _mem_save_gdi_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.gdi_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.gdi_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_gdi_handle_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; @@ -23811,11 +23890,19 @@ _PUBLIC_ void ndr_print_spoolss_DeletePrinterIC(struct ndr_print *ndr, const cha if (flags & NDR_IN) { ndr_print_struct(ndr, "in", "spoolss_DeletePrinterIC"); ndr->depth++; + ndr_print_ptr(ndr, "gdi_handle", r->in.gdi_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "gdi_handle", r->in.gdi_handle); + ndr->depth--; ndr->depth--; } if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "spoolss_DeletePrinterIC"); ndr->depth++; + ndr_print_ptr(ndr, "gdi_handle", r->out.gdi_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "gdi_handle", r->out.gdi_handle); + ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; } diff --git a/librpc/gen_ndr/spoolss.h b/librpc/gen_ndr/spoolss.h index 9446193863a..2575c4d082e 100644 --- a/librpc/gen_ndr/spoolss.h +++ b/librpc/gen_ndr/spoolss.h @@ -2516,6 +2516,12 @@ struct spoolss_DeletePort { struct spoolss_CreatePrinterIC { struct { + struct policy_handle *handle;/* [ref] */ + struct spoolss_DevmodeContainer *devmode_ctr;/* [ref] */ + } in; + + struct { + struct policy_handle *gdi_handle;/* [ref] */ WERROR result; } out; @@ -2532,6 +2538,11 @@ struct spoolss_PlayGDIScriptOnPrinterIC { struct spoolss_DeletePrinterIC { struct { + struct policy_handle *gdi_handle;/* [ref] */ + } in; + + struct { + struct policy_handle *gdi_handle;/* [ref] */ WERROR result; } out; diff --git a/librpc/gen_ndr/srv_spoolss.c b/librpc/gen_ndr/srv_spoolss.c index 41a79b4a79d..ae99f098a61 100644 --- a/librpc/gen_ndr/srv_spoolss.c +++ b/librpc/gen_ndr/srv_spoolss.c @@ -3245,6 +3245,13 @@ static bool api_spoolss_CreatePrinterIC(pipes_struct *p) NDR_PRINT_IN_DEBUG(spoolss_CreatePrinterIC, r); } + ZERO_STRUCT(r->out); + r->out.gdi_handle = talloc_zero(r, struct policy_handle); + if (r->out.gdi_handle == NULL) { + talloc_free(r); + return false; + } + r->out.result = _spoolss_CreatePrinterIC(p, r); if (p->rng_fault_state) { @@ -3391,6 +3398,8 @@ static bool api_spoolss_DeletePrinterIC(pipes_struct *p) NDR_PRINT_IN_DEBUG(spoolss_DeletePrinterIC, r); } + ZERO_STRUCT(r->out); + r->out.gdi_handle = r->in.gdi_handle; r->out.result = _spoolss_DeletePrinterIC(p, r); if (p->rng_fault_state) { @@ -8068,6 +8077,12 @@ NTSTATUS rpc_spoolss_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, case NDR_SPOOLSS_CREATEPRINTERIC: { struct spoolss_CreatePrinterIC *r = (struct spoolss_CreatePrinterIC *)_r; + ZERO_STRUCT(r->out); + r->out.gdi_handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.gdi_handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + r->out.result = _spoolss_CreatePrinterIC(cli->pipes_struct, r); return NT_STATUS_OK; } @@ -8080,6 +8095,8 @@ NTSTATUS rpc_spoolss_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, case NDR_SPOOLSS_DELETEPRINTERIC: { struct spoolss_DeletePrinterIC *r = (struct spoolss_DeletePrinterIC *)_r; + ZERO_STRUCT(r->out); + r->out.gdi_handle = r->in.gdi_handle; r->out.result = _spoolss_DeletePrinterIC(cli->pipes_struct, r); return NT_STATUS_OK; } diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl index f37424634d0..acfb54f9237 100644 --- a/librpc/idl/spoolss.idl +++ b/librpc/idl/spoolss.idl @@ -1683,7 +1683,10 @@ import "misc.idl", "security.idl", "winreg.idl"; /******************/ /* Function: 0x28 */ - [todo] WERROR spoolss_CreatePrinterIC( + WERROR spoolss_CreatePrinterIC( + [in,ref] policy_handle *handle, + [out,ref] policy_handle *gdi_handle, + [in,ref] spoolss_DevmodeContainer *devmode_ctr ); /******************/ @@ -1693,7 +1696,8 @@ import "misc.idl", "security.idl", "winreg.idl"; /******************/ /* Function: 0x2a */ - [todo] WERROR spoolss_DeletePrinterIC( + WERROR spoolss_DeletePrinterIC( + [in,out,ref] policy_handle *gdi_handle ); /******************/ -- 2.11.4.GIT