Jump to content

porting DOS application on WinPE


Recommended Posts

Posted

hi e'body,

I want to port MSDOS application to WinPE. so pls can anybody help me or tell me where will get info abt this. Issues involved r : as MSDOS is real mode os & WinPE runs in protected mode(compatibility ).....

thanks


Posted

When you say "port", are you referring to "recompile in 32-bit mode" or "run 16-bit program on WinPE"? The former would require 16-bit source code or a decompiled version of the program, while the latter would require someone to develop a PEBuilder plugin for the WOW subsystem.

-syrynxx

Posted

I've seen the plugin for pebuilder to run 16 bit applications. Has anyone done this for the official version of WinPE? Or does anyone know if you can run HP Bios updates, Firmware updates and configure arrays with the smart start scripting tools in WinPE?

Jeff

Posted

hi, thanks for response...

i want to run 16 bit dos prog on WinPE & still haven't got documentation for WinPE which will make it clear that whether WinPE also has the kind of plugin Bart PE has(dos plugin(dospe)) & if not then i'll have to write it. can anybody hlp me in how to write plugin or can provide any links?

Posted

I think you'll have to write it....it's written in the documentation : windowsPE can't run 16 bits programs. I searched something to "bypass" this but I didn't find anything.

The problem is that it's not a problem of plugin...there's simply no possibility to run 16 bits programs. WindowsPE doesn't have "WoW32" (windows on windows32), the software that allows this sort of thing. That's why I have a lot of problems migrating from DOS to Windows PE.

Good luck :/

Posted

I have translated DosPE from BartPE for use with M$ WinPE

It worked perfectly for me. ran dos programs just like xp

just save the files section with a .bat extension and the Setupreg.addreg section as an .inf extension.

Be sure to modify the first line to the path to your ISO in order to copy the needed files to the correct place.

