diff options
-rw-r--r-- | source3/rpcclient/cmd_spoolss.c | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c index eaee516ad5..51fcaaa54c 100644 --- a/source3/rpcclient/cmd_spoolss.c +++ b/source3/rpcclient/cmd_spoolss.c @@ -1978,6 +1978,28 @@ static void display_form_info1(struct spoolss_FormInfo1 *r) /**************************************************************************** ****************************************************************************/ +static void display_form_info2(struct spoolss_FormInfo2 *r) +{ + printf("%s\n" \ + "\tflag: %s (%d)\n" \ + "\twidth: %d, length: %d\n" \ + "\tleft: %d, right: %d, top: %d, bottom: %d\n", + r->form_name, get_form_flag(r->flags), r->flags, + r->size.width, r->size.height, + r->area.left, r->area.right, + r->area.top, r->area.bottom); + printf("\tkeyword: %s\n", r->keyword); + printf("\tstring_type: 0x%08x\n", r->string_type); + printf("\tmui_dll: %s\n", r->mui_dll); + printf("\tressource_id: 0x%08x\n", r->ressource_id); + printf("\tdisplay_name: %s\n", r->display_name); + printf("\tlang_id: %d\n", r->lang_id); + printf("\n"); +} + +/**************************************************************************** +****************************************************************************/ + static WERROR cmd_spoolss_getform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv) { @@ -1989,11 +2011,12 @@ static WERROR cmd_spoolss_getform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c uint32_t offered = 0; union spoolss_FormInfo info; uint32_t needed; + uint32_t level = 1; /* Parse the command arguments */ - if (argc != 3) { - printf ("Usage: %s <printer> <formname>\n", argv[0]); + if (argc < 3 || argc > 5) { + printf ("Usage: %s <printer> <formname> [level]\n", argv[0]); return WERR_OK; } @@ -2008,24 +2031,28 @@ static WERROR cmd_spoolss_getform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c if (!W_ERROR_IS_OK(werror)) goto done; + if (argc == 4) { + level = atoi(argv[3]); + } + /* Get the form */ status = rpccli_spoolss_GetForm(cli, mem_ctx, &handle, argv[2], - 1, + level, NULL, offered, &info, &needed, &werror); if (W_ERROR_EQUAL(werror, WERR_INSUFFICIENT_BUFFER)) { - buffer = data_blob_talloc(mem_ctx, NULL, needed); + buffer = data_blob_talloc_zero(mem_ctx, needed); offered = needed; status = rpccli_spoolss_GetForm(cli, mem_ctx, &handle, argv[2], - 1, + level, &buffer, offered, &info, @@ -2037,7 +2064,15 @@ static WERROR cmd_spoolss_getform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return werror; } - display_form_info1(&info.info1); + switch (level) { + case 1: + display_form_info1(&info.info1); + break; + case 2: + display_form_info2(&info.info2); + break; + } + done: if (is_valid_policy_hnd(&handle)) rpccli_spoolss_ClosePrinter(cli, mem_ctx, &handle, NULL); |