Utilities

A collection of tools that I developed while customizing the install of Windows 7 for the Lego Tivo. Most of these tools are fairly simple and straight-forward, however they save a lot of time when trying to perfect the install CD. Some are useful outside of this and could be used in a number of cases.

All of these are put into the public domain and come with no warranty. I would appreciate it if you gave me credit however.

The current programs are:



MinGW Unicode Support

I wished these programs to be as small as possible, have the minimal number of dependencies, and be compiled for 32 and 64 bit platforms. I turned to the MinGW project but quickly found out that it did not fully support Unicode programs (specifcally they did not support the Unicode main functions). I made wrappers for wmain / wWinMain so that MinGW could be used seamlessly with Unicode (WCHAR), regular (CHAR), or the ability to choose (TCHAR). The wrappers are provided below and the instructions for using them are in the files, you can also look at the programs I wrote for examples.

MinGW Unicode Main Wrapper (1.27 KB, updated 03/04/10)

MinGW Unicode GUI Main Wrapper (1.7 KB, updated 03/04/10)



BatchResourceUpdater

The BatchResourceUpdater (BRU) program automates extracting, updating, and removing of resources from PE files. It uses an XML file to describe all the actions it should perform, manipulates the files, saves them, and updates the checksum of the files. This program is not fully tested so backup all files first. However, I have seen no problems yet.

This meant to complement, not replace, programs such as ResourceHacker. BatchResourceUpdater provides you with no way of finding out which resources already exist and you can only view resources by extracting them. It does nothing special for string, menu, and dialog resource types. Instead you should use ResourceHacker to modify the resources, extract them, and then use BRU. Where BRU really shines is the automation - allowing you to 'instantly' apply resource changes if the binary changes (e.g. because of a Windows Update).

The program first attempts to use the built-in Windows API functions to update the resources (BeginUpdateResource, UpdateResource, and EndUpdateResoruce). If those fail (which they do quite often, e.g. explorer.exe) then it uses a PE file updating library that I made.

Features:

Future Features:

Need to clarify:

Features it will never have:

It is written in Visual C++ CLR and requires .Net 2.0. There is currently no 64-bit compiled version available (because I don't have a 64-bit CLR compiler). Requires Visual C++ 2008 Runtimes (download: x86 / x64). The PE file-modifying code and ICO/CUR manipulators are written in C++ and do not require any extra libraries.

BatchResourceUpdater (243.5 KB, updated 04/05/10)

Read Me (1.68 KB, updated 04/03/10)

Examples and Tests (22.66 MB, updated 04/03/10)

Source Code (98.44 KB, updated 04/05/10)



PEChecksum

Display and updates the checksum on PE files (EXE, DLL, OCX, SYS, DRV, MUI, ...). It works with 32 and 64 bit files. The checksum needs to be updated on critical Windows file if their resources (or other things) are changed. All command line arguments are treated as files to update checksums for. It is written in C.

PEChecksum (32-bit) (7.5 KB, updated 03/04/10)

PEChecksum (64-bit) (15.5 KB, updated 03/04/10)

PEChecksum Source Code (44.23 KB, updated 03/04/10)



img2bmp32

Converts many image formats (GIF, JPEG, PNG, TIFF, WMF, EMF, BMP, and ICO) to 32-bit BMP with am alpha channel. The alpha channel is pre-multiplied which is required for Windows BITMAP resources. Programs like GIMP don't do the pre-multiply step and cause the images to display very oddly when used. All command line arguments are treated as images to convert to BMP. The files are renamed to have the "bmp" extension. It is written in Visual C++ CLR and requires .Net 2.0. There is currently no 64-bit compiled version available (because I don't have a 64-bit CLR compiler). Requires Visual C++ 2008 Runtimes (download: x86 / x64).

Bug fixes:

img2bmp32 (35.5 KB, updated 03/29/10)

img2bmp32 Source Code (18.56 KB, updated 03/29/10)



xdel

