Exemple #1
0
int get_registry_value(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))
        {
            REGHANDLE hk;
            unsigned int type, size;

            if(!sceRegGetKeyInfo(hd, name, &hk, &type, &size))
            {
                if(!sceRegGetKeyValue(hd, hk, val, 4))
                {
                    ret = 1;
                    sceRegFlushCategory(hd);
                }
            }
            sceRegCloseCategory(hd);
        }
        sceRegFlushRegistry(h);
        sceRegCloseRegistry(h);
    }
    return ret;
}
Exemple #2
0
/* Print info about a specific key */
void print_key_info(REGHANDLE hd, const char *name)
{
	unsigned int type;
	SceSize size;
	unsigned char data[1024];
	REGHANDLE hk;

	if(!sceRegGetKeyInfo(hd, name, &hk, &type, &size))
	{
		if(type == REG_TYPE_DIR)
		{
			printf("DIR - %-27s\n", name);
		}
		else
		{
			if(!sceRegGetKeyValue(hd, hk, data, size))
			{
				switch(type)
				{
					case REG_TYPE_INT: printf("INT - %-27s - %4d : %d\n", name, size, *((int*) data));
									   break;
					case REG_TYPE_STR: printf("STR - %-27s - %4d : %s\n", name, size, (char *)data);
									   break;
					case REG_TYPE_BIN: {
										   int i;
										   printf("BIN - %-27s - %4d : ", name, size);
										   for(i = 0; i < size-1; i++)
										   {
											   printf("%02X-", data[i]);
										   }
										   printf("%02X\n", data[i]);
									   }
									   break;
				};
			}
		}
	}
	else
	{
		printf("Could not get info for key %s\n", name);
	}
}
Exemple #3
0
int LPP_UtilsGetSystemReg(const char *dir, const char *name, u32 *val)
{
    struct RegParam reg;
    REGHANDLE handle = 0;
	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, 1, &handle) == 0)
	{
	    REGHANDLE hd;
		if(sceRegOpenCategory(handle, dir, 2, &hd) == 0)
		{
		    REGHANDLE hk;
			u32 type, size;
			
			if(sceRegGetKeyInfo(hd, name, &hk, &type, &size) == 0)
			{
			    if(sceRegGetKeyValue(hd, hk, val, 4) == 0)
				{
				    ret = 0;
					sceRegFlushCategory(hd);
				}
			}
			sceRegCloseCategory(hd);
		}
		sceRegFlushRegistry(handle);
		sceRegCloseRegistry(handle);
	}
	
	return ret;
}