2 Unix SMB/CIFS implementation.
5 Copyright (C) Günther Deschner 2008
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "rpcclient.h"
24 static WERROR cmd_ntsvcs_get_version(struct rpc_pipe_client *cli,
33 status = rpccli_PNP_GetVersion(cli, mem_ctx,
35 if (!NT_STATUS_IS_OK(status)) {
36 return ntstatus_to_werror(status);
39 if (W_ERROR_IS_OK(werr)) {
40 printf("version: %d\n", version);
46 static WERROR cmd_ntsvcs_validate_dev_inst(struct rpc_pipe_client *cli,
53 const char *devicepath = NULL;
56 if (argc < 2 || argc > 3) {
57 printf("usage: %s [devicepath] <flags>\n", argv[0]);
64 flags = atoi(argv[2]);
67 status = rpccli_PNP_ValidateDeviceInstance(cli, mem_ctx,
71 if (!NT_STATUS_IS_OK(status)) {
72 return ntstatus_to_werror(status);
78 static WERROR cmd_ntsvcs_get_device_list_size(struct rpc_pipe_client *cli,
85 const char *devicename = NULL;
89 if (argc < 2 || argc > 4) {
90 printf("usage: %s [devicename] <flags>\n", argv[0]);
97 flags = atoi(argv[2]);
100 status = rpccli_PNP_GetDeviceListSize(cli, mem_ctx,
105 if (!NT_STATUS_IS_OK(status)) {
106 return ntstatus_to_werror(status);
109 if (W_ERROR_IS_OK(werr)) {
110 printf("size: %d\n", size);
116 static WERROR cmd_ntsvcs_hw_prof_flags(struct rpc_pipe_client *cli,
123 const char *devicepath = NULL;
126 const char *unk5 = NULL;
127 const char *unk5a = NULL;
130 printf("usage: %s [devicepath]\n", argv[0]);
134 devicepath = argv[1];
136 status = rpccli_PNP_HwProfFlags(cli, mem_ctx,
147 if (!NT_STATUS_IS_OK(status)) {
148 return ntstatus_to_werror(status);
154 static WERROR cmd_ntsvcs_get_hw_prof_info(struct rpc_pipe_client *cli,
162 struct PNP_HwProfInfo info;
163 uint32_t unknown1 = 0, unknown2 = 0;
167 status = rpccli_PNP_GetHwProfInfo(cli, mem_ctx,
173 if (!NT_STATUS_IS_OK(status)) {
174 return ntstatus_to_werror(status);
180 static WERROR cmd_ntsvcs_get_dev_reg_prop(struct rpc_pipe_client *cli,
187 const char *devicepath = NULL;
188 uint32_t property = DEV_REGPROP_DESC;
189 uint32_t unknown1 = 0;
191 uint32_t buffer_size = 0;
192 uint32_t unknown2 = 0;
193 uint32_t unknown3 = 0;
196 printf("usage: %s [devicepath]\n", argv[0]);
200 devicepath = argv[1];
202 status = rpccli_PNP_GetDeviceRegProp(cli, mem_ctx,
211 if (!NT_STATUS_IS_OK(status)) {
212 return ntstatus_to_werror(status);
219 struct cmd_set ntsvcs_commands[] = {
222 { "ntsvcs_getversion", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_get_version, PI_NTSVCS, NULL, "Query NTSVCS version", "" },
223 { "ntsvcs_validatedevinst", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_validate_dev_inst, PI_NTSVCS, NULL, "Query NTSVCS device instance", "" },
224 { "ntsvcs_getdevlistsize", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_get_device_list_size, PI_NTSVCS, NULL, "Query NTSVCS get device list", "" },
225 { "ntsvcs_hwprofflags", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_hw_prof_flags, PI_NTSVCS, NULL, "Query NTSVCS HW prof flags", "" },
226 { "ntsvcs_hwprofinfo", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_get_hw_prof_info, PI_NTSVCS, NULL, "Query NTSVCS HW prof info", "" },
227 { "ntsvcs_getdevregprop", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_get_dev_reg_prop, PI_NTSVCS, NULL, "Query NTSVCS device registry property", "" },