Setting up Windows environment variables for DJGPP (& other GCC based compilers)

DJGPP & other compilers, such as EMX require that you set needed variables with a UNIX style slash convention.  Also it is a pain to hard code the entire path into a command shell.  I know this works on Windows 10, although I’m not sure about earlier versions.

The %cd% variable contains the current directory, so it makes it easy to do something like this:

@echo.
@set tmpdir=%cd%\tmp
@set path=%cd%\bin;%PATH%
@set C_INCLUDE_PATH=%cd%\include
@set _LIBRARY_PATH=%cd%\lib
@echo.
@echo finished.

Which is great, but of course all the paths are MS-DOS style.  There now is the ability to replace strings!

@set _tmpdir=%cd%\tmp
@set tmpdir=%_tmpdir:\=/%
@set _tmpdir=

So in this example I set a temporary variable to the MS-DOS style path, and then using the pattern :(match)=(replace) it will then replace \ with /, giving me the UNIX style path.  I then just set _tmpdir to nothing, unsetting the variable.  So this way I don’t have to hard code any paths, and I can flip the slashes as needed.

Another fun thing is you can do logic blocks..  A simple one if a file doesn’t exist then compile it:

IF NOT EXIST dhyrst. (
echo.
echo Executable missing attempting to compile….
@make -f makefile
echo.
)

I’m sure most people knew about this, but for an old guy used to doing things the hard way, it was nice to see that there finally was some way to do this kind of thing.

SQL Server 6.5 on Windows 10 x64

SQL Server 6.5 running on Windows 10

In the same effort as getting SQL Server 4.21a running on Windows 10, I found that SQL Server 6.5 will run as well.  For what it’s worth, SQL Server 6.0 runs, but the enterprise manger will not run, giving this fun error:

sdf

The SQLOLE OLE object could not be registered.

And SQL 7.0 just bombs out with this:

x

Your SQL Server installation is either corrupt or has been tampered with (unknown package id).

Which clearly means I’m missing something in trying to transplant settings.  However for some reason SQL 6.5 I can register the SQLOLE type, and boom!

SQL 6.5 in action

SQL Server 6.5 running on Windows 10

SQL Server 6.5 running on Windows 10

On Win64 vs Win32 and COM objects

I should mention that when registering a COM object you typically run something like this:

regsvr32.exe \mssql\binn\SQLOLE65.DLL

Which picks up the one in the default path.  What about system32?

%SYSTEMROOT%\system32\regsvr32.exe \mssql\binn\SQLOLE65.DLL

Well it turns out that this ‘system32’ directory is actually the 64bit system directory!  And attempting to do this will just result in the error:

64bit regsvr32 on a 32bit COM object

64bit regsvr32 on a 32bit COM object

The module was loaded but the call to DllRegisterServer failed with the code 0x80040005. Well great.  This typically goes back to a permissions issue, or the wrong regsvr32.exe being called.

However on a Win64 based OS, you actually need to specify the Win32 version of regsvr32 which actually lives in the SysWOW64 directory, and run the command prompt at administrator!  So you would run it like this:

%SYSTEMROOT%\SysWOW64\regsvr32.exe \mssql\binn\SQLOLE65.DLL

And you should get:

adf

32bit regsvr32 working

With this COM object registered, you can now launch the Enterprise manager!

Also I found a semi fun way to rename the SQL server:

sp_configure ‘allow updates’, 1
go
reconfigure with override
go
delete sysservers
go
sp_addserver YOURSERVERNAME,local
go
shutdown
go

Running this and it renamed the local SQL instance, and shut it down.  Restarting and it connected to itself just fine.  Naturally change YOURSERVERNAME to whatever your hostname is.  SQL server always wants to be called whatever the actual hostname is, otherwise things break in strange and confusing ways.

Thoughts

Is this terribly useful?  Probably not.  But I think it’s kind of interesting to run 90’s era server software in the 21st century.  Sure I wouldn’t want to run any of it in any type of production environment, but it shows at it’s core how Win32 has not drifted.  However looking at the Microsoft Management console of SQL Server 7.0, and how it will not either run on Windows 10, nor will the snapin run show just how fragile the house of COM turned out to be, and meanwhile good old fashioned Sybase/Win32  code still runs from 1993 onward.

