16-bit console applications on 64-bit Windows
-
Long story short, I got tired of seeing this:
I have XP Mode installed, but the "standard" way to use it is to launch it, open Explorer, navigate to the program (drives need to be shared), and launch it. That's kind of a pain when I literally just double-clicked it in the 64-bit host OS. So I figured... integration features allow you to launch programs in XP Mode, seamlessly integrated in the host system. There must be some way to get it to do this. It turned out to be more tricky than I expected. The simple stuff I tried didn't work. Like publishing
cmd.exe
from XP Mode -- this works -- but, you can't call it with the path to an executable as an argument. I tried. (You can call other XP Mode apps with arguments, so I assume it just balked because the file was executable. Whatever.)In the end, I created an empty file called
C:\Windows\Temp\XPModeShortcut.bat
. Opened XP Mode, created a shortcut to that file (E:\Windows\Temp\XPModeShortcut.bat
because of the way the drive is shared) in XP Mode's All Users Start Menu\Programs folder. Turned on automatic publishing to get it pushed out, then restarted XP Mode and turned automatic publishing back off (the published apps don't disappear). Now I have a shortcut on my host system that, when called, runs that batch file in XP Mode.Then I created a script, which I called
C:\Program Files\Windows XP Mode\Run in XP Mode.js
:var Shell = new ActiveXObject("WScript.Shell"), FSO = new ActiveXObject("Scripting.FileSystemObject"); if (WScript.Arguments.length < 1) throw new Error("No arguments"); var filename = WScript.Arguments.Item(0); var batchFile = FSO.CreateTextFile("C:\\Windows\\Temp\\XPModeShortcut.bat", true); batchFile.WriteLine('@echo off'); if (/^C:/i.test(filename)) { batchFile.WriteLine('cd "E:\\' + filename.split("\\").slice(1, -1).join("\\") + '"'); batchFile.WriteLine('"' + filename.split("\\").pop() + '"'); } else { batchFile.WriteLine('"' + filename.replace(/^([a-z]):/i, "\\\\tsclient\\$1") + '"'); } batchFile.Close(); Shell.Run('VMSAL "Windows XP Mode" "||2df2581c" "Run in XP Mode"');
(Note: that
||2df2581c
string was randomly generated to uniquely ID my "Run in XP Mode" shared application. It won't change, but if you tried to reproduce my efforts, it'd be different. I got that string by inspecting the shortcut that it published to the XP Mode application... except the shortcut uses rundll32 to launch VMSal, while I had to just run VMSal directly.)From there, it was just a matter of creating a new shell extension for in RegEdit, with a label "Run in &XP Mode" and a command of
wscript "C:\Program Files\Windows XP Mode\Run in XP Mode.js" "%1"
... and...8-)
-
@anotherusername said in 16-bit console applications on 64-bit Windows:
XP Mode
I didn't know they still made this! How did you get it working in Windows 10?
-
@Tsaukpaetra His top screenshot is a Vista/7 style, so.
I assume XP Mode doesn't work on versions newer than 7, but I honestly haven't checked.
Windows Virtual PC with Windows XP Mode is not supported on Windows 10. Your options are to not upgrade if your software is important to you. Migrate to Hyper-V or Oracle VirtualBox and install Windows XP in one of those Hypervisors and use your software there.
Yeah. With the obvious "not supported doesn't mean it doesn't work!" disclaimer.
A bigger question is how often do you need to run 16-bit apps? Seriously? You got "tired" of seeing a dialog box I've seen once ever.
-
@Tsaukpaetra The OP looks like he's on Windows 7 (you get a different error on Windows 8/10 when you run an incompatible executable). You can probably use DOSBox to fake it for 16-bit DOS apps. For Windows apps, grab a VM :/
-
For this program specifically, wouldn't dosbox be easier?
-
@blakeyrat said in 16-bit console applications on 64-bit Windows:
His top screenshot is a Vista/7 style, so.
@NCmdr said in 16-bit console applications on 64-bit Windows:
he's on Windows 7
Sorry if I forgot the ... Sheesh!
-
@Tsaukpaetra said in 16-bit console applications on 64-bit Windows:
@blakeyrat said in 16-bit console applications on 64-bit Windows:
His top screenshot is a Vista/7 style, so.
@NCmdr said in 16-bit console applications on 64-bit Windows:
he's on Windows 7
Sorry if I forgot the ... Sheesh!
Fear the ninjaing ;)
Honestly, I know a fair number of businesses (at least two) that got bit by dropping 16-bit app support. Windows NT on Alpha supported emulation of 16/32-bit Intel PE binaries with FX!32, and I know WINE was able to get 16-bit apps emulated as well.
I'll never understand why Microsoft didn't implement an actual emulator, especially if they had code for one. (I know the old V8086 solution can't be used under long mode. At least unless you reset one processor core from LM->back to PM, but that's overkill)
-
@NCmdr said in 16-bit console applications on 64-bit Windows:
I'll never understand why Microsoft didn't implement an actual emulator, especially if they had code for one.
They did. That's what XP Mode is. This thread is about exactly that.
Seriously. WTF.
-
@blakeyrat said in 16-bit console applications on 64-bit Windows:
A bigger question is how often do you need to run 16-bit apps? Seriously? You got "tired" of seeing a dialog box I've seen once ever.
"Tired" was a slight over-dramatization, but I'll need to use them a lot less when we finally get rid of the old hardware that talks to an old 16-bit app.
-
@NCmdr said in 16-bit console applications on 64-bit Windows:
I'll never understand why Microsoft didn't implement an actual emulator, especially if they had code for one. (I know the old V8086 solution can't be used under long mode. At least unless you reset one processor core from LM->back to PM, but that's overkill)
I understand why. It was a fucking act of mercy for people like me who, otherwise, would be forever stuck supporting 16bit garbage from shitvendors long since dead that proliferated during the early Shadow IT era of Foxpro and Filemaker.
-
@Weng said in 16-bit console applications on 64-bit Windows:
Foxpro and Filemaker.
Can both die in a fire.
-
@Polygeekery said in 16-bit console applications on 64-bit Windows:
@Weng said in 16-bit console applications on 64-bit Windows:
Foxpro and Filemaker.
Can both die in a fire.
Porting FoxPro applications to modern programming language and DBMS can (and usually) be tricky. Some query will hit performance penalty because it'll send massive amount of data between database server and your application, while in FoxPro you can evade that penalty for free.
-
@PleegWat said in 16-bit console applications on 64-bit Windows:
For this program specifically, wouldn't dosbox be easier?
Yes... but it was mainly just a handy one that I could throw on a flash drive and use as an example.
Plus, I already had XP Mode installed (as I said), and didn't have DosBox installed... at least, I don't think I had it installed... on that machine.
-
@blakeyrat said in 16-bit console applications on 64-bit Windows:
@NCmdr said in 16-bit console applications on 64-bit Windows:
I'll never understand why Microsoft didn't implement an actual emulator, especially if they had code for one.
They did. That's what XP Mode is. This thread is about exactly that.
Seriously. WTF.
-
@anotherusername said in 16-bit console applications on 64-bit Windows:
@blakeyrat said in 16-bit console applications on 64-bit Windows:
@NCmdr said in 16-bit console applications on 64-bit Windows:
I'll never understand why Microsoft didn't implement an actual emulator, especially if they had code for one.
They did. That's what XP Mode is. This thread is about exactly that.
Seriously. WTF.
VM is emulator. Just that it's not emulation layer that you need.
-
@anotherusername said in 16-bit console applications on 64-bit Windows:
VM !== emulator
VM and emulator are not mutually-exclusive.
XP Mode is a VM that runs in an emulator. (Virtual PC, an emulator Microsoft bought back in 2003.) Microsoft already provided exactly the same thing NCmdr was bitching about them not having.
-
@cheong said in 16-bit console applications on 64-bit Windows:
Porting FoxPro applications to modern programming language and DBMS can (and usually) be tricky. Some query will hit performance penalty because it'll send massive amount of data between database server and your application, while in FoxPro you can evade that penalty for free.
If you send massive amounts of data you don't actually need, you're querying it wrong.
-
@blakeyrat said in 16-bit console applications on 64-bit Windows:
XP Mode is a VM that runs in an emulator.
Wrong. Windows Virtual PC is virtualization, not emulation. It won't run at all on machines that don't do hardware virtualization.
-
@anotherusername News to me, because I used to run the exact same Virtual PC program on my PowerPC Macintosh, but I guess I'm just a retard stupid moron idiot you should make sure to call dumb at every opportunity.
-
@blakeyrat said in 16-bit console applications on 64-bit Windows:
I guess I'm just a retard stupid moron idiot you should make sure to call dumb at every opportunity.
Ah! Welcome back @blakeyrat! We missed your depression!
-
@LaoC said in 16-bit console applications on 64-bit Windows:
@cheong said in 16-bit console applications on 64-bit Windows:
Porting FoxPro applications to modern programming language and DBMS can (and usually) be tricky. Some query will hit performance penalty because it'll send massive amount of data between database server and your application, while in FoxPro you can evade that penalty for free.
If you send massive amounts of data you don't actually need, you're querying it wrong.
It's pretty common in FoxPro to get some data, call some function with some field in the data (the function may not be "pure" because it may involve something like "getting the fax status based on the phone number", etc.), and then use the return value as key to fetch some other data from other table (or the same table in some case where the parent record is stored in the same table).
You can only do this with careful rewrite in logic, or deploy some Java/.NET(depend on database) module on SQL server.
-
@cheong said in 16-bit console applications on 64-bit Windows:
or deploy some Java/.NET(depend on database) module on SQL server.
I'm not sure what this means, but I'm thinking it's :donotwant.vss:
-
@sloosecannon said in 16-bit console applications on 64-bit Windows:
@cheong said in 16-bit console applications on 64-bit Windows:
or deploy some Java/.NET(depend on database) module on SQL server.
I'm not sure what this means, but I'm thinking it's :donotwant.vss:
Something like CLR module that runs on SQL server.
-
@blakeyrat said in 16-bit console applications on 64-bit Windows:
I used to run the exact same Virtual PC program on my PowerPC Macintosh
TIL that Windows Virtual PC, which entered beta testing in 2009, and Microsoft Virtual PC for Mac, the last version of which was released in 2004, are "the exact same program" because they're both produced by Microsoft and have vaguely similar names.
-
@anotherusername said in 16-bit console applications on 64-bit Windows:
@blakeyrat said in 16-bit console applications on 64-bit Windows:
XP Mode is a VM that runs in an emulator.
Wrong. Windows Virtual PC is virtualization, not emulation. It won't run at all on machines that don't do hardware virtualization.
FYI, from Ben Armstrong's blog, Windows Virtual PC no longer require VT-D to run and therefore can be run on older machines.
-
@anotherusername said in 16-bit console applications on 64-bit Windows:
@blakeyrat said in 16-bit console applications on 64-bit Windows:
I used to run the exact same Virtual PC program on my PowerPC Macintosh
TIL that Windows Virtual PC, which entered beta testing in 2009, and Microsoft Virtual PC for Mac, the last version of which was released in 2004, are "the exact same program" because they're both produced by Microsoft and have vaguely similar names.
Maybe you're from some open source shitty universe, but where I live, things with the same name MEAN THE SAME THING.
You think I'm wrong?
LOOK AT THE NAME. IT IS LITERALLY THE SAME. VIRTUAL PC. MEANS IT'S THE SAME THING.I can't imagine living in your world, where things don't mean what they say. But I guess that's what the shitty open source developers want, so that's what we get.
This mock blakeyrant brought to you by Microsoft©®™ PeopleImpersonator™ 2016 Professional.
-
@anotherusername said in 16-bit console applications on 64-bit Windows:
@blakeyrat said in 16-bit console applications on 64-bit Windows:
I used to run the exact same Virtual PC program on my PowerPC Macintosh
TIL that Windows Virtual PC, which entered beta testing in 2009, and Microsoft Virtual PC for Mac, the last version of which was released in 2004, are "the exact same program" because they're both produced by Microsoft and have vaguely similar names.
Ooh, ooh, are you also going to tell me that Microsoft Virtual PC 2007 for Windows XP and Windows Virtual PC for Windows 7 are unrelated products despite them having almost identical UIs and features?
-
@cheong said in 16-bit console applications on 64-bit Windows:
Some query will hit performance penalty because it'll send massive amount of data between database server and your application, while in FoxPro you can evade that penalty for free.
There are current in-process DB engines that don't make Baby Jesus cry.
-
@dkf said in 16-bit console applications on 64-bit Windows:
@cheong said in 16-bit console applications on 64-bit Windows:
Some query will hit performance penalty because it'll send massive amount of data between database server and your application, while in FoxPro you can evade that penalty for free.
There are current in-process DB engines that don't make Baby Jesus cry.
Apparently some versions of the Microsoft Jet Database Engine can even Access FoxPro databases:
one of the modules contains the ISAM Drivers, DLLs that allow access to a variety of ISAM databases, among them xBase, Paradox, Btrieve and FoxPro, depending on the version of Jet.
-
@dkf said in 16-bit console applications on 64-bit Windows:
@cheong said in 16-bit console applications on 64-bit Windows:
Some query will hit performance penalty because it'll send massive amount of data between database server and your application, while in FoxPro you can evade that penalty for free.
There are current in-process DB engines that don't make Baby Jesus cry.
Yup. That is the point.
Either put your database engine inside your process, or put your process inside the database engine, or do full refactoring while porting the code to smooth the code path out.
-
@cheong said in 16-bit console applications on 64-bit Windows:
FoxPro
@cheong said in 16-bit console applications on 64-bit Windows:
fax
In the same post? REALLY?
I'd like you to know this almost killed me. I'll send you both my counselling and phone bills (3 hours on suicide hotline).
-
@Onyx said in 16-bit console applications on 64-bit Windows:
@cheong said in 16-bit console applications on 64-bit Windows:
FoxPro
@cheong said in 16-bit console applications on 64-bit Windows:
fax
In the same post? REALLY?
I'd like you to know this almost killed me. I'll send you both my counselling and phone bills (3 hours on suicide hotline).
I think quite a number of POS and warehouse stocktaking applications in FoxPro does that, though.
-
@anotherusername said in 16-bit console applications on 64-bit Windows:
Windows Virtual PC (…) and Microsoft Virtual PC for Mac
What people pick up on is not the cruft like “Windows” and “for Mac” but the “Virtual PC” bit. TRWTF here is giving different programs almost the same name — but not unexpected, given Microsoft’s history of coming up with imaginative names like this.
-
@Gurth said in 16-bit console applications on 64-bit Windows:
@anotherusername said in 16-bit console applications on 64-bit Windows:
Windows Virtual PC (…) and Microsoft Virtual PC for Mac
What people pick up on is not the cruft like “Windows” and “for Mac” but the “Virtual PC” bit. TRWTF here is giving different programs almost the same name — but not unexpected, given Microsoft’s history of coming up with imaginative names like this.
A) Virtual PC wasn't named by Microsoft - they bought it from Connectix.
B‍) These unimaginative names have one great benefit: you usually have a good idea what they're about. Compare: Microsoft Paint vs GIMP
C) Apparently they actually are the same thing, they just discontinued the Mac line:Connectix Virtual PC, Microsoft Virtual PC 2004, Microsoft Virtual PC 2007, and Windows Virtual PC are successive versions of the same software.
-
@Dreikin said in 16-bit console applications on 64-bit Windows:
Compare: Microsoft Paint vs GIMP
Which one involves more pain?
-
@cheong said in 16-bit console applications on 64-bit Windows:
@anotherusername said in 16-bit console applications on 64-bit Windows:
@blakeyrat said in 16-bit console applications on 64-bit Windows:
XP Mode is a VM that runs in an emulator.
Wrong. Windows Virtual PC is virtualization, not emulation. It won't run at all on machines that don't do hardware virtualization.
FYI, from Ben Armstrong's blog, Windows Virtual PC no longer require VT-D to run and therefore can be run on older machines.
Interesting. If I had to guess, they're still doing something more like virtualization than like emulation.
@powerlord said in 16-bit console applications on 64-bit Windows:
Ooh, ooh, are you also going to tell me that Microsoft Virtual PC 2007 for Windows XP and Windows Virtual PC for Windows 7 are unrelated products despite them having almost identical UIs and features?
I'd be happy to tell you that Windows NT 3.1 and Windows 3.1 are completely different products.
@Dreikin said in 16-bit console applications on 64-bit Windows:
Apparently they actually are the same thing, they just discontinued the Mac line
Still, they're two completely different products. At the very lowest level, the processor, one is virtualizing and the other emulates.
-
@anotherusername I already told you, Microsoft bought the product. Which was an emulator. Which I owned back in the day on PowerPC and used to run Windows 98.
-
@anotherusername Is it even possible to virtualize 16-bit CPU instructions (at least enough needed to run applications) when the CPU's in 64-bit mode? My understanding from an old Raymond Chen blog is that no it's not; when in 64-bit mode the CPU literally cannot run the 16-bit instructions required, which is why Microsoft broke compatibility in the first place. They didn't do it on a whim.
Now how would a product get past that hardware limitation? Hm! Well, maybe if it were an emulator and not a virtualizer, it could manage it.
-
@Gurth said in 16-bit console applications on 64-bit Windows:
What people pick up on is not the cruft like “Windows” and “for Mac” but the “Virtual PC” bit. TRWTF here is giving different programs almost the same name — but not unexpected, given Microsoft’s history of coming up with imaginative names like this.
I'm still pissed that I ordered a Microsoft Surface and got some iPad wannabe instead of a cool 30" touchscreen table!
-
@blakeyrat said in 16-bit console applications on 64-bit Windows:
@anotherusername Is it even possible to virtualize 16-bit CPU instructions (at least enough needed to run applications) when the CPU's in 64-bit mode? My understanding from an old Raymond Chen blog is that no it's not; when in 64-bit mode the CPU literally cannot run the 16-bit instructions required, which is why Microsoft broke compatibility in the first place. They didn't do it on a whim.
Now how would a product get past that hardware limitation? Hm! Well, maybe if it were an emulator and not a virtualizer, it could manage it.
That's my understanding as well. x86 processors are literally incapable of executing 16-bit instructions if they're in 64-bit mode, without using hardware virtualization features.
The DOSBox guys need to get their act together and get Win95/Win98 support 100% working.
-
Foxpro... we have databases that do things the Foxpro way, but from some third party, that we still maintain the code for...
...ugh.
-
@mott555 said in 16-bit console applications on 64-bit Windows:
@blakeyrat said in 16-bit console applications on 64-bit Windows:
@anotherusername Is it even possible to virtualize 16-bit CPU instructions (at least enough needed to run applications) when the CPU's in 64-bit mode? My understanding from an old Raymond Chen blog is that no it's not; when in 64-bit mode the CPU literally cannot run the 16-bit instructions required, which is why Microsoft broke compatibility in the first place. They didn't do it on a whim.
Now how would a product get past that hardware limitation? Hm! Well, maybe if it were an emulator and not a virtualizer, it could manage it.
That's my understanding as well. x86 processors are literally incapable of executing 16-bit instructions if they're in 64-bit mode, without using hardware virtualization features.
The DOSBox guys need to get their act together and get Win95/Win98 support 100% working.
It's a bit more complicated than that. I'm going to note in advance its been several years since the last time I did assembly on x86_64, so I might be wrong, but the short version is you can execute 16-bit instructions* when in long mode as well as reference AL/AH, etc. The problem is you can't trap calls to legacy BIOS emulates from long mode (or from protected mode either) nor can you use selectors when in long mode. For those who haven't done real mode programming, x86_16 doesn't have a flat memory model, you have to use segments and there are special registers (CS, DS, etc) to work with this.
When you're in protected mode, you can use V8086 mode which lets you use 16-bit selectors which makes the whole thing go as well as trap calls out to BIOS.
The point I was trying to make is that NTVDM (the magic thing that makes DOS emulation work) existed on NT Alpha. I believe it was also there for NT MIPS and PowerPC. Microsoft had already solved the problem of running 16-bit code (and 32-bit (FX!32)). I can understand it being too much effort to want to support it but there is a depressing amount of legacy 16-bit code out there in the wild :/
-
- Pre-preemptive clarification - you can use 16-bit sizes. The opcodes are different between real mode (16-bit), protected mode (32-bit), and long mode (64-bit) because the register encoding changed. Without V8086 mode, you can't use pure 16-bit instructions either in 32-bit mode (this was a RL problem with the 80286 and the original Protected Mode).
-
-
@Magus said in 16-bit console applications on 64-bit Windows:
Foxpro... we have databases that do things the Foxpro way, but from some third party, that we still maintain the code for...
...ugh.
SQLWindows, is that you?
If so, I feel sorry for you.
-
@cheong We don't have sql. You should feel more sorry for us.
-
@mott555 said in 16-bit console applications on 64-bit Windows:
I ordered a Microsoft Surface and got some iPad wannabe instead of a cool 30" touchscreen table!
Holy crap someone else remembers that?!
-
@Tsaukpaetra We had one at a previous job in the break room. It was an interesting concept, but I never spent much time playing with it.
-
@mott555 said in 16-bit console applications on 64-bit Windows:
The DOSBox guys need to get their act together and get Win95/Win98 support 100% working.
Is there a pressing need? I know from experience that those install and run fine in both VirtualBox and Parallels.
-
@Dreikin said in 16-bit console applications on 64-bit Windows:
A) Virtual PC wasn't named by Microsoft - they bought it from Connectix.
They didn’t change it either, but I suppose that might be because the name fits in pretty well with Microsoft’s naming conventions.
B‍) These unimaginative names have one great benefit: you usually have a good idea what they're about. Compare: Microsoft Paint vs GIMP
Well, I’d guess that the latter is an image manipulation program … the former — a tube of paint?
-
@Gurth said in 16-bit console applications on 64-bit Windows:
Well, I’d guess that the latter is an image manipulation program
You haven't watched the same movies 90% of Americans have.
-
@blakeyrat said in 16-bit console applications on 64-bit Windows:
You haven't watched the same movies 90% of Americans have.
Damn, I'm in the lower 10% again...