コード例 #1
0
/* load only the value names into memory to enable searching */
WERROR value_list_load_quick(struct value_list *vl, struct registry_key *key)
{
	uint32_t nvalues;
	uint32_t idx;
	struct value_item *vitem, *new_items;
	WERROR rv;

	multilist_set_data(vl->list, NULL);
	vl->nvalues = 0;
	TALLOC_FREE(vl->values);

	nvalues = get_num_values(vl, key);
	if (nvalues == 0) {
		return WERR_OK;
	}

	new_items = talloc_zero_array(vl, struct value_item, nvalues);
	if (new_items == NULL) {
		return WERR_NOMEM;
	}

	for (idx = 0; idx < nvalues; ++idx) {
		vitem = &new_items[idx];
		rv = reg_key_get_value_by_index(new_items, key, idx,
						&vitem->value_name,
						&vitem->type,
						&vitem->data);
		if (!W_ERROR_IS_OK(rv)) {
			talloc_free(new_items);
			return rv;
		}
	}

	TYPESAFE_QSORT(new_items, nvalues, vitem_cmp);
	vl->nvalues = nvalues;
	vl->values = new_items;

	return rv;
}
コード例 #2
0
ファイル: outputters.c プロジェクト: masneyb/weather-station
static int show_value(yadl_config *config, yadl_result *result)
{
	if (!config->only_log_value_changes)
		return 1;

	int num_values = get_num_values(config);

	int equal = 1;

	for (int i = 0; i < num_values; i++) {
		if (config->last_values[i] != result->value[i]) {
			equal = 0;
			break;
		}
	}

	if (equal)
		return 0;

	for (int i = 0; i < num_values; i++)
		config->last_values[i] = result->value[i];

	return 1;
}
コード例 #3
0
 bool command_line_params::has_value(const char *pKey, uint32_t key_index) const
 {
     return get_num_values(pKey, key_index) != 0;
 }
コード例 #4
0
 bool command_line_params::has_value(const wchar_t* pKey, uint index) const
 {
    return get_num_values(pKey, index) != 0;
 }