Problem to list module names

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Cpasjuste
Posts: 214
Joined: Sun May 29, 2005 8:28 am

Problem to list module names

Post by Cpasjuste »

Hello, i'm working under the 3.03 vsh on the ftpd server, but i have a little prob listing the modules that are running.

The function to get the running threads is working great, but the one for the module is listing only around 10 modules. Is it a prob of the 3.03 firmware, and if yes does someone have a solution ? Thanks in advance !

Here is the code :

Code: Select all


SceUID thids[50];
int thid_count = 0;
int i;
SceKernelThreadInfo thinfo;

void thlist() {

	char szString[256] = "";

	int fd = sceIoOpen("ms0:/thlist.txt", PSP_O_WRONLY |PSP_O_CREAT/*|PSP_O_APPEND*/, 0777); 
   
	sceKernelGetThreadmanIdList(SCE_KERNEL_TMID_Thread,thids,50,&thid_count);
	for&#40;i=0;i<thid_count;i++&#41;
        &#123;
		memset&#40;&thinfo,0,sizeof&#40;SceKernelThreadInfo&#41;&#41;;
		thinfo.size = sizeof&#40;SceKernelThreadInfo&#41;;

		sceKernelReferThreadStatus&#40;thids&#91;i&#93;,&thinfo&#41;;

		sceIoLseek&#40;fd, 0, SEEK_END&#41;;

		sprintf&#40; szString, &thinfo.name&#91;0&#93;&#41;;

		sceIoWrite&#40;fd, szString, strlen&#40;szString&#41; &#41;;

		sceIoLseek&#40;fd, 0, SEEK_END&#41;;

		sceIoWrite&#40;fd, "--", 2&#41;;
				
	&#125;
	sceIoClose&#40;fd&#41;;

&#125;

SceUID mods&#91;50&#93;;
int mod_count = 0;
int x;
SceKernelModuleInfo modinfo;

void modlist&#40;&#41; &#123;

	char szString2&#91;256&#93; = "";

	int fd2 = sceIoOpen&#40;"ms0&#58;/modlist.txt", PSP_O_WRONLY |PSP_O_CREAT/*|PSP_O_APPEND*/, 0777&#41;; 
   
	sceKernelGetModuleIdList&#40;mods,50,&mod_count&#41;;
	for&#40;x=0;x<mod_count;x++&#41;
        &#123;
		memset&#40;&modinfo,0,sizeof&#40;SceKernelModuleInfo&#41;&#41;;
		modinfo.size = sizeof&#40;SceKernelModuleInfo&#41;;

		sceKernelQueryModuleInfo&#40;mods&#91;x&#93;,&modinfo&#41;;

		sceIoLseek&#40;fd2, 0, SEEK_END&#41;;

		sprintf&#40; szString2, &modinfo.name&#91;0&#93;&#41;;

		sceIoWrite&#40;fd2, szString2, strlen&#40;szString2&#41; &#41;;

		sceIoLseek&#40;fd2, 0, SEEK_END&#41;;

		sceIoWrite&#40;fd2, "--", 2&#41;;
		sceKernelDelayThread&#40;10*10000&#41;;
				
	&#125;
	sceIoClose&#40;fd2&#41;;

&#125;
Cpasjuste
Posts: 214
Joined: Sun May 29, 2005 8:28 am

Post by Cpasjuste »

Ok i get it, its not elegent at all but it working great, i take the code from psplink (like almost always, thanks again tyranid :) )

Code: Select all

static int print_modinfo&#40;SceUID uid&#41;
&#123;
	SceKernelModuleInfo info;
	int ret;
	char szString2&#91;256&#93; = "";

	int fd2 = sceIoOpen&#40;"ms0&#58;/modlist.txt", PSP_O_WRONLY |/*PSP_O_CREAT|*/PSP_O_APPEND, 0777&#41;; 

	memset&#40;&info, 0, sizeof&#40;info&#41;&#41;;
	info.size = sizeof&#40;info&#41;;

	ret = sceKernelQueryModuleInfo&#40;uid, &info&#41;;
	if&#40;ret >= 0&#41;
	&#123;
		//printf&#40;"UID&#58; 0x%08X Attr&#58; %04X - Name&#58; %s\n", uid, info.attribute, info.name&#41;;

		sceIoLseek&#40;fd2, 0, SEEK_END&#41;;

		sprintf&#40; szString2, &info.name&#41;;

		sceIoWrite&#40;fd2, szString2, strlen&#40;szString2&#41; &#41;;

		sceIoLseek&#40;fd2, 0, SEEK_END&#41;;

		sceIoWrite&#40;fd2, "--", 2&#41;;	

	&#125;
	sceIoClose&#40;fd2&#41;;

	return ret;
&#125;


int modlist&#40;&#41;
&#123;
	SceUID ids&#91;100&#93;;
	int ret;
	int count;
	int i;

	memset&#40;ids, 0, 100 * sizeof&#40;SceUID&#41;&#41;;
	ret = sceKernelGetModuleIdList&#40;ids, 100 * sizeof&#40;SceUID&#41;, &count&#41;;
	if&#40;ret >= 0&#41;
	&#123;
		printf&#40;"<Module List &#40;%d modules&#41;>\n", count&#41;;
		for&#40;i = 0; i < count; i++&#41;
		&#123;
			print_modinfo&#40;ids&#91;i&#93;&#41;;
		&#125;
	&#125;

	return 0;
&#125;
Post Reply