Dot Net programs only start when they are in the /windows directory

Started by mce2222, 14. Jul 2008, 08:55

previous topic - next topic
Go Down

mce2222

Hi,

I did some more research on the latest firmware, and I found out that I was able to start
new dot net programs from any folder... (they are shown in the remote-process-viewer)
however they do not work correctly.

with the remote-spy tool I noticed that there was a error window displayed on the box
which said, that the dot net dlls cannot be found.

so it seems that the main problem is that the dlls are only found when they are in the same folder.

does anyone know how to set the search path in WinCE ?  I expect that should be something like the PATH variable on Windows.
but I haven't found info on it yet.

Hoernchen

Something like this ?
Quote
A search path to the executable module cannot be specified. Unless the full path to the module is specified, Windows CE .NET searches the following path for the module:

    * The absolute path specified by the lpLibFileName parameter
    * The .exe launch directory
    * The Windows directory
    * ROM DLL files
    * OEM-specified search path, which also now contains the Windows CE Debug Shell path when the Shell.exe is included in the image.

The following registry subkey specifies a search path to use with LoadLibrary and CreateProcess:
Copy Code

HKEY_LOCAL_MACHINE\Loader
    SystemPath=multi_sz:\\path1\\
                        \\path2\\

But that doen't explain why it seems to search only in the .exe launch directory.
bringer of linux, conqueror of hdmi, jack of all trades.

is0-mick

I still seem to be having difficulty starting my modded version of tv2client, unfortunatly its too big to inject into the NK.BIN so I need to start it externally.

I've added this to the booterCE code:

            //set the path
            string[] paths = { @"\windows", @"\Hard Disk" };
            Registry.SetValue(@"HKEY_LOCAL_MACHINE\Loader", "SystemPath", paths, RegistryValueKind.MultiString);

I checked this was being set with remote registry viewer.

I have also changed the way TV2Client2.exe loads if it exists, and also the way the 'start' works in the web interface.

            if (File.Exists(appPath))
            {

                    {
                        FileInfo fi = new FileInfo(appPath);
                        ProcessStartInfo startInfo = new ProcessStartInfo(fi.FullName, null);
                        startInfo.UseShellExecute = false;
                        //startInfo.WorkingDirectory = fi.Directory.FullName;
                        Process myProcess = Process.Start(startInfo);
                        tv2clientPid = myProcess.Id;
           
                    }
            }


I still seem to get the error:
in booterCE.txt
error while starting App:System.ComponentModel.Win32Exception: Win32Exception at System.Diagnostics.PalErrors.Error() at System.Diagnostics.Process.StartWithCreateProcess() at System.Diagnostics.Process.Start() at System.Diagnostics.Process.Start() at Booter.App.RealMain() at Booter.App.Main()

If I try with the start in the web browser (I also modified the start routine) I get:

2.try... Win32Exception nativeCode:-2147454964 errorCode:-2147467259 base:System.ComponentModel.Win32Exception: Win32Exception at System.Diagnostics.PalErrors.Error() at System.Diagnostics.Process.StartWithCreateProcess() at System.Diagnostics.Process.Start() at System.Diagnostics.Process.Start() at BooterCE.Httpd.HttpServer.executeFile() at BooterCE.Httpd.HttpServer.handleCommand() at BooterCE.Httpd.HttpServer.OnResponse() at BooterCE.Httpd.HttpRequest.Process()


Any ideas?

Mick

mce2222

I think the systemPath value cannot be changed during runtime. so you need to modify the registry file and update it in nk.bin

is0-mick

I cant seem to find a fdf file editor, I did find fdf2reg.pl , but haven't got perl installed on my xp box.

I also tried creating a directory called \hard disk\test, and copying all of the wince DLL's including the framework into there, but that didnt work either. I would have thought that it should?

Any more ideas? Also from what I have read it says that the path already searches the \windows folder.
Could it be some security restriction like only allow execution from ram based disk, and not hard disk?

Any more ideas?

Mick

mce2222


I cant seem to find a fdf file editor, I did find fdf2reg.pl , but haven't got perl installed on my xp box.


I dont know of any fdf editor either.
only known way is  fdf2reg ... edit ... reg2fdf   


I also tried creating a directory called \hard disk\test, and copying all of the wince DLL's including the framework into there, but that didnt work either. I would have thought that it should?

Any more ideas? Also from what I have read it says that the path already searches the \windows folder.
Could it be some security restriction like only allow execution from ram based disk, and not hard disk?


I would expect that it should work. do you get a different error message ?

its a fact that older versions of the firmware behave differently, but I couldnt find any differences in the registries that would explain this.
so I suspect that the restriction was added on kernel level, which would mean that it could only be fixed by using and updating an older nk.bin or
by building a completely new nk.bin


is0-mick

I emailed 'itsme' to see if he could help with either rebuilding or adding larger files.

He suggested the following:

Quote

does it have multiple 'xip-sections' ?

if there is lots of empty space in the rom,what i usually do, is use 'makexip.pl' (http://www.google.com/search?q=makexip.pl )to create a new xip section,and then patch the the original filenames to be something else. 

if you want to replace a file with a larger one, what i ususally do, is add the new file data at the start of the empty space in the rom,and readjust the filedata pointers in the 'toc list'

relocating other data can be difficult, the module data is hard to relocate, filedata is not that hard.

but i did not write a script to really edit the roms, but usually create something manual,using 
'http://www.nah6.com/~itsme/cvs-xdadevtools/perlutils/hexedit' in a shell script to edit the image.


Mick

mce2222

as far as I understand an NK.BIN consists of exactly one XIP section... I don't think it is possible to have multiple in it.

also I don't think there is empty space in the NK.BIN, so there is no room to put anything larger in it without rearranging all the filedata pointers, so that there is no overlap.

if XIPPORT would work correctly on our nk.bin, then it would be pretty easy to remove or add files... however with the NK.BIN that I tried, it always crashed with this error:

Code: [Select]

System.ArgumentException: Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
   at System.IO.FileStream.Write(Byte[] array, Int32 offset, Int32 count)
   at RomLDR.FILESentry.WriteToText(String name, BinaryReader br)
   at XIPPort.MainForm.Dump(String path)
   at XIPPort.MainForm.button1_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


so it looks like it has a problem with one of the file entries.

xthing

This is maybe a stupid question, but doesn't the remote registry editor of WinCE Platform Builder work?
Or does that one also require the .bsp files?

mce2222

remote registry editor works nicely.
but the problem is that changes to the registry are not permanent... and many changes only have effect at boot time.
so the only way to change certain things is to modify the registry database in the NK.BIN

Go Up