set isoroot=c:\winpe\iso\set ToDo=copy
if not exist %isoroot%\null md %isoroot%if not exist %isoroot%\i386\null md %isoroot%\i386REM; SystemRoot%ToDo% c:\windows\_default.pif %isoroot%\I386\%ToDo% c:\windows\system.ini %isoroot%\I386\%ToDo% c:\windows\win.ini %isoroot%\I386
if not exist %isoroot%\i386\system32\null md %isoroot%\i386\system32REM system32%ToDo% c:\windows\System32\ansi.sys  %isoroot%\I386\System32\%ToDo% c:\windows\System32\autoexec.nt  %isoroot%\I386\System32\%ToDo% c:\windows\System32\avicap.dll  %isoroot%\I386\System32%ToDo% c:\windows\System32\avifile.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\config.nt  %isoroot%\I386\System32\%ToDo% c:\windows\System32\command.com  %isoroot%\I386\System32\%ToDo% c:\windows\System32\comm.drv  %isoroot%\I386\System32\%ToDo% c:\windows\System32\commdlg.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\compobj.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\country.sys  %isoroot%\I386\System32\%ToDo% c:\windows\System32\crtdll.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\ctl3dv2.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\ddeml.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\dosx.exe  %isoroot%\I386\System32\%ToDo% c:\windows\System32\ega.cpi  %isoroot%\I386\System32\%ToDo% c:\windows\System32\gdi.exe  %isoroot%\I386\System32\%ToDo% c:\windows\System32\himem.sys  %isoroot%\I386\System32\%ToDo% c:\windows\System32\keyboard.drv  %isoroot%\I386\System32\%ToDo% c:\windows\System32\keyboard.sys  %isoroot%\I386\System32\%ToDo% c:\windows\System32\krnl386.exe  %isoroot%\I386\System32\%ToDo% c:\windows\System32\lanman.drv  %isoroot%\I386\System32\%ToDo% c:\windows\System32\lzexpand.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\mapi.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\mciavi.drv  %isoroot%\I386\System32\%ToDo% c:\windows\System32\mciseq.drv  %isoroot%\I386\System32\%ToDo% c:\windows\System32\mciwave.drv  %isoroot%\I386\System32\%ToDo% c:\windows\System32\mmsystem.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\mouse.drv  %isoroot%\I386\System32\%ToDo% c:\windows\System32\msacm.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\mscdexnt.exe  %isoroot%\I386\System32\%ToDo% c:\windows\System32\msvideo.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\netapi.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\ntdos.sys  %isoroot%\I386\System32\%ToDo% c:\windows\System32\ntdos404.sys  %isoroot%\I386\System32\%ToDo% c:\windows\System32\ntdos411.sys  %isoroot%\I386\System32\%ToDo% c:\windows\System32\ntdos412.sys  %isoroot%\I386\System32\%ToDo% c:\windows\System32\ntdos804.sys  %isoroot%\I386\System32\%ToDo% c:\windows\System32\ntio.sys  %isoroot%\I386\System32\%ToDo% c:\windows\System32\ntio404.sys  %isoroot%\I386\System32\%ToDo% c:\windows\System32\ntio411.sys  %isoroot%\I386\System32\%ToDo% c:\windows\System32\ntio412.sys  %isoroot%\I386\System32\%ToDo% c:\windows\System32\ntio804.sys  %isoroot%\I386\System32\%ToDo% c:\windows\System32\ntvdm.exe  %isoroot%\I386\System32\%ToDo% c:\windows\System32\ntvdmd.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\ole2.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\ole2disp.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\ole2nls.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\olecli.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\olesvr.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\pmspl.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\progman.exe  %isoroot%\I386\System32\%ToDo% c:\windows\System32\rasapi16.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\redir.exe  %isoroot%\I386\System32\%ToDo% c:\windows\System32\shell.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\sound.drv  %isoroot%\I386\System32\%ToDo% c:\windows\System32\storage.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\system.drv  %isoroot%\I386\System32\%ToDo% c:\windows\System32\timer.drv  %isoroot%\I386\System32\%ToDo% c:\windows\System32\toolhelp.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\typelib.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\user.exe  %isoroot%\I386\System32\%ToDo% c:\windows\System32\vcdex.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\ver.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\vga.drv  %isoroot%\I386\System32\%ToDo% c:\windows\System32\wfwnet.drv  %isoroot%\I386\System32\%ToDo% c:\windows\System32\win87em.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\winoldap.mod  %isoroot%\I386\System32\%ToDo% c:\windows\System32\winsock.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\winspool.exe  %isoroot%\I386\System32\%ToDo% c:\windows\System32\wow32.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\wowdeb.exe  %isoroot%\I386\System32\%ToDo% c:\windows\System32\wowexec.exe  %isoroot%\I386\System32\%ToDo% c:\windows\System32\wowfax.dll  %isoroot%\I386\System32\%ToDo% c:\windows\System32\wowfaxui.dll  %isoroot%\I386\System32\
If not exist %isoroot%\i386\system\null md %isoroot%\i386\systemREM System%ToDo% c:\windows\System\avicap.dll  %isoroot%\I386\System\%ToDo% c:\windows\System\avifile.dll  %isoroot%\I386\System\%ToDo% c:\windows\System\commdlg.dll  %isoroot%\I386\System\%ToDo% c:\windows\System\keyboard.drv  %isoroot%\I386\System\%ToDo% c:\windows\System\lzexpand.dll  %isoroot%\I386\System\%ToDo% c:\windows\System\mciavi.drv  %isoroot%\I386\System\%ToDo% c:\windows\System\mciseq.drv  %isoroot%\I386\System\%ToDo% c:\windows\System\mciwave.drv  %isoroot%\I386\System\%ToDo% c:\windows\System\mmsystem.dll  %isoroot%\I386\System\%ToDo% c:\windows\System\mmtask.tsk  %isoroot%\I386\System\%ToDo% c:\windows\System\mouse.drv  %isoroot%\I386\System\%ToDo% c:\windows\System\msvideo.dll  %isoroot%\I386\System\%ToDo% c:\windows\System\olecli.dll  %isoroot%\I386\System\%ToDo% c:\windows\System\olesvr.dll  %isoroot%\I386\System\%ToDo% c:\windows\System\shell.dll  %isoroot%\I386\System\%ToDo% c:\windows\System\sound.drv  %isoroot%\I386\System\%ToDo% c:\windows\System\stdole.tlb  %isoroot%\I386\System\%ToDo% c:\windows\System\system.drv  %isoroot%\I386\System\%ToDo% c:\windows\System\tapi.dll  %isoroot%\I386\System\%ToDo% c:\windows\System\timer.drv  %isoroot%\I386\System\%ToDo% c:\windows\System\ver.dll  %isoroot%\I386\System\%ToDo% c:\windows\System\vga.drv  %isoroot%\I386\System\%ToDo% c:\windows\System\wfwnet.drv  %isoroot%\I386\System\

