Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Hi,
Would it be possible to write a program to strip the windows files from an EXE file and then write another one to place the Files from another os into the EXE file? Also, chase, jAAman, carbonbased, get rid of the inopropriate post please.
"Real corn makes it special!" -The Grim Adventures of Billy and Mandy
I recently heard of a program called exe2com that strips an exe file down to a com one. Would it be possible to strip an exe file down to com, then, add info to the com file so that another os could use windows exe files?
"Real corn makes it special!" -The Grim Adventures of Billy and Mandy
exe2com IIRC only works with MZ type exe files and not PE
MZ I think just has some extra info like stack size and preferred memory address or something like that and is NOT relocatable, but PE will have RELOCATIONS wich means you have to
1.read/interpret the header(for linker stuff)
2.change the relocations to actual memory locations(or leave it that way if you support relocations in your format)
3.interpret the header again to convert it to your header
4.copy it to your header applying sections and such
but yea i don't remeber if it was MZE or PE or both but 1 is so simple you can just attach a template header onto a com/bin file and work perfectly
btw what do you need this for? if you need it to convert your kernel to .exe then well I would need to know what compiler your using
The hard part isn't reading the binary, even if it's a PE file (windows EXE format). The hard part is to offer all the OS services that the Windows program requires.
MZ I think just has some extra info like stack size and preferred memory address or something like that and is NOT relocatable
MZ executables are relocatable, dos did come with a program for converting DOS 'MZ' files, into CP/M style 'com' files (called exe2bin), however (iirc) it wouldnt work unless the program was compiled specifically for it (couldnt work if they were relocatable, or it specified a stack -- both required by the specification)
Also, chase, jAAman, carbonbased, get rid of the inopropriate post please
Hello..
As mentioned here, MZ exes can only converted into com and so on. Now from your question I can guess that you want to convert a standard exe to a file say "xyz" that can be executed in your OS.
Now for this you have to make your APIs windows (or rather DOS) compatible.. When a DOS program to print "Hello World" is compiled.. the DOS interrupts are assembled(int 21 I guess). So when such file executes it calls int 21 without knowing in which OS it is..
So you need to change such calls to your own API calls.. You have to map them...
Hope I was on right track.. its 5 AM.. so I am half in bed..
From my understanding MZ and PE are both relocatable, but mz default to realmode and PE to pmode with a realmode stub that prints the mesage about can run in realmode.