summaryrefslogtreecommitdiff
path: root/source3/rpc_server/srv_spoolss_util.h
blob: 0ef57bca3d814847dc6ac6392724d69b04f5e340 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/*
 *  Unix SMB/CIFS implementation.
 *
 *  SPOOLSS RPC Pipe server / winreg client routines
 *
 *  Copyright (c) 2010      Andreas Schneider <asn@samba.org>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _SRV_SPOOLSS_UITL_H
#define _SRV_SPOOLSS_UITL_H

/**
 * @internal
 *
 * @brief Set printer data over the winreg pipe.
 *
 * @param[in]  p        The pipes structure to be able to open a new pipe.
 *
 * @param[in]  printer  The printer name.
 *
 * @param[in]  key      The key of the printer data to store the value.
 *
 * @param[in]  value    The value name to save.
 *
 * @param[in]  type     The type of the value to use.
 *
 * @param[in]  data     The data which sould be saved under the given value.
 *
 * @param[in]  data_size The size of the data.
 *
 * @return              On success WERR_OK, a corresponding DOS error is
 *                      something went wrong.
 */
WERROR winreg_set_printer_dataex(struct pipes_struct *p,
				 const char *printer,
				 const char *key,
				 const char *value,
				 enum winreg_Type type,
				 uint8_t *data,
				 uint32_t data_size);

/**
 * @internal
 *
 * @brief Get printer data over a winreg pipe.
 *
 * @param[in]  p        The pipes structure to be able to open a new pipe.
 *
 * @param[in]  printer  The printer name.
 *
 * @param[in]  key      The key of the printer data to get the value.
 *
 * @param[in]  value    The name of the value to query.
 *
 * @param[in]  type     The type of the value to query.
 *
 * @param[out] data     A pointer to store the data.
 *
 * @param[out] data_size A pointer to store the size of the data.
 *
 * @return              On success WERR_OK, a corresponding DOS error is
 *                      something went wrong.
 */
WERROR winreg_get_printer_dataex(struct pipes_struct *p,
				 const char *printer,
				 const char *key,
				 const char *value,
				 enum winreg_Type *type,
				 uint8_t **data,
				 uint32_t *data_size);

/**
 * @internal
 *
 * @brief Enumerate on the values of a given key and provide the data.
 *
 * @param[in]  p        The pipes structure to be able to open a new pipe.
 *
 * @param[in]  printer  The printer name.
 *
 * @param[in]  key      The key of the printer data to get the value.
 *
 * @param[out] pnum_values A pointer to store the number of values we found.
 *
 * @param[out] penum_values A pointer to store the values and its data.
 *
 * @return                   WERR_OK on success, the corresponding DOS error
 *                           code if something gone wrong.
 */
WERROR winreg_enum_printer_dataex(struct pipes_struct *p,
				  const char *printer,
				  const char *key,
				  uint32_t *pnum_values,
				  struct spoolss_PrinterEnumValues **penum_values);

/**
 * @internal
 *
 * @brief Delete printer data over a winreg pipe.
 *
 * @param[in]  p        The pipes structure to be able to open a new pipe.
 *
 * @param[in]  printer  The printer name.
 *
 * @param[in]  key      The key of the printer data to delete.
 *
 * @param[in]  value    The name of the value to delete.
 *
 * @return              On success WERR_OK, a corresponding DOS error is
 *                      something went wrong.
 */
WERROR winreg_delete_printer_dataex(struct pipes_struct *p,
				    const char *printer,
				    const char *key,
				    const char *value);

/**
 * @internal
 *
 * @brief Enumerate on the subkeys of a given key and provide the data.
 *
 * @param[in]  p        The pipes structure to be able to open a new pipe.
 *
 * @param[in]  printer  The printer name.
 *
 * @param[in]  key      The key of the printer data to get the value.
 *
 * @param[out] pnum_subkeys A pointer to store the number of subkeys found.
 *
 * @param[in]  psubkeys A pointer to an array to store the names of the subkeys
 *                      found.
 *
 * @return              WERR_OK on success, the corresponding DOS error
 *                      code if something gone wrong.
 */
WERROR winreg_enum_printer_key(struct pipes_struct *p,
			       const char *printer,
			       const char *key,
			       uint32_t *pnum_subkeys,
			       const char ***psubkeys);

/**
 * @internal
 *
 * @brief Delete a key with subkeys of a given printer.
 *
 * @param[in]  p        The pipes structure to be able to open a new pipe.
 *
 * @param[in]  printer  The printer name.
 *
 * @param[in]  key      The key of the printer to delete.
 *
 * @return              On success WERR_OK, a corresponding DOS error is
 *                      something went wrong.
 */
WERROR winreg_delete_printer_key(struct pipes_struct *p,
				 const char *printer,
				 const char *key);

#endif /* _SRV_SPOOLSS_UITL_H */