Merge lp:~linux-jacekk/ocsinventory-windows-agent/motherboard-data into lp:ocsinventory-windows-agent

Proposed by Jacek Kowalski
Status: Merged
Approved by: Didier Liroulet
Approved revision: 494
Merged at revision: 499
Proposed branch: lp:~linux-jacekk/ocsinventory-windows-agent/motherboard-data
Merge into: lp:ocsinventory-windows-agent
Diff against target: 333 lines (+127/-30)
6 files modified
OCSInventory Front/XMLInteract.cpp (+9/-0)
SysInfo/DMI.cpp (+4/-5)
SysInfo/Registry.cpp (+36/-3)
SysInfo/Wmi.cpp (+6/-9)
SysInfo/bios.cpp (+43/-1)
SysInfo/bios.h (+29/-12)
To merge this branch: bzr merge lp:~linux-jacekk/ocsinventory-windows-agent/motherboard-data
Reviewer Review Type Date Requested Status
Didier Liroulet Approve
Review via email: mp+224481@code.launchpad.net

Description of the change

In OCS Unified Unix Agent (written in Perl), the following properties have been introduced: MMANUFACTURER, MMODEL, MSN. These are not currently read by OCS server, but there are patches making it possible to use those properties.

See:
https://blueprints.launchpad.net/ocsinventory-server/+spec/motherboard-info
http://forums.ocsinventory-ng.org/viewtopic.php?id=5579

To post a comment you must log in.
Revision history for this message
Didier Liroulet (dliroulet) :
review: Approve
Revision history for this message
TroubleMakerDV (grayman2000) wrote :

