Remove unused marshalling for SVCCTL_OPEN_SCMANAGER.
[gd/samba/.git] / source / rpc_parse / parse_svcctl.c
1 /* 
2  *  Unix SMB/CIFS implementation.
3  *  RPC Pipe client / server routines
4  *  Copyright (C) Gerald (Jerry) Carter             2005.
5  *  
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 3 of the License, or
9  *  (at your option) any later version.
10  *  
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *  
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #include "includes.h"
21
22 #undef DBGC_CLASS
23 #define DBGC_CLASS DBGC_RPC_PARSE
24
25 /*******************************************************************
26 ********************************************************************/
27
28 static bool svcctl_io_service_status( const char *desc, SERVICE_STATUS *status, prs_struct *ps, int depth )
29 {
30
31         prs_debug(ps, depth, desc, "svcctl_io_service_status");
32         depth++;
33
34         if(!prs_uint32("type", ps, depth, &status->type))
35                 return False;
36
37         if(!prs_uint32("state", ps, depth, &status->state))
38                 return False;
39
40         if(!prs_uint32("controls_accepted", ps, depth, &status->controls_accepted))
41                 return False;
42
43         if(!prs_werror("win32_exit_code", ps, depth, &status->win32_exit_code))
44                 return False;
45
46         if(!prs_uint32("service_exit_code", ps, depth, &status->service_exit_code))
47                 return False;
48
49         if(!prs_uint32("check_point", ps, depth, &status->check_point))
50                 return False;
51
52         if(!prs_uint32("wait_hint", ps, depth, &status->wait_hint))
53                 return False;
54
55         return True;
56 }
57
58 /*******************************************************************
59 ********************************************************************/
60
61 static bool svcctl_io_service_config( const char *desc, SERVICE_CONFIG *config, prs_struct *ps, int depth )
62 {
63
64         prs_debug(ps, depth, desc, "svcctl_io_service_config");
65         depth++;
66
67         if(!prs_uint32("service_type", ps, depth, &config->service_type))
68                 return False;
69         if(!prs_uint32("start_type", ps, depth, &config->start_type))
70                 return False;
71         if(!prs_uint32("error_control", ps, depth, &config->error_control))
72                 return False;
73
74         if (!prs_io_unistr2_p("", ps, depth, &config->executablepath))
75                 return False;
76         if (!prs_io_unistr2_p("", ps, depth, &config->loadordergroup))
77                 return False;
78
79         if(!prs_uint32("tag_id", ps, depth, &config->tag_id))
80                 return False;
81
82         if (!prs_io_unistr2_p("", ps, depth, &config->dependencies))
83                 return False;
84         if (!prs_io_unistr2_p("", ps, depth, &config->startname))
85                 return False;
86         if (!prs_io_unistr2_p("", ps, depth, &config->displayname))
87                 return False;
88
89         if (!prs_io_unistr2("", ps, depth, config->executablepath))
90                 return False;
91         if (!prs_io_unistr2("", ps, depth, config->loadordergroup))
92                 return False;
93         if (!prs_io_unistr2("", ps, depth, config->dependencies))
94                 return False;
95         if (!prs_io_unistr2("", ps, depth, config->startname))
96                 return False;
97         if (!prs_io_unistr2("", ps, depth, config->displayname))
98                 return False;
99
100         return True;
101 }
102
103 /*******************************************************************
104 ********************************************************************/
105
106 bool svcctl_io_enum_services_status( const char *desc, ENUM_SERVICES_STATUS *enum_status, RPC_BUFFER *buffer, int depth )
107 {
108         prs_struct *ps=&buffer->prs;
109         
110         prs_debug(ps, depth, desc, "svcctl_io_enum_services_status");
111         depth++;
112         
113         if ( !smb_io_relstr("servicename", buffer, depth, &enum_status->servicename) )
114                 return False;
115         if ( !smb_io_relstr("displayname", buffer, depth, &enum_status->displayname) )
116                 return False;
117
118         if ( !svcctl_io_service_status("svc_status", &enum_status->status, ps, depth) )
119                 return False;
120         
121         return True;
122 }
123
124 /*******************************************************************
125 ********************************************************************/
126
127 bool svcctl_io_service_status_process( const char *desc, SERVICE_STATUS_PROCESS *status, RPC_BUFFER *buffer, int depth )
128 {
129         prs_struct *ps=&buffer->prs;
130
131         prs_debug(ps, depth, desc, "svcctl_io_service_status_process");
132         depth++;
133
134         if ( !svcctl_io_service_status("status", &status->status, ps, depth) )
135                 return False;
136         if(!prs_align(ps))
137                 return False;
138
139         if(!prs_uint32("process_id", ps, depth, &status->process_id))
140                 return False;
141         if(!prs_uint32("service_flags", ps, depth, &status->service_flags))
142                 return False;
143
144         return True;
145 }
146
147 /*******************************************************************
148 ********************************************************************/
149
150 uint32 svcctl_sizeof_enum_services_status( ENUM_SERVICES_STATUS *status )
151 {
152         uint32 size = 0;
153         
154         size += size_of_relative_string( &status->servicename );
155         size += size_of_relative_string( &status->displayname );
156         size += sizeof(SERVICE_STATUS);
157
158         return size;
159 }
160
161 /********************************************************************
162 ********************************************************************/
163
164 static uint32 sizeof_unistr2( UNISTR2 *string )
165 {
166         uint32 size = 0;
167
168         if ( !string ) 
169                 return 0;       
170
171         size  = sizeof(uint32) * 3;             /* length fields */
172         size += 2 * string->uni_max_len;        /* string data */
173         size += size % 4;                       /* alignment */
174
175         return size;
176 }
177
178 /********************************************************************
179 ********************************************************************/
180
181 uint32 svcctl_sizeof_service_config( SERVICE_CONFIG *config )
182 {
183         uint32 size = 0;
184
185         size = sizeof(uint32) * 4;      /* static uint32 fields */
186
187         /* now add the UNISTR2 + pointer sizes */
188
189         size += sizeof(uint32) * sizeof_unistr2(config->executablepath);
190         size += sizeof(uint32) * sizeof_unistr2(config->loadordergroup);
191         size += sizeof(uint32) * sizeof_unistr2(config->dependencies);
192         size += sizeof(uint32) * sizeof_unistr2(config->startname);
193         size += sizeof(uint32) * sizeof_unistr2(config->displayname);
194         
195         return size;
196 }
197
198 /*******************************************************************
199 ********************************************************************/
200
201 bool svcctl_io_q_get_display_name(const char *desc, SVCCTL_Q_GET_DISPLAY_NAME *q_u, prs_struct *ps, int depth)
202 {
203         if (q_u == NULL)
204                 return False;
205
206         prs_debug(ps, depth, desc, "svcctl_io_q_get_display_name");
207         depth++;
208
209         if(!prs_align(ps))
210                 return False;
211
212         if(!smb_io_pol_hnd("scm_pol", &q_u->handle, ps, depth))
213                 return False;
214
215         if(!smb_io_unistr2("servicename", &q_u->servicename, 1, ps, depth))
216                 return False;
217
218         if(!prs_align(ps))
219                 return False;
220
221         if(!prs_uint32("display_name_len", ps, depth, &q_u->display_name_len))
222                 return False;
223         
224         return True;
225 }
226
227 /*******************************************************************
228 ********************************************************************/
229
230 bool init_svcctl_r_get_display_name( SVCCTL_R_GET_DISPLAY_NAME *r_u, const char *displayname )
231 {
232         r_u->display_name_len = strlen(displayname);
233         init_unistr2( &r_u->displayname, displayname, UNI_STR_TERMINATE );
234
235         return True;
236 }
237
238 /*******************************************************************
239 ********************************************************************/
240
241 bool svcctl_io_r_get_display_name(const char *desc, SVCCTL_R_GET_DISPLAY_NAME *r_u, prs_struct *ps, int depth)
242 {
243         if (r_u == NULL)
244                 return False;
245
246         prs_debug(ps, depth, desc, "svcctl_io_r_get_display_name");
247         depth++;
248
249         if(!prs_align(ps))
250                 return False;
251
252         
253         if(!smb_io_unistr2("displayname", &r_u->displayname, 1, ps, depth))
254                 return False;
255
256         if(!prs_align(ps))
257                 return False;
258
259         if(!prs_uint32("display_name_len", ps, depth, &r_u->display_name_len))
260                 return False;
261
262         if(!prs_werror("status", ps, depth, &r_u->status))
263                 return False;
264
265         return True;
266 }
267
268
269 /*******************************************************************
270 ********************************************************************/
271
272 bool svcctl_io_q_open_service(const char *desc, SVCCTL_Q_OPEN_SERVICE *q_u, prs_struct *ps, int depth)
273 {
274         if (q_u == NULL)
275                 return False;
276
277         prs_debug(ps, depth, desc, "svcctl_io_q_open_service");
278         depth++;
279
280         if(!prs_align(ps))
281                 return False;
282
283         if(!smb_io_pol_hnd("scm_pol", &q_u->handle, ps, depth))
284                 return False;
285
286         if(!smb_io_unistr2("servicename", &q_u->servicename, 1, ps, depth))
287                 return False;
288
289         if(!prs_align(ps))
290                 return False;
291
292         if(!prs_uint32("access", ps, depth, &q_u->access))
293                 return False;
294         
295         return True;
296 }
297
298 /*******************************************************************
299 ********************************************************************/
300
301 bool svcctl_io_r_open_service(const char *desc, SVCCTL_R_OPEN_SERVICE *r_u, prs_struct *ps, int depth)
302 {
303         if (r_u == NULL)
304                 return False;
305
306         prs_debug(ps, depth, desc, "svcctl_io_r_open_service");
307         depth++;
308
309         if(!prs_align(ps))
310                 return False;
311
312         if(!smb_io_pol_hnd("service_pol", &r_u->handle, ps, depth))
313                 return False;
314
315         if(!prs_werror("status", ps, depth, &r_u->status))
316                 return False;
317
318         return True;
319 }
320
321 /*******************************************************************
322 ********************************************************************/
323
324 bool svcctl_io_q_query_status(const char *desc, SVCCTL_Q_QUERY_STATUS *q_u, prs_struct *ps, int depth)
325 {
326         if (q_u == NULL)
327                 return False;
328
329         prs_debug(ps, depth, desc, "svcctl_io_q_query_status");
330         depth++;
331
332         if(!prs_align(ps))
333                 return False;
334
335         if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
336                 return False;
337         
338         return True;
339 }
340
341 /*******************************************************************
342 ********************************************************************/
343
344 bool svcctl_io_r_query_status(const char *desc, SVCCTL_R_QUERY_STATUS *r_u, prs_struct *ps, int depth)
345 {
346         if (r_u == NULL)
347                 return False;
348
349         prs_debug(ps, depth, desc, "svcctl_io_r_query_status");
350         depth++;
351
352         if(!prs_align(ps))
353                 return False;
354
355         if(!svcctl_io_service_status("service_status", &r_u->svc_status, ps, depth))
356                 return False;
357
358         if(!prs_werror("status", ps, depth, &r_u->status))
359                 return False;
360
361         return True;
362 }
363
364 /*******************************************************************
365 ********************************************************************/
366
367 bool svcctl_io_q_enum_services_status(const char *desc, SVCCTL_Q_ENUM_SERVICES_STATUS *q_u, prs_struct *ps, int depth)
368 {
369         if (q_u == NULL)
370                 return False;
371
372         prs_debug(ps, depth, desc, "svcctl_io_q_enum_services_status");
373         depth++;
374
375         if(!prs_align(ps))
376                 return False;
377
378         if(!smb_io_pol_hnd("scm_pol", &q_u->handle, ps, depth))
379                 return False;
380
381         if(!prs_uint32("type", ps, depth, &q_u->type))
382                 return False;
383         if(!prs_uint32("state", ps, depth, &q_u->state))
384                 return False;
385         if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))
386                 return False;
387
388         if(!prs_pointer("resume", ps, depth, (void*)&q_u->resume, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
389                 return False;
390         
391         return True;
392 }
393
394 /*******************************************************************
395 ********************************************************************/
396
397 bool svcctl_io_r_enum_services_status(const char *desc, SVCCTL_R_ENUM_SERVICES_STATUS *r_u, prs_struct *ps, int depth)
398 {
399         if (r_u == NULL)
400                 return False;
401
402         prs_debug(ps, depth, desc, "svcctl_io_r_enum_services_status");
403         depth++;
404
405         if(!prs_align(ps))
406                 return False;
407
408         if (!prs_rpcbuffer("", ps, depth, &r_u->buffer))
409                 return False;
410
411         if(!prs_align(ps))
412                 return False;
413
414         if(!prs_uint32("needed", ps, depth, &r_u->needed))
415                 return False;
416         if(!prs_uint32("returned", ps, depth, &r_u->returned))
417                 return False;
418
419         if(!prs_pointer("resume", ps, depth, (void*)&r_u->resume, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
420                 return False;
421
422         if(!prs_werror("status", ps, depth, &r_u->status))
423                 return False;
424
425         return True;
426 }
427
428 /*******************************************************************
429 ********************************************************************/
430
431 bool svcctl_io_q_start_service(const char *desc, SVCCTL_Q_START_SERVICE *q_u, prs_struct *ps, int depth)
432 {
433         if (q_u == NULL)
434                 return False;
435
436         prs_debug(ps, depth, desc, "svcctl_io_q_start_service");
437         depth++;
438
439         if(!prs_align(ps))
440                 return False;
441
442         if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
443                 return False;
444
445         if(!prs_uint32("parmcount", ps, depth, &q_u->parmcount))
446                 return False;
447
448         if ( !prs_pointer("rights", ps, depth, (void*)&q_u->parameters, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) )
449                 return False;
450
451         return True;
452 }
453
454 /*******************************************************************
455 ********************************************************************/
456
457 bool svcctl_io_r_start_service(const char *desc, SVCCTL_R_START_SERVICE *r_u, prs_struct *ps, int depth)
458 {
459         if (r_u == NULL)
460                 return False;
461
462         prs_debug(ps, depth, desc, "svcctl_io_r_start_service");
463         depth++;
464
465         if(!prs_werror("status", ps, depth, &r_u->status))
466                 return False;
467
468         return True;
469 }
470
471
472 /*******************************************************************
473 ********************************************************************/
474
475 bool svcctl_io_q_enum_dependent_services(const char *desc, SVCCTL_Q_ENUM_DEPENDENT_SERVICES *q_u, prs_struct *ps, int depth)
476 {
477         if (q_u == NULL)
478                 return False;
479
480         prs_debug(ps, depth, desc, "svcctl_io_q_enum_dependent_services");
481         depth++;
482
483         if(!prs_align(ps))
484                 return False;
485
486         if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
487                 return False;
488
489         if(!prs_uint32("state", ps, depth, &q_u->state))
490                 return False;
491         if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))
492                 return False;
493
494         return True;
495 }
496
497 /*******************************************************************
498 ********************************************************************/
499
500 bool svcctl_io_r_enum_dependent_services(const char *desc, SVCCTL_R_ENUM_DEPENDENT_SERVICES *r_u, prs_struct *ps, int depth)
501 {
502         if (r_u == NULL)
503                 return False;
504
505         prs_debug(ps, depth, desc, "svcctl_io_r_enum_dependent_services");
506         depth++;
507
508         if(!prs_align(ps))
509                 return False;
510
511         if (!prs_rpcbuffer("", ps, depth, &r_u->buffer))
512                 return False;
513
514         if(!prs_align(ps))
515                 return False;
516
517         if(!prs_uint32("needed", ps, depth, &r_u->needed))
518                 return False;
519         if(!prs_uint32("returned", ps, depth, &r_u->returned))
520                 return False;
521
522         if(!prs_werror("status", ps, depth, &r_u->status))
523                 return False;
524
525         return True;
526 }
527
528 /*******************************************************************
529 ********************************************************************/
530
531 bool svcctl_io_q_control_service(const char *desc, SVCCTL_Q_CONTROL_SERVICE *q_u, prs_struct *ps, int depth)
532 {
533         if (q_u == NULL)
534                 return False;
535
536         prs_debug(ps, depth, desc, "svcctl_io_q_control_service");
537         depth++;
538
539         if(!prs_align(ps))
540                 return False;
541
542         if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
543                 return False;
544
545         if(!prs_uint32("control", ps, depth, &q_u->control))
546                 return False;
547
548         return True;
549 }
550
551 /*******************************************************************
552 ********************************************************************/
553
554 bool svcctl_io_r_control_service(const char *desc, SVCCTL_R_CONTROL_SERVICE *r_u, prs_struct *ps, int depth)
555 {
556         if (r_u == NULL)
557                 return False;
558
559         prs_debug(ps, depth, desc, "svcctl_io_r_control_service");
560         depth++;
561
562         if(!prs_align(ps))
563                 return False;
564
565         if(!svcctl_io_service_status("service_status", &r_u->svc_status, ps, depth))
566                 return False;
567
568         if(!prs_werror("status", ps, depth, &r_u->status))
569                 return False;
570
571         return True;
572 }
573
574
575 /*******************************************************************
576 ********************************************************************/
577
578 bool svcctl_io_q_query_service_config(const char *desc, SVCCTL_Q_QUERY_SERVICE_CONFIG *q_u, prs_struct *ps, int depth)
579 {
580         if (q_u == NULL)
581                 return False;
582
583         prs_debug(ps, depth, desc, "svcctl_io_q_query_service_config");
584         depth++;
585
586         if(!prs_align(ps))
587                 return False;
588
589         if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
590                 return False;
591
592         if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))
593                 return False;
594
595         return True;
596 }
597
598 /*******************************************************************
599 ********************************************************************/
600
601 bool svcctl_io_r_query_service_config(const char *desc, SVCCTL_R_QUERY_SERVICE_CONFIG *r_u, prs_struct *ps, int depth)
602 {
603         if (r_u == NULL)
604                 return False;
605
606         prs_debug(ps, depth, desc, "svcctl_io_r_query_service_config");
607         depth++;
608
609
610         if(!prs_align(ps))
611                 return False;
612
613         if(!svcctl_io_service_config("config", &r_u->config, ps, depth))
614                 return False;
615
616         if(!prs_uint32("needed", ps, depth, &r_u->needed))
617                 return False;
618
619         if(!prs_werror("status", ps, depth, &r_u->status))
620                 return False;
621
622
623         return True;
624 }
625
626 /*******************************************************************
627 ********************************************************************/
628
629 bool svcctl_io_q_query_service_config2(const char *desc, SVCCTL_Q_QUERY_SERVICE_CONFIG2 *q_u, prs_struct *ps, int depth)
630 {
631         if (q_u == NULL)
632                 return False;
633
634         prs_debug(ps, depth, desc, "svcctl_io_q_query_service_config2");
635         depth++;
636
637         if(!prs_align(ps))
638                 return False;
639
640         if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
641                 return False;
642
643         if(!prs_uint32("level", ps, depth, &q_u->level))
644                 return False;
645
646         if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))
647                 return False;
648
649         return True;
650 }
651
652
653 /*******************************************************************
654 ********************************************************************/
655
656 void init_service_description_buffer(SERVICE_DESCRIPTION *desc, const char *service_desc )
657 {
658         desc->unknown = 0x04;   /* always 0x0000 0004 (no idea what this is) */
659         init_unistr( &desc->description, service_desc );
660 }
661
662 /*******************************************************************
663 ********************************************************************/
664
665 bool svcctl_io_service_description( const char *desc, SERVICE_DESCRIPTION *description, RPC_BUFFER *buffer, int depth )
666 {
667         prs_struct *ps = &buffer->prs;
668
669         prs_debug(ps, depth, desc, "svcctl_io_service_description");
670         depth++;
671
672         if ( !prs_uint32("unknown", ps, depth, &description->unknown) )
673                 return False;
674         if ( !prs_unistr("description", ps, depth, &description->description) )
675                 return False;
676
677         return True;
678
679
680 /*******************************************************************
681 ********************************************************************/
682
683 uint32 svcctl_sizeof_service_description( SERVICE_DESCRIPTION *desc )
684 {
685         if ( !desc )
686                 return 0;
687
688         /* make sure to include the terminating NULL */
689         return ( sizeof(uint32) + (2*(str_len_uni(&desc->description)+1)) );
690 }
691
692 /*******************************************************************
693 ********************************************************************/
694
695 static bool svcctl_io_action( const char *desc, SC_ACTION *action, prs_struct *ps, int depth )
696 {
697
698         prs_debug(ps, depth, desc, "svcctl_io_action");
699         depth++;
700
701         if ( !prs_uint32("type", ps, depth, &action->type) )
702                 return False;
703         if ( !prs_uint32("delay", ps, depth, &action->delay) )
704                 return False;
705
706         return True;
707 }
708
709 /*******************************************************************
710 ********************************************************************/
711
712 bool svcctl_io_service_fa( const char *desc, SERVICE_FAILURE_ACTIONS *fa, RPC_BUFFER *buffer, int depth )
713 {
714         prs_struct *ps = &buffer->prs;
715         int i;
716
717         prs_debug(ps, depth, desc, "svcctl_io_service_description");
718         depth++;
719
720         if ( !prs_uint32("reset_period", ps, depth, &fa->reset_period) )
721                 return False;
722
723         if ( !prs_pointer( desc, ps, depth, (void*)&fa->rebootmsg, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) )
724                 return False;
725         if ( !prs_pointer( desc, ps, depth, (void*)&fa->command, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) )
726                 return False;
727
728         if ( !prs_uint32("num_actions", ps, depth, &fa->num_actions) )
729                 return False;
730
731         if ( UNMARSHALLING(ps)) {
732                 if (fa->num_actions) {
733                         if ( !(fa->actions = TALLOC_ARRAY( talloc_tos(), SC_ACTION, fa->num_actions )) ) {
734                                 DEBUG(0,("svcctl_io_service_fa: talloc() failure!\n"));
735                                 return False;
736                         }
737                 } else {
738                         fa->actions = NULL;
739                 }
740         }
741
742         for ( i=0; i<fa->num_actions; i++ ) {
743                 if ( !svcctl_io_action( "actions", &fa->actions[i], ps, depth ) )
744                         return False;
745         }
746
747         return True;
748
749
750 /*******************************************************************
751 ********************************************************************/
752
753 uint32 svcctl_sizeof_service_fa( SERVICE_FAILURE_ACTIONS *fa)
754 {
755         uint32 size = 0;
756
757         if ( !fa )
758                 return 0;
759
760         size  = sizeof(uint32) * 2;
761         size += sizeof_unistr2( fa->rebootmsg );
762         size += sizeof_unistr2( fa->command );
763         size += sizeof(SC_ACTION) * fa->num_actions;
764
765         return size;
766 }
767
768 /*******************************************************************
769 ********************************************************************/
770
771 bool svcctl_io_r_query_service_config2(const char *desc, SVCCTL_R_QUERY_SERVICE_CONFIG2 *r_u, prs_struct *ps, int depth)
772 {
773         if ( !r_u )
774                 return False;
775
776         prs_debug(ps, depth, desc, "svcctl_io_r_query_service_config2");
777         depth++;
778
779         if ( !prs_align(ps) )
780                 return False;
781
782         if (!prs_rpcbuffer("", ps, depth, &r_u->buffer))
783                 return False;
784         if(!prs_align(ps))
785                 return False;
786
787         if (!prs_uint32("needed", ps, depth, &r_u->needed))
788                 return False;
789
790         if(!prs_werror("status", ps, depth, &r_u->status))
791                 return False;
792
793         return True;
794 }
795
796
797 /*******************************************************************
798 ********************************************************************/
799
800 bool svcctl_io_q_query_service_status_ex(const char *desc, SVCCTL_Q_QUERY_SERVICE_STATUSEX *q_u, prs_struct *ps, int depth)
801 {
802         if (q_u == NULL)
803                 return False;
804
805         prs_debug(ps, depth, desc, "svcctl_io_q_query_service_status_ex");
806         depth++;
807
808         if(!prs_align(ps))
809                 return False;
810
811         if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
812                 return False;
813
814         if(!prs_uint32("level", ps, depth, &q_u->level))
815                 return False;
816
817         if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))
818                 return False;
819
820         return True;
821
822 }
823
824 /*******************************************************************
825 ********************************************************************/
826
827 bool svcctl_io_r_query_service_status_ex(const char *desc, SVCCTL_R_QUERY_SERVICE_STATUSEX *r_u, prs_struct *ps, int depth)
828 {
829         if ( !r_u )
830                 return False;
831
832         prs_debug(ps, depth, desc, "svcctl_io_r_query_service_status_ex");
833         depth++;
834
835         if (!prs_rpcbuffer("", ps, depth, &r_u->buffer))
836                 return False;
837
838         if(!prs_align(ps))
839                 return False;
840
841         if(!prs_uint32("needed", ps, depth, &r_u->needed))
842                 return False;
843
844         if(!prs_werror("status", ps, depth, &r_u->status))
845                 return False;
846
847         return True;
848 }
849
850 /*******************************************************************
851 ********************************************************************/
852
853 bool svcctl_io_q_lock_service_db(const char *desc, SVCCTL_Q_LOCK_SERVICE_DB *q_u, prs_struct *ps, int depth)
854 {
855         if (q_u == NULL)
856                 return False;
857
858         prs_debug(ps, depth, desc, "svcctl_io_q_lock_service_db");
859         depth++;
860
861         if(!prs_align(ps))
862                 return False;
863
864         if(!smb_io_pol_hnd("scm_handle", &q_u->handle, ps, depth))
865                 return False;
866
867         return True;
868
869 }
870
871 /*******************************************************************
872 ********************************************************************/
873
874 bool svcctl_io_r_lock_service_db(const char *desc, SVCCTL_R_LOCK_SERVICE_DB *r_u, prs_struct *ps, int depth)
875 {
876         if ( !r_u )
877                 return False;
878
879         prs_debug(ps, depth, desc, "svcctl_io_r_lock_service_db");
880         depth++;
881
882         if(!prs_align(ps))
883                 return False;
884
885         if(!smb_io_pol_hnd("lock_handle", &r_u->h_lock, ps, depth))
886                 return False;
887
888         if(!prs_werror("status", ps, depth, &r_u->status))
889                 return False;
890
891         return True;
892 }
893
894 /*******************************************************************
895 ********************************************************************/
896
897 bool svcctl_io_q_unlock_service_db(const char *desc, SVCCTL_Q_UNLOCK_SERVICE_DB *q_u, prs_struct *ps, int depth)
898 {
899         if (q_u == NULL)
900                 return False;
901
902         prs_debug(ps, depth, desc, "svcctl_io_q_unlock_service_db");
903         depth++;
904
905         if(!prs_align(ps))
906                 return False;
907
908         if(!smb_io_pol_hnd("h_lock", &q_u->h_lock, ps, depth))
909                 return False;
910
911         return True;
912
913 }
914
915 /*******************************************************************
916 ********************************************************************/
917
918 bool svcctl_io_r_unlock_service_db(const char *desc, SVCCTL_R_UNLOCK_SERVICE_DB *r_u, prs_struct *ps, int depth)
919 {
920         if ( !r_u )
921                 return False;
922
923         prs_debug(ps, depth, desc, "svcctl_io_r_unlock_service_db");
924         depth++;
925
926         if(!prs_align(ps))
927                 return False;
928
929         if(!prs_werror("status", ps, depth, &r_u->status))
930                 return False;
931
932         return True;
933 }
934
935 /*******************************************************************
936 ********************************************************************/
937
938 bool svcctl_io_q_query_service_sec(const char *desc, SVCCTL_Q_QUERY_SERVICE_SEC *q_u, prs_struct *ps, int depth)
939 {
940         if (q_u == NULL)
941                 return False;
942
943         prs_debug(ps, depth, desc, "svcctl_io_q_query_service_sec");
944         depth++;
945
946         if(!prs_align(ps))
947                 return False;
948
949         if(!smb_io_pol_hnd("handle", &q_u->handle, ps, depth))
950                 return False;
951         if(!prs_uint32("security_flags", ps, depth, &q_u->security_flags))
952                 return False;
953         if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))
954                 return False;
955
956         return True;
957
958 }
959
960 /*******************************************************************
961 ********************************************************************/
962
963 bool svcctl_io_r_query_service_sec(const char *desc, SVCCTL_R_QUERY_SERVICE_SEC *r_u, prs_struct *ps, int depth)
964 {
965         if ( !r_u )
966                 return False;
967
968         prs_debug(ps, depth, desc, "svcctl_io_r_query_service_sec");
969         depth++;
970
971         if(!prs_align(ps))
972                 return False;
973
974         if (!prs_rpcbuffer("buffer", ps, depth, &r_u->buffer))
975                 return False;
976
977         if(!prs_uint32("needed", ps, depth, &r_u->needed))
978                 return False;
979
980         if(!prs_werror("status", ps, depth, &r_u->status))
981                 return False;
982
983         return True;
984 }
985
986 /*******************************************************************
987 ********************************************************************/
988
989 bool svcctl_io_q_set_service_sec(const char *desc, SVCCTL_Q_SET_SERVICE_SEC *q_u, prs_struct *ps, int depth)
990 {
991         if (q_u == NULL)
992                 return False;
993
994         prs_debug(ps, depth, desc, "svcctl_io_q_set_service_sec");
995         depth++;
996
997         if(!prs_align(ps))
998                 return False;
999
1000         if(!smb_io_pol_hnd("handle", &q_u->handle, ps, depth))
1001                 return False;
1002         if(!prs_uint32("security_flags", ps, depth, &q_u->security_flags))
1003                 return False;
1004
1005         if (!prs_rpcbuffer("buffer", ps, depth, &q_u->buffer))
1006                 return False;
1007
1008         if(!prs_align(ps))
1009                 return False;
1010
1011         if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))
1012                 return False;
1013
1014         return True;
1015
1016 }
1017
1018 /*******************************************************************
1019 ********************************************************************/
1020
1021 bool svcctl_io_r_set_service_sec(const char *desc, SVCCTL_R_SET_SERVICE_SEC *r_u, prs_struct *ps, int depth)
1022 {
1023         if ( !r_u )
1024                 return False;
1025
1026         prs_debug(ps, depth, desc, "svcctl_io_r_set_service_sec");
1027         depth++;
1028
1029         if(!prs_align(ps))
1030                 return False;
1031
1032         if(!prs_werror("status", ps, depth, &r_u->status))
1033                 return False;
1034
1035         return True;
1036 }
1037
1038
1039
1040