“warning: Invalid parameter passed to C runtime function.”

So while debugging Dynamips I got this fun message under GDB.  Of course it doesn’t tell you WHAT function did it, or HOW it was trying to do it.  Fantastic.

Thankfully Dennis Yurichev’s blog gave me the hint to put a breakpoint on ‘OutputDebugStringA’ and sure enough I could see Dynamips trying to treat a socket like a stdio file handle.  Something you can’t do in Win32 world.

On the plus side, I just had to do a small re-write of some functions and I can talk to the Dynamips hypervisor!  Idle and JIT are working too!  Along with WinPcap and UDP transports.

Dynamips on MinGW

It’s always bugged me that the only way to build Dynamips for Windows was with Cygwin.

Well fear no more, I’ve mashed an old version (I would have tried newer, but of course Cmake fails spectacularly and with zero help as always!) and not only does it compile, but it can boot a 7200 version of IOS.

Dynamips on MinGW

Dynamips on MinGW

JIT is broken.  You have to telnet into the console.  And the console is a little wonkey as I’m sure it’s doing a lot more UNIX translation vs being a Win32 program but it does work enough to login, save the config, and reload.

But it’ll crash on reload.

I’m sure it’s full of bugs actually.

https://sourceforge.net/projects/dynamips-mingw/

I started with Dynamips 0.2.8-RC7-community and started commenting out stuff to get it to compile.  Luckily I found this ezwinports that includes mairix that includes some memory mapping functions, namely mmap and munmap ported to Win32 in an early glibc port. While I was trying to integrate libuuid, I got this fun error:

mingw “error: conflicting types” “UUID”

MinGW includes UUID support, since it’s a Microsoft thing.  Unfortunately libuuid doesn’t include unique names,  so I had to rename uuid_t to uu_uuid_t

//typedef unsigned char uuid_t[16];
typedef unsigned char uu_uuid_t[16];

in the uuid.h header file, along with all instances in Dynamips.

I also borrowed sendmsg/recvmsg along with the msg structures from VLC.  inetaton.c from WSHelper, and finally telnet.h from NetBSD.

After that it was a matter of making sure Winsock starts up, and fixing some linking breakage.

For those who want to try, the binary package is here.  I’ll have to setup git on this machine and upload all the changes.  It shouldn’t require any DLL’s, although I haven’t looked at the pcap stuff, as I mentioned it’s largely untested, so I have no idea if any of it works other than the telnet console.

Dealing with Gmail’s attachment ‘security’

Blocked!

Blocked!

Ugh I’m sure I’m not the only one that has this issue.  So before google drive, and friends were a thing, gmail gave us 1GB of mail space (at the time why it was called ‘G’ mail).  And what better way to make files available between machines than to email them to yourself?

Well this worked for YEARS then they started to block some extensions, and now they block damned near everything.  From their ‘Learn more’

Some file types are blocked

As a security measure to prevent potential viruses, Gmail doesn’t allow you to send or receive executable files (such as files ending in .exe). Executable files can contain harmful code that might cause malicious software to download to your computer. In addition, Gmail doesn’t allow you to send or receive corrupted files, files that don’t work properly.

File types that can’t be sent or received

You can’t send or receive the following file types:

.ade, .adp, .bat, .chm, .cmd, .com, .cpl, .exe, .hta, .ins, .isp, .jar, .jse, .lib, .lnk, .mde, .msc, .msp, .mst, .pif, .scr, .sct, .shb, .sys, .vb, .vbe, .vbs, .vxd, .wsc, .wsf, .wsh

Messages containing the types of files listed above will be bounced back and returned to the sender automatically. Gmail won’t accept these file types even if they’re sent in a zipped format. Here are some examples of zipped formats:

.zip, .tar, .tgz, .taz, .z, .gz, .rar

Well isn’t that great.  Of course when I’m uploading source I tend to include executables, custom batch scripts to either clean or prepare, and sometimes run whatever it is I’m doing. Perhaps libraries, jar’s and maybe even device drivers.

Thinking the email attachment had been lost I was looking to see if I can forward it, when I stumbled onto this interesting bit:

show original

The show original option!

This lets you view the email in it’s un- formatted state, which also includes the attachments!

So from here it’s a simple matter of saving the file to your hard disk.  It is important that you ONLY save the base64 portion not that headers.  I guess this is a pain for multiple attachments as b64 doesn’t read MIME containers.

If you look at an email it’ll roughly look like this:

