2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
5 * Copyright (C) Gerald (Jerry) Carter 2005.
6 * Copyright (C) Guenther Deschner 2008,2009.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, see <http://www.gnu.org/licenses/>.
23 #include "../librpc/gen_ndr/srv_ntsvcs.h"
27 #define DBGC_CLASS DBGC_RPC_SRV
29 /********************************************************************
30 ********************************************************************/
32 static char* get_device_path(TALLOC_CTX
*mem_ctx
, const char *device
)
34 return talloc_asprintf(mem_ctx
, "ROOT\\Legacy_%s\\0000", device
);
37 /********************************************************************
38 ********************************************************************/
40 WERROR
_PNP_GetVersion(pipes_struct
*p
,
41 struct PNP_GetVersion
*r
)
43 *r
->out
.version
= 0x0400; /* no idea what this means */
48 /********************************************************************
49 ********************************************************************/
51 WERROR
_PNP_GetDeviceListSize(pipes_struct
*p
,
52 struct PNP_GetDeviceListSize
*r
)
56 if ((r
->in
.flags
& CM_GETIDLIST_FILTER_SERVICE
) &&
57 (!r
->in
.devicename
)) {
58 return WERR_CM_INVALID_POINTER
;
61 if (!(devicepath
= get_device_path(p
->mem_ctx
, r
->in
.devicename
))) {
65 *r
->out
.size
= strlen(devicepath
) + 2;
67 TALLOC_FREE(devicepath
);
72 /****************************************************************
74 ****************************************************************/
76 WERROR
_PNP_GetDeviceList(pipes_struct
*p
,
77 struct PNP_GetDeviceList
*r
)
81 const char **multi_sz
= NULL
;
84 if ((r
->in
.flags
& CM_GETIDLIST_FILTER_SERVICE
) &&
86 return WERR_CM_INVALID_POINTER
;
89 if (!(devicepath
= get_device_path(p
->mem_ctx
, r
->in
.filter
))) {
93 size
= strlen(devicepath
) + 2;
95 if (*r
->in
.length
< size
) {
96 return WERR_CM_BUFFER_SMALL
;
99 multi_sz
= talloc_zero_array(p
->mem_ctx
, const char *, 2);
104 multi_sz
[0] = devicepath
;
106 if (!push_reg_multi_sz(multi_sz
, &blob
, multi_sz
)) {
110 if (*r
->in
.length
< blob
.length
/2) {
111 return WERR_CM_BUFFER_SMALL
;
114 memcpy(r
->out
.buffer
, blob
.data
, blob
.length
);
119 /********************************************************************
120 _PNP_GetDeviceRegProp
121 ********************************************************************/
123 WERROR
_PNP_GetDeviceRegProp(pipes_struct
*p
,
124 struct PNP_GetDeviceRegProp
*r
)
127 struct regval_ctr
*values
;
128 struct regval_blob
*val
;
130 switch( r
->in
.property
) {
131 case DEV_REGPROP_DESC
:
133 /* just parse the service name from the device path and then
134 lookup the display name */
135 if ( !(ptr
= strrchr_m( r
->in
.devicepath
, '\\' )) )
136 return WERR_GENERAL_FAILURE
;
139 if ( !(ptr
= strrchr_m( r
->in
.devicepath
, '_' )) )
140 return WERR_GENERAL_FAILURE
;
143 if ( !(values
= svcctl_fetch_regvalues(
144 ptr
, p
->server_info
->ptok
)))
145 return WERR_GENERAL_FAILURE
;
147 if ( !(val
= regval_ctr_getvalue( values
, "DisplayName" )) ) {
148 TALLOC_FREE( values
);
149 return WERR_GENERAL_FAILURE
;
152 if (*r
->in
.buffer_size
< val
->size
) {
153 *r
->out
.needed
= val
->size
;
154 *r
->out
.buffer_size
= 0;
155 TALLOC_FREE( values
);
156 return WERR_CM_BUFFER_SMALL
;
159 r
->out
.buffer
= (uint8_t *)talloc_memdup(p
->mem_ctx
, val
->data_p
, val
->size
);
161 if (!r
->out
.buffer
) {
165 *r
->out
.reg_data_type
= REG_SZ
; /* always 1...tested using a remove device manager connection */
166 *r
->out
.buffer_size
= val
->size
;
167 *r
->out
.needed
= val
->size
;
172 *r
->out
.reg_data_type
= 0x00437c98; /* ??? */
173 return WERR_CM_NO_SUCH_VALUE
;
179 /********************************************************************
180 ********************************************************************/
182 WERROR
_PNP_ValidateDeviceInstance(pipes_struct
*p
,
183 struct PNP_ValidateDeviceInstance
*r
)
189 /********************************************************************
190 ********************************************************************/
192 WERROR
_PNP_GetHwProfInfo(pipes_struct
*p
,
193 struct PNP_GetHwProfInfo
*r
)
195 /* steal the incoming buffer */
197 r
->out
.info
= r
->in
.info
;
199 /* Take the 5th Ammentment */
201 return WERR_CM_NO_MORE_HW_PROFILES
;
204 /********************************************************************
205 ********************************************************************/
207 WERROR
_PNP_HwProfFlags(pipes_struct
*p
,
208 struct PNP_HwProfFlags
*r
)
210 /* just nod your head */
215 /****************************************************************
216 ****************************************************************/
218 WERROR
_PNP_Disconnect(pipes_struct
*p
,
219 struct PNP_Disconnect
*r
)
221 p
->rng_fault_state
= true;
222 return WERR_NOT_SUPPORTED
;
225 /****************************************************************
226 ****************************************************************/
228 WERROR
_PNP_Connect(pipes_struct
*p
,
229 struct PNP_Connect
*r
)
231 p
->rng_fault_state
= true;
232 return WERR_NOT_SUPPORTED
;
235 /****************************************************************
236 ****************************************************************/
238 WERROR
_PNP_GetGlobalState(pipes_struct
*p
,
239 struct PNP_GetGlobalState
*r
)
241 p
->rng_fault_state
= true;
242 return WERR_NOT_SUPPORTED
;
245 /****************************************************************
246 ****************************************************************/
248 WERROR
_PNP_InitDetection(pipes_struct
*p
,
249 struct PNP_InitDetection
*r
)
251 p
->rng_fault_state
= true;
252 return WERR_NOT_SUPPORTED
;
255 /****************************************************************
256 ****************************************************************/
258 WERROR
_PNP_ReportLogOn(pipes_struct
*p
,
259 struct PNP_ReportLogOn
*r
)
261 p
->rng_fault_state
= true;
262 return WERR_NOT_SUPPORTED
;
265 /****************************************************************
266 ****************************************************************/
268 WERROR
_PNP_GetRootDeviceInstance(pipes_struct
*p
,
269 struct PNP_GetRootDeviceInstance
*r
)
271 p
->rng_fault_state
= true;
272 return WERR_NOT_SUPPORTED
;
275 /****************************************************************
276 ****************************************************************/
278 WERROR
_PNP_GetRelatedDeviceInstance(pipes_struct
*p
,
279 struct PNP_GetRelatedDeviceInstance
*r
)
281 p
->rng_fault_state
= true;
282 return WERR_NOT_SUPPORTED
;
285 /****************************************************************
286 ****************************************************************/
288 WERROR
_PNP_EnumerateSubKeys(pipes_struct
*p
,
289 struct PNP_EnumerateSubKeys
*r
)
291 p
->rng_fault_state
= true;
292 return WERR_NOT_SUPPORTED
;
295 /****************************************************************
296 ****************************************************************/
298 WERROR
_PNP_GetDepth(pipes_struct
*p
,
299 struct PNP_GetDepth
*r
)
301 p
->rng_fault_state
= true;
302 return WERR_NOT_SUPPORTED
;
305 /****************************************************************
306 ****************************************************************/
308 WERROR
_PNP_SetDeviceRegProp(pipes_struct
*p
,
309 struct PNP_SetDeviceRegProp
*r
)
311 p
->rng_fault_state
= true;
312 return WERR_NOT_SUPPORTED
;
315 /****************************************************************
316 ****************************************************************/
318 WERROR
_PNP_GetClassInstance(pipes_struct
*p
,
319 struct PNP_GetClassInstance
*r
)
321 p
->rng_fault_state
= true;
322 return WERR_NOT_SUPPORTED
;
325 /****************************************************************
326 ****************************************************************/
328 WERROR
_PNP_CreateKey(pipes_struct
*p
,
329 struct PNP_CreateKey
*r
)
331 p
->rng_fault_state
= true;
332 return WERR_NOT_SUPPORTED
;
335 /****************************************************************
336 ****************************************************************/
338 WERROR
_PNP_DeleteRegistryKey(pipes_struct
*p
,
339 struct PNP_DeleteRegistryKey
*r
)
341 p
->rng_fault_state
= true;
342 return WERR_NOT_SUPPORTED
;
345 /****************************************************************
346 ****************************************************************/
348 WERROR
_PNP_GetClassCount(pipes_struct
*p
,
349 struct PNP_GetClassCount
*r
)
351 p
->rng_fault_state
= true;
352 return WERR_NOT_SUPPORTED
;
355 /****************************************************************
356 ****************************************************************/
358 WERROR
_PNP_GetClassName(pipes_struct
*p
,
359 struct PNP_GetClassName
*r
)
361 p
->rng_fault_state
= true;
362 return WERR_NOT_SUPPORTED
;
365 /****************************************************************
366 ****************************************************************/
368 WERROR
_PNP_DeleteClassKey(pipes_struct
*p
,
369 struct PNP_DeleteClassKey
*r
)
371 p
->rng_fault_state
= true;
372 return WERR_NOT_SUPPORTED
;
375 /****************************************************************
376 ****************************************************************/
378 WERROR
_PNP_GetInterfaceDeviceAlias(pipes_struct
*p
,
379 struct PNP_GetInterfaceDeviceAlias
*r
)
381 p
->rng_fault_state
= true;
382 return WERR_NOT_SUPPORTED
;
385 /****************************************************************
386 ****************************************************************/
388 WERROR
_PNP_GetInterfaceDeviceList(pipes_struct
*p
,
389 struct PNP_GetInterfaceDeviceList
*r
)
391 p
->rng_fault_state
= true;
392 return WERR_NOT_SUPPORTED
;
395 /****************************************************************
396 ****************************************************************/
398 WERROR
_PNP_GetInterfaceDeviceListSize(pipes_struct
*p
,
399 struct PNP_GetInterfaceDeviceListSize
*r
)
401 p
->rng_fault_state
= true;
402 return WERR_NOT_SUPPORTED
;
405 /****************************************************************
406 ****************************************************************/
408 WERROR
_PNP_RegisterDeviceClassAssociation(pipes_struct
*p
,
409 struct PNP_RegisterDeviceClassAssociation
*r
)
411 p
->rng_fault_state
= true;
412 return WERR_NOT_SUPPORTED
;
415 /****************************************************************
416 ****************************************************************/
418 WERROR
_PNP_UnregisterDeviceClassAssociation(pipes_struct
*p
,
419 struct PNP_UnregisterDeviceClassAssociation
*r
)
421 p
->rng_fault_state
= true;
422 return WERR_NOT_SUPPORTED
;
425 /****************************************************************
426 ****************************************************************/
428 WERROR
_PNP_GetClassRegProp(pipes_struct
*p
,
429 struct PNP_GetClassRegProp
*r
)
431 p
->rng_fault_state
= true;
432 return WERR_NOT_SUPPORTED
;
435 /****************************************************************
436 ****************************************************************/
438 WERROR
_PNP_SetClassRegProp(pipes_struct
*p
,
439 struct PNP_SetClassRegProp
*r
)
441 p
->rng_fault_state
= true;
442 return WERR_NOT_SUPPORTED
;
445 /****************************************************************
446 ****************************************************************/
448 WERROR
_PNP_CreateDevInst(pipes_struct
*p
,
449 struct PNP_CreateDevInst
*r
)
451 p
->rng_fault_state
= true;
452 return WERR_NOT_SUPPORTED
;
455 /****************************************************************
456 ****************************************************************/
458 WERROR
_PNP_DeviceInstanceAction(pipes_struct
*p
,
459 struct PNP_DeviceInstanceAction
*r
)
461 p
->rng_fault_state
= true;
462 return WERR_NOT_SUPPORTED
;
465 /****************************************************************
466 ****************************************************************/
468 WERROR
_PNP_GetDeviceStatus(pipes_struct
*p
,
469 struct PNP_GetDeviceStatus
*r
)
471 p
->rng_fault_state
= true;
472 return WERR_NOT_SUPPORTED
;
475 /****************************************************************
476 ****************************************************************/
478 WERROR
_PNP_SetDeviceProblem(pipes_struct
*p
,
479 struct PNP_SetDeviceProblem
*r
)
481 p
->rng_fault_state
= true;
482 return WERR_NOT_SUPPORTED
;
485 /****************************************************************
486 ****************************************************************/
488 WERROR
_PNP_DisableDevInst(pipes_struct
*p
,
489 struct PNP_DisableDevInst
*r
)
491 p
->rng_fault_state
= true;
492 return WERR_NOT_SUPPORTED
;
495 /****************************************************************
496 ****************************************************************/
498 WERROR
_PNP_UninstallDevInst(pipes_struct
*p
,
499 struct PNP_UninstallDevInst
*r
)
501 p
->rng_fault_state
= true;
502 return WERR_NOT_SUPPORTED
;
505 /****************************************************************
506 ****************************************************************/
508 WERROR
_PNP_AddID(pipes_struct
*p
,
511 p
->rng_fault_state
= true;
512 return WERR_NOT_SUPPORTED
;
515 /****************************************************************
516 ****************************************************************/
518 WERROR
_PNP_RegisterDriver(pipes_struct
*p
,
519 struct PNP_RegisterDriver
*r
)
521 p
->rng_fault_state
= true;
522 return WERR_NOT_SUPPORTED
;
525 /****************************************************************
526 ****************************************************************/
528 WERROR
_PNP_QueryRemove(pipes_struct
*p
,
529 struct PNP_QueryRemove
*r
)
531 p
->rng_fault_state
= true;
532 return WERR_NOT_SUPPORTED
;
535 /****************************************************************
536 ****************************************************************/
538 WERROR
_PNP_RequestDeviceEject(pipes_struct
*p
,
539 struct PNP_RequestDeviceEject
*r
)
541 p
->rng_fault_state
= true;
542 return WERR_NOT_SUPPORTED
;
545 /****************************************************************
546 ****************************************************************/
548 WERROR
_PNP_IsDockStationPresent(pipes_struct
*p
,
549 struct PNP_IsDockStationPresent
*r
)
551 p
->rng_fault_state
= true;
552 return WERR_NOT_SUPPORTED
;
555 /****************************************************************
556 ****************************************************************/
558 WERROR
_PNP_RequestEjectPC(pipes_struct
*p
,
559 struct PNP_RequestEjectPC
*r
)
561 p
->rng_fault_state
= true;
562 return WERR_NOT_SUPPORTED
;
565 /****************************************************************
566 ****************************************************************/
568 WERROR
_PNP_AddEmptyLogConf(pipes_struct
*p
,
569 struct PNP_AddEmptyLogConf
*r
)
571 p
->rng_fault_state
= true;
572 return WERR_NOT_SUPPORTED
;
575 /****************************************************************
576 ****************************************************************/
578 WERROR
_PNP_FreeLogConf(pipes_struct
*p
,
579 struct PNP_FreeLogConf
*r
)
581 p
->rng_fault_state
= true;
582 return WERR_NOT_SUPPORTED
;
585 /****************************************************************
586 ****************************************************************/
588 WERROR
_PNP_GetFirstLogConf(pipes_struct
*p
,
589 struct PNP_GetFirstLogConf
*r
)
591 p
->rng_fault_state
= true;
592 return WERR_NOT_SUPPORTED
;
595 /****************************************************************
596 ****************************************************************/
598 WERROR
_PNP_GetNextLogConf(pipes_struct
*p
,
599 struct PNP_GetNextLogConf
*r
)
601 p
->rng_fault_state
= true;
602 return WERR_NOT_SUPPORTED
;
605 /****************************************************************
606 ****************************************************************/
608 WERROR
_PNP_GetLogConfPriority(pipes_struct
*p
,
609 struct PNP_GetLogConfPriority
*r
)
611 p
->rng_fault_state
= true;
612 return WERR_NOT_SUPPORTED
;
615 /****************************************************************
616 ****************************************************************/
618 WERROR
_PNP_AddResDes(pipes_struct
*p
,
619 struct PNP_AddResDes
*r
)
621 p
->rng_fault_state
= true;
622 return WERR_NOT_SUPPORTED
;
625 /****************************************************************
626 ****************************************************************/
628 WERROR
_PNP_FreeResDes(pipes_struct
*p
,
629 struct PNP_FreeResDes
*r
)
631 p
->rng_fault_state
= true;
632 return WERR_NOT_SUPPORTED
;
635 /****************************************************************
636 ****************************************************************/
638 WERROR
_PNP_GetNextResDes(pipes_struct
*p
,
639 struct PNP_GetNextResDes
*r
)
641 p
->rng_fault_state
= true;
642 return WERR_NOT_SUPPORTED
;
645 /****************************************************************
646 ****************************************************************/
648 WERROR
_PNP_GetResDesData(pipes_struct
*p
,
649 struct PNP_GetResDesData
*r
)
651 p
->rng_fault_state
= true;
652 return WERR_NOT_SUPPORTED
;
655 /****************************************************************
656 ****************************************************************/
658 WERROR
_PNP_GetResDesDataSize(pipes_struct
*p
,
659 struct PNP_GetResDesDataSize
*r
)
661 p
->rng_fault_state
= true;
662 return WERR_NOT_SUPPORTED
;
665 /****************************************************************
666 ****************************************************************/
668 WERROR
_PNP_ModifyResDes(pipes_struct
*p
,
669 struct PNP_ModifyResDes
*r
)
671 p
->rng_fault_state
= true;
672 return WERR_NOT_SUPPORTED
;
675 /****************************************************************
676 ****************************************************************/
678 WERROR
_PNP_DetectResourceLimit(pipes_struct
*p
,
679 struct PNP_DetectResourceLimit
*r
)
681 p
->rng_fault_state
= true;
682 return WERR_NOT_SUPPORTED
;
685 /****************************************************************
686 ****************************************************************/
688 WERROR
_PNP_QueryResConfList(pipes_struct
*p
,
689 struct PNP_QueryResConfList
*r
)
691 p
->rng_fault_state
= true;
692 return WERR_NOT_SUPPORTED
;
695 /****************************************************************
696 ****************************************************************/
698 WERROR
_PNP_SetHwProf(pipes_struct
*p
,
699 struct PNP_SetHwProf
*r
)
701 p
->rng_fault_state
= true;
702 return WERR_NOT_SUPPORTED
;
705 /****************************************************************
706 ****************************************************************/
708 WERROR
_PNP_QueryArbitratorFreeData(pipes_struct
*p
,
709 struct PNP_QueryArbitratorFreeData
*r
)
711 p
->rng_fault_state
= true;
712 return WERR_NOT_SUPPORTED
;
715 /****************************************************************
716 ****************************************************************/
718 WERROR
_PNP_QueryArbitratorFreeSize(pipes_struct
*p
,
719 struct PNP_QueryArbitratorFreeSize
*r
)
721 p
->rng_fault_state
= true;
722 return WERR_NOT_SUPPORTED
;
725 /****************************************************************
726 ****************************************************************/
728 WERROR
_PNP_RunDetection(pipes_struct
*p
,
729 struct PNP_RunDetection
*r
)
731 p
->rng_fault_state
= true;
732 return WERR_NOT_SUPPORTED
;
735 /****************************************************************
736 ****************************************************************/
738 WERROR
_PNP_RegisterNotification(pipes_struct
*p
,
739 struct PNP_RegisterNotification
*r
)
741 p
->rng_fault_state
= true;
742 return WERR_NOT_SUPPORTED
;
745 /****************************************************************
746 ****************************************************************/
748 WERROR
_PNP_UnregisterNotification(pipes_struct
*p
,
749 struct PNP_UnregisterNotification
*r
)
751 p
->rng_fault_state
= true;
752 return WERR_NOT_SUPPORTED
;
755 /****************************************************************
756 ****************************************************************/
758 WERROR
_PNP_GetCustomDevProp(pipes_struct
*p
,
759 struct PNP_GetCustomDevProp
*r
)
761 p
->rng_fault_state
= true;
762 return WERR_NOT_SUPPORTED
;
765 /****************************************************************
766 ****************************************************************/
768 WERROR
_PNP_GetVersionInternal(pipes_struct
*p
,
769 struct PNP_GetVersionInternal
*r
)
771 p
->rng_fault_state
= true;
772 return WERR_NOT_SUPPORTED
;
775 /****************************************************************
776 ****************************************************************/
778 WERROR
_PNP_GetBlockedDriverInfo(pipes_struct
*p
,
779 struct PNP_GetBlockedDriverInfo
*r
)
781 p
->rng_fault_state
= true;
782 return WERR_NOT_SUPPORTED
;
785 /****************************************************************
786 ****************************************************************/
788 WERROR
_PNP_GetServerSideDeviceInstallFlags(pipes_struct
*p
,
789 struct PNP_GetServerSideDeviceInstallFlags
*r
)
791 p
->rng_fault_state
= true;
792 return WERR_NOT_SUPPORTED
;