this section contains the needed registry entries.

depends on how you create your registry files.

if you edit the registry files directly then you will need to put the name of the imported SetupReg.hiv file. for example if you imported SetupReg.hiv as PeSetupReg then you would modify the code like this:

HKLM, "PeSetupReg\ControlSet001\Control\WOW"

OR

add the [setupreg.addreg] section (excluding the section marker) to winpesys.inf in order to merge this into the registry while creating the hives.

[Version]signature = $CHICAGO$SetupClass=BASE
[DefaultInstall]AddReg     = Setupreg.addreg
[setupreg.addreg]
HKLM, "ControlSet001\Control\WOW"HKLM, "ControlSet001\Control\WOW", "cmdline",0x00020000, "%SystemRoot%\system32\ntvdm.exe"HKLM, "ControlSet001\Control\WOW", "DefaultSeparateVDM",, "no"HKLM, "ControlSet001\Control\WOW", "LPT_timeout",, "15"HKLM, "ControlSet001\Control\WOW", "size",, "0"HKLM, "ControlSet001\Control\WOW", "wowsize",, "16"HKLM, "ControlSet001\Control\WOW", "wowcmdline",0x00020000, "%SystemRoot%\system32\ntvdm.exe -a %SystemRoot%\system32\krnl386"HKLM, "ControlSet001\Control\WOW", "KnownDLLs",, "comm.drv commdlg.dll ctl3dv2.dll ddeml.dll keyboard.drv lanman.drv mmsystem.dll mouse.drv netapi.dll olecli.dll olesvr.dll pmspl.dll shell.dll sound.drv system.drv toolhelp.dll vga.drv wfwnet.drv win87em.dll winoldap.mod winsock.dll winspool.exe wowdeb.exe timer.drv rasapi16.dll compobj.dll storage.dll ole2.dll ole2disp.dll ole2nls.dll typelib.dll msvideo.dll avifile.dll msacm.dll mciavi.drv mciseq.drv mciwave.drv progman.exe avicap.dll mapi.dll"HKLM, "ControlSet001\Control\WOW", "SharedWowTimeout", 0x00000e10HKLM, "ControlSet001\Control\WOW", "RomFontPointers",1,\  b0,52,00,c0,b0,4a,00,c0,b0,4e,00,c0,b0,60,00,c0,c0,60,00,c0,c0,70,00,c0HKLM, "ControlSet001\Control\Session Manager\Environment", "PATHEXT",,".COM;.EXE;.BAT;.CMD"HKLM, "ControlSet001\Control\VirtualDeviceDrivers"HKLM, "ControlSet001\Control\VirtualDeviceDrivers", "VDD",0x00010000, ""

Hope I wasn't too confusing :)

Posted

hi spwan,

yeah, its confusing, can u elaborote it little more as i have never wrote scripts & played with registry?

Posted

Ok,

The first code window is a batch file. so simply copy and paste it into a text file and remame the file with a .bat extension, for example Ramdisk.bat

You have to edit the first line of this batch file to point to your iso

set isoroot= c:\winpe\iso\

so modify the part in blue to point to the root of your iso before you make the image

As far as the registry part, I don't know how you create you registry files.

There are three Main registry files that you can edit

SetupReg.hiv --> isoroot\I386\SYSTEM32\ = HKLM\System

Default --> isoroot\I386\SYSTEM32\CONFIG = HKCU (current user)

Software --> isoroot\I386\SYSTEM32\CONFIG = HKLM\Software

Sam and Security I have never used.

When you run the batch file(mkimg.cmd ) that makes the winpe iso it creates the above files that later turn into the Winpe registry when you boot it. (with me so far?)

There are two ways to edit these files. You can edit them before or after they are created. mkimg.cmd creates the registry by settings stored in config.inf. One line in this file reads setupreg.hiv = .\winpesys.inf,AddReg. This means that it uses winpesys.inf [addreg] section to create the setupreg.hiv file. So, if you add the lines of code after [setupreg.addreg] from the second code window above to winpesys.inf. The next time you run mkimg.cmd to create your iso, the SetupReg.hiv will have those keys added to it. Yes it's confusing, but that's wipe for you.

In order to edit the SetupReg.hiv after it has been created you have to import it into the registry.

