r6369: update release notes
[Samba.git] / source / rpc_parse / parse_reg.c
bloba51b4269e3ad8c85981f8ae020805b335e4a8789
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_uint32("access", ps, depth, &q_u->access))
79 return False;
81 return True;
85 /*******************************************************************
86 Unmarshalls a hive connect response
87 ********************************************************************/
89 BOOL reg_io_r_open_hive(const char *desc, REG_R_OPEN_HIVE *r_u,
90 prs_struct *ps, int depth)
92 if ( !r_u )
93 return False;
95 prs_debug(ps, depth, desc, "reg_io_r_open_hive");
96 depth++;
98 if(!prs_align(ps))
99 return False;
101 if(!smb_io_pol_hnd("", &r_u->pol, ps, depth))
102 return False;
104 if(!prs_werror("status", ps, depth, &r_u->status))
105 return False;
107 return True;
110 /*******************************************************************
111 Inits a structure.
112 ********************************************************************/
114 void init_reg_q_flush_key(REG_Q_FLUSH_KEY *q_u, POLICY_HND *pol)
116 memcpy(&q_u->pol, pol, sizeof(q_u->pol));
119 /*******************************************************************
120 reads or writes a structure.
121 ********************************************************************/
123 BOOL reg_io_q_flush_key(const char *desc, REG_Q_FLUSH_KEY *q_u, prs_struct *ps, int depth)
125 if ( !q_u )
126 return False;
128 prs_debug(ps, depth, desc, "reg_io_q_flush_key");
129 depth++;
131 if(!prs_align(ps))
132 return False;
134 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
135 return False;
137 return True;
140 /*******************************************************************
141 Unmarshalls a registry key flush response
142 ********************************************************************/
144 BOOL reg_io_r_flush_key(const char *desc, REG_R_FLUSH_KEY *r_u,
145 prs_struct *ps, int depth)
147 if ( !r_u )
148 return False;
150 prs_debug(ps, depth, desc, "reg_io_r_flush_key");
151 depth++;
153 if(!prs_align(ps))
154 return False;
156 if(!prs_werror("status", ps, depth, &r_u->status))
157 return False;
159 return True;
162 /*******************************************************************
163 reads or writes SEC_DESC_BUF and SEC_DATA structures.
164 ********************************************************************/
166 static BOOL reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec,
167 SEC_DESC_BUF *data, prs_struct *ps, int depth)
169 if (ptr != 0) {
170 uint32 hdr_offset;
171 uint32 old_offset;
172 if(!smb_io_hdrbuf_pre("hdr_sec", hdr_sec, ps, depth,
173 &hdr_offset))
174 return False;
176 old_offset = prs_offset(ps);
178 if (ptr3 != NULL) {
179 if(!prs_uint32("ptr3", ps, depth, ptr3))
180 return False;
183 if (ptr3 == NULL || *ptr3 != 0) {
184 /* JRA - this next line is probably wrong... */
185 if(!sec_io_desc_buf("data ", &data, ps, depth))
186 return False;
189 if(!smb_io_hdrbuf_post("hdr_sec", hdr_sec, ps, depth,
190 hdr_offset, data->max_len, data->len))
191 return False;
192 if(!prs_set_offset(ps, old_offset + data->len +
193 sizeof(uint32) * ((ptr3 != NULL) ? 5 : 3)))
194 return False;
196 if(!prs_align(ps))
197 return False;
200 return True;
203 /*******************************************************************
204 Inits a registry key create request
205 ********************************************************************/
207 void init_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd,
208 char *name, char *class, uint32 access_desired,
209 SEC_DESC_BUF *sec_buf)
211 ZERO_STRUCTP(q_c);
213 memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol));
216 init_unistr4( &q_c->name, name, UNI_STR_TERMINATE );
217 init_unistr4( &q_c->class, class, UNI_STR_TERMINATE );
219 q_c->access = access_desired;
221 q_c->sec_info = TALLOC_P( get_talloc_ctx(), uint32 );
222 *q_c->sec_info = DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION;
224 q_c->data = sec_buf;
225 q_c->ptr2 = 1;
226 init_buf_hdr(&q_c->hdr_sec, sec_buf->len, sec_buf->len);
227 q_c->ptr3 = 1;
228 q_c->unknown_2 = 0x00000000;
231 /*******************************************************************
232 Marshalls a registry key create request
233 ********************************************************************/
235 BOOL reg_io_q_create_key(const char *desc, REG_Q_CREATE_KEY *q_u,
236 prs_struct *ps, int depth)
238 if ( !q_u )
239 return False;
241 prs_debug(ps, depth, desc, "reg_io_q_create_key");
242 depth++;
244 if(!prs_align(ps))
245 return False;
247 if(!smb_io_pol_hnd("", &q_u->pnt_pol, ps, depth))
248 return False;
250 if(!prs_unistr4 ("name", ps, depth, &q_u->name))
251 return False;
252 if(!prs_align(ps))
253 return False;
255 if(!prs_unistr4 ("class", ps, depth, &q_u->class))
256 return False;
257 if(!prs_align(ps))
258 return False;
260 if(!prs_uint32("reserved", ps, depth, &q_u->reserved))
261 return False;
262 if(!prs_uint32("access", ps, depth, &q_u->access))
263 return False;
265 if(!prs_pointer("sec_info", ps, depth, (void**)&q_u->sec_info, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
266 return False;
268 if(!prs_uint32("ptr2", ps, depth, &q_u->ptr2))
269 return False;
270 if(!reg_io_hdrbuf_sec(q_u->ptr2, &q_u->ptr3, &q_u->hdr_sec, q_u->data,
271 ps, depth))
272 return False;
274 #if 0
275 if(!prs_uint32("unknown_2", ps, depth, &q_u->unknown_2))
276 return False;
277 #endif
279 return True;
282 /*******************************************************************
283 Unmarshalls a registry key create response
284 ********************************************************************/
286 BOOL reg_io_r_create_key(const char *desc, REG_R_CREATE_KEY *r_u,
287 prs_struct *ps, int depth)
289 if ( !r_u )
290 return False;
292 prs_debug(ps, depth, desc, "reg_io_r_create_key");
293 depth++;
295 if(!prs_align(ps))
296 return False;
298 if(!smb_io_pol_hnd("", &r_u->key_pol, ps, depth))
299 return False;
300 if(!prs_uint32("unknown", ps, depth, &r_u->unknown))
301 return False;
303 if(!prs_werror("status", ps, depth, &r_u->status))
304 return False;
306 return True;
310 /*******************************************************************
311 Inits a structure.
312 ********************************************************************/
314 void init_reg_q_delete_val(REG_Q_DELETE_VALUE *q_c, POLICY_HND *hnd,
315 char *name)
317 ZERO_STRUCTP(q_c);
319 memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol));
320 init_unistr4(&q_c->name, name, UNI_STR_TERMINATE);
323 /*******************************************************************
324 reads or writes a structure.
325 ********************************************************************/
327 BOOL reg_io_q_delete_val(const char *desc, REG_Q_DELETE_VALUE *q_u,
328 prs_struct *ps, int depth)
330 if ( !q_u )
331 return False;
333 prs_debug(ps, depth, desc, "reg_io_q_delete_val");
334 depth++;
336 if(!prs_align(ps))
337 return False;
339 if(!smb_io_pol_hnd("", &q_u->pnt_pol, ps, depth))
340 return False;
342 if(!prs_unistr4("name", ps, depth, &q_u->name))
343 return False;
344 if(!prs_align(ps))
345 return False;
347 return True;
351 /*******************************************************************
352 reads or writes a structure.
353 ********************************************************************/
355 BOOL reg_io_r_delete_val(const char *desc, REG_R_DELETE_VALUE *r_u,
356 prs_struct *ps, int depth)
358 if ( !r_u )
359 return False;
361 prs_debug(ps, depth, desc, "reg_io_r_delete_val");
362 depth++;
364 if(!prs_align(ps))
365 return False;
367 if(!prs_werror("status", ps, depth, &r_u->status))
368 return False;
370 return True;
373 /*******************************************************************
374 Inits a structure.
375 ********************************************************************/
377 void init_reg_q_delete_key(REG_Q_DELETE_KEY *q_c, POLICY_HND *hnd,
378 char *name)
380 ZERO_STRUCTP(q_c);
382 memcpy(&q_c->pnt_pol, hnd, sizeof(q_c->pnt_pol));
384 init_unistr4(&q_c->name, name, UNI_STR_TERMINATE);
387 /*******************************************************************
388 reads or writes a structure.
389 ********************************************************************/
391 BOOL reg_io_q_delete_key(const char *desc, REG_Q_DELETE_KEY *q_u,
392 prs_struct *ps, int depth)
394 if ( !q_u )
395 return False;
397 prs_debug(ps, depth, desc, "reg_io_q_delete_key");
398 depth++;
400 if(!prs_align(ps))
401 return False;
403 if(!smb_io_pol_hnd("", &q_u->pnt_pol, ps, depth))
404 return False;
406 if(!prs_unistr4("", ps, depth, &q_u->name))
407 return False;
408 if(!prs_align(ps))
409 return False;
411 return True;
414 /*******************************************************************
415 reads or writes a structure.
416 ********************************************************************/
418 BOOL reg_io_r_delete_key(const char *desc, REG_R_DELETE_KEY *r_u, prs_struct *ps, int depth)
420 if ( !r_u )
421 return False;
423 prs_debug(ps, depth, desc, "reg_io_r_delete_key");
424 depth++;
426 if(!prs_align(ps))
427 return False;
429 if(!prs_werror("status", ps, depth, &r_u->status))
430 return False;
432 return True;
435 /*******************************************************************
436 Inits a structure.
437 ********************************************************************/
439 void init_reg_q_query_key(REG_Q_QUERY_KEY *q_o, POLICY_HND *hnd, const char *class)
441 ZERO_STRUCTP(q_o);
443 memcpy(&q_o->pol, hnd, sizeof(q_o->pol));
444 init_unistr4(&q_o->class, class, UNI_STR_TERMINATE);
447 /*******************************************************************
448 reads or writes a structure.
449 ********************************************************************/
451 BOOL reg_io_q_query_key(const char *desc, REG_Q_QUERY_KEY *q_u, prs_struct *ps, int depth)
453 if ( !q_u )
454 return False;
456 prs_debug(ps, depth, desc, "reg_io_q_query_key");
457 depth++;
459 if(!prs_align(ps))
460 return False;
462 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
463 return False;
464 if(!prs_unistr4("class", ps, depth, &q_u->class))
465 return False;
467 if(!prs_align(ps))
468 return False;
470 return True;
474 /*******************************************************************
475 reads or writes a structure.
476 ********************************************************************/
478 BOOL reg_io_r_query_key(const char *desc, REG_R_QUERY_KEY *r_u, prs_struct *ps, int depth)
480 if ( !r_u )
481 return False;
483 prs_debug(ps, depth, desc, "reg_io_r_query_key");
484 depth++;
486 if(!prs_align(ps))
487 return False;
489 if(!prs_unistr4("class", ps, depth, &r_u->class))
490 return False;
492 if(!prs_align(ps))
493 return False;
495 if(!prs_uint32("num_subkeys ", ps, depth, &r_u->num_subkeys))
496 return False;
497 if(!prs_uint32("max_subkeylen ", ps, depth, &r_u->max_subkeylen))
498 return False;
499 if(!prs_uint32("reserved ", ps, depth, &r_u->reserved))
500 return False;
501 if(!prs_uint32("num_values ", ps, depth, &r_u->num_values))
502 return False;
503 if(!prs_uint32("max_valnamelen", ps, depth, &r_u->max_valnamelen))
504 return False;
505 if(!prs_uint32("max_valbufsize", ps, depth, &r_u->max_valbufsize))
506 return False;
507 if(!prs_uint32("sec_desc ", ps, depth, &r_u->sec_desc))
508 return False;
509 if(!smb_io_time("mod_time ", &r_u->mod_time, ps, depth))
510 return False;
512 if(!prs_werror("status", ps, depth, &r_u->status))
513 return False;
515 return True;
518 /*******************************************************************
519 Inits a structure.
520 ********************************************************************/
522 void init_reg_q_getversion(REG_Q_GETVERSION *q_o, POLICY_HND *hnd)
524 memcpy(&q_o->pol, hnd, sizeof(q_o->pol));
528 /*******************************************************************
529 reads or writes a structure.
530 ********************************************************************/
532 BOOL reg_io_q_getversion(const char *desc, REG_Q_GETVERSION *q_u, prs_struct *ps, int depth)
534 if ( !q_u )
535 return False;
537 prs_debug(ps, depth, desc, "reg_io_q_getversion");
538 depth++;
540 if(!prs_align(ps))
541 return False;
543 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
544 return False;
546 return True;
549 /*******************************************************************
550 reads or writes a structure.
551 ********************************************************************/
553 BOOL reg_io_r_getversion(const char *desc, REG_R_GETVERSION *r_u, prs_struct *ps, int depth)
555 if ( !r_u )
556 return False;
558 prs_debug(ps, depth, desc, "reg_io_r_getversion");
559 depth++;
561 if(!prs_align(ps))
562 return False;
564 if(!prs_uint32("unknown", ps, depth, &r_u->unknown))
565 return False;
566 if(!prs_werror("status" , ps, depth, &r_u->status))
567 return False;
569 return True;
573 /*******************************************************************
574 reads or writes a structure.
575 ********************************************************************/
577 BOOL reg_io_q_restore_key(const char *desc, REG_Q_RESTORE_KEY *q_u, prs_struct *ps, int depth)
579 if ( !q_u )
580 return False;
582 prs_debug(ps, depth, desc, "reg_io_q_restore_key");
583 depth++;
585 if(!prs_align(ps))
586 return False;
588 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
589 return False;
591 if(!prs_unistr4("filename", ps, depth, &q_u->filename))
592 return False;
594 if(!prs_uint32("flags", ps, depth, &q_u->flags))
595 return False;
597 return True;
600 /*******************************************************************
601 reads or writes a structure.
602 ********************************************************************/
604 BOOL reg_io_r_restore_key(const char *desc, REG_R_RESTORE_KEY *r_u, prs_struct *ps, int depth)
606 if ( !r_u )
607 return False;
609 prs_debug(ps, depth, desc, "reg_io_r_restore_key");
610 depth++;
612 if(!prs_align(ps))
613 return False;
615 if(!prs_werror("status" , ps, depth, &r_u->status))
616 return False;
618 return True;
621 /*******************************************************************
622 reads or writes a structure.
623 ********************************************************************/
625 BOOL reg_io_q_save_key(const char *desc, REG_Q_SAVE_KEY *q_u, prs_struct *ps, int depth)
627 if ( !q_u )
628 return False;
630 prs_debug(ps, depth, desc, "reg_io_q_save_key");
631 depth++;
633 if(!prs_align(ps))
634 return False;
636 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
637 return False;
639 if(!prs_unistr4("filename", ps, depth, &q_u->filename))
640 return False;
642 #if 0 /* reg_io_sec_attr() */
643 if(!prs_uint32("unknown", ps, depth, &q_u->unknown))
644 return False;
645 #endif
647 return True;
650 /*******************************************************************
651 reads or writes a structure.
652 ********************************************************************/
654 BOOL reg_io_r_save_key(const char *desc, REG_R_SAVE_KEY *r_u, prs_struct *ps, int depth)
656 if ( !r_u )
657 return False;
659 prs_debug(ps, depth, desc, "reg_io_r_save_key");
660 depth++;
662 if(!prs_align(ps))
663 return False;
665 if(!prs_werror("status" , ps, depth, &r_u->status))
666 return False;
668 return True;
671 /*******************************************************************
672 Inits an REG_Q_CLOSE structure.
673 ********************************************************************/
675 void init_reg_q_close(REG_Q_CLOSE *q_c, POLICY_HND *hnd)
677 DEBUG(5,("init_reg_q_close\n"));
679 memcpy(&q_c->pol, hnd, sizeof(q_c->pol));
682 /*******************************************************************
683 reads or writes a structure.
684 ********************************************************************/
686 BOOL reg_io_q_close(const char *desc, REG_Q_CLOSE *q_u, prs_struct *ps, int depth)
688 if (q_u == NULL)
689 return False;
691 prs_debug(ps, depth, desc, "reg_io_q_close");
692 depth++;
694 if(!prs_align(ps))
695 return False;
697 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
698 return False;
699 if(!prs_align(ps))
700 return False;
702 return True;
705 /*******************************************************************
706 reads or writes a structure.
707 ********************************************************************/
709 BOOL reg_io_r_close(const char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth)
711 if ( !r_u )
712 return False;
714 prs_debug(ps, depth, desc, "reg_io_r_close");
715 depth++;
717 if(!prs_align(ps))
718 return False;
720 if(!smb_io_pol_hnd("", &r_u->pol, ps, depth))
721 return False;
722 if(!prs_align(ps))
723 return False;
725 if(!prs_werror("status", ps, depth, &r_u->status))
726 return False;
728 return True;
731 /*******************************************************************
732 makes a structure.
733 ********************************************************************/
735 void init_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_u, POLICY_HND *pol,
736 uint32 sec_info, SEC_DESC_BUF *sec_desc_buf)
738 memcpy(&q_u->pol, pol, sizeof(q_u->pol));
740 q_u->sec_info = sec_info;
742 q_u->ptr = 1;
743 init_buf_hdr(&q_u->hdr_sec, sec_desc_buf->len, sec_desc_buf->len);
744 q_u->data = sec_desc_buf;
747 /*******************************************************************
748 reads or writes a structure.
749 ********************************************************************/
751 BOOL reg_io_q_set_key_sec(const char *desc, REG_Q_SET_KEY_SEC *q_u, prs_struct *ps, int depth)
753 if ( !q_u )
754 return False;
756 prs_debug(ps, depth, desc, "reg_io_q_set_key_sec");
757 depth++;
759 if(!prs_align(ps))
760 return False;
762 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
763 return False;
765 if(!prs_uint32("sec_info", ps, depth, &q_u->sec_info))
766 return False;
767 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
768 return False;
770 if(!reg_io_hdrbuf_sec(q_u->ptr, NULL, &q_u->hdr_sec, q_u->data, ps, depth))
771 return False;
773 return True;
776 /*******************************************************************
777 reads or writes a structure.
778 ********************************************************************/
780 BOOL reg_io_r_set_key_sec(const char *desc, REG_R_SET_KEY_SEC *q_u, prs_struct *ps, int depth)
782 if ( !q_u )
783 return False;
785 prs_debug(ps, depth, desc, "reg_io_r_set_key_sec");
786 depth++;
788 if(!prs_align(ps))
789 return False;
791 if(!prs_werror("status", ps, depth, &q_u->status))
792 return False;
794 return True;
798 /*******************************************************************
799 makes a structure.
800 ********************************************************************/
802 void init_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_u, POLICY_HND *pol,
803 uint32 sec_info, uint32 sec_buf_size,
804 SEC_DESC_BUF *psdb)
806 memcpy(&q_u->pol, pol, sizeof(q_u->pol));
808 q_u->sec_info = sec_info;
810 q_u->ptr = psdb != NULL ? 1 : 0;
811 q_u->data = psdb;
813 init_buf_hdr(&q_u->hdr_sec, sec_buf_size, 0);
816 /*******************************************************************
817 reads or writes a structure.
818 ********************************************************************/
820 BOOL reg_io_q_get_key_sec(const char *desc, REG_Q_GET_KEY_SEC *q_u, prs_struct *ps, int depth)
822 if ( !q_u )
823 return False;
825 prs_debug(ps, depth, desc, "reg_io_q_get_key_sec");
826 depth++;
828 if(!prs_align(ps))
829 return False;
831 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
832 return False;
834 if(!prs_uint32("sec_info", ps, depth, &q_u->sec_info))
835 return False;
836 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
837 return False;
839 if(!reg_io_hdrbuf_sec(q_u->ptr, NULL, &q_u->hdr_sec, q_u->data, ps, depth))
840 return False;
842 return True;
845 #if 0
846 /*******************************************************************
847 makes a structure.
848 ********************************************************************/
849 void init_reg_r_get_key_sec(REG_R_GET_KEY_SEC *r_i, POLICY_HND *pol,
850 uint32 buf_len, uint8 *buf,
851 NTSTATUS status)
853 r_i->ptr = 1;
854 init_buf_hdr(&r_i->hdr_sec, buf_len, buf_len);
855 init_sec_desc_buf(r_i->data, buf_len, 1);
857 r_i->status = status; /* 0x0000 0000 or 0x0000 007a */
859 #endif
861 /*******************************************************************
862 reads or writes a structure.
863 ********************************************************************/
865 BOOL reg_io_r_get_key_sec(const char *desc, REG_R_GET_KEY_SEC *q_u, prs_struct *ps, int depth)
867 if ( !q_u )
868 return False;
870 prs_debug(ps, depth, desc, "reg_io_r_get_key_sec");
871 depth++;
873 if(!prs_align(ps))
874 return False;
876 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
877 return False;
879 if (q_u->ptr != 0) {
880 if(!smb_io_hdrbuf("", &q_u->hdr_sec, ps, depth))
881 return False;
882 if(!sec_io_desc_buf("", &q_u->data, ps, depth))
883 return False;
884 if(!prs_align(ps))
885 return False;
888 if(!prs_werror("status", ps, depth, &q_u->status))
889 return False;
891 return True;
894 /*******************************************************************
895 makes a structure.
896 ********************************************************************/
898 BOOL init_reg_q_info(REG_Q_INFO *q_u, POLICY_HND *pol, const char *val_name,
899 REGVAL_BUFFER *value_output)
901 if (q_u == NULL)
902 return False;
904 q_u->pol = *pol;
906 init_unistr4(&q_u->name, val_name, UNI_STR_TERMINATE);
908 q_u->ptr_reserved = 1;
909 q_u->ptr_buf = 1;
911 q_u->ptr_bufsize = 1;
912 q_u->bufsize = value_output->buf_max_len;
913 q_u->buf_unk = 0;
915 q_u->unk1 = 0;
916 q_u->ptr_buflen = 1;
917 q_u->buflen = value_output->buf_max_len;
919 q_u->ptr_buflen2 = 1;
920 q_u->buflen2 = 0;
922 return True;
925 /*******************************************************************
926 reads or writes a structure.
927 ********************************************************************/
929 BOOL reg_io_q_info(const char *desc, REG_Q_INFO *q_u, prs_struct *ps, int depth)
931 if ( !q_u )
932 return False;
934 prs_debug(ps, depth, desc, "reg_io_q_info");
935 depth++;
937 if(!prs_align(ps))
938 return False;
940 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
941 return False;
942 if(!prs_unistr4("name", ps, depth, &q_u->name))
943 return False;
945 if(!prs_align(ps))
946 return False;
948 if(!prs_uint32("ptr_reserved", ps, depth, &(q_u->ptr_reserved)))
949 return False;
951 if(!prs_uint32("ptr_buf", ps, depth, &(q_u->ptr_buf)))
952 return False;
954 if(q_u->ptr_buf) {
955 if(!prs_uint32("ptr_bufsize", ps, depth, &(q_u->ptr_bufsize)))
956 return False;
957 if(!prs_uint32("bufsize", ps, depth, &(q_u->bufsize)))
958 return False;
959 if(!prs_uint32("buf_unk", ps, depth, &(q_u->buf_unk)))
960 return False;
963 if(!prs_uint32("unk1", ps, depth, &(q_u->unk1)))
964 return False;
966 if(!prs_uint32("ptr_buflen", ps, depth, &(q_u->ptr_buflen)))
967 return False;
969 if (q_u->ptr_buflen) {
970 if(!prs_uint32("buflen", ps, depth, &(q_u->buflen)))
971 return False;
972 if(!prs_uint32("ptr_buflen2", ps, depth, &(q_u->ptr_buflen2)))
973 return False;
974 if(!prs_uint32("buflen2", ps, depth, &(q_u->buflen2)))
975 return False;
978 return True;
981 /*******************************************************************
982 Inits a structure.
983 New version to replace older init_reg_r_info()
984 ********************************************************************/
986 BOOL init_reg_r_info(uint32 include_keyval, REG_R_INFO *r_u,
987 REGISTRY_VALUE *val, WERROR status)
989 uint32 buf_len = 0;
990 REGVAL_BUFFER buf2;
992 if( !r_u || !val )
993 return False;
995 r_u->type = TALLOC_P( get_talloc_ctx(), uint32 );
996 *r_u->type = val->type;
998 buf_len = reg_init_regval_buffer( &buf2, val );
1000 r_u->buf_max_len = TALLOC_P( get_talloc_ctx(), uint32 );
1001 *r_u->buf_max_len = buf_len;
1003 r_u->buf_len = TALLOC_P( get_talloc_ctx(), uint32 );
1004 *r_u->buf_len = buf_len;
1006 /* if include_keyval is not set, don't send the key value, just
1007 the buflen data. probably used by NT5 to allocate buffer space - SK */
1009 if ( include_keyval ) {
1010 r_u->value = TALLOC_P( get_talloc_ctx(), REGVAL_BUFFER );
1011 /* steal the memory */
1012 *r_u->value = buf2;
1015 r_u->status = status;
1017 return True;
1020 /*******************************************************************
1021 reads or writes a structure.
1022 ********************************************************************/
1024 BOOL reg_io_r_info(const char *desc, REG_R_INFO *r_u, prs_struct *ps, int depth)
1026 if ( !r_u )
1027 return False;
1029 prs_debug(ps, depth, desc, "reg_io_r_info");
1030 depth++;
1032 if(!prs_align(ps))
1033 return False;
1035 if ( !prs_pointer("type", ps, depth, (void**)&r_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1036 return False;
1038 if ( !prs_pointer("value", ps, depth, (void**)&r_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer))
1039 return False;
1040 if(!prs_align(ps))
1041 return False;
1043 if ( !prs_pointer("buf_max_len", ps, depth, (void**)&r_u->buf_max_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1044 return False;
1045 if ( !prs_pointer("buf_len", ps, depth, (void**)&r_u->buf_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1046 return False;
1048 if(!prs_werror("status", ps, depth, &r_u->status))
1049 return False;
1051 return True;
1054 /*******************************************************************
1055 makes a structure.
1056 ********************************************************************/
1058 void init_reg_q_enum_val(REG_Q_ENUM_VALUE *q_u, POLICY_HND *pol,
1059 uint32 val_idx, char *name,
1060 uint32 max_buf_len)
1062 ZERO_STRUCTP(q_u);
1064 memcpy(&q_u->pol, pol, sizeof(q_u->pol));
1066 q_u->val_index = val_idx;
1068 init_unistr4( &q_u->name, name, UNI_STR_TERMINATE );
1070 q_u->type = TALLOC_P( get_talloc_ctx(), uint32 );
1071 *q_u->type = 0x0;
1073 q_u->value = TALLOC_P( get_talloc_ctx(), REGVAL_BUFFER );
1074 q_u->value->buf_max_len = max_buf_len;
1076 q_u->len_value1 = TALLOC_P( get_talloc_ctx(), uint32 );
1077 *q_u->len_value1 = max_buf_len;
1079 q_u->len_value2 = TALLOC_P( get_talloc_ctx(), uint32 );
1080 *q_u->len_value2 = max_buf_len;
1083 /*******************************************************************
1084 makes a structure.
1085 ********************************************************************/
1087 void init_reg_r_enum_val(REG_R_ENUM_VALUE *r_u, REGISTRY_VALUE *val )
1089 uint32 real_size;
1091 DEBUG(8,("init_reg_r_enum_val: Enter\n"));
1093 ZERO_STRUCTP(r_u);
1095 /* value name */
1097 DEBUG(10,("init_reg_r_enum_val: Valuename => [%s]\n", val->valuename));
1099 init_unistr4( &r_u->name, val->valuename, UNI_STR_TERMINATE);
1101 /* type */
1103 r_u->type = TALLOC_P( get_talloc_ctx(), uint32 );
1104 *r_u->type = val->type;
1106 /* REG_SZ & REG_MULTI_SZ must be converted to UNICODE */
1108 r_u->value = TALLOC_P( get_talloc_ctx(), REGVAL_BUFFER );
1109 real_size = reg_init_regval_buffer( r_u->value, val );
1111 /* lengths */
1113 r_u->len_value1 = TALLOC_P( get_talloc_ctx(), uint32 );
1114 *r_u->len_value1 = real_size;
1116 r_u->len_value2 = TALLOC_P( get_talloc_ctx(), uint32 );
1117 *r_u->len_value2 = real_size;
1119 DEBUG(8,("init_reg_r_enum_val: Exit\n"));
1122 /*******************************************************************
1123 reads or writes a structure.
1124 ********************************************************************/
1126 BOOL reg_io_q_enum_val(const char *desc, REG_Q_ENUM_VALUE *q_u, prs_struct *ps, int depth)
1128 if (q_u == NULL)
1129 return False;
1131 prs_debug(ps, depth, desc, "reg_io_q_enum_val");
1132 depth++;
1134 if(!prs_align(ps))
1135 return False;
1137 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
1138 return False;
1140 if(!prs_uint32("val_index", ps, depth, &q_u->val_index))
1141 return False;
1143 if(!prs_unistr4("name", ps, depth, &q_u->name ))
1144 return False;
1145 if(!prs_align(ps))
1146 return False;
1148 if(!prs_pointer("type", ps, depth, (void**)&q_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1149 return False;
1151 if ( !prs_pointer("value", ps, depth, (void**)&q_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer))
1152 return False;
1153 if(!prs_align(ps))
1154 return False;
1156 if(!prs_pointer("len_value1", ps, depth, (void**)&q_u->len_value1, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1157 return False;
1158 if(!prs_pointer("len_value2", ps, depth, (void**)&q_u->len_value2, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1159 return False;
1161 return True;
1164 /*******************************************************************
1165 reads or writes a structure.
1166 ********************************************************************/
1168 BOOL reg_io_r_enum_val(const char *desc, REG_R_ENUM_VALUE *r_u, prs_struct *ps, int depth)
1170 if ( !r_u )
1171 return False;
1173 prs_debug(ps, depth, desc, "reg_io_r_enum_val");
1174 depth++;
1176 if(!prs_align(ps))
1177 return False;
1179 if(!prs_unistr4("name", ps, depth, &r_u->name ))
1180 return False;
1181 if(!prs_align(ps))
1182 return False;
1184 if(!prs_pointer("type", ps, depth, (void**)&r_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1185 return False;
1187 if ( !prs_pointer("value", ps, depth, (void**)&r_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer))
1188 return False;
1189 if(!prs_align(ps))
1190 return False;
1192 if(!prs_pointer("len_value1", ps, depth, (void**)&r_u->len_value1, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1193 return False;
1194 if(!prs_pointer("len_value2", ps, depth, (void**)&r_u->len_value2, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1195 return False;
1198 if(!prs_werror("status", ps, depth, &r_u->status))
1199 return False;
1201 return True;
1204 /*******************************************************************
1205 makes a structure.
1206 ********************************************************************/
1208 void init_reg_q_set_val(REG_Q_SET_VALUE *q_u, POLICY_HND *pol,
1209 char *val_name, uint32 type,
1210 RPC_DATA_BLOB *val)
1212 ZERO_STRUCTP(q_u);
1214 memcpy(&q_u->pol, pol, sizeof(q_u->pol));
1216 init_unistr4(&q_u->name, val_name, UNI_STR_TERMINATE);
1218 q_u->type = type;
1219 q_u->value = *val;
1220 q_u->size = val->buf_len;
1223 /*******************************************************************
1224 reads or writes a structure.
1225 ********************************************************************/
1227 BOOL reg_io_q_set_val(const char *desc, REG_Q_SET_VALUE *q_u, prs_struct *ps, int depth)
1229 if (q_u == NULL)
1230 return False;
1232 prs_debug(ps, depth, desc, "reg_io_q_set_val");
1233 depth++;
1235 if(!prs_align(ps))
1236 return False;
1238 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
1239 return False;
1241 if(!prs_unistr4("name", ps, depth, &q_u->name ))
1242 return False;
1243 if(!prs_align(ps))
1244 return False;
1246 if(!prs_uint32("type", ps, depth, &q_u->type))
1247 return False;
1249 if(!smb_io_rpc_blob("value", &q_u->value, ps, depth ))
1250 return False;
1251 if(!prs_align(ps))
1252 return False;
1254 if(!prs_uint32("size", ps, depth, &q_u->size))
1255 return False;
1257 return True;
1260 /*******************************************************************
1261 reads or writes a structure.
1262 ********************************************************************/
1264 BOOL reg_io_r_set_val(const char *desc, REG_R_SET_VALUE *q_u, prs_struct *ps, int depth)
1266 if ( !q_u )
1267 return False;
1269 prs_debug(ps, depth, desc, "reg_io_r_set_val");
1270 depth++;
1272 if(!prs_align(ps))
1273 return False;
1275 if(!prs_werror("status", ps, depth, &q_u->status))
1276 return False;
1278 return True;
1281 /*******************************************************************
1282 makes a structure.
1283 ********************************************************************/
1285 void init_reg_q_enum_key(REG_Q_ENUM_KEY *q_u, POLICY_HND *pol, uint32 key_idx)
1287 memcpy(&q_u->pol, pol, sizeof(q_u->pol));
1289 q_u->key_index = key_idx;
1290 q_u->key_name_len = 0;
1291 q_u->unknown_1 = 0x0414;
1293 q_u->ptr1 = 1;
1294 q_u->unknown_2 = 0x0000020A;
1295 memset(q_u->pad1, 0, sizeof(q_u->pad1));
1297 q_u->ptr2 = 1;
1298 memset(q_u->pad2, 0, sizeof(q_u->pad2));
1300 q_u->ptr3 = 1;
1301 unix_to_nt_time(&q_u->time, 0); /* current time? */
1304 /*******************************************************************
1305 makes a reply structure.
1306 ********************************************************************/
1308 void init_reg_r_enum_key(REG_R_ENUM_KEY *r_u, char *subkey, uint32 unknown_1,
1309 uint32 unknown_2)
1311 if ( !r_u )
1312 return;
1314 r_u->unknown_1 = unknown_1;
1315 r_u->unknown_2 = unknown_2;
1316 r_u->unknown_3 = 0x0;
1318 r_u->key_name_len = (strlen(subkey)+1) * 2;
1319 if (r_u->key_name_len)
1320 r_u->ptr1 = 0x1;
1321 init_unistr3( &r_u->key_name, subkey );
1323 r_u->ptr2 = 0x1;
1324 r_u->ptr3 = 0x1;
1327 /*******************************************************************
1328 reads or writes a structure.
1329 ********************************************************************/
1331 BOOL reg_io_q_enum_key(const char *desc, REG_Q_ENUM_KEY *q_u, prs_struct *ps, int depth)
1333 if (q_u == NULL)
1334 return False;
1336 prs_debug(ps, depth, desc, "reg_io_q_enum_key");
1337 depth++;
1339 if(!prs_align(ps))
1340 return False;
1342 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
1343 return False;
1345 if(!prs_uint32("key_index", ps, depth, &q_u->key_index))
1346 return False;
1347 if(!prs_uint16("key_name_len", ps, depth, &q_u->key_name_len))
1348 return False;
1349 if(!prs_uint16("unknown_1", ps, depth, &q_u->unknown_1))
1350 return False;
1352 if(!prs_uint32("ptr1", ps, depth, &q_u->ptr1))
1353 return False;
1355 if (q_u->ptr1 != 0) {
1356 if(!prs_uint32("unknown_2", ps, depth, &q_u->unknown_2))
1357 return False;
1358 if(!prs_uint8s(False, "pad1", ps, depth, q_u->pad1, sizeof(q_u->pad1)))
1359 return False;
1362 if(!prs_uint32("ptr2", ps, depth, &q_u->ptr2))
1363 return False;
1365 if (q_u->ptr2 != 0) {
1366 if(!prs_uint8s(False, "pad2", ps, depth, q_u->pad2, sizeof(q_u->pad2)))
1367 return False;
1370 if(!prs_uint32("ptr3", ps, depth, &q_u->ptr3))
1371 return False;
1373 if (q_u->ptr3 != 0) {
1374 if(!smb_io_time("", &q_u->time, ps, depth))
1375 return False;
1378 return True;
1381 /*******************************************************************
1382 reads or writes a structure.
1383 ********************************************************************/
1385 BOOL reg_io_r_enum_key(const char *desc, REG_R_ENUM_KEY *q_u, prs_struct *ps, int depth)
1387 if ( !q_u )
1388 return False;
1390 prs_debug(ps, depth, desc, "reg_io_r_enum_key");
1391 depth++;
1393 if(!prs_align(ps))
1394 return False;
1396 if(!prs_uint16("key_name_len", ps, depth, &q_u->key_name_len))
1397 return False;
1398 if(!prs_uint16("unknown_1", ps, depth, &q_u->unknown_1))
1399 return False;
1401 if(!prs_uint32("ptr1", ps, depth, &q_u->ptr1))
1402 return False;
1404 if (q_u->ptr1 != 0) {
1405 if(!prs_uint32("unknown_2", ps, depth, &q_u->unknown_2))
1406 return False;
1407 if(!prs_uint32("unknown_3", ps, depth, &q_u->unknown_3))
1408 return False;
1409 if(!smb_io_unistr3("key_name", &q_u->key_name, ps, depth))
1410 return False;
1411 if(!prs_align(ps))
1412 return False;
1415 if(!prs_uint32("ptr2", ps, depth, &q_u->ptr2))
1416 return False;
1418 if (q_u->ptr2 != 0) {
1419 if(!prs_uint8s(False, "pad2", ps, depth, q_u->pad2, sizeof(q_u->pad2)))
1420 return False;
1423 if(!prs_uint32("ptr3", ps, depth, &q_u->ptr3))
1424 return False;
1426 if (q_u->ptr3 != 0) {
1427 if(!smb_io_time("", &q_u->time, ps, depth))
1428 return False;
1431 if(!prs_werror("status", ps, depth, &q_u->status))
1432 return False;
1434 return True;
1437 /*******************************************************************
1438 makes a structure.
1439 ********************************************************************/
1441 void init_reg_q_open_entry(REG_Q_OPEN_ENTRY *q_u, POLICY_HND *pol,
1442 char *key_name, uint32 access_desired)
1444 memcpy(&q_u->pol, pol, sizeof(q_u->pol));
1446 init_unistr4(&q_u->name, key_name, UNI_STR_TERMINATE);
1448 q_u->unknown_0 = 0x00000000;
1449 q_u->access = access_desired;
1452 /*******************************************************************
1453 reads or writes a structure.
1454 ********************************************************************/
1456 BOOL reg_io_q_open_entry(const char *desc, REG_Q_OPEN_ENTRY *q_u, prs_struct *ps, int depth)
1458 if ( !q_u )
1459 return False;
1461 prs_debug(ps, depth, desc, "reg_io_q_open_entry");
1462 depth++;
1464 if(!prs_align(ps))
1465 return False;
1467 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
1468 return False;
1469 if(!prs_unistr4("name", ps, depth, &q_u->name))
1470 return False;
1472 if(!prs_align(ps))
1473 return False;
1475 if(!prs_uint32("unknown_0 ", ps, depth, &q_u->unknown_0))
1476 return False;
1477 if(!prs_uint32("access", ps, depth, &q_u->access))
1478 return False;
1480 return True;
1483 /*******************************************************************
1484 Inits a structure.
1485 ********************************************************************/
1487 void init_reg_r_open_entry(REG_R_OPEN_ENTRY *r_u,
1488 POLICY_HND *pol, WERROR werr)
1490 if (W_ERROR_IS_OK(werr)) {
1491 memcpy(&r_u->pol, pol, sizeof(r_u->pol));
1492 } else {
1493 ZERO_STRUCT(r_u->pol);
1495 r_u->status = werr;
1498 /*******************************************************************
1499 reads or writes a structure.
1500 ********************************************************************/
1502 BOOL reg_io_r_open_entry(const char *desc, REG_R_OPEN_ENTRY *r_u, prs_struct *ps, int depth)
1504 if ( !r_u )
1505 return False;
1507 prs_debug(ps, depth, desc, "reg_io_r_open_entry");
1508 depth++;
1510 if(!prs_align(ps))
1511 return False;
1513 if(!smb_io_pol_hnd("", &r_u->pol, ps, depth))
1514 return False;
1516 if(!prs_werror("status", ps, depth, &r_u->status))
1517 return False;
1519 return True;
1522 /*******************************************************************
1523 Inits a structure.
1524 ********************************************************************/
1526 void init_reg_q_shutdown(REG_Q_SHUTDOWN *q_u, const char *msg,
1527 uint32 timeout, BOOL do_reboot, BOOL force)
1529 q_u->server = TALLOC_P( get_talloc_ctx(), uint16 );
1530 *q_u->server = 0x1;
1532 q_u->message = TALLOC_P( get_talloc_ctx(), UNISTR4 );
1533 init_unistr4( q_u->message, msg, UNI_FLAGS_NONE );
1535 q_u->timeout = timeout;
1537 q_u->reboot = do_reboot ? 1 : 0;
1538 q_u->force = force ? 1 : 0;
1541 /*******************************************************************
1542 Inits a REG_Q_SHUTDOWN_EX structure.
1543 ********************************************************************/
1545 void init_reg_q_shutdown_ex(REG_Q_SHUTDOWN_EX * q_u_ex, const char *msg,
1546 uint32 timeout, BOOL do_reboot, BOOL force, uint32 reason)
1548 REG_Q_SHUTDOWN q_u;
1550 ZERO_STRUCT( q_u );
1552 init_reg_q_shutdown( &q_u, msg, timeout, do_reboot, force );
1554 /* steal memory */
1556 q_u_ex->server = q_u.server;
1557 q_u_ex->message = q_u.message;
1559 q_u_ex->reboot = q_u.reboot;
1560 q_u_ex->force = q_u.force;
1562 q_u_ex->reason = reason;
1565 /*******************************************************************
1566 reads or writes a structure.
1567 ********************************************************************/
1569 BOOL reg_io_q_shutdown(const char *desc, REG_Q_SHUTDOWN *q_u, prs_struct *ps,
1570 int depth)
1572 if ( !q_u )
1573 return False;
1575 prs_debug(ps, depth, desc, "reg_io_q_shutdown");
1576 depth++;
1578 if (!prs_align(ps))
1579 return False;
1581 if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16))
1582 return False;
1584 if (!prs_pointer("message", ps, depth, (void**)&q_u->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4))
1585 return False;
1587 if (!prs_align(ps))
1588 return False;
1590 if (!prs_uint32("timeout", ps, depth, &(q_u->timeout)))
1591 return False;
1593 if (!prs_uint8("force ", ps, depth, &(q_u->force)))
1594 return False;
1595 if (!prs_uint8("reboot ", ps, depth, &(q_u->reboot)))
1596 return False;
1599 return True;
1602 /*******************************************************************
1603 reads or writes a structure.
1604 ********************************************************************/
1605 BOOL reg_io_r_shutdown(const char *desc, REG_R_SHUTDOWN *r_u, prs_struct *ps,
1606 int depth)
1608 if ( !r_u )
1609 return False;
1611 prs_debug(ps, depth, desc, "reg_io_r_shutdown");
1612 depth++;
1614 if(!prs_align(ps))
1615 return False;
1617 if(!prs_werror("status", ps, depth, &r_u->status))
1618 return False;
1620 return True;
1623 /*******************************************************************
1624 reads or writes a REG_Q_SHUTDOWN_EX structure.
1625 ********************************************************************/
1627 BOOL reg_io_q_shutdown_ex(const char *desc, REG_Q_SHUTDOWN_EX *q_u, prs_struct *ps,
1628 int depth)
1630 if ( !q_u )
1631 return False;
1633 prs_debug(ps, depth, desc, "reg_io_q_shutdown_ex");
1634 depth++;
1636 if (!prs_align(ps))
1637 return False;
1639 if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16))
1640 return False;
1642 if (!prs_pointer("message", ps, depth, (void**)&q_u->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4))
1643 return False;
1645 if (!prs_align(ps))
1646 return False;
1648 if (!prs_uint32("timeout", ps, depth, &(q_u->timeout)))
1649 return False;
1651 if (!prs_uint8("force ", ps, depth, &(q_u->force)))
1652 return False;
1653 if (!prs_uint8("reboot ", ps, depth, &(q_u->reboot)))
1654 return False;
1656 if (!prs_align(ps))
1657 return False;
1658 if (!prs_uint32("reason", ps, depth, &(q_u->reason)))
1659 return False;
1662 return True;
1665 /*******************************************************************
1666 reads or writes a REG_R_SHUTDOWN_EX structure.
1667 ********************************************************************/
1668 BOOL reg_io_r_shutdown_ex(const char *desc, REG_R_SHUTDOWN_EX *r_u, prs_struct *ps,
1669 int depth)
1671 if ( !r_u )
1672 return False;
1674 prs_debug(ps, depth, desc, "reg_io_r_shutdown_ex");
1675 depth++;
1677 if(!prs_align(ps))
1678 return False;
1680 if(!prs_werror("status", ps, depth, &r_u->status))
1681 return False;
1683 return True;
1688 /*******************************************************************
1689 Inits a structure.
1690 ********************************************************************/
1691 void init_reg_q_abort_shutdown(REG_Q_ABORT_SHUTDOWN *q_u)
1693 q_u->server = TALLOC_P( get_talloc_ctx(), uint16 );
1694 *q_u->server = 0x1;
1697 /*******************************************************************
1698 reads or writes a structure.
1699 ********************************************************************/
1700 BOOL reg_io_q_abort_shutdown(const char *desc, REG_Q_ABORT_SHUTDOWN *q_u,
1701 prs_struct *ps, int depth)
1703 if ( !q_u )
1704 return False;
1706 prs_debug(ps, depth, desc, "reg_io_q_abort_shutdown");
1707 depth++;
1709 if (!prs_align(ps))
1710 return False;
1712 if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16))
1713 return False;
1715 return True;
1718 /*******************************************************************
1719 reads or writes a structure.
1720 ********************************************************************/
1721 BOOL reg_io_r_abort_shutdown(const char *desc, REG_R_ABORT_SHUTDOWN *r_u,
1722 prs_struct *ps, int depth)
1724 if ( !r_u )
1725 return False;
1727 prs_debug(ps, depth, desc, "reg_io_r_abort_shutdown");
1728 depth++;
1730 if (!prs_align(ps))
1731 return False;
1733 if (!prs_werror("status", ps, depth, &r_u->status))
1734 return False;
1736 return True;