r7649: * fix compile breakage (sorry, should have done a make clean before the
[Samba/gbeck.git] / source / rpc_parse / parse_reg.c
blob9f50f50acf46ef1a26d78ea367cd9e8778e727ca
1 /*
2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Andrew Tridgell 1992-1997,
5 * Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
6 * Copyright (C) Paul Ashton 1997.
7 * Copyright (C) Marc Jacobsen 1999.
8 * Copyright (C) Simo Sorce 2000.
9 * Copyright (C) Jeremy Cooper 2004
10 * Copyright (C) Gerald Carter 2002-2005.
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 #include "includes.h"
29 #undef DBGC_CLASS
30 #define DBGC_CLASS DBGC_RPC_PARSE
32 /*******************************************************************
33 Fill in a REGVAL_BUFFER for the data given a REGISTRY_VALUE
34 *******************************************************************/
36 static uint32 reg_init_regval_buffer( REGVAL_BUFFER *buf2, REGISTRY_VALUE *val )
38 uint32 real_size = 0;
40 if ( !buf2 || !val )
41 return 0;
43 real_size = regval_size(val);
44 init_regval_buffer( buf2, (unsigned char*)regval_data_p(val), real_size );
46 return real_size;
49 /*******************************************************************
50 Inits a hive connect request structure
51 ********************************************************************/
53 void init_reg_q_open_hive( REG_Q_OPEN_HIVE *q_o, uint32 access_desired )
56 q_o->server = TALLOC_P( get_talloc_ctx(), uint16);
57 *q_o->server = 0x1;
59 q_o->access = access_desired;
62 /*******************************************************************
63 Marshalls a hive connect request
64 ********************************************************************/
66 BOOL reg_io_q_open_hive(const char *desc, REG_Q_OPEN_HIVE *q_u,
67 prs_struct *ps, int depth)
69 prs_debug(ps, depth, desc, "reg_io_q_open_hive");
70 depth++;
72 if(!prs_align(ps))
73 return False;
75 if(!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16))
76 return False;
78 if(!prs_align(ps))
79 return False;
80 if(!prs_uint32("access", ps, depth, &q_u->access))
81 return False;
83 return True;
87 /*******************************************************************
88 Unmarshalls a hive connect response
89 ********************************************************************/
91 BOOL reg_io_r_open_hive(const char *desc, REG_R_OPEN_HIVE *r_u,
92 prs_struct *ps, int depth)
94 if ( !r_u )
95 return False;
97 prs_debug(ps, depth, desc, "reg_io_r_open_hive");
98 depth++;
100 if(!prs_align(ps))
101 return False;
103 if(!smb_io_pol_hnd("", &r_u->pol, ps, depth))
104 return False;
106 if(!prs_werror("status", ps, depth, &r_u->status))
107 return False;
109 return True;
112 /*******************************************************************
113 Inits a structure.
114 ********************************************************************/
116 void init_reg_q_flush_key(REG_Q_FLUSH_KEY *q_u, POLICY_HND *pol)
118 memcpy(&q_u->pol, pol, sizeof(q_u->pol));
121 /*******************************************************************
122 reads or writes a structure.
123 ********************************************************************/
125 BOOL reg_io_q_flush_key(const char *desc, REG_Q_FLUSH_KEY *q_u, prs_struct *ps, int depth)
127 if ( !q_u )
128 return False;
130 prs_debug(ps, depth, desc, "reg_io_q_flush_key");
131 depth++;
133 if(!prs_align(ps))
134 return False;
136 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
137 return False;
139 return True;
142 /*******************************************************************
143 Unmarshalls a registry key flush response
144 ********************************************************************/
146 BOOL reg_io_r_flush_key(const char *desc, REG_R_FLUSH_KEY *r_u,
147 prs_struct *ps, int depth)
149 if ( !r_u )
150 return False;
152 prs_debug(ps, depth, desc, "reg_io_r_flush_key");
153 depth++;
155 if(!prs_align(ps))
156 return False;
158 if(!prs_werror("status", ps, depth, &r_u->status))
159 return False;
161 return True;
164 /*******************************************************************
165 reads or writes SEC_DESC_BUF and SEC_DATA structures.
166 ********************************************************************/
168 static BOOL reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec,
169 SEC_DESC_BUF *data, prs_struct *ps, int depth)
171 if (ptr != 0) {
172 uint32 hdr_offset;
173 uint32 old_offset;
174 if(!smb_io_hdrbuf_pre("hdr_sec", hdr_sec, ps, depth,
175 &hdr_offset))
176 return False;
178 old_offset = prs_offset(ps);
180 if (ptr3 != NULL) {
181 if(!prs_uint32("ptr3", ps, depth, ptr3))
182 return False;
185 if (ptr3 == NULL || *ptr3 != 0) {
186 /* JRA - this next line is probably wrong... */
187 if(!sec_io_desc_buf("data ", &data, ps, depth))
188 return False;
191 if(!smb_io_hdrbuf_post("hdr_sec", hdr_sec, ps, depth,
192 hdr_offset, data->max_len, data->len))
193 return False;
194 if(!prs_set_offset(ps, old_offset + data->len +
195 sizeof(uint32) * ((ptr3 != NULL) ? 5 : 3)))
196 return False;
198 if(!prs_align(ps))
199 return False;
202 return True;
205 /*******************************************************************
206 Inits a registry key create request
207 ********************************************************************/
209 void init_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd,
210 char *name, char *class, uint32 access_desired,
211 SEC_DESC_BUF *sec_buf)
213 ZERO_STRUCTP(q_c);
215 memcpy(&q_c->handle, hnd, sizeof(q_c->handle));
218 init_unistr4( &q_c->name, name, UNI_STR_TERMINATE );
219 init_unistr4( &q_c->class, class, UNI_STR_TERMINATE );
221 q_c->access = access_desired;
223 q_c->sec_info = TALLOC_P( get_talloc_ctx(), uint32 );
224 *q_c->sec_info = DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION;
226 q_c->data = sec_buf;
227 q_c->ptr2 = 1;
228 init_buf_hdr(&q_c->hdr_sec, sec_buf->len, sec_buf->len);
229 q_c->ptr3 = 1;
230 q_c->unknown_2 = 0x00000000;
233 /*******************************************************************
234 Marshalls a registry key create request
235 ********************************************************************/
237 BOOL reg_io_q_create_key(const char *desc, REG_Q_CREATE_KEY *q_u,
238 prs_struct *ps, int depth)
240 if ( !q_u )
241 return False;
243 prs_debug(ps, depth, desc, "reg_io_q_create_key");
244 depth++;
246 if(!prs_align(ps))
247 return False;
249 if(!smb_io_pol_hnd("", &q_u->handle, ps, depth))
250 return False;
252 if(!prs_unistr4 ("name", ps, depth, &q_u->name))
253 return False;
254 if(!prs_align(ps))
255 return False;
257 if(!prs_unistr4 ("class", ps, depth, &q_u->class))
258 return False;
259 if(!prs_align(ps))
260 return False;
262 if(!prs_uint32("reserved", ps, depth, &q_u->reserved))
263 return False;
264 if(!prs_uint32("access", ps, depth, &q_u->access))
265 return False;
267 if(!prs_pointer("sec_info", ps, depth, (void**)&q_u->sec_info, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
268 return False;
270 if(!prs_uint32("ptr2", ps, depth, &q_u->ptr2))
271 return False;
272 if(!reg_io_hdrbuf_sec(q_u->ptr2, &q_u->ptr3, &q_u->hdr_sec, q_u->data,
273 ps, depth))
274 return False;
276 #if 0
277 if(!prs_uint32("unknown_2", ps, depth, &q_u->unknown_2))
278 return False;
279 #endif
281 return True;
284 /*******************************************************************
285 Unmarshalls a registry key create response
286 ********************************************************************/
288 BOOL reg_io_r_create_key(const char *desc, REG_R_CREATE_KEY *r_u,
289 prs_struct *ps, int depth)
291 if ( !r_u )
292 return False;
294 prs_debug(ps, depth, desc, "reg_io_r_create_key");
295 depth++;
297 if(!prs_align(ps))
298 return False;
300 if(!smb_io_pol_hnd("", &r_u->key_pol, ps, depth))
301 return False;
302 if(!prs_uint32("unknown", ps, depth, &r_u->unknown))
303 return False;
305 if(!prs_werror("status", ps, depth, &r_u->status))
306 return False;
308 return True;
312 /*******************************************************************
313 Inits a structure.
314 ********************************************************************/
316 void init_reg_q_delete_val(REG_Q_DELETE_VALUE *q_c, POLICY_HND *hnd,
317 char *name)
319 ZERO_STRUCTP(q_c);
321 memcpy(&q_c->handle, hnd, sizeof(q_c->handle));
322 init_unistr4(&q_c->name, name, UNI_STR_TERMINATE);
325 /*******************************************************************
326 reads or writes a structure.
327 ********************************************************************/
329 BOOL reg_io_q_delete_value(const char *desc, REG_Q_DELETE_VALUE *q_u,
330 prs_struct *ps, int depth)
332 if ( !q_u )
333 return False;
335 prs_debug(ps, depth, desc, "reg_io_q_delete_value");
336 depth++;
338 if(!prs_align(ps))
339 return False;
341 if(!smb_io_pol_hnd("", &q_u->handle, ps, depth))
342 return False;
344 if(!prs_unistr4("name", ps, depth, &q_u->name))
345 return False;
346 if(!prs_align(ps))
347 return False;
349 return True;
353 /*******************************************************************
354 reads or writes a structure.
355 ********************************************************************/
357 BOOL reg_io_r_delete_value(const char *desc, REG_R_DELETE_VALUE *r_u,
358 prs_struct *ps, int depth)
360 if ( !r_u )
361 return False;
363 prs_debug(ps, depth, desc, "reg_io_r_delete_value");
364 depth++;
366 if(!prs_align(ps))
367 return False;
369 if(!prs_werror("status", ps, depth, &r_u->status))
370 return False;
372 return True;
375 /*******************************************************************
376 Inits a structure.
377 ********************************************************************/
379 void init_reg_q_delete_key(REG_Q_DELETE_KEY *q_c, POLICY_HND *hnd,
380 char *name)
382 ZERO_STRUCTP(q_c);
384 memcpy(&q_c->handle, hnd, sizeof(q_c->handle));
386 init_unistr4(&q_c->name, name, UNI_STR_TERMINATE);
389 /*******************************************************************
390 reads or writes a structure.
391 ********************************************************************/
393 BOOL reg_io_q_delete_key(const char *desc, REG_Q_DELETE_KEY *q_u,
394 prs_struct *ps, int depth)
396 if ( !q_u )
397 return False;
399 prs_debug(ps, depth, desc, "reg_io_q_delete_key");
400 depth++;
402 if(!prs_align(ps))
403 return False;
405 if(!smb_io_pol_hnd("", &q_u->handle, ps, depth))
406 return False;
408 if(!prs_unistr4("", ps, depth, &q_u->name))
409 return False;
410 if(!prs_align(ps))
411 return False;
413 return True;
416 /*******************************************************************
417 reads or writes a structure.
418 ********************************************************************/
420 BOOL reg_io_r_delete_key(const char *desc, REG_R_DELETE_KEY *r_u, prs_struct *ps, int depth)
422 if ( !r_u )
423 return False;
425 prs_debug(ps, depth, desc, "reg_io_r_delete_key");
426 depth++;
428 if(!prs_align(ps))
429 return False;
431 if(!prs_werror("status", ps, depth, &r_u->status))
432 return False;
434 return True;
437 /*******************************************************************
438 Inits a structure.
439 ********************************************************************/
441 void init_reg_q_query_key(REG_Q_QUERY_KEY *q_o, POLICY_HND *hnd, const char *class)
443 ZERO_STRUCTP(q_o);
445 memcpy(&q_o->pol, hnd, sizeof(q_o->pol));
446 init_unistr4(&q_o->class, class, UNI_STR_TERMINATE);
449 /*******************************************************************
450 reads or writes a structure.
451 ********************************************************************/
453 BOOL reg_io_q_query_key(const char *desc, REG_Q_QUERY_KEY *q_u, prs_struct *ps, int depth)
455 if ( !q_u )
456 return False;
458 prs_debug(ps, depth, desc, "reg_io_q_query_key");
459 depth++;
461 if(!prs_align(ps))
462 return False;
464 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
465 return False;
466 if(!prs_unistr4("class", ps, depth, &q_u->class))
467 return False;
469 if(!prs_align(ps))
470 return False;
472 return True;
476 /*******************************************************************
477 reads or writes a structure.
478 ********************************************************************/
480 BOOL reg_io_r_query_key(const char *desc, REG_R_QUERY_KEY *r_u, prs_struct *ps, int depth)
482 if ( !r_u )
483 return False;
485 prs_debug(ps, depth, desc, "reg_io_r_query_key");
486 depth++;
488 if(!prs_align(ps))
489 return False;
491 if(!prs_unistr4("class", ps, depth, &r_u->class))
492 return False;
494 if(!prs_align(ps))
495 return False;
497 if(!prs_uint32("num_subkeys ", ps, depth, &r_u->num_subkeys))
498 return False;
499 if(!prs_uint32("max_subkeylen ", ps, depth, &r_u->max_subkeylen))
500 return False;
501 if(!prs_uint32("reserved ", ps, depth, &r_u->reserved))
502 return False;
503 if(!prs_uint32("num_values ", ps, depth, &r_u->num_values))
504 return False;
505 if(!prs_uint32("max_valnamelen", ps, depth, &r_u->max_valnamelen))
506 return False;
507 if(!prs_uint32("max_valbufsize", ps, depth, &r_u->max_valbufsize))
508 return False;
509 if(!prs_uint32("sec_desc ", ps, depth, &r_u->sec_desc))
510 return False;
511 if(!smb_io_time("mod_time ", &r_u->mod_time, ps, depth))
512 return False;
514 if(!prs_werror("status", ps, depth, &r_u->status))
515 return False;
517 return True;
520 /*******************************************************************
521 Inits a structure.
522 ********************************************************************/
524 void init_reg_q_getversion(REG_Q_GETVERSION *q_o, POLICY_HND *hnd)
526 memcpy(&q_o->pol, hnd, sizeof(q_o->pol));
530 /*******************************************************************
531 reads or writes a structure.
532 ********************************************************************/
534 BOOL reg_io_q_getversion(const char *desc, REG_Q_GETVERSION *q_u, prs_struct *ps, int depth)
536 if ( !q_u )
537 return False;
539 prs_debug(ps, depth, desc, "reg_io_q_getversion");
540 depth++;
542 if(!prs_align(ps))
543 return False;
545 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
546 return False;
548 return True;
551 /*******************************************************************
552 reads or writes a structure.
553 ********************************************************************/
555 BOOL reg_io_r_getversion(const char *desc, REG_R_GETVERSION *r_u, prs_struct *ps, int depth)
557 if ( !r_u )
558 return False;
560 prs_debug(ps, depth, desc, "reg_io_r_getversion");
561 depth++;
563 if(!prs_align(ps))
564 return False;
566 if(!prs_uint32("win_version", ps, depth, &r_u->win_version))
567 return False;
568 if(!prs_werror("status" , ps, depth, &r_u->status))
569 return False;
571 return True;
575 /*******************************************************************
576 reads or writes a structure.
577 ********************************************************************/
579 BOOL reg_io_q_restore_key(const char *desc, REG_Q_RESTORE_KEY *q_u, prs_struct *ps, int depth)
581 if ( !q_u )
582 return False;
584 prs_debug(ps, depth, desc, "reg_io_q_restore_key");
585 depth++;
587 if(!prs_align(ps))
588 return False;
590 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
591 return False;
593 if(!prs_unistr4("filename", ps, depth, &q_u->filename))
594 return False;
596 if(!prs_uint32("flags", ps, depth, &q_u->flags))
597 return False;
599 return True;
602 /*******************************************************************
603 reads or writes a structure.
604 ********************************************************************/
606 BOOL reg_io_r_restore_key(const char *desc, REG_R_RESTORE_KEY *r_u, prs_struct *ps, int depth)
608 if ( !r_u )
609 return False;
611 prs_debug(ps, depth, desc, "reg_io_r_restore_key");
612 depth++;
614 if(!prs_align(ps))
615 return False;
617 if(!prs_werror("status" , ps, depth, &r_u->status))
618 return False;
620 return True;
623 /*******************************************************************
624 ********************************************************************/
626 void init_q_reg_save_key( REG_Q_SAVE_KEY *q_u, POLICY_HND *handle, const char *fname )
628 memcpy(&q_u->pol, handle, sizeof(q_u->pol));
629 init_unistr4( &q_u->filename, fname, UNI_STR_TERMINATE );
630 q_u->sec_attr = NULL;
633 /*******************************************************************
634 reads or writes a structure.
635 ********************************************************************/
637 BOOL reg_io_q_save_key(const char *desc, REG_Q_SAVE_KEY *q_u, prs_struct *ps, int depth)
639 if ( !q_u )
640 return False;
642 prs_debug(ps, depth, desc, "reg_io_q_save_key");
643 depth++;
645 if(!prs_align(ps))
646 return False;
648 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
649 return False;
651 if(!prs_unistr4("filename", ps, depth, &q_u->filename))
652 return False;
654 #if 0 /* reg_io_sec_attr() */
655 if(!prs_uint32("unknown", ps, depth, &q_u->unknown))
656 return False;
657 #endif
659 return True;
662 /*******************************************************************
663 reads or writes a structure.
664 ********************************************************************/
666 BOOL reg_io_r_save_key(const char *desc, REG_R_SAVE_KEY *r_u, prs_struct *ps, int depth)
668 if ( !r_u )
669 return False;
671 prs_debug(ps, depth, desc, "reg_io_r_save_key");
672 depth++;
674 if(!prs_align(ps))
675 return False;
677 if(!prs_werror("status" , ps, depth, &r_u->status))
678 return False;
680 return True;
683 /*******************************************************************
684 Inits an REG_Q_CLOSE structure.
685 ********************************************************************/
687 void init_reg_q_close(REG_Q_CLOSE *q_c, POLICY_HND *hnd)
689 DEBUG(5,("init_reg_q_close\n"));
691 memcpy(&q_c->pol, hnd, sizeof(q_c->pol));
694 /*******************************************************************
695 reads or writes a structure.
696 ********************************************************************/
698 BOOL reg_io_q_close(const char *desc, REG_Q_CLOSE *q_u, prs_struct *ps, int depth)
700 if (q_u == NULL)
701 return False;
703 prs_debug(ps, depth, desc, "reg_io_q_close");
704 depth++;
706 if(!prs_align(ps))
707 return False;
709 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
710 return False;
711 if(!prs_align(ps))
712 return False;
714 return True;
717 /*******************************************************************
718 reads or writes a structure.
719 ********************************************************************/
721 BOOL reg_io_r_close(const char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth)
723 if ( !r_u )
724 return False;
726 prs_debug(ps, depth, desc, "reg_io_r_close");
727 depth++;
729 if(!prs_align(ps))
730 return False;
732 if(!smb_io_pol_hnd("", &r_u->pol, ps, depth))
733 return False;
734 if(!prs_align(ps))
735 return False;
737 if(!prs_werror("status", ps, depth, &r_u->status))
738 return False;
740 return True;
743 /*******************************************************************
744 makes a structure.
745 ********************************************************************/
747 void init_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_u, POLICY_HND *pol,
748 uint32 sec_info, SEC_DESC_BUF *sec_desc_buf)
750 memcpy(&q_u->pol, pol, sizeof(q_u->pol));
752 q_u->sec_info = sec_info;
754 q_u->ptr = 1;
755 init_buf_hdr(&q_u->hdr_sec, sec_desc_buf->len, sec_desc_buf->len);
756 q_u->data = sec_desc_buf;
759 /*******************************************************************
760 reads or writes a structure.
761 ********************************************************************/
763 BOOL reg_io_q_set_key_sec(const char *desc, REG_Q_SET_KEY_SEC *q_u, prs_struct *ps, int depth)
765 if ( !q_u )
766 return False;
768 prs_debug(ps, depth, desc, "reg_io_q_set_key_sec");
769 depth++;
771 if(!prs_align(ps))
772 return False;
774 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
775 return False;
777 if(!prs_uint32("sec_info", ps, depth, &q_u->sec_info))
778 return False;
779 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
780 return False;
782 if(!reg_io_hdrbuf_sec(q_u->ptr, NULL, &q_u->hdr_sec, q_u->data, ps, depth))
783 return False;
785 return True;
788 /*******************************************************************
789 reads or writes a structure.
790 ********************************************************************/
792 BOOL reg_io_r_set_key_sec(const char *desc, REG_R_SET_KEY_SEC *q_u, prs_struct *ps, int depth)
794 if ( !q_u )
795 return False;
797 prs_debug(ps, depth, desc, "reg_io_r_set_key_sec");
798 depth++;
800 if(!prs_align(ps))
801 return False;
803 if(!prs_werror("status", ps, depth, &q_u->status))
804 return False;
806 return True;
810 /*******************************************************************
811 makes a structure.
812 ********************************************************************/
814 void init_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_u, POLICY_HND *pol,
815 uint32 sec_info, uint32 sec_buf_size,
816 SEC_DESC_BUF *psdb)
818 memcpy(&q_u->pol, pol, sizeof(q_u->pol));
820 q_u->sec_info = sec_info;
822 q_u->ptr = psdb != NULL ? 1 : 0;
823 q_u->data = psdb;
825 init_buf_hdr(&q_u->hdr_sec, sec_buf_size, 0);
828 /*******************************************************************
829 reads or writes a structure.
830 ********************************************************************/
832 BOOL reg_io_q_get_key_sec(const char *desc, REG_Q_GET_KEY_SEC *q_u, prs_struct *ps, int depth)
834 if ( !q_u )
835 return False;
837 prs_debug(ps, depth, desc, "reg_io_q_get_key_sec");
838 depth++;
840 if(!prs_align(ps))
841 return False;
843 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
844 return False;
846 if(!prs_uint32("sec_info", ps, depth, &q_u->sec_info))
847 return False;
848 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
849 return False;
851 if(!reg_io_hdrbuf_sec(q_u->ptr, NULL, &q_u->hdr_sec, q_u->data, ps, depth))
852 return False;
854 return True;
857 #if 0
858 /*******************************************************************
859 makes a structure.
860 ********************************************************************/
861 void init_reg_r_get_key_sec(REG_R_GET_KEY_SEC *r_i, POLICY_HND *pol,
862 uint32 buf_len, uint8 *buf,
863 NTSTATUS status)
865 r_i->ptr = 1;
866 init_buf_hdr(&r_i->hdr_sec, buf_len, buf_len);
867 init_sec_desc_buf(r_i->data, buf_len, 1);
869 r_i->status = status; /* 0x0000 0000 or 0x0000 007a */
871 #endif
873 /*******************************************************************
874 reads or writes a structure.
875 ********************************************************************/
877 BOOL reg_io_r_get_key_sec(const char *desc, REG_R_GET_KEY_SEC *q_u, prs_struct *ps, int depth)
879 if ( !q_u )
880 return False;
882 prs_debug(ps, depth, desc, "reg_io_r_get_key_sec");
883 depth++;
885 if(!prs_align(ps))
886 return False;
888 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
889 return False;
891 if (q_u->ptr != 0) {
892 if(!smb_io_hdrbuf("", &q_u->hdr_sec, ps, depth))
893 return False;
894 if(!sec_io_desc_buf("", &q_u->data, ps, depth))
895 return False;
896 if(!prs_align(ps))
897 return False;
900 if(!prs_werror("status", ps, depth, &q_u->status))
901 return False;
903 return True;
906 /*******************************************************************
907 makes a structure.
908 ********************************************************************/
910 BOOL init_reg_q_info(REG_Q_INFO *q_u, POLICY_HND *pol, const char *val_name,
911 REGVAL_BUFFER *value_output)
913 if (q_u == NULL)
914 return False;
916 q_u->pol = *pol;
918 init_unistr4(&q_u->name, val_name, UNI_STR_TERMINATE);
920 q_u->ptr_reserved = 1;
921 q_u->ptr_buf = 1;
923 q_u->ptr_bufsize = 1;
924 q_u->bufsize = value_output->buf_max_len;
925 q_u->buf_unk = 0;
927 q_u->unk1 = 0;
928 q_u->ptr_buflen = 1;
929 q_u->buflen = value_output->buf_max_len;
931 q_u->ptr_buflen2 = 1;
932 q_u->buflen2 = 0;
934 return True;
937 /*******************************************************************
938 reads or writes a structure.
939 ********************************************************************/
941 BOOL reg_io_q_info(const char *desc, REG_Q_INFO *q_u, prs_struct *ps, int depth)
943 if ( !q_u )
944 return False;
946 prs_debug(ps, depth, desc, "reg_io_q_info");
947 depth++;
949 if(!prs_align(ps))
950 return False;
952 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
953 return False;
954 if(!prs_unistr4("name", ps, depth, &q_u->name))
955 return False;
957 if(!prs_align(ps))
958 return False;
960 if(!prs_uint32("ptr_reserved", ps, depth, &(q_u->ptr_reserved)))
961 return False;
963 if(!prs_uint32("ptr_buf", ps, depth, &(q_u->ptr_buf)))
964 return False;
966 if(q_u->ptr_buf) {
967 if(!prs_uint32("ptr_bufsize", ps, depth, &(q_u->ptr_bufsize)))
968 return False;
969 if(!prs_uint32("bufsize", ps, depth, &(q_u->bufsize)))
970 return False;
971 if(!prs_uint32("buf_unk", ps, depth, &(q_u->buf_unk)))
972 return False;
975 if(!prs_uint32("unk1", ps, depth, &(q_u->unk1)))
976 return False;
978 if(!prs_uint32("ptr_buflen", ps, depth, &(q_u->ptr_buflen)))
979 return False;
981 if (q_u->ptr_buflen) {
982 if(!prs_uint32("buflen", ps, depth, &(q_u->buflen)))
983 return False;
984 if(!prs_uint32("ptr_buflen2", ps, depth, &(q_u->ptr_buflen2)))
985 return False;
986 if(!prs_uint32("buflen2", ps, depth, &(q_u->buflen2)))
987 return False;
990 return True;
993 /*******************************************************************
994 Inits a structure.
995 New version to replace older init_reg_r_info()
996 ********************************************************************/
998 BOOL init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_u,
999 REGISTRY_VALUE *val, WERROR status)
1001 uint32 buf_len = 0;
1002 REGVAL_BUFFER buf2;
1004 if( !r_u || !val )
1005 return False;
1007 r_u->type = TALLOC_P( get_talloc_ctx(), uint32 );
1008 *r_u->type = val->type;
1010 buf_len = reg_init_regval_buffer( &buf2, val );
1012 r_u->buf_max_len = TALLOC_P( get_talloc_ctx(), uint32 );
1013 *r_u->buf_max_len = buf_len;
1015 r_u->buf_len = TALLOC_P( get_talloc_ctx(), uint32 );
1016 *r_u->buf_len = buf_len;
1018 /* if include_keyval is not set, don't send the key value, just
1019 the buflen data. probably used by NT5 to allocate buffer space - SK */
1021 if ( include_keyval ) {
1022 r_u->value = TALLOC_P( get_talloc_ctx(), REGVAL_BUFFER );
1023 /* steal the memory */
1024 *r_u->value = buf2;
1027 r_u->status = status;
1029 return True;
1032 /*******************************************************************
1033 reads or writes a structure.
1034 ********************************************************************/
1036 BOOL reg_io_r_info(const char *desc, REG_R_INFO *r_u, prs_struct *ps, int depth)
1038 if ( !r_u )
1039 return False;
1041 prs_debug(ps, depth, desc, "reg_io_r_info");
1042 depth++;
1044 if(!prs_align(ps))
1045 return False;
1047 if ( !prs_pointer("type", ps, depth, (void**)&r_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1048 return False;
1050 if ( !prs_pointer("value", ps, depth, (void**)&r_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer))
1051 return False;
1052 if(!prs_align(ps))
1053 return False;
1055 if ( !prs_pointer("buf_max_len", ps, depth, (void**)&r_u->buf_max_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1056 return False;
1057 if ( !prs_pointer("buf_len", ps, depth, (void**)&r_u->buf_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1058 return False;
1060 if(!prs_werror("status", ps, depth, &r_u->status))
1061 return False;
1063 return True;
1066 /*******************************************************************
1067 makes a structure.
1068 ********************************************************************/
1070 void init_reg_q_enum_val(REG_Q_ENUM_VALUE *q_u, POLICY_HND *pol,
1071 uint32 val_idx,
1072 uint32 max_name_len, uint32 max_buf_len)
1074 ZERO_STRUCTP(q_u);
1076 memcpy(&q_u->pol, pol, sizeof(q_u->pol));
1078 q_u->val_index = val_idx;
1080 q_u->name.size = max_name_len*2;
1081 q_u->name.string = TALLOC_ZERO_P( get_talloc_ctx(), UNISTR2 );
1082 q_u->name.string->uni_max_len = max_name_len;
1084 q_u->type = TALLOC_P( get_talloc_ctx(), uint32 );
1085 *q_u->type = 0x0;
1087 q_u->value = TALLOC_ZERO_P( get_talloc_ctx(), REGVAL_BUFFER );
1088 q_u->value->buf_max_len = max_buf_len;
1090 q_u->buffer_len = TALLOC_P( get_talloc_ctx(), uint32 );
1091 *q_u->buffer_len = max_buf_len;
1093 q_u->name_len = TALLOC_P( get_talloc_ctx(), uint32 );
1094 *q_u->name_len = 0x0;
1097 /*******************************************************************
1098 makes a structure.
1099 ********************************************************************/
1101 void init_reg_r_enum_val(REG_R_ENUM_VALUE *r_u, REGISTRY_VALUE *val )
1103 uint32 real_size;
1105 ZERO_STRUCTP(r_u);
1107 /* value name */
1109 DEBUG(10,("init_reg_r_enum_val: Valuename => [%s]\n", val->valuename));
1111 init_unistr4( &r_u->name, val->valuename, UNI_STR_TERMINATE);
1113 /* type */
1115 r_u->type = TALLOC_P( get_talloc_ctx(), uint32 );
1116 *r_u->type = val->type;
1118 /* REG_SZ & REG_MULTI_SZ must be converted to UNICODE */
1120 r_u->value = TALLOC_P( get_talloc_ctx(), REGVAL_BUFFER );
1121 real_size = reg_init_regval_buffer( r_u->value, val );
1123 /* lengths */
1125 r_u->buffer_len1 = TALLOC_P( get_talloc_ctx(), uint32 );
1126 *r_u->buffer_len1 = real_size;
1127 r_u->buffer_len2 = TALLOC_P( get_talloc_ctx(), uint32 );
1128 *r_u->buffer_len2 = real_size;
1131 /*******************************************************************
1132 reads or writes a structure.
1133 ********************************************************************/
1135 BOOL reg_io_q_enum_val(const char *desc, REG_Q_ENUM_VALUE *q_u, prs_struct *ps, int depth)
1137 if (q_u == NULL)
1138 return False;
1140 prs_debug(ps, depth, desc, "reg_io_q_enum_val");
1141 depth++;
1143 if(!prs_align(ps))
1144 return False;
1146 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
1147 return False;
1149 if(!prs_uint32("val_index", ps, depth, &q_u->val_index))
1150 return False;
1152 if(!prs_unistr4("name", ps, depth, &q_u->name ))
1153 return False;
1154 if(!prs_align(ps))
1155 return False;
1157 if(!prs_pointer("type", ps, depth, (void**)&q_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1158 return False;
1160 if ( !prs_pointer("value", ps, depth, (void**)&q_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer))
1161 return False;
1162 if(!prs_align(ps))
1163 return False;
1165 if(!prs_pointer("buffer_len", ps, depth, (void**)&q_u->buffer_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1166 return False;
1167 if(!prs_pointer("name_len", ps, depth, (void**)&q_u->name_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1168 return False;
1170 return True;
1173 /*******************************************************************
1174 reads or writes a structure.
1175 ********************************************************************/
1177 BOOL reg_io_r_enum_val(const char *desc, REG_R_ENUM_VALUE *r_u, prs_struct *ps, int depth)
1179 if ( !r_u )
1180 return False;
1182 prs_debug(ps, depth, desc, "reg_io_r_enum_val");
1183 depth++;
1185 if(!prs_align(ps))
1186 return False;
1188 if(!prs_unistr4("name", ps, depth, &r_u->name ))
1189 return False;
1190 if(!prs_align(ps))
1191 return False;
1193 if(!prs_pointer("type", ps, depth, (void**)&r_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1194 return False;
1196 if ( !prs_pointer("value", ps, depth, (void**)&r_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer))
1197 return False;
1198 if(!prs_align(ps))
1199 return False;
1201 if(!prs_pointer("buffer_len1", ps, depth, (void**)&r_u->buffer_len1, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1202 return False;
1203 if(!prs_pointer("buffer_len2", ps, depth, (void**)&r_u->buffer_len2, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1204 return False;
1206 if(!prs_werror("status", ps, depth, &r_u->status))
1207 return False;
1209 return True;
1212 /*******************************************************************
1213 makes a structure.
1214 ********************************************************************/
1216 void init_reg_q_set_val(REG_Q_SET_VALUE *q_u, POLICY_HND *pol,
1217 char *val_name, uint32 type,
1218 RPC_DATA_BLOB *val)
1220 ZERO_STRUCTP(q_u);
1222 memcpy(&q_u->pol, pol, sizeof(q_u->pol));
1224 init_unistr4(&q_u->name, val_name, UNI_STR_TERMINATE);
1226 q_u->type = type;
1227 q_u->value = *val;
1228 q_u->size = val->buf_len;
1231 /*******************************************************************
1232 reads or writes a structure.
1233 ********************************************************************/
1235 BOOL reg_io_q_set_value(const char *desc, REG_Q_SET_VALUE *q_u, prs_struct *ps, int depth)
1237 if (q_u == NULL)
1238 return False;
1240 prs_debug(ps, depth, desc, "reg_io_q_set_value");
1241 depth++;
1243 if(!prs_align(ps))
1244 return False;
1246 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
1247 return False;
1249 if(!prs_unistr4("name", ps, depth, &q_u->name ))
1250 return False;
1251 if(!prs_align(ps))
1252 return False;
1254 if(!prs_uint32("type", ps, depth, &q_u->type))
1255 return False;
1257 if(!smb_io_rpc_blob("value", &q_u->value, ps, depth ))
1258 return False;
1259 if(!prs_align(ps))
1260 return False;
1262 if(!prs_uint32("size", ps, depth, &q_u->size))
1263 return False;
1265 return True;
1268 /*******************************************************************
1269 reads or writes a structure.
1270 ********************************************************************/
1272 BOOL reg_io_r_set_value(const char *desc, REG_R_SET_VALUE *q_u, prs_struct *ps, int depth)
1274 if ( !q_u )
1275 return False;
1277 prs_debug(ps, depth, desc, "reg_io_r_set_value");
1278 depth++;
1280 if(!prs_align(ps))
1281 return False;
1283 if(!prs_werror("status", ps, depth, &q_u->status))
1284 return False;
1286 return True;
1289 /*******************************************************************
1290 makes a structure.
1291 ********************************************************************/
1293 void init_reg_q_enum_key(REG_Q_ENUM_KEY *q_u, POLICY_HND *pol, uint32 key_idx)
1295 memcpy(&q_u->pol, pol, sizeof(q_u->pol));
1297 q_u->key_index = key_idx;
1298 q_u->key_name_len = 0;
1299 q_u->unknown_1 = 0x0414;
1301 q_u->ptr1 = 1;
1302 q_u->unknown_2 = 0x0000020A;
1303 memset(q_u->pad1, 0, sizeof(q_u->pad1));
1305 q_u->ptr2 = 1;
1306 memset(q_u->pad2, 0, sizeof(q_u->pad2));
1308 q_u->ptr3 = 1;
1309 unix_to_nt_time(&q_u->time, 0); /* current time? */
1312 /*******************************************************************
1313 makes a reply structure.
1314 ********************************************************************/
1316 void init_reg_r_enum_key(REG_R_ENUM_KEY *r_u, char *subkey )
1318 if ( !r_u )
1319 return;
1321 init_unistr4( &r_u->keyname, subkey, STR_TERMINATE );
1322 r_u->classname = TALLOC_ZERO_P( get_talloc_ctx(), UNISTR4 );
1323 r_u->time = TALLOC_ZERO_P( get_talloc_ctx(), NTTIME );
1326 /*******************************************************************
1327 reads or writes a structure.
1328 ********************************************************************/
1330 BOOL reg_io_q_enum_key(const char *desc, REG_Q_ENUM_KEY *q_u, prs_struct *ps, int depth)
1332 if (q_u == NULL)
1333 return False;
1335 prs_debug(ps, depth, desc, "reg_io_q_enum_key");
1336 depth++;
1338 if(!prs_align(ps))
1339 return False;
1341 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
1342 return False;
1344 if(!prs_uint32("key_index", ps, depth, &q_u->key_index))
1345 return False;
1346 if(!prs_uint16("key_name_len", ps, depth, &q_u->key_name_len))
1347 return False;
1348 if(!prs_uint16("unknown_1", ps, depth, &q_u->unknown_1))
1349 return False;
1351 if(!prs_uint32("ptr1", ps, depth, &q_u->ptr1))
1352 return False;
1354 if (q_u->ptr1 != 0) {
1355 if(!prs_uint32("unknown_2", ps, depth, &q_u->unknown_2))
1356 return False;
1357 if(!prs_uint8s(False, "pad1", ps, depth, q_u->pad1, sizeof(q_u->pad1)))
1358 return False;
1361 if(!prs_uint32("ptr2", ps, depth, &q_u->ptr2))
1362 return False;
1364 if (q_u->ptr2 != 0) {
1365 if(!prs_uint8s(False, "pad2", ps, depth, q_u->pad2, sizeof(q_u->pad2)))
1366 return False;
1369 if(!prs_uint32("ptr3", ps, depth, &q_u->ptr3))
1370 return False;
1372 if (q_u->ptr3 != 0) {
1373 if(!smb_io_time("", &q_u->time, ps, depth))
1374 return False;
1377 return True;
1380 /*******************************************************************
1381 reads or writes a structure.
1382 ********************************************************************/
1384 BOOL reg_io_r_enum_key(const char *desc, REG_R_ENUM_KEY *q_u, prs_struct *ps, int depth)
1386 if ( !q_u )
1387 return False;
1389 prs_debug(ps, depth, desc, "reg_io_r_enum_key");
1390 depth++;
1392 if(!prs_align(ps))
1393 return False;
1394 if ( !prs_unistr4( "keyname", ps, depth, &q_u->keyname ) )
1395 return False;
1397 if(!prs_align(ps))
1398 return False;
1399 if (!prs_pointer("class", ps, depth, (void**)&q_u->classname, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4))
1400 return False;
1402 if(!prs_align(ps))
1403 return False;
1404 if (!prs_pointer("time", ps, depth, (void**)&q_u->time, sizeof(NTTIME), (PRS_POINTER_CAST)smb_io_nttime))
1405 return False;
1407 if(!prs_align(ps))
1408 return False;
1409 if(!prs_werror("status", ps, depth, &q_u->status))
1410 return False;
1412 return True;
1415 /*******************************************************************
1416 makes a structure.
1417 ********************************************************************/
1419 void init_reg_q_open_entry(REG_Q_OPEN_ENTRY *q_u, POLICY_HND *pol,
1420 char *key_name, uint32 access_desired)
1422 memcpy(&q_u->pol, pol, sizeof(q_u->pol));
1424 init_unistr4(&q_u->name, key_name, UNI_STR_TERMINATE);
1426 q_u->unknown_0 = 0x00000000;
1427 q_u->access = access_desired;
1430 /*******************************************************************
1431 reads or writes a structure.
1432 ********************************************************************/
1434 BOOL reg_io_q_open_entry(const char *desc, REG_Q_OPEN_ENTRY *q_u, prs_struct *ps, int depth)
1436 if ( !q_u )
1437 return False;
1439 prs_debug(ps, depth, desc, "reg_io_q_open_entry");
1440 depth++;
1442 if(!prs_align(ps))
1443 return False;
1445 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
1446 return False;
1447 if(!prs_unistr4("name", ps, depth, &q_u->name))
1448 return False;
1450 if(!prs_align(ps))
1451 return False;
1453 if(!prs_uint32("unknown_0 ", ps, depth, &q_u->unknown_0))
1454 return False;
1455 if(!prs_uint32("access", ps, depth, &q_u->access))
1456 return False;
1458 return True;
1461 /*******************************************************************
1462 Inits a structure.
1463 ********************************************************************/
1465 void init_reg_r_open_entry(REG_R_OPEN_ENTRY *r_u,
1466 POLICY_HND *pol, WERROR werr)
1468 if (W_ERROR_IS_OK(werr)) {
1469 memcpy(&r_u->pol, pol, sizeof(r_u->pol));
1470 } else {
1471 ZERO_STRUCT(r_u->pol);
1473 r_u->status = werr;
1476 /*******************************************************************
1477 reads or writes a structure.
1478 ********************************************************************/
1480 BOOL reg_io_r_open_entry(const char *desc, REG_R_OPEN_ENTRY *r_u, prs_struct *ps, int depth)
1482 if ( !r_u )
1483 return False;
1485 prs_debug(ps, depth, desc, "reg_io_r_open_entry");
1486 depth++;
1488 if(!prs_align(ps))
1489 return False;
1491 if(!smb_io_pol_hnd("", &r_u->pol, ps, depth))
1492 return False;
1494 if(!prs_werror("status", ps, depth, &r_u->status))
1495 return False;
1497 return True;
1500 /*******************************************************************
1501 Inits a structure.
1502 ********************************************************************/
1504 void init_reg_q_shutdown(REG_Q_SHUTDOWN *q_u, const char *msg,
1505 uint32 timeout, BOOL do_reboot, BOOL force)
1507 q_u->server = TALLOC_P( get_talloc_ctx(), uint16 );
1508 *q_u->server = 0x1;
1510 q_u->message = TALLOC_P( get_talloc_ctx(), UNISTR4 );
1511 init_unistr4( q_u->message, msg, UNI_FLAGS_NONE );
1513 q_u->timeout = timeout;
1515 q_u->reboot = do_reboot ? 1 : 0;
1516 q_u->force = force ? 1 : 0;
1519 /*******************************************************************
1520 Inits a REG_Q_SHUTDOWN_EX structure.
1521 ********************************************************************/
1523 void init_reg_q_shutdown_ex(REG_Q_SHUTDOWN_EX * q_u_ex, const char *msg,
1524 uint32 timeout, BOOL do_reboot, BOOL force, uint32 reason)
1526 REG_Q_SHUTDOWN q_u;
1528 ZERO_STRUCT( q_u );
1530 init_reg_q_shutdown( &q_u, msg, timeout, do_reboot, force );
1532 /* steal memory */
1534 q_u_ex->server = q_u.server;
1535 q_u_ex->message = q_u.message;
1537 q_u_ex->reboot = q_u.reboot;
1538 q_u_ex->force = q_u.force;
1540 q_u_ex->reason = reason;
1543 /*******************************************************************
1544 reads or writes a structure.
1545 ********************************************************************/
1547 BOOL reg_io_q_shutdown(const char *desc, REG_Q_SHUTDOWN *q_u, prs_struct *ps,
1548 int depth)
1550 if ( !q_u )
1551 return False;
1553 prs_debug(ps, depth, desc, "reg_io_q_shutdown");
1554 depth++;
1556 if (!prs_align(ps))
1557 return False;
1559 if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16))
1560 return False;
1562 if (!prs_pointer("message", ps, depth, (void**)&q_u->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4))
1563 return False;
1565 if (!prs_align(ps))
1566 return False;
1568 if (!prs_uint32("timeout", ps, depth, &(q_u->timeout)))
1569 return False;
1571 if (!prs_uint8("force ", ps, depth, &(q_u->force)))
1572 return False;
1573 if (!prs_uint8("reboot ", ps, depth, &(q_u->reboot)))
1574 return False;
1577 return True;
1580 /*******************************************************************
1581 reads or writes a structure.
1582 ********************************************************************/
1583 BOOL reg_io_r_shutdown(const char *desc, REG_R_SHUTDOWN *r_u, prs_struct *ps,
1584 int depth)
1586 if ( !r_u )
1587 return False;
1589 prs_debug(ps, depth, desc, "reg_io_r_shutdown");
1590 depth++;
1592 if(!prs_align(ps))
1593 return False;
1595 if(!prs_werror("status", ps, depth, &r_u->status))
1596 return False;
1598 return True;
1601 /*******************************************************************
1602 reads or writes a REG_Q_SHUTDOWN_EX structure.
1603 ********************************************************************/
1605 BOOL reg_io_q_shutdown_ex(const char *desc, REG_Q_SHUTDOWN_EX *q_u, prs_struct *ps,
1606 int depth)
1608 if ( !q_u )
1609 return False;
1611 prs_debug(ps, depth, desc, "reg_io_q_shutdown_ex");
1612 depth++;
1614 if (!prs_align(ps))
1615 return False;
1617 if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16))
1618 return False;
1620 if (!prs_pointer("message", ps, depth, (void**)&q_u->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4))
1621 return False;
1623 if (!prs_align(ps))
1624 return False;
1626 if (!prs_uint32("timeout", ps, depth, &(q_u->timeout)))
1627 return False;
1629 if (!prs_uint8("force ", ps, depth, &(q_u->force)))
1630 return False;
1631 if (!prs_uint8("reboot ", ps, depth, &(q_u->reboot)))
1632 return False;
1634 if (!prs_align(ps))
1635 return False;
1636 if (!prs_uint32("reason", ps, depth, &(q_u->reason)))
1637 return False;
1640 return True;
1643 /*******************************************************************
1644 reads or writes a REG_R_SHUTDOWN_EX structure.
1645 ********************************************************************/
1646 BOOL reg_io_r_shutdown_ex(const char *desc, REG_R_SHUTDOWN_EX *r_u, prs_struct *ps,
1647 int depth)
1649 if ( !r_u )
1650 return False;
1652 prs_debug(ps, depth, desc, "reg_io_r_shutdown_ex");
1653 depth++;
1655 if(!prs_align(ps))
1656 return False;
1658 if(!prs_werror("status", ps, depth, &r_u->status))
1659 return False;
1661 return True;
1666 /*******************************************************************
1667 Inits a structure.
1668 ********************************************************************/
1669 void init_reg_q_abort_shutdown(REG_Q_ABORT_SHUTDOWN *q_u)
1671 q_u->server = TALLOC_P( get_talloc_ctx(), uint16 );
1672 *q_u->server = 0x1;
1675 /*******************************************************************
1676 reads or writes a structure.
1677 ********************************************************************/
1678 BOOL reg_io_q_abort_shutdown(const char *desc, REG_Q_ABORT_SHUTDOWN *q_u,
1679 prs_struct *ps, int depth)
1681 if ( !q_u )
1682 return False;
1684 prs_debug(ps, depth, desc, "reg_io_q_abort_shutdown");
1685 depth++;
1687 if (!prs_align(ps))
1688 return False;
1690 if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16))
1691 return False;
1693 return True;
1696 /*******************************************************************
1697 reads or writes a structure.
1698 ********************************************************************/
1699 BOOL reg_io_r_abort_shutdown(const char *desc, REG_R_ABORT_SHUTDOWN *r_u,
1700 prs_struct *ps, int depth)
1702 if ( !r_u )
1703 return False;
1705 prs_debug(ps, depth, desc, "reg_io_r_abort_shutdown");
1706 depth++;
1708 if (!prs_align(ps))
1709 return False;
1711 if (!prs_werror("status", ps, depth, &r_u->status))
1712 return False;
1714 return True;