r7995: * privileges are local except when they're *not*
[Samba.git] / source / rpc_parse / parse_reg.c
blobc46eef130037d46699ffe475f1b6d9c8b4070a91
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_ex(REG_Q_CREATE_KEY_EX *q_c, POLICY_HND *hnd,
210 char *name, char *key_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->key_class, key_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_ex(const char *desc, REG_Q_CREATE_KEY_EX *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_ex");
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 ("key_class", ps, depth, &q_u->key_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_ex(const char *desc, REG_R_CREATE_KEY_EX *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_ex");
295 depth++;
297 if(!prs_align(ps))
298 return False;
300 if(!smb_io_pol_hnd("", &r_u->handle, ps, depth))
301 return False;
302 if(!prs_uint32("disposition", ps, depth, &r_u->disposition))
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;
347 return True;
351 /*******************************************************************
352 reads or writes a structure.
353 ********************************************************************/
355 BOOL reg_io_r_delete_value(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_value");
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->handle, hnd, sizeof(q_c->handle));
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->handle, ps, depth))
404 return False;
406 if(!prs_unistr4("", ps, depth, &q_u->name))
407 return False;
409 return True;
412 /*******************************************************************
413 reads or writes a structure.
414 ********************************************************************/
416 BOOL reg_io_r_delete_key(const char *desc, REG_R_DELETE_KEY *r_u, prs_struct *ps, int depth)
418 if ( !r_u )
419 return False;
421 prs_debug(ps, depth, desc, "reg_io_r_delete_key");
422 depth++;
424 if(!prs_align(ps))
425 return False;
427 if(!prs_werror("status", ps, depth, &r_u->status))
428 return False;
430 return True;
433 /*******************************************************************
434 Inits a structure.
435 ********************************************************************/
437 void init_reg_q_query_key(REG_Q_QUERY_KEY *q_o, POLICY_HND *hnd, const char *key_class)
439 ZERO_STRUCTP(q_o);
441 memcpy(&q_o->pol, hnd, sizeof(q_o->pol));
442 init_unistr4(&q_o->key_class, key_class, UNI_STR_TERMINATE);
445 /*******************************************************************
446 reads or writes a structure.
447 ********************************************************************/
449 BOOL reg_io_q_query_key(const char *desc, REG_Q_QUERY_KEY *q_u, prs_struct *ps, int depth)
451 if ( !q_u )
452 return False;
454 prs_debug(ps, depth, desc, "reg_io_q_query_key");
455 depth++;
457 if(!prs_align(ps))
458 return False;
460 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
461 return False;
462 if(!prs_unistr4("key_class", ps, depth, &q_u->key_class))
463 return False;
465 return True;
469 /*******************************************************************
470 reads or writes a structure.
471 ********************************************************************/
473 BOOL reg_io_r_query_key(const char *desc, REG_R_QUERY_KEY *r_u, prs_struct *ps, int depth)
475 if ( !r_u )
476 return False;
478 prs_debug(ps, depth, desc, "reg_io_r_query_key");
479 depth++;
481 if(!prs_align(ps))
482 return False;
484 if(!prs_unistr4("key_class", ps, depth, &r_u->key_class))
485 return False;
487 if(!prs_align(ps))
488 return False;
490 if(!prs_uint32("num_subkeys ", ps, depth, &r_u->num_subkeys))
491 return False;
492 if(!prs_uint32("max_subkeylen ", ps, depth, &r_u->max_subkeylen))
493 return False;
494 if(!prs_uint32("reserved ", ps, depth, &r_u->reserved))
495 return False;
496 if(!prs_uint32("num_values ", ps, depth, &r_u->num_values))
497 return False;
498 if(!prs_uint32("max_valnamelen", ps, depth, &r_u->max_valnamelen))
499 return False;
500 if(!prs_uint32("max_valbufsize", ps, depth, &r_u->max_valbufsize))
501 return False;
502 if(!prs_uint32("sec_desc ", ps, depth, &r_u->sec_desc))
503 return False;
504 if(!smb_io_time("mod_time ", &r_u->mod_time, ps, depth))
505 return False;
507 if(!prs_werror("status", ps, depth, &r_u->status))
508 return False;
510 return True;
513 /*******************************************************************
514 Inits a structure.
515 ********************************************************************/
517 void init_reg_q_getversion(REG_Q_GETVERSION *q_o, POLICY_HND *hnd)
519 memcpy(&q_o->pol, hnd, sizeof(q_o->pol));
523 /*******************************************************************
524 reads or writes a structure.
525 ********************************************************************/
527 BOOL reg_io_q_getversion(const char *desc, REG_Q_GETVERSION *q_u, prs_struct *ps, int depth)
529 if ( !q_u )
530 return False;
532 prs_debug(ps, depth, desc, "reg_io_q_getversion");
533 depth++;
535 if(!prs_align(ps))
536 return False;
538 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
539 return False;
541 return True;
544 /*******************************************************************
545 reads or writes a structure.
546 ********************************************************************/
548 BOOL reg_io_r_getversion(const char *desc, REG_R_GETVERSION *r_u, prs_struct *ps, int depth)
550 if ( !r_u )
551 return False;
553 prs_debug(ps, depth, desc, "reg_io_r_getversion");
554 depth++;
556 if(!prs_align(ps))
557 return False;
559 if(!prs_uint32("win_version", ps, depth, &r_u->win_version))
560 return False;
561 if(!prs_werror("status" , ps, depth, &r_u->status))
562 return False;
564 return True;
568 /*******************************************************************
569 reads or writes a structure.
570 ********************************************************************/
572 BOOL reg_io_q_restore_key(const char *desc, REG_Q_RESTORE_KEY *q_u, prs_struct *ps, int depth)
574 if ( !q_u )
575 return False;
577 prs_debug(ps, depth, desc, "reg_io_q_restore_key");
578 depth++;
580 if(!prs_align(ps))
581 return False;
583 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
584 return False;
586 if(!prs_unistr4("filename", ps, depth, &q_u->filename))
587 return False;
589 if(!prs_uint32("flags", ps, depth, &q_u->flags))
590 return False;
592 return True;
595 /*******************************************************************
596 reads or writes a structure.
597 ********************************************************************/
599 BOOL reg_io_r_restore_key(const char *desc, REG_R_RESTORE_KEY *r_u, prs_struct *ps, int depth)
601 if ( !r_u )
602 return False;
604 prs_debug(ps, depth, desc, "reg_io_r_restore_key");
605 depth++;
607 if(!prs_align(ps))
608 return False;
610 if(!prs_werror("status" , ps, depth, &r_u->status))
611 return False;
613 return True;
616 /*******************************************************************
617 ********************************************************************/
619 void init_q_reg_save_key( REG_Q_SAVE_KEY *q_u, POLICY_HND *handle, const char *fname )
621 memcpy(&q_u->pol, handle, sizeof(q_u->pol));
622 init_unistr4( &q_u->filename, fname, UNI_STR_TERMINATE );
623 q_u->sec_attr = NULL;
626 /*******************************************************************
627 reads or writes a structure.
628 ********************************************************************/
630 BOOL reg_io_q_save_key(const char *desc, REG_Q_SAVE_KEY *q_u, prs_struct *ps, int depth)
632 if ( !q_u )
633 return False;
635 prs_debug(ps, depth, desc, "reg_io_q_save_key");
636 depth++;
638 if(!prs_align(ps))
639 return False;
641 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
642 return False;
644 if(!prs_unistr4("filename", ps, depth, &q_u->filename))
645 return False;
647 #if 0 /* reg_io_sec_attr() */
648 if(!prs_uint32("unknown", ps, depth, &q_u->unknown))
649 return False;
650 #endif
652 return True;
655 /*******************************************************************
656 reads or writes a structure.
657 ********************************************************************/
659 BOOL reg_io_r_save_key(const char *desc, REG_R_SAVE_KEY *r_u, prs_struct *ps, int depth)
661 if ( !r_u )
662 return False;
664 prs_debug(ps, depth, desc, "reg_io_r_save_key");
665 depth++;
667 if(!prs_align(ps))
668 return False;
670 if(!prs_werror("status" , ps, depth, &r_u->status))
671 return False;
673 return True;
676 /*******************************************************************
677 Inits an REG_Q_CLOSE structure.
678 ********************************************************************/
680 void init_reg_q_close(REG_Q_CLOSE *q_c, POLICY_HND *hnd)
682 DEBUG(5,("init_reg_q_close\n"));
684 memcpy(&q_c->pol, hnd, sizeof(q_c->pol));
687 /*******************************************************************
688 reads or writes a structure.
689 ********************************************************************/
691 BOOL reg_io_q_close(const char *desc, REG_Q_CLOSE *q_u, prs_struct *ps, int depth)
693 if (q_u == NULL)
694 return False;
696 prs_debug(ps, depth, desc, "reg_io_q_close");
697 depth++;
699 if(!prs_align(ps))
700 return False;
702 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
703 return False;
704 if(!prs_align(ps))
705 return False;
707 return True;
710 /*******************************************************************
711 reads or writes a structure.
712 ********************************************************************/
714 BOOL reg_io_r_close(const char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth)
716 if ( !r_u )
717 return False;
719 prs_debug(ps, depth, desc, "reg_io_r_close");
720 depth++;
722 if(!prs_align(ps))
723 return False;
725 if(!smb_io_pol_hnd("", &r_u->pol, ps, depth))
726 return False;
727 if(!prs_align(ps))
728 return False;
730 if(!prs_werror("status", ps, depth, &r_u->status))
731 return False;
733 return True;
736 /*******************************************************************
737 makes a structure.
738 ********************************************************************/
740 void init_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_u, POLICY_HND *pol,
741 uint32 sec_info, SEC_DESC_BUF *sec_desc_buf)
743 memcpy(&q_u->handle, pol, sizeof(q_u->handle));
745 q_u->sec_info = sec_info;
747 q_u->ptr = 1;
748 init_buf_hdr(&q_u->hdr_sec, sec_desc_buf->len, sec_desc_buf->len);
749 q_u->data = sec_desc_buf;
752 /*******************************************************************
753 reads or writes a structure.
754 ********************************************************************/
756 BOOL reg_io_q_set_key_sec(const char *desc, REG_Q_SET_KEY_SEC *q_u, prs_struct *ps, int depth)
758 if ( !q_u )
759 return False;
761 prs_debug(ps, depth, desc, "reg_io_q_set_key_sec");
762 depth++;
764 if(!prs_align(ps))
765 return False;
767 if(!smb_io_pol_hnd("", &q_u->handle, ps, depth))
768 return False;
770 if(!prs_uint32("sec_info", ps, depth, &q_u->sec_info))
771 return False;
772 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
773 return False;
775 if(!reg_io_hdrbuf_sec(q_u->ptr, NULL, &q_u->hdr_sec, q_u->data, ps, depth))
776 return False;
778 return True;
781 /*******************************************************************
782 reads or writes a structure.
783 ********************************************************************/
785 BOOL reg_io_r_set_key_sec(const char *desc, REG_R_SET_KEY_SEC *q_u, prs_struct *ps, int depth)
787 if ( !q_u )
788 return False;
790 prs_debug(ps, depth, desc, "reg_io_r_set_key_sec");
791 depth++;
793 if(!prs_align(ps))
794 return False;
796 if(!prs_werror("status", ps, depth, &q_u->status))
797 return False;
799 return True;
803 /*******************************************************************
804 makes a structure.
805 ********************************************************************/
807 void init_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_u, POLICY_HND *pol,
808 uint32 sec_info, uint32 sec_buf_size,
809 SEC_DESC_BUF *psdb)
811 memcpy(&q_u->handle, pol, sizeof(q_u->handle));
813 q_u->sec_info = sec_info;
815 q_u->ptr = psdb != NULL ? 1 : 0;
816 q_u->data = psdb;
818 init_buf_hdr(&q_u->hdr_sec, sec_buf_size, 0);
821 /*******************************************************************
822 reads or writes a structure.
823 ********************************************************************/
825 BOOL reg_io_q_get_key_sec(const char *desc, REG_Q_GET_KEY_SEC *q_u, prs_struct *ps, int depth)
827 if ( !q_u )
828 return False;
830 prs_debug(ps, depth, desc, "reg_io_q_get_key_sec");
831 depth++;
833 if(!prs_align(ps))
834 return False;
836 if(!smb_io_pol_hnd("", &q_u->handle, ps, depth))
837 return False;
839 if(!prs_uint32("sec_info", ps, depth, &q_u->sec_info))
840 return False;
841 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
842 return False;
844 if(!reg_io_hdrbuf_sec(q_u->ptr, NULL, &q_u->hdr_sec, q_u->data, ps, depth))
845 return False;
847 return True;
850 #if 0
851 /*******************************************************************
852 makes a structure.
853 ********************************************************************/
854 void init_reg_r_get_key_sec(REG_R_GET_KEY_SEC *r_i, POLICY_HND *pol,
855 uint32 buf_len, uint8 *buf,
856 NTSTATUS status)
858 r_i->ptr = 1;
859 init_buf_hdr(&r_i->hdr_sec, buf_len, buf_len);
860 init_sec_desc_buf(r_i->data, buf_len, 1);
862 r_i->status = status; /* 0x0000 0000 or 0x0000 007a */
864 #endif
866 /*******************************************************************
867 reads or writes a structure.
868 ********************************************************************/
870 BOOL reg_io_r_get_key_sec(const char *desc, REG_R_GET_KEY_SEC *q_u, prs_struct *ps, int depth)
872 if ( !q_u )
873 return False;
875 prs_debug(ps, depth, desc, "reg_io_r_get_key_sec");
876 depth++;
878 if(!prs_align(ps))
879 return False;
881 if(!prs_uint32("ptr ", ps, depth, &q_u->ptr))
882 return False;
884 if (q_u->ptr != 0) {
885 if(!smb_io_hdrbuf("", &q_u->hdr_sec, ps, depth))
886 return False;
887 if(!sec_io_desc_buf("", &q_u->data, ps, depth))
888 return False;
889 if(!prs_align(ps))
890 return False;
893 if(!prs_werror("status", ps, depth, &q_u->status))
894 return False;
896 return True;
899 /*******************************************************************
900 makes a structure.
901 ********************************************************************/
903 BOOL init_reg_q_query_value(REG_Q_QUERY_VALUE *q_u, POLICY_HND *pol, const char *val_name,
904 REGVAL_BUFFER *value_output)
906 if (q_u == NULL)
907 return False;
909 q_u->pol = *pol;
911 init_unistr4(&q_u->name, val_name, UNI_STR_TERMINATE);
913 q_u->ptr_reserved = 1;
914 q_u->ptr_buf = 1;
916 q_u->ptr_bufsize = 1;
917 q_u->bufsize = value_output->buf_max_len;
918 q_u->buf_unk = 0;
920 q_u->unk1 = 0;
921 q_u->ptr_buflen = 1;
922 q_u->buflen = value_output->buf_max_len;
924 q_u->ptr_buflen2 = 1;
925 q_u->buflen2 = 0;
927 return True;
930 /*******************************************************************
931 reads or writes a structure.
932 ********************************************************************/
934 BOOL reg_io_q_query_value(const char *desc, REG_Q_QUERY_VALUE *q_u, prs_struct *ps, int depth)
936 if ( !q_u )
937 return False;
939 prs_debug(ps, depth, desc, "reg_io_q_query_value");
940 depth++;
942 if(!prs_align(ps))
943 return False;
945 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
946 return False;
947 if(!prs_unistr4("name", ps, depth, &q_u->name))
948 return False;
950 if(!prs_align(ps))
951 return False;
953 if(!prs_uint32("ptr_reserved", ps, depth, &(q_u->ptr_reserved)))
954 return False;
956 if(!prs_uint32("ptr_buf", ps, depth, &(q_u->ptr_buf)))
957 return False;
959 if(q_u->ptr_buf) {
960 if(!prs_uint32("ptr_bufsize", ps, depth, &(q_u->ptr_bufsize)))
961 return False;
962 if(!prs_uint32("bufsize", ps, depth, &(q_u->bufsize)))
963 return False;
964 if(!prs_uint32("buf_unk", ps, depth, &(q_u->buf_unk)))
965 return False;
968 if(!prs_uint32("unk1", ps, depth, &(q_u->unk1)))
969 return False;
971 if(!prs_uint32("ptr_buflen", ps, depth, &(q_u->ptr_buflen)))
972 return False;
974 if (q_u->ptr_buflen) {
975 if(!prs_uint32("buflen", ps, depth, &(q_u->buflen)))
976 return False;
977 if(!prs_uint32("ptr_buflen2", ps, depth, &(q_u->ptr_buflen2)))
978 return False;
979 if(!prs_uint32("buflen2", ps, depth, &(q_u->buflen2)))
980 return False;
983 return True;
986 /*******************************************************************
987 Inits a structure.
988 New version to replace older init_reg_r_query_value()
989 ********************************************************************/
991 BOOL init_reg_r_query_value(uint32 include_keyval, REG_R_QUERY_VALUE *r_u,
992 REGISTRY_VALUE *val, WERROR status)
994 uint32 buf_len = 0;
995 REGVAL_BUFFER buf2;
997 if( !r_u || !val )
998 return False;
1000 r_u->type = TALLOC_P( get_talloc_ctx(), uint32 );
1001 *r_u->type = val->type;
1003 buf_len = reg_init_regval_buffer( &buf2, val );
1005 r_u->buf_max_len = TALLOC_P( get_talloc_ctx(), uint32 );
1006 *r_u->buf_max_len = buf_len;
1008 r_u->buf_len = TALLOC_P( get_talloc_ctx(), uint32 );
1009 *r_u->buf_len = buf_len;
1011 /* if include_keyval is not set, don't send the key value, just
1012 the buflen data. probably used by NT5 to allocate buffer space - SK */
1014 if ( include_keyval ) {
1015 r_u->value = TALLOC_P( get_talloc_ctx(), REGVAL_BUFFER );
1016 /* steal the memory */
1017 *r_u->value = buf2;
1020 r_u->status = status;
1022 return True;
1025 /*******************************************************************
1026 reads or writes a structure.
1027 ********************************************************************/
1029 BOOL reg_io_r_query_value(const char *desc, REG_R_QUERY_VALUE *r_u, prs_struct *ps, int depth)
1031 if ( !r_u )
1032 return False;
1034 prs_debug(ps, depth, desc, "reg_io_r_query_value");
1035 depth++;
1037 if(!prs_align(ps))
1038 return False;
1040 if ( !prs_pointer("type", ps, depth, (void**)&r_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1041 return False;
1043 if ( !prs_pointer("value", ps, depth, (void**)&r_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer))
1044 return False;
1045 if(!prs_align(ps))
1046 return False;
1048 if ( !prs_pointer("buf_max_len", ps, depth, (void**)&r_u->buf_max_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1049 return False;
1050 if ( !prs_pointer("buf_len", ps, depth, (void**)&r_u->buf_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1051 return False;
1053 if(!prs_werror("status", ps, depth, &r_u->status))
1054 return False;
1056 return True;
1059 /*******************************************************************
1060 makes a structure.
1061 ********************************************************************/
1063 void init_reg_q_enum_val(REG_Q_ENUM_VALUE *q_u, POLICY_HND *pol,
1064 uint32 val_idx,
1065 uint32 max_name_len, uint32 max_buf_len)
1067 ZERO_STRUCTP(q_u);
1069 memcpy(&q_u->pol, pol, sizeof(q_u->pol));
1071 q_u->val_index = val_idx;
1073 q_u->name.size = max_name_len*2;
1074 q_u->name.string = TALLOC_ZERO_P( get_talloc_ctx(), UNISTR2 );
1075 q_u->name.string->uni_max_len = max_name_len;
1077 q_u->type = TALLOC_P( get_talloc_ctx(), uint32 );
1078 *q_u->type = 0x0;
1080 q_u->value = TALLOC_ZERO_P( get_talloc_ctx(), REGVAL_BUFFER );
1081 q_u->value->buf_max_len = max_buf_len;
1083 q_u->buffer_len = TALLOC_P( get_talloc_ctx(), uint32 );
1084 *q_u->buffer_len = max_buf_len;
1086 q_u->name_len = TALLOC_P( get_talloc_ctx(), uint32 );
1087 *q_u->name_len = 0x0;
1090 /*******************************************************************
1091 makes a structure.
1092 ********************************************************************/
1094 void init_reg_r_enum_val(REG_R_ENUM_VALUE *r_u, REGISTRY_VALUE *val )
1096 uint32 real_size;
1098 ZERO_STRUCTP(r_u);
1100 /* value name */
1102 DEBUG(10,("init_reg_r_enum_val: Valuename => [%s]\n", val->valuename));
1104 init_unistr4( &r_u->name, val->valuename, UNI_STR_TERMINATE);
1106 /* type */
1108 r_u->type = TALLOC_P( get_talloc_ctx(), uint32 );
1109 *r_u->type = val->type;
1111 /* REG_SZ & REG_MULTI_SZ must be converted to UNICODE */
1113 r_u->value = TALLOC_P( get_talloc_ctx(), REGVAL_BUFFER );
1114 real_size = reg_init_regval_buffer( r_u->value, val );
1116 /* lengths */
1118 r_u->buffer_len1 = TALLOC_P( get_talloc_ctx(), uint32 );
1119 *r_u->buffer_len1 = real_size;
1120 r_u->buffer_len2 = TALLOC_P( get_talloc_ctx(), uint32 );
1121 *r_u->buffer_len2 = real_size;
1124 /*******************************************************************
1125 reads or writes a structure.
1126 ********************************************************************/
1128 BOOL reg_io_q_enum_val(const char *desc, REG_Q_ENUM_VALUE *q_u, prs_struct *ps, int depth)
1130 if (q_u == NULL)
1131 return False;
1133 prs_debug(ps, depth, desc, "reg_io_q_enum_val");
1134 depth++;
1136 if(!prs_align(ps))
1137 return False;
1139 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
1140 return False;
1142 if(!prs_uint32("val_index", ps, depth, &q_u->val_index))
1143 return False;
1145 if(!prs_unistr4("name", ps, depth, &q_u->name ))
1146 return False;
1147 if(!prs_align(ps))
1148 return False;
1150 if(!prs_pointer("type", ps, depth, (void**)&q_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1151 return False;
1153 if ( !prs_pointer("value", ps, depth, (void**)&q_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer))
1154 return False;
1155 if(!prs_align(ps))
1156 return False;
1158 if(!prs_pointer("buffer_len", ps, depth, (void**)&q_u->buffer_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1159 return False;
1160 if(!prs_pointer("name_len", ps, depth, (void**)&q_u->name_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1161 return False;
1163 return True;
1166 /*******************************************************************
1167 reads or writes a structure.
1168 ********************************************************************/
1170 BOOL reg_io_r_enum_val(const char *desc, REG_R_ENUM_VALUE *r_u, prs_struct *ps, int depth)
1172 if ( !r_u )
1173 return False;
1175 prs_debug(ps, depth, desc, "reg_io_r_enum_val");
1176 depth++;
1178 if(!prs_align(ps))
1179 return False;
1181 if(!prs_unistr4("name", ps, depth, &r_u->name ))
1182 return False;
1183 if(!prs_align(ps))
1184 return False;
1186 if(!prs_pointer("type", ps, depth, (void**)&r_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1187 return False;
1189 if ( !prs_pointer("value", ps, depth, (void**)&r_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer))
1190 return False;
1191 if(!prs_align(ps))
1192 return False;
1194 if(!prs_pointer("buffer_len1", ps, depth, (void**)&r_u->buffer_len1, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1195 return False;
1196 if(!prs_pointer("buffer_len2", ps, depth, (void**)&r_u->buffer_len2, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32))
1197 return False;
1199 if(!prs_werror("status", ps, depth, &r_u->status))
1200 return False;
1202 return True;
1205 /*******************************************************************
1206 makes a structure.
1207 ********************************************************************/
1209 void init_reg_q_set_val(REG_Q_SET_VALUE *q_u, POLICY_HND *pol,
1210 char *val_name, uint32 type,
1211 RPC_DATA_BLOB *val)
1213 ZERO_STRUCTP(q_u);
1215 memcpy(&q_u->handle, pol, sizeof(q_u->handle));
1217 init_unistr4(&q_u->name, val_name, UNI_STR_TERMINATE);
1219 q_u->type = type;
1220 q_u->value = *val;
1221 q_u->size = val->buf_len;
1224 /*******************************************************************
1225 reads or writes a structure.
1226 ********************************************************************/
1228 BOOL reg_io_q_set_value(const char *desc, REG_Q_SET_VALUE *q_u, prs_struct *ps, int depth)
1230 if (q_u == NULL)
1231 return False;
1233 prs_debug(ps, depth, desc, "reg_io_q_set_value");
1234 depth++;
1236 if(!prs_align(ps))
1237 return False;
1239 if(!smb_io_pol_hnd("", &q_u->handle, ps, depth))
1240 return False;
1242 if(!prs_unistr4("name", ps, depth, &q_u->name ))
1243 return False;
1244 if(!prs_align(ps))
1245 return False;
1247 if(!prs_uint32("type", ps, depth, &q_u->type))
1248 return False;
1250 if(!smb_io_rpc_blob("value", &q_u->value, ps, depth ))
1251 return False;
1252 if(!prs_align(ps))
1253 return False;
1255 if(!prs_uint32("size", ps, depth, &q_u->size))
1256 return False;
1258 return True;
1261 /*******************************************************************
1262 reads or writes a structure.
1263 ********************************************************************/
1265 BOOL reg_io_r_set_value(const char *desc, REG_R_SET_VALUE *q_u, prs_struct *ps, int depth)
1267 if ( !q_u )
1268 return False;
1270 prs_debug(ps, depth, desc, "reg_io_r_set_value");
1271 depth++;
1273 if(!prs_align(ps))
1274 return False;
1276 if(!prs_werror("status", ps, depth, &q_u->status))
1277 return False;
1279 return True;
1282 /*******************************************************************
1283 makes a structure.
1284 ********************************************************************/
1286 void init_reg_q_enum_key(REG_Q_ENUM_KEY *q_u, POLICY_HND *pol, uint32 key_idx)
1288 memcpy(&q_u->pol, pol, sizeof(q_u->pol));
1290 q_u->key_index = key_idx;
1291 q_u->key_name_len = 0;
1292 q_u->unknown_1 = 0x0414;
1294 q_u->ptr1 = 1;
1295 q_u->unknown_2 = 0x0000020A;
1296 memset(q_u->pad1, 0, sizeof(q_u->pad1));
1298 q_u->ptr2 = 1;
1299 memset(q_u->pad2, 0, sizeof(q_u->pad2));
1301 q_u->ptr3 = 1;
1302 unix_to_nt_time(&q_u->time, 0); /* current time? */
1305 /*******************************************************************
1306 makes a reply structure.
1307 ********************************************************************/
1309 void init_reg_r_enum_key(REG_R_ENUM_KEY *r_u, char *subkey )
1311 if ( !r_u )
1312 return;
1314 init_unistr4( &r_u->keyname, subkey, STR_TERMINATE );
1315 r_u->classname = TALLOC_ZERO_P( get_talloc_ctx(), UNISTR4 );
1316 r_u->time = TALLOC_ZERO_P( get_talloc_ctx(), NTTIME );
1319 /*******************************************************************
1320 reads or writes a structure.
1321 ********************************************************************/
1323 BOOL reg_io_q_enum_key(const char *desc, REG_Q_ENUM_KEY *q_u, prs_struct *ps, int depth)
1325 if (q_u == NULL)
1326 return False;
1328 prs_debug(ps, depth, desc, "reg_io_q_enum_key");
1329 depth++;
1331 if(!prs_align(ps))
1332 return False;
1334 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
1335 return False;
1337 if(!prs_uint32("key_index", ps, depth, &q_u->key_index))
1338 return False;
1339 if(!prs_uint16("key_name_len", ps, depth, &q_u->key_name_len))
1340 return False;
1341 if(!prs_uint16("unknown_1", ps, depth, &q_u->unknown_1))
1342 return False;
1344 if(!prs_uint32("ptr1", ps, depth, &q_u->ptr1))
1345 return False;
1347 if (q_u->ptr1 != 0) {
1348 if(!prs_uint32("unknown_2", ps, depth, &q_u->unknown_2))
1349 return False;
1350 if(!prs_uint8s(False, "pad1", ps, depth, q_u->pad1, sizeof(q_u->pad1)))
1351 return False;
1354 if(!prs_uint32("ptr2", ps, depth, &q_u->ptr2))
1355 return False;
1357 if (q_u->ptr2 != 0) {
1358 if(!prs_uint8s(False, "pad2", ps, depth, q_u->pad2, sizeof(q_u->pad2)))
1359 return False;
1362 if(!prs_uint32("ptr3", ps, depth, &q_u->ptr3))
1363 return False;
1365 if (q_u->ptr3 != 0) {
1366 if(!smb_io_time("", &q_u->time, ps, depth))
1367 return False;
1370 return True;
1373 /*******************************************************************
1374 reads or writes a structure.
1375 ********************************************************************/
1377 BOOL reg_io_r_enum_key(const char *desc, REG_R_ENUM_KEY *q_u, prs_struct *ps, int depth)
1379 if ( !q_u )
1380 return False;
1382 prs_debug(ps, depth, desc, "reg_io_r_enum_key");
1383 depth++;
1385 if(!prs_align(ps))
1386 return False;
1387 if ( !prs_unistr4( "keyname", ps, depth, &q_u->keyname ) )
1388 return False;
1390 if(!prs_align(ps))
1391 return False;
1392 if (!prs_pointer("class", ps, depth, (void**)&q_u->classname, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4))
1393 return False;
1395 if(!prs_align(ps))
1396 return False;
1397 if (!prs_pointer("time", ps, depth, (void**)&q_u->time, sizeof(NTTIME), (PRS_POINTER_CAST)smb_io_nttime))
1398 return False;
1400 if(!prs_align(ps))
1401 return False;
1402 if(!prs_werror("status", ps, depth, &q_u->status))
1403 return False;
1405 return True;
1408 /*******************************************************************
1409 makes a structure.
1410 ********************************************************************/
1412 void init_reg_q_open_entry(REG_Q_OPEN_ENTRY *q_u, POLICY_HND *pol,
1413 char *key_name, uint32 access_desired)
1415 memcpy(&q_u->pol, pol, sizeof(q_u->pol));
1417 init_unistr4(&q_u->name, key_name, UNI_STR_TERMINATE);
1419 q_u->unknown_0 = 0x00000000;
1420 q_u->access = access_desired;
1423 /*******************************************************************
1424 reads or writes a structure.
1425 ********************************************************************/
1427 BOOL reg_io_q_open_entry(const char *desc, REG_Q_OPEN_ENTRY *q_u, prs_struct *ps, int depth)
1429 if ( !q_u )
1430 return False;
1432 prs_debug(ps, depth, desc, "reg_io_q_open_entry");
1433 depth++;
1435 if(!prs_align(ps))
1436 return False;
1438 if(!smb_io_pol_hnd("", &q_u->pol, ps, depth))
1439 return False;
1440 if(!prs_unistr4("name", ps, depth, &q_u->name))
1441 return False;
1443 if(!prs_align(ps))
1444 return False;
1446 if(!prs_uint32("unknown_0 ", ps, depth, &q_u->unknown_0))
1447 return False;
1448 if(!prs_uint32("access", ps, depth, &q_u->access))
1449 return False;
1451 return True;
1454 /*******************************************************************
1455 reads or writes a structure.
1456 ********************************************************************/
1458 BOOL reg_io_r_open_entry(const char *desc, REG_R_OPEN_ENTRY *r_u, prs_struct *ps, int depth)
1460 if ( !r_u )
1461 return False;
1463 prs_debug(ps, depth, desc, "reg_io_r_open_entry");
1464 depth++;
1466 if(!prs_align(ps))
1467 return False;
1469 if(!smb_io_pol_hnd("handle", &r_u->handle, ps, depth))
1470 return False;
1472 if(!prs_werror("status", ps, depth, &r_u->status))
1473 return False;
1475 return True;
1478 /*******************************************************************
1479 Inits a structure.
1480 ********************************************************************/
1482 void init_reg_q_shutdown(REG_Q_SHUTDOWN *q_u, const char *msg,
1483 uint32 timeout, BOOL do_reboot, BOOL force)
1485 q_u->server = TALLOC_P( get_talloc_ctx(), uint16 );
1486 *q_u->server = 0x1;
1488 q_u->message = TALLOC_P( get_talloc_ctx(), UNISTR4 );
1489 init_unistr4( q_u->message, msg, UNI_FLAGS_NONE );
1491 q_u->timeout = timeout;
1493 q_u->reboot = do_reboot ? 1 : 0;
1494 q_u->force = force ? 1 : 0;
1497 /*******************************************************************
1498 Inits a REG_Q_SHUTDOWN_EX structure.
1499 ********************************************************************/
1501 void init_reg_q_shutdown_ex(REG_Q_SHUTDOWN_EX * q_u_ex, const char *msg,
1502 uint32 timeout, BOOL do_reboot, BOOL force, uint32 reason)
1504 REG_Q_SHUTDOWN q_u;
1506 ZERO_STRUCT( q_u );
1508 init_reg_q_shutdown( &q_u, msg, timeout, do_reboot, force );
1510 /* steal memory */
1512 q_u_ex->server = q_u.server;
1513 q_u_ex->message = q_u.message;
1515 q_u_ex->reboot = q_u.reboot;
1516 q_u_ex->force = q_u.force;
1518 q_u_ex->reason = reason;
1521 /*******************************************************************
1522 reads or writes a structure.
1523 ********************************************************************/
1525 BOOL reg_io_q_shutdown(const char *desc, REG_Q_SHUTDOWN *q_u, prs_struct *ps,
1526 int depth)
1528 if ( !q_u )
1529 return False;
1531 prs_debug(ps, depth, desc, "reg_io_q_shutdown");
1532 depth++;
1534 if (!prs_align(ps))
1535 return False;
1537 if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16))
1538 return False;
1540 if (!prs_pointer("message", ps, depth, (void**)&q_u->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4))
1541 return False;
1543 if (!prs_align(ps))
1544 return False;
1546 if (!prs_uint32("timeout", ps, depth, &(q_u->timeout)))
1547 return False;
1549 if (!prs_uint8("force ", ps, depth, &(q_u->force)))
1550 return False;
1551 if (!prs_uint8("reboot ", ps, depth, &(q_u->reboot)))
1552 return False;
1555 return True;
1558 /*******************************************************************
1559 reads or writes a structure.
1560 ********************************************************************/
1561 BOOL reg_io_r_shutdown(const char *desc, REG_R_SHUTDOWN *r_u, prs_struct *ps,
1562 int depth)
1564 if ( !r_u )
1565 return False;
1567 prs_debug(ps, depth, desc, "reg_io_r_shutdown");
1568 depth++;
1570 if(!prs_align(ps))
1571 return False;
1573 if(!prs_werror("status", ps, depth, &r_u->status))
1574 return False;
1576 return True;
1579 /*******************************************************************
1580 reads or writes a REG_Q_SHUTDOWN_EX structure.
1581 ********************************************************************/
1583 BOOL reg_io_q_shutdown_ex(const char *desc, REG_Q_SHUTDOWN_EX *q_u, prs_struct *ps,
1584 int depth)
1586 if ( !q_u )
1587 return False;
1589 prs_debug(ps, depth, desc, "reg_io_q_shutdown_ex");
1590 depth++;
1592 if (!prs_align(ps))
1593 return False;
1595 if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16))
1596 return False;
1598 if (!prs_pointer("message", ps, depth, (void**)&q_u->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4))
1599 return False;
1601 if (!prs_align(ps))
1602 return False;
1604 if (!prs_uint32("timeout", ps, depth, &(q_u->timeout)))
1605 return False;
1607 if (!prs_uint8("force ", ps, depth, &(q_u->force)))
1608 return False;
1609 if (!prs_uint8("reboot ", ps, depth, &(q_u->reboot)))
1610 return False;
1612 if (!prs_align(ps))
1613 return False;
1614 if (!prs_uint32("reason", ps, depth, &(q_u->reason)))
1615 return False;
1618 return True;
1621 /*******************************************************************
1622 reads or writes a REG_R_SHUTDOWN_EX structure.
1623 ********************************************************************/
1624 BOOL reg_io_r_shutdown_ex(const char *desc, REG_R_SHUTDOWN_EX *r_u, prs_struct *ps,
1625 int depth)
1627 if ( !r_u )
1628 return False;
1630 prs_debug(ps, depth, desc, "reg_io_r_shutdown_ex");
1631 depth++;
1633 if(!prs_align(ps))
1634 return False;
1636 if(!prs_werror("status", ps, depth, &r_u->status))
1637 return False;
1639 return True;
1644 /*******************************************************************
1645 Inits a structure.
1646 ********************************************************************/
1647 void init_reg_q_abort_shutdown(REG_Q_ABORT_SHUTDOWN *q_u)
1649 q_u->server = TALLOC_P( get_talloc_ctx(), uint16 );
1650 *q_u->server = 0x1;
1653 /*******************************************************************
1654 reads or writes a structure.
1655 ********************************************************************/
1656 BOOL reg_io_q_abort_shutdown(const char *desc, REG_Q_ABORT_SHUTDOWN *q_u,
1657 prs_struct *ps, int depth)
1659 if ( !q_u )
1660 return False;
1662 prs_debug(ps, depth, desc, "reg_io_q_abort_shutdown");
1663 depth++;
1665 if (!prs_align(ps))
1666 return False;
1668 if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16))
1669 return False;
1671 return True;
1674 /*******************************************************************
1675 reads or writes a structure.
1676 ********************************************************************/
1677 BOOL reg_io_r_abort_shutdown(const char *desc, REG_R_ABORT_SHUTDOWN *r_u,
1678 prs_struct *ps, int depth)
1680 if ( !r_u )
1681 return False;
1683 prs_debug(ps, depth, desc, "reg_io_r_abort_shutdown");
1684 depth++;
1686 if (!prs_align(ps))
1687 return False;
1689 if (!prs_werror("status", ps, depth, &r_u->status))
1690 return False;
1692 return True;