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

WERROR cli_spoolss_open_printer_ex ( struct cli_state *  cli,
TALLOC_CTX mem_ctx,
char *  printername,
const char *  datatype,
uint32  access_required,
char *  station,
char *  username,
POLICY_HND *  pol 
)

Return a handle to the specified printer or print server.

Parameters:
cli Pointer to client state structure which is open on the SPOOLSS pipe.
mem_ctx Pointer to an initialised talloc context.
printername The name of the printer or print server to be opened in UNC format.
datatype Specifies the default data type for the printer.
access_required The access rights requested on the printer or print server.
station The UNC name of the requesting workstation.
username The name of the user requesting the open.
pol Returned policy handle.

Definition at line 282 of file cli_spoolss.c.

{
      prs_struct qbuf, rbuf;
      SPOOL_Q_OPEN_PRINTER_EX q;
      SPOOL_R_OPEN_PRINTER_EX r;
      WERROR result = W_ERROR(ERRgeneral);

      ZERO_STRUCT(q);
      ZERO_STRUCT(r);

      /* Initialise parse structures */

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

      /* Initialise input parameters */

        make_spoolss_q_open_printer_ex(&q, printername, datatype,
                                       access_required, station, username);
      
      /* Marshall data and send request */

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

      /* Unmarshall response */

      if (!spoolss_io_r_open_printer_ex("", &r, &rbuf, 0))
            goto done;

      /* Return output parameters */

      result = r.status;

      if (W_ERROR_IS_OK(result))
            *pol = r.handle;

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

      return result;
}


Generated by  Doxygen 1.6.0   Back to index