so run regedit click on HKEY_LOCAL_MACHINE go to File and select Load Hive

Find the hive file and load it. it will ask you what you want to load it as. You can use any name except for the ones that already exist. eg, software,system.

From there you can use a .reg or .inf file to import settings. Use the previous post for further directions

Hope it helps, Sorry I coldn't be any clearer. sometimes I get all tied up in the Acronyms myself!

Posted

Thanks Spawn!

I had also tried the same thing. It did not work for me. What are you using for source code? XP or WS03. I am tring it with WS03 and I enabled the ram drive. I get the error:

"The system file is not suitable for running MS-DOS and Microsoft Windows applications."

I will try to compile it with XP source code next. However, I am trying to do this with the server version to enable network driver support better.

One thing that I noticed is that 3 of the files are not in the server source mapi.dll, rasapi16.dll and vcdex.dll. In XP the first 2 files are not there but vcdex.dll is. Where did you get these files from?

Jeff

Posted

hi,

its not wrking...

what i did:

1>created .bat file with code given by u & put that in WINPE folder frm where u run mkimg or oscdimg file. isoroot i set to the folder in which i store my iso image.

2>Added the code in winpesys.inf file as followes:

/*this part was already there in .inf file*/

[Version]

Signature = "$Windows NT$"

ClassGUID={00000000-0000-0000-0000-000000000000}

/*added this*/

[DefaultInstall]

AddReg = Setupreg.addreg

/*here, added the code given by u*/

/*following is nxt part of winpesys.inf*/

[AddReg]

;

; MiniNT key

;

HKLM,"ControlSet001\Control\MiniNT"

.

.

.

& then executed mkimg.cmd

but wheni boot my PC frm tis CD & try to run DOS application , i get an error as "is not a valid win 32 application" whether i am missing smyhing or need to migrate my code?(code is written in microsoft c6.0 & uses int86x & REGS commands)

Posted

Guess I wasn't Clear.

You got most of it right though. Since you are doing the winpesys.inf method. All you need to do is remove these lines from your modified winpesys.inf

[DefaultInstall]

AddReg = Setupreg.addreg

[setupreg.addreg]

Notice My Previous post says:

add the lines of code after [setupreg.addreg] from the second code window above to winpesys.inf

To clarify, Add the lines below [setupreg.addreg] from the second code window above to winpesys.inf but DO NOT include [setupreg.addreg] or anything above it.

Just like this

HKLM, "ControlSet001\Control\WOW"

HKLM, "ControlSet001\Control\WOW", "cmdline",0x00020000, "%SystemRoot%\system32\ntvdm.exe"

HKLM, "ControlSet001\Control\WOW", "DefaultSeparateVDM",, "no"

HKLM, "ControlSet001\Control\WOW", "LPT_timeout",, "15"

HKLM, "ControlSet001\Control\WOW", "size",, "0"

HKLM, "ControlSet001\Control\WOW", "wowsize",, "16"

HKLM, "ControlSet001\Control\WOW", "wowcmdline",0x00020000, "%SystemRoot%\system32\ntvdm.exe -a %SystemRoot%\system32\krnl386"

HKLM, "ControlSet001\Control\WOW", "KnownDLLs",, "comm.drv commdlg.dll ctl3dv2.dll ddeml.dll keyboard.drv lanman.drv mmsystem.dll mouse.drv netapi.dll olecli.dll olesvr.dll pmspl.dll shell.dll sound.drv system.drv toolhelp.dll vga.drv wfwnet.drv win87em.dll winoldap.mod winsock.dll winspool.exe wowdeb.exe timer.drv rasapi16.dll compobj.dll storage.dll ole2.dll ole2disp.dll ole2nls.dll typelib.dll msvideo.dll avifile.dll msacm.dll mciavi.drv mciseq.drv mciwave.drv progman.exe avicap.dll mapi.dll"

HKLM, "ControlSet001\Control\WOW", "SharedWowTimeout", 0x00000e10

HKLM, "ControlSet001\Control\WOW", "RomFontPointers",1,\

b0,52,00,c0,b0,4a,00,c0,b0,4e,00,c0,b0,60,00,c0,c0,60,00,c0,c0,70,00,c0

HKLM, "ControlSet001\Control\Session Manager\Environment", "PATHEXT",,".COM;.EXE;.BAT;.CMD"

HKLM, "ControlSet001\Control\VirtualDeviceDrivers"

