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_hw_prof_flags(struct rpc_pipe_client *cli,
85 const char *devicepath = NULL;
86 uint32_t profile_flags = 0;
87 uint16_t veto_type = 0;
88 const char *unk5 = NULL;
89 const char *unk5a = NULL;
92 printf("usage: %s [devicepath]\n", argv[0]);
98 status = rpccli_PNP_HwProfFlags(cli, mem_ctx,
109 if (!NT_STATUS_IS_OK(status)) {
110 return ntstatus_to_werror(status);
116 static WERROR cmd_ntsvcs_get_hw_prof_info(struct rpc_pipe_client *cli,
124 struct PNP_HwProfInfo info;
125 uint32_t size = 0, flags = 0;
129 status = rpccli_PNP_GetHwProfInfo(cli, mem_ctx,
135 if (!NT_STATUS_IS_OK(status)) {
136 return ntstatus_to_werror(status);
142 static WERROR cmd_ntsvcs_get_dev_reg_prop(struct rpc_pipe_client *cli,
149 const char *devicepath = NULL;
150 uint32_t property = DEV_REGPROP_DESC;
151 uint32_t reg_data_type = REG_NONE;
153 uint32_t buffer_size = 0;
158 printf("usage: %s [devicepath] [buffersize]\n", argv[0]);
162 devicepath = argv[1];
165 buffer_size = atoi(argv[2]);
166 needed = buffer_size;
169 buffer = talloc_array(mem_ctx, uint8_t, buffer_size);
170 W_ERROR_HAVE_NO_MEMORY(buffer);
172 status = rpccli_PNP_GetDeviceRegProp(cli, mem_ctx,
181 if (!NT_STATUS_IS_OK(status)) {
182 return ntstatus_to_werror(status);
188 static WERROR cmd_ntsvcs_get_dev_list_size(struct rpc_pipe_client *cli,
197 const char *filter = NULL;
200 printf("usage: %s [filter] [flags]\n", argv[0]);
209 flags = atoi(argv[2]);
212 status = rpccli_PNP_GetDeviceListSize(cli, mem_ctx,
217 if (!NT_STATUS_IS_OK(status)) {
218 return ntstatus_to_werror(status);
221 printf("size: %d\n", size);
226 static WERROR cmd_ntsvcs_get_dev_list(struct rpc_pipe_client *cli,
233 const char *filter = NULL;
234 uint16_t *buffer = NULL;
239 printf("usage: %s [length] [filter]\n", argv[0]);
244 length = atoi(argv[1]);
251 buffer = talloc(mem_ctx, uint16_t);
256 status = rpccli_PNP_GetDeviceList(cli, mem_ctx,
262 if (!NT_STATUS_IS_OK(status)) {
263 return ntstatus_to_werror(status);
266 printf("devlist needs size: %d\n", length);
271 struct cmd_set ntsvcs_commands[] = {
274 { "ntsvcs_getversion", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_get_version, &ndr_table_ntsvcs.syntax_id, NULL, "Query NTSVCS version", "" },
275 { "ntsvcs_validatedevinst", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_validate_dev_inst, &ndr_table_ntsvcs.syntax_id, NULL, "Query NTSVCS device instance", "" },
276 { "ntsvcs_hwprofflags", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_hw_prof_flags, &ndr_table_ntsvcs.syntax_id, NULL, "Query NTSVCS HW prof flags", "" },
277 { "ntsvcs_hwprofinfo", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_get_hw_prof_info, &ndr_table_ntsvcs.syntax_id, NULL, "Query NTSVCS HW prof info", "" },
278 { "ntsvcs_getdevregprop", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_get_dev_reg_prop, &ndr_table_ntsvcs.syntax_id, NULL, "Query NTSVCS device registry property", "" },
279 { "ntsvcs_getdevlistsize", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_get_dev_list_size, &ndr_table_ntsvcs.syntax_id, NULL, "Query NTSVCS device list size", "" },
280 { "ntsvcs_getdevlist", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_get_dev_list, &ndr_table_ntsvcs.syntax_id, NULL, "Query NTSVCS device list", "" },