So i finally got round to doing a lot more testing on booting MRI from USB and finally got it to work
to make the USB bootable in the first place i tried to inject the bootsector from the ezboot to my usb pen to make a cleaner loading way like the original cd boots but it ended up just making the usb not readable so its best to follow this tutorial from maanu to make the USB pen bootable first
now we can boot MRI but we get the valid structure error
It took a lot of time debugging to find the problem but the fix is really simple.
The problem lies when the system loads the first thing that is booted is winpeshl.ini located in X:\windows\system32 of boot.wim image on the usb,
This then points to the file MRIPEShl.exe which is responsible for loading the wallpaper backgrounds and scanning all attached drives looking for a MRI.EXE which it then copies to the X: ramdrive and runs, although the MRIPEShl.exe does scan all drives looking e.g floppy, cdrom it seems to miss the usb drive,
So i edited it to load my debugger first so i could load MRIPEShl.exe manually and see where the problem was but after i loaded it in my debugger in the PE enviroment the MRIPEShl.exe executed fine and found MRI.EXE on the USB which made things hard to see where the problem was as i couldnt recreate the problem in the debugger.
my next step was to try and make a loader that would act in the same way as the debugger to load MRIPEShl.exe and therfore execute MRI.EXE ok as i thought it must be a timing issue but i found a much simpler fix.
edit the winpeshl.ini file to load 2 instances of MRIPEShl.exe so the first one will fail to find it but the second time it should see the USB drive.
so if you edit your winpeshl.ini to have these both,
this will start the first instance of MRIPEShl.exe which will find no valid MRI then once you press ok the second MRIPEShl.exe will load up and find the valid structure ok and boot up as normal