I suppose the next thing to do is to try it on Wine, or a fun enough debugger/syscall trace to see what on earth SQL 7.0’s problem is.  I don’t have any doubt that it’s nothing that can’t be fixed, although back to the root point, would you really want SQL 7.0 in 2016… or even SQL 2000 for that matter.

SQL Server 4.21a on Windows 10 x64

SQL Server 4.21a!

SQL Server 4.21a!

It’s been 7 YEARS, since I last took the SQL Server 4.21a plunge by getting it running on Windows Vista.  I was thinking with all this Windows NT 3.1 fun, I should get SQL Server 4.21a up and running on my current Windows 10 machine.  However this proved more involved.

Unlike Windows Vista, the setupdll.dll from Windows NT 4.0 will not work.  I used the one from Windows NT 3.1, and it will run the setup program fine, but the file copy bombs out.  I went crazy and modified the setup.inf to not actually copy files, take an xcopy of the raw files from an old install, and it won’t even try to install the service, it just builds a master database, and exits.

Trying to run the SQL Server directly, and you get this fun error:

16/10/13 21:19:08.40 kernel   Unable to start due to invalid serial number.

Well isn’t that great.  So naturally you either have to install it, or just import an existing registry key setup like this SQL.REG file.

If you are so inclined, you can even remove named pipe support, and have it listen only on TCP/IP.  Or the other way around.  Or even change the TCP port.

In the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SQLServer\Server key there should be a Multi-String key called ListenOn … and it’s just the network transport DLL, and how they listen.  As you can see SSNMPNTW is the named pipe transport, and SSMSSOCN is the TCP/IP transport.

ListenOn key

ListenOn key

However it’s not terribly useful as it turns out that master database is actually empty.  So without stored procedures or much of anything you really can’t do anything with it.  However looking at the install directory there is a bunch of SQL scripts.  Even better on the VM where I’ve installed it, there is some output files, that by their date & time tell me in what order to run them!

First things first, I copy the following files from the C:\SQL\DLL diredctory to the C:\SQL\BINN directory so I don’t have to mess with paths:

NTWDBLIB.DLL
OPENDSNT.DLL
SQLEVENT.DLL
SQLTL32.DLL
SSNMPNTW.DLL
SSMSSOCN.DLL

Now I can run the SQL server from the C:\SQL\BINN directory

START SQLSERVR.EXE

And now it’s running.  If there is any issues, or your master database is either damaged, or just plain doesn’t exist, you can create one with the BLDMASTR.EXE program.

C:\sql\BINN>BLDMASTR.EXE
Buildmaster 4.20a NT : Wed Jan 26 12:37:00 1994

Master disk name? (default is master.dat) :

Master disk size (in 2k blocks)? (default is 6144) :

Configuration only? (default is N) (y or n) : n

Databases only? (default is N) (y or n) : n
Master device: master.dat
writing configuration area
writing the MASTER database
writing the MODEL database
writing allocation pages for remaining 7 MB, (3584 pages)
7 MB
Buildmaster complete

It’s that simple!  Move the master.dat file into the C:\SQL\DATA directory and if the server doesn’t find it by itself, you can just tell it where it’s located:

START SQLSERVR.EXE -d ..\DATA\master.dat

And it should start.

Now the file CONFIG.SQL needs to be modifed (if you have a prior config) or created.

The two key lines are:

update master.dbo.sysdevices set phyname=’C:\SQL\DATA\MASTER.DAT’ where name = ‘master’
sp_addserver YOURMACHINE,local

Which as you can imagine simply sets where the master database lives, and what the machine name is, as SQL server LOVES to know the correct machine name.  With that done, here is my simple script for populating the master database:

CHARSET.EXE /S . CP437\noaccent.437
isql -Usa -P < ..\INSTALL\INSTMSTR.SQL
isql -Usa -P < ..\INSTALL\INSTNT.SQL
isql -Usa -P < ..\INSTALL\INSTMODL.SQL
isql -Usa -P < ..\INSTALL\INSTCAT.SQL
isql -Usa -P < ..\INSTALL\CONFIG.SQL
isql -Usa -P < ..\INSTALL\INSTPUBS.SQL
isql -Usa -P < ..\INSTALL\ADMIN2.SQL
isql -Usa -P < ..\INSTALL\OBJECT2.SQL
isql -Usa -P < ..\INSTALL\HELPSQL.SQL

