Fix bug #7669.
[Samba.git] / source / rpc_parse / parse_ntsvcs.c
blob2b15a45506cc352e890b3bc21b1befad623e7064
1 /*
2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Gerald (Jerry) Carter 2005.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #include "includes.h"
22 #undef DBGC_CLASS
23 #define DBGC_CLASS DBGC_RPC_PARSE
25 /*******************************************************************
26 ********************************************************************/
28 bool ntsvcs_io_q_get_device_list(const char *desc, NTSVCS_Q_GET_DEVICE_LIST *q_u, prs_struct *ps, int depth)
30 if (q_u == NULL)
31 return False;
33 prs_debug(ps, depth, desc, "ntsvcs_io_q_get_device_list");
34 depth++;
36 if(!prs_align(ps))
37 return False;
39 if ( !prs_pointer("devicename", ps, depth, (void*)&q_u->devicename, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2) )
40 return False;
41 if( !prs_align(ps) )
42 return False;
44 if ( !prs_uint32("buffer_size", ps, depth, &q_u->buffer_size) )
45 return False;
46 if ( !prs_uint32("flags", ps, depth, &q_u->flags) )
47 return False;
49 return True;
53 /*******************************************************************
54 ********************************************************************/
56 bool ntsvcs_io_r_get_device_list(const char *desc, NTSVCS_R_GET_DEVICE_LIST *r_u, prs_struct *ps, int depth)
58 if ( !r_u )
59 return False;
61 prs_debug(ps, depth, desc, "ntsvcs_io_r_get_device_list_size");
62 depth++;
64 if(!prs_align(ps))
65 return False;
67 if ( !prs_io_unistr2("devicepath", ps, depth, &r_u->devicepath) )
68 return False;
69 if(!prs_align(ps))
70 return False;
72 if(!prs_uint32("needed", ps, depth, &r_u->needed))
73 return False;
75 if(!prs_werror("status", ps, depth, &r_u->status))
76 return False;
78 return True;
81 /*******************************************************************
82 ********************************************************************/
84 bool ntsvcs_io_q_get_device_reg_property(const char *desc, NTSVCS_Q_GET_DEVICE_REG_PROPERTY *q_u, prs_struct *ps, int depth)
86 if (q_u == NULL)
87 return False;
89 prs_debug(ps, depth, desc, "ntsvcs_io_q_get_device_reg_property");
90 depth++;
92 if(!prs_align(ps))
93 return False;
95 if ( !prs_io_unistr2("devicepath", ps, depth, &q_u->devicepath) )
96 return False;
97 if( !prs_align(ps) )
98 return False;
100 if ( !prs_uint32("property", ps, depth, &q_u->property) )
101 return False;
102 if ( !prs_uint32("unknown2", ps, depth, &q_u->unknown2) )
103 return False;
104 if ( !prs_uint32("buffer_size1", ps, depth, &q_u->buffer_size1) )
105 return False;
106 if ( !prs_uint32("buffer_size2", ps, depth, &q_u->buffer_size2) )
107 return False;
108 if ( !prs_uint32("unknown5", ps, depth, &q_u->unknown5) )
109 return False;
111 return True;
115 /*******************************************************************
116 ********************************************************************/
118 bool ntsvcs_io_r_get_device_reg_property(const char *desc, NTSVCS_R_GET_DEVICE_REG_PROPERTY *r_u, prs_struct *ps, int depth)
120 if ( !r_u )
121 return False;
123 prs_debug(ps, depth, desc, "ntsvcs_io_r_get_device_reg_property");
124 depth++;
126 if ( !prs_align(ps) )
127 return False;
129 if ( !prs_uint32("unknown1", ps, depth, &r_u->unknown1) )
130 return False;
132 if ( !smb_io_regval_buffer("value", ps, depth, &r_u->value) )
133 return False;
134 if ( !prs_align(ps) )
135 return False;
137 if ( !prs_uint32("size", ps, depth, &r_u->size) )
138 return False;
140 if ( !prs_uint32("needed", ps, depth, &r_u->needed) )
141 return False;
143 if(!prs_werror("status", ps, depth, &r_u->status))
144 return False;
146 return True;