struct spoolss_PrinterInfo2 *info2;
uint32_t access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
struct policy_handle hive_hnd, key_hnd;
- struct spoolss_PrinterEnumValues *enum_values = NULL;
+ struct spoolss_PrinterEnumValues enum_value;
struct spoolss_PrinterEnumValues *v = NULL;
enum ndr_err_code ndr_err;
DATA_BLOB blob;
char *path;
NTSTATUS status;
WERROR result = WERR_OK;
+ const char **enum_names = NULL;
+ enum winreg_Type *enum_types = NULL;
+ DATA_BLOB *enum_data_blobs = NULL;
TALLOC_CTX *tmp_ctx;
tmp_ctx = talloc_stackframe();
goto done;
}
- result = winreg_printer_enumvalues(tmp_ctx,
- winreg_handle,
- &key_hnd,
- &num_values,
- &enum_values);
+ status = dcerpc_winreg_enumvals(tmp_ctx,
+ winreg_handle,
+ &key_hnd,
+ &num_values,
+ &enum_names,
+ &enum_types,
+ &enum_data_blobs,
+ &result);
+ if (!NT_STATUS_IS_OK(status)){
+ result = ntstatus_to_werror(status);
+ }
+
if (!W_ERROR_IS_OK(result)) {
DEBUG(0, ("winreg_get_printer: Could not enumerate values in %s: %s\n",
path, win_errstr(result)));
FILL_STRING(info2, EMPTY_STRING, info2->parameters);
for (i = 0; i < num_values; i++) {
- v = &enum_values[i];
+ enum_value.value_name = enum_names[i];
+ enum_value.value_name_len = 2*strlen_m_term(enum_names[i]);
+ enum_value.type = enum_types[i];
+ enum_value.data_length = enum_data_blobs[i].length;
+ enum_value.data = NULL;
+ if (enum_value.data_length != 0){
+ enum_value.data = &enum_data_blobs[i];
+ }
+ v = &enum_value;
result = winreg_enumval_to_sz(info2,
v,
uint32_t *pnum_values,
struct spoolss_PrinterEnumValues **penum_values)
{
+ uint32_t i;
uint32_t access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
struct policy_handle hive_hnd, key_hnd;
uint32_t num_values = 0;
char *path;
WERROR result = WERR_OK;
+ NTSTATUS status;
+ const char **enum_names = NULL;
+ enum winreg_Type *enum_types = NULL;
+ DATA_BLOB *enum_data_blobs = NULL;
TALLOC_CTX *tmp_ctx;
goto done;
}
- result = winreg_printer_enumvalues(tmp_ctx,
- winreg_handle,
- &key_hnd,
- &num_values,
- &enum_values);
+ status = dcerpc_winreg_enumvals(tmp_ctx,
+ winreg_handle,
+ &key_hnd,
+ &num_values,
+ &enum_names,
+ &enum_types,
+ &enum_data_blobs,
+ &result);
+ if (!NT_STATUS_IS_OK(status)){
+ result = ntstatus_to_werror(status);
+ }
+
if (!W_ERROR_IS_OK(result)) {
DEBUG(0, ("winreg_enum_printer_dataex: Could not enumerate values in %s: %s\n",
key, win_errstr(result)));
goto done;
}
+ enum_values = talloc_array(tmp_ctx, struct spoolss_PrinterEnumValues, num_values);
+ if (enum_values == NULL){
+ result = WERR_NOMEM;
+ DEBUG(0, ("winreg_enum_printer_dataex: Could not enumerate values in %s: %s\n",
+ key, win_errstr(result)));
+ goto done;
+ }
+
+ for (i = 0; i < num_values; i++){
+ enum_values[i].value_name = enum_names[i];
+ enum_values[i].value_name_len = strlen_m_term(enum_names[i]) * 2;
+ enum_values[i].type = enum_types[i];
+ enum_values[i].data_length = enum_data_blobs[i].length;
+ enum_values[i].data = NULL;
+
+ if (enum_values[i].data_length != 0){
+ enum_values[i].data = &enum_data_blobs[i];
+ }
+ }
+
+ enum_names = talloc_move(mem_ctx, &enum_names);
+ enum_types = talloc_move(mem_ctx, &enum_types);
+ enum_data_blobs = talloc_move(mem_ctx, &enum_data_blobs);
+
*pnum_values = num_values;
if (penum_values) {
*penum_values = talloc_move(mem_ctx, &enum_values);
uint32_t num_builtin = ARRAY_SIZE(builtin_forms1);
uint32_t i;
WERROR result;
+ NTSTATUS status;
+ const char **enum_names = NULL;
+ enum winreg_Type *enum_types = NULL;
+ DATA_BLOB *enum_data_blobs = NULL;
TALLOC_CTX *tmp_ctx;
tmp_ctx = talloc_stackframe();
goto done;
}
- result = winreg_printer_enumvalues(tmp_ctx,
- winreg_handle,
- &key_hnd,
- &num_values,
- &enum_values);
+ status = dcerpc_winreg_enumvals(tmp_ctx,
+ winreg_handle,
+ &key_hnd,
+ &num_values,
+ &enum_names,
+ &enum_types,
+ &enum_data_blobs,
+ &result);
+ if (!NT_STATUS_IS_OK(status)){
+ result = ntstatus_to_werror(status);
+ }
+
+ if (!W_ERROR_IS_OK(result)) {
+ DEBUG(0, ("winreg_printer_enumforms1: Could not enumerate values in %s: %s\n",
+ TOP_LEVEL_CONTROL_FORMS_KEY, win_errstr(result)));
+ goto done;
+ }
+
+ enum_values = talloc_zero_array(tmp_ctx,
+ struct spoolss_PrinterEnumValues,
+ num_values);
+ if (enum_values == NULL){
+ result = WERR_NOMEM;
+ goto done;
+ }
+
+ for (i = 0; i < num_values; i++){
+ enum_values[i].value_name = enum_names[i];
+ enum_values[i].value_name_len = strlen_m_term(enum_names[i]) * 2;
+ enum_values[i].type = enum_types[i];
+ enum_values[i].data_length = enum_data_blobs[i].length;
+ enum_values[i].data = NULL;
+ if (enum_values[i].data_length != 0){
+ enum_values[i].data = &enum_data_blobs[i];
+ }
+ }
+
if (!W_ERROR_IS_OK(result)) {
DEBUG(0, ("winreg_printer_enumforms1: Could not enumerate values in %s: %s\n",
TOP_LEVEL_CONTROL_FORMS_KEY, win_errstr(result)));
uint32_t num_values = 0;
TALLOC_CTX *tmp_ctx;
WERROR result;
+ NTSTATUS status;
uint32_t i;
+ const char **enum_names = NULL;
+ enum winreg_Type *enum_types = NULL;
+ DATA_BLOB *enum_data_blobs = NULL;
ZERO_STRUCT(hive_hnd);
ZERO_STRUCT(key_hnd);
goto done;
}
- result = winreg_printer_enumvalues(tmp_ctx,
- winreg_handle,
- &key_hnd,
- &num_values,
- &enum_values);
+ status = dcerpc_winreg_enumvals(tmp_ctx,
+ winreg_handle,
+ &key_hnd,
+ &num_values,
+ &enum_names,
+ &enum_types,
+ &enum_data_blobs,
+ &result);
+ if (!NT_STATUS_IS_OK(status)){
+ result = ntstatus_to_werror(status);
+ }
+
if (!W_ERROR_IS_OK(result)) {
DEBUG(0, ("winreg_get_driver: "
"Could not enumerate values for (%s,%s,%d): %s\n",
goto done;
}
+ enum_values = talloc_zero_array(tmp_ctx,
+ struct spoolss_PrinterEnumValues,
+ num_values);
+ if (enum_values == NULL){
+ result = WERR_NOMEM;
+ goto done;
+ }
+
+ for (i = 0; i < num_values; i++){
+ enum_values[i].value_name = enum_names[i];
+ enum_values[i].value_name_len = strlen_m_term(enum_names[i]) * 2;
+ enum_values[i].type = enum_types[i];
+ enum_values[i].data_length = enum_data_blobs[i].length;
+ enum_values[i].data = NULL;
+ if (enum_values[i].data_length != 0){
+ enum_values[i].data = &enum_data_blobs[i];
+ }
+ }
+
info8 = talloc_zero(tmp_ctx, struct spoolss_DriverInfo8);
if (info8 == NULL) {
result = WERR_NOMEM;