Category Archives: Windows

Microsoft Bugs

There is an old Disney urban legend that Walt Disney was cryogenically frozen and, when medical technology has evolved to cure his cancer, he will be thawed out and cured. In modern internet times, this tale really took off with Disney fans, leading to several books and even a movie:

The Further Adventures of Walt’s Frozen Head (2018) – IMDb

If I recall, my name is in the credits of that movie … because I backed it on Kickstarter or whatever fund raisingsite it was using at the time. ;-)

But I digress…

It has been claimed that Disney’s “ice princess” movie was released under the title Frozen so when people web search for “walt disney frozen” the search engines will return hits about the movie Frozen instead of the urban legend. “Ah! It’s a cover up! It must be true!”

And this is clearly not true, because if you web search for that, you get a bunch of front page results about the urban legend, well before you get to anything about the animated movie.

What Would Microsoft Do?

But this does give me an idea. Microsoft has released a number of games for Windows over the year, such as Microsoft Solitaire, Microsoft Freecell, Microsoft Minesweeper and Microsoft Pinball Arcade.

I propose Microsoft create a new game for Windows called “Bugs” — perhaps some modern update of Dung Beetles (known as Mega-Bug on the CoCo).

That way, when you web search “microsoft bugs” you get results about the game, and not about the frustrating thing that just got pushed to your PC in the latest Microsoft Windows Update.

Just a thought…

Until next time…

TIL how to build a PC .exe on my Mac, and RUN it on my Mac.

For reasons that are not important (or at least not interesting, or maybe both), tonight I was researching to see if I could build a PC .exe on a Mac. I asked Copilot, and it suggested I install the “MinGW” cross compiler tools.

Installing MinGW cross compiling tools on a Mac

Using brew, I typed:

brew install mingw-w64

Now that it was installed, to build a simple “hello world” program, I could start with this:

#include <stdio.h>

int main(void)
{
puts ("Hello, world!\");
return 0;
}

And from the directory where that file is located, I can type:

x86_64-w64-mingw32-gcc helloworld.c -o helloworld.exe

And thus…

allenh@Mac HelloWorldPC % ls
helloworld.c helloworld.exe

Neat. This might let me toy with some C source code to figure something out for work without having to get on my PC or run Windows on my Mac.

Then I wondered: could I run it?

Copilot said I could, if I had wine. That sounds like a great idea, but I was sure the AI was confused.

Wine Is Not Emulation

To install Wine, I needed to type this:

brew install --cask wine-stable

Away it went, but I noticed it told me (on my non-Intel Mac) that this would also require Rosetta 2, which is Apple’s Intel emulation layer they used early on when transitioning Macs from Intel to ARM processors. To get that, I did:

softwareupdate --install-rosetta --agree-to-license 

Well, that took no time at all, especially compared to how long MinGW and Wine took to install.

So what now?

Run, EXE! Run!

wine helloworld.exe

…though that did not get me too far, because security.

A quick visit to System Settings and Privacy & Security let me go here and throw caution to the wind…

Well, why not Open Anyway… A few clicks later and…

I’m bored. Let’s go ride bikes.

But first… I tried “winehello world.exe” again (though I had to change back to the directory where it was located).

Sometimes “the juice isn’t worth the squeeze,” and I know I am really late to the wine party, but I thought it was neat.

Until next time…

winget – like apt-get for Linux and brew for Mac?

I was today years old when I learned that winget is a thing for windows.

I powered up my ancient Lenovo ideapad FLEX 4 (so old, it cannot run Windows 11) today, and looked to see what updates where waiting. There were plenty in the Microsoft Store plus some in Windows Update. I only use this machine for running my vinyl cutter and laser engraver, so there is not much on it.

Due to the tiny SSD hard drive, I do have WinDirStat installed. It is a nice tool that will show you what is using up all your hard drive space.

I went to the WinDirStat website to look for updates:

WinDirStat – Downloads

My version was quite behind, so I was abouty to download the installer then I noticed this:

You may also install it with:

  • 📦 winget install -e –id WinDirStat.WinDirStat (or use winget upgrade subsequently)
  • 📦 scoop install extras/windirstat (requires scoop bucket add extras)
WinDirStat – Downloads

I am pretty sure I have used winget before to install some developer thing, but was unaware that it was used by other apps.

Typing “winget upgrade” showed me that it recognized several things on my PC:

C:\Users\alspl>winget upgrade
Name Id Version Available Source
-----------------------------------------------------------------------------------------------------------------------
WinMerge 2.16.18.0 x64 WinMerge.WinMerge 2.16.18.0 2.16.44.0 winget
Windows PC Health Check Microsoft.WindowsPCHealthCheck 3.6.2204.08001 3.7.2204.15001 winget
Microsoft ODBC Driver 17 for SQL Server Microsoft.msodbcsql.17 17.7.2.1 17.10.6.1 winget
Microsoft Visual Studio Code Microsoft.VisualStudioCode 1.91.1 1.96.4 winget
Visual Studio Community 2022 Microsoft.VisualStudio.2022.Community 17.4.1 17.12.3 winget
Dropbox Dropbox.Dropbox 216.4.4420 217.3.4243 winget
Google Chrome Google.Chrome.EXE 131.0.6778.267 132.0.6834.111 winget
Microsoft Visual C++ 2015-2022 Redistributa… Microsoft.VCRedist.2015+.x86 14.31.31103.0 14.42.34433.0 winget
Microsoft Visual C++ 2015-2022 Redistributa… Microsoft.VCRedist.2015+.x64 14.40.33810.0 14.42.34433.0 winget
Slack SlackTechnologies.Slack 4.39.93 4.42.115 winget
Lenovo Service Bridge Lenovo.ServiceBridge 5.0.2.9 5.0.2.17 winget
App Installer Microsoft.AppInstaller 1.23.1911.0 1.24.25200.0 winget
Dev Home Microsoft.DevHome 0.1900.687.0 0.1901.687.0 winget
13 upgrades available.

I tried “winget upgrade WinMerge.WinMerge” and saw it kick off and download the installer, then launch it. Very cool! It even has a spinning cursor while downloading :)