And once this has finished it will have populated all the tables in your master database.  Hit CTRL+C in the SQL Server window, and it’ll shut down. Re-launch it, and it’ll be initialized.

Assuming this all went according to plan, you can now launch SQLADMIN, the SQL Administrator, and then you can get a connect screen like this (I only got it running with the named pipes transport…)

SQL Admin connect

SQL Admin connect

Remember by default the sa user has no password!

SQL Administrator

SQL Administrator

And we are good to go!  Feel free to grab SP4, and apply it by unzipping, and copying the files & dll’s to their respective places.  So there we go, from January of 1994, to October of 2016, SQL Server still running!

MIDI Mayhem on Windows 10

So I know it’s ‘probably’ the super cheap generic USB to MIDI dongal I got on the cheap, but it just doesn’t work on Windows 10.

Using DOSBox, I get the following output when cycling between devices on the console:

MIDI:Opened device:win32
MIDI:win32 selected Microsoft GS Wavetable Synth
MIDI:Opened device:win32
MIDI:win32 selected USB2.0-MIDI
MIDI:Opened device:none
MIDI:win32 selected MIDIOUT2 (USB2.0-MIDI)
MIDI:Opened device:none

As you can see it clearly can see the USB device, but when it opens the device it fails. And yes I’ve tried Administrator.  And for the hell of it, I fire up Windows XP on VMWare, connect the USB dongal, and amazingly:

MIDI:Opened device:win32
MIDI:win32 selected USB Audio Device
MIDI:Opened device:win32
MIDI:win32 selected USB Audio Device [2]
MIDI:Opened device:win32
MIDI:win32 selected Microsoft GS Wavetable SW Synth
MIDI:Opened device:win32

Yes, I can open the out port just fine.  So now I run a virtualizer to run my emulator to drive a physical peripheral… Ugh.  Has MIDI been this messed up all along and I never noticed?

Oh yeah, the GS Wavetable Synth works fine, as did MUNT before I uninstalled it, thinking it was somehow interfering with anything.

I know I’m using this fine device, the QinHeng USB MIDI adapter, which apparently is notorious crap, but my recently acquired Yamaha MU 80, works fine with it on Windows XP.

QinHeng USB MIDI adapter

QinHeng USB MIDI adapter

Ugh.

Updated build of Linux 0.11 on Windows 10

Building & Running Linux

Building & Running Linux

I’ve updated my project for compiling Linux 0.11 on Windows 10.  In this version it builds a lot better with TDM MinGW 5.1.0 + MSYS.

The big improvements is that you can compile Linux without the full MinGW/MSYS install by running the ‘blind’ script which will compile the kernel without make and friends.

The build process for the kernel works as well so now with the included Qemu 0.12.5, no need to link under Linux anymore.  I fixed up some of the build processes as I thought I’d re-build and some stuff bombed so it’s all fixed up.

For those interested, I just updated the original download here:

MinGW-aout-linux-011.7z

Qemu 2.4.0.1 binaries for Windows

So here is my cross compiled Qemu binaries for Windows.

I added in my Control+Alt+d ‘fix’ to be a Control+Alt+Delete that anyone who runs Windows NT or MS-DOS will no doubt love.  The kbd_put_keycode function had been removed, so I also put that back in.

I also undid the weird scaling thing that has been around since version 1.1.  And I tried my best to merge in some NE2000 fixes.

Solaris 9

Solaris 9

I threw a Solaris 9 ISO at it, and it booted up to the text installer!

asd

MIPS ARC

The MIPS ARC firmware however always bombs out on reset with an Interrupt Controller Error.

I tried the ‘doom’ test, and installing DooM 1.1 took FOREVER.  Writing to the disk is slow. Incredibly slow. I guess forcing the write thru cache is mandatory?

-drive file=bla.disk,if=ide,index=0,media=disk,cache=writethrough

I haven’t tested.

Also DO NOT USE THE PCSPEAKER DEVICE.

I nearly went deaf.  It doesn’t work properly, but rather loops so that one beep turns into a hurricane of beeps.

I’ve included the needed DLL’s, and compiled everything I could statically.  I guess I could have fought more but I have other things to do.

So the ‘cut down’ version which is i386/x86_64 only is HERE.

Those who want to try out the various RISC processors download the ‘full’ package HERE.

Failure to upgrade to Windows 10