HKLM, "ControlSet001\Control\VirtualDeviceDrivers", "VDD",0x00010000, ""

By the way the reason you got that message is because

If you notice in config.inf it says winpesys.inf.,AddReg. So it is looking for the addreg section. but, this line

AddReg  = Setupreg.addreg
acts like a pointer that says addreg = setupreg.addreg. and since there is no setupreg.addreg section it fails. so you in fact created an empty setupreg.hiv

@Jeffwitt41

I am running Windows XP and using windows xp cd as my source cd.

Posted

@Jeffwitt41

hey I sorry I skipped the part about the missing files. I don't know what the deal is with those. I just translated it from Bartpe. reading the pluggin it seems I should have translated some of those as If %filename% exist then copy...

sorry about that. but i guess you don't need them. My guess is that since bartpe can be compiled from xp home and windows 2000(I think) then maybe those OS's have those files.

Posted

Spawn,

No those files are not needed. I still cannot get it to work though. I am making it from windows 2000 Pro and have tried it with both Ws03 and xp source code. No go either way. I am installing an XP Virtual machine to try and compile it from that os.

I keep getting the error that an initilization file file could not be created. Did you ever get that message?

Have a good weekend.

Jeff

Posted

Hi Spawn,

Ok, i was making misake u mentioned, tommorow i 'll add the code to winpesys.inf file. tanks, one more thing, how u got to read bartpe dos plug in cause i tried but cuden't , also, can u suggest me sm links where i can learn more abt plugins as now i am just adding code given by u

thanks...

Posted

hi,

still getting the same err as "not a valid win32 application"

this is my winpesys.inf:

[Version]

Signature = "$Windows NT$"

ClassGUID={00000000-0000-0000-0000-000000000000}

[AddReg]

HKLM, "ControlSet001\Control\WOW"

HKLM, "ControlSet001\Control\WOW", "cmdline",0x00020000, "%SystemRoot%\system32\ntvdm.exe"

HKLM, "ControlSet001\Control\WOW", "DefaultSeparateVDM",, "no"

HKLM, "ControlSet001\Control\WOW", "LPT_timeout",, "15"

HKLM, "ControlSet001\Control\WOW", "size",, "0"

HKLM, "ControlSet001\Control\WOW", "wowsize",, "16"

HKLM, "ControlSet001\Control\WOW", "wowcmdline",0x00020000, "%SystemRoot%\system32\ntvdm.exe -a %SystemRoot%\system32\krnl386"

HKLM, "ControlSet001\Control\WOW", "KnownDLLs",, "comm.drv commdlg.dll ctl3dv2.dll ddeml.dll keyboard.drv lanman.drv mmsystem.dll mouse.drv netapi.dll olecli.dll olesvr.dll pmspl.dll shell.dll sound.drv system.drv toolhelp.dll vga.drv wfwnet.drv win87em.dll winoldap.mod winsock.dll winspool.exe wowdeb.exe timer.drv rasapi16.dll compobj.dll storage.dll ole2.dll ole2disp.dll ole2nls.dll typelib.dll msvideo.dll avifile.dll msacm.dll mciavi.drv mciseq.drv mciwave.drv progman.exe avicap.dll mapi.dll"

HKLM, "ControlSet001\Control\WOW", "SharedWowTimeout", 0x00000e10

HKLM, "ControlSet001\Control\WOW", "RomFontPointers",1,\

b0,52,00,c0,b0,4a,00,c0,b0,4e,00,c0,b0,60,00,c0,c0,60,00,c0,c0,70,00,c0

HKLM, "ControlSet001\Control\Session Manager\Environment", "PATHEXT",,".COM;.EXE;.BAT;.CMD"

HKLM, "ControlSet001\Control\VirtualDeviceDrivers"

HKLM, "ControlSet001\Control\VirtualDeviceDrivers", "VDD",0x00010000, ""

;

; MiniNT key

;

HKLM,"ControlSet001\Control\MiniNT"

;

; Core entries

;

HKLM,"ControlSet001\Control\GraphicsDrivers\DCI","Timeout",REG_DWORD,0x7

HKLM,"ControlSet001\Control\ProductOptions","ProductSuite",REG_MULTI_SZ,""

HKLM,"ControlSet001\Control\ProductOptions","ProductTyp

.

.

.

.

.

now , i am not getting where i am missing....

pls hlp me, its very urgent

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...