Пример #1
0
eSMBIOS_RET_CODE smbios_3_0_parser(sSMbios_3_0_header *psSmbiosHdr,uint8_t *pu8SmData,uint64_t u64DataLen)
{
	uint8_t *pu8DataPtr = NULL;
	eSMBIOS_RET_CODE eRtCode = eSMBIOS_RET_OK;
	eSMBIOS_HDR_VER eSmbios_version;
	if(NULL == psSmbiosHdr)
	{
		SMBIOS_TOOL_ERR("INPUT PARAMETER [psSmbiosHdr] IS NULL\n");
		return eSMBIOS_RET_NULL_BUFF;				
	}
	
	if(NULL == pu8SmData)
	{
		SMBIOS_TOOL_ERR("INPUT PARAMETER [pu8SmData] IS NULL\n");
		return eSMBIOS_RET_NULL_BUFF;
	}	
	
	/*at least include Entry Point Length*/
	if(0x7 > u64DataLen)
	{
		SMBIOS_TOOL_ERR("SMBIOS 3.0 HEADER SIZE IS TOO SMALL\n");	
	}
	
	eSmbios_version = smbios_version(pu8SmData);
	if(eSMBIOS_HDR_VER_3_0 != eSmbios_version)
	{
		SMBIOS_TOOL_ERR("IT IS NOT SMBIOS 3.0 VERSION\n");
		return eSMBIOS_RET_VER_ERR;
	}
	
	memcpy(psSmbiosHdr,pu8SmData,pu8SmData[SMBIOS_3_0_HDR_LEN_OFFSET]);

	return eRtCode;	
}
Пример #2
0
char* print_array_devices_info(char* buf, smbios_hdl_t smb_hdl, u16 array_hdl)
{
	smbios_node_t		node;
	mem_device_info_t	info;
	u16			version;
	char*			pos;
	int			index;
	int			unins;
	int			i, len;
	
	version = smbios_version(smb_hdl);
	node = smb_get_node_by_type(smb_hdl, MEMORY_DEVICE_INFO);
	
	pos = buf;

	index = 0;
	unins = 0;
	
	while(node) {
		info = (mem_device_info_t)node->info;
		
		if(info->array_handle == array_hdl) {
			if(info->size) {
				sprintf(pos, "\n  Memory Device %d:\n", index);
				
				len = strlen(pos);
				pos = pos + len;
				index ++;
				pos = print_memory_device_info(pos, node, version);
			} else {
				unins++;
			}
		}
		node = smb_get_next_node_by_type(node, MEMORY_DEVICE_INFO);
	}
	
	for(i = 0; i < unins; i++) {
		sprintf(pos, "\n  Memory Device %d:\n", index + i);
		strcat(pos, "   [Not Installed]\n");
		len = strlen(pos);
		pos = pos + len;
	}

	return pos;
}