Eric's Technical Outlet

Learning the hard way so you don't have to

Category Archives: Programming

WiX: Add Browse for File Capability to Installer

Do you want to add the ability for a user to browse for a file to your WiX installer project? The problem is fairly straightforward, and according to my searches, a lot of people have solved it. Unfortunately, no one seems to want to publish it. Here’s how I solved it.

Also, if you’re looking for a way to have an external custom action update a text box, that’s here, too.

Read more of this post

Advertisements

PowerShell: Determine if an EXE is 32- or 64-bit, and Other Tricks

So, I needed to find out if a particular EXE was 32-bit or 64-bit. I found a lot of articles pointing to downloadable tools to do this, but I didn’t want another every-three-months-or-so tool to lose track of. Then I found a few confusing articles that sort of talked about how to do it programmatically that mostly managed to not really say how to do it programmatically. I found my way to Microsoft’s documentation on the executable standard and just rolled my own. In the process, I tossed in a few little tricks to go beyond just determining bitness.

Read more of this post

Convert Visual Basic Form to PowerShell

Last Updated: v1.05, May 22, 2015

From time to time, I like to have my PowerShell scripts display a nice GUI. Often, I have a scheduled script with numerous configuration options, and I see no value in forcing any person who uses my scheduled script to have to decipher and retool the options when I can slap together a UI that builds the configuration file for them. That’s just one example of why you might want to have PowerShell generate a GUI. But, this post is not about the philosophy of using a GUI in PowerShell, or using PowerShell instead of a full application development environment. This is about the mechanics.

Read more of this post

Take Ownership of and Reset Registry Key Permissions with VB.Net

Windows programming has begun a trend away from using the registry to store application data. There are a lot of reasons for that, most of them are pretty good, and I have no intentions of debating them in this post. There are still plenty of valid reasons you might wish to use the registry. Unfortunately, the .Net Framework’s abstraction of the registry is nowhere near as robust as it is for other system objects, such as files and folders. The area that it’s most critically lacking is that the only thing you can do without an active handle to a registry key is open a handle to a registry key. Most of the time, that’s not a big deal. Any key you can’t open is probably a key you shouldn’t open. Then again, there are those few times that you need to open a key but can’t. This post is intended to show you how to do that in VB.Net. C# users should be able to read along without a lot of difficulty, although you’ll probably want to refer to PInvoke.net or a similar resource for the exact methods of calling the specified Windows API functions from within C#. Read more of this post