There is a “winget upgrade – all” option that should do all of them. The installers may pop up an authorization box you have to click on, so they are not fully automated, but still neat.

Did I do something on this computer years ago to install winget, or is it on any Windows 10/11 system just waiting to be used? Give “winget upgrade” a try on your PC and let me know if it works…

I have some upgrading to do.

Until next time…

Perforce to BitBucket Git migration – rename $File$ RCS keywords in source files

After migrating from Perforce to Git (BitBucket, in our case) at work, I learned that Git does not support any embedded source code keywords for replacement on check in. In our case, we use things like:

/*-------------------------------------------------------------------------------
 *      File Name: $File$
 *  Creation Date: $DateTime$
 *         Author: $Author$
 *       Revision: $Revision$
 *    Change List: $Change$

…and at the end of the files…

// End of $File$

On Submit, Perforce will replace those keywords with useful information, such as the username ($Author$) that did the submit, the data and time of the submit ($DateTime$) and the filename ($File$). I find this very useful when looking at source code outside of Perforce, since it tells me how new or old the code is. (Anyone who’s ever had to print out a ton of code for a group code review knows how easy it is to end up looking at the wrong version of the file… Usually not discovered until someone finds a bug you know you already fixed ;-)

Since Git does not support this, I wanted to at least search/replace “$File$” to be the actual filename of the source file. I am sure there are many ways to do this, but I ended up using a PowerShell script, based on code I found some web searches (probably on Stack Exchange or similar):

Get-ChildItem "*.h" -Recurse | ForEach-Object {
echo Processing: $_.FullName
$content = Get-Content $_.FullName
$newtext = ((Get-Content -path $_.FullName -Raw) -replace '\$File\$',$_.Name)
[system.io.file]::WriteAllText($_.FullName,$newtext)
}

In this case, this code specifically targets “.h” files at or below the directory you run the script in. I expect you can make a multi-filter that does .c and .h at one time, but I only needed to do this once so I ran it like this, then edited the “*.h” to be “*.c” and ran it again. (You’d change it to whatever your source file extensions are, like .cs or whatever.)

The [system.io.file] tip came from someone who noticed the other output would always add a blank line at the end of the file. This method re-writes the file as-is.

WARNING: I did notice that some files get messed up if they contain special characters. It would put some garbage (when viewing in a text editor) in place of things like weird apostrophes and such, so if you use this, make sure to diff your files before checking them back in and revert any goofs that “-replace” causes. I had to revert about one dozen blocks in my code.

I also had to run a command to grant my Windows 11 machine permission to even execute a PowerShell script.

Hope this helps someone else, and saves them a few hours of research…

Upgrade from Windows 11 Home to Windows 11 Pro using an old Windows key

I have a Windows laptop that came with Windows 10 Home. Unfortunately, Home is missing two features I wanted to use — Remote Desktop (so I could connect to this machine from elsewhere) and Bitlocker (so I can encrypt the hard drive). Those features require upgrading to Windows 10 Pro.

I was able to do the free upgrade to Windows 11 Home, but upgrading to Windows 11 Pro was a $99 charge in the Microsoft Store. That’s quite a bit of money for two minor features I wanted to use.

Fortunately, over on the Sub-Etha Software Facebook page, Jason D. had a solution.

“If you have an old key for Win 7 Pro, it should work. Seeing as how the system has an OEM key on it now, though, who knows… You could always just bite the bullet and upgrade, I had to do that on my Surface.”

– Jason D.

I recalled I had Windows 7 Pro in the past, which I ran on my Mac under the Parallels PC emulator. I looked through my old registration files and found my activation key for Windows 7 Pro. Using it, I was able to upgrade my Windows 11 Home version to Windows 11 Pro.

Thank you, Jason, for the great idea! I’d never run that old Windows 7 install again, so this was a great way to re-use a license I already paid for. (I also have a Windows 10 Pro license, but I have to keep that one for running it on my emulator.)

Hopefully Jason’s suggestion also helps someone else…

Until next time…