Пример #1
0
bool wxRegKey::CopyValue(const wxString& szValue,
                         wxRegKey& keyDst,
                         const wxString& szValueNew)
{
    wxString valueNew(szValueNew);
    if ( valueNew.empty() ) {
        // by default, use the same name
        valueNew = szValue;
    }

    switch ( GetValueType(szValue) ) {
        case Type_String:
            {
                wxString strVal;
                return QueryValue(szValue, strVal) &&
                       keyDst.SetValue(valueNew, strVal);
            }

        case Type_Dword:
        /* case Type_Dword_little_endian: == Type_Dword */
            {
                long dwVal;
                return QueryValue(szValue, &dwVal) &&
                       keyDst.SetValue(valueNew, dwVal);
            }

        case Type_Binary:
        {
            wxMemoryBuffer buf;
            return QueryValue(szValue,buf) &&
                   keyDst.SetValue(valueNew,buf);
        }

        // these types are unsupported because I am not sure about how
        // exactly they should be copied and because they shouldn't
        // occur among the application keys (supposedly created with
        // this class)
        case Type_None:
        case Type_Expand_String:
        case Type_Dword_big_endian:
        case Type_Link:
        case Type_Multi_String:
        case Type_Resource_list:
        case Type_Full_resource_descriptor:
        case Type_Resource_requirements_list:
        default:
            wxLogError(_("Can't copy values of unsupported type %d."),
                       GetValueType(szValue));
            return false;
    }
}
Пример #2
0
bool PrintValue(PWCHAR KeyPath, PWCHAR ValueName, ULONG Depth)
{
	ULONG	Type;
	ULONG	DataLen;
	char	Buffer[1024];

	PVOID	pBuffer = Buffer;
	bool	Success = false;
	if (QueryValue(KeyPath, ValueName, &Type, &DataLen, Buffer, sizeof(Buffer)))
	{
		if (DataLen > sizeof(Buffer))
		{
// буфер на стеке мал - выделяем из кучи
			pBuffer = HeapAlloc(GetProcessHeap(), 0, DataLen);
			if (pBuffer)
			{
				if (QueryValue(KeyPath, ValueName, &Type, &DataLen, pBuffer, DataLen))
					Success = true;
			}
		}
		else
			Success = true;
	}

	if (Success)
	{
		PrintTabs(Depth);
		printf("%S: type = %d, data length = %d", ValueName[0]?ValueName:L"(Default)"/*дефолтовая валушка == L""*/, Type, DataLen);
		switch (Type)
		{
		case REG_DWORD:
			printf(", data = 0x%08X", *(PULONG)pBuffer);
			break;
		case REG_SZ:
		case REG_EXPAND_SZ:
			printf(", data = %S", pBuffer);
			break;
		}

		printf("\n");
	}

// если выделяли буфер
	if (pBuffer != Buffer)
		HeapFree(GetProcessHeap(), 0, pBuffer);

	return Success;
}
Пример #3
0
LONG CKey::QueryValue(LPCTSTR name, bool &value) throw()
{
  UInt32 uintValue = BoolToUINT32(value);
  LONG res = QueryValue(name, uintValue);
  value = UINT32ToBool(uintValue);
  return res;
}
Пример #4
0
LONG CKey::GetValue_Strings(LPCTSTR valueName, UStringVector &strings)
{
  strings.Clear();
  CByteBuffer buffer;
  UInt32 dataSize;
  LONG res = QueryValue(valueName, buffer, dataSize);
  if (res != ERROR_SUCCESS)
    return res;
  if (dataSize % sizeof(wchar_t) != 0)
    return E_FAIL;
  const wchar_t *data = (const wchar_t *)(const Byte  *)buffer;
  unsigned numChars = dataSize / sizeof(wchar_t);
  UString s;
  for (unsigned i = 0; i < numChars; i++)
  {
    wchar_t c = data[i];
    if (c == 0)
    {
      strings.Add(s);
      s.Empty();
    }
    else
      s += c;
  }
  return res;
}
Пример #5
0
BOOL CRegistry::GetStringValue(LPCTSTR name_of_value, CString& return_string)
{

    ASSERT(name_of_value != NULL);

    if (name_of_value == NULL) {
        m_ErrorCode = ERROR_INVALID_PARAMETER;
        return(FALSE);
    }

    TCHAR temp_string[ 2048 ];
    DWORD size_of_buffer = 2048;

    ::ZeroMemory(temp_string, sizeof(temp_string));

    KeyValueTypes type = typeString;

    if (QueryValue(name_of_value, type, (LPBYTE) temp_string, size_of_buffer) != FALSE) {
        return_string = temp_string;
        return(TRUE);
    }
    else {
        return_string.Empty();
        return(FALSE);
    }
}
Пример #6
0
LONG CKey::GetValue_IfOk(LPCTSTR name, bool &value) throw()
{
  bool newVal;
  LONG res = QueryValue(name, newVal);
  if (res == ERROR_SUCCESS)
    value = newVal;
  return res;
}
Пример #7
0
void URealSenseOption::QueryData()
{
	rs2::error_ref e;
	Name = uestr(rs2_option_to_string((rs2_option)Type));
	Description = uestr(rs2_get_option_description(RsOptions, (rs2_option)Type, &e));
	rs2_get_option_range(RsOptions, (rs2_option)Type, &Range.Min, &Range.Max, &Range.Step, &Range.Default, &e);
	QueryValue();
}
Пример #8
0
LONG CKey::QueryValue(LPCTSTR name, CByteBuffer &value, UInt32 &dataSize)
{
  DWORD type = 0;
  dataSize = 0;
  LONG res = RegQueryValueEx(_object, (LPTSTR)name, NULL, &type, NULL, (DWORD *)&dataSize);
  if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA)
    return res;
  value.Alloc(dataSize);
  return QueryValue(name, (BYTE *)value, dataSize);
}
bool CPropertyArchiveRegistry::Read(const CString &strValueName, bool& bValue) const
{
	DWORD dw = 0;

	if (ERROR_SUCCESS != QueryValue(dw, strValueName))
		return false;

	bValue = dw != 0;
	return true;
}
Пример #10
0
BOOL CRegistry::GetStringArrayValue(LPCTSTR name_of_value, CStringArray& return_array)
{

    ASSERT(name_of_value != NULL);

    if (name_of_value == NULL) {
        m_ErrorCode = ERROR_INVALID_PARAMETER;
        return(FALSE);
    }

    // Thanks go to Chris Hines ([email protected]) for finding
    // a bug here. If you add entries to the key, then the
    // information retrieved via QueryInfo() may be invalid. This
    // will screw you here. So, we must make sure our information
    // is correct before we attempt to *use* the data.

    QueryInfo();

    DWORD size_of_buffer = m_LongestValueDataLength;

    LPBYTE memory_buffer = (LPBYTE) new BYTE[ size_of_buffer ];

    if (memory_buffer == NULL) {
        m_ErrorCode = ::GetLastError();
        return(FALSE);
    }

    BOOL ret = TRUE;

    KeyValueTypes type = typeMultipleString; // A double NULL terminated string

    if (QueryValue(name_of_value, type, memory_buffer, size_of_buffer) != FALSE) {
        /*
        ** We've got data so give it back to the caller
        */

        LPTSTR strings = (LPTSTR) memory_buffer;

        return_array.RemoveAll();

        while(strings[ 0 ] != 0x00) {
            return_array.Add((LPCTSTR) strings);
            strings += (_tcslen((LPCTSTR) strings) + 1); // Paul Ostrowski [[email protected]]
        }

        ret = TRUE;
    }
    else {
        ret = FALSE;
    }

    delete [] memory_buffer;
   
    return(ret);
}
Пример #11
0
BOOL CRegistry::GetBinaryValue(LPCTSTR name_of_value, CByteArray& return_array)
{

    ASSERT(name_of_value != NULL);

    if (name_of_value == NULL) {
        m_ErrorCode = ERROR_INVALID_PARAMETER;
        return(FALSE);
    }

    // Thanks go to Chris Hines ([email protected]) for finding
    // a bug here. If you add entries to the key, then the
    // information retrieved via QueryInfo() may be invalid. This
    // will screw you here. So, we must make sure our information
    // is correct before we attempt to *use* the data.

    QueryInfo();

    DWORD size_of_buffer = m_LongestValueDataLength;

    LPBYTE memory_buffer = (LPBYTE) new BYTE[ size_of_buffer ];

    if (memory_buffer == NULL) {
        m_ErrorCode = ::GetLastError();
        return(FALSE);
    }

    BOOL ret = TRUE;

    KeyValueTypes type = typeBinary;

    if (QueryValue(name_of_value, type, memory_buffer, size_of_buffer) != FALSE) {
        /*
        ** We've got data so give it back to the caller
        */

        return_array.RemoveAll();

        DWORD index = 0;

        while(index < size_of_buffer) {
            return_array.Add(memory_buffer[ index ]);
            index++;
        }

        ret = TRUE;
    }
    else {
        ret = FALSE;
    }

    delete [] memory_buffer;

    return(ret);
}
Пример #12
0
LONG CKey::QueryValue(LPCTSTR name, CSysString &value)
{
  value.Empty();
  DWORD type = 0;
  UInt32 currentSize = 0;
  LONG res = RegQueryValueEx(_object, (LPTSTR)name, NULL, &type, NULL, (DWORD *)&currentSize);
  if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA)
    return res;
  res = QueryValue(name, value.GetBuffer(currentSize), currentSize);
  value.ReleaseBuffer();
  return res;
}
Пример #13
0
layer_c::layer_c(char * exefile,char * layer)
{
  OpenKey(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers");
  data = new char[512];
  DWORD asize = 512;
  if (QueryValue(exefile,data,&asize) == 1) {
    asize = 0;
    data[0] = 0;
  };
  SetValue(exefile, layer);
  value = new char[strlen(exefile)+5];
  sprintf(value,"%s",exefile);
  value[strlen(exefile)] = 0;
}
bool CPropertyArchiveRegistry::Read(const CString &strValueName, CString &str) const
{
	const int nBufferSize = 1024 * 8;
	TCHAR sz[nBufferSize + 1];
	DWORD dwSize = nBufferSize;

	if (ERROR_SUCCESS != QueryValue(sz, strValueName, &dwSize) || dwSize == 0)
	{
		return false;
	}

	str = sz;
	return true;
}
Пример #15
0
LONG CKey::QueryValue(LPCWSTR name, UString &value)
{
  value.Empty();
  DWORD type = 0;
  UInt32 currentSize = 0;

  LONG res;
  if (g_IsNT)
  {
    res = RegQueryValueExW(_object, name, NULL, &type, NULL, (DWORD *)&currentSize);
    if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA)
      return res;
    res = QueryValue(name, value.GetBuffer(currentSize), currentSize);
    value.ReleaseBuffer();
  }
  else
  {
    AString vTemp;
    res = QueryValue(name == 0 ? 0 : (LPCSTR)GetSystemString(name), vTemp);
    value = GetUnicodeString(vTemp);
  }
  return res;
}
Пример #16
0
CRegKeyEx::Value CRegKeyEx::QueryValue(LPCTSTR pszValueName)
{
  DWORD dwType;
  if(ERROR_SUCCESS!=::RegQueryValueEx(m_hKey,pszValueName,NULL,&dwType,NULL,NULL)){
    dwType=REG_NONE;
  }
  switch(dwType){
    case REG_SZ:
      {
        CString strValue;
        return QueryValue(pszValueName,strValue)?Value(strValue):Value();
      }
      break;
    case REG_DWORD:
      {
        DWORD dw;
        return QueryValue(pszValueName,dw)?Value(dw):Value();
      }
      break;
    default:
      return Value();
      break;
  }
}
Пример #17
0
CRegKeyEx::Value CRegKeyEx::QueryValue(int nIndex,CString &strName)
{
  DWORD dwType;
  if(ERROR_SUCCESS!=::RegEnumValue(m_hKey,nIndex,NULL,NULL,NULL,&dwType,NULL,NULL)){
    dwType=REG_NONE;
  }
  switch(dwType){
    case REG_SZ:
      {
        CString strValue;
        return QueryValue(nIndex,strName,strValue)?Value(strValue):Value();
      }
      break;
    case REG_DWORD:
      {
        DWORD dw;
        return QueryValue(nIndex,strName,dw)?Value(dw):Value();
      }
      break;
    default:
      return Value();
      break;
  }
}
Пример #18
0
BOOL CRegistry::GetDoubleWordValue(LPCTSTR name_of_value, DWORD& ret)
{

    ASSERT(name_of_value != NULL);

    if (name_of_value == NULL) {
        m_ErrorCode = ERROR_INVALID_PARAMETER;
        return(FALSE);
    }

    DWORD size_of_buffer = sizeof(DWORD);

    KeyValueTypes type = typeDoubleWord;

    return(QueryValue(name_of_value, type, (LPBYTE) &ret, size_of_buffer));
}
Пример #19
0
BOOL CRegKey::QueryValue(LPCWSTR lpszValueName,CStringW& strData) const
{
	if (!IsUnicodeSystem())
	{
		CString strA;
		if (QueryValue(W2A(lpszValueName),strA))
		{
			strData=strA;
			return TRUE;
		}
		return FALSE;
	}

	DWORD dwLength=0;
	DWORD dwType=REG_SZ;
	if (::RegQueryValueExW(m_hKey,lpszValueName,NULL,&dwType,NULL,&dwLength)!=ERROR_SUCCESS)
	{
		strData.Empty();
		return FALSE;
	}

	if (dwType!=REG_SZ && dwType!=REG_EXPAND_SZ)
	{
		strData.Empty();
		return FALSE;
	}

	if (dwLength<=1)
	{
		strData.Empty();
		return TRUE;
	}


	if (::RegQueryValueExW(m_hKey,lpszValueName,NULL,NULL,(LPBYTE)strData.GetBuffer(dwLength/2-1),&dwLength)!=ERROR_SUCCESS)
	{
		strData.Empty();
		return FALSE;
	}
	return TRUE;
}
Пример #20
0
static wxString GetDiPropStr(HDEVINFO h, SP_DEVINFO_DATA *data, const wxString& key)
{
    wxString val;

    WCHAR buf[4096];
    DWORD size = sizeof(buf);
    DWORD proptype;
    if (SetupDiGetDeviceRegistryProperty(h, data, SPDRP_DRIVER, &proptype, (PBYTE)&buf[0], size, &size))
    {
        wxRegKey k(wxString("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Class\\") + buf);
        if (!QueryValue(k, key, val))
        {
            Debug.AddLine("SSAG failed to get " + key + " driver property value");
        }
    }
    else
    {
        Debug.AddLine("SSAG failed to get SDRP_DRIVER registry property for SSAG");
    }

    return val;
}
Пример #21
0
int main(int argc, char* argv[])
{
	Init();

	ULONG Type = 0;
	ULONG DataLen = 0;
	CHAR Buffer[0x200];

	ZeroMemory( Buffer, sizeof(Buffer) );
	for (ULONG i = 0; i < 10000; i++)
	{
		BOOL bResult = QueryValue(L"\\registry\\machine\\system\\controlset003\\services\\mup",
			L"ImagePath", &Type, &DataLen, Buffer, sizeof(Buffer));
		printf( "bResult = %d string = %S\n", bResult, Buffer );
	}

	return 0;

	CreateKey();
	printf("\n");
	SetValue();
	printf("\n");
//---------------------------------------------------------------------------------------------------------
	WCHAR RootKey[MAX_REGPATH_LEN];

	printf("MACHINE\n");
	lstrcpyW(RootKey, L"\\registry\\machine");
	EnumRegistry(RootKey, 1);

	printf("USER\n");
	lstrcpyW(RootKey, L"\\registry\\user");
	EnumRegistry(RootKey, 1);
//---------------------------------------------------------------------------------------------------------

	DeInit();

	return 0;
}
Пример #22
0
UnicodeString __fastcall TVersionInfo::QueryStringValue(const UnicodeString& SubBlock) const
{
  UnicodeString ResultString;
  void *StringBuffer;
  unsigned int BufferLength;
  if (FEnabled && FHasVersionInfo)
  {
	if (QueryValue(BuildStringFileInfo(SubBlock), StringBuffer, BufferLength))
	{
	  assert(BufferLength != 0);
	  ResultString = static_cast<TCHAR *>(StringBuffer);
	}
	else
	{
	  ResultString = L"";
	}
  }
  else
  {
	ResultString = L"";
  }
  return ResultString;
}
Пример #23
0
CString CFileVersionInfo::GetFileVersion() const
{
    return QueryValue(_T("FileVersion"));
}
bool CPropertyArchiveRegistry::Read(const CString &strValueName, long& nValue) const
{
	return ERROR_SUCCESS == QueryValue((DWORD&)nValue, strValueName);
}
Пример #25
0
CString CFileVersionInfo::GetProductName() const
{
    return QueryValue(_T("ProductName"));
}
Пример #26
0
wxString wxRegKey::FormatValue(const wxString& name) const
{
    wxString rhs;
    const ValueType type = GetValueType(name);
    switch ( type )
    {
        case Type_String:
            {
                wxString value;
                if ( !QueryValue(name, value) )
                    break;

                // quotes and backslashes must be quoted, linefeeds are not
                // allowed in string values
                rhs.reserve(value.length() + 2);
                rhs = wxT('"');

                // there can be no NULs here
                bool useHex = false;
                for ( wxString::const_iterator p = value.begin();
                      p != value.end() && !useHex; ++p )
                {
                    switch ( (*p).GetValue() )
                    {
                        case wxT('\n'):
                            // we can only represent this string in hex
                            useHex = true;
                            break;

                        case wxT('"'):
                        case wxT('\\'):
                            // escape special symbol
                            rhs += wxT('\\');
                            // fall through

                        default:
                            rhs += *p;
                    }
                }

                if ( useHex )
                    rhs = FormatAsHex(value, Type_String);
                else
                    rhs += wxT('"');
            }
            break;

        case Type_Dword:
        /* case Type_Dword_little_endian: == Type_Dword */
            {
                long value;
                if ( !QueryValue(name, &value) )
                    break;

                rhs.Printf(wxT("dword:%08x"), (unsigned int)value);
            }
            break;

        case Type_Expand_String:
        case Type_Multi_String:
            {
                wxString value;
                if ( !QueryRawValue(name, value) )
                    break;

                rhs = FormatAsHex(value, type);
            }
            break;

        case Type_Binary:
            {
                wxMemoryBuffer buf;
                if ( !QueryValue(name, buf) )
                    break;

                rhs = FormatAsHex(buf.GetData(), buf.GetDataLen());
            }
            break;

        // no idea how those appear in REGEDIT4 files
        case Type_None:
        case Type_Dword_big_endian:
        case Type_Link:
        case Type_Resource_list:
        case Type_Full_resource_descriptor:
        case Type_Resource_requirements_list:
        default:
            wxLogWarning(_("Can't export value of unsupported type %d."), type);
    }

    return rhs;
}
Пример #27
0
wxString wxRegKey::QueryDefaultValue() const
{
  wxString str;
  QueryValue(wxEmptyString, str, false);
  return str;
}
Пример #28
0
void __fastcall TVersionInfo::InitializeTranslationTable(void)
{
  #pragma pack(push, 1)
    union TTranslationTableEntry
    {
      struct struct_Codes
      {
        WORD LanguageCode;
        WORD CharsetCode;
      } Codes;

      DWORD RawData;
	};
  #pragma pack(pop)

  void *xlatebuffer;
  unsigned int BufferLength = 0;

  UnicodeString TempString;

  QueryValue(L"\\VarFileInfo\\Translation",xlatebuffer, BufferLength);
  TTranslationTableEntry* ATranslationTableEntry;
  ATranslationTableEntry = static_cast<TTranslationTableEntry*>(xlatebuffer);
  // We assume that the translation table is stored correctly;
  // the operating system provides no other means to retrieve
  // the count of items, so dividing table size by
  // sizeof(table entry) is the only means to achieve this.
  assert(BufferLength % sizeof(TTranslationTableEntry) == 0);

  while (BufferLength != 0)
  {
    TempString = L"";
	TempString.sprintf(L"%.4X%.4X", ATranslationTableEntry->Codes.LanguageCode,
                                  ATranslationTableEntry->Codes.CharsetCode);

    FTranslations->AddObject(TempString, reinterpret_cast<TObject*>(ATranslationTableEntry->RawData));

    ATranslationTableEntry++;
    BufferLength = BufferLength - sizeof(TTranslationTableEntry);
  }

  if ((FTranslations->Count == 0) && FHasVersionInfo)
  {
    // Interestingly, there was *NO* translation
    // data stored inside the buffer - for whatever
    // reason there might be.
    // The operating system mandates a language-charset
    // identifier, though, when it comes to querying
    // for string data.
    // Resolution: create a fake entry which is
    //             language-neutral and which uses
    //             the Unicode charset.

    TTranslationTableEntry TranslationCode;
    TranslationCode.Codes.LanguageCode = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
    TranslationCode.Codes.CharsetCode = 0x04b0; // Unicode

    TempString = L"";
	TempString.sprintf(L"%.4X%.4X", TranslationCode.Codes.LanguageCode,
                                  TranslationCode.Codes.CharsetCode );

    FTranslations->AddObject(TempString, reinterpret_cast<TObject*>(TranslationCode.RawData));
  }

  // By default pick the first language-charset entry
  // for display / analysis.
  FLanguageCharsetIndex = 0;
}
Пример #29
0
LONG	CIniFileRead::QueryValue(int& nValue, LPCTSTR lpszValueName)
{
	return QueryValue(*(DWORD*)&nValue, lpszValueName);
}
// --------------------------------------------------------------------------
// UPnPAppSettingPageHomeIAP::CreateAndExecuteSettingPageL ()
// --------------------------------------------------------------------------
//
void UPnPAppSettingItemHomeIAP::CreateAndExecuteSettingPageL()
    {
    __LOG8_1( "%s begin.", __PRETTY_FUNCTION__ );
    // if sharing is on, only information note is displayed
    UPnPAVControllerFactory::TAVControllerServerStatus status;
    UPnPAVControllerFactory::Status( status );
    if ( iSharingState || status == UPnPAVControllerFactory::EStatusActive )
        {
        CAknInformationNote* note = new (ELeave) CAknInformationNote;
        CleanupStack::PushL(note);
        HBufC* noteText = iCoeEnv->AllocReadResourceLC(
            R_QTN_IUPNP_IAP_TURN_SHARING_OFF);
        note->ExecuteLD(*noteText);
        CleanupStack::PopAndDestroy(noteText);
        CleanupStack::Pop(note);
        return;
        }

    // Resets the member array for iap ids.
    // Creates new array for iap names.
    iIAPIdArray.Reset();
    CDesCArray* array = new (ELeave) CDesCArrayFlat(5);
    CleanupStack::PushL(array);

    // adds static setting page items from resource
    // and stores the number of static items.
    AddStaticItemsL(array);
    TInt staticItemCount = array->Count();
    
    // adds wlan access points, array GETS the ownership
    CUPnPSettingsEngine::GetWLANAccessPointsL( array, iIAPIdArray );
    
    MAknQueryValue* qValue = QueryValue();
    User::LeaveIfNull(qValue);
    LoadL();
    StoreL();

    TInt idx = GetIAPIndex( staticItemCount );
    if ( idx >= array->MdcaCount() )
        {
        idx = array->MdcaCount() - 1;
        }
    // setting page is launched
    CAknSettingPage* dlg = new (ELeave) CAknRadioButtonSettingPage(
        SettingPageResourceId(),
        idx,
        array);

    if (dlg->ExecuteLD())
        {
        switch (idx)
            {
            case EUPnPSettingsEngineIAPItemNone:
                {
                DisplayInfoL(R_IBU_GALLERY_UPDATE_NOTE_TITLE_TEXT,
                             R_IBU_GALLERY_UPDATE_NOTAVAIL_NOTE_TEXT,
                             R_HOMECONNECT_INFO_QUERY);
                qValue->SetCurrentValueIndex(EUPnPSettingsEngineIAPItemNone);
                iIAPId = EUPnPSettingsEngineIAPIdNone;
                iIAPSetting = EUPnPSettingsEngineIAPItemNone;
                break;
                }
            case EUPnPSettingsEngineIAPItemAlwaysAsk:
                {
                qValue->SetCurrentValueIndex(EUPnPSettingsEngineIAPItemAlwaysAsk);
                iIAPId = EUPnPSettingsEngineIAPIdAlwaysAsk;
                iIAPSetting = EUPnPSettingsEngineIAPItemAlwaysAsk;
                DisplayInfoL(R_IBU_GALLERY_UPDATE_NOTE_TITLE_TEXT,
                             R_IBU_GALLERY_UPDATE_NOTE_TEXT,
                             R_HOMECONNECT_INFO_QUERY);
                break;
                }
            case EUPnPSettingsEngineIAPItemUserDefined: // Create new
                {
                // new iap wlan iap creation is started here
                
                TInt old_iap = iIAPId;
                
                CUPnPSettingsEngine::CreateAccessPointL();
                
                //We have to re-get all the wlan iaps again since
                //user may modify the iap list   
                RArray<TInt64> newArray;
                CleanupClosePushL( newArray );
                
                //We only are interested in the iap ids
                CUPnPSettingsEngine::GetWLANAccessPointsL(
                                                    NULL, 
                                                    newArray );
                
                if( newArray.Count() <= 0 ) //if no iap exisits
                    {
                    //if previous iap is not "None" or "Always ask"
                    if( old_iap > EUPnPSettingsEngineIAPIdAlwaysAsk )
                        {
                        DisplayInfoL(
                            R_IBU_GALLERY_UPDATE_NOTE_TITLE_TEXT,
                            R_IBU_GALLERY_UPDATE_NOTAVAIL_NOTE_TEXT,
                            R_HOMECONNECT_INFO_QUERY);
                        iIAPId = EUPnPSettingsEngineIAPIdNone;
                        
                        qValue->SetCurrentValueIndex(
                                            EUPnPSettingsEngineIAPItemNone );
                        iIAPSetting = EUPnPSettingsEngineIAPItemNone;
                        }
                    iIAPIdArray.Reset();
                    CleanupStack::PopAndDestroy( &newArray );
                    }
                else
                    {
                    TBool newiap = ETrue;
                    TInt lastItemIndex = newArray.Count() - 1;
                    //if the last item on the new iap list 
                    //is found in the old iap array
                    //then we think no new iap is created
                    for( TInt i = 0; i < iIAPIdArray.Count(); i++ )
                        {                        
                        if( newArray[lastItemIndex] == iIAPIdArray[i] )
                            {
                            newiap = EFalse; 
                            i = iIAPIdArray.Count();
                            }
                        }
                    
                    //get the new iap list
                    iIAPIdArray.Reset();
                    for( TInt i = 0; i < newArray.Count(); i++ )
                        {
                        iIAPIdArray.AppendL( newArray[i] );
                        }                        
                    CleanupStack::PopAndDestroy( &newArray );
                    
                    if( newiap )
                        {
                        iIAPId = iIAPIdArray[lastItemIndex];//get new iap
                        iIAPSetting = 
                                EUPnPSettingsEngineIAPItemUserDefined;
                        // show confirmation note if connection is 
                        // unsecured, the database store the value of
                        // the securitymode,such as EOpen,EWep,E802_1x,
                        // EWpa,if select other securitymode except 
                        // EOpen, the return value of the 
                        // CheckAPSecurityL fuction is not EWLanUnsecured
                        if ( CheckAPSecurityL(iIAPId) == EWLanUnsecured )
                            {
                            CAknQueryDialog* dlg = 
                                                CAknQueryDialog::NewL();
                            if (!(dlg->ExecuteLD(
                            R_UNSECURED_CONNECTIONS_CONFIRMATION_QUERY)))
                                {
                                //user cancels the dialog
                                UsePreviousIapL( old_iap ); 
                                }
                            }
                        else
                            {
                            // show 'Sharing Changed' note ( None -> sharing)
                            if(old_iap == EUPnPSettingsEngineIAPIdNone &&
                               iIAPId != old_iap )
                                {
                                DisplayInfoL(
                                     R_IBU_GALLERY_UPDATE_NOTE_TITLE_TEXT,
                                     R_IBU_GALLERY_UPDATE_NOTE_TEXT,
                                     R_HOMECONNECT_INFO_QUERY);
                                }  
                            }    
                        }
                    else 
                        {
                        UsePreviousIapL(old_iap);
                        } //if( newiap )
                    } //if( newArray.Count() <= 0 )
                break;
                }
            default: // Predefined iap is selected
                {
                TInt index;
                TInt old_iap = iIAPId;
                TBool iapchange = EFalse;
                // iap id is set
                if ( idx - staticItemCount >= 0 )
                    {
                    index = idx - staticItemCount;
                    if (CheckAPSecurityL(iIAPIdArray[index]) ==
                        EWLanUnsecured)
                        {
                        // show confirmation note if connection is unsecured
                        CAknQueryDialog* dlg = CAknQueryDialog::NewL();
                        if (dlg->ExecuteLD(
                            R_UNSECURED_CONNECTIONS_CONFIRMATION_QUERY))
                            {
                            //if "Continue"
                            iapchange = ETrue;
                            }
                        }
                    else
                        {
                        iapchange = ETrue;
                        }
                   
                    if( iapchange )
                        {
                        iIAPSetting = EUPnPSettingsEngineIAPItemUserDefined;
                        iIAPId = iIAPIdArray[index];
                        qValue->SetCurrentValueIndex(
                            EUPnPSettingsEngineIAPItemUserDefined);

                        // if previous iap was 'None' and current iap
                        // is not 'None'
                        if ( old_iap == EUPnPSettingsEngineIAPIdNone &&
                             iIAPId != old_iap )
                            {
                            DisplayInfoL(
                                R_IBU_GALLERY_UPDATE_NOTE_TITLE_TEXT,
                                R_IBU_GALLERY_UPDATE_NOTE_TEXT,
                                R_HOMECONNECT_INFO_QUERY);
                            }
                        }
                    }
                break;
                }
            }
        }
    LoadL();
    StoreL();

    CleanupStack::PopAndDestroy(array);
    __LOG8_1( "%s end.", __PRETTY_FUNCTION__ );
    }