Welcome! Log In Create A New Profile

Advanced

Swapping IOS Modules with patchmii?

Posted by pokeglobe 
Swapping IOS Modules with patchmii?
March 13, 2010 02:54AM
I have been messing around with IOS lately and thought, hey! why not swap modules around?

What I did was download IOS60 and copied 00000000 file and tried to put it into IOS70 just as a test.
So I used this method.

used the tmd_add_module.c

and used:

ISFS_Delete("/tmp/patchmii/00000000");
ncid = 0; // from tmd_add_module2
tmd_add_module2(p_tmd,00000000_elf,00000000_elf_size);

It deletes the file and replaces it with 00000000.elf and renames it to 00000000 without extention I assume.
but when I get to ES_AddContentFinish it returns -4100 -1022

I read the error code on the /dev/es page on wiibrew and it said:
Content did not match hash in TMD

I have a feeling the mistake is not far away, but help on HOW to fix this would be great!



Edited 1 time(s). Last edit at 03/13/2010 03:20AM by pokeglobe.
Re: Swapping IOS Modules with patchmii?
March 14, 2010 03:59PM
You need to know if the file you want to put in is encrypted or not. If it is, then you need to decrypt it first, then you need to update the hash in the tmd, and then encrypt it.

I don't like the order in which PatchMii does its stuff, look at the modified PatchMii code in Trucha Bug Restorer. It uses too much memory to handle something else than IOS, but in exchange it does not write anything to nand except the title you want to install and it works in this order:
Get the IOS
Decrypt it
Patch it if selected
Trucha sign it if necessary
Encrypt it
Install it

I think the TBR code is more easy to understand and modify than the original PatchMii code. That's only my personal point of view, you may disagree on this, maybe not.
Re: Swapping IOS Modules with patchmii?
March 14, 2010 06:48PM
I didn't think patchmii did that. So when patchmii downloads it decrypts it too?
Because I made it remove the 00 file from tmp/patchmii and add it from the app.

The file I am adding is encrypted though, so I will need to decrypt it from my pc and then add it?
Also does patchmii encrypt it before installing? because that would save some time.

I also found TBR to be easier for this, but I couldn't figure some things out since you changed the names of things like p_cr and stuff.
Re: Swapping IOS Modules with patchmii?
March 16, 2010 02:27AM
Okay. I noticed that TBR stores stuff to encrypted buffer. Then Decrypts them to decrypted buffer.
How can I put ehcmodule_elf into the decrypted buffer without downloading it?

I have been going for a day or so. Thanks.
Re: Swapping IOS Modules with patchmii?
March 17, 2010 05:38AM
just say memcpy(decrypted_buffer, ehcimodule_elf, ehcimodule_elf_size); you just have to make sure the buffer is big enough to hold it.
Re: Swapping IOS Modules with patchmii?
March 29, 2010 01:29AM
I am still having a problem with this. How come I cannot delete the temporary file in ISFS and then add a custom one?

I added the code into save_nus_object

Right after it saves:
Delete it
Add new one
Update Hash
Then it encrypts then signs TMD
But install ALWAYS returns -4100

It's using the same module, I mean EXACT same! I have tried not updating hash also, but problem still occurs.
Sorry, only registered users may post in this forum.

Click here to login