Logo Search packages:      
Sourcecode: samba-doc-ja version File versions

WERROR cli_spoolss_getprinterdriver ( struct cli_state *  cli,
TALLOC_CTX mem_ctx,
uint32  offered,
uint32 *  needed,
POLICY_HND *  pol,
uint32  level,
const char *  env,
PRINTER_DRIVER_CTR *  ctr 
)

Get installed printer drivers for a given printer

Parameters:
cli Pointer to client state structure which is open on the SPOOLSS pipe.
mem_ctx Pointer to an initialised talloc context.
offered Buffer size offered in the request.
needed Number of bytes needed to complete the request. may be NULL.
pol Pointer to an open policy handle for the printer opened with cli_spoolss_open_printer_ex().
level Requested information level.
env The print environment or archictecture. This is "Windows NT x86" for NT4.
ctr Returned printer driver information.

Definition at line 727 of file cli_spoolss.c.

{
      prs_struct qbuf, rbuf;
      SPOOL_Q_GETPRINTERDRIVER2 q;
        SPOOL_R_GETPRINTERDRIVER2 r;
      NEW_BUFFER buffer;
      WERROR result = W_ERROR(ERRgeneral);
      fstring server;

      ZERO_STRUCT(q);
      ZERO_STRUCT(r);

      fstrcpy (server, cli->desthost);
      strupper (server);

            /* Initialise input parameters */

      init_buffer(&buffer, offered, mem_ctx);

            prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
            prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);

      make_spoolss_q_getprinterdriver2(&q, pol, env, level, 2, 2,
                               &buffer, offered);

      /* Marshall data and send request */

            if (!spoolss_io_q_getprinterdriver2 ("", &q, &qbuf, 0) ||
                !rpc_api_pipe_req (cli, SPOOLSS_GETPRINTERDRIVER2, &qbuf, &rbuf)) 
                  goto done;

            /* Unmarshall response */

      if (spoolss_io_r_getprinterdriver2 ("", &r, &rbuf, 0)) {
            if (needed)
                  *needed = r.needed;
            }
            
      result = r.status;

            /* Return output parameters */
            
      if (!W_ERROR_IS_OK(result))
            goto done;

      if (!ctr)
            goto done;

      switch (level) {
                  case 1:
                        decode_printer_driver_1(mem_ctx, r.buffer, 1, &ctr->info1);
                        break;
                  case 2:
                        decode_printer_driver_2(mem_ctx, r.buffer, 1, &ctr->info2);
                        break;
                  case 3:
                        decode_printer_driver_3(mem_ctx, r.buffer, 1, &ctr->info3);
                        break;
                  }                 

      done:
            prs_mem_free(&qbuf);
            prs_mem_free(&rbuf);

      return result;    
}


Generated by  Doxygen 1.6.0   Back to index