rpc_winreg.c
来自「samba最新软件」· C语言 代码 · 共 666 行 · 第 1/2 页
C
666 行
DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY); return WERR_NOT_SUPPORTED;}/* winreg_LoadKey*/static WERROR dcesrv_winreg_LoadKey(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_LoadKey *r){ return WERR_NOT_SUPPORTED;}/* winreg_NotifyChangeKeyValue*/static WERROR dcesrv_winreg_NotifyChangeKeyValue(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_NotifyChangeKeyValue *r){ return WERR_NOT_SUPPORTED;}/* winreg_OpenKey*/static WERROR dcesrv_winreg_OpenKey(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_OpenKey *r){ struct dcesrv_handle *h, *newh; WERROR result; DCESRV_PULL_HANDLE_FAULT(h, r->in.parent_handle, HTYPE_REGKEY); switch (security_session_user_level(dce_call->conn->auth_state.session_info)) { case SECURITY_SYSTEM: case SECURITY_ADMINISTRATOR: case SECURITY_USER: if (r->in.keyname.name && strcmp(r->in.keyname.name, "") == 0) { newh = talloc_reference(dce_call->context, h); result = WERR_OK; } else { newh = dcesrv_handle_new(dce_call->context, HTYPE_REGKEY); result = reg_open_key(newh, (struct registry_key *)h->data, r->in.keyname.name, (struct registry_key **)&newh->data); } if (W_ERROR_IS_OK(result)) { r->out.handle = &newh->wire_handle; } else { talloc_free(newh); } return result; default: return WERR_ACCESS_DENIED; }}/* winreg_QueryInfoKey*/static WERROR dcesrv_winreg_QueryInfoKey(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_QueryInfoKey *r){ struct dcesrv_handle *h; struct registry_key *k; WERROR ret; const char *classname = NULL; DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY); switch (security_session_user_level(dce_call->conn->auth_state.session_info)) { case SECURITY_SYSTEM: case SECURITY_ADMINISTRATOR: case SECURITY_USER: k = h->data; ret = reg_key_get_info(mem_ctx, k, &classname, r->out.num_subkeys, r->out.num_values, r->out.last_changed_time, r->out.max_subkeylen, r->out.max_valnamelen, r->out.max_valbufsize); if (r->out.classname != NULL) r->out.classname->name = classname; return ret; default: return WERR_ACCESS_DENIED; }}/* winreg_QueryValue*/static WERROR dcesrv_winreg_QueryValue(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_QueryValue *r){ struct dcesrv_handle *h; struct registry_key *key; uint32_t value_type; DATA_BLOB value_data; WERROR result; DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY); switch (security_session_user_level(dce_call->conn->auth_state.session_info)) { case SECURITY_SYSTEM: case SECURITY_ADMINISTRATOR: case SECURITY_USER: key = h->data; result = reg_key_get_value_by_name(mem_ctx, key, r->in.value_name.name, &value_type, &value_data); if (!W_ERROR_IS_OK(result)) { return result; } /* Just asking for the size of the buffer */ r->out.type = talloc(mem_ctx, uint32_t); if (!r->out.type) { return WERR_NOMEM; } *r->out.type = value_type; r->out.length = talloc(mem_ctx, uint32_t); if (!r->out.length) { return WERR_NOMEM; } *r->out.length = value_data.length; if (r->in.data == NULL) { r->out.size = talloc(mem_ctx, uint32_t); *r->out.size = value_data.length; } else { r->out.size = r->in.size; r->out.data = value_data.data; } return WERR_OK; default: return WERR_ACCESS_DENIED; }}/* winreg_ReplaceKey*/static WERROR dcesrv_winreg_ReplaceKey(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_ReplaceKey *r){ return WERR_NOT_SUPPORTED;}/* winreg_RestoreKey*/static WERROR dcesrv_winreg_RestoreKey(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_RestoreKey *r){ return WERR_NOT_SUPPORTED;}/* winreg_SaveKey*/static WERROR dcesrv_winreg_SaveKey(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_SaveKey *r){ return WERR_NOT_SUPPORTED;}/* winreg_SetKeySecurity*/static WERROR dcesrv_winreg_SetKeySecurity(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_SetKeySecurity *r){ return WERR_NOT_SUPPORTED;}/* winreg_SetValue*/static WERROR dcesrv_winreg_SetValue(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_SetValue *r){ struct dcesrv_handle *h; struct registry_key *key; WERROR result; DATA_BLOB data; DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY); key = h->data; switch (security_session_user_level(dce_call->conn->auth_state.session_info)) { case SECURITY_SYSTEM: case SECURITY_ADMINISTRATOR: data.data = r->in.data; data.length = r->in.size; result = reg_val_set(key, r->in.name.name, r->in.type, data); return result; default: return WERR_ACCESS_DENIED; }}/* winreg_UnLoadKey*/static WERROR dcesrv_winreg_UnLoadKey(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_UnLoadKey *r){ return WERR_NOT_SUPPORTED;}/* winreg_InitiateSystemShutdown*/static WERROR dcesrv_winreg_InitiateSystemShutdown(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_InitiateSystemShutdown *r){ return WERR_NOT_SUPPORTED;}/* winreg_AbortSystemShutdown*/static WERROR dcesrv_winreg_AbortSystemShutdown(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_AbortSystemShutdown *r){ return WERR_NOT_SUPPORTED;}/* winreg_GetVersion*/static WERROR dcesrv_winreg_GetVersion(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_GetVersion *r){ struct dcesrv_handle *h; DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY); r->out.version = talloc(mem_ctx, uint32_t); W_ERROR_HAVE_NO_MEMORY(r->out.version); *r->out.version = 5; return WERR_OK;}/* winreg_QueryMultipleValues*/static WERROR dcesrv_winreg_QueryMultipleValues(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_QueryMultipleValues *r){ return WERR_NOT_SUPPORTED;}/* winreg_InitiateSystemShutdownEx*/static WERROR dcesrv_winreg_InitiateSystemShutdownEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_InitiateSystemShutdownEx *r){ return WERR_NOT_SUPPORTED;}/* winreg_SaveKeyEx*/static WERROR dcesrv_winreg_SaveKeyEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_SaveKeyEx *r){ return WERR_NOT_SUPPORTED;}/* winreg_QueryMultipleValues2*/static WERROR dcesrv_winreg_QueryMultipleValues2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct winreg_QueryMultipleValues2 *r){ return WERR_NOT_SUPPORTED;}/* include the generated boilerplate */#include "librpc/gen_ndr/ndr_winreg_s.c"
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?