forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem to list module names

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Cpasjuste



Joined: 29 May 2005
Posts: 214

PostPosted: Mon Jan 29, 2007 11:53 pm    Post subject: Problem to list module names Reply with quote

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:


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(i=0;i<thid_count;i++)
        {
      memset(&thinfo,0,sizeof(SceKernelThreadInfo));
      thinfo.size = sizeof(SceKernelThreadInfo);

      sceKernelReferThreadStatus(thids[i],&thinfo);

      sceIoLseek(fd, 0, SEEK_END);

      sprintf( szString, &thinfo.name[0]);

      sceIoWrite(fd, szString, strlen(szString) );

      sceIoLseek(fd, 0, SEEK_END);

      sceIoWrite(fd, "--", 2);
            
   }
   sceIoClose(fd);

}

SceUID mods[50];
int mod_count = 0;
int x;
SceKernelModuleInfo modinfo;

void modlist() {

   char szString2[256] = "";

   int fd2 = sceIoOpen("ms0:/modlist.txt", PSP_O_WRONLY |PSP_O_CREAT/*|PSP_O_APPEND*/, 0777);
   
   sceKernelGetModuleIdList(mods,50,&mod_count);
   for(x=0;x<mod_count;x++)
        {
      memset(&modinfo,0,sizeof(SceKernelModuleInfo));
      modinfo.size = sizeof(SceKernelModuleInfo);

      sceKernelQueryModuleInfo(mods[x],&modinfo);

      sceIoLseek(fd2, 0, SEEK_END);

      sprintf( szString2, &modinfo.name[0]);

      sceIoWrite(fd2, szString2, strlen(szString2) );

      sceIoLseek(fd2, 0, SEEK_END);

      sceIoWrite(fd2, "--", 2);
      sceKernelDelayThread(10*10000);
            
   }
   sceIoClose(fd2);

}
Back to top
View user's profile Send private message
Cpasjuste



Joined: 29 May 2005
Posts: 214

PostPosted: Tue Jan 30, 2007 1:39 am    Post subject: Reply with quote

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:

static int print_modinfo(SceUID uid)
{
   SceKernelModuleInfo info;
   int ret;
   char szString2[256] = "";

   int fd2 = sceIoOpen("ms0:/modlist.txt", PSP_O_WRONLY |/*PSP_O_CREAT|*/PSP_O_APPEND, 0777);

   memset(&info, 0, sizeof(info));
   info.size = sizeof(info);

   ret = sceKernelQueryModuleInfo(uid, &info);
   if(ret >= 0)
   {
      //printf("UID: 0x%08X Attr: %04X - Name: %s\n", uid, info.attribute, info.name);

      sceIoLseek(fd2, 0, SEEK_END);

      sprintf( szString2, &info.name);

      sceIoWrite(fd2, szString2, strlen(szString2) );

      sceIoLseek(fd2, 0, SEEK_END);

      sceIoWrite(fd2, "--", 2);   

   }
   sceIoClose(fd2);

   return ret;
}


int modlist()
{
   SceUID ids[100];
   int ret;
   int count;
   int i;

   memset(ids, 0, 100 * sizeof(SceUID));
   ret = sceKernelGetModuleIdList(ids, 100 * sizeof(SceUID), &count);
   if(ret >= 0)
   {
      printf("<Module List (%d modules)>\n", count);
      for(i = 0; i < count; i++)
      {
         print_modinfo(ids[i]);
      }
   }

   return 0;
}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group