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 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 */ 20 21#include "includes.h" 22 23#undef DBGC_CLASS 24#define DBGC_CLASS DBGC_RPC_PARSE 25 26/******************************************************************* 27********************************************************************/ 28 29BOOL ntsvcs_io_q_get_version(const char *desc, NTSVCS_Q_GET_VERSION *q_u, prs_struct *ps, int depth) 30{ 31 if (q_u == NULL) 32 return False; 33 34 prs_debug(ps, depth, desc, "ntsvcs_io_q_get_version"); 35 depth++; 36 37 /* there is nothing to parse in this PDU */ 38 39 return True; 40 41} 42 43/******************************************************************* 44********************************************************************/ 45 46BOOL ntsvcs_io_r_get_version(const char *desc, NTSVCS_R_GET_VERSION *r_u, prs_struct *ps, int depth) 47{ 48 if ( !r_u ) 49 return False; 50 51 prs_debug(ps, depth, desc, "ntsvcs_io_r_get_version"); 52 depth++; 53 54 if(!prs_align(ps)) 55 return False; 56 57 if(!prs_uint32("version", ps, depth, &r_u->version)) 58 return False; 59 60 if(!prs_werror("status", ps, depth, &r_u->status)) 61 return False; 62 63 return True; 64} 65 66/******************************************************************* 67********************************************************************/ 68 69BOOL ntsvcs_io_q_get_device_list_size(const char *desc, NTSVCS_Q_GET_DEVICE_LIST_SIZE *q_u, prs_struct *ps, int depth) 70{ 71 if (q_u == NULL) 72 return False; 73 74 prs_debug(ps, depth, desc, "ntsvcs_io_q_get_device_list_size"); 75 depth++; 76 77 if(!prs_align(ps)) 78 return False; 79 80 if ( !prs_pointer("devicename", ps, depth, (void*)&q_u->devicename, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2) ) 81 return False; 82 if ( !prs_align(ps) ) 83 return False; 84 85 if ( !prs_uint32("flags", ps, depth, &q_u->flags) ) 86 return False; 87 88 return True; 89 90} 91 92/******************************************************************* 93********************************************************************/ 94 95BOOL ntsvcs_io_r_get_device_list_size(const char *desc, NTSVCS_R_GET_DEVICE_LIST_SIZE *r_u, prs_struct *ps, int depth) 96{ 97 if ( !r_u ) 98 return False; 99 100 prs_debug(ps, depth, desc, "ntsvcs_io_r_get_device_list_size"); 101 depth++; 102 103 if(!prs_align(ps)) 104 return False; 105 106 if(!prs_uint32("size", ps, depth, &r_u->size)) 107 return False; 108 109 if(!prs_werror("status", ps, depth, &r_u->status)) 110 return False; 111 112 return True; 113} 114 115 116/******************************************************************* 117********************************************************************/ 118 119BOOL ntsvcs_io_q_get_device_list(const char *desc, NTSVCS_Q_GET_DEVICE_LIST *q_u, prs_struct *ps, int depth) 120{ 121 if (q_u == NULL) 122 return False; 123 124 prs_debug(ps, depth, desc, "ntsvcs_io_q_get_device_list"); 125 depth++; 126 127 if(!prs_align(ps)) 128 return False; 129 130 if ( !prs_pointer("devicename", ps, depth, (void*)&q_u->devicename, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2) ) 131 return False; 132 if( !prs_align(ps) ) 133 return False; 134 135 if ( !prs_uint32("buffer_size", ps, depth, &q_u->buffer_size) ) 136 return False; 137 if ( !prs_uint32("flags", ps, depth, &q_u->flags) ) 138 return False; 139 140 return True; 141 142} 143 144/******************************************************************* 145********************************************************************/ 146 147BOOL ntsvcs_io_r_get_device_list(const char *desc, NTSVCS_R_GET_DEVICE_LIST *r_u, prs_struct *ps, int depth) 148{ 149 if ( !r_u ) 150 return False; 151 152 prs_debug(ps, depth, desc, "ntsvcs_io_r_get_device_list_size"); 153 depth++; 154 155 if(!prs_align(ps)) 156 return False; 157 158 if ( !prs_io_unistr2("devicepath", ps, depth, &r_u->devicepath) ) 159 return False; 160 if(!prs_align(ps)) 161 return False; 162 163 if(!prs_uint32("needed", ps, depth, &r_u->needed)) 164 return False; 165 166 if(!prs_werror("status", ps, depth, &r_u->status)) 167 return False; 168 169 return True; 170} 171 172/******************************************************************* 173********************************************************************/ 174 175BOOL ntsvcs_io_q_validate_device_instance(const char *desc, NTSVCS_Q_VALIDATE_DEVICE_INSTANCE *q_u, prs_struct *ps, int depth) 176{ 177 if (q_u == NULL) 178 return False; 179 180 prs_debug(ps, depth, desc, "ntsvcs_io_q_validate_device_instance"); 181 depth++; 182 183 if(!prs_align(ps)) 184 return False; 185 186 if ( !prs_io_unistr2("devicepath", ps, depth, &q_u->devicepath) ) 187 return False; 188 if( !prs_align(ps) ) 189 return False; 190 191 if ( !prs_uint32("flags", ps, depth, &q_u->flags) ) 192 return False; 193 194 return True; 195 196} 197 198/******************************************************************* 199********************************************************************/ 200 201BOOL ntsvcs_io_r_validate_device_instance(const char *desc, NTSVCS_R_VALIDATE_DEVICE_INSTANCE *r_u, prs_struct *ps, int depth) 202{ 203 if ( !r_u ) 204 return False; 205 206 prs_debug(ps, depth, desc, "ntsvcs_io_r_validate_device_instance"); 207 depth++; 208 209 if(!prs_werror("status", ps, depth, &r_u->status)) 210 return False; 211 212 return True; 213} 214 215/******************************************************************* 216********************************************************************/ 217 218BOOL ntsvcs_io_q_get_device_reg_property(const char *desc, NTSVCS_Q_GET_DEVICE_REG_PROPERTY *q_u, prs_struct *ps, int depth) 219{ 220 if (q_u == NULL) 221 return False; 222 223 prs_debug(ps, depth, desc, "ntsvcs_io_q_get_device_reg_property"); 224 depth++; 225 226 if(!prs_align(ps)) 227 return False; 228 229 if ( !prs_io_unistr2("devicepath", ps, depth, &q_u->devicepath) ) 230 return False; 231 if( !prs_align(ps) ) 232 return False; 233 234 if ( !prs_uint32("property", ps, depth, &q_u->property) ) 235 return False; 236 if ( !prs_uint32("unknown2", ps, depth, &q_u->unknown2) ) 237 return False; 238 if ( !prs_uint32("buffer_size1", ps, depth, &q_u->buffer_size1) ) 239 return False; 240 if ( !prs_uint32("buffer_size2", ps, depth, &q_u->buffer_size2) ) 241 return False; 242 if ( !prs_uint32("unknown5", ps, depth, &q_u->unknown5) ) 243 return False; 244 245 return True; 246 247} 248 249/******************************************************************* 250********************************************************************/ 251 252BOOL ntsvcs_io_r_get_device_reg_property(const char *desc, NTSVCS_R_GET_DEVICE_REG_PROPERTY *r_u, prs_struct *ps, int depth) 253{ 254 if ( !r_u ) 255 return False; 256 257 prs_debug(ps, depth, desc, "ntsvcs_io_r_get_device_reg_property"); 258 depth++; 259 260 if ( !prs_align(ps) ) 261 return False; 262 263 if ( !prs_uint32("unknown1", ps, depth, &r_u->unknown1) ) 264 return False; 265 266 if ( !smb_io_regval_buffer("value", ps, depth, &r_u->value) ) 267 return False; 268 if ( !prs_align(ps) ) 269 return False; 270 271 if ( !prs_uint32("size", ps, depth, &r_u->size) ) 272 return False; 273 274 if ( !prs_uint32("needed", ps, depth, &r_u->needed) ) 275 return False; 276 277 if(!prs_werror("status", ps, depth, &r_u->status)) 278 return False; 279 280 return True; 281} 282 283/******************************************************************* 284********************************************************************/ 285 286BOOL ntsvcs_io_q_get_hw_profile_info(const char *desc, NTSVCS_Q_GET_HW_PROFILE_INFO *q_u, prs_struct *ps, int depth) 287{ 288 if (q_u == NULL) 289 return False; 290 291 prs_debug(ps, depth, desc, "ntsvcs_io_q_get_hw_profile_info"); 292 depth++; 293 294 if(!prs_align(ps)) 295 return False; 296 297 if ( !prs_uint32("index", ps, depth, &q_u->index) ) 298 return False; 299 300 q_u->buffer_size = 0x000000a8; 301 302 if ( UNMARSHALLING(ps) ) { 303 q_u->buffer = TALLOC_ARRAY(get_talloc_ctx(), uint8, q_u->buffer_size ); 304 if (!q_u->buffer) { 305 return False; 306 } 307 } 308 309 if ( !prs_uint8s(True, "buffer", ps, depth, q_u->buffer, q_u->buffer_size) ) 310 return False; 311 312 if ( !prs_uint32("buffer_size", ps, depth, &q_u->buffer_size) ) 313 return False; 314 315 if ( !prs_uint32("unknown1", ps, depth, &q_u->unknown1) ) 316 return False; 317 318 return True; 319 320} 321 322/******************************************************************* 323********************************************************************/ 324 325BOOL ntsvcs_io_r_get_hw_profile_info(const char *desc, NTSVCS_R_GET_HW_PROFILE_INFO *r_u, prs_struct *ps, int depth) 326{ 327 if ( !r_u ) 328 return False; 329 330 prs_debug(ps, depth, desc, "ntsvcs_io_r_get_device_reg_property"); 331 depth++; 332 333 if ( !prs_align(ps) ) 334 return False; 335 336 if ( UNMARSHALLING(ps) ) { 337 if (r_u->buffer_size) { 338 r_u->buffer = TALLOC_ARRAY(get_talloc_ctx(), uint8, r_u->buffer_size ); 339 if (!r_u->buffer) { 340 return False; 341 } 342 } else { 343 r_u->buffer = NULL; 344 } 345 } 346 347 if ( !prs_uint8s(True, "buffer", ps, depth, r_u->buffer, r_u->buffer_size) ) 348 return False; 349 350 if(!prs_werror("status", ps, depth, &r_u->status)) 351 return False; 352 353 return True; 354} 355 356/******************************************************************* 357********************************************************************/ 358 359BOOL ntsvcs_io_q_hw_profile_flags(const char *desc, NTSVCS_Q_HW_PROFILE_FLAGS *q_u, prs_struct *ps, int depth) 360{ 361 if (q_u == NULL) 362 return False; 363 364 prs_debug(ps, depth, desc, "ntsvcs_io_q_hw_profile_flags"); 365 depth++; 366 367 if(!prs_align(ps)) 368 return False; 369 370 if ( !prs_uint32("unknown1", ps, depth, &q_u->unknown1) ) 371 return False; 372 373 374 if ( !prs_io_unistr2("devicepath", ps, depth, &q_u->devicepath) ) 375 return False; 376 if( !prs_align(ps) ) 377 return False; 378 379 if ( !prs_uint32("unknown2", ps, depth, &q_u->unknown2) ) 380 return False; 381 if ( !prs_uint32("unknown3", ps, depth, &q_u->unknown3) ) 382 return False; 383 if ( !prs_uint32("unknown4", ps, depth, &q_u->unknown4) ) 384 return False; 385 if ( !prs_uint32("unknown5", ps, depth, &q_u->unknown5) ) 386 return False; 387 if ( !prs_uint32("unknown6", ps, depth, &q_u->unknown6) ) 388 return False; 389 if ( !prs_uint32("unknown7", ps, depth, &q_u->unknown7) ) 390 return False; 391 392 if ( !prs_uint32("unknown1", ps, depth, &q_u->unknown1) ) 393 return False; 394 395 return True; 396 397} 398 399/******************************************************************* 400********************************************************************/ 401 402BOOL ntsvcs_io_r_hw_profile_flags(const char *desc, NTSVCS_R_HW_PROFILE_FLAGS *r_u, prs_struct *ps, int depth) 403{ 404 if ( !r_u ) 405 return False; 406 407 prs_debug(ps, depth, desc, "ntsvcs_io_r_hw_profile_flags"); 408 depth++; 409 410 if ( !prs_align(ps) ) 411 return False; 412 413 if ( !prs_uint32("unknown1", ps, depth, &r_u->unknown1) ) 414 return False; 415 if ( !prs_uint32("unknown2", ps, depth, &r_u->unknown2) ) 416 return False; 417 if ( !prs_uint32("unknown3", ps, depth, &r_u->unknown3) ) 418 return False; 419 if(!prs_werror("status", ps, depth, &r_u->status)) 420 return False; 421 422 return True; 423} 424 425 426 427 428