From the code archives: Delphi and figuring out who I am

2 minute read article Leadership   Technology   Delphi   Pascal   CommandLine   CodeArchive   Wisdom Comments

As I’ve mentioned recently, I found a big stash of backup CDs that date back to 1998 (the oldest I’ve found so far). The backups contain full Visual SourceSafe repositories along with lots of zip files since I used to be religious about backing up my data. I’m still looking through more CDs, so I hope to find something prior to 1998.

For the record, I also can’t get into the VSS repositories right now because my Windows machine is down for maintenance (a CPU heat issue that I haven’t felt like dealing with). As soon as I can get Parallels to see my external hard drive, I might be able to do some spelunking, but for now, I’m just combing through some of the folders and zip files.

While I wrote a ton of Visual Basic Classic (2.0 through 6.0) back in the day for work, many of my side projects were written in Delphi. I loved Delphi. I loved Object Pascal. I loved the power of Delphi it gave me compared to Visual Basic. I loved being able to compile my apps down to a single .exe since Visual Basic had the big VBRuntime dependency. Shipping VB shareware sucked - remember, this was all before the high bandwidth connections we now love and enjoy. We downloaded on relatively slow modem connections, so the smaller an app was, the more likely it was to be downloaded.

I used it for side projects until the early 2000s, even writing a couple applications for clients with it. I finally put it away after the release of the .NET Framework in 2002 and haven’t really looked back.

Anyway, as I was digging, I found this nugget - part of a suite of command-line utilities I wrote to fill in some of the gaps with Windows 95+ and Windows NT. This was my attempt at a ‘whoami’ program. It’s not rocket surgery, but at the time, it was something I was proud of. BTW, the exe is 30kb, and I just confirmed that it runs with no problems on Windows 10/11.

Note: I redacted the original email address since it’s not around anymore.

program whoami32;
// Michael Eaton
// Nov 21, 1997

// Michael Eaton
// Jan 8, 1998
// Adding Version resource
{$R VerInfo.res}

uses sysutils,// standard functions
     windows; // api calls...

procedure show_header;
    writeln('whoami32 for Windows 95 and Windows NT, Version 1.0');
    writeln('Written by: Michael Eaton (***REDACTED***)');

// Retrieves the network name of the computer
function whoami : string;
var username : array[0..100] of char;
    di : longint;
    FillChar(username, SizeOf(username), #0);
    di := 255;
    GetUserName(username, dword(di));
    whoami := username;

// main program code...
	Writeln('I am: ' + whoami);

More code from the archives coming soon!

A seal indicating this page was written by a human