Index: ext/libicpf/src/libicpf/cfg.cpp
===================================================================
diff -u -N -r86310fdf8a767b700985ebd1b255004d9eb85fb7 -r6e13958c3d83047ec29e5a703d8982025eb22304
--- ext/libicpf/src/libicpf/cfg.cpp	(.../cfg.cpp)	(revision 86310fdf8a767b700985ebd1b255004d9eb85fb7)
+++ ext/libicpf/src/libicpf/cfg.cpp	(.../cfg.cpp)	(revision 6e13958c3d83047ec29e5a703d8982025eb22304)
@@ -138,9 +138,9 @@
 {
 	switch(eCfgType)
 	{
-	case eXml:
-		m_pCfgBase = new xml_cfg;
-		break;
+	//case eXml:
+	//	m_pCfgBase = new xml_cfg;
+	//	break;
 	case eIni:
 		m_pCfgBase = new ini_cfg;
 		break;
@@ -322,10 +322,11 @@
 	ptr_t hFind=NULL;
 	if( (hFind=m_pCfgBase->find(pszName)) != NULL )
 	{
-		const tchar_t* psz=NULL;
-		while( (psz=m_pCfgBase->find_next(hFind)) != NULL)
+		PROPINFO pi;
+		while(m_pCfgBase->find_next(hFind, pi))
 		{
-			prop.set_value(psz, property::action_add);
+			assert(!pi.bGroup);
+			prop.set_value(pi.pszValue, property::action_add);
 		}
 
 		m_pCfgBase->find_close(hFind);
@@ -366,10 +367,11 @@
 	ptr_t hFind=NULL;
 	if( (hFind=m_pCfgBase->find(pszName)) != NULL )
 	{
-		const tchar_t* psz=NULL;
-		while( (psz=m_pCfgBase->find_next(hFind)) != NULL)
+		PROPINFO pi;
+		while(m_pCfgBase->find_next(hFind, pi))
 		{
-			prop.set_value(psz, property::action_add);
+			assert(!pi.bGroup);
+			prop.set_value(pi.pszValue, property::action_add);
 		}
 
 		m_pCfgBase->find_close(hFind);
@@ -407,10 +409,11 @@
 	ptr_t hFind=NULL;
 	if( (hFind=m_pCfgBase->find(pszName)) != NULL )
 	{
-		const tchar_t* psz=NULL;
-		while( (psz=m_pCfgBase->find_next(hFind)) != NULL)
+		PROPINFO pi;
+		while(m_pCfgBase->find_next(hFind, pi))
 		{
-			prop.set_value(psz, property::action_add);
+			assert(!pi.bGroup);
+			prop.set_value(pi.pszValue, property::action_add);
 		}
 
 		m_pCfgBase->find_close(hFind);
@@ -448,10 +451,11 @@
 	ptr_t hFind=NULL;
 	if( (hFind=m_pCfgBase->find(pszName)) != NULL )
 	{
-		const tchar_t* psz=NULL;
-		while( (psz=m_pCfgBase->find_next(hFind)) != NULL)
+		PROPINFO pi;
+		while(m_pCfgBase->find_next(hFind, pi))
 		{
-			prop.set_value(psz, property::action_add);
+			assert(!pi.bGroup);
+			prop.set_value(pi.pszValue, property::action_add);
 		}
 
 		m_pCfgBase->find_close(hFind);
@@ -484,6 +488,11 @@
 const tchar_t* config::get_value(uint_t uiProp, tchar_t* pszBuffer, size_t stMaxSize, size_t stIndex)
 {
 	m_lock.lock();
+	if(uiProp >= m_pvProps->size())
+	{
+		m_lock.unlock();
+		THROW(_t("Index out of range"), 0, 0, 0);
+	}
 	const tchar_t* psz=m_pvProps->at(uiProp).get_value(pszBuffer, stMaxSize, stIndex);
 	m_lock.unlock();
 
@@ -500,6 +509,11 @@
 ll_t config::get_signed_num(uint_t uiProp, size_t stIndex)
 {
 	m_lock.lock();
+	if(uiProp >= m_pvProps->size())
+	{
+		m_lock.unlock();
+		THROW(_t("Index out of range"), 0, 0, 0);
+	}
 	ll_t ll=m_pvProps->at(uiProp).get_signed_num(stIndex);
 	m_lock.unlock();
 	return ll;
@@ -515,6 +529,11 @@
 ull_t config::get_unsigned_num(uint_t uiProp, size_t stIndex)
 {
 	m_lock.lock();
+	if(uiProp >= m_pvProps->size())
+	{
+		m_lock.unlock();
+		THROW(_t("Index out of range"), 0, 0, 0);
+	}
 	ull_t ull=m_pvProps->at(uiProp).get_unsigned_num(stIndex);
 	m_lock.unlock();
 	return ull;
@@ -530,6 +549,11 @@
 bool config::get_bool(uint_t uiProp, size_t stIndex)
 {
 	m_lock.lock();
+	if(uiProp >= m_pvProps->size())
+	{
+		m_lock.unlock();
+		THROW(_t("Index out of range"), 0, 0, 0);
+	}
 	bool b=m_pvProps->at(uiProp).get_bool(stIndex);
 	m_lock.unlock();
 	return b;
@@ -545,8 +569,14 @@
 const tchar_t* config::get_string(uint_t uiProp, size_t stIndex)
 {
 	m_lock.lock();
+	if(uiProp >= m_pvProps->size())
+	{
+		m_lock.unlock();
+		THROW(_t("Index out of range"), 0, 0, 0);
+	}
 	const tchar_t* psz=m_pvProps->at(uiProp).get_string(stIndex);
 	m_lock.unlock();
+
 	return psz;
 }
 
@@ -563,6 +593,11 @@
 		return NULL;
 
 	m_lock.lock();
+	if(uiProp >= m_pvProps->size())
+	{
+		m_lock.unlock();
+		THROW(_t("Index out of range"), 0, 0, 0);
+	}
 	const tchar_t* psz=m_pvProps->at(uiProp).get_string(stIndex);
 	size_t stLen = _tcslen(psz);
 	if(stLen >= stBufferSize)
@@ -574,6 +609,24 @@
 	return pszBuffer;
 }
 
+bool config::enum_properties(const tchar_t* pszName, PFNCFGENUMCALLBACK pfn, ptr_t pParam)
+{
+	ptr_t pFind = m_pCfgBase->find(pszName);
+	if(pFind)
+	{
+		PROPINFO pi;
+		while(m_pCfgBase->find_next(pFind, pi))
+		{
+			(*pfn)(pi.bGroup, pi.pszName, pi.pszValue, pParam);
+		}
+
+		m_pCfgBase->find_close(pFind);
+		return true;
+	}
+	else
+		return false;
+}
+
 /** Function sets the property value from string.
  *
  * \param[in] uiProp - property id to set the value for
@@ -682,7 +735,6 @@
 	m_lock.lock();
 
 	ptr_t hFind=NULL;
-	const tchar_t* psz=NULL;
 	for (std::vector<property>::iterator it=m_pvProps->begin();it != m_pvProps->end();it++)
 	{
 		// is this an array property ?
@@ -692,9 +744,11 @@
 		// and fill with value(s)
 		if( (hFind=m_pCfgBase->find((*it).get_name())) != NULL)
 		{
-			while( (psz=m_pCfgBase->find_next(hFind)) != NULL)
+			PROPINFO pi;
+			while(m_pCfgBase->find_next(hFind, pi))
 			{
-				(*it).set_value(psz, property::action_add);
+				assert(!pi.bGroup);
+				(*it).set_value(pi.pszValue, property::action_add);
 			}
 		}