diff options
Diffstat (limited to 'source3/librpc/gen_ndr/srv_winreg.c')
-rw-r--r-- | source3/librpc/gen_ndr/srv_winreg.c | 1701 |
1 files changed, 973 insertions, 728 deletions
diff --git a/source3/librpc/gen_ndr/srv_winreg.c b/source3/librpc/gen_ndr/srv_winreg.c index 6384f65f04..c947de4837 100644 --- a/source3/librpc/gen_ndr/srv_winreg.c +++ b/source3/librpc/gen_ndr/srv_winreg.c @@ -8,2398 +8,2643 @@ static BOOL api_winreg_OpenHKCR(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_OpenHKCR r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKCR"); + struct winreg_OpenHKCR *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKCR]; + + r = talloc(NULL, struct winreg_OpenHKCR); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_OpenHKCR(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_OpenHKCR, &r); + NDR_PRINT_IN_DEBUG(winreg_OpenHKCR, r); - ZERO_STRUCT(r.out); - r.out.handle = talloc_zero(mem_ctx, struct policy_handle); - if (r.out.handle == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(r, struct policy_handle); + if (r->out.handle == NULL) { + talloc_free(r); return False; } - r.out.result = _winreg_OpenHKCR(p, &r); + r->out.result = _winreg_OpenHKCR(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_OpenHKCR, &r); + NDR_PRINT_OUT_DEBUG(winreg_OpenHKCR, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_OpenHKCR(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_OpenHKCU(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_OpenHKCU r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKCU"); + struct winreg_OpenHKCU *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKCU]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_OpenHKCU); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_OpenHKCU(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_OpenHKCU, &r); + NDR_PRINT_IN_DEBUG(winreg_OpenHKCU, r); - ZERO_STRUCT(r.out); - r.out.handle = talloc_zero(mem_ctx, struct policy_handle); - if (r.out.handle == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(r, struct policy_handle); + if (r->out.handle == NULL) { + talloc_free(r); return False; } - r.out.result = _winreg_OpenHKCU(p, &r); + r->out.result = _winreg_OpenHKCU(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_OpenHKCU, &r); + NDR_PRINT_OUT_DEBUG(winreg_OpenHKCU, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_OpenHKCU(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_OpenHKLM(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_OpenHKLM r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKLM"); + struct winreg_OpenHKLM *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKLM]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_OpenHKLM); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_OpenHKLM(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_OpenHKLM, &r); + NDR_PRINT_IN_DEBUG(winreg_OpenHKLM, r); - ZERO_STRUCT(r.out); - r.out.handle = talloc_zero(mem_ctx, struct policy_handle); - if (r.out.handle == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(r, struct policy_handle); + if (r->out.handle == NULL) { + talloc_free(r); return False; } - r.out.result = _winreg_OpenHKLM(p, &r); + r->out.result = _winreg_OpenHKLM(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_OpenHKLM, &r); + NDR_PRINT_OUT_DEBUG(winreg_OpenHKLM, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_OpenHKLM(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_OpenHKPD(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_OpenHKPD r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKPD"); + struct winreg_OpenHKPD *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKPD]; + + r = talloc(NULL, struct winreg_OpenHKPD); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_OpenHKPD(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_OpenHKPD, &r); + NDR_PRINT_IN_DEBUG(winreg_OpenHKPD, r); - ZERO_STRUCT(r.out); - r.out.handle = talloc_zero(mem_ctx, struct policy_handle); - if (r.out.handle == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(r, struct policy_handle); + if (r->out.handle == NULL) { + talloc_free(r); return False; } - r.out.result = _winreg_OpenHKPD(p, &r); + r->out.result = _winreg_OpenHKPD(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_OpenHKPD, &r); + NDR_PRINT_OUT_DEBUG(winreg_OpenHKPD, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_OpenHKPD(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_OpenHKU(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_OpenHKU r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKU"); + struct winreg_OpenHKU *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKU]; + + r = talloc(NULL, struct winreg_OpenHKU); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_OpenHKU(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_OpenHKU, &r); + NDR_PRINT_IN_DEBUG(winreg_OpenHKU, r); - ZERO_STRUCT(r.out); - r.out.handle = talloc_zero(mem_ctx, struct policy_handle); - if (r.out.handle == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(r, struct policy_handle); + if (r->out.handle == NULL) { + talloc_free(r); return False; } - r.out.result = _winreg_OpenHKU(p, &r); + r->out.result = _winreg_OpenHKU(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_OpenHKU, &r); + NDR_PRINT_OUT_DEBUG(winreg_OpenHKU, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_OpenHKU(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_CloseKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_CloseKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_CloseKey"); + struct winreg_CloseKey *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_CLOSEKEY]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_CloseKey); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_CloseKey(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_CloseKey, &r); + NDR_PRINT_IN_DEBUG(winreg_CloseKey, r); - ZERO_STRUCT(r.out); - r.out.handle = r.in.handle; - r.out.result = _winreg_CloseKey(p, &r); + ZERO_STRUCT(r->out); + r->out.handle = r->in.handle; + r->out.result = _winreg_CloseKey(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_CloseKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_CloseKey, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_CloseKey(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_CreateKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_CreateKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_CreateKey"); + struct winreg_CreateKey *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_CREATEKEY]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_CreateKey); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_CreateKey(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_CreateKey, &r); + NDR_PRINT_IN_DEBUG(winreg_CreateKey, r); - ZERO_STRUCT(r.out); - r.out.new_handle = talloc_zero(mem_ctx, struct policy_handle); - if (r.out.new_handle == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.new_handle = talloc_zero(r, struct policy_handle); + if (r->out.new_handle == NULL) { + talloc_free(r); return False; } - r.out.action_taken = r.in.action_taken; - r.out.result = _winreg_CreateKey(p, &r); + r->out.action_taken = r->in.action_taken; + r->out.result = _winreg_CreateKey(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_CreateKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_CreateKey, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_CreateKey(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_DeleteKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_DeleteKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_DeleteKey"); + struct winreg_DeleteKey *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_DELETEKEY]; + + r = talloc(NULL, struct winreg_DeleteKey); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_DeleteKey(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_DeleteKey, &r); + NDR_PRINT_IN_DEBUG(winreg_DeleteKey, r); - r.out.result = _winreg_DeleteKey(p, &r); + r->out.result = _winreg_DeleteKey(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_DeleteKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_DeleteKey, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_DeleteKey(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_DeleteValue(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_DeleteValue r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_DeleteValue"); + struct winreg_DeleteValue *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_DELETEVALUE]; + + r = talloc(NULL, struct winreg_DeleteValue); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_DeleteValue(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_DeleteValue, &r); + NDR_PRINT_IN_DEBUG(winreg_DeleteValue, r); - r.out.result = _winreg_DeleteValue(p, &r); + r->out.result = _winreg_DeleteValue(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_DeleteValue, &r); + NDR_PRINT_OUT_DEBUG(winreg_DeleteValue, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_DeleteValue(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_EnumKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_EnumKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_EnumKey"); + struct winreg_EnumKey *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_ENUMKEY]; + + r = talloc(NULL, struct winreg_EnumKey); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_EnumKey(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_EnumKey, &r); + NDR_PRINT_IN_DEBUG(winreg_EnumKey, r); - ZERO_STRUCT(r.out); - r.out.name = r.in.name; - r.out.keyclass = r.in.keyclass; - r.out.last_changed_time = r.in.last_changed_time; - r.out.result = _winreg_EnumKey(p, &r); + ZERO_STRUCT(r->out); + r->out.name = r->in.name; + r->out.keyclass = r->in.keyclass; + r->out.last_changed_time = r->in.last_changed_time; + r->out.result = _winreg_EnumKey(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_EnumKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_EnumKey, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_EnumKey(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_EnumValue(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_EnumValue r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_EnumValue"); + struct winreg_EnumValue *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_ENUMVALUE]; + + r = talloc(NULL, struct winreg_EnumValue); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_EnumValue(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_EnumValue, &r); + NDR_PRINT_IN_DEBUG(winreg_EnumValue, r); - ZERO_STRUCT(r.out); - r.out.name = r.in.name; - r.out.type = r.in.type; - r.out.value = r.in.value; - r.out.size = r.in.size; - r.out.length = r.in.length; - r.out.result = _winreg_EnumValue(p, &r); + ZERO_STRUCT(r->out); + r->out.name = r->in.name; + r->out.type = r->in.type; + r->out.value = r->in.value; + r->out.size = r->in.size; + r->out.length = r->in.length; + r->out.result = _winreg_EnumValue(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_EnumValue, &r); + NDR_PRINT_OUT_DEBUG(winreg_EnumValue, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_EnumValue(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_FlushKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_FlushKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_FlushKey"); + struct winreg_FlushKey *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_winreg.calls[NDR_WINREG_FLUSHKEY]; + + r = talloc(NULL, struct winreg_FlushKey); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_FlushKey(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_FlushKey, &r); + NDR_PRINT_IN_DEBUG(winreg_FlushKey, r); - r.out.result = _winreg_FlushKey(p, &r); + r->out.result = _winreg_FlushKey(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_FlushKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_FlushKey, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_FlushKey(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_GetKeySecurity(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_GetKeySecurity r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_GetKeySecurity"); + struct winreg_GetKeySecurity *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_GETKEYSECURITY]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_GetKeySecurity); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_GetKeySecurity(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_GetKeySecurity, &r); + NDR_PRINT_IN_DEBUG(winreg_GetKeySecurity, r); - ZERO_STRUCT(r.out); - r.out.sd = r.in.sd; - r.out.result = _winreg_GetKeySecurity(p, &r); + ZERO_STRUCT(r->out); + r->out.sd = r->in.sd; + r->out.result = _winreg_GetKeySecurity(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_GetKeySecurity, &r); + NDR_PRINT_OUT_DEBUG(winreg_GetKeySecurity, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_GetKeySecurity(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_LoadKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_LoadKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_LoadKey"); + struct winreg_LoadKey *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_LOADKEY]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_LoadKey); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_LoadKey(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_LoadKey, &r); + NDR_PRINT_IN_DEBUG(winreg_LoadKey, r); - r.out.result = _winreg_LoadKey(p, &r); + r->out.result = _winreg_LoadKey(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_LoadKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_LoadKey, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_LoadKey(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_NotifyChangeKeyValue(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_NotifyChangeKeyValue r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_NotifyChangeKeyValue"); + struct winreg_NotifyChangeKeyValue *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_winreg.calls[NDR_WINREG_NOTIFYCHANGEKEYVALUE]; + + r = talloc(NULL, struct winreg_NotifyChangeKeyValue); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_NotifyChangeKeyValue(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_NotifyChangeKeyValue, &r); + NDR_PRINT_IN_DEBUG(winreg_NotifyChangeKeyValue, r); - r.out.result = _winreg_NotifyChangeKeyValue(p, &r); + r->out.result = _winreg_NotifyChangeKeyValue(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_NotifyChangeKeyValue, &r); + NDR_PRINT_OUT_DEBUG(winreg_NotifyChangeKeyValue, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_NotifyChangeKeyValue(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_OpenKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_OpenKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenKey"); + struct winreg_OpenKey *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_winreg.calls[NDR_WINREG_OPENKEY]; + + r = talloc(NULL, struct winreg_OpenKey); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_OpenKey(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_OpenKey, &r); + NDR_PRINT_IN_DEBUG(winreg_OpenKey, r); - ZERO_STRUCT(r.out); - r.out.handle = talloc_zero(mem_ctx, struct policy_handle); - if (r.out.handle == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(r, struct policy_handle); + if (r->out.handle == NULL) { + talloc_free(r); return False; } - r.out.result = _winreg_OpenKey(p, &r); + r->out.result = _winreg_OpenKey(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_OpenKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_OpenKey, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_OpenKey(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_QueryInfoKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_QueryInfoKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_QueryInfoKey"); + struct winreg_QueryInfoKey *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_QUERYINFOKEY]; + + r = talloc(NULL, struct winreg_QueryInfoKey); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_QueryInfoKey(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_QueryInfoKey, &r); + NDR_PRINT_IN_DEBUG(winreg_QueryInfoKey, r); - ZERO_STRUCT(r.out); - r.out.classname = r.in.classname; - r.out.num_subkeys = talloc_zero(mem_ctx, uint32_t); - if (r.out.num_subkeys == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.classname = r->in.classname; + r->out.num_subkeys = talloc_zero(r, uint32_t); + if (r->out.num_subkeys == NULL) { + talloc_free(r); return False; } - r.out.max_subkeylen = talloc_zero(mem_ctx, uint32_t); - if (r.out.max_subkeylen == NULL) { - talloc_free(mem_ctx); + r->out.max_subkeylen = talloc_zero(r, uint32_t); + if (r->out.max_subkeylen == NULL) { + talloc_free(r); return False; } - r.out.max_classlen = talloc_zero(mem_ctx, uint32_t); - if (r.out.max_classlen == NULL) { - talloc_free(mem_ctx); + r->out.max_classlen = talloc_zero(r, uint32_t); + if (r->out.max_classlen == NULL) { + talloc_free(r); return False; } - r.out.num_values = talloc_zero(mem_ctx, uint32_t); - if (r.out.num_values == NULL) { - talloc_free(mem_ctx); + r->out.num_values = talloc_zero(r, uint32_t); + if (r->out.num_values == NULL) { + talloc_free(r); return False; } - r.out.max_valnamelen = talloc_zero(mem_ctx, uint32_t); - if (r.out.max_valnamelen == NULL) { - talloc_free(mem_ctx); + r->out.max_valnamelen = talloc_zero(r, uint32_t); + if (r->out.max_valnamelen == NULL) { + talloc_free(r); return False; } - r.out.max_valbufsize = talloc_zero(mem_ctx, uint32_t); - if (r.out.max_valbufsize == NULL) { - talloc_free(mem_ctx); + r->out.max_valbufsize = talloc_zero(r, uint32_t); + if (r->out.max_valbufsize == NULL) { + talloc_free(r); return False; } - r.out.secdescsize = talloc_zero(mem_ctx, uint32_t); - if (r.out.secdescsize == NULL) { - talloc_free(mem_ctx); + r->out.secdescsize = talloc_zero(r, uint32_t); + if (r->out.secdescsize == NULL) { + talloc_free(r); return False; } - r.out.last_changed_time = talloc_zero(mem_ctx, NTTIME); - if (r.out.last_changed_time == NULL) { - talloc_free(mem_ctx); + r->out.last_changed_time = talloc_zero(r, NTTIME); + if (r->out.last_changed_time == NULL) { + talloc_free(r); return False; } - r.out.result = _winreg_QueryInfoKey(p, &r); + r->out.result = _winreg_QueryInfoKey(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_QueryInfoKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_QueryInfoKey, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_QueryInfoKey(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_QueryValue(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_QueryValue r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_QueryValue"); + struct winreg_QueryValue *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_QUERYVALUE]; + + r = talloc(NULL, struct winreg_QueryValue); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_QueryValue(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_QueryValue, &r); + NDR_PRINT_IN_DEBUG(winreg_QueryValue, r); - ZERO_STRUCT(r.out); - r.out.type = r.in.type; - r.out.data = r.in.data; - r.out.data_size = r.in.data_size; - r.out.value_length = r.in.value_length; - r.out.result = _winreg_QueryValue(p, &r); + ZERO_STRUCT(r->out); + r->out.type = r->in.type; + r->out.data = r->in.data; + r->out.data_size = r->in.data_size; + r->out.value_length = r->in.value_length; + r->out.result = _winreg_QueryValue(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_QueryValue, &r); + NDR_PRINT_OUT_DEBUG(winreg_QueryValue, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_QueryValue(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_ReplaceKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_ReplaceKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_ReplaceKey"); + struct winreg_ReplaceKey *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_REPLACEKEY]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_ReplaceKey); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_ReplaceKey(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_ReplaceKey, &r); + NDR_PRINT_IN_DEBUG(winreg_ReplaceKey, r); - r.out.result = _winreg_ReplaceKey(p, &r); + r->out.result = _winreg_ReplaceKey(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_ReplaceKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_ReplaceKey, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_ReplaceKey(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_RestoreKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_RestoreKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_RestoreKey"); + struct winreg_RestoreKey *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_RESTOREKEY]; + + r = talloc(NULL, struct winreg_RestoreKey); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_RestoreKey(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_RestoreKey, &r); + NDR_PRINT_IN_DEBUG(winreg_RestoreKey, r); - r.out.result = _winreg_RestoreKey(p, &r); + r->out.result = _winreg_RestoreKey(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_RestoreKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_RestoreKey, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_RestoreKey(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_SaveKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_SaveKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_SaveKey"); + struct winreg_SaveKey *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_SAVEKEY]; + + r = talloc(NULL, struct winreg_SaveKey); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_SaveKey(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_SaveKey, &r); + NDR_PRINT_IN_DEBUG(winreg_SaveKey, r); - r.out.result = _winreg_SaveKey(p, &r); + r->out.result = _winreg_SaveKey(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_SaveKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_SaveKey, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_SaveKey(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_SetKeySecurity(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_SetKeySecurity r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_SetKeySecurity"); + struct winreg_SetKeySecurity *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_SETKEYSECURITY]; + + r = talloc(NULL, struct winreg_SetKeySecurity); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_SetKeySecurity(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_SetKeySecurity, &r); + NDR_PRINT_IN_DEBUG(winreg_SetKeySecurity, r); - r.out.result = _winreg_SetKeySecurity(p, &r); + r->out.result = _winreg_SetKeySecurity(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_SetKeySecurity, &r); + NDR_PRINT_OUT_DEBUG(winreg_SetKeySecurity, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_SetKeySecurity(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_SetValue(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_SetValue r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_SetValue"); + struct winreg_SetValue *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_winreg.calls[NDR_WINREG_SETVALUE]; + + r = talloc(NULL, struct winreg_SetValue); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_SetValue(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_SetValue, &r); + NDR_PRINT_IN_DEBUG(winreg_SetValue, r); - r.out.result = _winreg_SetValue(p, &r); + r->out.result = _winreg_SetValue(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_SetValue, &r); + NDR_PRINT_OUT_DEBUG(winreg_SetValue, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_SetValue(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_UnLoadKey(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_UnLoadKey r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_UnLoadKey"); + struct winreg_UnLoadKey *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_UNLOADKEY]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_UnLoadKey); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_UnLoadKey(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_UnLoadKey, &r); + NDR_PRINT_IN_DEBUG(winreg_UnLoadKey, r); - r.out.result = _winreg_UnLoadKey(p, &r); + r->out.result = _winreg_UnLoadKey(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_UnLoadKey, &r); + NDR_PRINT_OUT_DEBUG(winreg_UnLoadKey, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_UnLoadKey(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_InitiateSystemShutdown(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_InitiateSystemShutdown r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_InitiateSystemShutdown"); + struct winreg_InitiateSystemShutdown *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_INITIATESYSTEMSHUTDOWN]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_InitiateSystemShutdown); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_InitiateSystemShutdown(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdown, &r); + NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdown, r); - r.out.result = _winreg_InitiateSystemShutdown(p, &r); + r->out.result = _winreg_InitiateSystemShutdown(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdown, &r); + NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdown, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_InitiateSystemShutdown(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_AbortSystemShutdown(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_AbortSystemShutdown r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_AbortSystemShutdown"); + struct winreg_AbortSystemShutdown *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_ABORTSYSTEMSHUTDOWN]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_AbortSystemShutdown); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_AbortSystemShutdown(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_AbortSystemShutdown, &r); + NDR_PRINT_IN_DEBUG(winreg_AbortSystemShutdown, r); - r.out.result = _winreg_AbortSystemShutdown(p, &r); + r->out.result = _winreg_AbortSystemShutdown(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_AbortSystemShutdown, &r); + NDR_PRINT_OUT_DEBUG(winreg_AbortSystemShutdown, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_AbortSystemShutdown(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_GetVersion(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_GetVersion r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_GetVersion"); + struct winreg_GetVersion *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_GETVERSION]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_GetVersion); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_GetVersion(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_GetVersion, &r); + NDR_PRINT_IN_DEBUG(winreg_GetVersion, r); - ZERO_STRUCT(r.out); - r.out.version = talloc_zero(mem_ctx, uint32_t); - if (r.out.version == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.version = talloc_zero(r, uint32_t); + if (r->out.version == NULL) { + talloc_free(r); return False; } - r.out.result = _winreg_GetVersion(p, &r); + r->out.result = _winreg_GetVersion(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_GetVersion, &r); + NDR_PRINT_OUT_DEBUG(winreg_GetVersion, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_GetVersion(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_OpenHKCC(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_OpenHKCC r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKCC"); + struct winreg_OpenHKCC *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKCC]; + + r = talloc(NULL, struct winreg_OpenHKCC); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_OpenHKCC(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_OpenHKCC, &r); + NDR_PRINT_IN_DEBUG(winreg_OpenHKCC, r); - ZERO_STRUCT(r.out); - r.out.handle = talloc_zero(mem_ctx, struct policy_handle); - if (r.out.handle == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(r, struct policy_handle); + if (r->out.handle == NULL) { + talloc_free(r); return False; } - r.out.result = _winreg_OpenHKCC(p, &r); + r->out.result = _winreg_OpenHKCC(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_OpenHKCC, &r); + NDR_PRINT_OUT_DEBUG(winreg_OpenHKCC, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_OpenHKCC(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_OpenHKDD(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_OpenHKDD r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKDD"); + struct winreg_OpenHKDD *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKDD]; + + r = talloc(NULL, struct winreg_OpenHKDD); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_OpenHKDD(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_OpenHKDD, &r); + NDR_PRINT_IN_DEBUG(winreg_OpenHKDD, r); - ZERO_STRUCT(r.out); - r.out.handle = talloc_zero(mem_ctx, struct policy_handle); - if (r.out.handle == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(r, struct policy_handle); + if (r->out.handle == NULL) { + talloc_free(r); return False; } - r.out.result = _winreg_OpenHKDD(p, &r); + r->out.result = _winreg_OpenHKDD(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_OpenHKDD, &r); + NDR_PRINT_OUT_DEBUG(winreg_OpenHKDD, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_OpenHKDD(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_QueryMultipleValues(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_QueryMultipleValues r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_QueryMultipleValues"); + struct winreg_QueryMultipleValues *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_QUERYMULTIPLEVALUES]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_QueryMultipleValues); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_QueryMultipleValues(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues, &r); + NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues, r); - ZERO_STRUCT(r.out); - r.out.values = r.in.values; - r.out.buffer = r.in.buffer; - r.out.buffer_size = r.in.buffer_size; - r.out.result = _winreg_QueryMultipleValues(p, &r); + ZERO_STRUCT(r->out); + r->out.values = r->in.values; + r->out.buffer = r->in.buffer; + r->out.buffer_size = r->in.buffer_size; + r->out.result = _winreg_QueryMultipleValues(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues, &r); + NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_QueryMultipleValues(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_InitiateSystemShutdownEx(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_InitiateSystemShutdownEx r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_InitiateSystemShutdownEx"); + struct winreg_InitiateSystemShutdownEx *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_INITIATESYSTEMSHUTDOWNEX]; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + r = talloc(NULL, struct winreg_InitiateSystemShutdownEx); + if (r == NULL) { return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return False; + } + + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_InitiateSystemShutdownEx(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdownEx, &r); + NDR_PRINT_IN_DEBUG(winreg_InitiateSystemShutdownEx, r); - r.out.result = _winreg_InitiateSystemShutdownEx(p, &r); + r->out.result = _winreg_InitiateSystemShutdownEx(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdownEx, &r); + NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdownEx, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_InitiateSystemShutdownEx(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_SaveKeyEx(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_SaveKeyEx r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_SaveKeyEx"); + struct winreg_SaveKeyEx *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_SAVEKEYEX]; + + r = talloc(NULL, struct winreg_SaveKeyEx); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_SaveKeyEx(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_SaveKeyEx, &r); + NDR_PRINT_IN_DEBUG(winreg_SaveKeyEx, r); - r.out.result = _winreg_SaveKeyEx(p, &r); + r->out.result = _winreg_SaveKeyEx(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_SaveKeyEx, &r); + NDR_PRINT_OUT_DEBUG(winreg_SaveKeyEx, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_SaveKeyEx(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_OpenHKPT(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_OpenHKPT r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKPT"); + struct winreg_OpenHKPT *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKPT]; + + r = talloc(NULL, struct winreg_OpenHKPT); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_OpenHKPT(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_OpenHKPT, &r); + NDR_PRINT_IN_DEBUG(winreg_OpenHKPT, r); - ZERO_STRUCT(r.out); - r.out.handle = talloc_zero(mem_ctx, struct policy_handle); - if (r.out.handle == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(r, struct policy_handle); + if (r->out.handle == NULL) { + talloc_free(r); return False; } - r.out.result = _winreg_OpenHKPT(p, &r); + r->out.result = _winreg_OpenHKPT(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_OpenHKPT, &r); + NDR_PRINT_OUT_DEBUG(winreg_OpenHKPT, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_OpenHKPT(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_OpenHKPN(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_OpenHKPN r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_OpenHKPN"); + struct winreg_OpenHKPN *r; - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + call = &ndr_table_winreg.calls[NDR_WINREG_OPENHKPN]; + + r = talloc(NULL, struct winreg_OpenHKPN); + if (r == NULL) { + return False; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_OpenHKPN(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_OpenHKPN, &r); + NDR_PRINT_IN_DEBUG(winreg_OpenHKPN, r); - ZERO_STRUCT(r.out); - r.out.handle = talloc_zero(mem_ctx, struct policy_handle); - if (r.out.handle == NULL) { - talloc_free(mem_ctx); + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(r, struct policy_handle); + if (r->out.handle == NULL) { + talloc_free(r); return False; } - r.out.result = _winreg_OpenHKPN(p, &r); + r->out.result = _winreg_OpenHKPN(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_OpenHKPN, &r); + NDR_PRINT_OUT_DEBUG(winreg_OpenHKPN, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_OpenHKPN(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } static BOOL api_winreg_QueryMultipleValues2(pipes_struct *p) { + const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; NTSTATUS status; DATA_BLOB blob; - struct winreg_QueryMultipleValues2 r; - TALLOC_CTX *mem_ctx = talloc_init("api_winreg_QueryMultipleValues2"); + struct winreg_QueryMultipleValues2 *r; + + call = &ndr_table_winreg.calls[NDR_WINREG_QUERYMULTIPLEVALUES2]; + + r = talloc(NULL, struct winreg_QueryMultipleValues2); + if (r == NULL) { + return False; + } - if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { - talloc_free(mem_ctx); + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); return False; } - pull = ndr_pull_init_blob(&blob, mem_ctx); + pull = ndr_pull_init_blob(&blob, r); if (pull == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } pull->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_winreg_QueryMultipleValues2(pull, NDR_IN, &r); + status = call->ndr_pull(pull, NDR_IN, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } if (DEBUGLEVEL >= 10) - NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues2, &r); + NDR_PRINT_IN_DEBUG(winreg_QueryMultipleValues2, r); - r.out.result = _winreg_QueryMultipleValues2(p, &r); + r->out.result = _winreg_QueryMultipleValues2(p, r); if (p->rng_fault_state) { - talloc_free(mem_ctx); + talloc_free(r); /* Return True here, srv_pipe_hnd.c will take care */ return True; } if (DEBUGLEVEL >= 10) - NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues2, &r); + NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues2, r); - push = ndr_push_init_ctx(mem_ctx); + push = ndr_push_init_ctx(r); if (push == NULL) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - status = ndr_push_winreg_QueryMultipleValues2(push, NDR_OUT, &r); + status = call->ndr_push(push, NDR_OUT, r); if (NT_STATUS_IS_ERR(status)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } blob = ndr_push_blob(push); if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32)blob.length)) { - talloc_free(mem_ctx); + talloc_free(r); return False; } - talloc_free(mem_ctx); + talloc_free(r); return True; } |