diff options
author | Gerald Carter <jerry@samba.org> | 2006-09-15 18:32:43 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:51:50 -0500 |
commit | c4013df0c18779191d124dcb3ee35499900b54e0 (patch) | |
tree | 5565886a7c90e36a73b073b040f967bdb7870d21 /source3/librpc/gen_ndr | |
parent | 1052e48e87fc1cf0e93ce880fce1820bd842055b (diff) | |
download | samba-c4013df0c18779191d124dcb3ee35499900b54e0.tar.gz samba-c4013df0c18779191d124dcb3ee35499900b54e0.tar.bz2 samba-c4013df0c18779191d124dcb3ee35499900b54e0.zip |
r18560: * Add in the winreg and initshutdown IDL files
* rename PI_SHUTDOWN from include/smb.h to PI_INITSHUTDOWN
for compatibility with pidl libndr output
(This used to be commit 23a882861311d9d6ca45af1bfcc90d05846ba3a9)
Diffstat (limited to 'source3/librpc/gen_ndr')
-rw-r--r-- | source3/librpc/gen_ndr/cli_initshutdown.c | 71 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/cli_initshutdown.h | 7 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/cli_winreg.c | 737 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/cli_winreg.h | 39 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/initshutdown.h | 62 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_initshutdown.c | 429 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_initshutdown.h | 29 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_winreg.c | 4306 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_winreg.h | 131 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_initshutdown.c | 177 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_initshutdown.h | 9 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_winreg.c | 1954 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/srv_winreg.h | 41 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/winreg.h | 564 |
14 files changed, 8556 insertions, 0 deletions
diff --git a/source3/librpc/gen_ndr/cli_initshutdown.c b/source3/librpc/gen_ndr/cli_initshutdown.c new file mode 100644 index 0000000000..dc07b4c20c --- /dev/null +++ b/source3/librpc/gen_ndr/cli_initshutdown.c @@ -0,0 +1,71 @@ +/* + * Unix SMB/CIFS implementation. + * client auto-generated by pidl. DO NOT MODIFY! + */ + +#include "includes.h" +#include "librpc/gen_ndr/cli_initshutdown.h" + +NTSTATUS rpccli_initshutdown_Init(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot) +{ + struct initshutdown_Init r; + NTSTATUS status; + + /* In parameters */ + r.in.hostname = hostname; + r.in.message = message; + r.in.timeout = timeout; + r.in.force_apps = force_apps; + r.in.reboot = reboot; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_INITSHUTDOWN, DCERPC_INITSHUTDOWN_INIT, &r, (ndr_pull_flags_fn_t)ndr_pull_initshutdown_Init, (ndr_push_flags_fn_t)ndr_push_initshutdown_Init); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_initshutdown_Abort(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *server) +{ + struct initshutdown_Abort r; + NTSTATUS status; + + /* In parameters */ + r.in.server = server; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_INITSHUTDOWN, DCERPC_INITSHUTDOWN_ABORT, &r, (ndr_pull_flags_fn_t)ndr_pull_initshutdown_Abort, (ndr_push_flags_fn_t)ndr_push_initshutdown_Abort); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_initshutdown_InitEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot, uint32_t reason) +{ + struct initshutdown_InitEx r; + NTSTATUS status; + + /* In parameters */ + r.in.hostname = hostname; + r.in.message = message; + r.in.timeout = timeout; + r.in.force_apps = force_apps; + r.in.reboot = reboot; + r.in.reason = reason; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_INITSHUTDOWN, DCERPC_INITSHUTDOWN_INITEX, &r, (ndr_pull_flags_fn_t)ndr_pull_initshutdown_InitEx, (ndr_push_flags_fn_t)ndr_push_initshutdown_InitEx); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + diff --git a/source3/librpc/gen_ndr/cli_initshutdown.h b/source3/librpc/gen_ndr/cli_initshutdown.h new file mode 100644 index 0000000000..947f4ae056 --- /dev/null +++ b/source3/librpc/gen_ndr/cli_initshutdown.h @@ -0,0 +1,7 @@ +#include "librpc/gen_ndr/ndr_initshutdown.h" +#ifndef __CLI_INITSHUTDOWN__ +#define __CLI_INITSHUTDOWN__ +NTSTATUS rpccli_initshutdown_Init(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot); +NTSTATUS rpccli_initshutdown_Abort(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *server); +NTSTATUS rpccli_initshutdown_InitEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot, uint32_t reason); +#endif /* __CLI_INITSHUTDOWN__ */ diff --git a/source3/librpc/gen_ndr/cli_winreg.c b/source3/librpc/gen_ndr/cli_winreg.c new file mode 100644 index 0000000000..0dd7dcd035 --- /dev/null +++ b/source3/librpc/gen_ndr/cli_winreg.c @@ -0,0 +1,737 @@ +/* + * Unix SMB/CIFS implementation. + * client auto-generated by pidl. DO NOT MODIFY! + */ + +#include "includes.h" +#include "librpc/gen_ndr/cli_winreg.h" + +NTSTATUS rpccli_winreg_OpenHKCR(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle) +{ + struct winreg_OpenHKCR r; + NTSTATUS status; + + /* In parameters */ + r.in.system_name = system_name; + r.in.access_mask = access_mask; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_OPENHKCR, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_OpenHKCR, (ndr_push_flags_fn_t)ndr_push_winreg_OpenHKCR); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *handle = *r.out.handle; + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_OpenHKCU(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle) +{ + struct winreg_OpenHKCU r; + NTSTATUS status; + + /* In parameters */ + r.in.system_name = system_name; + r.in.access_mask = access_mask; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_OPENHKCU, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_OpenHKCU, (ndr_push_flags_fn_t)ndr_push_winreg_OpenHKCU); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *handle = *r.out.handle; + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_OpenHKLM(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle) +{ + struct winreg_OpenHKLM r; + NTSTATUS status; + + /* In parameters */ + r.in.system_name = system_name; + r.in.access_mask = access_mask; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_OPENHKLM, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_OpenHKLM, (ndr_push_flags_fn_t)ndr_push_winreg_OpenHKLM); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *handle = *r.out.handle; + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_OpenHKPD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle) +{ + struct winreg_OpenHKPD r; + NTSTATUS status; + + /* In parameters */ + r.in.system_name = system_name; + r.in.access_mask = access_mask; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_OPENHKPD, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_OpenHKPD, (ndr_push_flags_fn_t)ndr_push_winreg_OpenHKPD); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *handle = *r.out.handle; + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_OpenHKU(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle) +{ + struct winreg_OpenHKU r; + NTSTATUS status; + + /* In parameters */ + r.in.system_name = system_name; + r.in.access_mask = access_mask; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_OPENHKU, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_OpenHKU, (ndr_push_flags_fn_t)ndr_push_winreg_OpenHKU); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *handle = *r.out.handle; + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_CloseKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle) +{ + struct winreg_CloseKey r; + NTSTATUS status; + + /* In parameters */ + r.in.handle = handle; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_CLOSEKEY, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_CloseKey, (ndr_push_flags_fn_t)ndr_push_winreg_CloseKey); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *handle = *r.out.handle; + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String name, struct winreg_String keyclass, uint32_t options, uint32_t access_mask, struct winreg_SecBuf *secdesc, struct policy_handle *new_handle, enum winreg_CreateAction *action_taken) +{ + struct winreg_CreateKey r; + NTSTATUS status; + + /* In parameters */ + r.in.handle = handle; + r.in.name = name; + r.in.keyclass = keyclass; + r.in.options = options; + r.in.access_mask = access_mask; + r.in.secdesc = secdesc; + r.in.action_taken = action_taken; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_CREATEKEY, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_CreateKey, (ndr_push_flags_fn_t)ndr_push_winreg_CreateKey); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *new_handle = *r.out.new_handle; + *action_taken = *r.out.action_taken; + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_DeleteKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String key) +{ + struct winreg_DeleteKey r; + NTSTATUS status; + + /* In parameters */ + r.in.handle = handle; + r.in.key = key; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_DELETEKEY, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_DeleteKey, (ndr_push_flags_fn_t)ndr_push_winreg_DeleteKey); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_DeleteValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String value) +{ + struct winreg_DeleteValue r; + NTSTATUS status; + + /* In parameters */ + r.in.handle = handle; + r.in.value = value; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_DELETEVALUE, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_DeleteValue, (ndr_push_flags_fn_t)ndr_push_winreg_DeleteValue); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, struct winreg_StringBuf *keyclass, NTTIME *last_changed_time) +{ + struct winreg_EnumKey r; + NTSTATUS status; + + /* In parameters */ + r.in.handle = handle; + r.in.enum_index = enum_index; + r.in.name = name; + r.in.keyclass = keyclass; + r.in.last_changed_time = last_changed_time; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_ENUMKEY, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_EnumKey, (ndr_push_flags_fn_t)ndr_push_winreg_EnumKey); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *name = *r.out.name; + *keyclass = *r.out.keyclass; + *last_changed_time = *r.out.last_changed_time; + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, enum winreg_Type *type, uint8_t *value, uint32_t *size, uint32_t *length) +{ + struct winreg_EnumValue r; + NTSTATUS status; + + /* In parameters */ + r.in.handle = handle; + r.in.enum_index = enum_index; + r.in.name = name; + r.in.type = type; + r.in.value = value; + r.in.size = size; + r.in.length = length; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_ENUMVALUE, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_EnumValue, (ndr_push_flags_fn_t)ndr_push_winreg_EnumValue); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *name = *r.out.name; + *type = *r.out.type; + *value = *r.out.value; + *size = *r.out.size; + *length = *r.out.length; + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_FlushKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle) +{ + struct winreg_FlushKey r; + NTSTATUS status; + + /* In parameters */ + r.in.handle = handle; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_FLUSHKEY, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_FlushKey, (ndr_push_flags_fn_t)ndr_push_winreg_FlushKey); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_GetKeySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t sec_info, struct KeySecurityData *sd) +{ + struct winreg_GetKeySecurity r; + NTSTATUS status; + + /* In parameters */ + r.in.handle = handle; + r.in.sec_info = sec_info; + r.in.sd = sd; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_GETKEYSECURITY, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_GetKeySecurity, (ndr_push_flags_fn_t)ndr_push_winreg_GetKeySecurity); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *sd = *r.out.sd; + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_LoadKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *keyname, struct winreg_String *filename) +{ + struct winreg_LoadKey r; + NTSTATUS status; + + /* In parameters */ + r.in.handle = handle; + r.in.keyname = keyname; + r.in.filename = filename; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_LOADKEY, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_LoadKey, (ndr_push_flags_fn_t)ndr_push_winreg_LoadKey); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_NotifyChangeKeyValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint8_t watch_subtree, uint32_t notify_filter, uint32_t unknown, struct winreg_String string1, struct winreg_String string2, uint32_t unknown2) +{ + struct winreg_NotifyChangeKeyValue r; + NTSTATUS status; + + /* In parameters */ + r.in.handle = handle; + r.in.watch_subtree = watch_subtree; + r.in.notify_filter = notify_filter; + r.in.unknown = unknown; + r.in.string1 = string1; + r.in.string2 = string2; + r.in.unknown2 = unknown2; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_NOTIFYCHANGEKEYVALUE, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_NotifyChangeKeyValue, (ndr_push_flags_fn_t)ndr_push_winreg_NotifyChangeKeyValue); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_OpenKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *parent_handle, struct winreg_String keyname, uint32_t unknown, uint32_t access_mask, struct policy_handle *handle) +{ + struct winreg_OpenKey r; + NTSTATUS status; + + /* In parameters */ + r.in.parent_handle = parent_handle; + r.in.keyname = keyname; + r.in.unknown = unknown; + r.in.access_mask = access_mask; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_OPENKEY, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_OpenKey, (ndr_push_flags_fn_t)ndr_push_winreg_OpenKey); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *handle = *r.out.handle; + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String class_in, struct winreg_String *class_out, uint32_t *num_subkeys, uint32_t *max_subkeylen, uint32_t *max_subkeysize, uint32_t *num_values, uint32_t *max_valnamelen, uint32_t *max_valbufsize, uint32_t *secdescsize, NTTIME *last_changed_time) +{ + struct winreg_QueryInfoKey r; + NTSTATUS status; + + /* In parameters */ + r.in.handle = handle; + r.in.class_in = class_in; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_QUERYINFOKEY, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_QueryInfoKey, (ndr_push_flags_fn_t)ndr_push_winreg_QueryInfoKey); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *class_out = *r.out.class_out; + *num_subkeys = *r.out.num_subkeys; + *max_subkeylen = *r.out.max_subkeylen; + *max_subkeysize = *r.out.max_subkeysize; + *num_values = *r.out.num_values; + *max_valnamelen = *r.out.max_valnamelen; + *max_valbufsize = *r.out.max_valbufsize; + *secdescsize = *r.out.secdescsize; + *last_changed_time = *r.out.last_changed_time; + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String value_name, enum winreg_Type *type, uint8_t *data, uint32_t *size, uint32_t *length) +{ + struct winreg_QueryValue r; + NTSTATUS status; + + /* In parameters */ + r.in.handle = handle; + r.in.value_name = value_name; + r.in.type = type; + r.in.data = data; + r.in.size = size; + r.in.length = length; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_QUERYVALUE, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_QueryValue, (ndr_push_flags_fn_t)ndr_push_winreg_QueryValue); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *type = *r.out.type; + *data = *r.out.data; + *size = *r.out.size; + *length = *r.out.length; + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_ReplaceKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +{ + struct winreg_ReplaceKey r; + NTSTATUS status; + + /* In parameters */ + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_REPLACEKEY, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_ReplaceKey, (ndr_push_flags_fn_t)ndr_push_winreg_ReplaceKey); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +{ + struct winreg_RestoreKey r; + NTSTATUS status; + + /* In parameters */ + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_RESTOREKEY, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_RestoreKey, (ndr_push_flags_fn_t)ndr_push_winreg_RestoreKey); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +{ + struct winreg_SaveKey r; + NTSTATUS status; + + /* In parameters */ + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_SAVEKEY, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_SaveKey, (ndr_push_flags_fn_t)ndr_push_winreg_SaveKey); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_SetKeySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t access_mask, struct KeySecurityData *sd) +{ + struct winreg_SetKeySecurity r; + NTSTATUS status; + + /* In parameters */ + r.in.handle = handle; + r.in.access_mask = access_mask; + r.in.sd = sd; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_SETKEYSECURITY, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_SetKeySecurity, (ndr_push_flags_fn_t)ndr_push_winreg_SetKeySecurity); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *sd = *r.out.sd; + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_SetValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String name, enum winreg_Type type, uint8_t *data, uint32_t size) +{ + struct winreg_SetValue r; + NTSTATUS status; + + /* In parameters */ + r.in.handle = handle; + r.in.name = name; + r.in.type = type; + r.in.data = data; + r.in.size = size; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_SETVALUE, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_SetValue, (ndr_push_flags_fn_t)ndr_push_winreg_SetValue); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_UnLoadKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +{ + struct winreg_UnLoadKey r; + NTSTATUS status; + + /* In parameters */ + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_UNLOADKEY, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_UnLoadKey, (ndr_push_flags_fn_t)ndr_push_winreg_UnLoadKey); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_InitiateSystemShutdown(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot) +{ + struct winreg_InitiateSystemShutdown r; + NTSTATUS status; + + /* In parameters */ + r.in.hostname = hostname; + r.in.message = message; + r.in.timeout = timeout; + r.in.force_apps = force_apps; + r.in.reboot = reboot; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_INITIATESYSTEMSHUTDOWN, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_InitiateSystemShutdown, (ndr_push_flags_fn_t)ndr_push_winreg_InitiateSystemShutdown); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_AbortSystemShutdown(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *server) +{ + struct winreg_AbortSystemShutdown r; + NTSTATUS status; + + /* In parameters */ + r.in.server = server; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_ABORTSYSTEMSHUTDOWN, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_AbortSystemShutdown, (ndr_push_flags_fn_t)ndr_push_winreg_AbortSystemShutdown); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_GetVersion(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *version) +{ + struct winreg_GetVersion r; + NTSTATUS status; + + /* In parameters */ + r.in.handle = handle; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_GETVERSION, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_GetVersion, (ndr_push_flags_fn_t)ndr_push_winreg_GetVersion); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *version = *r.out.version; + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_OpenHKCC(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle) +{ + struct winreg_OpenHKCC r; + NTSTATUS status; + + /* In parameters */ + r.in.system_name = system_name; + r.in.access_mask = access_mask; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_OPENHKCC, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_OpenHKCC, (ndr_push_flags_fn_t)ndr_push_winreg_OpenHKCC); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *handle = *r.out.handle; + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_OpenHKDD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle) +{ + struct winreg_OpenHKDD r; + NTSTATUS status; + + /* In parameters */ + r.in.system_name = system_name; + r.in.access_mask = access_mask; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_OPENHKDD, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_OpenHKDD, (ndr_push_flags_fn_t)ndr_push_winreg_OpenHKDD); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *handle = *r.out.handle; + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_QueryMultipleValues(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *key_handle, struct QueryMultipleValue *values, uint32_t num_values, uint8_t *buffer, uint32_t *buffer_size) +{ + struct winreg_QueryMultipleValues r; + NTSTATUS status; + + /* In parameters */ + r.in.key_handle = key_handle; + r.in.values = values; + r.in.num_values = num_values; + r.in.buffer = buffer; + r.in.buffer_size = buffer_size; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_QUERYMULTIPLEVALUES, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_QueryMultipleValues, (ndr_push_flags_fn_t)ndr_push_winreg_QueryMultipleValues); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *values = *r.out.values; + *buffer = *r.out.buffer; + *buffer_size = *r.out.buffer_size; + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_InitiateSystemShutdownEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot, uint32_t reason) +{ + struct winreg_InitiateSystemShutdownEx r; + NTSTATUS status; + + /* In parameters */ + r.in.hostname = hostname; + r.in.message = message; + r.in.timeout = timeout; + r.in.force_apps = force_apps; + r.in.reboot = reboot; + r.in.reason = reason; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_INITIATESYSTEMSHUTDOWNEX, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_InitiateSystemShutdownEx, (ndr_push_flags_fn_t)ndr_push_winreg_InitiateSystemShutdownEx); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_SaveKeyEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +{ + struct winreg_SaveKeyEx r; + NTSTATUS status; + + /* In parameters */ + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_SAVEKEYEX, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_SaveKeyEx, (ndr_push_flags_fn_t)ndr_push_winreg_SaveKeyEx); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_OpenHKPT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle) +{ + struct winreg_OpenHKPT r; + NTSTATUS status; + + /* In parameters */ + r.in.system_name = system_name; + r.in.access_mask = access_mask; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_OPENHKPT, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_OpenHKPT, (ndr_push_flags_fn_t)ndr_push_winreg_OpenHKPT); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *handle = *r.out.handle; + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_OpenHKPN(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle) +{ + struct winreg_OpenHKPN r; + NTSTATUS status; + + /* In parameters */ + r.in.system_name = system_name; + r.in.access_mask = access_mask; + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_OPENHKPN, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_OpenHKPN, (ndr_push_flags_fn_t)ndr_push_winreg_OpenHKPN); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *handle = *r.out.handle; + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + +NTSTATUS rpccli_winreg_QueryMultipleValues2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx) +{ + struct winreg_QueryMultipleValues2 r; + NTSTATUS status; + + /* In parameters */ + status = cli_do_rpc_ndr(cli, mem_ctx, PI_WINREG, DCERPC_WINREG_QUERYMULTIPLEVALUES2, &r, (ndr_pull_flags_fn_t)ndr_pull_winreg_QueryMultipleValues2, (ndr_push_flags_fn_t)ndr_push_winreg_QueryMultipleValues2); + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return werror_to_ntstatus(r.out.result); +} + diff --git a/source3/librpc/gen_ndr/cli_winreg.h b/source3/librpc/gen_ndr/cli_winreg.h new file mode 100644 index 0000000000..041efd2b91 --- /dev/null +++ b/source3/librpc/gen_ndr/cli_winreg.h @@ -0,0 +1,39 @@ +#include "librpc/gen_ndr/ndr_winreg.h" +#ifndef __CLI_WINREG__ +#define __CLI_WINREG__ +NTSTATUS rpccli_winreg_OpenHKCR(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle); +NTSTATUS rpccli_winreg_OpenHKCU(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle); +NTSTATUS rpccli_winreg_OpenHKLM(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle); +NTSTATUS rpccli_winreg_OpenHKPD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle); +NTSTATUS rpccli_winreg_OpenHKU(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle); +NTSTATUS rpccli_winreg_CloseKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle); +NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String name, struct winreg_String keyclass, uint32_t options, uint32_t access_mask, struct winreg_SecBuf *secdesc, struct policy_handle *new_handle, enum winreg_CreateAction *action_taken); +NTSTATUS rpccli_winreg_DeleteKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String key); +NTSTATUS rpccli_winreg_DeleteValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String value); +NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, struct winreg_StringBuf *keyclass, NTTIME *last_changed_time); +NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, enum winreg_Type *type, uint8_t *value, uint32_t *size, uint32_t *length); +NTSTATUS rpccli_winreg_FlushKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle); +NTSTATUS rpccli_winreg_GetKeySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t sec_info, struct KeySecurityData *sd); +NTSTATUS rpccli_winreg_LoadKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *keyname, struct winreg_String *filename); +NTSTATUS rpccli_winreg_NotifyChangeKeyValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint8_t watch_subtree, uint32_t notify_filter, uint32_t unknown, struct winreg_String string1, struct winreg_String string2, uint32_t unknown2); +NTSTATUS rpccli_winreg_OpenKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *parent_handle, struct winreg_String keyname, uint32_t unknown, uint32_t access_mask, struct policy_handle *handle); +NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String class_in, struct winreg_String *class_out, uint32_t *num_subkeys, uint32_t *max_subkeylen, uint32_t *max_subkeysize, uint32_t *num_values, uint32_t *max_valnamelen, uint32_t *max_valbufsize, uint32_t *secdescsize, NTTIME *last_changed_time); +NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String value_name, enum winreg_Type *type, uint8_t *data, uint32_t *size, uint32_t *length); +NTSTATUS rpccli_winreg_ReplaceKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_winreg_SetKeySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t access_mask, struct KeySecurityData *sd); +NTSTATUS rpccli_winreg_SetValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String name, enum winreg_Type type, uint8_t *data, uint32_t size); +NTSTATUS rpccli_winreg_UnLoadKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_winreg_InitiateSystemShutdown(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot); +NTSTATUS rpccli_winreg_AbortSystemShutdown(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *server); +NTSTATUS rpccli_winreg_GetVersion(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *version); +NTSTATUS rpccli_winreg_OpenHKCC(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle); +NTSTATUS rpccli_winreg_OpenHKDD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle); +NTSTATUS rpccli_winreg_QueryMultipleValues(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *key_handle, struct QueryMultipleValue *values, uint32_t num_values, uint8_t *buffer, uint32_t *buffer_size); +NTSTATUS rpccli_winreg_InitiateSystemShutdownEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot, uint32_t reason); +NTSTATUS rpccli_winreg_SaveKeyEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_winreg_OpenHKPT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle); +NTSTATUS rpccli_winreg_OpenHKPN(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle); +NTSTATUS rpccli_winreg_QueryMultipleValues2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); +#endif /* __CLI_WINREG__ */ diff --git a/source3/librpc/gen_ndr/initshutdown.h b/source3/librpc/gen_ndr/initshutdown.h new file mode 100644 index 0000000000..58f7b3bc6e --- /dev/null +++ b/source3/librpc/gen_ndr/initshutdown.h @@ -0,0 +1,62 @@ +/* header auto-generated by pidl */ + +#ifndef _HEADER_initshutdown +#define _HEADER_initshutdown + +struct initshutdown_String_sub { + uint32_t name_size;/* [keepref,value(strlen_m_term(name))] */ + const char * name;/* [keepref,flag(LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_NOTERM)] */ +}; + +struct initshutdown_String { + uint16_t name_len;/* [keepref,value(strlen_m(r->name->name)*2)] */ + uint16_t name_size;/* [keepref,value(strlen_m_term(r->name->name)*2)] */ + struct initshutdown_String_sub *name;/* [unique,keepref] */ +}/* [public] */; + + +struct initshutdown_Init { + struct { + uint16_t *hostname;/* [unique,keepref] */ + struct initshutdown_String *message;/* [unique,keepref] */ + uint32_t timeout;/* [keepref] */ + uint8_t force_apps;/* [keepref] */ + uint8_t reboot;/* [keepref] */ + } in; + + struct { + WERROR result; + } out; + +}; + + +struct initshutdown_Abort { + struct { + uint16_t *server;/* [unique,keepref] */ + } in; + + struct { + WERROR result; + } out; + +}; + + +struct initshutdown_InitEx { + struct { + uint16_t *hostname;/* [unique,keepref] */ + struct initshutdown_String *message;/* [unique,keepref] */ + uint32_t timeout;/* [keepref] */ + uint8_t force_apps;/* [keepref] */ + uint8_t reboot;/* [keepref] */ + uint32_t reason;/* [keepref] */ + } in; + + struct { + WERROR result; + } out; + +}; + +#endif /* _HEADER_initshutdown */ diff --git a/source3/librpc/gen_ndr/ndr_initshutdown.c b/source3/librpc/gen_ndr/ndr_initshutdown.c new file mode 100644 index 0000000000..3341d5cbaa --- /dev/null +++ b/source3/librpc/gen_ndr/ndr_initshutdown.c @@ -0,0 +1,429 @@ +/* parser auto-generated by pidl */ + +#include "includes.h" +#include "librpc/gen_ndr/ndr_initshutdown.h" + +NTSTATUS ndr_push_initshutdown_String_sub(struct ndr_push *ndr, int ndr_flags, const struct initshutdown_String_sub *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, strlen_m_term(r->name))); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_NOTERM); + NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->name)); + ndr->flags = _flags_save_string; + } + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_initshutdown_String_sub(struct ndr_pull *ndr, int ndr_flags, struct initshutdown_String_sub *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->name_size)); + { + uint32_t _flags_save_string = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_NOTERM); + NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->name)); + ndr->flags = _flags_save_string; + } + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_initshutdown_String_sub(struct ndr_print *ndr, const char *name, const struct initshutdown_String_sub *r) +{ + ndr_print_struct(ndr, name, "initshutdown_String_sub"); + ndr->depth++; + ndr_print_uint32(ndr, "name_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m_term(r->name):r->name_size); + ndr_print_string(ndr, "name", r->name); + ndr->depth--; +} + +_PUBLIC_ NTSTATUS ndr_push_initshutdown_String(struct ndr_push *ndr, int ndr_flags, const struct initshutdown_String *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen_m(r->name->name)*2)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen_m_term(r->name->name)*2)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->name)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->name) { + NDR_CHECK(ndr_push_initshutdown_String_sub(ndr, NDR_SCALARS, r->name)); + } + } + return NT_STATUS_OK; +} + +_PUBLIC_ NTSTATUS ndr_pull_initshutdown_String(struct ndr_pull *ndr, int ndr_flags, struct initshutdown_String *r) +{ + uint32_t _ptr_name; + TALLOC_CTX *_mem_save_name_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->name_len)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->name_size)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_name)); + if (_ptr_name) { + NDR_PULL_ALLOC(ndr, r->name); + } else { + r->name = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->name) { + _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->name, 0); + NDR_CHECK(ndr_pull_initshutdown_String_sub(ndr, NDR_SCALARS, r->name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, 0); + } + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_initshutdown_String(struct ndr_print *ndr, const char *name, const struct initshutdown_String *r) +{ + ndr_print_struct(ndr, name, "initshutdown_String"); + ndr->depth++; + ndr_print_uint16(ndr, "name_len", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m(r->name->name)*2:r->name_len); + ndr_print_uint16(ndr, "name_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m_term(r->name->name)*2:r->name_size); + ndr_print_ptr(ndr, "name", r->name); + ndr->depth++; + if (r->name) { + ndr_print_initshutdown_String_sub(ndr, "name", r->name); + } + ndr->depth--; + ndr->depth--; +} + +NTSTATUS ndr_push_initshutdown_Init(struct ndr_push *ndr, int flags, const struct initshutdown_Init *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.hostname)); + if (r->in.hostname) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.hostname)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.message)); + if (r->in.message) { + NDR_CHECK(ndr_push_initshutdown_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message)); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.timeout)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.force_apps)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.reboot)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_initshutdown_Init(struct ndr_pull *ndr, int flags, struct initshutdown_Init *r) +{ + uint32_t _ptr_hostname; + uint32_t _ptr_message; + TALLOC_CTX *_mem_save_hostname_0; + TALLOC_CTX *_mem_save_message_0; + if (flags & NDR_IN) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_hostname)); + if (_ptr_hostname) { + NDR_PULL_ALLOC(ndr, r->in.hostname); + } else { + r->in.hostname = NULL; + } + if (r->in.hostname) { + _mem_save_hostname_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.hostname, 0); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.hostname)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_hostname_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_message)); + if (_ptr_message) { + NDR_PULL_ALLOC(ndr, r->in.message); + } else { + r->in.message = NULL; + } + if (r->in.message) { + _mem_save_message_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.message, 0); + NDR_CHECK(ndr_pull_initshutdown_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_message_0, 0); + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.timeout)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.force_apps)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.reboot)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_initshutdown_Init(struct ndr_print *ndr, const char *name, int flags, const struct initshutdown_Init *r) +{ + ndr_print_struct(ndr, name, "initshutdown_Init"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "initshutdown_Init"); + ndr->depth++; + ndr_print_ptr(ndr, "hostname", r->in.hostname); + ndr->depth++; + if (r->in.hostname) { + ndr_print_uint16(ndr, "hostname", *r->in.hostname); + } + ndr->depth--; + ndr_print_ptr(ndr, "message", r->in.message); + ndr->depth++; + if (r->in.message) { + ndr_print_initshutdown_String(ndr, "message", r->in.message); + } + ndr->depth--; + ndr_print_uint32(ndr, "timeout", r->in.timeout); + ndr_print_uint8(ndr, "force_apps", r->in.force_apps); + ndr_print_uint8(ndr, "reboot", r->in.reboot); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "initshutdown_Init"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_initshutdown_Abort(struct ndr_push *ndr, int flags, const struct initshutdown_Abort *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server)); + if (r->in.server) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.server)); + } + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_initshutdown_Abort(struct ndr_pull *ndr, int flags, struct initshutdown_Abort *r) +{ + uint32_t _ptr_server; + TALLOC_CTX *_mem_save_server_0; + if (flags & NDR_IN) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server)); + if (_ptr_server) { + NDR_PULL_ALLOC(ndr, r->in.server); + } else { + r->in.server = NULL; + } + if (r->in.server) { + _mem_save_server_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.server, 0); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.server)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_0, 0); + } + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_initshutdown_Abort(struct ndr_print *ndr, const char *name, int flags, const struct initshutdown_Abort *r) +{ + ndr_print_struct(ndr, name, "initshutdown_Abort"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "initshutdown_Abort"); + ndr->depth++; + ndr_print_ptr(ndr, "server", r->in.server); + ndr->depth++; + if (r->in.server) { + ndr_print_uint16(ndr, "server", *r->in.server); + } + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "initshutdown_Abort"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_initshutdown_InitEx(struct ndr_push *ndr, int flags, const struct initshutdown_InitEx *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.hostname)); + if (r->in.hostname) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.hostname)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.message)); + if (r->in.message) { + NDR_CHECK(ndr_push_initshutdown_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message)); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.timeout)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.force_apps)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.reboot)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.reason)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_initshutdown_InitEx(struct ndr_pull *ndr, int flags, struct initshutdown_InitEx *r) +{ + uint32_t _ptr_hostname; + uint32_t _ptr_message; + TALLOC_CTX *_mem_save_hostname_0; + TALLOC_CTX *_mem_save_message_0; + if (flags & NDR_IN) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_hostname)); + if (_ptr_hostname) { + NDR_PULL_ALLOC(ndr, r->in.hostname); + } else { + r->in.hostname = NULL; + } + if (r->in.hostname) { + _mem_save_hostname_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.hostname, 0); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.hostname)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_hostname_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_message)); + if (_ptr_message) { + NDR_PULL_ALLOC(ndr, r->in.message); + } else { + r->in.message = NULL; + } + if (r->in.message) { + _mem_save_message_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.message, 0); + NDR_CHECK(ndr_pull_initshutdown_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_message_0, 0); + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.timeout)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.force_apps)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.reboot)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.reason)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_initshutdown_InitEx(struct ndr_print *ndr, const char *name, int flags, const struct initshutdown_InitEx *r) +{ + ndr_print_struct(ndr, name, "initshutdown_InitEx"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "initshutdown_InitEx"); + ndr->depth++; + ndr_print_ptr(ndr, "hostname", r->in.hostname); + ndr->depth++; + if (r->in.hostname) { + ndr_print_uint16(ndr, "hostname", *r->in.hostname); + } + ndr->depth--; + ndr_print_ptr(ndr, "message", r->in.message); + ndr->depth++; + if (r->in.message) { + ndr_print_initshutdown_String(ndr, "message", r->in.message); + } + ndr->depth--; + ndr_print_uint32(ndr, "timeout", r->in.timeout); + ndr_print_uint8(ndr, "force_apps", r->in.force_apps); + ndr_print_uint8(ndr, "reboot", r->in.reboot); + ndr_print_uint32(ndr, "reason", r->in.reason); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "initshutdown_InitEx"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +const struct dcerpc_interface_call initshutdown_calls[] = { + { + "initshutdown_Init", + sizeof(struct initshutdown_Init), + (ndr_push_flags_fn_t) ndr_push_initshutdown_Init, + (ndr_pull_flags_fn_t) ndr_pull_initshutdown_Init, + (ndr_print_function_t) ndr_print_initshutdown_Init, + False, + }, + { + "initshutdown_Abort", + sizeof(struct initshutdown_Abort), + (ndr_push_flags_fn_t) ndr_push_initshutdown_Abort, + (ndr_pull_flags_fn_t) ndr_pull_initshutdown_Abort, + (ndr_print_function_t) ndr_print_initshutdown_Abort, + False, + }, + { + "initshutdown_InitEx", + sizeof(struct initshutdown_InitEx), + (ndr_push_flags_fn_t) ndr_push_initshutdown_InitEx, + (ndr_pull_flags_fn_t) ndr_pull_initshutdown_InitEx, + (ndr_print_function_t) ndr_print_initshutdown_InitEx, + False, + }, + { NULL, 0, NULL, NULL, NULL, False } +}; + +const char * const initshutdown_endpoint_strings[] = { + "ncacn_np:[\\pipe\\InitShutdown]", +}; + +const struct dcerpc_endpoint_list initshutdown_endpoints = { + .count = 1, + .names = initshutdown_endpoint_strings +}; + +const char * const initshutdown_authservice_strings[] = { + "host", +}; + +const struct dcerpc_authservice_list initshutdown_authservices = { + .count = 1, + .names = initshutdown_authservice_strings +}; + + +const struct dcerpc_interface_table dcerpc_table_initshutdown = { + .name = "initshutdown", + .syntax_id = { + {0x894de0c0,0x0d55,0x11d3,{0xa3,0x22},{0x00,0xc0,0x4f,0xa3,0x21,0xa1}}, + DCERPC_INITSHUTDOWN_VERSION + }, + .helpstring = DCERPC_INITSHUTDOWN_HELPSTRING, + .num_calls = 3, + .calls = initshutdown_calls, + .endpoints = &initshutdown_endpoints, + .authservices = &initshutdown_authservices +}; + diff --git a/source3/librpc/gen_ndr/ndr_initshutdown.h b/source3/librpc/gen_ndr/ndr_initshutdown.h new file mode 100644 index 0000000000..0df80cb707 --- /dev/null +++ b/source3/librpc/gen_ndr/ndr_initshutdown.h @@ -0,0 +1,29 @@ +/* header auto-generated by pidl */ + +#include "librpc/gen_ndr/initshutdown.h" + +#ifndef _HEADER_NDR_initshutdown +#define _HEADER_NDR_initshutdown + +#include "librpc/ndr/libndr.h" +#define DCERPC_INITSHUTDOWN_UUID "894de0c0-0d55-11d3-a322-00c04fa321a1" +#define DCERPC_INITSHUTDOWN_VERSION 1.0 +#define DCERPC_INITSHUTDOWN_NAME "initshutdown" +#define DCERPC_INITSHUTDOWN_HELPSTRING "Init shutdown service" +extern const struct dcerpc_interface_table dcerpc_table_initshutdown; +NTSTATUS dcerpc_server_initshutdown_init(void); +#define DCERPC_INITSHUTDOWN_INIT (0x00) + +#define DCERPC_INITSHUTDOWN_ABORT (0x01) + +#define DCERPC_INITSHUTDOWN_INITEX (0x02) + +#define DCERPC_INITSHUTDOWN_CALL_COUNT (3) +void ndr_print_initshutdown_String_sub(struct ndr_print *ndr, const char *name, const struct initshutdown_String_sub *r); +NTSTATUS ndr_push_initshutdown_String(struct ndr_push *ndr, int ndr_flags, const struct initshutdown_String *r); +NTSTATUS ndr_pull_initshutdown_String(struct ndr_pull *ndr, int ndr_flags, struct initshutdown_String *r); +void ndr_print_initshutdown_String(struct ndr_print *ndr, const char *name, const struct initshutdown_String *r); +void ndr_print_initshutdown_Init(struct ndr_print *ndr, const char *name, int flags, const struct initshutdown_Init *r); +void ndr_print_initshutdown_Abort(struct ndr_print *ndr, const char *name, int flags, const struct initshutdown_Abort *r); +void ndr_print_initshutdown_InitEx(struct ndr_print *ndr, const char *name, int flags, const struct initshutdown_InitEx *r); +#endif /* _HEADER_NDR_initshutdown */ diff --git a/source3/librpc/gen_ndr/ndr_winreg.c b/source3/librpc/gen_ndr/ndr_winreg.c new file mode 100644 index 0000000000..0bd5528c9c --- /dev/null +++ b/source3/librpc/gen_ndr/ndr_winreg.c @@ -0,0 +1,4306 @@ +/* parser auto-generated by pidl */ + +#include "includes.h" +#include "librpc/gen_ndr/ndr_winreg.h" + +#include "librpc/gen_ndr/ndr_lsa.h" +#include "librpc/gen_ndr/ndr_initshutdown.h" +#include "librpc/gen_ndr/ndr_security.h" +NTSTATUS ndr_push_winreg_AccessMask(struct ndr_push *ndr, int ndr_flags, uint32_t r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_AccessMask(struct ndr_pull *ndr, int ndr_flags, uint32_t *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_AccessMask(struct ndr_print *ndr, const char *name, uint32_t r) +{ + ndr_print_uint32(ndr, name, r); + ndr->depth++; + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_Type(struct ndr_push *ndr, int ndr_flags, enum winreg_Type r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_Type(struct ndr_pull *ndr, int ndr_flags, enum winreg_Type *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_Type(struct ndr_print *ndr, const char *name, enum winreg_Type r) +{ + const char *val = NULL; + + switch (r) { + case REG_NONE: val = "REG_NONE"; break; + case REG_SZ: val = "REG_SZ"; break; + case REG_EXPAND_SZ: val = "REG_EXPAND_SZ"; break; + case REG_BINARY: val = "REG_BINARY"; break; + case REG_DWORD: val = "REG_DWORD"; break; + case REG_DWORD_BIG_ENDIAN: val = "REG_DWORD_BIG_ENDIAN"; break; + case REG_LINK: val = "REG_LINK"; break; + case REG_MULTI_SZ: val = "REG_MULTI_SZ"; break; + case REG_RESOURCE_LIST: val = "REG_RESOURCE_LIST"; break; + case REG_FULL_RESOURCE_DESCRIPTOR: val = "REG_FULL_RESOURCE_DESCRIPTOR"; break; + case REG_RESOURCE_REQUIREMENTS_LIST: val = "REG_RESOURCE_REQUIREMENTS_LIST"; break; + case REG_QWORD: val = "REG_QWORD"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +_PUBLIC_ NTSTATUS ndr_push_winreg_String(struct ndr_push *ndr, int ndr_flags, const struct winreg_String *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen_m_term(r->name)*2)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen_m_term(r->name)*2)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->name)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->name, ndr_charset_length(r->name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } + } + return NT_STATUS_OK; +} + +_PUBLIC_ NTSTATUS ndr_pull_winreg_String(struct ndr_pull *ndr, int ndr_flags, struct winreg_String *r) +{ + uint32_t _ptr_name; + TALLOC_CTX *_mem_save_name_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->name_len)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->name_size)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_name)); + if (_ptr_name) { + NDR_PULL_ALLOC(ndr, r->name); + } else { + r->name = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->name) { + _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->name)); + if (ndr_get_array_length(ndr, &r->name) > ndr_get_array_size(ndr, &r->name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->name), ndr_get_array_length(ndr, &r->name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->name, ndr_get_array_length(ndr, &r->name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, 0); + } + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_String(struct ndr_print *ndr, const char *name, const struct winreg_String *r) +{ + ndr_print_struct(ndr, name, "winreg_String"); + ndr->depth++; + ndr_print_uint16(ndr, "name_len", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m_term(r->name)*2:r->name_len); + ndr_print_uint16(ndr, "name_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m_term(r->name)*2:r->name_size); + ndr_print_ptr(ndr, "name", r->name); + ndr->depth++; + if (r->name) { + ndr_print_string(ndr, "name", r->name); + } + ndr->depth--; + ndr->depth--; +} + +NTSTATUS ndr_push_KeySecurityData(struct ndr_push *ndr, int ndr_flags, const struct KeySecurityData *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->data)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->len)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->data) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->len)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->data, r->len)); + } + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_KeySecurityData(struct ndr_pull *ndr, int ndr_flags, struct KeySecurityData *r) +{ + uint32_t _ptr_data; + TALLOC_CTX *_mem_save_data_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data)); + if (_ptr_data) { + NDR_PULL_ALLOC(ndr, r->data); + } else { + r->data = NULL; + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->size)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->len)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->data) { + _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->data, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->data)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->data)); + if (ndr_get_array_length(ndr, &r->data) > ndr_get_array_size(ndr, &r->data)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->data), ndr_get_array_length(ndr, &r->data)); + } + NDR_PULL_ALLOC_N(ndr, r->data, ndr_get_array_size(ndr, &r->data)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->data, ndr_get_array_length(ndr, &r->data))); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0); + } + if (r->data) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->data, r->size)); + } + if (r->data) { + NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->data, r->len)); + } + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_KeySecurityData(struct ndr_print *ndr, const char *name, const struct KeySecurityData *r) +{ + ndr_print_struct(ndr, name, "KeySecurityData"); + ndr->depth++; + ndr_print_ptr(ndr, "data", r->data); + ndr->depth++; + if (r->data) { + ndr_print_array_uint8(ndr, "data", r->data, r->len); + } + ndr->depth--; + ndr_print_uint32(ndr, "size", r->size); + ndr_print_uint32(ndr, "len", r->len); + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_SecBuf(struct ndr_push *ndr, int ndr_flags, const struct winreg_SecBuf *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length)); + NDR_CHECK(ndr_push_KeySecurityData(ndr, NDR_SCALARS, &r->sd)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->inherit)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_KeySecurityData(ndr, NDR_BUFFERS, &r->sd)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_SecBuf(struct ndr_pull *ndr, int ndr_flags, struct winreg_SecBuf *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->length)); + NDR_CHECK(ndr_pull_KeySecurityData(ndr, NDR_SCALARS, &r->sd)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->inherit)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_KeySecurityData(ndr, NDR_BUFFERS, &r->sd)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_SecBuf(struct ndr_print *ndr, const char *name, const struct winreg_SecBuf *r) +{ + ndr_print_struct(ndr, name, "winreg_SecBuf"); + ndr->depth++; + ndr_print_uint32(ndr, "length", r->length); + ndr_print_KeySecurityData(ndr, "sd", &r->sd); + ndr_print_uint8(ndr, "inherit", r->inherit); + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_CreateAction(struct ndr_push *ndr, int ndr_flags, enum winreg_CreateAction r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_CreateAction(struct ndr_pull *ndr, int ndr_flags, enum winreg_CreateAction *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_CreateAction(struct ndr_print *ndr, const char *name, enum winreg_CreateAction r) +{ + const char *val = NULL; + + switch (r) { + case REG_ACTION_NONE: val = "REG_ACTION_NONE"; break; + case REG_CREATED_NEW_KEY: val = "REG_CREATED_NEW_KEY"; break; + case REG_OPENED_EXISTING_KEY: val = "REG_OPENED_EXISTING_KEY"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +NTSTATUS ndr_push_winreg_StringBuf(struct ndr_push *ndr, int ndr_flags, const struct winreg_StringBuf *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen_m_term(r->name)*2)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->size)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->name)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size/2)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, strlen_m_term(r->name)*2/2)); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->name, strlen_m_term(r->name)*2/2, sizeof(uint16_t), CH_UTF16)); + } + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_StringBuf(struct ndr_pull *ndr, int ndr_flags, struct winreg_StringBuf *r) +{ + uint32_t _ptr_name; + TALLOC_CTX *_mem_save_name_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_name)); + if (_ptr_name) { + NDR_PULL_ALLOC(ndr, r->name); + } else { + r->name = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->name) { + _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->name)); + if (ndr_get_array_length(ndr, &r->name) > ndr_get_array_size(ndr, &r->name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->name), ndr_get_array_length(ndr, &r->name)); + } + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->name, ndr_get_array_length(ndr, &r->name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, 0); + } + if (r->name) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->name, r->size/2)); + } + if (r->name) { + NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->name, r->length/2)); + } + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_StringBuf(struct ndr_print *ndr, const char *name, const struct winreg_StringBuf *r) +{ + ndr_print_struct(ndr, name, "winreg_StringBuf"); + ndr->depth++; + ndr_print_uint16(ndr, "length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m_term(r->name)*2:r->length); + ndr_print_uint16(ndr, "size", r->size); + ndr_print_ptr(ndr, "name", r->name); + ndr->depth++; + if (r->name) { + ndr_print_string(ndr, "name", r->name); + } + ndr->depth--; + ndr->depth--; +} + +NTSTATUS ndr_push_QueryMultipleValue(struct ndr_push *ndr, int ndr_flags, const struct QueryMultipleValue *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->name)); + NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, r->type)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->offset)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->name) { + NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->name)); + } + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_QueryMultipleValue(struct ndr_pull *ndr, int ndr_flags, struct QueryMultipleValue *r) +{ + uint32_t _ptr_name; + TALLOC_CTX *_mem_save_name_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_name)); + if (_ptr_name) { + NDR_PULL_ALLOC(ndr, r->name); + } else { + r->name = NULL; + } + NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, &r->type)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->offset)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->length)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->name) { + _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->name, 0); + NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, 0); + } + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_QueryMultipleValue(struct ndr_print *ndr, const char *name, const struct QueryMultipleValue *r) +{ + ndr_print_struct(ndr, name, "QueryMultipleValue"); + ndr->depth++; + ndr_print_ptr(ndr, "name", r->name); + ndr->depth++; + if (r->name) { + ndr_print_winreg_String(ndr, "name", r->name); + } + ndr->depth--; + ndr_print_winreg_Type(ndr, "type", r->type); + ndr_print_uint32(ndr, "offset", r->offset); + ndr_print_uint32(ndr, "length", r->length); + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_OpenHKCR(struct ndr_push *ndr, int flags, const struct winreg_OpenHKCR *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name)); + if (r->in.system_name) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.system_name)); + } + NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + } + if (flags & NDR_OUT) { + if (r->out.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle)); + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_OpenHKCR(struct ndr_pull *ndr, int flags, struct winreg_OpenHKCR *r) +{ + uint32_t _ptr_system_name; + TALLOC_CTX *_mem_save_system_name_0; + TALLOC_CTX *_mem_save_handle_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name)); + if (_ptr_system_name) { + NDR_PULL_ALLOC(ndr, r->in.system_name); + } else { + r->in.system_name = NULL; + } + if (r->in.system_name) { + _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.system_name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0); + } + NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + NDR_PULL_ALLOC(ndr, r->out.handle); + ZERO_STRUCTP(r->out.handle); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.handle); + } + _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_OpenHKCR(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKCR *r) +{ + ndr_print_struct(ndr, name, "winreg_OpenHKCR"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_OpenHKCR"); + ndr->depth++; + ndr_print_ptr(ndr, "system_name", r->in.system_name); + ndr->depth++; + if (r->in.system_name) { + ndr_print_uint16(ndr, "system_name", *r->in.system_name); + } + ndr->depth--; + ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_OpenHKCR"); + ndr->depth++; + ndr_print_ptr(ndr, "handle", r->out.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->out.handle); + ndr->depth--; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_OpenHKCU(struct ndr_push *ndr, int flags, const struct winreg_OpenHKCU *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name)); + if (r->in.system_name) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.system_name)); + } + NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + } + if (flags & NDR_OUT) { + if (r->out.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle)); + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_OpenHKCU(struct ndr_pull *ndr, int flags, struct winreg_OpenHKCU *r) +{ + uint32_t _ptr_system_name; + TALLOC_CTX *_mem_save_system_name_0; + TALLOC_CTX *_mem_save_handle_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name)); + if (_ptr_system_name) { + NDR_PULL_ALLOC(ndr, r->in.system_name); + } else { + r->in.system_name = NULL; + } + if (r->in.system_name) { + _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.system_name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0); + } + NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + NDR_PULL_ALLOC(ndr, r->out.handle); + ZERO_STRUCTP(r->out.handle); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.handle); + } + _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_OpenHKCU(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKCU *r) +{ + ndr_print_struct(ndr, name, "winreg_OpenHKCU"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_OpenHKCU"); + ndr->depth++; + ndr_print_ptr(ndr, "system_name", r->in.system_name); + ndr->depth++; + if (r->in.system_name) { + ndr_print_uint16(ndr, "system_name", *r->in.system_name); + } + ndr->depth--; + ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_OpenHKCU"); + ndr->depth++; + ndr_print_ptr(ndr, "handle", r->out.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->out.handle); + ndr->depth--; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_OpenHKLM(struct ndr_push *ndr, int flags, const struct winreg_OpenHKLM *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name)); + if (r->in.system_name) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.system_name)); + } + NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + } + if (flags & NDR_OUT) { + if (r->out.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle)); + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_OpenHKLM(struct ndr_pull *ndr, int flags, struct winreg_OpenHKLM *r) +{ + uint32_t _ptr_system_name; + TALLOC_CTX *_mem_save_system_name_0; + TALLOC_CTX *_mem_save_handle_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name)); + if (_ptr_system_name) { + NDR_PULL_ALLOC(ndr, r->in.system_name); + } else { + r->in.system_name = NULL; + } + if (r->in.system_name) { + _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.system_name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0); + } + NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + NDR_PULL_ALLOC(ndr, r->out.handle); + ZERO_STRUCTP(r->out.handle); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.handle); + } + _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_OpenHKLM(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKLM *r) +{ + ndr_print_struct(ndr, name, "winreg_OpenHKLM"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_OpenHKLM"); + ndr->depth++; + ndr_print_ptr(ndr, "system_name", r->in.system_name); + ndr->depth++; + if (r->in.system_name) { + ndr_print_uint16(ndr, "system_name", *r->in.system_name); + } + ndr->depth--; + ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_OpenHKLM"); + ndr->depth++; + ndr_print_ptr(ndr, "handle", r->out.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->out.handle); + ndr->depth--; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_OpenHKPD(struct ndr_push *ndr, int flags, const struct winreg_OpenHKPD *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name)); + if (r->in.system_name) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.system_name)); + } + NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + } + if (flags & NDR_OUT) { + if (r->out.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle)); + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_OpenHKPD(struct ndr_pull *ndr, int flags, struct winreg_OpenHKPD *r) +{ + uint32_t _ptr_system_name; + TALLOC_CTX *_mem_save_system_name_0; + TALLOC_CTX *_mem_save_handle_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name)); + if (_ptr_system_name) { + NDR_PULL_ALLOC(ndr, r->in.system_name); + } else { + r->in.system_name = NULL; + } + if (r->in.system_name) { + _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.system_name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0); + } + NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + NDR_PULL_ALLOC(ndr, r->out.handle); + ZERO_STRUCTP(r->out.handle); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.handle); + } + _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_OpenHKPD(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKPD *r) +{ + ndr_print_struct(ndr, name, "winreg_OpenHKPD"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_OpenHKPD"); + ndr->depth++; + ndr_print_ptr(ndr, "system_name", r->in.system_name); + ndr->depth++; + if (r->in.system_name) { + ndr_print_uint16(ndr, "system_name", *r->in.system_name); + } + ndr->depth--; + ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_OpenHKPD"); + ndr->depth++; + ndr_print_ptr(ndr, "handle", r->out.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->out.handle); + ndr->depth--; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_OpenHKU(struct ndr_push *ndr, int flags, const struct winreg_OpenHKU *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name)); + if (r->in.system_name) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.system_name)); + } + NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + } + if (flags & NDR_OUT) { + if (r->out.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle)); + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_OpenHKU(struct ndr_pull *ndr, int flags, struct winreg_OpenHKU *r) +{ + uint32_t _ptr_system_name; + TALLOC_CTX *_mem_save_system_name_0; + TALLOC_CTX *_mem_save_handle_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name)); + if (_ptr_system_name) { + NDR_PULL_ALLOC(ndr, r->in.system_name); + } else { + r->in.system_name = NULL; + } + if (r->in.system_name) { + _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.system_name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0); + } + NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + NDR_PULL_ALLOC(ndr, r->out.handle); + ZERO_STRUCTP(r->out.handle); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.handle); + } + _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_OpenHKU(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKU *r) +{ + ndr_print_struct(ndr, name, "winreg_OpenHKU"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_OpenHKU"); + ndr->depth++; + ndr_print_ptr(ndr, "system_name", r->in.system_name); + ndr->depth++; + if (r->in.system_name) { + ndr_print_uint16(ndr, "system_name", *r->in.system_name); + } + ndr->depth--; + ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_OpenHKU"); + ndr->depth++; + ndr_print_ptr(ndr, "handle", r->out.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->out.handle); + ndr->depth--; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_CloseKey(struct ndr_push *ndr, int flags, const struct winreg_CloseKey *r) +{ + if (flags & NDR_IN) { + if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + } + if (flags & NDR_OUT) { + if (r->out.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle)); + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_CloseKey(struct ndr_pull *ndr, int flags, struct winreg_CloseKey *r) +{ + TALLOC_CTX *_mem_save_handle_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|NDR_BUFFERS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.handle); + *r->out.handle = *r->in.handle; + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.handle); + } + _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_CloseKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_CloseKey *r) +{ + ndr_print_struct(ndr, name, "winreg_CloseKey"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_CloseKey"); + ndr->depth++; + ndr_print_ptr(ndr, "handle", r->in.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->in.handle); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_CloseKey"); + ndr->depth++; + ndr_print_ptr(ndr, "handle", r->out.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->out.handle); + ndr->depth--; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_CreateKey(struct ndr_push *ndr, int flags, const struct winreg_CreateKey *r) +{ + if (flags & NDR_IN) { + if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name)); + NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.keyclass)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.options)); + NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.secdesc)); + if (r->in.secdesc) { + NDR_CHECK(ndr_push_winreg_SecBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.secdesc)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.action_taken)); + if (r->in.action_taken) { + NDR_CHECK(ndr_push_winreg_CreateAction(ndr, NDR_SCALARS, *r->in.action_taken)); + } + } + if (flags & NDR_OUT) { + if (r->out.new_handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.new_handle)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.action_taken)); + if (r->out.action_taken) { + NDR_CHECK(ndr_push_winreg_CreateAction(ndr, NDR_SCALARS, *r->out.action_taken)); + } + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_CreateKey(struct ndr_pull *ndr, int flags, struct winreg_CreateKey *r) +{ + uint32_t _ptr_secdesc; + uint32_t _ptr_action_taken; + TALLOC_CTX *_mem_save_handle_0; + TALLOC_CTX *_mem_save_secdesc_0; + TALLOC_CTX *_mem_save_new_handle_0; + TALLOC_CTX *_mem_save_action_taken_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|NDR_BUFFERS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name)); + NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.keyclass)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.options)); + NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_secdesc)); + if (_ptr_secdesc) { + NDR_PULL_ALLOC(ndr, r->in.secdesc); + } else { + r->in.secdesc = NULL; + } + if (r->in.secdesc) { + _mem_save_secdesc_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.secdesc, 0); + NDR_CHECK(ndr_pull_winreg_SecBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.secdesc)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_secdesc_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_action_taken)); + if (_ptr_action_taken) { + NDR_PULL_ALLOC(ndr, r->in.action_taken); + } else { + r->in.action_taken = NULL; + } + if (r->in.action_taken) { + _mem_save_action_taken_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.action_taken, 0); + NDR_CHECK(ndr_pull_winreg_CreateAction(ndr, NDR_SCALARS, r->in.action_taken)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_action_taken_0, 0); + } + NDR_PULL_ALLOC(ndr, r->out.new_handle); + ZERO_STRUCTP(r->out.new_handle); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.new_handle); + } + _mem_save_new_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.new_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.new_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_new_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_action_taken)); + if (_ptr_action_taken) { + NDR_PULL_ALLOC(ndr, r->out.action_taken); + } else { + r->out.action_taken = NULL; + } + if (r->out.action_taken) { + _mem_save_action_taken_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.action_taken, 0); + NDR_CHECK(ndr_pull_winreg_CreateAction(ndr, NDR_SCALARS, r->out.action_taken)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_action_taken_0, 0); + } + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_CreateKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_CreateKey *r) +{ + ndr_print_struct(ndr, name, "winreg_CreateKey"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_CreateKey"); + 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_winreg_String(ndr, "name", &r->in.name); + ndr_print_winreg_String(ndr, "keyclass", &r->in.keyclass); + ndr_print_uint32(ndr, "options", r->in.options); + ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask); + ndr_print_ptr(ndr, "secdesc", r->in.secdesc); + ndr->depth++; + if (r->in.secdesc) { + ndr_print_winreg_SecBuf(ndr, "secdesc", r->in.secdesc); + } + ndr->depth--; + ndr_print_ptr(ndr, "action_taken", r->in.action_taken); + ndr->depth++; + if (r->in.action_taken) { + ndr_print_winreg_CreateAction(ndr, "action_taken", *r->in.action_taken); + } + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_CreateKey"); + ndr->depth++; + ndr_print_ptr(ndr, "new_handle", r->out.new_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "new_handle", r->out.new_handle); + ndr->depth--; + ndr_print_ptr(ndr, "action_taken", r->out.action_taken); + ndr->depth++; + if (r->out.action_taken) { + ndr_print_winreg_CreateAction(ndr, "action_taken", *r->out.action_taken); + } + ndr->depth--; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_DeleteKey(struct ndr_push *ndr, int flags, const struct winreg_DeleteKey *r) +{ + if (flags & NDR_IN) { + if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.key)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_DeleteKey(struct ndr_pull *ndr, int flags, struct winreg_DeleteKey *r) +{ + TALLOC_CTX *_mem_save_handle_0; + if (flags & NDR_IN) { + 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|NDR_BUFFERS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.key)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_DeleteKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_DeleteKey *r) +{ + ndr_print_struct(ndr, name, "winreg_DeleteKey"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_DeleteKey"); + 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_winreg_String(ndr, "key", &r->in.key); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_DeleteKey"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_DeleteValue(struct ndr_push *ndr, int flags, const struct winreg_DeleteValue *r) +{ + if (flags & NDR_IN) { + if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.value)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_DeleteValue(struct ndr_pull *ndr, int flags, struct winreg_DeleteValue *r) +{ + TALLOC_CTX *_mem_save_handle_0; + if (flags & NDR_IN) { + 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|NDR_BUFFERS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.value)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_DeleteValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_DeleteValue *r) +{ + ndr_print_struct(ndr, name, "winreg_DeleteValue"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_DeleteValue"); + 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_winreg_String(ndr, "value", &r->in.value); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_DeleteValue"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_EnumKey(struct ndr_push *ndr, int flags, const struct winreg_EnumKey *r) +{ + if (flags & NDR_IN) { + if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.enum_index)); + if (r->in.name == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.keyclass)); + if (r->in.keyclass) { + NDR_CHECK(ndr_push_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.keyclass)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.last_changed_time)); + if (r->in.last_changed_time) { + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, *r->in.last_changed_time)); + } + } + if (flags & NDR_OUT) { + if (r->out.name == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.name)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.keyclass)); + if (r->out.keyclass) { + NDR_CHECK(ndr_push_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.keyclass)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.last_changed_time)); + if (r->out.last_changed_time) { + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, *r->out.last_changed_time)); + } + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_EnumKey(struct ndr_pull *ndr, int flags, struct winreg_EnumKey *r) +{ + uint32_t _ptr_keyclass; + uint32_t _ptr_last_changed_time; + TALLOC_CTX *_mem_save_handle_0; + TALLOC_CTX *_mem_save_name_0; + TALLOC_CTX *_mem_save_keyclass_0; + TALLOC_CTX *_mem_save_last_changed_time_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|NDR_BUFFERS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.enum_index)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.name); + } + _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.name, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_keyclass)); + if (_ptr_keyclass) { + NDR_PULL_ALLOC(ndr, r->in.keyclass); + } else { + r->in.keyclass = NULL; + } + if (r->in.keyclass) { + _mem_save_keyclass_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.keyclass, 0); + NDR_CHECK(ndr_pull_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.keyclass)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_keyclass_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_last_changed_time)); + if (_ptr_last_changed_time) { + NDR_PULL_ALLOC(ndr, r->in.last_changed_time); + } else { + r->in.last_changed_time = NULL; + } + if (r->in.last_changed_time) { + _mem_save_last_changed_time_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.last_changed_time, 0); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, r->in.last_changed_time)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_last_changed_time_0, 0); + } + NDR_PULL_ALLOC(ndr, r->out.name); + *r->out.name = *r->in.name; + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.name); + } + _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.name, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_keyclass)); + if (_ptr_keyclass) { + NDR_PULL_ALLOC(ndr, r->out.keyclass); + } else { + r->out.keyclass = NULL; + } + if (r->out.keyclass) { + _mem_save_keyclass_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.keyclass, 0); + NDR_CHECK(ndr_pull_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.keyclass)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_keyclass_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_last_changed_time)); + if (_ptr_last_changed_time) { + NDR_PULL_ALLOC(ndr, r->out.last_changed_time); + } else { + r->out.last_changed_time = NULL; + } + if (r->out.last_changed_time) { + _mem_save_last_changed_time_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.last_changed_time, 0); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, r->out.last_changed_time)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_last_changed_time_0, 0); + } + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_EnumKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_EnumKey *r) +{ + ndr_print_struct(ndr, name, "winreg_EnumKey"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_EnumKey"); + 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_uint32(ndr, "enum_index", r->in.enum_index); + ndr_print_ptr(ndr, "name", r->in.name); + ndr->depth++; + ndr_print_winreg_StringBuf(ndr, "name", r->in.name); + ndr->depth--; + ndr_print_ptr(ndr, "keyclass", r->in.keyclass); + ndr->depth++; + if (r->in.keyclass) { + ndr_print_winreg_StringBuf(ndr, "keyclass", r->in.keyclass); + } + ndr->depth--; + ndr_print_ptr(ndr, "last_changed_time", r->in.last_changed_time); + ndr->depth++; + if (r->in.last_changed_time) { + ndr_print_NTTIME(ndr, "last_changed_time", *r->in.last_changed_time); + } + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_EnumKey"); + ndr->depth++; + ndr_print_ptr(ndr, "name", r->out.name); + ndr->depth++; + ndr_print_winreg_StringBuf(ndr, "name", r->out.name); + ndr->depth--; + ndr_print_ptr(ndr, "keyclass", r->out.keyclass); + ndr->depth++; + if (r->out.keyclass) { + ndr_print_winreg_StringBuf(ndr, "keyclass", r->out.keyclass); + } + ndr->depth--; + ndr_print_ptr(ndr, "last_changed_time", r->out.last_changed_time); + ndr->depth++; + if (r->out.last_changed_time) { + ndr_print_NTTIME(ndr, "last_changed_time", *r->out.last_changed_time); + } + ndr->depth--; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_EnumValue(struct ndr_push *ndr, int flags, const struct winreg_EnumValue *r) +{ + if (flags & NDR_IN) { + if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.enum_index)); + if (r->in.name == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.type)); + if (r->in.type) { + NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, *r->in.type)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.value)); + if (r->in.value) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.size)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.length)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->in.value, *r->in.length)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.size)); + if (r->in.size) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.size)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.length)); + if (r->in.length) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.length)); + } + } + if (flags & NDR_OUT) { + if (r->out.name == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.name)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.type)); + if (r->out.type) { + NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, *r->out.type)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.value)); + if (r->out.value) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.size)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.length)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.value, *r->out.length)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.size)); + if (r->out.size) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.size)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.length)); + if (r->out.length) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.length)); + } + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_EnumValue(struct ndr_pull *ndr, int flags, struct winreg_EnumValue *r) +{ + uint32_t _ptr_type; + uint32_t _ptr_value; + uint32_t _ptr_size; + uint32_t _ptr_length; + TALLOC_CTX *_mem_save_handle_0; + TALLOC_CTX *_mem_save_name_0; + TALLOC_CTX *_mem_save_type_0; + TALLOC_CTX *_mem_save_value_0; + TALLOC_CTX *_mem_save_size_0; + TALLOC_CTX *_mem_save_length_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|NDR_BUFFERS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.enum_index)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.name); + } + _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.name, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_type)); + if (_ptr_type) { + NDR_PULL_ALLOC(ndr, r->in.type); + } else { + r->in.type = NULL; + } + if (r->in.type) { + _mem_save_type_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.type, 0); + NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, r->in.type)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_type_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_value)); + if (_ptr_value) { + NDR_PULL_ALLOC(ndr, r->in.value); + } else { + r->in.value = NULL; + } + if (r->in.value) { + _mem_save_value_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.value, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.value)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.value)); + if (ndr_get_array_length(ndr, &r->in.value) > ndr_get_array_size(ndr, &r->in.value)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.value), ndr_get_array_length(ndr, &r->in.value)); + } + NDR_PULL_ALLOC_N(ndr, r->in.value, ndr_get_array_size(ndr, &r->in.value)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->in.value, ndr_get_array_length(ndr, &r->in.value))); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_size)); + if (_ptr_size) { + NDR_PULL_ALLOC(ndr, r->in.size); + } else { + r->in.size = NULL; + } + if (r->in.size) { + _mem_save_size_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.size, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.size)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_size_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_length)); + if (_ptr_length) { + NDR_PULL_ALLOC(ndr, r->in.length); + } else { + r->in.length = NULL; + } + if (r->in.length) { + _mem_save_length_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.length, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.length)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_length_0, 0); + } + NDR_PULL_ALLOC(ndr, r->out.name); + *r->out.name = *r->in.name; + if (r->in.value) { + if (r->in.size == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.value, *r->in.size)); + } + if (r->in.value) { + if (r->in.length == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->in.value, *r->in.length)); + } + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.name); + } + _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.name, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_type)); + if (_ptr_type) { + NDR_PULL_ALLOC(ndr, r->out.type); + } else { + r->out.type = NULL; + } + if (r->out.type) { + _mem_save_type_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.type, 0); + NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, r->out.type)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_type_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_value)); + if (_ptr_value) { + NDR_PULL_ALLOC(ndr, r->out.value); + } else { + r->out.value = NULL; + } + if (r->out.value) { + _mem_save_value_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.value, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->out.value)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->out.value)); + if (ndr_get_array_length(ndr, &r->out.value) > ndr_get_array_size(ndr, &r->out.value)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->out.value), ndr_get_array_length(ndr, &r->out.value)); + } + NDR_PULL_ALLOC_N(ndr, r->out.value, ndr_get_array_size(ndr, &r->out.value)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->out.value, ndr_get_array_length(ndr, &r->out.value))); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_size)); + if (_ptr_size) { + NDR_PULL_ALLOC(ndr, r->out.size); + } else { + r->out.size = NULL; + } + if (r->out.size) { + _mem_save_size_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.size, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.size)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_size_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_length)); + if (_ptr_length) { + NDR_PULL_ALLOC(ndr, r->out.length); + } else { + r->out.length = NULL; + } + if (r->out.length) { + _mem_save_length_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.length, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.length)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_length_0, 0); + } + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + if (r->out.value) { + if (r->out.size == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.value, *r->out.size)); + } + if (r->out.value) { + if (r->out.length == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->out.value, *r->out.length)); + } + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_EnumValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_EnumValue *r) +{ + ndr_print_struct(ndr, name, "winreg_EnumValue"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_EnumValue"); + 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_uint32(ndr, "enum_index", r->in.enum_index); + ndr_print_ptr(ndr, "name", r->in.name); + ndr->depth++; + ndr_print_winreg_StringBuf(ndr, "name", r->in.name); + ndr->depth--; + ndr_print_ptr(ndr, "type", r->in.type); + ndr->depth++; + if (r->in.type) { + ndr_print_winreg_Type(ndr, "type", *r->in.type); + } + ndr->depth--; + ndr_print_ptr(ndr, "value", r->in.value); + ndr->depth++; + if (r->in.value) { + ndr_print_array_uint8(ndr, "value", r->in.value, *r->in.length); + } + ndr->depth--; + ndr_print_ptr(ndr, "size", r->in.size); + ndr->depth++; + if (r->in.size) { + ndr_print_uint32(ndr, "size", *r->in.size); + } + ndr->depth--; + ndr_print_ptr(ndr, "length", r->in.length); + ndr->depth++; + if (r->in.length) { + ndr_print_uint32(ndr, "length", *r->in.length); + } + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_EnumValue"); + ndr->depth++; + ndr_print_ptr(ndr, "name", r->out.name); + ndr->depth++; + ndr_print_winreg_StringBuf(ndr, "name", r->out.name); + ndr->depth--; + ndr_print_ptr(ndr, "type", r->out.type); + ndr->depth++; + if (r->out.type) { + ndr_print_winreg_Type(ndr, "type", *r->out.type); + } + ndr->depth--; + ndr_print_ptr(ndr, "value", r->out.value); + ndr->depth++; + if (r->out.value) { + ndr_print_array_uint8(ndr, "value", r->out.value, *r->out.length); + } + ndr->depth--; + ndr_print_ptr(ndr, "size", r->out.size); + ndr->depth++; + if (r->out.size) { + ndr_print_uint32(ndr, "size", *r->out.size); + } + ndr->depth--; + ndr_print_ptr(ndr, "length", r->out.length); + ndr->depth++; + if (r->out.length) { + ndr_print_uint32(ndr, "length", *r->out.length); + } + ndr->depth--; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_FlushKey(struct ndr_push *ndr, int flags, const struct winreg_FlushKey *r) +{ + if (flags & NDR_IN) { + if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_FlushKey(struct ndr_pull *ndr, int flags, struct winreg_FlushKey *r) +{ + TALLOC_CTX *_mem_save_handle_0; + if (flags & NDR_IN) { + 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|NDR_BUFFERS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_FlushKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_FlushKey *r) +{ + ndr_print_struct(ndr, name, "winreg_FlushKey"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_FlushKey"); + ndr->depth++; + ndr_print_ptr(ndr, "handle", r->in.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->in.handle); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_FlushKey"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_GetKeySecurity(struct ndr_push *ndr, int flags, const struct winreg_GetKeySecurity *r) +{ + if (flags & NDR_IN) { + if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + NDR_CHECK(ndr_push_security_secinfo(ndr, NDR_SCALARS, r->in.sec_info)); + if (r->in.sd == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_KeySecurityData(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sd)); + } + if (flags & NDR_OUT) { + if (r->out.sd == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_KeySecurityData(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sd)); + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_GetKeySecurity(struct ndr_pull *ndr, int flags, struct winreg_GetKeySecurity *r) +{ + TALLOC_CTX *_mem_save_handle_0; + TALLOC_CTX *_mem_save_sd_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|NDR_BUFFERS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_security_secinfo(ndr, NDR_SCALARS, &r->in.sec_info)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.sd); + } + _mem_save_sd_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.sd, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_KeySecurityData(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sd)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.sd); + *r->out.sd = *r->in.sd; + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.sd); + } + _mem_save_sd_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.sd, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_KeySecurityData(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sd)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_GetKeySecurity(struct ndr_print *ndr, const char *name, int flags, const struct winreg_GetKeySecurity *r) +{ + ndr_print_struct(ndr, name, "winreg_GetKeySecurity"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_GetKeySecurity"); + 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_security_secinfo(ndr, "sec_info", r->in.sec_info); + ndr_print_ptr(ndr, "sd", r->in.sd); + ndr->depth++; + ndr_print_KeySecurityData(ndr, "sd", r->in.sd); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_GetKeySecurity"); + ndr->depth++; + ndr_print_ptr(ndr, "sd", r->out.sd); + ndr->depth++; + ndr_print_KeySecurityData(ndr, "sd", r->out.sd); + ndr->depth--; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_LoadKey(struct ndr_push *ndr, int flags, const struct winreg_LoadKey *r) +{ + if (flags & NDR_IN) { + if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.keyname)); + if (r->in.keyname) { + NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.keyname)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.filename)); + if (r->in.filename) { + NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.filename)); + } + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_LoadKey(struct ndr_pull *ndr, int flags, struct winreg_LoadKey *r) +{ + uint32_t _ptr_keyname; + uint32_t _ptr_filename; + TALLOC_CTX *_mem_save_handle_0; + TALLOC_CTX *_mem_save_keyname_0; + TALLOC_CTX *_mem_save_filename_0; + if (flags & NDR_IN) { + 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|NDR_BUFFERS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_keyname)); + if (_ptr_keyname) { + NDR_PULL_ALLOC(ndr, r->in.keyname); + } else { + r->in.keyname = NULL; + } + if (r->in.keyname) { + _mem_save_keyname_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.keyname, 0); + NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.keyname)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_keyname_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_filename)); + if (_ptr_filename) { + NDR_PULL_ALLOC(ndr, r->in.filename); + } else { + r->in.filename = NULL; + } + if (r->in.filename) { + _mem_save_filename_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.filename, 0); + NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.filename)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_filename_0, 0); + } + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_LoadKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_LoadKey *r) +{ + ndr_print_struct(ndr, name, "winreg_LoadKey"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_LoadKey"); + 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, "keyname", r->in.keyname); + ndr->depth++; + if (r->in.keyname) { + ndr_print_winreg_String(ndr, "keyname", r->in.keyname); + } + ndr->depth--; + ndr_print_ptr(ndr, "filename", r->in.filename); + ndr->depth++; + if (r->in.filename) { + ndr_print_winreg_String(ndr, "filename", r->in.filename); + } + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_LoadKey"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_NotifyChangeKeyValue(struct ndr_push *ndr, int flags, const struct winreg_NotifyChangeKeyValue *r) +{ + if (flags & NDR_IN) { + if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.watch_subtree)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.notify_filter)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown)); + NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.string1)); + NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.string2)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown2)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_NotifyChangeKeyValue(struct ndr_pull *ndr, int flags, struct winreg_NotifyChangeKeyValue *r) +{ + TALLOC_CTX *_mem_save_handle_0; + if (flags & NDR_IN) { + 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|NDR_BUFFERS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.watch_subtree)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.notify_filter)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown)); + NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.string1)); + NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.string2)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown2)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_NotifyChangeKeyValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_NotifyChangeKeyValue *r) +{ + ndr_print_struct(ndr, name, "winreg_NotifyChangeKeyValue"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_NotifyChangeKeyValue"); + 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_uint8(ndr, "watch_subtree", r->in.watch_subtree); + ndr_print_uint32(ndr, "notify_filter", r->in.notify_filter); + ndr_print_uint32(ndr, "unknown", r->in.unknown); + ndr_print_winreg_String(ndr, "string1", &r->in.string1); + ndr_print_winreg_String(ndr, "string2", &r->in.string2); + ndr_print_uint32(ndr, "unknown2", r->in.unknown2); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_NotifyChangeKeyValue"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_OpenKey(struct ndr_push *ndr, int flags, const struct winreg_OpenKey *r) +{ + if (flags & NDR_IN) { + if (r->in.parent_handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.parent_handle)); + NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.keyname)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown)); + NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + } + if (flags & NDR_OUT) { + if (r->out.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle)); + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_OpenKey(struct ndr_pull *ndr, int flags, struct winreg_OpenKey *r) +{ + TALLOC_CTX *_mem_save_parent_handle_0; + TALLOC_CTX *_mem_save_handle_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.parent_handle); + } + _mem_save_parent_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.parent_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.parent_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_parent_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.keyname)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown)); + NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + NDR_PULL_ALLOC(ndr, r->out.handle); + ZERO_STRUCTP(r->out.handle); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.handle); + } + _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_OpenKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenKey *r) +{ + ndr_print_struct(ndr, name, "winreg_OpenKey"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_OpenKey"); + ndr->depth++; + ndr_print_ptr(ndr, "parent_handle", r->in.parent_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "parent_handle", r->in.parent_handle); + ndr->depth--; + ndr_print_winreg_String(ndr, "keyname", &r->in.keyname); + ndr_print_uint32(ndr, "unknown", r->in.unknown); + ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_OpenKey"); + ndr->depth++; + ndr_print_ptr(ndr, "handle", r->out.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->out.handle); + ndr->depth--; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_QueryInfoKey(struct ndr_push *ndr, int flags, const struct winreg_QueryInfoKey *r) +{ + if (flags & NDR_IN) { + if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.class_in)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.class_out)); + if (r->out.class_out) { + NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.class_out)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.num_subkeys)); + if (r->out.num_subkeys) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.num_subkeys)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.max_subkeylen)); + if (r->out.max_subkeylen) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.max_subkeylen)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.max_subkeysize)); + if (r->out.max_subkeysize) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.max_subkeysize)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.num_values)); + if (r->out.num_values) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.num_values)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.max_valnamelen)); + if (r->out.max_valnamelen) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.max_valnamelen)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.max_valbufsize)); + if (r->out.max_valbufsize) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.max_valbufsize)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.secdescsize)); + if (r->out.secdescsize) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.secdescsize)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.last_changed_time)); + if (r->out.last_changed_time) { + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, *r->out.last_changed_time)); + } + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_QueryInfoKey(struct ndr_pull *ndr, int flags, struct winreg_QueryInfoKey *r) +{ + uint32_t _ptr_class_out; + uint32_t _ptr_num_subkeys; + uint32_t _ptr_max_subkeylen; + uint32_t _ptr_max_subkeysize; + uint32_t _ptr_num_values; + uint32_t _ptr_max_valnamelen; + uint32_t _ptr_max_valbufsize; + uint32_t _ptr_secdescsize; + uint32_t _ptr_last_changed_time; + TALLOC_CTX *_mem_save_handle_0; + TALLOC_CTX *_mem_save_class_out_0; + TALLOC_CTX *_mem_save_num_subkeys_0; + TALLOC_CTX *_mem_save_max_subkeylen_0; + TALLOC_CTX *_mem_save_max_subkeysize_0; + TALLOC_CTX *_mem_save_num_values_0; + TALLOC_CTX *_mem_save_max_valnamelen_0; + TALLOC_CTX *_mem_save_max_valbufsize_0; + TALLOC_CTX *_mem_save_secdescsize_0; + TALLOC_CTX *_mem_save_last_changed_time_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|NDR_BUFFERS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.class_in)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_class_out)); + if (_ptr_class_out) { + NDR_PULL_ALLOC(ndr, r->out.class_out); + } else { + r->out.class_out = NULL; + } + if (r->out.class_out) { + _mem_save_class_out_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.class_out, 0); + NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.class_out)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_class_out_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_num_subkeys)); + if (_ptr_num_subkeys) { + NDR_PULL_ALLOC(ndr, r->out.num_subkeys); + } else { + r->out.num_subkeys = NULL; + } + if (r->out.num_subkeys) { + _mem_save_num_subkeys_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.num_subkeys, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.num_subkeys)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_num_subkeys_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_max_subkeylen)); + if (_ptr_max_subkeylen) { + NDR_PULL_ALLOC(ndr, r->out.max_subkeylen); + } else { + r->out.max_subkeylen = NULL; + } + if (r->out.max_subkeylen) { + _mem_save_max_subkeylen_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.max_subkeylen, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.max_subkeylen)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_max_subkeylen_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_max_subkeysize)); + if (_ptr_max_subkeysize) { + NDR_PULL_ALLOC(ndr, r->out.max_subkeysize); + } else { + r->out.max_subkeysize = NULL; + } + if (r->out.max_subkeysize) { + _mem_save_max_subkeysize_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.max_subkeysize, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.max_subkeysize)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_max_subkeysize_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_num_values)); + if (_ptr_num_values) { + NDR_PULL_ALLOC(ndr, r->out.num_values); + } else { + r->out.num_values = NULL; + } + if (r->out.num_values) { + _mem_save_num_values_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.num_values, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.num_values)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_num_values_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_max_valnamelen)); + if (_ptr_max_valnamelen) { + NDR_PULL_ALLOC(ndr, r->out.max_valnamelen); + } else { + r->out.max_valnamelen = NULL; + } + if (r->out.max_valnamelen) { + _mem_save_max_valnamelen_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.max_valnamelen, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.max_valnamelen)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_max_valnamelen_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_max_valbufsize)); + if (_ptr_max_valbufsize) { + NDR_PULL_ALLOC(ndr, r->out.max_valbufsize); + } else { + r->out.max_valbufsize = NULL; + } + if (r->out.max_valbufsize) { + _mem_save_max_valbufsize_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.max_valbufsize, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.max_valbufsize)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_max_valbufsize_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_secdescsize)); + if (_ptr_secdescsize) { + NDR_PULL_ALLOC(ndr, r->out.secdescsize); + } else { + r->out.secdescsize = NULL; + } + if (r->out.secdescsize) { + _mem_save_secdescsize_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.secdescsize, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.secdescsize)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_secdescsize_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_last_changed_time)); + if (_ptr_last_changed_time) { + NDR_PULL_ALLOC(ndr, r->out.last_changed_time); + } else { + r->out.last_changed_time = NULL; + } + if (r->out.last_changed_time) { + _mem_save_last_changed_time_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.last_changed_time, 0); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, r->out.last_changed_time)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_last_changed_time_0, 0); + } + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_QueryInfoKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryInfoKey *r) +{ + ndr_print_struct(ndr, name, "winreg_QueryInfoKey"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_QueryInfoKey"); + 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_winreg_String(ndr, "class_in", &r->in.class_in); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_QueryInfoKey"); + ndr->depth++; + ndr_print_ptr(ndr, "class_out", r->out.class_out); + ndr->depth++; + if (r->out.class_out) { + ndr_print_winreg_String(ndr, "class_out", r->out.class_out); + } + ndr->depth--; + ndr_print_ptr(ndr, "num_subkeys", r->out.num_subkeys); + ndr->depth++; + if (r->out.num_subkeys) { + ndr_print_uint32(ndr, "num_subkeys", *r->out.num_subkeys); + } + ndr->depth--; + ndr_print_ptr(ndr, "max_subkeylen", r->out.max_subkeylen); + ndr->depth++; + if (r->out.max_subkeylen) { + ndr_print_uint32(ndr, "max_subkeylen", *r->out.max_subkeylen); + } + ndr->depth--; + ndr_print_ptr(ndr, "max_subkeysize", r->out.max_subkeysize); + ndr->depth++; + if (r->out.max_subkeysize) { + ndr_print_uint32(ndr, "max_subkeysize", *r->out.max_subkeysize); + } + ndr->depth--; + ndr_print_ptr(ndr, "num_values", r->out.num_values); + ndr->depth++; + if (r->out.num_values) { + ndr_print_uint32(ndr, "num_values", *r->out.num_values); + } + ndr->depth--; + ndr_print_ptr(ndr, "max_valnamelen", r->out.max_valnamelen); + ndr->depth++; + if (r->out.max_valnamelen) { + ndr_print_uint32(ndr, "max_valnamelen", *r->out.max_valnamelen); + } + ndr->depth--; + ndr_print_ptr(ndr, "max_valbufsize", r->out.max_valbufsize); + ndr->depth++; + if (r->out.max_valbufsize) { + ndr_print_uint32(ndr, "max_valbufsize", *r->out.max_valbufsize); + } + ndr->depth--; + ndr_print_ptr(ndr, "secdescsize", r->out.secdescsize); + ndr->depth++; + if (r->out.secdescsize) { + ndr_print_uint32(ndr, "secdescsize", *r->out.secdescsize); + } + ndr->depth--; + ndr_print_ptr(ndr, "last_changed_time", r->out.last_changed_time); + ndr->depth++; + if (r->out.last_changed_time) { + ndr_print_NTTIME(ndr, "last_changed_time", *r->out.last_changed_time); + } + ndr->depth--; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_QueryValue(struct ndr_push *ndr, int flags, const struct winreg_QueryValue *r) +{ + if (flags & NDR_IN) { + if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.value_name)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.type)); + if (r->in.type) { + NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, *r->in.type)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.data)); + if (r->in.data) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.size)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.length)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->in.data, *r->in.length)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.size)); + if (r->in.size) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.size)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.length)); + if (r->in.length) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.length)); + } + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.type)); + if (r->out.type) { + NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, *r->out.type)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.data)); + if (r->out.data) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.size)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.length)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.data, *r->out.length)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.size)); + if (r->out.size) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.size)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.length)); + if (r->out.length) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.length)); + } + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_QueryValue(struct ndr_pull *ndr, int flags, struct winreg_QueryValue *r) +{ + uint32_t _ptr_type; + uint32_t _ptr_data; + uint32_t _ptr_size; + uint32_t _ptr_length; + TALLOC_CTX *_mem_save_handle_0; + TALLOC_CTX *_mem_save_type_0; + TALLOC_CTX *_mem_save_data_0; + TALLOC_CTX *_mem_save_size_0; + TALLOC_CTX *_mem_save_length_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|NDR_BUFFERS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.value_name)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_type)); + if (_ptr_type) { + NDR_PULL_ALLOC(ndr, r->in.type); + } else { + r->in.type = NULL; + } + if (r->in.type) { + _mem_save_type_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.type, 0); + NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, r->in.type)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_type_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data)); + if (_ptr_data) { + NDR_PULL_ALLOC(ndr, r->in.data); + } else { + r->in.data = NULL; + } + if (r->in.data) { + _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.data, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.data)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.data)); + if (ndr_get_array_length(ndr, &r->in.data) > ndr_get_array_size(ndr, &r->in.data)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.data), ndr_get_array_length(ndr, &r->in.data)); + } + NDR_PULL_ALLOC_N(ndr, r->in.data, ndr_get_array_size(ndr, &r->in.data)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->in.data, ndr_get_array_length(ndr, &r->in.data))); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_size)); + if (_ptr_size) { + NDR_PULL_ALLOC(ndr, r->in.size); + } else { + r->in.size = NULL; + } + if (r->in.size) { + _mem_save_size_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.size, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.size)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_size_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_length)); + if (_ptr_length) { + NDR_PULL_ALLOC(ndr, r->in.length); + } else { + r->in.length = NULL; + } + if (r->in.length) { + _mem_save_length_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.length, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.length)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_length_0, 0); + } + if (r->in.data) { + if (r->in.size == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.data, *r->in.size)); + } + if (r->in.data) { + if (r->in.length == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->in.data, *r->in.length)); + } + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_type)); + if (_ptr_type) { + NDR_PULL_ALLOC(ndr, r->out.type); + } else { + r->out.type = NULL; + } + if (r->out.type) { + _mem_save_type_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.type, 0); + NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, r->out.type)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_type_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data)); + if (_ptr_data) { + NDR_PULL_ALLOC(ndr, r->out.data); + } else { + r->out.data = NULL; + } + if (r->out.data) { + _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.data, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->out.data)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->out.data)); + if (ndr_get_array_length(ndr, &r->out.data) > ndr_get_array_size(ndr, &r->out.data)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->out.data), ndr_get_array_length(ndr, &r->out.data)); + } + NDR_PULL_ALLOC_N(ndr, r->out.data, ndr_get_array_size(ndr, &r->out.data)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->out.data, ndr_get_array_length(ndr, &r->out.data))); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_size)); + if (_ptr_size) { + NDR_PULL_ALLOC(ndr, r->out.size); + } else { + r->out.size = NULL; + } + if (r->out.size) { + _mem_save_size_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.size, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.size)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_size_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_length)); + if (_ptr_length) { + NDR_PULL_ALLOC(ndr, r->out.length); + } else { + r->out.length = NULL; + } + if (r->out.length) { + _mem_save_length_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.length, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.length)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_length_0, 0); + } + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + if (r->out.data) { + if (r->out.size == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.data, *r->out.size)); + } + if (r->out.data) { + if (r->out.length == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->out.data, *r->out.length)); + } + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_QueryValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryValue *r) +{ + ndr_print_struct(ndr, name, "winreg_QueryValue"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_QueryValue"); + 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_winreg_String(ndr, "value_name", &r->in.value_name); + ndr_print_ptr(ndr, "type", r->in.type); + ndr->depth++; + if (r->in.type) { + ndr_print_winreg_Type(ndr, "type", *r->in.type); + } + ndr->depth--; + ndr_print_ptr(ndr, "data", r->in.data); + ndr->depth++; + if (r->in.data) { + ndr_print_array_uint8(ndr, "data", r->in.data, *r->in.length); + } + ndr->depth--; + ndr_print_ptr(ndr, "size", r->in.size); + ndr->depth++; + if (r->in.size) { + ndr_print_uint32(ndr, "size", *r->in.size); + } + ndr->depth--; + ndr_print_ptr(ndr, "length", r->in.length); + ndr->depth++; + if (r->in.length) { + ndr_print_uint32(ndr, "length", *r->in.length); + } + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_QueryValue"); + ndr->depth++; + ndr_print_ptr(ndr, "type", r->out.type); + ndr->depth++; + if (r->out.type) { + ndr_print_winreg_Type(ndr, "type", *r->out.type); + } + ndr->depth--; + ndr_print_ptr(ndr, "data", r->out.data); + ndr->depth++; + if (r->out.data) { + ndr_print_array_uint8(ndr, "data", r->out.data, *r->out.length); + } + ndr->depth--; + ndr_print_ptr(ndr, "size", r->out.size); + ndr->depth++; + if (r->out.size) { + ndr_print_uint32(ndr, "size", *r->out.size); + } + ndr->depth--; + ndr_print_ptr(ndr, "length", r->out.length); + ndr->depth++; + if (r->out.length) { + ndr_print_uint32(ndr, "length", *r->out.length); + } + ndr->depth--; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_ReplaceKey(struct ndr_push *ndr, int flags, const struct winreg_ReplaceKey *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_ReplaceKey(struct ndr_pull *ndr, int flags, struct winreg_ReplaceKey *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_ReplaceKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_ReplaceKey *r) +{ + ndr_print_struct(ndr, name, "winreg_ReplaceKey"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_ReplaceKey"); + ndr->depth++; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_ReplaceKey"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_RestoreKey(struct ndr_push *ndr, int flags, const struct winreg_RestoreKey *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_RestoreKey(struct ndr_pull *ndr, int flags, struct winreg_RestoreKey *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_RestoreKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_RestoreKey *r) +{ + ndr_print_struct(ndr, name, "winreg_RestoreKey"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_RestoreKey"); + ndr->depth++; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_RestoreKey"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_SaveKey(struct ndr_push *ndr, int flags, const struct winreg_SaveKey *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_SaveKey(struct ndr_pull *ndr, int flags, struct winreg_SaveKey *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_SaveKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_SaveKey *r) +{ + ndr_print_struct(ndr, name, "winreg_SaveKey"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_SaveKey"); + ndr->depth++; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_SaveKey"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_SetKeySecurity(struct ndr_push *ndr, int flags, const struct winreg_SetKeySecurity *r) +{ + if (flags & NDR_IN) { + if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + if (r->in.sd == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_KeySecurityData(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sd)); + } + if (flags & NDR_OUT) { + if (r->out.sd == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_KeySecurityData(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sd)); + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_SetKeySecurity(struct ndr_pull *ndr, int flags, struct winreg_SetKeySecurity *r) +{ + TALLOC_CTX *_mem_save_handle_0; + TALLOC_CTX *_mem_save_sd_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|NDR_BUFFERS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.sd); + } + _mem_save_sd_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.sd, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_KeySecurityData(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sd)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.sd); + *r->out.sd = *r->in.sd; + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.sd); + } + _mem_save_sd_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.sd, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_KeySecurityData(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sd)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sd_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_SetKeySecurity(struct ndr_print *ndr, const char *name, int flags, const struct winreg_SetKeySecurity *r) +{ + ndr_print_struct(ndr, name, "winreg_SetKeySecurity"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_SetKeySecurity"); + 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_winreg_AccessMask(ndr, "access_mask", r->in.access_mask); + ndr_print_ptr(ndr, "sd", r->in.sd); + ndr->depth++; + ndr_print_KeySecurityData(ndr, "sd", r->in.sd); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_SetKeySecurity"); + ndr->depth++; + ndr_print_ptr(ndr, "sd", r->out.sd); + ndr->depth++; + ndr_print_KeySecurityData(ndr, "sd", r->out.sd); + ndr->depth--; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_SetValue(struct ndr_push *ndr, int flags, const struct winreg_SetValue *r) +{ + if (flags & NDR_IN) { + if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name)); + NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, r->in.type)); + if (r->in.data == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.size)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->in.data, r->in.size)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.size)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_SetValue(struct ndr_pull *ndr, int flags, struct winreg_SetValue *r) +{ + TALLOC_CTX *_mem_save_handle_0; + if (flags & NDR_IN) { + 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|NDR_BUFFERS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name)); + NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, &r->in.type)); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.data)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC_N(ndr, r->in.data, ndr_get_array_size(ndr, &r->in.data)); + } + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->in.data, ndr_get_array_size(ndr, &r->in.data))); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.size)); + if (r->in.data) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.data, r->in.size)); + } + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_SetValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_SetValue *r) +{ + ndr_print_struct(ndr, name, "winreg_SetValue"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_SetValue"); + 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_winreg_String(ndr, "name", &r->in.name); + ndr_print_winreg_Type(ndr, "type", r->in.type); + ndr_print_ptr(ndr, "data", r->in.data); + ndr->depth++; + ndr_print_array_uint8(ndr, "data", r->in.data, r->in.size); + ndr->depth--; + ndr_print_uint32(ndr, "size", r->in.size); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_SetValue"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_UnLoadKey(struct ndr_push *ndr, int flags, const struct winreg_UnLoadKey *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_UnLoadKey(struct ndr_pull *ndr, int flags, struct winreg_UnLoadKey *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_UnLoadKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_UnLoadKey *r) +{ + ndr_print_struct(ndr, name, "winreg_UnLoadKey"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_UnLoadKey"); + ndr->depth++; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_UnLoadKey"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_InitiateSystemShutdown(struct ndr_push *ndr, int flags, const struct winreg_InitiateSystemShutdown *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.hostname)); + if (r->in.hostname) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.hostname)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.message)); + if (r->in.message) { + NDR_CHECK(ndr_push_initshutdown_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message)); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.timeout)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.force_apps)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.reboot)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_InitiateSystemShutdown(struct ndr_pull *ndr, int flags, struct winreg_InitiateSystemShutdown *r) +{ + uint32_t _ptr_hostname; + uint32_t _ptr_message; + TALLOC_CTX *_mem_save_hostname_0; + TALLOC_CTX *_mem_save_message_0; + if (flags & NDR_IN) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_hostname)); + if (_ptr_hostname) { + NDR_PULL_ALLOC(ndr, r->in.hostname); + } else { + r->in.hostname = NULL; + } + if (r->in.hostname) { + _mem_save_hostname_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.hostname, 0); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.hostname)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_hostname_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_message)); + if (_ptr_message) { + NDR_PULL_ALLOC(ndr, r->in.message); + } else { + r->in.message = NULL; + } + if (r->in.message) { + _mem_save_message_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.message, 0); + NDR_CHECK(ndr_pull_initshutdown_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_message_0, 0); + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.timeout)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.force_apps)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.reboot)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_InitiateSystemShutdown(struct ndr_print *ndr, const char *name, int flags, const struct winreg_InitiateSystemShutdown *r) +{ + ndr_print_struct(ndr, name, "winreg_InitiateSystemShutdown"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_InitiateSystemShutdown"); + ndr->depth++; + ndr_print_ptr(ndr, "hostname", r->in.hostname); + ndr->depth++; + if (r->in.hostname) { + ndr_print_uint16(ndr, "hostname", *r->in.hostname); + } + ndr->depth--; + ndr_print_ptr(ndr, "message", r->in.message); + ndr->depth++; + if (r->in.message) { + ndr_print_initshutdown_String(ndr, "message", r->in.message); + } + ndr->depth--; + ndr_print_uint32(ndr, "timeout", r->in.timeout); + ndr_print_uint8(ndr, "force_apps", r->in.force_apps); + ndr_print_uint8(ndr, "reboot", r->in.reboot); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_InitiateSystemShutdown"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_AbortSystemShutdown(struct ndr_push *ndr, int flags, const struct winreg_AbortSystemShutdown *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server)); + if (r->in.server) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.server)); + } + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_AbortSystemShutdown(struct ndr_pull *ndr, int flags, struct winreg_AbortSystemShutdown *r) +{ + uint32_t _ptr_server; + TALLOC_CTX *_mem_save_server_0; + if (flags & NDR_IN) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server)); + if (_ptr_server) { + NDR_PULL_ALLOC(ndr, r->in.server); + } else { + r->in.server = NULL; + } + if (r->in.server) { + _mem_save_server_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.server, 0); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.server)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_0, 0); + } + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_AbortSystemShutdown(struct ndr_print *ndr, const char *name, int flags, const struct winreg_AbortSystemShutdown *r) +{ + ndr_print_struct(ndr, name, "winreg_AbortSystemShutdown"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_AbortSystemShutdown"); + ndr->depth++; + ndr_print_ptr(ndr, "server", r->in.server); + ndr->depth++; + if (r->in.server) { + ndr_print_uint16(ndr, "server", *r->in.server); + } + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_AbortSystemShutdown"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_GetVersion(struct ndr_push *ndr, int flags, const struct winreg_GetVersion *r) +{ + if (flags & NDR_IN) { + if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.version)); + if (r->out.version) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.version)); + } + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_GetVersion(struct ndr_pull *ndr, int flags, struct winreg_GetVersion *r) +{ + uint32_t _ptr_version; + TALLOC_CTX *_mem_save_handle_0; + TALLOC_CTX *_mem_save_version_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|NDR_BUFFERS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_version)); + if (_ptr_version) { + NDR_PULL_ALLOC(ndr, r->out.version); + } else { + r->out.version = NULL; + } + if (r->out.version) { + _mem_save_version_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.version, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.version)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_version_0, 0); + } + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_GetVersion(struct ndr_print *ndr, const char *name, int flags, const struct winreg_GetVersion *r) +{ + ndr_print_struct(ndr, name, "winreg_GetVersion"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_GetVersion"); + ndr->depth++; + ndr_print_ptr(ndr, "handle", r->in.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->in.handle); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_GetVersion"); + ndr->depth++; + ndr_print_ptr(ndr, "version", r->out.version); + ndr->depth++; + if (r->out.version) { + ndr_print_uint32(ndr, "version", *r->out.version); + } + ndr->depth--; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_OpenHKCC(struct ndr_push *ndr, int flags, const struct winreg_OpenHKCC *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name)); + if (r->in.system_name) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.system_name)); + } + NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + } + if (flags & NDR_OUT) { + if (r->out.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle)); + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_OpenHKCC(struct ndr_pull *ndr, int flags, struct winreg_OpenHKCC *r) +{ + uint32_t _ptr_system_name; + TALLOC_CTX *_mem_save_system_name_0; + TALLOC_CTX *_mem_save_handle_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name)); + if (_ptr_system_name) { + NDR_PULL_ALLOC(ndr, r->in.system_name); + } else { + r->in.system_name = NULL; + } + if (r->in.system_name) { + _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.system_name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0); + } + NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + NDR_PULL_ALLOC(ndr, r->out.handle); + ZERO_STRUCTP(r->out.handle); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.handle); + } + _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_OpenHKCC(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKCC *r) +{ + ndr_print_struct(ndr, name, "winreg_OpenHKCC"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_OpenHKCC"); + ndr->depth++; + ndr_print_ptr(ndr, "system_name", r->in.system_name); + ndr->depth++; + if (r->in.system_name) { + ndr_print_uint16(ndr, "system_name", *r->in.system_name); + } + ndr->depth--; + ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_OpenHKCC"); + ndr->depth++; + ndr_print_ptr(ndr, "handle", r->out.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->out.handle); + ndr->depth--; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_OpenHKDD(struct ndr_push *ndr, int flags, const struct winreg_OpenHKDD *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name)); + if (r->in.system_name) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.system_name)); + } + NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + } + if (flags & NDR_OUT) { + if (r->out.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle)); + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_OpenHKDD(struct ndr_pull *ndr, int flags, struct winreg_OpenHKDD *r) +{ + uint32_t _ptr_system_name; + TALLOC_CTX *_mem_save_system_name_0; + TALLOC_CTX *_mem_save_handle_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name)); + if (_ptr_system_name) { + NDR_PULL_ALLOC(ndr, r->in.system_name); + } else { + r->in.system_name = NULL; + } + if (r->in.system_name) { + _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.system_name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0); + } + NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + NDR_PULL_ALLOC(ndr, r->out.handle); + ZERO_STRUCTP(r->out.handle); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.handle); + } + _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_OpenHKDD(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKDD *r) +{ + ndr_print_struct(ndr, name, "winreg_OpenHKDD"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_OpenHKDD"); + ndr->depth++; + ndr_print_ptr(ndr, "system_name", r->in.system_name); + ndr->depth++; + if (r->in.system_name) { + ndr_print_uint16(ndr, "system_name", *r->in.system_name); + } + ndr->depth--; + ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_OpenHKDD"); + ndr->depth++; + ndr_print_ptr(ndr, "handle", r->out.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->out.handle); + ndr->depth--; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_QueryMultipleValues(struct ndr_push *ndr, int flags, const struct winreg_QueryMultipleValues *r) +{ + uint32_t cntr_values_1; + if (flags & NDR_IN) { + if (r->in.key_handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.key_handle)); + if (r->in.values == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_values)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_values)); + for (cntr_values_1 = 0; cntr_values_1 < r->in.num_values; cntr_values_1++) { + NDR_CHECK(ndr_push_QueryMultipleValue(ndr, NDR_SCALARS, &r->in.values[cntr_values_1])); + } + for (cntr_values_1 = 0; cntr_values_1 < r->in.num_values; cntr_values_1++) { + NDR_CHECK(ndr_push_QueryMultipleValue(ndr, NDR_BUFFERS, &r->in.values[cntr_values_1])); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_values)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.buffer)); + if (r->in.buffer) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.buffer_size)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.buffer_size)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->in.buffer, *r->in.buffer_size)); + } + if (r->in.buffer_size == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.buffer_size)); + } + if (flags & NDR_OUT) { + if (r->out.values == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_values)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_values)); + for (cntr_values_1 = 0; cntr_values_1 < r->in.num_values; cntr_values_1++) { + NDR_CHECK(ndr_push_QueryMultipleValue(ndr, NDR_SCALARS, &r->out.values[cntr_values_1])); + } + for (cntr_values_1 = 0; cntr_values_1 < r->in.num_values; cntr_values_1++) { + NDR_CHECK(ndr_push_QueryMultipleValue(ndr, NDR_BUFFERS, &r->out.values[cntr_values_1])); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.buffer)); + if (r->out.buffer) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.buffer_size)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.buffer_size)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.buffer, *r->out.buffer_size)); + } + if (r->out.buffer_size == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.buffer_size)); + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_QueryMultipleValues(struct ndr_pull *ndr, int flags, struct winreg_QueryMultipleValues *r) +{ + uint32_t cntr_values_1; + uint32_t _ptr_buffer; + TALLOC_CTX *_mem_save_key_handle_0; + TALLOC_CTX *_mem_save_values_1; + TALLOC_CTX *_mem_save_buffer_0; + TALLOC_CTX *_mem_save_buffer_size_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.key_handle); + } + _mem_save_key_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.key_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.key_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_key_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.values)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.values)); + if (ndr_get_array_length(ndr, &r->in.values) > ndr_get_array_size(ndr, &r->in.values)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.values), ndr_get_array_length(ndr, &r->in.values)); + } + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC_N(ndr, r->in.values, ndr_get_array_size(ndr, &r->in.values)); + } + memcpy(r->out.values,r->in.values,ndr_get_array_size(ndr, &r->in.values) * sizeof(*r->in.values)); + _mem_save_values_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.values, 0); + for (cntr_values_1 = 0; cntr_values_1 < r->in.num_values; cntr_values_1++) { + NDR_CHECK(ndr_pull_QueryMultipleValue(ndr, NDR_SCALARS, &r->in.values[cntr_values_1])); + } + for (cntr_values_1 = 0; cntr_values_1 < r->in.num_values; cntr_values_1++) { + NDR_CHECK(ndr_pull_QueryMultipleValue(ndr, NDR_BUFFERS, &r->in.values[cntr_values_1])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_values_1, 0); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.num_values)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_buffer)); + if (_ptr_buffer) { + NDR_PULL_ALLOC(ndr, r->in.buffer); + } else { + r->in.buffer = NULL; + } + if (r->in.buffer) { + _mem_save_buffer_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.buffer, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.buffer)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.buffer)); + if (ndr_get_array_length(ndr, &r->in.buffer) > ndr_get_array_size(ndr, &r->in.buffer)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.buffer), ndr_get_array_length(ndr, &r->in.buffer)); + } + NDR_PULL_ALLOC_N(ndr, r->in.buffer, ndr_get_array_size(ndr, &r->in.buffer)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->in.buffer, ndr_get_array_length(ndr, &r->in.buffer))); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_buffer_0, 0); + } + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.buffer_size); + } + _mem_save_buffer_size_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.buffer_size, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.buffer_size)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_buffer_size_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC_N(ndr, r->out.values, r->in.num_values); + memcpy(r->out.values, r->in.values, r->in.num_values * sizeof(*r->in.values)); + NDR_PULL_ALLOC(ndr, r->out.buffer_size); + *r->out.buffer_size = *r->in.buffer_size; + if (r->in.values) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.values, r->in.num_values)); + } + if (r->in.values) { + NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->in.values, r->in.num_values)); + } + if (r->in.buffer) { + if (r->in.buffer_size == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.buffer, *r->in.buffer_size)); + } + if (r->in.buffer) { + if (r->in.buffer_size == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->in.buffer, *r->in.buffer_size)); + } + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_array_size(ndr, &r->out.values)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->out.values)); + if (ndr_get_array_length(ndr, &r->out.values) > ndr_get_array_size(ndr, &r->out.values)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->out.values), ndr_get_array_length(ndr, &r->out.values)); + } + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC_N(ndr, r->out.values, ndr_get_array_size(ndr, &r->out.values)); + } + memcpy(r->out.values,r->in.values,ndr_get_array_size(ndr, &r->out.values) * sizeof(*r->in.values)); + _mem_save_values_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.values, 0); + for (cntr_values_1 = 0; cntr_values_1 < r->in.num_values; cntr_values_1++) { + NDR_CHECK(ndr_pull_QueryMultipleValue(ndr, NDR_SCALARS, &r->out.values[cntr_values_1])); + } + for (cntr_values_1 = 0; cntr_values_1 < r->in.num_values; cntr_values_1++) { + NDR_CHECK(ndr_pull_QueryMultipleValue(ndr, NDR_BUFFERS, &r->out.values[cntr_values_1])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_values_1, 0); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_buffer)); + if (_ptr_buffer) { + NDR_PULL_ALLOC(ndr, r->out.buffer); + } else { + r->out.buffer = NULL; + } + if (r->out.buffer) { + _mem_save_buffer_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.buffer, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->out.buffer)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->out.buffer)); + if (ndr_get_array_length(ndr, &r->out.buffer) > ndr_get_array_size(ndr, &r->out.buffer)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->out.buffer), ndr_get_array_length(ndr, &r->out.buffer)); + } + NDR_PULL_ALLOC_N(ndr, r->out.buffer, ndr_get_array_size(ndr, &r->out.buffer)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->out.buffer, ndr_get_array_length(ndr, &r->out.buffer))); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_buffer_0, 0); + } + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.buffer_size); + } + _mem_save_buffer_size_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.buffer_size, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.buffer_size)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_buffer_size_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + if (r->out.values) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.values, r->in.num_values)); + } + if (r->out.values) { + NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->out.values, r->in.num_values)); + } + if (r->out.buffer) { + if (r->out.buffer_size == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.buffer, *r->out.buffer_size)); + } + if (r->out.buffer) { + if (r->out.buffer_size == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->out.buffer, *r->out.buffer_size)); + } + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_QueryMultipleValues(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryMultipleValues *r) +{ + uint32_t cntr_values_1; + ndr_print_struct(ndr, name, "winreg_QueryMultipleValues"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_QueryMultipleValues"); + ndr->depth++; + ndr_print_ptr(ndr, "key_handle", r->in.key_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "key_handle", r->in.key_handle); + ndr->depth--; + ndr_print_ptr(ndr, "values", r->in.values); + ndr->depth++; + ndr->print(ndr, "%s: ARRAY(%d)", "values", r->in.num_values); + ndr->depth++; + for (cntr_values_1=0;cntr_values_1<r->in.num_values;cntr_values_1++) { + char *idx_1=NULL; + asprintf(&idx_1, "[%d]", cntr_values_1); + if (idx_1) { + ndr_print_QueryMultipleValue(ndr, "values", &r->in.values[cntr_values_1]); + free(idx_1); + } + } + ndr->depth--; + ndr->depth--; + ndr_print_uint32(ndr, "num_values", r->in.num_values); + ndr_print_ptr(ndr, "buffer", r->in.buffer); + ndr->depth++; + if (r->in.buffer) { + ndr_print_array_uint8(ndr, "buffer", r->in.buffer, *r->in.buffer_size); + } + ndr->depth--; + ndr_print_ptr(ndr, "buffer_size", r->in.buffer_size); + ndr->depth++; + ndr_print_uint32(ndr, "buffer_size", *r->in.buffer_size); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_QueryMultipleValues"); + ndr->depth++; + ndr_print_ptr(ndr, "values", r->out.values); + ndr->depth++; + ndr->print(ndr, "%s: ARRAY(%d)", "values", r->in.num_values); + ndr->depth++; + for (cntr_values_1=0;cntr_values_1<r->in.num_values;cntr_values_1++) { + char *idx_1=NULL; + asprintf(&idx_1, "[%d]", cntr_values_1); + if (idx_1) { + ndr_print_QueryMultipleValue(ndr, "values", &r->out.values[cntr_values_1]); + free(idx_1); + } + } + ndr->depth--; + ndr->depth--; + ndr_print_ptr(ndr, "buffer", r->out.buffer); + ndr->depth++; + if (r->out.buffer) { + ndr_print_array_uint8(ndr, "buffer", r->out.buffer, *r->out.buffer_size); + } + ndr->depth--; + ndr_print_ptr(ndr, "buffer_size", r->out.buffer_size); + ndr->depth++; + ndr_print_uint32(ndr, "buffer_size", *r->out.buffer_size); + ndr->depth--; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_InitiateSystemShutdownEx(struct ndr_push *ndr, int flags, const struct winreg_InitiateSystemShutdownEx *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.hostname)); + if (r->in.hostname) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.hostname)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.message)); + if (r->in.message) { + NDR_CHECK(ndr_push_initshutdown_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message)); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.timeout)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.force_apps)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.reboot)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.reason)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_InitiateSystemShutdownEx(struct ndr_pull *ndr, int flags, struct winreg_InitiateSystemShutdownEx *r) +{ + uint32_t _ptr_hostname; + uint32_t _ptr_message; + TALLOC_CTX *_mem_save_hostname_0; + TALLOC_CTX *_mem_save_message_0; + if (flags & NDR_IN) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_hostname)); + if (_ptr_hostname) { + NDR_PULL_ALLOC(ndr, r->in.hostname); + } else { + r->in.hostname = NULL; + } + if (r->in.hostname) { + _mem_save_hostname_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.hostname, 0); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.hostname)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_hostname_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_message)); + if (_ptr_message) { + NDR_PULL_ALLOC(ndr, r->in.message); + } else { + r->in.message = NULL; + } + if (r->in.message) { + _mem_save_message_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.message, 0); + NDR_CHECK(ndr_pull_initshutdown_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_message_0, 0); + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.timeout)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.force_apps)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.reboot)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.reason)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_InitiateSystemShutdownEx(struct ndr_print *ndr, const char *name, int flags, const struct winreg_InitiateSystemShutdownEx *r) +{ + ndr_print_struct(ndr, name, "winreg_InitiateSystemShutdownEx"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_InitiateSystemShutdownEx"); + ndr->depth++; + ndr_print_ptr(ndr, "hostname", r->in.hostname); + ndr->depth++; + if (r->in.hostname) { + ndr_print_uint16(ndr, "hostname", *r->in.hostname); + } + ndr->depth--; + ndr_print_ptr(ndr, "message", r->in.message); + ndr->depth++; + if (r->in.message) { + ndr_print_initshutdown_String(ndr, "message", r->in.message); + } + ndr->depth--; + ndr_print_uint32(ndr, "timeout", r->in.timeout); + ndr_print_uint8(ndr, "force_apps", r->in.force_apps); + ndr_print_uint8(ndr, "reboot", r->in.reboot); + ndr_print_uint32(ndr, "reason", r->in.reason); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_InitiateSystemShutdownEx"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_SaveKeyEx(struct ndr_push *ndr, int flags, const struct winreg_SaveKeyEx *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_SaveKeyEx(struct ndr_pull *ndr, int flags, struct winreg_SaveKeyEx *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_SaveKeyEx(struct ndr_print *ndr, const char *name, int flags, const struct winreg_SaveKeyEx *r) +{ + ndr_print_struct(ndr, name, "winreg_SaveKeyEx"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_SaveKeyEx"); + ndr->depth++; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_SaveKeyEx"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_OpenHKPT(struct ndr_push *ndr, int flags, const struct winreg_OpenHKPT *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name)); + if (r->in.system_name) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.system_name)); + } + NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + } + if (flags & NDR_OUT) { + if (r->out.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle)); + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_OpenHKPT(struct ndr_pull *ndr, int flags, struct winreg_OpenHKPT *r) +{ + uint32_t _ptr_system_name; + TALLOC_CTX *_mem_save_system_name_0; + TALLOC_CTX *_mem_save_handle_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name)); + if (_ptr_system_name) { + NDR_PULL_ALLOC(ndr, r->in.system_name); + } else { + r->in.system_name = NULL; + } + if (r->in.system_name) { + _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.system_name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0); + } + NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + NDR_PULL_ALLOC(ndr, r->out.handle); + ZERO_STRUCTP(r->out.handle); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.handle); + } + _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_OpenHKPT(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKPT *r) +{ + ndr_print_struct(ndr, name, "winreg_OpenHKPT"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_OpenHKPT"); + ndr->depth++; + ndr_print_ptr(ndr, "system_name", r->in.system_name); + ndr->depth++; + if (r->in.system_name) { + ndr_print_uint16(ndr, "system_name", *r->in.system_name); + } + ndr->depth--; + ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_OpenHKPT"); + ndr->depth++; + ndr_print_ptr(ndr, "handle", r->out.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->out.handle); + ndr->depth--; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_OpenHKPN(struct ndr_push *ndr, int flags, const struct winreg_OpenHKPN *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name)); + if (r->in.system_name) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.system_name)); + } + NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + } + if (flags & NDR_OUT) { + if (r->out.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX; + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle)); + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_OpenHKPN(struct ndr_pull *ndr, int flags, struct winreg_OpenHKPN *r) +{ + uint32_t _ptr_system_name; + TALLOC_CTX *_mem_save_system_name_0; + TALLOC_CTX *_mem_save_handle_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name)); + if (_ptr_system_name) { + NDR_PULL_ALLOC(ndr, r->in.system_name); + } else { + r->in.system_name = NULL; + } + if (r->in.system_name) { + _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.system_name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0); + } + NDR_CHECK(ndr_pull_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + NDR_PULL_ALLOC(ndr, r->out.handle); + ZERO_STRUCTP(r->out.handle); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.handle); + } + _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_OpenHKPN(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKPN *r) +{ + ndr_print_struct(ndr, name, "winreg_OpenHKPN"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_OpenHKPN"); + ndr->depth++; + ndr_print_ptr(ndr, "system_name", r->in.system_name); + ndr->depth++; + if (r->in.system_name) { + ndr_print_uint16(ndr, "system_name", *r->in.system_name); + } + ndr->depth--; + ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_OpenHKPN"); + ndr->depth++; + ndr_print_ptr(ndr, "handle", r->out.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->out.handle); + ndr->depth--; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +NTSTATUS ndr_push_winreg_QueryMultipleValues2(struct ndr_push *ndr, int flags, const struct winreg_QueryMultipleValues2 *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_winreg_QueryMultipleValues2(struct ndr_pull *ndr, int flags, struct winreg_QueryMultipleValues2 *r) +{ + if (flags & NDR_IN) { + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + } + return NT_STATUS_OK; +} + +_PUBLIC_ void ndr_print_winreg_QueryMultipleValues2(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryMultipleValues2 *r) +{ + ndr_print_struct(ndr, name, "winreg_QueryMultipleValues2"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "winreg_QueryMultipleValues2"); + ndr->depth++; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "winreg_QueryMultipleValues2"); + ndr->depth++; + ndr_print_WERROR(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +const struct dcerpc_interface_call winreg_calls[] = { + { + "winreg_OpenHKCR", + sizeof(struct winreg_OpenHKCR), + (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKCR, + (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKCR, + (ndr_print_function_t) ndr_print_winreg_OpenHKCR, + False, + }, + { + "winreg_OpenHKCU", + sizeof(struct winreg_OpenHKCU), + (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKCU, + (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKCU, + (ndr_print_function_t) ndr_print_winreg_OpenHKCU, + False, + }, + { + "winreg_OpenHKLM", + sizeof(struct winreg_OpenHKLM), + (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKLM, + (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKLM, + (ndr_print_function_t) ndr_print_winreg_OpenHKLM, + False, + }, + { + "winreg_OpenHKPD", + sizeof(struct winreg_OpenHKPD), + (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKPD, + (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKPD, + (ndr_print_function_t) ndr_print_winreg_OpenHKPD, + False, + }, + { + "winreg_OpenHKU", + sizeof(struct winreg_OpenHKU), + (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKU, + (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKU, + (ndr_print_function_t) ndr_print_winreg_OpenHKU, + False, + }, + { + "winreg_CloseKey", + sizeof(struct winreg_CloseKey), + (ndr_push_flags_fn_t) ndr_push_winreg_CloseKey, + (ndr_pull_flags_fn_t) ndr_pull_winreg_CloseKey, + (ndr_print_function_t) ndr_print_winreg_CloseKey, + False, + }, + { + "winreg_CreateKey", + sizeof(struct winreg_CreateKey), + (ndr_push_flags_fn_t) ndr_push_winreg_CreateKey, + (ndr_pull_flags_fn_t) ndr_pull_winreg_CreateKey, + (ndr_print_function_t) ndr_print_winreg_CreateKey, + False, + }, + { + "winreg_DeleteKey", + sizeof(struct winreg_DeleteKey), + (ndr_push_flags_fn_t) ndr_push_winreg_DeleteKey, + (ndr_pull_flags_fn_t) ndr_pull_winreg_DeleteKey, + (ndr_print_function_t) ndr_print_winreg_DeleteKey, + False, + }, + { + "winreg_DeleteValue", + sizeof(struct winreg_DeleteValue), + (ndr_push_flags_fn_t) ndr_push_winreg_DeleteValue, + (ndr_pull_flags_fn_t) ndr_pull_winreg_DeleteValue, + (ndr_print_function_t) ndr_print_winreg_DeleteValue, + False, + }, + { + "winreg_EnumKey", + sizeof(struct winreg_EnumKey), + (ndr_push_flags_fn_t) ndr_push_winreg_EnumKey, + (ndr_pull_flags_fn_t) ndr_pull_winreg_EnumKey, + (ndr_print_function_t) ndr_print_winreg_EnumKey, + False, + }, + { + "winreg_EnumValue", + sizeof(struct winreg_EnumValue), + (ndr_push_flags_fn_t) ndr_push_winreg_EnumValue, + (ndr_pull_flags_fn_t) ndr_pull_winreg_EnumValue, + (ndr_print_function_t) ndr_print_winreg_EnumValue, + False, + }, + { + "winreg_FlushKey", + sizeof(struct winreg_FlushKey), + (ndr_push_flags_fn_t) ndr_push_winreg_FlushKey, + (ndr_pull_flags_fn_t) ndr_pull_winreg_FlushKey, + (ndr_print_function_t) ndr_print_winreg_FlushKey, + False, + }, + { + "winreg_GetKeySecurity", + sizeof(struct winreg_GetKeySecurity), + (ndr_push_flags_fn_t) ndr_push_winreg_GetKeySecurity, + (ndr_pull_flags_fn_t) ndr_pull_winreg_GetKeySecurity, + (ndr_print_function_t) ndr_print_winreg_GetKeySecurity, + False, + }, + { + "winreg_LoadKey", + sizeof(struct winreg_LoadKey), + (ndr_push_flags_fn_t) ndr_push_winreg_LoadKey, + (ndr_pull_flags_fn_t) ndr_pull_winreg_LoadKey, + (ndr_print_function_t) ndr_print_winreg_LoadKey, + False, + }, + { + "winreg_NotifyChangeKeyValue", + sizeof(struct winreg_NotifyChangeKeyValue), + (ndr_push_flags_fn_t) ndr_push_winreg_NotifyChangeKeyValue, + (ndr_pull_flags_fn_t) ndr_pull_winreg_NotifyChangeKeyValue, + (ndr_print_function_t) ndr_print_winreg_NotifyChangeKeyValue, + False, + }, + { + "winreg_OpenKey", + sizeof(struct winreg_OpenKey), + (ndr_push_flags_fn_t) ndr_push_winreg_OpenKey, + (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenKey, + (ndr_print_function_t) ndr_print_winreg_OpenKey, + False, + }, + { + "winreg_QueryInfoKey", + sizeof(struct winreg_QueryInfoKey), + (ndr_push_flags_fn_t) ndr_push_winreg_QueryInfoKey, + (ndr_pull_flags_fn_t) ndr_pull_winreg_QueryInfoKey, + (ndr_print_function_t) ndr_print_winreg_QueryInfoKey, + False, + }, + { + "winreg_QueryValue", + sizeof(struct winreg_QueryValue), + (ndr_push_flags_fn_t) ndr_push_winreg_QueryValue, + (ndr_pull_flags_fn_t) ndr_pull_winreg_QueryValue, + (ndr_print_function_t) ndr_print_winreg_QueryValue, + False, + }, + { + "winreg_ReplaceKey", + sizeof(struct winreg_ReplaceKey), + (ndr_push_flags_fn_t) ndr_push_winreg_ReplaceKey, + (ndr_pull_flags_fn_t) ndr_pull_winreg_ReplaceKey, + (ndr_print_function_t) ndr_print_winreg_ReplaceKey, + False, + }, + { + "winreg_RestoreKey", + sizeof(struct winreg_RestoreKey), + (ndr_push_flags_fn_t) ndr_push_winreg_RestoreKey, + (ndr_pull_flags_fn_t) ndr_pull_winreg_RestoreKey, + (ndr_print_function_t) ndr_print_winreg_RestoreKey, + False, + }, + { + "winreg_SaveKey", + sizeof(struct winreg_SaveKey), + (ndr_push_flags_fn_t) ndr_push_winreg_SaveKey, + (ndr_pull_flags_fn_t) ndr_pull_winreg_SaveKey, + (ndr_print_function_t) ndr_print_winreg_SaveKey, + False, + }, + { + "winreg_SetKeySecurity", + sizeof(struct winreg_SetKeySecurity), + (ndr_push_flags_fn_t) ndr_push_winreg_SetKeySecurity, + (ndr_pull_flags_fn_t) ndr_pull_winreg_SetKeySecurity, + (ndr_print_function_t) ndr_print_winreg_SetKeySecurity, + False, + }, + { + "winreg_SetValue", + sizeof(struct winreg_SetValue), + (ndr_push_flags_fn_t) ndr_push_winreg_SetValue, + (ndr_pull_flags_fn_t) ndr_pull_winreg_SetValue, + (ndr_print_function_t) ndr_print_winreg_SetValue, + False, + }, + { + "winreg_UnLoadKey", + sizeof(struct winreg_UnLoadKey), + (ndr_push_flags_fn_t) ndr_push_winreg_UnLoadKey, + (ndr_pull_flags_fn_t) ndr_pull_winreg_UnLoadKey, + (ndr_print_function_t) ndr_print_winreg_UnLoadKey, + False, + }, + { + "winreg_InitiateSystemShutdown", + sizeof(struct winreg_InitiateSystemShutdown), + (ndr_push_flags_fn_t) ndr_push_winreg_InitiateSystemShutdown, + (ndr_pull_flags_fn_t) ndr_pull_winreg_InitiateSystemShutdown, + (ndr_print_function_t) ndr_print_winreg_InitiateSystemShutdown, + False, + }, + { + "winreg_AbortSystemShutdown", + sizeof(struct winreg_AbortSystemShutdown), + (ndr_push_flags_fn_t) ndr_push_winreg_AbortSystemShutdown, + (ndr_pull_flags_fn_t) ndr_pull_winreg_AbortSystemShutdown, + (ndr_print_function_t) ndr_print_winreg_AbortSystemShutdown, + False, + }, + { + "winreg_GetVersion", + sizeof(struct winreg_GetVersion), + (ndr_push_flags_fn_t) ndr_push_winreg_GetVersion, + (ndr_pull_flags_fn_t) ndr_pull_winreg_GetVersion, + (ndr_print_function_t) ndr_print_winreg_GetVersion, + False, + }, + { + "winreg_OpenHKCC", + sizeof(struct winreg_OpenHKCC), + (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKCC, + (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKCC, + (ndr_print_function_t) ndr_print_winreg_OpenHKCC, + False, + }, + { + "winreg_OpenHKDD", + sizeof(struct winreg_OpenHKDD), + (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKDD, + (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKDD, + (ndr_print_function_t) ndr_print_winreg_OpenHKDD, + False, + }, + { + "winreg_QueryMultipleValues", + sizeof(struct winreg_QueryMultipleValues), + (ndr_push_flags_fn_t) ndr_push_winreg_QueryMultipleValues, + (ndr_pull_flags_fn_t) ndr_pull_winreg_QueryMultipleValues, + (ndr_print_function_t) ndr_print_winreg_QueryMultipleValues, + False, + }, + { + "winreg_InitiateSystemShutdownEx", + sizeof(struct winreg_InitiateSystemShutdownEx), + (ndr_push_flags_fn_t) ndr_push_winreg_InitiateSystemShutdownEx, + (ndr_pull_flags_fn_t) ndr_pull_winreg_InitiateSystemShutdownEx, + (ndr_print_function_t) ndr_print_winreg_InitiateSystemShutdownEx, + False, + }, + { + "winreg_SaveKeyEx", + sizeof(struct winreg_SaveKeyEx), + (ndr_push_flags_fn_t) ndr_push_winreg_SaveKeyEx, + (ndr_pull_flags_fn_t) ndr_pull_winreg_SaveKeyEx, + (ndr_print_function_t) ndr_print_winreg_SaveKeyEx, + False, + }, + { + "winreg_OpenHKPT", + sizeof(struct winreg_OpenHKPT), + (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKPT, + (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKPT, + (ndr_print_function_t) ndr_print_winreg_OpenHKPT, + False, + }, + { + "winreg_OpenHKPN", + sizeof(struct winreg_OpenHKPN), + (ndr_push_flags_fn_t) ndr_push_winreg_OpenHKPN, + (ndr_pull_flags_fn_t) ndr_pull_winreg_OpenHKPN, + (ndr_print_function_t) ndr_print_winreg_OpenHKPN, + False, + }, + { + "winreg_QueryMultipleValues2", + sizeof(struct winreg_QueryMultipleValues2), + (ndr_push_flags_fn_t) ndr_push_winreg_QueryMultipleValues2, + (ndr_pull_flags_fn_t) ndr_pull_winreg_QueryMultipleValues2, + (ndr_print_function_t) ndr_print_winreg_QueryMultipleValues2, + False, + }, + { NULL, 0, NULL, NULL, NULL, False } +}; + +const char * const winreg_endpoint_strings[] = { + "ncacn_np:[\\pipe\\winreg]", + "ncacn_ip_tcp:", + "ncalrpc:", +}; + +const struct dcerpc_endpoint_list winreg_endpoints = { + .count = 3, + .names = winreg_endpoint_strings +}; + +const char * const winreg_authservice_strings[] = { + "host", +}; + +const struct dcerpc_authservice_list winreg_authservices = { + .count = 3, + .names = winreg_authservice_strings +}; + + +const struct dcerpc_interface_table dcerpc_table_winreg = { + .name = "winreg", + .syntax_id = { + {0x338cd001,0x2244,0x31f1,{0xaa,0xaa},{0x90,0x00,0x38,0x00,0x10,0x03}}, + DCERPC_WINREG_VERSION + }, + .helpstring = DCERPC_WINREG_HELPSTRING, + .num_calls = 35, + .calls = winreg_calls, + .endpoints = &winreg_endpoints, + .authservices = &winreg_authservices +}; + diff --git a/source3/librpc/gen_ndr/ndr_winreg.h b/source3/librpc/gen_ndr/ndr_winreg.h new file mode 100644 index 0000000000..dd2ecf0c19 --- /dev/null +++ b/source3/librpc/gen_ndr/ndr_winreg.h @@ -0,0 +1,131 @@ +/* header auto-generated by pidl */ + +#include "librpc/gen_ndr/winreg.h" + +#ifndef _HEADER_NDR_winreg +#define _HEADER_NDR_winreg + +#include "librpc/ndr/libndr.h" +#define DCERPC_WINREG_UUID "338cd001-2244-31f1-aaaa-900038001003" +#define DCERPC_WINREG_VERSION 1.0 +#define DCERPC_WINREG_NAME "winreg" +#define DCERPC_WINREG_HELPSTRING "Remote Registry Service" +extern const struct dcerpc_interface_table dcerpc_table_winreg; +NTSTATUS dcerpc_server_winreg_init(void); +#define DCERPC_WINREG_OPENHKCR (0x00) + +#define DCERPC_WINREG_OPENHKCU (0x01) + +#define DCERPC_WINREG_OPENHKLM (0x02) + +#define DCERPC_WINREG_OPENHKPD (0x03) + +#define DCERPC_WINREG_OPENHKU (0x04) + +#define DCERPC_WINREG_CLOSEKEY (0x05) + +#define DCERPC_WINREG_CREATEKEY (0x06) + +#define DCERPC_WINREG_DELETEKEY (0x07) + +#define DCERPC_WINREG_DELETEVALUE (0x08) + +#define DCERPC_WINREG_ENUMKEY (0x09) + +#define DCERPC_WINREG_ENUMVALUE (0x0a) + +#define DCERPC_WINREG_FLUSHKEY (0x0b) + +#define DCERPC_WINREG_GETKEYSECURITY (0x0c) + +#define DCERPC_WINREG_LOADKEY (0x0d) + +#define DCERPC_WINREG_NOTIFYCHANGEKEYVALUE (0x0e) + +#define DCERPC_WINREG_OPENKEY (0x0f) + +#define DCERPC_WINREG_QUERYINFOKEY (0x10) + +#define DCERPC_WINREG_QUERYVALUE (0x11) + +#define DCERPC_WINREG_REPLACEKEY (0x12) + +#define DCERPC_WINREG_RESTOREKEY (0x13) + +#define DCERPC_WINREG_SAVEKEY (0x14) + +#define DCERPC_WINREG_SETKEYSECURITY (0x15) + +#define DCERPC_WINREG_SETVALUE (0x16) + +#define DCERPC_WINREG_UNLOADKEY (0x17) + +#define DCERPC_WINREG_INITIATESYSTEMSHUTDOWN (0x18) + +#define DCERPC_WINREG_ABORTSYSTEMSHUTDOWN (0x19) + +#define DCERPC_WINREG_GETVERSION (0x1a) + +#define DCERPC_WINREG_OPENHKCC (0x1b) + +#define DCERPC_WINREG_OPENHKDD (0x1c) + +#define DCERPC_WINREG_QUERYMULTIPLEVALUES (0x1d) + +#define DCERPC_WINREG_INITIATESYSTEMSHUTDOWNEX (0x1e) + +#define DCERPC_WINREG_SAVEKEYEX (0x1f) + +#define DCERPC_WINREG_OPENHKPT (0x20) + +#define DCERPC_WINREG_OPENHKPN (0x21) + +#define DCERPC_WINREG_QUERYMULTIPLEVALUES2 (0x22) + +#define DCERPC_WINREG_CALL_COUNT (35) +void ndr_print_winreg_AccessMask(struct ndr_print *ndr, const char *name, uint32_t r); +void ndr_print_winreg_Type(struct ndr_print *ndr, const char *name, enum winreg_Type r); +NTSTATUS ndr_push_winreg_String(struct ndr_push *ndr, int ndr_flags, const struct winreg_String *r); +NTSTATUS ndr_pull_winreg_String(struct ndr_pull *ndr, int ndr_flags, struct winreg_String *r); +void ndr_print_winreg_String(struct ndr_print *ndr, const char *name, const struct winreg_String *r); +void ndr_print_KeySecurityData(struct ndr_print *ndr, const char *name, const struct KeySecurityData *r); +void ndr_print_winreg_SecBuf(struct ndr_print *ndr, const char *name, const struct winreg_SecBuf *r); +void ndr_print_winreg_CreateAction(struct ndr_print *ndr, const char *name, enum winreg_CreateAction r); +void ndr_print_winreg_StringBuf(struct ndr_print *ndr, const char *name, const struct winreg_StringBuf *r); +void ndr_print_QueryMultipleValue(struct ndr_print *ndr, const char *name, const struct QueryMultipleValue *r); +void ndr_print_winreg_OpenHKCR(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKCR *r); +void ndr_print_winreg_OpenHKCU(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKCU *r); +void ndr_print_winreg_OpenHKLM(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKLM *r); +void ndr_print_winreg_OpenHKPD(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKPD *r); +void ndr_print_winreg_OpenHKU(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKU *r); +void ndr_print_winreg_CloseKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_CloseKey *r); +void ndr_print_winreg_CreateKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_CreateKey *r); +void ndr_print_winreg_DeleteKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_DeleteKey *r); +void ndr_print_winreg_DeleteValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_DeleteValue *r); +void ndr_print_winreg_EnumKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_EnumKey *r); +void ndr_print_winreg_EnumValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_EnumValue *r); +void ndr_print_winreg_FlushKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_FlushKey *r); +void ndr_print_winreg_GetKeySecurity(struct ndr_print *ndr, const char *name, int flags, const struct winreg_GetKeySecurity *r); +void ndr_print_winreg_LoadKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_LoadKey *r); +void ndr_print_winreg_NotifyChangeKeyValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_NotifyChangeKeyValue *r); +void ndr_print_winreg_OpenKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenKey *r); +void ndr_print_winreg_QueryInfoKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryInfoKey *r); +void ndr_print_winreg_QueryValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryValue *r); +void ndr_print_winreg_ReplaceKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_ReplaceKey *r); +void ndr_print_winreg_RestoreKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_RestoreKey *r); +void ndr_print_winreg_SaveKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_SaveKey *r); +void ndr_print_winreg_SetKeySecurity(struct ndr_print *ndr, const char *name, int flags, const struct winreg_SetKeySecurity *r); +void ndr_print_winreg_SetValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_SetValue *r); +void ndr_print_winreg_UnLoadKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_UnLoadKey *r); +void ndr_print_winreg_InitiateSystemShutdown(struct ndr_print *ndr, const char *name, int flags, const struct winreg_InitiateSystemShutdown *r); +void ndr_print_winreg_AbortSystemShutdown(struct ndr_print *ndr, const char *name, int flags, const struct winreg_AbortSystemShutdown *r); +void ndr_print_winreg_GetVersion(struct ndr_print *ndr, const char *name, int flags, const struct winreg_GetVersion *r); +void ndr_print_winreg_OpenHKCC(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKCC *r); +void ndr_print_winreg_OpenHKDD(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKDD *r); +void ndr_print_winreg_QueryMultipleValues(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryMultipleValues *r); +void ndr_print_winreg_InitiateSystemShutdownEx(struct ndr_print *ndr, const char *name, int flags, const struct winreg_InitiateSystemShutdownEx *r); +void ndr_print_winreg_SaveKeyEx(struct ndr_print *ndr, const char *name, int flags, const struct winreg_SaveKeyEx *r); +void ndr_print_winreg_OpenHKPT(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKPT *r); +void ndr_print_winreg_OpenHKPN(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKPN *r); +void ndr_print_winreg_QueryMultipleValues2(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryMultipleValues2 *r); +#endif /* _HEADER_NDR_winreg */ diff --git a/source3/librpc/gen_ndr/srv_initshutdown.c b/source3/librpc/gen_ndr/srv_initshutdown.c new file mode 100644 index 0000000000..ba7a20a6d5 --- /dev/null +++ b/source3/librpc/gen_ndr/srv_initshutdown.c @@ -0,0 +1,177 @@ +/* + * Unix SMB/CIFS implementation. + * server auto-generated by pidl. DO NOT MODIFY! + */ + +#include "includes.h" +#include "librpc/gen_ndr/srv_initshutdown.h" + +static BOOL api_initshutdown_Init(pipes_struct *p) +{ + struct ndr_pull *pull; + struct ndr_push *push; + NTSTATUS status; + DATA_BLOB blob; + struct initshutdown_Init r; + TALLOC_CTX *mem_ctx = talloc_init("api_initshutdown_Init"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_initshutdown_Init(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _initshutdown_Init(p, r.in.hostname, r.in.message, r.in.timeout, r.in.force_apps, r.in.reboot); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_initshutdown_Init(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_initshutdown_Abort(pipes_struct *p) +{ + struct ndr_pull *pull; + struct ndr_push *push; + NTSTATUS status; + DATA_BLOB blob; + struct initshutdown_Abort r; + TALLOC_CTX *mem_ctx = talloc_init("api_initshutdown_Abort"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_initshutdown_Abort(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _initshutdown_Abort(p, r.in.server); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_initshutdown_Abort(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_initshutdown_InitEx(pipes_struct *p) +{ + struct ndr_pull *pull; + struct ndr_push *push; + NTSTATUS status; + DATA_BLOB blob; + struct initshutdown_InitEx r; + TALLOC_CTX *mem_ctx = talloc_init("api_initshutdown_InitEx"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_initshutdown_InitEx(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _initshutdown_InitEx(p, r.in.hostname, r.in.message, r.in.timeout, r.in.force_apps, r.in.reboot, r.in.reason); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_initshutdown_InitEx(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + + +/* Tables */ +static struct api_struct api_initshutdown_cmds[] = +{ + {"INITSHUTDOWN_INIT", DCERPC_INITSHUTDOWN_INIT, api_initshutdown_Init}, + {"INITSHUTDOWN_ABORT", DCERPC_INITSHUTDOWN_ABORT, api_initshutdown_Abort}, + {"INITSHUTDOWN_INITEX", DCERPC_INITSHUTDOWN_INITEX, api_initshutdown_InitEx}, +}; + +void initshutdown_get_pipe_fns(struct api_struct **fns, int *n_fns) +{ + *fns = api_initshutdown_cmds; + *n_fns = sizeof(api_initshutdown_cmds) / sizeof(struct api_struct); +} + +NTSTATUS rpc_initshutdown_init(void) +{ + return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "initshutdown", "initshutdown", api_initshutdown_cmds, sizeof(api_initshutdown_cmds) / sizeof(struct api_struct)); +} diff --git a/source3/librpc/gen_ndr/srv_initshutdown.h b/source3/librpc/gen_ndr/srv_initshutdown.h new file mode 100644 index 0000000000..5182e9958d --- /dev/null +++ b/source3/librpc/gen_ndr/srv_initshutdown.h @@ -0,0 +1,9 @@ +#include "librpc/gen_ndr/ndr_initshutdown.h" +#ifndef __SRV_INITSHUTDOWN__ +#define __SRV_INITSHUTDOWN__ +WERROR _initshutdown_Init(pipes_struct *p, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot); +WERROR _initshutdown_Abort(pipes_struct *p, uint16_t *server); +WERROR _initshutdown_InitEx(pipes_struct *p, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot, uint32_t reason); +void initshutdown_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_initshutdown_init(void); +#endif /* __SRV_INITSHUTDOWN__ */ diff --git a/source3/librpc/gen_ndr/srv_winreg.c b/source3/librpc/gen_ndr/srv_winreg.c new file mode 100644 index 0000000000..e40d53ebb7 --- /dev/null +++ b/source3/librpc/gen_ndr/srv_winreg.c @@ -0,0 +1,1954 @@ +/* + * Unix SMB/CIFS implementation. + * server auto-generated by pidl. DO NOT MODIFY! + */ + +#include "includes.h" +#include "librpc/gen_ndr/srv_winreg.h" + +static BOOL api_winreg_OpenHKCR(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_OpenHKCR(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.handle = talloc_size(mem_ctx, sizeof(*r.out.handle)); + if (r.out.handle == NULL) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_OpenHKCR(p, r.in.system_name, r.in.access_mask, r.out.handle); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_OpenHKCR(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_OpenHKCU(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_OpenHKCU(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.handle = talloc_size(mem_ctx, sizeof(*r.out.handle)); + if (r.out.handle == NULL) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_OpenHKCU(p, r.in.system_name, r.in.access_mask, r.out.handle); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_OpenHKCU(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_OpenHKLM(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_OpenHKLM(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.handle = talloc_size(mem_ctx, sizeof(*r.out.handle)); + if (r.out.handle == NULL) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_OpenHKLM(p, r.in.system_name, r.in.access_mask, r.out.handle); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_OpenHKLM(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_OpenHKPD(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_OpenHKPD(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.handle = talloc_size(mem_ctx, sizeof(*r.out.handle)); + if (r.out.handle == NULL) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_OpenHKPD(p, r.in.system_name, r.in.access_mask, r.out.handle); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_OpenHKPD(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_OpenHKU(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_OpenHKU(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.handle = talloc_size(mem_ctx, sizeof(*r.out.handle)); + if (r.out.handle == NULL) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_OpenHKU(p, r.in.system_name, r.in.access_mask, r.out.handle); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_OpenHKU(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_CloseKey(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_CloseKey(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.handle = r.in.handle; + r.out.result = _winreg_CloseKey(p, r.in.handle); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_CloseKey(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_CreateKey(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_CreateKey(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.new_handle = talloc_size(mem_ctx, sizeof(*r.out.new_handle)); + if (r.out.new_handle == NULL) { + talloc_free(mem_ctx); + return False; + } + + r.out.action_taken = r.in.action_taken; + r.out.result = _winreg_CreateKey(p, r.in.handle, r.in.name, r.in.keyclass, r.in.options, r.in.access_mask, r.in.secdesc, r.out.new_handle, r.in.action_taken); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_CreateKey(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_DeleteKey(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_DeleteKey(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_DeleteKey(p, r.in.handle, r.in.key); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_DeleteKey(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_DeleteValue(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_DeleteValue(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_DeleteValue(p, r.in.handle, r.in.value); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_DeleteValue(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_EnumKey(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_EnumKey(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + 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.in.handle, r.in.enum_index, r.in.name, r.in.keyclass, r.in.last_changed_time); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_EnumKey(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_EnumValue(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_EnumValue(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + 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.in.handle, r.in.enum_index, r.in.name, r.in.type, r.in.value, r.in.size, r.in.length); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_EnumValue(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_FlushKey(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_FlushKey(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_FlushKey(p, r.in.handle); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_FlushKey(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_GetKeySecurity(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_GetKeySecurity(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.sd = r.in.sd; + r.out.result = _winreg_GetKeySecurity(p, r.in.handle, r.in.sec_info, r.in.sd); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_GetKeySecurity(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_LoadKey(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_LoadKey(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_LoadKey(p, r.in.handle, r.in.keyname, r.in.filename); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_LoadKey(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_NotifyChangeKeyValue(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_NotifyChangeKeyValue(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_NotifyChangeKeyValue(p, r.in.handle, r.in.watch_subtree, r.in.notify_filter, r.in.unknown, r.in.string1, r.in.string2, r.in.unknown2); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_NotifyChangeKeyValue(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_OpenKey(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_OpenKey(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.handle = talloc_size(mem_ctx, sizeof(*r.out.handle)); + if (r.out.handle == NULL) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_OpenKey(p, r.in.parent_handle, r.in.keyname, r.in.unknown, r.in.access_mask, r.out.handle); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_OpenKey(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_QueryInfoKey(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_QueryInfoKey(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.class_out = talloc_size(mem_ctx, sizeof(*r.out.class_out)); + if (r.out.class_out == NULL) { + talloc_free(mem_ctx); + return False; + } + + r.out.num_subkeys = talloc_size(mem_ctx, sizeof(*r.out.num_subkeys)); + if (r.out.num_subkeys == NULL) { + talloc_free(mem_ctx); + return False; + } + + r.out.max_subkeylen = talloc_size(mem_ctx, sizeof(*r.out.max_subkeylen)); + if (r.out.max_subkeylen == NULL) { + talloc_free(mem_ctx); + return False; + } + + r.out.max_subkeysize = talloc_size(mem_ctx, sizeof(*r.out.max_subkeysize)); + if (r.out.max_subkeysize == NULL) { + talloc_free(mem_ctx); + return False; + } + + r.out.num_values = talloc_size(mem_ctx, sizeof(*r.out.num_values)); + if (r.out.num_values == NULL) { + talloc_free(mem_ctx); + return False; + } + + r.out.max_valnamelen = talloc_size(mem_ctx, sizeof(*r.out.max_valnamelen)); + if (r.out.max_valnamelen == NULL) { + talloc_free(mem_ctx); + return False; + } + + r.out.max_valbufsize = talloc_size(mem_ctx, sizeof(*r.out.max_valbufsize)); + if (r.out.max_valbufsize == NULL) { + talloc_free(mem_ctx); + return False; + } + + r.out.secdescsize = talloc_size(mem_ctx, sizeof(*r.out.secdescsize)); + if (r.out.secdescsize == NULL) { + talloc_free(mem_ctx); + return False; + } + + r.out.last_changed_time = talloc_size(mem_ctx, sizeof(*r.out.last_changed_time)); + if (r.out.last_changed_time == NULL) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_QueryInfoKey(p, r.in.handle, r.in.class_in, r.out.class_out, r.out.num_subkeys, r.out.max_subkeylen, r.out.max_subkeysize, r.out.num_values, r.out.max_valnamelen, r.out.max_valbufsize, r.out.secdescsize, r.out.last_changed_time); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_QueryInfoKey(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_QueryValue(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_QueryValue(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.type = r.in.type; + r.out.data = r.in.data; + r.out.size = r.in.size; + r.out.length = r.in.length; + r.out.result = _winreg_QueryValue(p, r.in.handle, r.in.value_name, r.in.type, r.in.data, r.in.size, r.in.length); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_QueryValue(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_ReplaceKey(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_ReplaceKey(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_ReplaceKey(p); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_ReplaceKey(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_RestoreKey(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_RestoreKey(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_RestoreKey(p); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_RestoreKey(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_SaveKey(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_SaveKey(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_SaveKey(p); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_SaveKey(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_SetKeySecurity(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_SetKeySecurity(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.sd = r.in.sd; + r.out.result = _winreg_SetKeySecurity(p, r.in.handle, r.in.access_mask, r.in.sd); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_SetKeySecurity(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_SetValue(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_SetValue(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_SetValue(p, r.in.handle, r.in.name, r.in.type, r.in.data, r.in.size); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_SetValue(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_UnLoadKey(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_UnLoadKey(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_UnLoadKey(p); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_UnLoadKey(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_InitiateSystemShutdown(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_InitiateSystemShutdown(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_InitiateSystemShutdown(p, r.in.hostname, r.in.message, r.in.timeout, r.in.force_apps, r.in.reboot); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_InitiateSystemShutdown(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_AbortSystemShutdown(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_AbortSystemShutdown(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_AbortSystemShutdown(p, r.in.server); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_AbortSystemShutdown(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_GetVersion(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_GetVersion(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.version = talloc_size(mem_ctx, sizeof(*r.out.version)); + if (r.out.version == NULL) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_GetVersion(p, r.in.handle, r.out.version); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_GetVersion(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_OpenHKCC(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_OpenHKCC(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.handle = talloc_size(mem_ctx, sizeof(*r.out.handle)); + if (r.out.handle == NULL) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_OpenHKCC(p, r.in.system_name, r.in.access_mask, r.out.handle); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_OpenHKCC(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_OpenHKDD(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_OpenHKDD(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.handle = talloc_size(mem_ctx, sizeof(*r.out.handle)); + if (r.out.handle == NULL) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_OpenHKDD(p, r.in.system_name, r.in.access_mask, r.out.handle); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_OpenHKDD(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_QueryMultipleValues(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_QueryMultipleValues(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + 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.in.key_handle, r.in.values, r.in.num_values, r.in.buffer, r.in.buffer_size); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_QueryMultipleValues(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_InitiateSystemShutdownEx(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_InitiateSystemShutdownEx(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_InitiateSystemShutdownEx(p, r.in.hostname, r.in.message, r.in.timeout, r.in.force_apps, r.in.reboot, r.in.reason); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_InitiateSystemShutdownEx(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_SaveKeyEx(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_SaveKeyEx(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_SaveKeyEx(p); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_SaveKeyEx(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_OpenHKPT(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_OpenHKPT(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.handle = talloc_size(mem_ctx, sizeof(*r.out.handle)); + if (r.out.handle == NULL) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_OpenHKPT(p, r.in.system_name, r.in.access_mask, r.out.handle); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_OpenHKPT(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_OpenHKPN(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_OpenHKPN(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.handle = talloc_size(mem_ctx, sizeof(*r.out.handle)); + if (r.out.handle == NULL) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_OpenHKPN(p, r.in.system_name, r.in.access_mask, r.out.handle); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_OpenHKPN(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + +static BOOL api_winreg_QueryMultipleValues2(pipes_struct *p) +{ + 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"); + + if (!prs_data_blob(&p->in_data.data, &blob, mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + pull = ndr_pull_init_blob(&blob, mem_ctx); + if (pull == NULL) + return False; + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + status = ndr_pull_winreg_QueryMultipleValues2(pull, NDR_IN, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + r.out.result = _winreg_QueryMultipleValues2(p); + + push = ndr_push_init_ctx(mem_ctx); + if (push == NULL) { + talloc_free(mem_ctx); + return False; + } + + status = ndr_push_winreg_QueryMultipleValues2(push, NDR_OUT, &r); + if (NT_STATUS_IS_ERR(status)) { + talloc_free(mem_ctx); + return False; + } + + blob = ndr_push_blob(push); + if (!prs_init_data_blob(&p->out_data.rdata, &blob, p->mem_ctx)) { + talloc_free(mem_ctx); + return False; + } + + talloc_free(mem_ctx); + + return True; +} + + +/* Tables */ +static struct api_struct api_winreg_cmds[] = +{ + {"WINREG_OPENHKCR", DCERPC_WINREG_OPENHKCR, api_winreg_OpenHKCR}, + {"WINREG_OPENHKCU", DCERPC_WINREG_OPENHKCU, api_winreg_OpenHKCU}, + {"WINREG_OPENHKLM", DCERPC_WINREG_OPENHKLM, api_winreg_OpenHKLM}, + {"WINREG_OPENHKPD", DCERPC_WINREG_OPENHKPD, api_winreg_OpenHKPD}, + {"WINREG_OPENHKU", DCERPC_WINREG_OPENHKU, api_winreg_OpenHKU}, + {"WINREG_CLOSEKEY", DCERPC_WINREG_CLOSEKEY, api_winreg_CloseKey}, + {"WINREG_CREATEKEY", DCERPC_WINREG_CREATEKEY, api_winreg_CreateKey}, + {"WINREG_DELETEKEY", DCERPC_WINREG_DELETEKEY, api_winreg_DeleteKey}, + {"WINREG_DELETEVALUE", DCERPC_WINREG_DELETEVALUE, api_winreg_DeleteValue}, + {"WINREG_ENUMKEY", DCERPC_WINREG_ENUMKEY, api_winreg_EnumKey}, + {"WINREG_ENUMVALUE", DCERPC_WINREG_ENUMVALUE, api_winreg_EnumValue}, + {"WINREG_FLUSHKEY", DCERPC_WINREG_FLUSHKEY, api_winreg_FlushKey}, + {"WINREG_GETKEYSECURITY", DCERPC_WINREG_GETKEYSECURITY, api_winreg_GetKeySecurity}, + {"WINREG_LOADKEY", DCERPC_WINREG_LOADKEY, api_winreg_LoadKey}, + {"WINREG_NOTIFYCHANGEKEYVALUE", DCERPC_WINREG_NOTIFYCHANGEKEYVALUE, api_winreg_NotifyChangeKeyValue}, + {"WINREG_OPENKEY", DCERPC_WINREG_OPENKEY, api_winreg_OpenKey}, + {"WINREG_QUERYINFOKEY", DCERPC_WINREG_QUERYINFOKEY, api_winreg_QueryInfoKey}, + {"WINREG_QUERYVALUE", DCERPC_WINREG_QUERYVALUE, api_winreg_QueryValue}, + {"WINREG_REPLACEKEY", DCERPC_WINREG_REPLACEKEY, api_winreg_ReplaceKey}, + {"WINREG_RESTOREKEY", DCERPC_WINREG_RESTOREKEY, api_winreg_RestoreKey}, + {"WINREG_SAVEKEY", DCERPC_WINREG_SAVEKEY, api_winreg_SaveKey}, + {"WINREG_SETKEYSECURITY", DCERPC_WINREG_SETKEYSECURITY, api_winreg_SetKeySecurity}, + {"WINREG_SETVALUE", DCERPC_WINREG_SETVALUE, api_winreg_SetValue}, + {"WINREG_UNLOADKEY", DCERPC_WINREG_UNLOADKEY, api_winreg_UnLoadKey}, + {"WINREG_INITIATESYSTEMSHUTDOWN", DCERPC_WINREG_INITIATESYSTEMSHUTDOWN, api_winreg_InitiateSystemShutdown}, + {"WINREG_ABORTSYSTEMSHUTDOWN", DCERPC_WINREG_ABORTSYSTEMSHUTDOWN, api_winreg_AbortSystemShutdown}, + {"WINREG_GETVERSION", DCERPC_WINREG_GETVERSION, api_winreg_GetVersion}, + {"WINREG_OPENHKCC", DCERPC_WINREG_OPENHKCC, api_winreg_OpenHKCC}, + {"WINREG_OPENHKDD", DCERPC_WINREG_OPENHKDD, api_winreg_OpenHKDD}, + {"WINREG_QUERYMULTIPLEVALUES", DCERPC_WINREG_QUERYMULTIPLEVALUES, api_winreg_QueryMultipleValues}, + {"WINREG_INITIATESYSTEMSHUTDOWNEX", DCERPC_WINREG_INITIATESYSTEMSHUTDOWNEX, api_winreg_InitiateSystemShutdownEx}, + {"WINREG_SAVEKEYEX", DCERPC_WINREG_SAVEKEYEX, api_winreg_SaveKeyEx}, + {"WINREG_OPENHKPT", DCERPC_WINREG_OPENHKPT, api_winreg_OpenHKPT}, + {"WINREG_OPENHKPN", DCERPC_WINREG_OPENHKPN, api_winreg_OpenHKPN}, + {"WINREG_QUERYMULTIPLEVALUES2", DCERPC_WINREG_QUERYMULTIPLEVALUES2, api_winreg_QueryMultipleValues2}, +}; + +void winreg_get_pipe_fns(struct api_struct **fns, int *n_fns) +{ + *fns = api_winreg_cmds; + *n_fns = sizeof(api_winreg_cmds) / sizeof(struct api_struct); +} + +NTSTATUS rpc_winreg_init(void) +{ + return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "winreg", "winreg", api_winreg_cmds, sizeof(api_winreg_cmds) / sizeof(struct api_struct)); +} diff --git a/source3/librpc/gen_ndr/srv_winreg.h b/source3/librpc/gen_ndr/srv_winreg.h new file mode 100644 index 0000000000..7fd3bfedd1 --- /dev/null +++ b/source3/librpc/gen_ndr/srv_winreg.h @@ -0,0 +1,41 @@ +#include "librpc/gen_ndr/ndr_winreg.h" +#ifndef __SRV_WINREG__ +#define __SRV_WINREG__ +WERROR _winreg_OpenHKCR(pipes_struct *p, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle); +WERROR _winreg_OpenHKCU(pipes_struct *p, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle); +WERROR _winreg_OpenHKLM(pipes_struct *p, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle); +WERROR _winreg_OpenHKPD(pipes_struct *p, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle); +WERROR _winreg_OpenHKU(pipes_struct *p, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle); +WERROR _winreg_CloseKey(pipes_struct *p, struct policy_handle *handle); +WERROR _winreg_CreateKey(pipes_struct *p, struct policy_handle *handle, struct winreg_String name, struct winreg_String keyclass, uint32_t options, uint32_t access_mask, struct winreg_SecBuf *secdesc, struct policy_handle *new_handle, enum winreg_CreateAction *action_taken); +WERROR _winreg_DeleteKey(pipes_struct *p, struct policy_handle *handle, struct winreg_String key); +WERROR _winreg_DeleteValue(pipes_struct *p, struct policy_handle *handle, struct winreg_String value); +WERROR _winreg_EnumKey(pipes_struct *p, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, struct winreg_StringBuf *keyclass, NTTIME *last_changed_time); +WERROR _winreg_EnumValue(pipes_struct *p, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, enum winreg_Type *type, uint8_t *value, uint32_t *size, uint32_t *length); +WERROR _winreg_FlushKey(pipes_struct *p, struct policy_handle *handle); +WERROR _winreg_GetKeySecurity(pipes_struct *p, struct policy_handle *handle, uint32_t sec_info, struct KeySecurityData *sd); +WERROR _winreg_LoadKey(pipes_struct *p, struct policy_handle *handle, struct winreg_String *keyname, struct winreg_String *filename); +WERROR _winreg_NotifyChangeKeyValue(pipes_struct *p, struct policy_handle *handle, uint8_t watch_subtree, uint32_t notify_filter, uint32_t unknown, struct winreg_String string1, struct winreg_String string2, uint32_t unknown2); +WERROR _winreg_OpenKey(pipes_struct *p, struct policy_handle *parent_handle, struct winreg_String keyname, uint32_t unknown, uint32_t access_mask, struct policy_handle *handle); +WERROR _winreg_QueryInfoKey(pipes_struct *p, struct policy_handle *handle, struct winreg_String class_in, struct winreg_String *class_out, uint32_t *num_subkeys, uint32_t *max_subkeylen, uint32_t *max_subkeysize, uint32_t *num_values, uint32_t *max_valnamelen, uint32_t *max_valbufsize, uint32_t *secdescsize, NTTIME *last_changed_time); +WERROR _winreg_QueryValue(pipes_struct *p, struct policy_handle *handle, struct winreg_String value_name, enum winreg_Type *type, uint8_t *data, uint32_t *size, uint32_t *length); +WERROR _winreg_ReplaceKey(pipes_struct *p); +WERROR _winreg_RestoreKey(pipes_struct *p); +WERROR _winreg_SaveKey(pipes_struct *p); +WERROR _winreg_SetKeySecurity(pipes_struct *p, struct policy_handle *handle, uint32_t access_mask, struct KeySecurityData *sd); +WERROR _winreg_SetValue(pipes_struct *p, struct policy_handle *handle, struct winreg_String name, enum winreg_Type type, uint8_t *data, uint32_t size); +WERROR _winreg_UnLoadKey(pipes_struct *p); +WERROR _winreg_InitiateSystemShutdown(pipes_struct *p, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot); +WERROR _winreg_AbortSystemShutdown(pipes_struct *p, uint16_t *server); +WERROR _winreg_GetVersion(pipes_struct *p, struct policy_handle *handle, uint32_t *version); +WERROR _winreg_OpenHKCC(pipes_struct *p, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle); +WERROR _winreg_OpenHKDD(pipes_struct *p, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle); +WERROR _winreg_QueryMultipleValues(pipes_struct *p, struct policy_handle *key_handle, struct QueryMultipleValue *values, uint32_t num_values, uint8_t *buffer, uint32_t *buffer_size); +WERROR _winreg_InitiateSystemShutdownEx(pipes_struct *p, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot, uint32_t reason); +WERROR _winreg_SaveKeyEx(pipes_struct *p); +WERROR _winreg_OpenHKPT(pipes_struct *p, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle); +WERROR _winreg_OpenHKPN(pipes_struct *p, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle); +WERROR _winreg_QueryMultipleValues2(pipes_struct *p); +void winreg_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_winreg_init(void); +#endif /* __SRV_WINREG__ */ diff --git a/source3/librpc/gen_ndr/winreg.h b/source3/librpc/gen_ndr/winreg.h new file mode 100644 index 0000000000..eadcc2fef4 --- /dev/null +++ b/source3/librpc/gen_ndr/winreg.h @@ -0,0 +1,564 @@ +/* header auto-generated by pidl */ + +#ifndef _HEADER_winreg +#define _HEADER_winreg + +#include "librpc/gen_ndr/lsa.h" +#include "librpc/gen_ndr/initshutdown.h" +#include "librpc/gen_ndr/security.h" +/* bitmap winreg_AccessMask */ + +enum winreg_Type { + REG_NONE=0, + REG_SZ=1, + REG_EXPAND_SZ=2, + REG_BINARY=3, + REG_DWORD=4, + REG_DWORD_BIG_ENDIAN=5, + REG_LINK=6, + REG_MULTI_SZ=7, + REG_RESOURCE_LIST=8, + REG_FULL_RESOURCE_DESCRIPTOR=9, + REG_RESOURCE_REQUIREMENTS_LIST=10, + REG_QWORD=11 +}; + +struct winreg_String { + uint16_t name_len;/* [keepref,value(strlen_m_term(name)*2)] */ + uint16_t name_size;/* [keepref,value(strlen_m_term(name)*2)] */ + const char *name;/* [unique,keepref,charset(UTF16)] */ +}/* [public,noejs] */; + +struct KeySecurityData { + uint8_t *data;/* [unique,keepref,length_is(len),size_is(size)] */ + uint32_t size;/* [keepref] */ + uint32_t len;/* [keepref] */ +}; + +struct winreg_SecBuf { + uint32_t length;/* [keepref] */ + struct KeySecurityData sd;/* [keepref] */ + uint8_t inherit;/* [keepref] */ +}; + +enum winreg_CreateAction { + REG_ACTION_NONE=0, + REG_CREATED_NEW_KEY=1, + REG_OPENED_EXISTING_KEY=2 +}; + +struct winreg_StringBuf { + uint16_t length;/* [keepref,value(strlen_m_term(name)*2)] */ + uint16_t size;/* [keepref] */ + const char *name;/* [unique,keepref,length_is(length/2),charset(UTF16),size_is(size/2)] */ +}; + +struct QueryMultipleValue { + struct winreg_String *name;/* [unique,keepref] */ + enum winreg_Type type;/* [keepref] */ + uint32_t offset;/* [keepref] */ + uint32_t length;/* [keepref] */ +}; + + +struct winreg_OpenHKCR { + struct { + uint16_t *system_name;/* [unique,keepref] */ + uint32_t access_mask;/* [keepref] */ + } in; + + struct { + struct policy_handle *handle;/* [keepref,ref] */ + WERROR result; + } out; + +}; + + +struct winreg_OpenHKCU { + struct { + uint16_t *system_name;/* [unique,keepref] */ + uint32_t access_mask;/* [keepref] */ + } in; + + struct { + struct policy_handle *handle;/* [keepref,ref] */ + WERROR result; + } out; + +}; + + +struct winreg_OpenHKLM { + struct { + uint16_t *system_name;/* [unique,keepref] */ + uint32_t access_mask;/* [keepref] */ + } in; + + struct { + struct policy_handle *handle;/* [keepref,ref] */ + WERROR result; + } out; + +}; + + +struct winreg_OpenHKPD { + struct { + uint16_t *system_name;/* [unique,keepref] */ + uint32_t access_mask;/* [keepref] */ + } in; + + struct { + struct policy_handle *handle;/* [keepref,ref] */ + WERROR result; + } out; + +}; + + +struct winreg_OpenHKU { + struct { + uint16_t *system_name;/* [unique,keepref] */ + uint32_t access_mask;/* [keepref] */ + } in; + + struct { + struct policy_handle *handle;/* [keepref,ref] */ + WERROR result; + } out; + +}; + + +struct winreg_CloseKey { + struct { + struct policy_handle *handle;/* [keepref,ref] */ + } in; + + struct { + struct policy_handle *handle;/* [keepref,ref] */ + WERROR result; + } out; + +}; + + +struct winreg_CreateKey { + struct { + struct policy_handle *handle;/* [keepref,ref] */ + struct winreg_String name;/* [keepref] */ + struct winreg_String keyclass;/* [keepref] */ + uint32_t options;/* [keepref] */ + uint32_t access_mask;/* [keepref] */ + struct winreg_SecBuf *secdesc;/* [unique,keepref] */ + enum winreg_CreateAction *action_taken;/* [unique,keepref] */ + } in; + + struct { + struct policy_handle *new_handle;/* [keepref,ref] */ + enum winreg_CreateAction *action_taken;/* [unique,keepref] */ + WERROR result; + } out; + +}; + + +struct winreg_DeleteKey { + struct { + struct policy_handle *handle;/* [keepref,ref] */ + struct winreg_String key;/* [keepref] */ + } in; + + struct { + WERROR result; + } out; + +}; + + +struct winreg_DeleteValue { + struct { + struct policy_handle *handle;/* [keepref,ref] */ + struct winreg_String value;/* [keepref] */ + } in; + + struct { + WERROR result; + } out; + +}; + + +struct winreg_EnumKey { + struct { + struct policy_handle *handle;/* [keepref,ref] */ + uint32_t enum_index;/* [keepref] */ + struct winreg_StringBuf *name;/* [keepref,ref] */ + struct winreg_StringBuf *keyclass;/* [unique,keepref] */ + NTTIME *last_changed_time;/* [unique,keepref] */ + } in; + + struct { + struct winreg_StringBuf *name;/* [keepref,ref] */ + struct winreg_StringBuf *keyclass;/* [unique,keepref] */ + NTTIME *last_changed_time;/* [unique,keepref] */ + WERROR result; + } out; + +}; + + +struct winreg_EnumValue { + struct { + struct policy_handle *handle;/* [keepref,ref] */ + uint32_t enum_index;/* [keepref] */ + struct winreg_StringBuf *name;/* [keepref,ref] */ + enum winreg_Type *type;/* [unique,keepref] */ + uint8_t *value;/* [unique,keepref,length_is(*length),size_is(*size)] */ + uint32_t *size;/* [unique,keepref] */ + uint32_t *length;/* [unique,keepref] */ + } in; + + struct { + struct winreg_StringBuf *name;/* [keepref,ref] */ + enum winreg_Type *type;/* [unique,keepref] */ + uint8_t *value;/* [unique,keepref,length_is(*length),size_is(*size)] */ + uint32_t *size;/* [unique,keepref] */ + uint32_t *length;/* [unique,keepref] */ + WERROR result; + } out; + +}; + + +struct winreg_FlushKey { + struct { + struct policy_handle *handle;/* [keepref,ref] */ + } in; + + struct { + WERROR result; + } out; + +}; + + +struct winreg_GetKeySecurity { + struct { + struct policy_handle *handle;/* [keepref,ref] */ + uint32_t sec_info;/* [keepref] */ + struct KeySecurityData *sd;/* [keepref,ref] */ + } in; + + struct { + struct KeySecurityData *sd;/* [keepref,ref] */ + WERROR result; + } out; + +}; + + +struct winreg_LoadKey { + struct { + struct policy_handle *handle;/* [keepref,ref] */ + struct winreg_String *keyname;/* [unique,keepref] */ + struct winreg_String *filename;/* [unique,keepref] */ + } in; + + struct { + WERROR result; + } out; + +}; + + +struct winreg_NotifyChangeKeyValue { + struct { + struct policy_handle *handle;/* [keepref,ref] */ + uint8_t watch_subtree;/* [keepref] */ + uint32_t notify_filter;/* [keepref] */ + uint32_t unknown;/* [keepref] */ + struct winreg_String string1;/* [keepref] */ + struct winreg_String string2;/* [keepref] */ + uint32_t unknown2;/* [keepref] */ + } in; + + struct { + WERROR result; + } out; + +}; + + +struct winreg_OpenKey { + struct { + struct policy_handle *parent_handle;/* [keepref,ref] */ + struct winreg_String keyname;/* [keepref] */ + uint32_t unknown;/* [keepref] */ + uint32_t access_mask;/* [keepref] */ + } in; + + struct { + struct policy_handle *handle;/* [keepref,ref] */ + WERROR result; + } out; + +}; + + +struct winreg_QueryInfoKey { + struct { + struct policy_handle *handle;/* [keepref,ref] */ + struct winreg_String class_in;/* [keepref] */ + } in; + + struct { + struct winreg_String *class_out;/* [unique,keepref] */ + uint32_t *num_subkeys;/* [unique,keepref] */ + uint32_t *max_subkeylen;/* [unique,keepref] */ + uint32_t *max_subkeysize;/* [unique,keepref] */ + uint32_t *num_values;/* [unique,keepref] */ + uint32_t *max_valnamelen;/* [unique,keepref] */ + uint32_t *max_valbufsize;/* [unique,keepref] */ + uint32_t *secdescsize;/* [unique,keepref] */ + NTTIME *last_changed_time;/* [unique,keepref] */ + WERROR result; + } out; + +}; + + +struct winreg_QueryValue { + struct { + struct policy_handle *handle;/* [keepref,ref] */ + struct winreg_String value_name;/* [keepref] */ + enum winreg_Type *type;/* [unique,keepref] */ + uint8_t *data;/* [unique,keepref,length_is(*length),size_is(*size)] */ + uint32_t *size;/* [unique,keepref] */ + uint32_t *length;/* [unique,keepref] */ + } in; + + struct { + enum winreg_Type *type;/* [unique,keepref] */ + uint8_t *data;/* [unique,keepref,length_is(*length),size_is(*size)] */ + uint32_t *size;/* [unique,keepref] */ + uint32_t *length;/* [unique,keepref] */ + WERROR result; + } out; + +}; + + +struct winreg_ReplaceKey { + struct { + WERROR result; + } out; + +}; + + +struct winreg_RestoreKey { + struct { + WERROR result; + } out; + +}; + + +struct winreg_SaveKey { + struct { + WERROR result; + } out; + +}; + + +struct winreg_SetKeySecurity { + struct { + struct policy_handle *handle;/* [keepref,ref] */ + uint32_t access_mask;/* [keepref] */ + struct KeySecurityData *sd;/* [keepref,ref] */ + } in; + + struct { + struct KeySecurityData *sd;/* [keepref,ref] */ + WERROR result; + } out; + +}; + + +struct winreg_SetValue { + struct { + struct policy_handle *handle;/* [keepref,ref] */ + struct winreg_String name;/* [keepref] */ + enum winreg_Type type;/* [keepref] */ + uint8_t *data;/* [keepref,ref,size_is(size)] */ + uint32_t size;/* [keepref] */ + } in; + + struct { + WERROR result; + } out; + +}; + + +struct winreg_UnLoadKey { + struct { + WERROR result; + } out; + +}; + + +struct winreg_InitiateSystemShutdown { + struct { + uint16_t *hostname;/* [unique,keepref] */ + struct initshutdown_String *message;/* [unique,keepref] */ + uint32_t timeout;/* [keepref] */ + uint8_t force_apps;/* [keepref] */ + uint8_t reboot;/* [keepref] */ + } in; + + struct { + WERROR result; + } out; + +}; + + +struct winreg_AbortSystemShutdown { + struct { + uint16_t *server;/* [unique,keepref] */ + } in; + + struct { + WERROR result; + } out; + +}; + + +struct winreg_GetVersion { + struct { + struct policy_handle *handle;/* [keepref,ref] */ + } in; + + struct { + uint32_t *version;/* [unique,keepref] */ + WERROR result; + } out; + +}; + + +struct winreg_OpenHKCC { + struct { + uint16_t *system_name;/* [unique,keepref] */ + uint32_t access_mask;/* [keepref] */ + } in; + + struct { + struct policy_handle *handle;/* [keepref,ref] */ + WERROR result; + } out; + +}; + + +struct winreg_OpenHKDD { + struct { + uint16_t *system_name;/* [unique,keepref] */ + uint32_t access_mask;/* [keepref] */ + } in; + + struct { + struct policy_handle *handle;/* [keepref,ref] */ + WERROR result; + } out; + +}; + + +struct winreg_QueryMultipleValues { + struct { + struct policy_handle *key_handle;/* [keepref,ref] */ + struct QueryMultipleValue *values;/* [keepref,ref,length_is(num_values),size_is(num_values)] */ + uint32_t num_values;/* [keepref] */ + uint8_t *buffer;/* [unique,keepref,length_is(*buffer_size),size_is(*buffer_size)] */ + uint32_t *buffer_size;/* [keepref,ref] */ + } in; + + struct { + struct QueryMultipleValue *values;/* [keepref,ref,length_is(num_values),size_is(num_values)] */ + uint8_t *buffer;/* [unique,keepref,length_is(*buffer_size),size_is(*buffer_size)] */ + uint32_t *buffer_size;/* [keepref,ref] */ + WERROR result; + } out; + +}; + + +struct winreg_InitiateSystemShutdownEx { + struct { + uint16_t *hostname;/* [unique,keepref] */ + struct initshutdown_String *message;/* [unique,keepref] */ + uint32_t timeout;/* [keepref] */ + uint8_t force_apps;/* [keepref] */ + uint8_t reboot;/* [keepref] */ + uint32_t reason;/* [keepref] */ + } in; + + struct { + WERROR result; + } out; + +}; + + +struct winreg_SaveKeyEx { + struct { + WERROR result; + } out; + +}; + + +struct winreg_OpenHKPT { + struct { + uint16_t *system_name;/* [unique,keepref] */ + uint32_t access_mask;/* [keepref] */ + } in; + + struct { + struct policy_handle *handle;/* [keepref,ref] */ + WERROR result; + } out; + +}; + + +struct winreg_OpenHKPN { + struct { + uint16_t *system_name;/* [unique,keepref] */ + uint32_t access_mask;/* [keepref] */ + } in; + + struct { + struct policy_handle *handle;/* [keepref,ref] */ + WERROR result; + } out; + +}; + + +struct winreg_QueryMultipleValues2 { + struct { + WERROR result; + } out; + +}; + +#endif /* _HEADER_winreg */ |