installer::error clear_registry()
        {
            CAtlString key_product = CAtlString(L"Software\\") + (const wchar_t*) get_product_name().utf16();

            ::SHDeleteKey(HKEY_CURRENT_USER, key_product);
            ::SHDeleteKey(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\icq.desktop");
            ::SHDeleteValue(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Run", (const wchar_t*) get_product_name().utf16());
            ::SHDeleteKey(HKEY_CURRENT_USER, L"Software\\Classes\\icq");

            return installer::error();
        }
        installer::error write_update_version()
        {
            CRegKey key_software;

            if (ERROR_SUCCESS != key_software.Open(HKEY_CURRENT_USER, L"Software"))
                return installer::error(errorcode::open_registry_key, "open registry key: Software");

            CRegKey key_product;
            if (ERROR_SUCCESS != key_product.Create(key_software, (const wchar_t*) get_product_name().utf16()))
                return installer::error(errorcode::create_registry_key, QString("create registry key: ") + get_product_name());

            if (ERROR_SUCCESS != key_product.SetStringValue(L"update_version", (const wchar_t*) QString(VERSION_INFO_STR).utf16()))
                return installer::error(errorcode::set_registry_value, "set registry value: Software\\icq.desktop update_version");

            return installer::error();
        }
static int __devinit  fac_info_probe(struct platform_device *pdev)
{
         int ret = 0;
        ret = get_product_name(product_name,NAME_LEN);
        if(ret)
        {
            printk(KERN_ERR "get product name fail!\n");
        }
        ret = get_hardware_ver(hardware_ver,NAME_LEN);
        if(ret)
        {
            printk(KERN_ERR "get hardware version fail!\n");
        }
        ret = get_software_ver(software_ver,NAME_LEN);
        if(ret)
        {
            printk(KERN_ERR "get software version fail!\n");
        }
		ret = set_sbl1_ver_to_appinfo();
        if(ret)
        {
            printk(KERN_ERR "get sbl1 version fail!\n");
        }
		ret = set_hardware_ver_to_appinfo();
        if(ret)
        {
            printk(KERN_ERR "get hardware version fail!\n");
        }
		ret = set_appboot_ver_to_appinfo();
        if(ret)
        {
            printk(KERN_ERR "get appboot version fail!\n");
        }		
		ret = set_product_name_to_appinfo();
        if(ret)
        {
            printk(KERN_ERR "get product name fail!\n");
        }
		ret = set_software_ver_to_appinfo();
        if(ret)
        {
            printk(KERN_ERR "get software ver fail!\n");
        }
        return ret;
}
Exemple #4
0
int ff_syscall(u32 cmd,void * buf,u32 size)
{
    s32 ret = 0;
	
    switch(cmd)
    { 
		case FF_SYSCALL_FF_TABLE_DISABLE:
			{
				ff_list_disable();
			}
		    break;
        case FF_SYSCALL_SET_SESSION_MODE:
		{
            if(size == sizeof(s32))
                ns_mode = *(u32 *)buf;
            /* 注册会话钩子函数 */
            conplat_session_mode_init(*(u32 *)buf);
            break;
		}
        case FF_SYSCALL_GET_SESSION_MODE:
		{
            if(size == sizeof(s32))
                *(u32 *)buf = ns_mode;
            break;
		}
        case FF_SYSCALL_GET_PRODUCT_NAME:
        {            
#if defined(CONFIG_MIPS) && !defined(__srg__) && !defined(__bsw__) 
            if(size == sizeof(s8)*16)
                strncpy((s8 *)buf, get_product_name(), 16);
#endif
            break;
        }
		default:
		 	ret = 1;
            break;
    }

    (void)buf;
    (void)size;
    return ret;
}
 CAtlString get_default_referer()
 {
     return (const wchar_t*) get_product_name().utf16();
 }
        installer::error write_registry()
        {
            installer::error err;

            QString exe_path = get_icq_exe();
            exe_path = exe_path.replace('/', '\\');

            if (!get_exported_data().get_settings() || get_exported_data().get_settings()->auto_run_)
            {
                CRegKey key_software_run;
                if (ERROR_SUCCESS != key_software_run.Open(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Run", KEY_SET_VALUE))
                    return installer::error(errorcode::open_registry_key, "open registry key: Software\\Microsoft\\Windows\\CurrentVersion\\Run");

                if (ERROR_SUCCESS != key_software_run.SetStringValue((const wchar_t*) get_product_name().utf16(), (const wchar_t*)(QString("\"") + exe_path + "\"").utf16()))
                    return installer::error(errorcode::set_registry_value, "set registry value: Software\\Microsoft\\Windows\\CurrentVersion\\Run icq.desktop");
            }


            CRegKey key_software;

            if (ERROR_SUCCESS != key_software.Open(HKEY_CURRENT_USER, L"Software"))
                return installer::error(errorcode::open_registry_key, "open registry key: Software");

            CRegKey key_product;
            if (ERROR_SUCCESS != key_product.Create(key_software, (const wchar_t*) get_product_name().utf16()))
                return installer::error(errorcode::create_registry_key, QString("create registry key: ") + get_product_name());

            if (ERROR_SUCCESS != key_product.SetStringValue(L"path", (const wchar_t*) exe_path.utf16()))
                return installer::error(errorcode::set_registry_value, "set registry value: Software\\icq.desktop path");

            write_referer(key_product);

            HKEY key_cmd, key_icq = 0, key_icon = 0;
            DWORD disp = 0;

            CAtlString command_string = CAtlString("\"") + (const wchar_t*) exe_path.utf16() + L"\" -urlcommand \"%1\"";
            CAtlString url_link_string = "URL:ICQ Link";

            if (ERROR_SUCCESS == ::RegCreateKeyEx(HKEY_CURRENT_USER, L"Software\\Classes\\icq\\shell\\open\\command", 0, L"", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &key_cmd, &disp)) 
            {
                ::RegSetValueEx(key_cmd, NULL, 0, REG_SZ, (LPBYTE) command_string.GetBuffer(), sizeof(TCHAR)*(command_string.GetLength() + 1));
                
                if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\Classes\\icq", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, &key_icq))
                {
                    ::RegSetValueEx(key_icq, NULL, 0, REG_SZ, (LPBYTE) url_link_string.GetBuffer(), sizeof(TCHAR)*(url_link_string.GetLength() + 1));
                    ::RegSetValueEx(key_icq, L"URL Protocol", 0, REG_SZ, (LPBYTE) L"", sizeof(TCHAR));


                    if (ERROR_SUCCESS == ::RegCreateKeyEx(key_icq, L"DefaultIcon", 0, L"", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &key_icon, &disp))
                    {
                        CAtlString icon_path = (const wchar_t*) exe_path.utf16();

                        ::RegSetValueEx(key_icon, NULL, 0, REG_SZ, (LPBYTE) icon_path.GetBuffer(), sizeof(TCHAR)*(icon_path.GetLength() + 1));

                        ::RegCloseKey(key_icon);
                    }

                    ::RegCloseKey(key_icq);
                }

                ::RegCloseKey(key_cmd);
            }

            err = write_to_uninstall_key();
            if (!err.is_ok())
                return err;

            return err;
        }
int hisi_sensor_config(struct hisi_sensor_ctrl_t *s_ctrl, void *arg)
{
    if (NULL == arg) {
        cam_err("%s: arg is NULL", __func__);
        return -EFAULT;
    }
	struct sensor_cfg_data *cdata = (struct sensor_cfg_data *)arg;
	long   rc = 0;
	static bool power_on = false;

	cam_info("%s enter cfgtype=%d.\n", __func__, cdata->cfgtype);

	mutex_lock(s_ctrl->hisi_sensor_mutex);

	switch (cdata->cfgtype) {
	case CFG_SENSOR_POWER_DOWN:
		if (power_on == true) {
			rc = s_ctrl->sensor->func_tbl->sensor_power_down(s_ctrl);
			power_on = false;
		}
		break;
	case CFG_SENSOR_POWER_UP:
		if (power_on == false) {
			rc = s_ctrl->sensor->func_tbl->sensor_power_up(s_ctrl);
			if (0 == rc)
				power_on = true;
		}
		break;
	case CFG_SENSOR_I2C_READ:
		rc = s_ctrl->sensor->func_tbl->sensor_i2c_read(s_ctrl, arg);
		break;
	case CFG_SENSOR_I2C_WRITE:
		rc = s_ctrl->sensor->func_tbl->sensor_i2c_write(s_ctrl, arg);
		break;
	case CFG_SENSOR_I2C_READ_SEQ:
		rc = s_ctrl->sensor->func_tbl->sensor_i2c_read_seq(s_ctrl, arg);
		break;
	case CFG_SENSOR_I2C_WRITE_SEQ:
		rc = s_ctrl->sensor->func_tbl->sensor_i2c_write_seq(s_ctrl, arg);
		break;
	case CFG_SENSOR_GET_SENSOR_NAME:
        memset(cdata->cfg.name, 0, sizeof(cdata->cfg.name));
		strncpy(cdata->cfg.name, s_ctrl->sensor->sensor_info->name,
			sizeof(cdata->cfg.name) - 1);
		rc = 0;
		break;
	case CFG_SENSOR_APPLY_EXPO_GAIN:
		rc = s_ctrl->sensor->func_tbl->sensor_apply_expo_gain(s_ctrl, arg);
		break;
	case CFG_SENSOR_SUSPEND_HISI_EG_TASK:
		rc = s_ctrl->sensor->func_tbl->sensor_suspend_eg_task(s_ctrl, arg);
			break;
	case CFG_SENSOR_GET_PRODUCT_NAME:
        memset(cdata->cfg.name, 0, sizeof(cdata->cfg.name));
		strncpy(cdata->cfg.name, get_product_name(), sizeof(cdata->cfg.name) - 1);
		rc = 0;
		break;
	case CFG_SENSOR_APPLY_BSHUTTER_EXPO_GAIN:
		rc = s_ctrl->sensor->func_tbl->sensor_apply_bshutter_expo_gain(s_ctrl, arg);
		break;
	default:
		rc = s_ctrl->sensor->func_tbl->sensor_ioctl(s_ctrl, arg);
		break;
	}

	mutex_unlock(s_ctrl->hisi_sensor_mutex);

	return rc;
}