LCOV - code coverage report
Current view: top level - bin/default/librpc/gen_ndr - ndr_winreg_scompat.c (source / functions) Hit Total Coverage
Test: coverage report for master 2b515b7d Lines: 336 787 42.7 %
Date: 2024-02-28 12:06:22 Functions: 10 13 76.9 %

          Line data    Source code
       1             : /* s3 compat server functions auto-generated by pidl */
       2             : #include "bin/default/librpc/gen_ndr/ndr_winreg.h"
       3             : #include "bin/default/librpc/gen_ndr/ndr_winreg_scompat.h"
       4             : #include <librpc/rpc/dcesrv_core.h>
       5             : #include <rpc_server/rpc_config.h>
       6             : #include <rpc_server/rpc_server.h>
       7             : #include <util/debug.h>
       8             : 
       9             : enum s3compat_rpc_dispatch {
      10             :         S3COMPAT_RPC_DISPATCH_EXTERNAL = 0x00000001,
      11             :         S3COMPAT_RPC_DISPATCH_INTERNAL = 0x00000002,
      12             : };
      13             : 
      14             : /* winreg - dcerpc server boilerplate generated by pidl */
      15       31264 : static NTSTATUS winreg__op_bind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
      16             : {
      17             : #ifdef DCESRV_INTERFACE_WINREG_BIND
      18             :         return DCESRV_INTERFACE_WINREG_BIND(context,iface);
      19             : #else
      20       31264 :         return NT_STATUS_OK;
      21             : #endif
      22             : }
      23             : 
      24       31264 : static void winreg__op_unbind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
      25             : {
      26             : #ifdef DCESRV_INTERFACE_WINREG_UNBIND
      27             :         DCESRV_INTERFACE_WINREG_UNBIND(context, iface);
      28             : #else
      29       31264 :         return;
      30             : #endif
      31             : }
      32             : 
      33      530218 : NTSTATUS winreg__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_pull *pull, void **r)
      34             : {
      35           0 :         enum ndr_err_code ndr_err;
      36      530218 :         uint16_t opnum = dce_call->pkt.u.request.opnum;
      37             : 
      38      530218 :         dce_call->fault_code = 0;
      39             : 
      40      530218 :         if (opnum >= ndr_table_winreg.num_calls) {
      41           0 :                 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
      42           0 :                 return NT_STATUS_NET_WRITE_FAULT;
      43             :         }
      44             : 
      45      530218 :         *r = talloc_named(mem_ctx, ndr_table_winreg.calls[opnum].struct_size, "struct %s", ndr_table_winreg.calls[opnum].name);
      46      530218 :         NT_STATUS_HAVE_NO_MEMORY(*r);
      47             : 
      48             :         /* unravel the NDR for the packet */
      49      530218 :         ndr_err = ndr_table_winreg.calls[opnum].ndr_pull(pull, NDR_IN, *r);
      50      530218 :         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
      51           0 :                 dce_call->fault_code = DCERPC_FAULT_NDR;
      52           0 :                 return NT_STATUS_NET_WRITE_FAULT;
      53             :         }
      54             : 
      55      530218 :         return NT_STATUS_OK;
      56             : }
      57             : 
      58      530218 : static NTSTATUS winreg__op_dispatch_internal(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r, enum s3compat_rpc_dispatch dispatch)
      59             : {
      60      530218 :         uint16_t opnum = dce_call->pkt.u.request.opnum;
      61      530218 :         struct pipes_struct *p = NULL;
      62      530218 :         NTSTATUS status = NT_STATUS_OK;
      63      530218 :         bool impersonated = false;
      64             : 
      65             :         /* Retrieve pipes struct */
      66      530218 :         p = dcesrv_get_pipes_struct(dce_call->conn);
      67      530218 :         p->dce_call = dce_call;
      68      530218 :         p->mem_ctx = mem_ctx;
      69             :         /* Reset pipes struct fault state */
      70      530218 :         p->fault_state = 0;
      71             : 
      72             :         /* Impersonate */
      73      530218 :         if (dispatch == S3COMPAT_RPC_DISPATCH_EXTERNAL) {
      74      530218 :                 impersonated = become_authenticated_pipe_user(dce_call->auth_state->session_info);
      75      530218 :                 if (!impersonated) {
      76           0 :                         dce_call->fault_code = DCERPC_FAULT_ACCESS_DENIED;
      77           0 :                         status = NT_STATUS_NET_WRITE_FAULT;
      78           0 :                         goto fail;
      79             :                 }
      80             :         }
      81             : 
      82      530218 :         switch (opnum) {
      83           7 :         case 0: { /* winreg_OpenHKCR */
      84           7 :                 struct winreg_OpenHKCR *r2 = (struct winreg_OpenHKCR *)r;
      85           7 :                 if (DEBUGLEVEL >= 10) {
      86           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_OpenHKCR, NDR_IN, r2);
      87             :                 }
      88           7 :                 NDR_ZERO_STRUCT(r2->out);
      89           7 :                 r2->out.handle = talloc_zero(r2, struct policy_handle);
      90           7 :                 if (r2->out.handle == NULL) {
      91           0 :                         status = NT_STATUS_NO_MEMORY;
      92           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
      93           0 :                         goto fail;
      94             :                 }
      95             : 
      96           7 :                 r2->out.result = _winreg_OpenHKCR(p, r2);
      97           7 :                 break;
      98             :         }
      99           7 :         case 1: { /* winreg_OpenHKCU */
     100           7 :                 struct winreg_OpenHKCU *r2 = (struct winreg_OpenHKCU *)r;
     101           7 :                 if (DEBUGLEVEL >= 10) {
     102           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_OpenHKCU, NDR_IN, r2);
     103             :                 }
     104           7 :                 NDR_ZERO_STRUCT(r2->out);
     105           7 :                 r2->out.handle = talloc_zero(r2, struct policy_handle);
     106           7 :                 if (r2->out.handle == NULL) {
     107           0 :                         status = NT_STATUS_NO_MEMORY;
     108           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     109           0 :                         goto fail;
     110             :                 }
     111             : 
     112           7 :                 r2->out.result = _winreg_OpenHKCU(p, r2);
     113           7 :                 break;
     114             :         }
     115       44526 :         case 2: { /* winreg_OpenHKLM */
     116       44526 :                 struct winreg_OpenHKLM *r2 = (struct winreg_OpenHKLM *)r;
     117       44526 :                 if (DEBUGLEVEL >= 10) {
     118           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_OpenHKLM, NDR_IN, r2);
     119             :                 }
     120       44526 :                 NDR_ZERO_STRUCT(r2->out);
     121       44526 :                 r2->out.handle = talloc_zero(r2, struct policy_handle);
     122       44526 :                 if (r2->out.handle == NULL) {
     123           0 :                         status = NT_STATUS_NO_MEMORY;
     124           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     125           0 :                         goto fail;
     126             :                 }
     127             : 
     128       44526 :                 r2->out.result = _winreg_OpenHKLM(p, r2);
     129       44526 :                 break;
     130             :         }
     131           0 :         case 3: { /* winreg_OpenHKPD */
     132           0 :                 struct winreg_OpenHKPD *r2 = (struct winreg_OpenHKPD *)r;
     133           0 :                 if (DEBUGLEVEL >= 10) {
     134           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_OpenHKPD, NDR_IN, r2);
     135             :                 }
     136           0 :                 NDR_ZERO_STRUCT(r2->out);
     137           0 :                 r2->out.handle = talloc_zero(r2, struct policy_handle);
     138           0 :                 if (r2->out.handle == NULL) {
     139           0 :                         status = NT_STATUS_NO_MEMORY;
     140           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     141           0 :                         goto fail;
     142             :                 }
     143             : 
     144           0 :                 r2->out.result = _winreg_OpenHKPD(p, r2);
     145           0 :                 break;
     146             :         }
     147           7 :         case 4: { /* winreg_OpenHKU */
     148           7 :                 struct winreg_OpenHKU *r2 = (struct winreg_OpenHKU *)r;
     149           7 :                 if (DEBUGLEVEL >= 10) {
     150           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_OpenHKU, NDR_IN, r2);
     151             :                 }
     152           7 :                 NDR_ZERO_STRUCT(r2->out);
     153           7 :                 r2->out.handle = talloc_zero(r2, struct policy_handle);
     154           7 :                 if (r2->out.handle == NULL) {
     155           0 :                         status = NT_STATUS_NO_MEMORY;
     156           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     157           0 :                         goto fail;
     158             :                 }
     159             : 
     160           7 :                 r2->out.result = _winreg_OpenHKU(p, r2);
     161           7 :                 break;
     162             :         }
     163       90530 :         case 5: { /* winreg_CloseKey */
     164       90530 :                 struct winreg_CloseKey *r2 = (struct winreg_CloseKey *)r;
     165       90530 :                 if (DEBUGLEVEL >= 10) {
     166           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_CloseKey, NDR_IN, r2);
     167             :                 }
     168       90530 :                 NDR_ZERO_STRUCT(r2->out);
     169       90530 :                 r2->out.handle = r2->in.handle;
     170       90530 :                 r2->out.result = _winreg_CloseKey(p, r2);
     171       90530 :                 break;
     172             :         }
     173        6354 :         case 6: { /* winreg_CreateKey */
     174        6354 :                 struct winreg_CreateKey *r2 = (struct winreg_CreateKey *)r;
     175        6354 :                 if (DEBUGLEVEL >= 10) {
     176           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_CreateKey, NDR_IN, r2);
     177             :                 }
     178        6354 :                 NDR_ZERO_STRUCT(r2->out);
     179        6354 :                 r2->out.action_taken = r2->in.action_taken;
     180        6354 :                 r2->out.new_handle = talloc_zero(r2, struct policy_handle);
     181        6354 :                 if (r2->out.new_handle == NULL) {
     182           0 :                         status = NT_STATUS_NO_MEMORY;
     183           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     184           0 :                         goto fail;
     185             :                 }
     186             : 
     187        6354 :                 r2->out.result = _winreg_CreateKey(p, r2);
     188        6354 :                 break;
     189             :         }
     190        1194 :         case 7: { /* winreg_DeleteKey */
     191        1194 :                 struct winreg_DeleteKey *r2 = (struct winreg_DeleteKey *)r;
     192        1194 :                 if (DEBUGLEVEL >= 10) {
     193           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_DeleteKey, NDR_IN, r2);
     194             :                 }
     195        1194 :                 r2->out.result = _winreg_DeleteKey(p, r2);
     196        1194 :                 break;
     197             :         }
     198        3160 :         case 8: { /* winreg_DeleteValue */
     199        3160 :                 struct winreg_DeleteValue *r2 = (struct winreg_DeleteValue *)r;
     200        3160 :                 if (DEBUGLEVEL >= 10) {
     201           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_DeleteValue, NDR_IN, r2);
     202             :                 }
     203        3160 :                 r2->out.result = _winreg_DeleteValue(p, r2);
     204        3160 :                 break;
     205             :         }
     206       66308 :         case 9: { /* winreg_EnumKey */
     207       66308 :                 struct winreg_EnumKey *r2 = (struct winreg_EnumKey *)r;
     208       66308 :                 if (DEBUGLEVEL >= 10) {
     209           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_EnumKey, NDR_IN, r2);
     210             :                 }
     211       66308 :                 NDR_ZERO_STRUCT(r2->out);
     212       66308 :                 r2->out.name = r2->in.name;
     213       66308 :                 r2->out.keyclass = r2->in.keyclass;
     214       66308 :                 r2->out.last_changed_time = r2->in.last_changed_time;
     215       66308 :                 r2->out.result = _winreg_EnumKey(p, r2);
     216       66308 :                 break;
     217             :         }
     218      191801 :         case 10: { /* winreg_EnumValue */
     219      191801 :                 struct winreg_EnumValue *r2 = (struct winreg_EnumValue *)r;
     220      191801 :                 if (DEBUGLEVEL >= 10) {
     221           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_EnumValue, NDR_IN, r2);
     222             :                 }
     223      191801 :                 NDR_ZERO_STRUCT(r2->out);
     224      191801 :                 r2->out.name = r2->in.name;
     225      191801 :                 r2->out.type = r2->in.type;
     226      191801 :                 r2->out.value = r2->in.value;
     227      191801 :                 r2->out.size = r2->in.size;
     228      191801 :                 r2->out.length = r2->in.length;
     229      191801 :                 r2->out.result = _winreg_EnumValue(p, r2);
     230      191801 :                 break;
     231             :         }
     232          56 :         case 11: { /* winreg_FlushKey */
     233          56 :                 struct winreg_FlushKey *r2 = (struct winreg_FlushKey *)r;
     234          56 :                 if (DEBUGLEVEL >= 10) {
     235           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_FlushKey, NDR_IN, r2);
     236             :                 }
     237          56 :                 r2->out.result = _winreg_FlushKey(p, r2);
     238          56 :                 break;
     239             :         }
     240           0 :         case 12: { /* winreg_GetKeySecurity */
     241           0 :                 struct winreg_GetKeySecurity *r2 = (struct winreg_GetKeySecurity *)r;
     242           0 :                 if (DEBUGLEVEL >= 10) {
     243           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_GetKeySecurity, NDR_IN, r2);
     244             :                 }
     245           0 :                 NDR_ZERO_STRUCT(r2->out);
     246           0 :                 r2->out.sd = r2->in.sd;
     247           0 :                 r2->out.result = _winreg_GetKeySecurity(p, r2);
     248           0 :                 break;
     249             :         }
     250           0 :         case 13: { /* winreg_LoadKey */
     251           0 :                 struct winreg_LoadKey *r2 = (struct winreg_LoadKey *)r;
     252           0 :                 if (DEBUGLEVEL >= 10) {
     253           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_LoadKey, NDR_IN, r2);
     254             :                 }
     255           0 :                 r2->out.result = _winreg_LoadKey(p, r2);
     256           0 :                 break;
     257             :         }
     258          28 :         case 14: { /* winreg_NotifyChangeKeyValue */
     259          28 :                 struct winreg_NotifyChangeKeyValue *r2 = (struct winreg_NotifyChangeKeyValue *)r;
     260          28 :                 if (DEBUGLEVEL >= 10) {
     261           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_NotifyChangeKeyValue, NDR_IN, r2);
     262             :                 }
     263          28 :                 r2->out.result = _winreg_NotifyChangeKeyValue(p, r2);
     264          28 :                 break;
     265             :         }
     266       42396 :         case 15: { /* winreg_OpenKey */
     267       42396 :                 struct winreg_OpenKey *r2 = (struct winreg_OpenKey *)r;
     268       42396 :                 if (DEBUGLEVEL >= 10) {
     269           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_OpenKey, NDR_IN, r2);
     270             :                 }
     271       42396 :                 NDR_ZERO_STRUCT(r2->out);
     272       42396 :                 r2->out.handle = talloc_zero(r2, struct policy_handle);
     273       42396 :                 if (r2->out.handle == NULL) {
     274           0 :                         status = NT_STATUS_NO_MEMORY;
     275           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     276           0 :                         goto fail;
     277             :                 }
     278             : 
     279       42396 :                 r2->out.result = _winreg_OpenKey(p, r2);
     280       42396 :                 break;
     281             :         }
     282       20376 :         case 16: { /* winreg_QueryInfoKey */
     283       20376 :                 struct winreg_QueryInfoKey *r2 = (struct winreg_QueryInfoKey *)r;
     284       20376 :                 if (DEBUGLEVEL >= 10) {
     285           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_QueryInfoKey, NDR_IN, r2);
     286             :                 }
     287       20376 :                 NDR_ZERO_STRUCT(r2->out);
     288       20376 :                 r2->out.classname = r2->in.classname;
     289       20376 :                 r2->out.num_subkeys = talloc_zero(r2, uint32_t);
     290       20376 :                 if (r2->out.num_subkeys == NULL) {
     291           0 :                         status = NT_STATUS_NO_MEMORY;
     292           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     293           0 :                         goto fail;
     294             :                 }
     295             : 
     296       20376 :                 r2->out.max_subkeylen = talloc_zero(r2, uint32_t);
     297       20376 :                 if (r2->out.max_subkeylen == NULL) {
     298           0 :                         status = NT_STATUS_NO_MEMORY;
     299           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     300           0 :                         goto fail;
     301             :                 }
     302             : 
     303       20376 :                 r2->out.max_classlen = talloc_zero(r2, uint32_t);
     304       20376 :                 if (r2->out.max_classlen == NULL) {
     305           0 :                         status = NT_STATUS_NO_MEMORY;
     306           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     307           0 :                         goto fail;
     308             :                 }
     309             : 
     310       20376 :                 r2->out.num_values = talloc_zero(r2, uint32_t);
     311       20376 :                 if (r2->out.num_values == NULL) {
     312           0 :                         status = NT_STATUS_NO_MEMORY;
     313           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     314           0 :                         goto fail;
     315             :                 }
     316             : 
     317       20376 :                 r2->out.max_valnamelen = talloc_zero(r2, uint32_t);
     318       20376 :                 if (r2->out.max_valnamelen == NULL) {
     319           0 :                         status = NT_STATUS_NO_MEMORY;
     320           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     321           0 :                         goto fail;
     322             :                 }
     323             : 
     324       20376 :                 r2->out.max_valbufsize = talloc_zero(r2, uint32_t);
     325       20376 :                 if (r2->out.max_valbufsize == NULL) {
     326           0 :                         status = NT_STATUS_NO_MEMORY;
     327           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     328           0 :                         goto fail;
     329             :                 }
     330             : 
     331       20376 :                 r2->out.secdescsize = talloc_zero(r2, uint32_t);
     332       20376 :                 if (r2->out.secdescsize == NULL) {
     333           0 :                         status = NT_STATUS_NO_MEMORY;
     334           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     335           0 :                         goto fail;
     336             :                 }
     337             : 
     338       20376 :                 r2->out.last_changed_time = talloc_zero(r2, NTTIME);
     339       20376 :                 if (r2->out.last_changed_time == NULL) {
     340           0 :                         status = NT_STATUS_NO_MEMORY;
     341           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     342           0 :                         goto fail;
     343             :                 }
     344             : 
     345       20376 :                 r2->out.result = _winreg_QueryInfoKey(p, r2);
     346       20376 :                 break;
     347             :         }
     348       46510 :         case 17: { /* winreg_QueryValue */
     349       46510 :                 struct winreg_QueryValue *r2 = (struct winreg_QueryValue *)r;
     350       46510 :                 if (DEBUGLEVEL >= 10) {
     351           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_QueryValue, NDR_IN, r2);
     352             :                 }
     353       46510 :                 NDR_ZERO_STRUCT(r2->out);
     354       46510 :                 r2->out.type = r2->in.type;
     355       46510 :                 r2->out.data = r2->in.data;
     356       46510 :                 r2->out.data_size = r2->in.data_size;
     357       46510 :                 r2->out.data_length = r2->in.data_length;
     358       46510 :                 r2->out.result = _winreg_QueryValue(p, r2);
     359       46510 :                 break;
     360             :         }
     361           0 :         case 18: { /* winreg_ReplaceKey */
     362           0 :                 struct winreg_ReplaceKey *r2 = (struct winreg_ReplaceKey *)r;
     363           0 :                 if (DEBUGLEVEL >= 10) {
     364           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_ReplaceKey, NDR_IN, r2);
     365             :                 }
     366           0 :                 r2->out.result = _winreg_ReplaceKey(p, r2);
     367           0 :                 break;
     368             :         }
     369           0 :         case 19: { /* winreg_RestoreKey */
     370           0 :                 struct winreg_RestoreKey *r2 = (struct winreg_RestoreKey *)r;
     371           0 :                 if (DEBUGLEVEL >= 10) {
     372           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_RestoreKey, NDR_IN, r2);
     373             :                 }
     374           0 :                 r2->out.result = _winreg_RestoreKey(p, r2);
     375           0 :                 break;
     376             :         }
     377           0 :         case 20: { /* winreg_SaveKey */
     378           0 :                 struct winreg_SaveKey *r2 = (struct winreg_SaveKey *)r;
     379           0 :                 if (DEBUGLEVEL >= 10) {
     380           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_SaveKey, NDR_IN, r2);
     381             :                 }
     382           0 :                 r2->out.result = _winreg_SaveKey(p, r2);
     383           0 :                 break;
     384             :         }
     385           0 :         case 21: { /* winreg_SetKeySecurity */
     386           0 :                 struct winreg_SetKeySecurity *r2 = (struct winreg_SetKeySecurity *)r;
     387           0 :                 if (DEBUGLEVEL >= 10) {
     388           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_SetKeySecurity, NDR_IN, r2);
     389             :                 }
     390           0 :                 r2->out.result = _winreg_SetKeySecurity(p, r2);
     391           0 :                 break;
     392             :         }
     393       16754 :         case 22: { /* winreg_SetValue */
     394       16754 :                 struct winreg_SetValue *r2 = (struct winreg_SetValue *)r;
     395       16754 :                 if (DEBUGLEVEL >= 10) {
     396           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_SetValue, NDR_IN, r2);
     397             :                 }
     398       16754 :                 r2->out.result = _winreg_SetValue(p, r2);
     399       16754 :                 break;
     400             :         }
     401           0 :         case 23: { /* winreg_UnLoadKey */
     402           0 :                 struct winreg_UnLoadKey *r2 = (struct winreg_UnLoadKey *)r;
     403           0 :                 if (DEBUGLEVEL >= 10) {
     404           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_UnLoadKey, NDR_IN, r2);
     405             :                 }
     406           0 :                 r2->out.result = _winreg_UnLoadKey(p, r2);
     407           0 :                 break;
     408             :         }
     409           0 :         case 24: { /* winreg_InitiateSystemShutdown */
     410           0 :                 struct winreg_InitiateSystemShutdown *r2 = (struct winreg_InitiateSystemShutdown *)r;
     411           0 :                 if (DEBUGLEVEL >= 10) {
     412           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_InitiateSystemShutdown, NDR_IN, r2);
     413             :                 }
     414           0 :                 r2->out.result = _winreg_InitiateSystemShutdown(p, r2);
     415           0 :                 break;
     416             :         }
     417           0 :         case 25: { /* winreg_AbortSystemShutdown */
     418           0 :                 struct winreg_AbortSystemShutdown *r2 = (struct winreg_AbortSystemShutdown *)r;
     419           0 :                 if (DEBUGLEVEL >= 10) {
     420           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_AbortSystemShutdown, NDR_IN, r2);
     421             :                 }
     422           0 :                 r2->out.result = _winreg_AbortSystemShutdown(p, r2);
     423           0 :                 break;
     424             :         }
     425          28 :         case 26: { /* winreg_GetVersion */
     426          28 :                 struct winreg_GetVersion *r2 = (struct winreg_GetVersion *)r;
     427          28 :                 if (DEBUGLEVEL >= 10) {
     428           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_GetVersion, NDR_IN, r2);
     429             :                 }
     430          28 :                 NDR_ZERO_STRUCT(r2->out);
     431          28 :                 r2->out.version = talloc_zero(r2, uint32_t);
     432          28 :                 if (r2->out.version == NULL) {
     433           0 :                         status = NT_STATUS_NO_MEMORY;
     434           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     435           0 :                         goto fail;
     436             :                 }
     437             : 
     438          28 :                 r2->out.result = _winreg_GetVersion(p, r2);
     439          28 :                 break;
     440             :         }
     441           0 :         case 27: { /* winreg_OpenHKCC */
     442           0 :                 struct winreg_OpenHKCC *r2 = (struct winreg_OpenHKCC *)r;
     443           0 :                 if (DEBUGLEVEL >= 10) {
     444           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_OpenHKCC, NDR_IN, r2);
     445             :                 }
     446           0 :                 NDR_ZERO_STRUCT(r2->out);
     447           0 :                 r2->out.handle = talloc_zero(r2, struct policy_handle);
     448           0 :                 if (r2->out.handle == NULL) {
     449           0 :                         status = NT_STATUS_NO_MEMORY;
     450           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     451           0 :                         goto fail;
     452             :                 }
     453             : 
     454           0 :                 r2->out.result = _winreg_OpenHKCC(p, r2);
     455           0 :                 break;
     456             :         }
     457           0 :         case 28: { /* winreg_OpenHKDD */
     458           0 :                 struct winreg_OpenHKDD *r2 = (struct winreg_OpenHKDD *)r;
     459           0 :                 if (DEBUGLEVEL >= 10) {
     460           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_OpenHKDD, NDR_IN, r2);
     461             :                 }
     462           0 :                 NDR_ZERO_STRUCT(r2->out);
     463           0 :                 r2->out.handle = talloc_zero(r2, struct policy_handle);
     464           0 :                 if (r2->out.handle == NULL) {
     465           0 :                         status = NT_STATUS_NO_MEMORY;
     466           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     467           0 :                         goto fail;
     468             :                 }
     469             : 
     470           0 :                 r2->out.result = _winreg_OpenHKDD(p, r2);
     471           0 :                 break;
     472             :         }
     473          88 :         case 29: { /* winreg_QueryMultipleValues */
     474          88 :                 struct winreg_QueryMultipleValues *r2 = (struct winreg_QueryMultipleValues *)r;
     475          88 :                 if (DEBUGLEVEL >= 10) {
     476           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_QueryMultipleValues, NDR_IN, r2);
     477             :                 }
     478          88 :                 NDR_ZERO_STRUCT(r2->out);
     479          88 :                 r2->out.buffer = r2->in.buffer;
     480          88 :                 r2->out.buffer_size = r2->in.buffer_size;
     481          88 :                 r2->out.values_out = talloc_zero_array(r2, struct QueryMultipleValue, r2->in.num_values);
     482          88 :                 if (r2->out.values_out == NULL) {
     483           0 :                         status = NT_STATUS_NO_MEMORY;
     484           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     485           0 :                         goto fail;
     486             :                 }
     487             : 
     488          88 :                 r2->out.result = _winreg_QueryMultipleValues(p, r2);
     489          88 :                 break;
     490             :         }
     491           0 :         case 30: { /* winreg_InitiateSystemShutdownEx */
     492           0 :                 struct winreg_InitiateSystemShutdownEx *r2 = (struct winreg_InitiateSystemShutdownEx *)r;
     493           0 :                 if (DEBUGLEVEL >= 10) {
     494           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_InitiateSystemShutdownEx, NDR_IN, r2);
     495             :                 }
     496           0 :                 r2->out.result = _winreg_InitiateSystemShutdownEx(p, r2);
     497           0 :                 break;
     498             :         }
     499           0 :         case 31: { /* winreg_SaveKeyEx */
     500           0 :                 struct winreg_SaveKeyEx *r2 = (struct winreg_SaveKeyEx *)r;
     501           0 :                 if (DEBUGLEVEL >= 10) {
     502           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_SaveKeyEx, NDR_IN, r2);
     503             :                 }
     504           0 :                 r2->out.result = _winreg_SaveKeyEx(p, r2);
     505           0 :                 break;
     506             :         }
     507           0 :         case 32: { /* winreg_OpenHKPT */
     508           0 :                 struct winreg_OpenHKPT *r2 = (struct winreg_OpenHKPT *)r;
     509           0 :                 if (DEBUGLEVEL >= 10) {
     510           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_OpenHKPT, NDR_IN, r2);
     511             :                 }
     512           0 :                 NDR_ZERO_STRUCT(r2->out);
     513           0 :                 r2->out.handle = talloc_zero(r2, struct policy_handle);
     514           0 :                 if (r2->out.handle == NULL) {
     515           0 :                         status = NT_STATUS_NO_MEMORY;
     516           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     517           0 :                         goto fail;
     518             :                 }
     519             : 
     520           0 :                 r2->out.result = _winreg_OpenHKPT(p, r2);
     521           0 :                 break;
     522             :         }
     523           0 :         case 33: { /* winreg_OpenHKPN */
     524           0 :                 struct winreg_OpenHKPN *r2 = (struct winreg_OpenHKPN *)r;
     525           0 :                 if (DEBUGLEVEL >= 10) {
     526           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_OpenHKPN, NDR_IN, r2);
     527             :                 }
     528           0 :                 NDR_ZERO_STRUCT(r2->out);
     529           0 :                 r2->out.handle = talloc_zero(r2, struct policy_handle);
     530           0 :                 if (r2->out.handle == NULL) {
     531           0 :                         status = NT_STATUS_NO_MEMORY;
     532           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     533           0 :                         goto fail;
     534             :                 }
     535             : 
     536           0 :                 r2->out.result = _winreg_OpenHKPN(p, r2);
     537           0 :                 break;
     538             :         }
     539          88 :         case 34: { /* winreg_QueryMultipleValues2 */
     540          88 :                 struct winreg_QueryMultipleValues2 *r2 = (struct winreg_QueryMultipleValues2 *)r;
     541          88 :                 if (DEBUGLEVEL >= 10) {
     542           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_QueryMultipleValues2, NDR_IN, r2);
     543             :                 }
     544          88 :                 NDR_ZERO_STRUCT(r2->out);
     545          88 :                 r2->out.buffer = r2->in.buffer;
     546          88 :                 r2->out.values_out = talloc_zero_array(r2, struct QueryMultipleValue, r2->in.num_values);
     547          88 :                 if (r2->out.values_out == NULL) {
     548           0 :                         status = NT_STATUS_NO_MEMORY;
     549           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     550           0 :                         goto fail;
     551             :                 }
     552             : 
     553          88 :                 r2->out.needed = talloc_zero(r2, uint32_t);
     554          88 :                 if (r2->out.needed == NULL) {
     555           0 :                         status = NT_STATUS_NO_MEMORY;
     556           0 :                         p->fault_state = DCERPC_FAULT_CANT_PERFORM;
     557           0 :                         goto fail;
     558             :                 }
     559             : 
     560          88 :                 r2->out.result = _winreg_QueryMultipleValues2(p, r2);
     561          88 :                 break;
     562             :         }
     563           0 :         case 35: { /* winreg_DeleteKeyEx */
     564           0 :                 struct winreg_DeleteKeyEx *r2 = (struct winreg_DeleteKeyEx *)r;
     565           0 :                 if (DEBUGLEVEL >= 10) {
     566           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_DeleteKeyEx, NDR_IN, r2);
     567             :                 }
     568           0 :                 r2->out.result = _winreg_DeleteKeyEx(p, r2);
     569           0 :                 break;
     570             :         }
     571           0 :         default:
     572           0 :                 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
     573           0 :                 break;
     574             :         }
     575             : 
     576      530218 : fail:
     577             :         /* Unimpersonate */
     578      530218 :         if (impersonated) {
     579      530218 :                 unbecome_authenticated_pipe_user();
     580             :         }
     581             : 
     582      530218 :         p->dce_call = NULL;
     583      530218 :         p->mem_ctx = NULL;
     584             :         /* Check pipes struct fault state */
     585      530218 :         if (p->fault_state != 0) {
     586          46 :                 dce_call->fault_code = p->fault_state;
     587             :         }
     588      530218 :         if (dce_call->fault_code != 0) {
     589          46 :                 status = NT_STATUS_NET_WRITE_FAULT;
     590             :         }
     591             : 
     592      530218 :         return status;
     593             : }
     594             : 
     595      530218 : NTSTATUS winreg__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
     596             : {
     597      530218 :         return winreg__op_dispatch_internal(dce_call, mem_ctx, r, S3COMPAT_RPC_DISPATCH_EXTERNAL);
     598             : }
     599             : 
     600      530172 : NTSTATUS winreg__op_reply(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
     601             : {
     602      530172 :         uint16_t opnum = dce_call->pkt.u.request.opnum;
     603             : 
     604      530172 :         switch (opnum) {
     605           7 :         case 0: { /* winreg_OpenHKCR */
     606           7 :                 struct winreg_OpenHKCR *r2 = (struct winreg_OpenHKCR *)r;
     607           7 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     608           0 :                         DEBUG(5,("function winreg_OpenHKCR replied async\n"));
     609             :                 }
     610           7 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     611           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_OpenHKCR, NDR_OUT | NDR_SET_VALUES, r2);
     612             :                 }
     613           7 :                 if (dce_call->fault_code != 0) {
     614           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_OpenHKCR\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     615             :                 }
     616           7 :                 break;
     617             :         }
     618           7 :         case 1: { /* winreg_OpenHKCU */
     619           7 :                 struct winreg_OpenHKCU *r2 = (struct winreg_OpenHKCU *)r;
     620           7 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     621           0 :                         DEBUG(5,("function winreg_OpenHKCU replied async\n"));
     622             :                 }
     623           7 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     624           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_OpenHKCU, NDR_OUT | NDR_SET_VALUES, r2);
     625             :                 }
     626           7 :                 if (dce_call->fault_code != 0) {
     627           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_OpenHKCU\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     628             :                 }
     629           7 :                 break;
     630             :         }
     631       44526 :         case 2: { /* winreg_OpenHKLM */
     632       44526 :                 struct winreg_OpenHKLM *r2 = (struct winreg_OpenHKLM *)r;
     633       44526 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     634           0 :                         DEBUG(5,("function winreg_OpenHKLM replied async\n"));
     635             :                 }
     636       44526 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     637           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_OpenHKLM, NDR_OUT | NDR_SET_VALUES, r2);
     638             :                 }
     639       44526 :                 if (dce_call->fault_code != 0) {
     640           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_OpenHKLM\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     641             :                 }
     642       44526 :                 break;
     643             :         }
     644           0 :         case 3: { /* winreg_OpenHKPD */
     645           0 :                 struct winreg_OpenHKPD *r2 = (struct winreg_OpenHKPD *)r;
     646           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     647           0 :                         DEBUG(5,("function winreg_OpenHKPD replied async\n"));
     648             :                 }
     649           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     650           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_OpenHKPD, NDR_OUT | NDR_SET_VALUES, r2);
     651             :                 }
     652           0 :                 if (dce_call->fault_code != 0) {
     653           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_OpenHKPD\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     654             :                 }
     655           0 :                 break;
     656             :         }
     657           7 :         case 4: { /* winreg_OpenHKU */
     658           7 :                 struct winreg_OpenHKU *r2 = (struct winreg_OpenHKU *)r;
     659           7 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     660           0 :                         DEBUG(5,("function winreg_OpenHKU replied async\n"));
     661             :                 }
     662           7 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     663           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_OpenHKU, NDR_OUT | NDR_SET_VALUES, r2);
     664             :                 }
     665           7 :                 if (dce_call->fault_code != 0) {
     666           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_OpenHKU\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     667             :                 }
     668           7 :                 break;
     669             :         }
     670       90484 :         case 5: { /* winreg_CloseKey */
     671       90484 :                 struct winreg_CloseKey *r2 = (struct winreg_CloseKey *)r;
     672       90484 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     673           0 :                         DEBUG(5,("function winreg_CloseKey replied async\n"));
     674             :                 }
     675       90484 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     676           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_CloseKey, NDR_OUT | NDR_SET_VALUES, r2);
     677             :                 }
     678       90484 :                 if (dce_call->fault_code != 0) {
     679           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_CloseKey\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     680             :                 }
     681       90484 :                 break;
     682             :         }
     683        6354 :         case 6: { /* winreg_CreateKey */
     684        6354 :                 struct winreg_CreateKey *r2 = (struct winreg_CreateKey *)r;
     685        6354 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     686           0 :                         DEBUG(5,("function winreg_CreateKey replied async\n"));
     687             :                 }
     688        6354 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     689           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_CreateKey, NDR_OUT | NDR_SET_VALUES, r2);
     690             :                 }
     691        6354 :                 if (dce_call->fault_code != 0) {
     692           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_CreateKey\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     693             :                 }
     694        6354 :                 break;
     695             :         }
     696        1194 :         case 7: { /* winreg_DeleteKey */
     697        1194 :                 struct winreg_DeleteKey *r2 = (struct winreg_DeleteKey *)r;
     698        1194 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     699           0 :                         DEBUG(5,("function winreg_DeleteKey replied async\n"));
     700             :                 }
     701        1194 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     702           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_DeleteKey, NDR_OUT | NDR_SET_VALUES, r2);
     703             :                 }
     704        1194 :                 if (dce_call->fault_code != 0) {
     705           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_DeleteKey\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     706             :                 }
     707        1194 :                 break;
     708             :         }
     709        3160 :         case 8: { /* winreg_DeleteValue */
     710        3160 :                 struct winreg_DeleteValue *r2 = (struct winreg_DeleteValue *)r;
     711        3160 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     712           0 :                         DEBUG(5,("function winreg_DeleteValue replied async\n"));
     713             :                 }
     714        3160 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     715           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_DeleteValue, NDR_OUT | NDR_SET_VALUES, r2);
     716             :                 }
     717        3160 :                 if (dce_call->fault_code != 0) {
     718           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_DeleteValue\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     719             :                 }
     720        3160 :                 break;
     721             :         }
     722       66308 :         case 9: { /* winreg_EnumKey */
     723       66308 :                 struct winreg_EnumKey *r2 = (struct winreg_EnumKey *)r;
     724       66308 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     725           0 :                         DEBUG(5,("function winreg_EnumKey replied async\n"));
     726             :                 }
     727       66308 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     728           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_EnumKey, NDR_OUT | NDR_SET_VALUES, r2);
     729             :                 }
     730       66308 :                 if (dce_call->fault_code != 0) {
     731           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_EnumKey\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     732             :                 }
     733       66308 :                 break;
     734             :         }
     735      191801 :         case 10: { /* winreg_EnumValue */
     736      191801 :                 struct winreg_EnumValue *r2 = (struct winreg_EnumValue *)r;
     737      191801 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     738           0 :                         DEBUG(5,("function winreg_EnumValue replied async\n"));
     739             :                 }
     740      191801 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     741           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_EnumValue, NDR_OUT | NDR_SET_VALUES, r2);
     742             :                 }
     743      191801 :                 if (dce_call->fault_code != 0) {
     744           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_EnumValue\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     745             :                 }
     746      191801 :                 break;
     747             :         }
     748          56 :         case 11: { /* winreg_FlushKey */
     749          56 :                 struct winreg_FlushKey *r2 = (struct winreg_FlushKey *)r;
     750          56 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     751           0 :                         DEBUG(5,("function winreg_FlushKey replied async\n"));
     752             :                 }
     753          56 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     754           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_FlushKey, NDR_OUT | NDR_SET_VALUES, r2);
     755             :                 }
     756          56 :                 if (dce_call->fault_code != 0) {
     757           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_FlushKey\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     758             :                 }
     759          56 :                 break;
     760             :         }
     761           0 :         case 12: { /* winreg_GetKeySecurity */
     762           0 :                 struct winreg_GetKeySecurity *r2 = (struct winreg_GetKeySecurity *)r;
     763           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     764           0 :                         DEBUG(5,("function winreg_GetKeySecurity replied async\n"));
     765             :                 }
     766           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     767           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_GetKeySecurity, NDR_OUT | NDR_SET_VALUES, r2);
     768             :                 }
     769           0 :                 if (dce_call->fault_code != 0) {
     770           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_GetKeySecurity\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     771             :                 }
     772           0 :                 break;
     773             :         }
     774           0 :         case 13: { /* winreg_LoadKey */
     775           0 :                 struct winreg_LoadKey *r2 = (struct winreg_LoadKey *)r;
     776           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     777           0 :                         DEBUG(5,("function winreg_LoadKey replied async\n"));
     778             :                 }
     779           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     780           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_LoadKey, NDR_OUT | NDR_SET_VALUES, r2);
     781             :                 }
     782           0 :                 if (dce_call->fault_code != 0) {
     783           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_LoadKey\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     784             :                 }
     785           0 :                 break;
     786             :         }
     787          28 :         case 14: { /* winreg_NotifyChangeKeyValue */
     788          28 :                 struct winreg_NotifyChangeKeyValue *r2 = (struct winreg_NotifyChangeKeyValue *)r;
     789          28 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     790           0 :                         DEBUG(5,("function winreg_NotifyChangeKeyValue replied async\n"));
     791             :                 }
     792          28 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     793           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_NotifyChangeKeyValue, NDR_OUT | NDR_SET_VALUES, r2);
     794             :                 }
     795          28 :                 if (dce_call->fault_code != 0) {
     796           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_NotifyChangeKeyValue\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     797             :                 }
     798          28 :                 break;
     799             :         }
     800       42396 :         case 15: { /* winreg_OpenKey */
     801       42396 :                 struct winreg_OpenKey *r2 = (struct winreg_OpenKey *)r;
     802       42396 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     803           0 :                         DEBUG(5,("function winreg_OpenKey replied async\n"));
     804             :                 }
     805       42396 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     806           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_OpenKey, NDR_OUT | NDR_SET_VALUES, r2);
     807             :                 }
     808       42396 :                 if (dce_call->fault_code != 0) {
     809           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_OpenKey\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     810             :                 }
     811       42396 :                 break;
     812             :         }
     813       20376 :         case 16: { /* winreg_QueryInfoKey */
     814       20376 :                 struct winreg_QueryInfoKey *r2 = (struct winreg_QueryInfoKey *)r;
     815       20376 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     816           0 :                         DEBUG(5,("function winreg_QueryInfoKey replied async\n"));
     817             :                 }
     818       20376 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     819           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_QueryInfoKey, NDR_OUT | NDR_SET_VALUES, r2);
     820             :                 }
     821       20376 :                 if (dce_call->fault_code != 0) {
     822           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_QueryInfoKey\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     823             :                 }
     824       20376 :                 break;
     825             :         }
     826       46510 :         case 17: { /* winreg_QueryValue */
     827       46510 :                 struct winreg_QueryValue *r2 = (struct winreg_QueryValue *)r;
     828       46510 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     829           0 :                         DEBUG(5,("function winreg_QueryValue replied async\n"));
     830             :                 }
     831       46510 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     832           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_QueryValue, NDR_OUT | NDR_SET_VALUES, r2);
     833             :                 }
     834       46510 :                 if (dce_call->fault_code != 0) {
     835           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_QueryValue\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     836             :                 }
     837       46510 :                 break;
     838             :         }
     839           0 :         case 18: { /* winreg_ReplaceKey */
     840           0 :                 struct winreg_ReplaceKey *r2 = (struct winreg_ReplaceKey *)r;
     841           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     842           0 :                         DEBUG(5,("function winreg_ReplaceKey replied async\n"));
     843             :                 }
     844           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     845           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_ReplaceKey, NDR_OUT | NDR_SET_VALUES, r2);
     846             :                 }
     847           0 :                 if (dce_call->fault_code != 0) {
     848           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_ReplaceKey\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     849             :                 }
     850           0 :                 break;
     851             :         }
     852           0 :         case 19: { /* winreg_RestoreKey */
     853           0 :                 struct winreg_RestoreKey *r2 = (struct winreg_RestoreKey *)r;
     854           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     855           0 :                         DEBUG(5,("function winreg_RestoreKey replied async\n"));
     856             :                 }
     857           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     858           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_RestoreKey, NDR_OUT | NDR_SET_VALUES, r2);
     859             :                 }
     860           0 :                 if (dce_call->fault_code != 0) {
     861           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_RestoreKey\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     862             :                 }
     863           0 :                 break;
     864             :         }
     865           0 :         case 20: { /* winreg_SaveKey */
     866           0 :                 struct winreg_SaveKey *r2 = (struct winreg_SaveKey *)r;
     867           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     868           0 :                         DEBUG(5,("function winreg_SaveKey replied async\n"));
     869             :                 }
     870           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     871           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_SaveKey, NDR_OUT | NDR_SET_VALUES, r2);
     872             :                 }
     873           0 :                 if (dce_call->fault_code != 0) {
     874           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_SaveKey\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     875             :                 }
     876           0 :                 break;
     877             :         }
     878           0 :         case 21: { /* winreg_SetKeySecurity */
     879           0 :                 struct winreg_SetKeySecurity *r2 = (struct winreg_SetKeySecurity *)r;
     880           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     881           0 :                         DEBUG(5,("function winreg_SetKeySecurity replied async\n"));
     882             :                 }
     883           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     884           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_SetKeySecurity, NDR_OUT | NDR_SET_VALUES, r2);
     885             :                 }
     886           0 :                 if (dce_call->fault_code != 0) {
     887           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_SetKeySecurity\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     888             :                 }
     889           0 :                 break;
     890             :         }
     891       16754 :         case 22: { /* winreg_SetValue */
     892       16754 :                 struct winreg_SetValue *r2 = (struct winreg_SetValue *)r;
     893       16754 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     894           0 :                         DEBUG(5,("function winreg_SetValue replied async\n"));
     895             :                 }
     896       16754 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     897           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_SetValue, NDR_OUT | NDR_SET_VALUES, r2);
     898             :                 }
     899       16754 :                 if (dce_call->fault_code != 0) {
     900           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_SetValue\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     901             :                 }
     902       16754 :                 break;
     903             :         }
     904           0 :         case 23: { /* winreg_UnLoadKey */
     905           0 :                 struct winreg_UnLoadKey *r2 = (struct winreg_UnLoadKey *)r;
     906           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     907           0 :                         DEBUG(5,("function winreg_UnLoadKey replied async\n"));
     908             :                 }
     909           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     910           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_UnLoadKey, NDR_OUT | NDR_SET_VALUES, r2);
     911             :                 }
     912           0 :                 if (dce_call->fault_code != 0) {
     913           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_UnLoadKey\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     914             :                 }
     915           0 :                 break;
     916             :         }
     917           0 :         case 24: { /* winreg_InitiateSystemShutdown */
     918           0 :                 struct winreg_InitiateSystemShutdown *r2 = (struct winreg_InitiateSystemShutdown *)r;
     919           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     920           0 :                         DEBUG(5,("function winreg_InitiateSystemShutdown replied async\n"));
     921             :                 }
     922           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     923           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_InitiateSystemShutdown, NDR_OUT | NDR_SET_VALUES, r2);
     924             :                 }
     925           0 :                 if (dce_call->fault_code != 0) {
     926           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_InitiateSystemShutdown\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     927             :                 }
     928           0 :                 break;
     929             :         }
     930           0 :         case 25: { /* winreg_AbortSystemShutdown */
     931           0 :                 struct winreg_AbortSystemShutdown *r2 = (struct winreg_AbortSystemShutdown *)r;
     932           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     933           0 :                         DEBUG(5,("function winreg_AbortSystemShutdown replied async\n"));
     934             :                 }
     935           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     936           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_AbortSystemShutdown, NDR_OUT | NDR_SET_VALUES, r2);
     937             :                 }
     938           0 :                 if (dce_call->fault_code != 0) {
     939           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_AbortSystemShutdown\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     940             :                 }
     941           0 :                 break;
     942             :         }
     943          28 :         case 26: { /* winreg_GetVersion */
     944          28 :                 struct winreg_GetVersion *r2 = (struct winreg_GetVersion *)r;
     945          28 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     946           0 :                         DEBUG(5,("function winreg_GetVersion replied async\n"));
     947             :                 }
     948          28 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     949           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_GetVersion, NDR_OUT | NDR_SET_VALUES, r2);
     950             :                 }
     951          28 :                 if (dce_call->fault_code != 0) {
     952           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_GetVersion\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     953             :                 }
     954          28 :                 break;
     955             :         }
     956           0 :         case 27: { /* winreg_OpenHKCC */
     957           0 :                 struct winreg_OpenHKCC *r2 = (struct winreg_OpenHKCC *)r;
     958           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     959           0 :                         DEBUG(5,("function winreg_OpenHKCC replied async\n"));
     960             :                 }
     961           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     962           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_OpenHKCC, NDR_OUT | NDR_SET_VALUES, r2);
     963             :                 }
     964           0 :                 if (dce_call->fault_code != 0) {
     965           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_OpenHKCC\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     966             :                 }
     967           0 :                 break;
     968             :         }
     969           0 :         case 28: { /* winreg_OpenHKDD */
     970           0 :                 struct winreg_OpenHKDD *r2 = (struct winreg_OpenHKDD *)r;
     971           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     972           0 :                         DEBUG(5,("function winreg_OpenHKDD replied async\n"));
     973             :                 }
     974           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     975           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_OpenHKDD, NDR_OUT | NDR_SET_VALUES, r2);
     976             :                 }
     977           0 :                 if (dce_call->fault_code != 0) {
     978           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_OpenHKDD\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     979             :                 }
     980           0 :                 break;
     981             :         }
     982          88 :         case 29: { /* winreg_QueryMultipleValues */
     983          88 :                 struct winreg_QueryMultipleValues *r2 = (struct winreg_QueryMultipleValues *)r;
     984          88 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     985           0 :                         DEBUG(5,("function winreg_QueryMultipleValues replied async\n"));
     986             :                 }
     987          88 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
     988           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_QueryMultipleValues, NDR_OUT | NDR_SET_VALUES, r2);
     989             :                 }
     990          88 :                 if (dce_call->fault_code != 0) {
     991           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_QueryMultipleValues\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
     992             :                 }
     993          88 :                 break;
     994             :         }
     995           0 :         case 30: { /* winreg_InitiateSystemShutdownEx */
     996           0 :                 struct winreg_InitiateSystemShutdownEx *r2 = (struct winreg_InitiateSystemShutdownEx *)r;
     997           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
     998           0 :                         DEBUG(5,("function winreg_InitiateSystemShutdownEx replied async\n"));
     999             :                 }
    1000           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
    1001           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_InitiateSystemShutdownEx, NDR_OUT | NDR_SET_VALUES, r2);
    1002             :                 }
    1003           0 :                 if (dce_call->fault_code != 0) {
    1004           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_InitiateSystemShutdownEx\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
    1005             :                 }
    1006           0 :                 break;
    1007             :         }
    1008           0 :         case 31: { /* winreg_SaveKeyEx */
    1009           0 :                 struct winreg_SaveKeyEx *r2 = (struct winreg_SaveKeyEx *)r;
    1010           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
    1011           0 :                         DEBUG(5,("function winreg_SaveKeyEx replied async\n"));
    1012             :                 }
    1013           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
    1014           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_SaveKeyEx, NDR_OUT | NDR_SET_VALUES, r2);
    1015             :                 }
    1016           0 :                 if (dce_call->fault_code != 0) {
    1017           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_SaveKeyEx\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
    1018             :                 }
    1019           0 :                 break;
    1020             :         }
    1021           0 :         case 32: { /* winreg_OpenHKPT */
    1022           0 :                 struct winreg_OpenHKPT *r2 = (struct winreg_OpenHKPT *)r;
    1023           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
    1024           0 :                         DEBUG(5,("function winreg_OpenHKPT replied async\n"));
    1025             :                 }
    1026           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
    1027           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_OpenHKPT, NDR_OUT | NDR_SET_VALUES, r2);
    1028             :                 }
    1029           0 :                 if (dce_call->fault_code != 0) {
    1030           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_OpenHKPT\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
    1031             :                 }
    1032           0 :                 break;
    1033             :         }
    1034           0 :         case 33: { /* winreg_OpenHKPN */
    1035           0 :                 struct winreg_OpenHKPN *r2 = (struct winreg_OpenHKPN *)r;
    1036           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
    1037           0 :                         DEBUG(5,("function winreg_OpenHKPN replied async\n"));
    1038             :                 }
    1039           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
    1040           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_OpenHKPN, NDR_OUT | NDR_SET_VALUES, r2);
    1041             :                 }
    1042           0 :                 if (dce_call->fault_code != 0) {
    1043           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_OpenHKPN\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
    1044             :                 }
    1045           0 :                 break;
    1046             :         }
    1047          88 :         case 34: { /* winreg_QueryMultipleValues2 */
    1048          88 :                 struct winreg_QueryMultipleValues2 *r2 = (struct winreg_QueryMultipleValues2 *)r;
    1049          88 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
    1050           0 :                         DEBUG(5,("function winreg_QueryMultipleValues2 replied async\n"));
    1051             :                 }
    1052          88 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
    1053           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_QueryMultipleValues2, NDR_OUT | NDR_SET_VALUES, r2);
    1054             :                 }
    1055          88 :                 if (dce_call->fault_code != 0) {
    1056           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_QueryMultipleValues2\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
    1057             :                 }
    1058          88 :                 break;
    1059             :         }
    1060           0 :         case 35: { /* winreg_DeleteKeyEx */
    1061           0 :                 struct winreg_DeleteKeyEx *r2 = (struct winreg_DeleteKeyEx *)r;
    1062           0 :                 if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
    1063           0 :                         DEBUG(5,("function winreg_DeleteKeyEx replied async\n"));
    1064             :                 }
    1065           0 :                 if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
    1066           0 :                         NDR_PRINT_FUNCTION_DEBUG(winreg_DeleteKeyEx, NDR_OUT | NDR_SET_VALUES, r2);
    1067             :                 }
    1068           0 :                 if (dce_call->fault_code != 0) {
    1069           0 :                         DBG_WARNING("dcerpc_fault %s in winreg_DeleteKeyEx\n", dcerpc_errstr(mem_ctx, dce_call->fault_code));
    1070             :                 }
    1071           0 :                 break;
    1072             :         }
    1073           0 :         default:
    1074           0 :                 dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
    1075           0 :                 break;
    1076             :         }
    1077             : 
    1078      530172 :         if (dce_call->fault_code != 0) {
    1079           0 :                 return NT_STATUS_NET_WRITE_FAULT;
    1080             :         }
    1081             : 
    1082      530172 :         return NT_STATUS_OK;
    1083             : }
    1084             : 
    1085      530172 : NTSTATUS winreg__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_push *push, const void *r)
    1086             : {
    1087           0 :         enum ndr_err_code ndr_err;
    1088      530172 :         uint16_t opnum = dce_call->pkt.u.request.opnum;
    1089             : 
    1090      530172 :         ndr_err = ndr_table_winreg.calls[opnum].ndr_push(push, NDR_OUT, r);
    1091      530172 :         if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
    1092           0 :                 dce_call->fault_code = DCERPC_FAULT_NDR;
    1093           0 :                 return NT_STATUS_NET_WRITE_FAULT;
    1094             :         }
    1095             : 
    1096      530172 :         return NT_STATUS_OK;
    1097             : }
    1098             : 
    1099           0 : NTSTATUS winreg__op_local(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
    1100             : {
    1101           0 :         return winreg__op_dispatch_internal(dce_call, mem_ctx, r, S3COMPAT_RPC_DISPATCH_INTERNAL);
    1102             : }
    1103             : 
    1104             : static const struct dcesrv_interface dcesrv_winreg_interface = {
    1105             :         .name      = "winreg",
    1106             :         .syntax_id = {{0x338cd001,0x2244,0x31f1,{0xaa,0xaa},{0x90,0x00,0x38,0x00,0x10,0x03}},1.0},
    1107             :         .bind      = winreg__op_bind,
    1108             :         .unbind    = winreg__op_unbind,
    1109             :         .ndr_pull  = winreg__op_ndr_pull,
    1110             :         .dispatch  = winreg__op_dispatch,
    1111             :         .reply     = winreg__op_reply,
    1112             :         .ndr_push  = winreg__op_ndr_push,
    1113             :         .local     = winreg__op_local,
    1114             : #ifdef DCESRV_INTERFACE_WINREG_FLAGS
    1115             :         .flags     = DCESRV_INTERFACE_WINREG_FLAGS
    1116             : #else
    1117             :         .flags     = 0
    1118             : #endif
    1119             : };
    1120             : 
    1121         193 : static NTSTATUS winreg__op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
    1122             : {
    1123           0 :         uint32_t i;
    1124           0 :         NTSTATUS ret;
    1125             : 
    1126             : #ifdef DCESRV_INTERFACE_WINREG_NCACN_NP_SECONDARY_ENDPOINT
    1127             :         const char *ncacn_np_secondary_endpoint = DCESRV_INTERFACE_WINREG_NCACN_NP_SECONDARY_ENDPOINT;
    1128             : #else
    1129         193 :         const char *ncacn_np_secondary_endpoint = NULL;
    1130             : #endif
    1131             : 
    1132         772 :         for (i=0;i<ndr_table_winreg.endpoints->count;i++) {
    1133         579 :                 const char *name = ndr_table_winreg.endpoints->names[i];
    1134             : 
    1135         579 :                 ret = dcesrv_interface_register(dce_ctx, name, ncacn_np_secondary_endpoint, &dcesrv_winreg_interface, NULL);
    1136         579 :                 if (!NT_STATUS_IS_OK(ret)) {
    1137           0 :                         DBG_ERR("Failed to register endpoint '%s'\n",name);
    1138           0 :                         return ret;
    1139             :                 }
    1140             :         }
    1141             : 
    1142         193 :         return NT_STATUS_OK;
    1143             : }
    1144             : 
    1145         193 : static NTSTATUS winreg__op_shutdown_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
    1146             : {
    1147         193 :         return NT_STATUS_OK;
    1148             : }
    1149             : 
    1150           0 : static bool winreg__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version)
    1151             : {
    1152           0 :         if (dcesrv_winreg_interface.syntax_id.if_version == if_version && GUID_equal(&dcesrv_winreg_interface.syntax_id.uuid, uuid)) {
    1153           0 :                 memcpy(iface,&dcesrv_winreg_interface, sizeof(*iface));
    1154           0 :                 return true;
    1155             :         }
    1156             : 
    1157           0 :         return false;
    1158             : }
    1159             : 
    1160           0 : static bool winreg__op_interface_by_name(struct dcesrv_interface *iface, const char *name)
    1161             : {
    1162           0 :         if (strcmp(dcesrv_winreg_interface.name, name)==0) {
    1163           0 :                 memcpy(iface, &dcesrv_winreg_interface, sizeof(*iface));
    1164           0 :                 return true;
    1165             :         }
    1166             : 
    1167           0 :         return false;
    1168             : }
    1169             : 
    1170             : static const struct dcesrv_endpoint_server winreg_ep_server = {
    1171             :         /* fill in our name */
    1172             :         .name = "winreg",
    1173             : 
    1174             :         /* Initialization flag */
    1175             :         .initialized = false,
    1176             : 
    1177             :         /* fill in all the operations */
    1178             : #ifdef DCESRV_INTERFACE_WINREG_INIT_SERVER
    1179             :         .init_server = DCESRV_INTERFACE_WINREG_INIT_SERVER,
    1180             : #else
    1181             :         .init_server = winreg__op_init_server,
    1182             : #endif
    1183             : #ifdef DCESRV_INTERFACE_WINREG_SHUTDOWN_SERVER
    1184             :         .shutdown_server = DCESRV_INTERFACE_WINREG_SHUTDOWN_SERVER,
    1185             : #else
    1186             :         .shutdown_server = winreg__op_shutdown_server,
    1187             : #endif
    1188             :         .interface_by_uuid = winreg__op_interface_by_uuid,
    1189             :         .interface_by_name = winreg__op_interface_by_name
    1190             : };
    1191             : 
    1192         193 : const struct dcesrv_endpoint_server *winreg_get_ep_server(void)
    1193             : {
    1194         193 :         return &winreg_ep_server;
    1195             : }

Generated by: LCOV version 1.14