Deletes files and folders even if you aren't allowed to. It even supports wildcard expressions. This is essentially TAKEOWN, ICACLS, then RD or DEL in succession, however this is much more reliable and stronger. DEL/RD fail to delete some files even if you have permisions and the file matching performed xdel is better, especially since TAKEOWN and ICACLS have broken wildcard pattern matching. Written in C. All command line arguments are treated as files, folders, or wildcard expressions to delete. Wildcard expressions automatically recurse into subfolders. The program reports the total number of files deleted and their combined size. You must have administator privileges to delete protected files and you may need to elevate.

Bug fixes:

xdel (32-bit) (16 KB, updated 03/14/10)

xdel (64-bit) (25 KB, updated 03/14/10)

xdel Source Code (36.18 KB, updated 03/14/10)



xrepl

Replaces files even if you aren't allowed to. The new file will be set to have the privileges and owner of the old file. This is roughly equivelent to "ICACLS /save", TAKEOWN, "ICACLS /grant F", COPY, "ICACLS /setowner", "ICACLS /restore". You must have administator privileges to replace protected files and you may need to elevate.

xrepl (32-bit) (8 KB, updated 03/14/10)

xrepl (64-bit) (15.5 KB, updated 03/14/10)

xrepl Source Code (12.39 KB, updated 03/14/10)



BitDifference

Compares two files byte-wise to see if they are the same. If the files are different sizes it checks the files up till the end of one of the files and reports any differences or which file is shorter. Written in C. Command line arguments are the two files to compare.

BitDifference (32-bit) (6.5 KB, updated 03/04/10)

BitDifference (64-bit) (14.5 KB, updated 03/04/10)

BitDifference Source Code (10.85 KB, updated 03/04/10)



DuplicateFileFinder

Quickly finds duplicate files on your computer. It does this by first iterating all files in the search paths. Any files that have unique filesizes are removed right away as they could have no duplicate. Then the partial MD5 hash is calculated for each file (a partial hash greatly speeds up the program for larger files and does not really increase the number of false matches). Then all files having the same hash are compared byte-wise to see if they are actually identical. Written in C. Command line arguments are the paths to search, if none are given this defaults to the Documents, Pictures, Music, and Videos folders for the current user. Saves all matches into a text file and displays progress in standard output.

Bug fixes:

DuplicateFileFinder (32-bit) (19.5 KB, updated 03/14/10)

DuplicateFileFinder (64-bit) (28.5 KB, updated 03/14/10)

DuplicateFileFinder Source Code (117.78 KB, updated 03/14/10)



hide

Runs a command-line completely hidden from view. This allows you to run batch files or command-line programs without the big black box showing up on the screen. The downside is if the program asks for input it will wait forever. Written in C. The command line is the entire command to run. To have support for input/output redirection you must invoke CMD like so:

  1. hide cmd /c dir >output.txt

hide (32-bit) (6.5 KB, updated 03/04/10)

hide (64-bit) (13.5 KB, updated 03/04/10)

hide Source Code (10.77 KB, updated 03/04/10)



FirstUXRes

Adapts the FirstUXRes animation (see Windows\System32\oobe\FirstUXRes.WIM in install.wim) during the first boot to have a different background. The default animation has a solid black background, and using an algorithm from GIMP to replace a color with alpha and places a new background is behind the animation. The animation is 340x68 pixels and is placed at 342x579 on top of FirstUXBackground.bmp that you provide (1024x768). To use this program you need to copy the area from 342x579 to 682x647 into a seperate image file (BMP, GIF, JPEG, PNG, TIFF, WMF, EMF, or ICO), then run this program like:

  1. FirstUXRes <new background> <folder with originals> <folder to save new animation files>
  2. FirstUXRes new-background.bmp originals out

It is written in Visual C++ CLR and requires .Net 2.0. There is currently no 64-bit compiled version available (because I don't have a 64-bit CLR compiler). Requires Visual C++ 2008 Runtimes (download: x86 / x64).

FirstUXRes (38.5 KB, updated 03/26/10)

FirstUXRes Source Code [includes original animation] (653.14 KB, updated 03/26/10)