Commit fb138ac1 authored by Didier Liroulet's avatar Didier Liroulet
Browse files

Merge patch from Jacek Kowalski for reading Motherboard informations...

Merge patch from Jacek Kowalski for reading Motherboard informations (Manufacturer, Model and Serail number)
parent d76eafda
......@@ -665,9 +665,10 @@ BOOL CInventoryRequest::runInventory()
if (!m_pSysInfo->getBiosInfo( &m_BIOS))
m_pLogger->log( LOG_PRIORITY_WARNING, _T( "INVENTORY => Failed to retrieve BIOS"));
else
m_pLogger->log( LOG_PRIORITY_DEBUG, _T( "INVENTORY => System Manufacturer <%s>, System Model <%s>, System S/N <%s>, Bios Manufacturer <%s>, Bios Date <%s>, Bios Version <%s>"),
m_pLogger->log( LOG_PRIORITY_DEBUG, _T( "INVENTORY => System Manufacturer <%s>, System Model <%s>, System S/N <%s>, Bios Manufacturer <%s>, Bios Date <%s>, Bios Version <%s>, Motherboard Manufacturer <%s>, Motherboard Model <%s>, Motherboard S/N <%s>"),
m_BIOS.GetSystemManufacturer(), m_BIOS.GetSystemModel(), m_BIOS.GetSystemSerialNumber(),
m_BIOS.GetBiosManufacturer(), m_BIOS.GetBiosDate(), m_BIOS.GetBiosVersion());
m_BIOS.GetBiosManufacturer(), m_BIOS.GetBiosDate(), m_BIOS.GetBiosVersion(),
m_BIOS.GetMotherboardManufacturer(), m_BIOS.GetMotherboardModel(), m_BIOS.GetMotherboardSerialNumber());
// Get Processor infos (0 means error)
if (!(dwValue = m_pSysInfo->getProcessors( cs1, cs2, &m_CpuList)))
m_pLogger->log( LOG_PRIORITY_WARNING, _T( "INVENTORY => Failed to retrieve processor(s)"));
......
......@@ -44,6 +44,9 @@ BOOL CXMLInteract::UpdateBIOS( CBios &myBios)
m_pXml->AddChildElem( _T( "BMANUFACTURER"), myBios.GetBiosManufacturer());
m_pXml->AddChildElem( _T( "BVERSION"), myBios.GetBiosVersion());
m_pXml->AddChildElem( _T( "BDATE"), myBios.GetBiosDate());
m_pXml->AddChildElem( _T( "MMANUFACTURER"), myBios.GetMotherboardManufacturer());
m_pXml->AddChildElem( _T( "MMODEL"), myBios.GetMotherboardModel());
m_pXml->AddChildElem( _T( "MSN"), myBios.GetMotherboardSerialNumber());
m_pXml->AddChildElem( _T( "ASSETTAG"), myBios.GetAssetTag());
m_pXml->OutOfElem();
return TRUE;
......@@ -74,6 +77,12 @@ BOOL CXMLInteract::ReadBIOS( CBios &myBios)
myBios.SetBiosVersion( m_pXml->GetData( pXmlElement));
pXmlElement = m_pXml->FindFirstElem( _T( "BDATE"), pXml);
myBios.SetBiosDate( m_pXml->GetData( pXmlElement));
pXmlElement = m_pXml->FindFirstElem( _T( "MMANUFACTURER"), pXml);
myBios.SetMotherboardManufacturer( m_pXml->GetData( pXmlElement));
pXmlElement = m_pXml->FindFirstElem( _T( "MMODEL"), pXml);
myBios.SetMotherboardModel( m_pXml->GetData( pXmlElement));
pXmlElement = m_pXml->FindFirstElem( _T( "MSN"), pXml);
myBios.SetMotherboardSerialNumber( m_pXml->GetData( pXmlElement));
pXmlElement = m_pXml->FindFirstElem( _T( "ASSETTAG"), pXml);
myBios.SetAssetTag( m_pXml->GetData( pXmlElement));
}
......
......@@ -329,7 +329,7 @@ BOOL CDMI::GetBiosInfo( CBios *pMyBios)
csType,
csAssetTag;
pMyBios->Set( NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE);
pMyBios->Set( NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE);
// First, get BIOS Info
if (!GetBios( csVendor, csVersion, csDate))
return FALSE;
......@@ -362,6 +362,9 @@ BOOL CDMI::GetBiosInfo( CBios *pMyBios)
pMyBios->SetSystemManufacturer( csManufacturer);
if (!pMyBios->IsValidSystemModel())
pMyBios->SetSystemModel( csModel);
pMyBios->SetMotherboardManufacturer( csManufacturer);
pMyBios->SetMotherboardModel( csModel);
pMyBios->SetMotherboardSerialNumber( csSN);
}
return TRUE;
}
......
......@@ -62,6 +62,8 @@ static char THIS_FILE[] = __FILE__;
#define NT_BIOS_MANUFACTURER_VALUE _T( "BIOSName")
#define NT_BIOS_VERSION_VALUE _T( "SystemBiosVersion")
#define NT_BIOS_DATE_VALUE _T( "SystemBiosDate")
#define NT_BASEBOARD_MANUFACTURER_VALUE _T( "BaseBoardManufacturer")
#define NT_BASEBOARD_MODEL_VALUE _T( "BaseBoardProduct")
// Defines for retrieving BIOS from Vista registry
#define VISTA_BIOS_KEY _T( "HARDWARE\\Description\\System\\BIOS")
......@@ -72,6 +74,8 @@ static char THIS_FILE[] = __FILE__;
#define VISTA_BIOS_MANUFACTURER_VALUE _T( "BIOSVendor")
#define VISTA_BIOS_VERSION_VALUE _T( "BIOSVersion")
#define VISTA_BIOS_DATE_VALUE _T( "BIOSReleaseDate")
#define VISTA_BASEBOARD_MANUFACTURER_VALUE _T( "BaseBoardManufacturer")
#define VISTA_BASEBOARD_MODEL_VALUE _T( "BaseBoardProduct")
// Defines for retrieving processors from NT registry
#define NT_PROCESSOR_KEY _T( "HARDWARE\\Description\\System\\CentralProcessor")
......@@ -459,8 +463,9 @@ BOOL CRegistry::GetBiosInfo( CBios *pMyBios)
return GetBiosInfoNT( pMyBios);
default:
// Unknown
pMyBios->Set( NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE
NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE);
pMyBios->Set( NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE,
NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE,
NOT_AVAILABLE, NOT_AVAILABLE);
AddLog( _T( "Registry GetBiosInfo:\n\tFailed because unsupported or unrecognized OS !\n"));
return FALSE;
}
......@@ -556,6 +561,34 @@ BOOL CRegistry::GetBiosInfoNT( CBios *pMyBios)
{
pMyBios->SetBiosDate( csValue);
}
// Get Motherboard manufacturer
lResult = GetValue( hKey, NT_BASEBOARD_MANUFACTURER_VALUE, csValue);
if (lResult != ERROR_SUCCESS)
{
AddLog( _T( "\tFailed in call to <RegQueryValueEx> function for HKLM\\%s\\%s !\n"),
NT_BIOS_KEY, NT_BASEBOARD_MANUFACTURER_VALUE);
pMyBios->SetMotherboardManufacturer( NOT_AVAILABLE);
bManufacturer = FALSE;
}
else
{
pMyBios->SetMotherboardManufacturer( csValue);
bManufacturer = TRUE;
}
// Get Motherboard model
lResult = GetValue( hKey, NT_BASEBOARD_MODEL_VALUE, csValue);
if (lResult != ERROR_SUCCESS)
{
AddLog( _T( "\tFailed in call to <RegQueryValueEx> function for HKLM\\%s\\%s !\n"),
NT_BIOS_KEY, NT_BASEBOARD_MODEL_VALUE);
pMyBios->SetMotherboardModel( NOT_AVAILABLE);
bModel = FALSE;
}
else
{
pMyBios->SetMotherboardModel( csValue);
bModel = TRUE;
}
// Get machine type
lResult = GetValue( hKey, NT_BIOS_MACHINE_TYPE_VALUE, csValue);
if (lResult != ERROR_SUCCESS)
......@@ -568,17 +601,19 @@ BOOL CRegistry::GetBiosInfoNT( CBios *pMyBios)
{
pMyBios->SetMachineType( csValue);
}
AddLog( _T( "\t\t<System Manufacturer: %s><System Model: %s><System S/N: %s><BIOS Manufacturer: %s><BIOS Version: %s><BIOS Date: %s><Type: %s>\n"),
AddLog( _T( "\t\t<System Manufacturer: %s><System Model: %s><System S/N: %s><BIOS Manufacturer: %s><BIOS Version: %s><BIOS Date: %s><Baseboard Manufacturer: %s><Baseboard Model: %s><Type: %s>\n"),
pMyBios->GetSystemManufacturer(), pMyBios->GetSystemModel(), pMyBios->GetSystemSerialNumber(), pMyBios->GetBiosManufacturer(),
pMyBios->GetBiosVersion(), pMyBios->GetBiosDate(), pMyBios->GetMachineType());
pMyBios->GetBiosVersion(), pMyBios->GetBiosDate(), pMyBios->GetMotherboardManufacturer(), pMyBios->GetMotherboardModel(),
pMyBios->GetMachineType());
RegCloseKey( hKey);
}
else
{
AddLog( _T( "\tFailed in call to <RegOpenKeyEx> function for HKLM\\%s !\n"),
NT_BIOS_KEY);
pMyBios->Set( NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE
NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE);
pMyBios->Set( NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE,
NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE,
NOT_AVAILABLE, NOT_AVAILABLE);
}
AddLog( _T( "\tOK.\n"));
return TRUE;
......@@ -673,6 +708,34 @@ BOOL CRegistry::GetBiosInfoVista( CBios *pMyBios)
{
pMyBios->SetBiosDate( csValue);
}
// Get Motherboard manufacturer
lResult = GetValue( hKey, VISTA_BASEBOARD_MANUFACTURER_VALUE, csValue);
if (lResult != ERROR_SUCCESS)
{
AddLog( _T( "\tFailed in call to <RegQueryValueEx> function for HKLM\\%s\\%s !\n"),
NT_BIOS_KEY, VISTA_BASEBOARD_MANUFACTURER_VALUE);
pMyBios->SetMotherboardManufacturer( NOT_AVAILABLE);
bManufacturer = FALSE;
}
else
{
pMyBios->SetMotherboardManufacturer( csValue);
bManufacturer = TRUE;
}
// Get Motherboard model
lResult = GetValue( hKey, VISTA_BASEBOARD_MODEL_VALUE, csValue);
if (lResult != ERROR_SUCCESS)
{
AddLog( _T( "\tFailed in call to <RegQueryValueEx> function for HKLM\\%s\\%s !\n"),
NT_BIOS_KEY, VISTA_BASEBOARD_MODEL_VALUE);
pMyBios->SetMotherboardModel( NOT_AVAILABLE);
bModel = FALSE;
}
else
{
pMyBios->SetMotherboardModel( csValue);
bModel = TRUE;
}
// Get machine type
lResult = GetValue( hKey, VISTA_BIOS_MACHINE_TYPE_VALUE, csValue);
if (lResult != ERROR_SUCCESS)
......@@ -685,17 +748,19 @@ BOOL CRegistry::GetBiosInfoVista( CBios *pMyBios)
{
pMyBios->SetMachineType( csValue);
}
AddLog( _T( "\t\t<System Manufacturer: %s><System Model: %s><System S/N: %s><BIOS Manufacturer: %s><BIOS Version: %s><BIOS Date: %s><Type: %s>\n"),
AddLog( _T( "\t\t<System Manufacturer: %s><System Model: %s><System S/N: %s><BIOS Manufacturer: %s><BIOS Version: %s><BIOS Date: %s><Baseboard Manufacturer: %s><Baseboard Model: %s><Type: %s>\n"),
pMyBios->GetSystemManufacturer(), pMyBios->GetSystemModel(), pMyBios->GetSystemSerialNumber(), pMyBios->GetBiosManufacturer(),
pMyBios->GetBiosVersion(), pMyBios->GetBiosDate(), pMyBios->GetMachineType());
pMyBios->GetBiosVersion(), pMyBios->GetBiosDate(), pMyBios->GetMotherboardManufacturer(), pMyBios->GetMotherboardModel(),
pMyBios->GetMachineType());
RegCloseKey( hKey);
}
else
{
AddLog( _T( "\tFailed in call to <RegOpenKeyEx> function for HKLM\\%s !\n"),
VISTA_BIOS_KEY);
pMyBios->Set( NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE
NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE);
pMyBios->Set( NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE,
NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE,
NOT_AVAILABLE, NOT_AVAILABLE);
}
AddLog( _T( "\tOK.\n"));
return TRUE;
......
......@@ -218,7 +218,7 @@ BOOL CWmi::GetBiosInfo(CBios *pMyBios)
if (!m_bConnected)
return bResult;
pMyBios->Set( NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE);
pMyBios->Set( NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE);
// GET BIOS Informations
if (GetBios( csManufacturer, csBiosVer, csRdate, csSN))
{
......@@ -254,6 +254,9 @@ BOOL CWmi::GetBiosInfo(CBios *pMyBios)
pMyBios->SetSystemModel( csModel);
if (!pMyBios->IsValidSystemSerialNumber())
pMyBios->SetSystemSerialNumber( csSN);
pMyBios->SetMotherboardManufacturer( csManufacturer);
pMyBios->SetMotherboardModel( csModel);
pMyBios->SetMotherboardSerialNumber( csSN);
}
return bResult;
}
......
......@@ -71,7 +71,9 @@ LPCTSTR CBios::ParseChassisType( DWORD dwType)
}
}
void CBios::Set( LPCTSTR lpstrSystemManufacturer, LPCTSTR lpstrSystemModel, LPCTSTR lpstrSystemSerialNumber, LPCTSTR lpstrMachineType, LPCTSTR lpstrBiosManufacturer, LPCTSTR lpstrBiosVersion, LPCTSTR lpstrBiosDate)
void CBios::Set( LPCTSTR lpstrSystemManufacturer, LPCTSTR lpstrSystemModel, LPCTSTR lpstrSystemSerialNumber, LPCTSTR lpstrMachineType,
LPCTSTR lpstrBiosManufacturer, LPCTSTR lpstrBiosVersion, LPCTSTR lpstrBiosDate,
LPCTSTR lpstrMotherboardManufacturer, LPCTSTR lpstrMotherboardModel, LPCTSTR lpstrMotherboardSerialNumber)
{
m_csSystemManufacturer = lpstrSystemManufacturer;
StrForSQL( m_csSystemManufacturer);
......@@ -87,6 +89,12 @@ void CBios::Set( LPCTSTR lpstrSystemManufacturer, LPCTSTR lpstrSystemModel, LPCT
StrForSQL( m_csBiosVersion);
m_csBiosDate = lpstrBiosDate;
StrForSQL( m_csBiosDate);
m_csMotherboardManufacturer = lpstrMotherboardManufacturer;
StrForSQL(m_csMotherboardManufacturer);
m_csMotherboardModel = lpstrMotherboardModel;
StrForSQL(m_csMotherboardModel);
m_csMotherboardSerialNumber = lpstrMotherboardSerialNumber;
StrForSQL(m_csMotherboardSerialNumber);
}
void CBios::SetSystemManufacturer(LPCTSTR lpstrSystemManufacturer)
......@@ -107,6 +115,24 @@ void CBios::SetSystemSerialNumber(LPCTSTR lpstrSystemSerialNumber)
StrForSQL( m_csSystemSerialNumber);
}
void CBios::SetMotherboardManufacturer(LPCTSTR lpstrMotherboardManufacturer)
{
m_csMotherboardManufacturer = lpstrMotherboardManufacturer;
StrForSQL( m_csMotherboardManufacturer);
}
void CBios::SetMotherboardModel(LPCTSTR lpstrMotherboardModel)
{
m_csMotherboardModel = lpstrMotherboardModel;
StrForSQL( m_csMotherboardModel);
}
void CBios::SetMotherboardSerialNumber(LPCTSTR lpstrMotherboardSerialNumber)
{
m_csMotherboardSerialNumber = lpstrMotherboardSerialNumber;
StrForSQL( m_csMotherboardSerialNumber);
}
void CBios::SetMachineType(LPCTSTR lpstrMachineType)
{
m_csMachineType = lpstrMachineType;
......@@ -169,6 +195,21 @@ LPCTSTR CBios::GetSystemSerialNumber()
return m_csSystemSerialNumber;
}
LPCTSTR CBios::GetMotherboardManufacturer()
{
return m_csMotherboardManufacturer;
}
LPCTSTR CBios::GetMotherboardModel()
{
return m_csMotherboardModel;
}
LPCTSTR CBios::GetMotherboardSerialNumber()
{
return m_csMotherboardSerialNumber;
}
LPCTSTR CBios::GetMachineType()
{
return m_csMachineType;
......
......@@ -49,6 +49,12 @@ public: // Methods
LPCTSTR GetBiosVersion();
// Return the BIOS Date
LPCTSTR GetBiosDate();
// Return the Motherboard manufacturer
LPCTSTR GetMotherboardManufacturer();
// Return the Motherboard model
LPCTSTR GetMotherboardModel();
// Return the Motherboard S/N
LPCTSTR GetMotherboardSerialNumber();
// Return the Asset Tag
LPCTSTR GetAssetTag();
// Get hash code of data, to determine if changed since last inventory
......@@ -66,13 +72,21 @@ public: // Methods
// Clear BIOS infos
void Clear();
// Set all BIOSInfo attributes
void Set( LPCTSTR lpstrSystemManufacturer, LPCTSTR lpstrSystemModel, LPCTSTR lpstrSystemSerialNumber, LPCTSTR lpstrMachineType, LPCTSTR lpstrBiosManufacturer, LPCTSTR lpstrBiosVersion, LPCTSTR lpstrBiosDate);
void Set( LPCTSTR lpstrSystemManufacturer, LPCTSTR lpstrSystemModel, LPCTSTR lpstrSystemSerialNumber, LPCTSTR lpstrMachineType,
LPCTSTR lpstrBiosManufacturer, LPCTSTR lpstrBiosVersion, LPCTSTR lpstrBiosDate,
LPCTSTR lpstrMotherboardManufacturer, LPCTSTR lpstrMotherboardModel, LPCTSTR lpstrMotherboardSerialNumber);
// Set System manufacturer
void SetSystemManufacturer( LPCTSTR lpstrManufacturer);
// Set System model
void SetSystemModel( LPCTSTR lpstrModel);
// Set System serial number
void SetSystemSerialNumber( LPCTSTR lpstrSerialNumber);
// Set Motherboard manufacturer
void SetMotherboardManufacturer( LPCTSTR lpstrManufacturer);
// Set Motherboard model
void SetMotherboardModel( LPCTSTR lpstrModel);
// Set Motherboard serial number
void SetMotherboardSerialNumber( LPCTSTR lpstrSerialNumber);
// Set BIOS machine type
void SetMachineType( LPCTSTR lpstrMachineType);
// Set BIOS manufacturer
......@@ -95,6 +109,9 @@ protected: // Attributes
CString m_csSystemManufacturer; // Device manufacturer
CString m_csSystemModel; // Device model
CString m_csSystemSerialNumber; // Device serial number
CString m_csMotherboardManufacturer; // Motherboard manufacturer
CString m_csMotherboardModel; // Motherboard model
CString m_csMotherboardSerialNumber; // Motherboard serial number
CString m_csMachineType; // Device type (tower, mini-tower, pizza box...)
CString m_csBiosManufacturer; // BIOS manufacturer
CString m_csBiosVersion; // BIOS version
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment