Beispiel #1
0
int set_registry_value(const char *dir, const char *name, unsigned int val)
{
	int ret = 0;
	struct RegParam reg;
	REGHANDLE h;

	memset(&reg, 0, sizeof(reg));
	reg.regtype = 1;
	reg.namelen = strlen("/system");
	reg.unk2 = 1;
	reg.unk3 = 1;
	strcpy(reg.name, "/system");
	if(sceRegOpenRegistry(&reg, 2, &h) == 0)
	{
		REGHANDLE hd;
		if(!sceRegOpenCategory(h, dir, 2, &hd))
		{
			if(!sceRegSetKeyValue(hd, name, &val, 4))
			{
				printf("Set registry value\n");
				ret = 1;
				sceRegFlushCategory(hd);
			}
			sceRegCloseCategory(hd);
		}
		sceRegFlushRegistry(h);
		sceRegCloseRegistry(h);
	}

	return ret;
}
Beispiel #2
0
int LPP_UtilsSetSystemReg(const char *dir, const char *name, u32 val)
{
    struct RegParam reg;
	REGHANDLE handle;
	
	memset(&reg, 0, sizeof(struct RegParam));
	reg.regtype = 1;
	reg.namelen = 7;
	reg.unk2 = 1;
	reg.unk3 = 1;
	memcpy(reg.name, "/system", reg.namelen);
	
	int ret = -1;
	
	if(sceRegOpenRegistry(&reg, 2, &handle) == 0)
	{
	    REGHANDLE hd;
		if(sceRegOpenCategory(handle, dir, 2, &hd) == 0)
		{
		    if(sceRegSetKeyValue(hd, name, &val, 4))
		    {
		        ret = 0;
			    sceRegFlushCategory(hd);
		    }
	 	    else
		    {
		        sceRegCreateKey(hd, name, REG_TYPE_INT, 4);
			    sceRegSetKeyValue(hd, name, &val, 4);
			    ret = 0;
			    sceRegFlushCategory(hd);
		    }
		    sceRegCloseCategory(hd);
	    }
	    sceRegFlushRegistry(handle);
	    sceRegCloseRegistry(handle);
	}
	
	return ret;
}
Beispiel #3
0
//Registry
int SetRegistryValue(const char *dir, const char *name, u32 val)
{
    int ret = 0;
    struct RegParam reg;
    REGHANDLE h;

    memset(&reg, 0, sizeof(reg));
    reg.regtype = 1;
    reg.namelen = strlen("/system");
    reg.unk2 = 1;
    reg.unk3 = 1;
    strcpy(reg.name, "/system");
    if(sceRegOpenRegistry(&reg, 2, &h) == 0)
    {
        REGHANDLE hd;
        if(!sceRegOpenCategory(h, dir, 2, &hd))
        {
            if(!sceRegSetKeyValue(hd, name, &val, 4))
            {
                ret = 1;
                sceRegFlushCategory(hd);
            }
                        else
                        {
                                sceRegCreateKey(hd, name, REG_TYPE_INT, 4);
                                sceRegSetKeyValue(hd, name, &val, 4);
                                ret = 1;
                sceRegFlushCategory(hd);
                        }
            sceRegCloseCategory(hd);
        }
        sceRegFlushRegistry(h);
        sceRegCloseRegistry(h);
    }

        return ret;
}