| View previous topic :: View next topic |
| Author |
Message |
johnmph
Joined: 23 Jul 2005 Posts: 119
|
Posted: Tue Aug 09, 2005 12:36 am Post subject: How to load decrypted modules ? |
|
|
Hello, i have decrypted a module with decrypter sample of PSPSDK.
I have try to load it with sceKernelLoadModule but it doesn't work, why ?
Is there a function to load decrypted module (ELF) ?
Thanks. |
|
| Back to top |
|
 |
Agoln

Joined: 08 Jun 2005 Posts: 326 Location: Fort Wayne, IN
|
Posted: Tue Aug 09, 2005 12:53 am Post subject: |
|
|
when it sets user mode, make sure you are in kernel mode. _________________ Lego of my Ago! |
|
| Back to top |
|
 |
johnmph
Joined: 23 Jul 2005 Posts: 119
|
Posted: Tue Aug 09, 2005 1:10 am Post subject: |
|
|
| Agoln wrote: | | when it sets user mode, make sure you are in kernel mode. |
I am in user mode with kernel memory access and pspSdkInstallNoDeviceCheckPatch(); is called in _init function.
It's works with encrypted module but i have a SCE_KERNEL_ERROR_UNSUPPORTED_PRX_TYPE error with decrypted module. |
|
| Back to top |
|
 |
PspPet
Joined: 30 Mar 2005 Posts: 210
|
Posted: Tue Aug 09, 2005 1:32 am Post subject: |
|
|
> Is there a function to load decrypted module (ELF) ?
The system can be tricked (along the lines of what you are trying to do)
Kernel memory module flag (0x1000) AND kernel thread required for most of this loading trickery.
http://forums.ps2dev.org/viewtopic.php?p=16537
(look for "LoadModule tips and tricks")
In general most PRXs must be loaded from a kernel thread. You can use them later from a user thread.
This can cause unrelated problems (BTW: I believe it is the root cause of DHCP not working), and the library entries can be tricky.
Which PRX are you loading, and what are you doing special ? (ie. there may be more specific advice)
----
FWIW:
The official system wants support libraries to be encrypted (for obvious reasons).
IMHO, if you already have the encrypted ELF file (ie. the PRX), you can load it directly. If you want to tweek the ELF file, you can load it first, then party on the loaded memory image. No need for "pspSdkInstallNoDeviceCheckPatch"
[ie. if trying to tweek a loadable PRX library, I suggest changing the library directly instead of changing the entire system] |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Tue Aug 09, 2005 3:45 am Post subject: |
|
|
Well I can probably guess why it is failing, you are trying to load a plain text kernel module which by default will not work. You can load plain text user modules such as pspnet but the kernel will refuse anything with the 0x1000 attribute which is born out if you install a kprintf handler.
As psppet says there is probably littlle real reason why you can't just load the original encrypted form, though if you really really really have to do it then (seeing as I am in a good mood) call pspSdkInstallNoPlainModuleCheckPatch in kernel mode to disable the check. |
|
| Back to top |
|
 |
johnmph
Joined: 23 Jul 2005 Posts: 119
|
Posted: Tue Aug 09, 2005 4:17 am Post subject: |
|
|
| PspPet wrote: | > Is there a function to load decrypted module (ELF) ?
The system can be tricked (along the lines of what you are trying to do)
Kernel memory module flag (0x1000) AND kernel thread required for most of this loading trickery.
http://forums.ps2dev.org/viewtopic.php?p=16537
(look for "LoadModule tips and tricks")
In general most PRXs must be loaded from a kernel thread. You can use them later from a user thread.
This can cause unrelated problems (BTW: I believe it is the root cause of DHCP not working), and the library entries can be tricky.
Which PRX are you loading, and what are you doing special ? (ie. there may be more specific advice)
----
FWIW:
The official system wants support libraries to be encrypted (for obvious reasons).
IMHO, if you already have the encrypted ELF file (ie. the PRX), you can load it directly. If you want to tweek the ELF file, you can load it first, then party on the loaded memory image. No need for "pspSdkInstallNoDeviceCheckPatch"
[ie. if trying to tweek a loadable PRX library, I suggest changing the library directly instead of changing the entire system] |
In your tricks, you says :
"You can load encrypted files from the MS, but that leads to potential copyright problems.
Trying to load unencrypted PRX files fails [can't load a "PLAIN" module]"
Could the new function pspSdkInstallNoPlainModuleCheckPatch() of the PSPSDK solve the problem?
I have modify PRXdecrypt sample :
/* Check if we managed to decrypt the file */
if(*(unsigned short *)(check+0x5a) & 1)
{
/* Set decrypt buffer pointer */
*(unsigned int*)(check+0x24) = (unsigned int) g_decrypt_buf;
sceKernelCheckExecFile(g_data, check);
//output = g_decrypt_buf;
output = g_data;
}
else
output = g_data;
for writing g_data buffer instead g_decrypt_buf (decompressed but not decrypted) and i have noted only chnnlsv.prx (VSH module) module is not encrypted.
I think we can load decrypted modules but they must be compressed (PSP format) because chnnlsv.prx is in flash0 and he can be loaded.
"if you already have the encrypted ELF file (ie. the PRX), you can load it directly. If you want to tweek the ELF file, you can load it first, then party on the loaded memory image"
I will try that, thanks for your help.
Last edited by johnmph on Tue Aug 09, 2005 5:11 am; edited 1 time in total |
|
| Back to top |
|
 |
johnmph
Joined: 23 Jul 2005 Posts: 119
|
Posted: Tue Aug 09, 2005 4:43 am Post subject: |
|
|
| TyRaNiD wrote: | Well I can probably guess why it is failing, you are trying to load a plain text kernel module which by default will not work. You can load plain text user modules such as pspnet but the kernel will refuse anything with the 0x1000 attribute which is born out if you install a kprintf handler.
As psppet says there is probably littlle real reason why you can't just load the original encrypted form, though if you really really really have to do it then (seeing as I am in a good mood) call pspSdkInstallNoPlainModuleCheckPatch in kernel mode to disable the check. |
I had not seen your post message, i have used pspSdkInstallNoPlainModuleCheckPatch but i have a black screen and the psp shutdown.
I will try to load encrypted module and then modify functions in memory if i found address where loaded module is stored.
Thanks |
|
| Back to top |
|
 |
johnmph
Joined: 23 Jul 2005 Posts: 119
|
Posted: Tue Aug 09, 2005 5:43 am Post subject: |
|
|
"for writing g_data buffer instead g_decrypt_buf (decompressed but not decrypted) and i have noted only chnnlsv.prx (VSH module) module is not encrypted."
I made an error, i think that chnnlsv.prx is encrypted but not compressed. |
|
| Back to top |
|
 |
|