Are there any plans on implementing that in new agent's version? I patched the latest XAMP server, but latest windows agent does not send these fields to server.
FusionInventory agent does, BTW!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'OCSInventory Front/XMLInteract.cpp'
2--- OCSInventory Front/XMLInteract.cpp 2013-12-30 15:13:32 +0000
3+++ OCSInventory Front/XMLInteract.cpp 2014-06-25 16:43:43 +0000
4@@ -44,6 +44,9 @@
5 m_pXml->AddChildElem( _T( "BMANUFACTURER"), myBios.GetBiosManufacturer());
6 m_pXml->AddChildElem( _T( "BVERSION"), myBios.GetBiosVersion());
7 m_pXml->AddChildElem( _T( "BDATE"), myBios.GetBiosDate());
8+ m_pXml->AddChildElem( _T( "MMANUFACTURER"), myBios.GetMotherboardManufacturer());
9+ m_pXml->AddChildElem( _T( "MMODEL"), myBios.GetMotherboardModel());
10+ m_pXml->AddChildElem( _T( "MSN"), myBios.GetMotherboardSerialNumber());
11 m_pXml->AddChildElem( _T( "ASSETTAG"), myBios.GetAssetTag());
12 m_pXml->OutOfElem();
13 return TRUE;
14@@ -74,6 +77,12 @@
15 myBios.SetBiosVersion( m_pXml->GetData( pXmlElement));
16 pXmlElement = m_pXml->FindFirstElem( _T( "BDATE"), pXml);
17 myBios.SetBiosDate( m_pXml->GetData( pXmlElement));
18+ pXmlElement = m_pXml->FindFirstElem( _T( "MMANUFACTURER"), pXml);
19+ myBios.SetMotherboardManufacturer( m_pXml->GetData( pXmlElement));
20+ pXmlElement = m_pXml->FindFirstElem( _T( "MMODEL"), pXml);
21+ myBios.SetMotherboardModel( m_pXml->GetData( pXmlElement));
22+ pXmlElement = m_pXml->FindFirstElem( _T( "MSN"), pXml);
23+ myBios.SetMotherboardSerialNumber( m_pXml->GetData( pXmlElement));
24 pXmlElement = m_pXml->FindFirstElem( _T( "ASSETTAG"), pXml);
25 myBios.SetAssetTag( m_pXml->GetData( pXmlElement));
26 }
27
28=== modified file 'SysInfo/DMI.cpp'
29--- SysInfo/DMI.cpp 2014-04-09 17:35:05 +0000
30+++ SysInfo/DMI.cpp 2014-06-25 16:43:43 +0000
31@@ -329,7 +329,7 @@
32 csType,
33 csAssetTag;
34
35- pMyBios->Set( NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE);
36+ pMyBios->Set( NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE);
37 // First, get BIOS Info
38 if (!GetBios( csVendor, csVersion, csDate))
39 return FALSE;
40@@ -358,10 +358,9 @@
41 {
42 if (!pMyBios->IsValidAssetTag())
43 pMyBios->SetAssetTag( csAssetTag);
44- if (!pMyBios->IsValidSystemManufacturer())
45- pMyBios->SetSystemManufacturer( csManufacturer);
46- if (!pMyBios->IsValidSystemModel())
47- pMyBios->SetSystemModel( csModel);
48+ pMyBios->SetMotherboardManufacturer( csManufacturer);
49+ pMyBios->SetMotherboardModel( csModel);
50+ pMyBios->SetMotherboardSerialNumber( csSN);
51 }
52 return TRUE;
53 }
54
55=== modified file 'SysInfo/Registry.cpp'
56--- SysInfo/Registry.cpp 2014-06-25 15:19:39 +0000
57+++ SysInfo/Registry.cpp 2014-06-25 16:43:43 +0000
58@@ -62,6 +62,8 @@
59 #define NT_BIOS_MANUFACTURER_VALUE _T( "BIOSName")
60 #define NT_BIOS_VERSION_VALUE _T( "SystemBiosVersion")
61 #define NT_BIOS_DATE_VALUE _T( "SystemBiosDate")
62+#define NT_BASEBOARD_MANUFACTURER_VALUE _T("BaseBoardManufacturer")
63+#define NT_BASEBOARD_MODEL_VALUE _T("BaseBoardProduct")
64
65 // Defines for retrieving BIOS from Vista registry
66 #define VISTA_BIOS_KEY _T( "HARDWARE\\Description\\System\\BIOS")
67@@ -460,7 +462,8 @@
68 default:
69 // Unknown
70 pMyBios->Set( NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE
71- NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE);
72+ NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE,
73+ NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE);
74 AddLog( _T( "Registry GetBiosInfo:\n\tFailed because unsupported or unrecognized OS !\n"));
75 return FALSE;
76 }
77@@ -556,6 +559,34 @@
78 {
79 pMyBios->SetBiosDate( csValue);
80 }
81+ // Get Motherboard manufacturer
82+ lResult = GetValue( hKey, NT_BASEBOARD_MANUFACTURER_VALUE, csValue);
83+ if (lResult != ERROR_SUCCESS)
84+ {
85+ AddLog( _T( "\tFailed in call to <RegQueryValueEx> function for HKLM\\%s\\%s !\n"),
86+ NT_BIOS_KEY, NT_BASEBOARD_MANUFACTURER_VALUE);
87+ pMyBios->SetMotherboardManufacturer( NOT_AVAILABLE);
88+ bManufacturer = FALSE;
89+ }
90+ else
91+ {
92+ pMyBios->SetMotherboardManufacturer( csValue);
93+ bManufacturer = TRUE;
94+ }
95+ // Get Motherboard model
96+ lResult = GetValue( hKey, NT_BASEBOARD_MODEL_VALUE, csValue);
97+ if (lResult != ERROR_SUCCESS)
98+ {
99+ AddLog( _T( "\tFailed in call to <RegQueryValueEx> function for HKLM\\%s\\%s !\n"),
100+ NT_BIOS_KEY, NT_BASEBOARD_MODEL_VALUE);
101+ pMyBios->SetMotherboardModel( NOT_AVAILABLE);
102+ bModel = FALSE;
103+ }
104+ else
105+ {
106+ pMyBios->SetMotherboardModel( csValue);
107+ bModel = TRUE;
108+ }
109 // Get machine type
110 lResult = GetValue( hKey, NT_BIOS_MACHINE_TYPE_VALUE, csValue);
111 if (lResult != ERROR_SUCCESS)
112@@ -578,7 +609,8 @@
113 AddLog( _T( "\tFailed in call to <RegOpenKeyEx> function for HKLM\\%s !\n"),
114 NT_BIOS_KEY);
115 pMyBios->Set( NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE
116- NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE);
117+ NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE,
118+ NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE);
119 }
120 AddLog( _T( "\tOK.\n"));
121 return TRUE;
122@@ -695,7 +727,8 @@
123 AddLog( _T( "\tFailed in call to <RegOpenKeyEx> function for HKLM\\%s !\n"),
124 VISTA_BIOS_KEY);
125 pMyBios->Set( NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE
126- NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE);
127+ NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE,
128+ NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE);
129 }
130 AddLog( _T( "\tOK.\n"));
131 return TRUE;
132
133=== modified file 'SysInfo/Wmi.cpp'
134--- SysInfo/Wmi.cpp 2014-03-10 12:55:35 +0000
135+++ SysInfo/Wmi.cpp 2014-06-25 16:43:43 +0000
136@@ -218,7 +218,7 @@
137 if (!m_bConnected)
138 return bResult;
139
140- pMyBios->Set( NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE);
141+ pMyBios->Set( NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE, NOT_AVAILABLE);
142 // GET BIOS Informations
143 if (GetBios( csManufacturer, csBiosVer, csRdate, csSN))
144 {
145@@ -245,15 +245,12 @@
146 pMyBios->SetAssetTag( csAssetTag);
147 bResult = TRUE;
148 }
149+ // Try to use baseboard object to get Motherboard manufacturer, model & S/N
150 if (GetBaseBoard( csManufacturer, csModel, csSN))
151 {
152- // System enclosure not available => use mother board object
153- if (!pMyBios->IsValidSystemManufacturer())
154- pMyBios->SetSystemManufacturer( csManufacturer);
155- if (!pMyBios->IsValidSystemModel())
156- pMyBios->SetSystemModel( csModel);
157- if (!pMyBios->IsValidSystemSerialNumber())
158- pMyBios->SetSystemSerialNumber( csSN);
159+ pMyBios->SetMotherboardManufacturer( csManufacturer);
160+ pMyBios->SetMotherboardModel( csModel);
161+ pMyBios->SetMotherboardSerialNumber( csSN);
162 }
163 return bResult;
164 }
165@@ -1293,7 +1290,7 @@
166 csBuffer = m_dllWMI.GetClassObjectStringValue( _T( "ShareName"));
167 myObject.SetShareName( csBuffer);
168 csBuffer = m_dllWMI.GetClassObjectStringValue( _T( "HorizontalResolution"));
169- if (!csBuffer.IsEmpty())
170+ if (!csBuffer.IsEmpty())
171 {
172 csBuffer.AppendFormat( _T( " x %s"), m_dllWMI.GetClassObjectStringValue( _T( "VerticalResolution")));
173 myObject.SetResolution( csBuffer);
174
175=== modified file 'SysInfo/bios.cpp'
176--- SysInfo/bios.cpp 2012-10-25 22:48:46 +0000
177+++ SysInfo/bios.cpp 2014-06-25 16:43:43 +0000
178@@ -71,7 +71,9 @@
179 }
180 }
181
182-void CBios::Set( LPCTSTR lpstrSystemManufacturer, LPCTSTR lpstrSystemModel, LPCTSTR lpstrSystemSerialNumber, LPCTSTR lpstrMachineType, LPCTSTR lpstrBiosManufacturer, LPCTSTR lpstrBiosVersion, LPCTSTR lpstrBiosDate)
183+void CBios::Set( LPCTSTR lpstrSystemManufacturer, LPCTSTR lpstrSystemModel, LPCTSTR lpstrSystemSerialNumber, LPCTSTR lpstrMachineType,
184+ LPCTSTR lpstrBiosManufacturer, LPCTSTR lpstrBiosVersion, LPCTSTR lpstrBiosDate,
185+ LPCTSTR lpstrMotherboardManufacturer, LPCTSTR lpstrMotherboardModel, LPCTSTR lpstrMotherboardSerialNumber)
186 {
187 m_csSystemManufacturer = lpstrSystemManufacturer;
188 StrForSQL( m_csSystemManufacturer);
189@@ -87,6 +89,12 @@
190 StrForSQL( m_csBiosVersion);
191 m_csBiosDate = lpstrBiosDate;
192 StrForSQL( m_csBiosDate);
193+ m_csMotherboardManufacturer = lpstrMotherboardManufacturer;
194+ StrForSQL(m_csMotherboardManufacturer);
195+ m_csMotherboardModel = lpstrMotherboardModel;
196+ StrForSQL(m_csMotherboardModel);
197+ m_csMotherboardSerialNumber = lpstrMotherboardSerialNumber;
198+ StrForSQL(m_csMotherboardSerialNumber);
199 }
200
201 void CBios::SetSystemManufacturer(LPCTSTR lpstrSystemManufacturer)
202@@ -148,6 +156,25 @@
203 StrForSQL( m_csBiosDate);
204 }
205
206+void CBios::SetMotherboardManufacturer(LPCTSTR lpstrMotherboardManufacturer)
207+{
208+ m_csMotherboardManufacturer = lpstrMotherboardManufacturer;
209+ StrForSQL( m_csMotherboardManufacturer);
210+}
211+
212+void CBios::SetMotherboardModel(LPCTSTR lpstrMotherboardModel)
213+{
214+ m_csMotherboardModel = lpstrMotherboardModel;
215+ StrForSQL( m_csMotherboardModel);
216+}
217+
218+void CBios::SetMotherboardSerialNumber(LPCTSTR lpstrMotherboardSerialNumber)
219+{
220+ m_csMotherboardSerialNumber = lpstrMotherboardSerialNumber;
221+ StrForSQL( m_csMotherboardSerialNumber);
222+}
223+
224+
225 void CBios::SetAssetTag(LPCTSTR lpstrTag)
226 {
227 m_csAssetTag = lpstrTag;
228@@ -189,6 +216,21 @@
229 return m_csBiosDate;
230 }
231
232+LPCTSTR CBios::GetMotherboardManufacturer()
233+{
234+ return m_csMotherboardManufacturer;
235+}
236+
237+LPCTSTR CBios::GetMotherboardModel()
238+{
239+ return m_csMotherboardModel;
240+}
241+
242+LPCTSTR CBios::GetMotherboardSerialNumber()
243+{
244+ return m_csMotherboardSerialNumber;
245+}
246+
247 LPCTSTR CBios::GetAssetTag()
248 {
249 return m_csAssetTag;
250
251=== modified file 'SysInfo/bios.h'
252--- SysInfo/bios.h 2010-07-07 20:56:04 +0000
253+++ SysInfo/bios.h 2014-06-25 16:43:43 +0000
254@@ -1,13 +1,13 @@
255-//====================================================================================
256-// Open Computer and Software Inventory Next Generation
257-// Copyright (C) 2010 OCS Inventory NG Team. All rights reserved.
258-// Web: http://www.ocsinventory-ng.org
259-
260-// This code is open source and may be copied and modified as long as the source
261-// code is always made freely available.
262-// Please refer to the General Public Licence V2 http://www.gnu.org/ or Licence.txt
263-//====================================================================================
264-
265+//====================================================================================
266+// Open Computer and Software Inventory Next Generation
267+// Copyright (C) 2010 OCS Inventory NG Team. All rights reserved.
268+// Web: http://www.ocsinventory-ng.org
269+
270+// This code is open source and may be copied and modified as long as the source
271+// code is always made freely available.
272+// Please refer to the General Public Licence V2 http://www.gnu.org/ or Licence.txt
273+//====================================================================================
274+
275 // BIOSInfo.h: interface for the CBios class.
276 //
277 //////////////////////////////////////////////////////////////////////
278@@ -15,7 +15,7 @@
279 #if !defined(AFX_BIOS_H__0769B90F_185D_424A_A8E9_121705E35122__INCLUDED_)
280 #define AFX_BIOS_H__0769B90F_185D_424A_A8E9_121705E35122__INCLUDED_
281
282-#pragma once
283+#pragma once
284
285 #include "SysInfoClasses.h"
286
287@@ -49,6 +49,12 @@
288 LPCTSTR GetBiosVersion();
289 // Return the BIOS Date
290 LPCTSTR GetBiosDate();
291+ // Return the Motherboard manufacturer
292+ LPCTSTR GetMotherboardManufacturer();
293+ // Return the Motherboard model
294+ LPCTSTR GetMotherboardModel();
295+ // Return the Motherboard S/N
296+ LPCTSTR GetMotherboardSerialNumber();
297 // Return the Asset Tag
298 LPCTSTR GetAssetTag();
299 // Get hash code of data, to determine if changed since last inventory
300@@ -66,7 +72,9 @@
301 // Clear BIOS infos
302 void Clear();
303 // Set all BIOSInfo attributes
304- void Set( LPCTSTR lpstrSystemManufacturer, LPCTSTR lpstrSystemModel, LPCTSTR lpstrSystemSerialNumber, LPCTSTR lpstrMachineType, LPCTSTR lpstrBiosManufacturer, LPCTSTR lpstrBiosVersion, LPCTSTR lpstrBiosDate);
305+ void Set( LPCTSTR lpstrSystemManufacturer, LPCTSTR lpstrSystemModel, LPCTSTR lpstrSystemSerialNumber, LPCTSTR lpstrMachineType,
306+ LPCTSTR lpstrBiosManufacturer, LPCTSTR lpstrBiosVersion, LPCTSTR lpstrBiosDate,
307+ LPCTSTR lpstrMotherboardManufacturer, LPCTSTR lpstrMotherboardModel, LPCTSTR lpstrMotherboardSerialNumber);
308 // Set System manufacturer
309 void SetSystemManufacturer( LPCTSTR lpstrManufacturer);
310 // Set System model
311@@ -82,6 +90,12 @@
312 // Set BIOS date
313 void SetBiosDate( LPCTSTR lpstrBiosDate);
314 void SetBiosDateFormat( LPCTSTR lpstrBiosDate);
315+ // Set Motherboard manufacturer
316+ void SetMotherboardManufacturer( LPCTSTR lpstrManufacturer);
317+ // Set Motherboard model
318+ void SetMotherboardModel( LPCTSTR lpstrModel);
319+ // Set Motherboard serial number
320+ void SetMotherboardSerialNumber( LPCTSTR lpstrSerialNumber);
321 // Set ASSET TAG
322 void SetAssetTag( LPCTSTR lpstrTag);
323
324@@ -99,6 +113,9 @@
325 CString m_csBiosManufacturer; // BIOS manufacturer
326 CString m_csBiosVersion; // BIOS version
327 CString m_csBiosDate; // BIOS Date
328+ CString m_csMotherboardManufacturer; // Motherboard manufacturer
329+ CString m_csMotherboardModel; // Motherboard model
330+ CString m_csMotherboardSerialNumber; // Motherboard serial number
331 CString m_csAssetTag; // Asset Tag
332 };
333 #endif // !defined(AFX_BIOS_H__0769B90F_185D_424A_A8E9_121705E35122__INCLUDED_)

Subscribers

People subscribed via source and target branches