MIME-Version: 1.0
Received: by 10.64.9.141 with HTTP; Tue, 29 Oct 2012 13:33:16 -0700 (PDT)
Date: Tue, 29 Oct 2012 13:33:26 +0800
Delivered-To: [email protected]
Message-ID: <CA+rfG9Z-5Ej7iuXs36a_Lryqw+gs52GMUEFE9XPrSswjHRxXqw@mail.gmail.com>
Subject: doom?
From: Neozeed <[email protected]>
To: The Number One Guy <[email protected]>
Content-Type: multipart/mixed; boundary=001a11c3b874d1eaf704e9dde937

--001a11c3b874d1eaf704e9dde937
Content-Type: multipart/alternative; boundary=001a11c3b874d1eaf204e9dde935

--001a11c3b874d1eaf204e9dde935
Content-Type: text/plain; charset=ISO-8859-1

Don't lose this file!

--001a11c3b874d1eaf204e9dde935
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Don't lose this file! =A0<div><br></div>

--001a11c3b874d1eaf204e9dde935--
--001a11c3b874d1eaf704e9dde937
Content-Type: application/octet-stream; name="DOOM_SRC_102813.7Z"
Content-Disposition: attachment; filename="DOOM_SRC_102813.7Z"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_hncxub2b0

N3q8ryccAAPH+QLokKMEAAAAAAAkAAAAAAAAAKm3ezkABoLDcK0hSHl0xaeKFIsLY1Idc7MMQAtM
jDXWS9Sc5PvtvOmy27+byH8YZTOBY65JnEi5L9U41YDw53Wi1/xxpcR8Az8yIfc7DjQIT0ULtATL

We start the file at the ”

N3q8ryccAAPH+QLokKMEAAAAAAAkAAAAAAAAAKm3ezkABoLDcK0hSHl0xaeKFIsLY1Idc7MMQAtM

line.  I’m going to save it in notepad as “attachment.b64”

Now for the decoding!

I’m using b64, from sourceforge.  However you need an ‘older’ version 1.4 as the newer version has a decode bug.  Also

b64 -l76 -d attachment.b64 output.7z

And this will (blindly) decode the attachment.b64 into output.7z.  And from here you can extract the file without any issues.

As a bonus, if you have Outlook, you can just save the entire file as an .eml and open it in Outlook!

So easy!

So easy!

Also for Outlook 2003/2007 users you may have to use this registry alteration to have them support directly loading of .eml files.

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.

PCem networking update to build 335

Well after extensive testing of various CFLAGS settings it turns out that “-O2 -flto -ffast-math -mfpmath=387” gives the best overall settings for PCem.

So yeah me and leileilol went through a dozen+ iterations to arrive at this fun conclusion.

So I’ve only included 2 executables, a debug and the -O2 build.

You can download it here.

I haven’t made any changes to the networking code, and even with a LOT of fighting got OS/2 Warp 3.0 Connect to install.

Gopher

Gopher

Plus I fixed my gopher!

**EDIT

I made a mistake, and built both exe’s as debug.  I updated the archive, those who downloaded it, will want to do so again!

PCem networking update to build 334

You can download the build here: PCem-build-334-pcap-slirp.7z

This includes more different core binaries, and mostly fixes the NE2000 to no longer panic and fault out when something dumb tries to probe it, by writing the wrong values in the wrong places.

For the curious build 334 is right here.  We didn’t make the feature cut for version 10, so hopefully it’ll make 11.  I’ll provide an unofficial build once v10 is announced, along with hopefully better networking back end modules, expanding things from pcap & SLiRP.

Veritas in a Modern World

(this is a guest post by Tenox)

I used to use Veritas products (Volume Manager, File System and Cluster) professionally for quite a long time on Solaris and HP-UX. Except for Cluster, the software was exceptional for it’s time. Unfortunately after acquisition by Symantec and advancements of other storage technologies such as ZFS, the product suite disappeared from the radar completely.

Back to present time, I have a small x64 server that I use primarily as a NAS box plus run some applications, services and a few VMs. The machine runs Windows 2012 R2 Server which, for most parts I really like, with an exception of the storage stack, namely Storage Spaces. This is a completely botched feature both from functionality and management point of view. I don’t want to rant about it too much about it, so I just leave it as non working.

Unable work with Microsoft Bob of storage I have been looking for different alternatives, from using the Windows built-in VDS RAID-5 option, to moving entirely to a different OS. This is when I remembered that, some (OMFG!) 10 years ago Symantec has announced free Storage Foundation Basic, also available on Windows. Still continued and supported to this day, so obviously I wanted to give it a spin and evaluate whether it makes any sense to use such a dinosaur in a modern world.

I spun up a Windows 2012 R2 guest vm, added some data disks, downloaded the latest version 6.1 (released in 2014) from here and ran the installer.

sym1 Continue reading