Saturday, April 14, 2018

Welcome back to Winfile.exe

Microsoft recently released the source code to that 1990 winning program winfile.exe.

You probably remember  (if you are old enough) that this is the program you used to navigate the Windows File System graphically in the early days of Microsoft Windows

Since early April 2018 Microsoft has released the source code here  so Marcus bravely thought, well can I compile it up then? 

The Winging
If you want to skip this preamble jump to the next action step.

So I don't want to pollute my workstation therefore I decided to test all this out on a Windows Virtual machine running inside VMware.

A:  Marcus and Agata now live in a rural British environment without access to the Infinite speed Broadband that we became accustomed to in Switzerland.

In fact our current connection is 4G and metered.

B: Due to Bandwidth, my Windows Server 2016 VMware image that I plan to use had not been updated in many months.  But I must update it before trying this Compile.

I have no idea if the proposed 64bit Server Windows environment is compatible with Visual Studio, but go ahead anyway

C: VM starts fine, but the flippin Networking is broken

I have to look at the dedicated Hardware Firewall that I use for this Virtual Machines, which is different to the other Firewalls that I use daily.

No obvious errors!

D: After an hour of fiddling find that I must have (software) disabled some of the interfaces to make sure this machine cannot talk to the Internet to stop it using my Metered Internet connection.

Reversed these steps and now have Internet.  Begin Windows 2016 update before the Application install.

E: VMware prints out a 'fatal' error that my 2016 Server virtual machine is out of disk space, whilst performing Microsoft Update.

I run all virtual machines I use 'reguarly' in a smallish PCIe connected M2 SSD.  Why? Because the disk bandwidth exceeds 2,000 MB/second,  whereas the main virtual machine Storage Area [of Development, Completed and Template VMs] sits on a spinning disk which can manage < 200 MB/sec.

Plan is to copy back 2 least used Linux Virtual machines from the SSD, liberate space, and retry the VMware write error

F: So whilst the 2016 server Virtual Machine is paused I have to start my File Synchonisation program syncback up.  Copy back the Virtual Machine Files, of about 80 GB.  Then I deleted these files from the SSD

G: Now with M2 Disk space freed I can retry the disk write error from VMware and successfully updated Windows 2016

H: Finally I can do a Virtual Machine Snapshot so that if anything goes wrong after this I can rollback to this point.

At last: We are ready to continue.

The Compile Steps

01  Code Download

I downloaded and unzipped the code from here placing it into C:\code\winfile

This is the free version of the main paid Professional or Enterprise IDE  (Integrated Development Environment)

03 Open the Downloaded Files

Initially tried to open the .vcxproj file with File, Open, Project, Solution.   

C:\code\winfile\src\Winfile.vcxproj : warning  : The build tools for Visual Studio 2015 (v140) cannot be found. To build using the Visual Studio 2017 (v141) build tools, either click the Project menu or right-click the solution, and then select "Retarget Solution". Install Visual Studio 2015 (v140) to build using the Visual Studio 2015 (v140) build tools.

This prompted a further 700 MB download and then asked me to upgrade the SDK.   I think I asked to re-target the project somewhere 

04 Compile It

I set the type to Release and 64 bit code

Experimented with Build Solution and then Clean Solution then Rebuild solution

 So with Release 64bit code selected  I got warnings not errors.   If you try this and get errors then fallback to 32bit code and release, and do a Build, Clean solution first.

I renamed by 32bit and 64 bit .exe executables  winfile32.exe and winfile64.exe

05 Run It

06 Analyse It
Being not just old skool, but prehistoric skool, I always keep a copy of SysInternals on my Workstation.   You can download it here .  Lets poke around the executables I made.

So yes,  both the 32 bit and 64bit versions of the program roll in at about 400 Kilobytes

My main sentiment is that I am simultaneously impressed yet equalled appalled that I am able to build a Windows 64bit program in 2018 with practically no knowledge about what on earth I am doing!

I looked at the original C code.  Yes, that looks so familiar. All those hundreds if not thousands of hours looking over and writing Hungarian Notation.  You are not forgotten :-)

  if (IsRemovableDrive(drive)) {

   // TODO: if directory in right pane, get that instead of directory in left pane

   GetSelectedDirectory(drive + 1, szDir);
   (LPARAM)(szDir + lstrlen(szDir)));

I also comment about the change at Microsoft which embraces good, young (not old) Open Source technologies and methodologies like GitHub.