library/src/javascript/JSON/BP-JSON.cc
// Attempts to parse output hreg and create json.  If the from_hreg variable is set, the
// json generator use that registry instead of the internal builtin registry.
Attempts to parse output hreg and create json.  If the from_hreg variable is set, the
json generator use that registry instead of the internal builtin registry.
Attempts to parse output hreg and create json . If the from_hreg variable is set the json generator use that registry instead of the internal builtin registry .
BP_ERROR_T BP_JSONAppendHReg
(
		P_BP_JSON                 json,
		char                    * hreg_json_name,
		P_BP_HASH_TABLE_REGISTRY  hreg,
		BP_BOOL                   include_data,
		BP_BOOL                   base64_encode_bin_data
)
{
	if(!json)
		return ERR_FAILURE;
	if(!hreg)
		return ERR_FAILURE;
	if(!hreg_json_name)
		return ERR_FAILURE;
	if(!BP_StringIsReasonablePrintableString(hreg_json_name, bpstrlen(hreg_json_name), BP_FALSE, BP_FALSE))
		return ERR_FAILURE;
	if(!hreg->hive)
		return ERR_FAILURE;
	if(hreg->hive->type != BP_HASH_TABLE_KEYED_ENTRY_TYPE_NAMED_HASH_TABLE)
		return ERR_FAILURE;
	char *node_add_path[10];
	BP_ZERO_STACK(node_add_path);
	node_add_path[0] = hreg_json_name;
	BP_JSONAddNodeByPath
	(
			json,
			(char **) &node_add_path,
			NULL,
			0,
			BP_FALSE
	);
	BP_JSONAppendHReg_r
	(
			json,
			hreg->hive,
			(char **) &node_add_path,
			include_data,
			base64_encode_bin_data
	);
	json->number_of_registries_appended++;
	return ERR_SUCCESS;
}
BP_ERROR_T BP_JSONAppendHReg ( P_BP_JSON json , char * hreg_json_name , P_BP_HASH_TABLE_REGISTRY hreg , BP_BOOL include_data , BP_BOOL base64_encode_bin_data ) { if ( ! json ) return ERR_FAILURE ; if ( ! hreg ) return ERR_FAILURE ; if ( ! hreg_json_name ) return ERR_FAILURE ; if ( ! BP_StringIsReasonablePrintableString ( hreg_json_name , bpstrlen ( hreg_json_name ) , BP_FALSE , BP_FALSE ) ) return ERR_FAILURE ; if ( ! hreg -> hive ) return ERR_FAILURE ; if ( hreg -> hive -> type != BP_HASH_TABLE_KEYED_ENTRY_TYPE_NAMED_HASH_TABLE ) return ERR_FAILURE ; char * node_add_path [ 10 ] ; BP_ZERO_STACK ( node_add_path ) ; node_add_path [ 0 ] = hreg_json_name ; BP_JSONAddNodeByPath ( json , ( char * * ) & node_add_path , NULL , 0 , BP_FALSE ) ; BP_JSONAppendHReg_r ( json , hreg -> hive , ( char * * ) & node_add_path , include_data , base64_encode_bin_data ) ; json -> number_of_registries_appended ++ ; return ERR_SUCCESS ; }
Attempts to parse output hreg and create json.
Attempts to parse output hreg and create json .
// ensure we have output and a registry to create from // ensure we have a hash registry to append // check json id name // ensure we have a hive and that our type is a table // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Add Top Level Node Table %%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // create node add path // set node add path // attempt to add to json // run append from add path; this creates a recursing object // starting at our initial add path above, cascading into // the hive until all entries are appended. // increase the number of registries appended // return indicating success