It’s been a bad hardware day for me, my MacBook Air that I bought in 2012 stopped working.  And it’ll cost at least half the price of a new one to fix it.  So instead of that I don’t want to spend that much right now so I picked up a cheap used Fujitsu laptop.  It had Windows 7 on it, which qualifies for Windows 10, so I figured I’d just use that free upgrade!

Wow that was a whole day shot by.  Although now that I’m posting this from Windows 10, it is much more faster and responsive than Windows 7.

The first big problem I had was that this laptop didn’t have *ANY* updates installed.  Service pack 1 for Windows 7 is required for the upgrade, and that is a 1GB download on it’s own!  Then after that, it demanded KB2952664 which wanted forever to install, so I said screw it and run the Windows update, which was 199 updates to go. So after all those hours, I’m finally ready to install Windows 10!

Au

I wanted an upgrade!

So during the install, about 25% of the way in, 83% copying files it suddenly reboots, and then starts to restore my prior copy of Windows.  Great, something failed.  Once back in Windows 7 I get this wonderful message:

I love these cryptic errors!

I love these cryptic errors!

0xc1900101 – 0x20004 The installation failed in the SAFE_OS phase with an error during the INSTALL_RECOVERY_ENVIRONMENT operation.

After trying more updates, defraging, it failed to upgrade another two times.  So I googled some more, and it turns out that a lot of people had laptops like this Fujitsu that were partitioned 50/50 and people would convert their disk from a basic MBR to a dynamic disk, so they could destroy the un-needed and wasteful D drive, and merge it into a nice C drive.  So what is the fix? UGH you have to convert the disk back to a basic disk with a normal MBR.  Except You can’t easily revert as you can convert.  So a bunch of more time wasted with a Windows Vista DVD that can read the disk, and an external drive let me copy windows off, redo the disk as MBR and restore Windows.

After all that drama the Windows 10 upgrade went without a hitch!

Bottom line, is that it’s probably easier to just buy a copy of Windows 10.  There is a utility to convert a dynamic disk to a basic disk, Partition Wizard Pro which costs $39.  Which is better towards a copy of 10.

Oh well it’s finally done.

Update review

Update review

Probably a bad time to ask.

Update to Windows 10

x

Get ready!

I know I’m crazy, but for some reason the update didn’t kick off automagically on my 7 box, so I fished around and found the direct download here.

From what I’ve read VMware Player 7 updates should work with 10.

Time to see what breaks, and what works!

The first issue I had is that after the upgrade, VMware Player couldn’t connect to the bridge adapters.  Luckily the fix is really easy.

Bring up your network connections, go to your physical Ethernet adapter, bring up it’s properties, and add in a ‘service’.

add

Restoring the VMware Bridge service

Then select the VMware Inc, vendor and the VMware Bridge Protocol.  Now with that done, all I had to do is then bind the bridge to the Ethernet adapter.

x

Configuring the Bridged virtual interface

And now my VM’s can talk to my network without any of that NAT nonsense.  And I didn’t have to re-install VMware Player to fix this either!

Some real fun came from upgrading my wife to 2015.  She uses Outlook 2013 to talk to an IMAP server.  No big deal right?  Well after upgrading when she tried to send an email she would get the ever so helpful error 0x800CCC13 .  So her server is setup to use SSL to talk to the outbound SMTP server.  It even has a valid certificate!  The best part is that verifying her account and IT WILL SEND THE TEST EMAIL.  Yes, that is right, Outlook 2013 cannot send to SMTP servers, but the test and diagnostics work.  And in the age of multigigabyte installations all the user is left with is a hexidecimal error code of 0x800CCC13.  Frankly this is totally inexcusable in 2015, let alone in the 1990s.  Hell even OS/2 had a system to look up cryptic error messages.  I guess that was an IBM thing.

So anyways, the best part is the ‘fix’.  Apparently according to here, the upgrade to Windows 10 corrupts some DLL’s that are a part of Outlook 2013, and they need to be repaired.  Simply run the following command as administrator:

sfc /scannow

It can take upwards of 10 minutes to complete.  After we ran this, we re-ran Outlook 2013, and all of our dozens of attempted test messages sent.

Another possible problem is that the Exchange server pluggin is interfering with the IMAP/SMTP plugins, and it needs to be disabled/deleted.  I haven’t had to go there since she can send emails now.