I continued working on the just-for-fun AbiatharOS today, because messing with Windows PE is pretty fun. I discovered that DOSBox won't run under 64-bit WinPE because WinPE has no 32-bit subsystem. So, I switched the image to an x86 32-bit architecture. (If anybody ever makes serious use of this, it'll probably be because their full system doesn't have the power to run Abiathar smoothly, so being 32-bit makes sense.)
However, DOSBox still refused to run. After some investigation with Sysinternals Depends.exe and some hunting for 32-bit versions of the DLLs DOSBox calls for, I managed to get it working in WinPE. The only configuration changes I made were setting CPU cycles per second to 10,000 and enabling IPX. This was done so that the NetKeen files included in the image (with all the Galaxy games and Dreams) would be usable. Portable NetKeen disc, anyone?
I wrote the routine to create the open/save dialog when the normal .NET common dialogs aren't available. It uses P/Invoke and hopefully doesn't leak memory all over the place. (I did find and fix a particularly bad bug with a lack of null-terminator on the end of a string. Hey, I've never written anything in C++.) If possible (i.e. when not running as the PE shell), Abiathar uses a class that just forwards the property accesses to the normal .NET common dialog classes. The two folder browser dialogs that are used are just disabled when running under PE.
On PE startup, Abiathar looks for writable drives on which to place its configuration. If it finds none, it launches DiskPart, prompting the user to format a usable partition and give it a drive letter. If Abiathar can then detect a usable drive, it launches as normal; if not, DiskPart appears again and the user is given the option to shut down. (If multiple suitable drives are found, the user is prompted to choose one.)
In PE mode, an "OS" menu is added to the main menu strip that allows the user to launch a command prompt, start DOSBox, or shut down. (File | Exit is removed in PE mode because it would just cause a reboot.)
This is actually turning into something potentially useful. Of course, it'll need more testing before being declared stable, but Windows PE seems to be holding up pretty well.
No comments:
Post a Comment