XP-compatible Manifest

Illustration

I got a report that one of my applications under Windows XP. It would just simply fail with “The application failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.

A bit deeper investigation into the Event Viewer discovered slightly different error description there “Syntax error in manifest or policy file "\QText.exe" on line 24. The element trustInfo appears as a child of element urn:schemas-microsoft-com:asm.v1^assembly which is not supported by this version of Windows.

Quick look into my manifest showed:

<trustInfo>
  <security>
    <requestedPrivileges>
      <requestedExecutionLevel level="asInvoker" uiAccess="false" />
    </requestedPrivileges>
  </security>
</trustInfo>

PPS: You can find schema at Microsoft’s MSDN.

On first glance everything looked proper but next one brought obvious error. I was missing namespace declaration. Quick-fix was to just add it:

<trustInfo **xmlns="urn:schemas-microsoft-com:asm.v2"**>
  <security>
    <requestedPrivileges>
      <requestedExecutionLevel level="asInvoker" uiAccess="false" />
    </requestedPrivileges>
  </security>
</trustInfo>

It was that easy.

I introduced this error some time ago when I was fixing high-DPI support. Manifest processing on anything higher than XP (e.g. even XP with some patches), is much more forgiving so this issue hasn’t appeared much in the wild.

It simply goes to show that even most simple changes you do for one OS version might impact other. There is no substitute for actual testing.

PS: Just for reference, here is manifest I usually use:

<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependency xmlns="urn:schemas-microsoft-com:asm.v2">
        <dependentAssembly>
            <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*" />
        </dependentAssembly>
    </dependency>
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
        <security>
            <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
                <requestedExecutionLevel level="asInvoker" uiAccess="false" />
            </requestedPrivileges>
        </security>
    </trustInfo>
    <application xmlns="urn:schemas-microsoft-com:asm.v3">
        <windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
            <dpiAware>true</dpiAware>
        </windowsSettings>
    </application>
    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
        <application>
            <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />
            <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
            <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
            <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
            <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
        </application>
    </compatibility>
</assembly>

[2018-08-16: Added Windows 10 GUID.]

Drive Letter Change

Illustration

I am quite obsessive about which drive gets which letter. I have a certain expectations and it is not uncommon to see me fiddle with drive letters again and again. I mean, if I want that USB drive to be mapped as R:, I will get it mapped there.

Unfortunately this always includes trip to Disk Management and slowly selecting appropriate path. Well, no need for this any more.

Nitpickers of the world, rejoice. My latest program, logically named Change Letter can do this just by right-clicking on a drive. If you have VHD Attach installed, you will not even get UAC prompt.

You can download both setup and zipped files on BitBucket.

A Bit of Blur

Illustration

First time you install Windows 8.1 on high-DPI monitor, you will see a lot of blurring. Built-in applications will be really clear but third party applications that looked nice in Windows 8 suddenly got uglier.

It is not that Windows got dumber with new version. They actually got much smarter and now they can scale content properly over multiple different monitors. That is, one monitor can be 96 dpi, other 120 dpi, and third one can be 200 dpi. And all will work nicely.

However, this comes at the cost of blurriness for applications that haven’t declared themselves as DPI aware. Adding this to manifest is relatively easy for an application developer but I will leave that story for some other time. Question here will be whether user can help himself to deal better with “broken” applications.

If you don’t care for proper scaling across multiple displays, you can just turn it off. Go to Control PanelAppearance and PersonalizationDisplay. There just select Let me choose one scaling level for all my displays and you will be greeted with old scaling settings. Select 125% and, after log off, all applications will look sharp again.

PS: Same manifest request (and associated blurring) was present in Windows 7 but Windows 8 relaxed check a bit (if your display was up to 125% scale). I am a bit disappointed with applications that don’t have it configured yet (e.g. Google Chrome).

Installing Windows 8.1 (Or 8) Without a Product Key

Illustration

One great feature Windows 7 was possibility to install them without needing a key. Instead of entering 25-digit key, you could just select skip and Windows would give you 30 days after install to setup everything before requiring valid product key.

I found this really useful during setup of a new machine when I would have multiple reinstalls while trying out various drivers and performing their troubleshooting. Only once I was perfectly satisfied with machine, I would activate it.

More than once I also used this feature to reproduce a bug in different OS language (e.g. German). Mind you, I did have keys for that particular version (MSDN subscription is a great thing) but I was regularly too lazy to look key up for a version that would essentially get installed and deleted within a day.

Thus I was really pissed off when I found that feature was missing in Windows 8. But I was wrong. Feature is still present in setup. Only now it requires some preparation first.

Very first step is to copy all files from Windows DVD. Assuming that you have your DVD at letter W: and that you want staging directory at C:\Windows81, this would be:

ROBOCOPY W:\ C:\Windows81 /MIR
…

Once copy operation has completed, we need to create ei.cfg in C:\Windows81\sources directory. In my case I wanted to specify Professional edition expecting retail key so I created file with following content:

[EditionID]
Professional
[Channel]
Retail
[VL]
0

Only thing missing is creating new ISO file that we can burn on DVD. While this is not strictly necessary if you are creating bootable USB, I find having pre-prepared image an useful step. If nothing else, it is easier to backup a single ISO file than over a writable USB.

For bootable image creation we need Windows Assessment and Deployment Kit (or Windows ADK) for desired Windows version. Since I wanted to adjust Windows 8.1, I downloaded Windows ADK for Windows 8.1 but Windows 8 ADK is also freely available. Only thing that you really need to install for this guide are Deployment Tools. All other stuff you can uncheck.

To create bootable ISO image, I enter cmd.exe and there execute:

CD "C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\x86\Oscdimg"

OSCDIMG.EXE -u1 -bC:\Windows81\boot\etfsboot.com C:\Windows81 D:\Windows81.iso
 OSCDIMG 2.56 CD-ROM and DVD-ROM Premastering Utility
 Copyright (C) Microsoft, 1993-2012. All rights reserved.
 Licensed only for producing Microsoft authorized content.
 Scanning source tree (2000 files in 803 directories)
 Scanning source tree complete (2094 files in 867 directories)
 Computing directory information complete
 Image file is 3984359424 bytes
 Writing 2094 files in 867 directories to D:\Windows81.iso
 100% complete
 Final image file is 3990419456 bytes
 Done.

This will create bootable Windows81.iso image in a root directory of your second drive. If you have a single drive, place file into a subdirectory. Otherwise file will be written in Virtual store (usually at %USERPROFILE%\AppData\Local\VirtualStore).

Finally we have image that will not ask you for key during install and it will allow you to skip key entry for 30 days. Just burn it to CD or make bootable USB and you are ready to go.

PS: This also means that you can use your Windows 8 key to activate Windows 8.1 after installation is done. While Windows 8 key won’t work during installation, it will work nicely once everything is fully installed.

PPS: If you omit EditionID from ei.cfg, you will get an option to select edition that you would like (Professional or Core).

PPPS: No, this is not a hack. Microsoft has it all documented (both ei.cfg and oscdimg.exe).

[2013-10-20: You can download ISO directly from Microsoft (see instructions at SuperSite).]

Setting Up Private Internet Access on CentOS 6.4

Illustration

I am a big fan of Private Internet Access. It gives you anonymous and secure connection to Internet. I personally value my privacy and thus I find such VPN service very valuable.

Under Windows and huge variety of alternate platforms (Android, iOS, Ubuntu, …) installation is very simple and it hardly ever fails. But some platforms don’t come with instructions. Unfortunately one of them is CentOS. Fortunately, setting it all up is not that hard.

First we can do the easy stuff. Download PIA’s OpenVPN configuration files and extract it to directory of your choice. I kept them in /home/MyUserName/pia.

Next easy step is setting up DNS resolving. For that we go to System, Preferences, Network Connections. Just click edit on connection you are using and go to IPv4 Settings tab. Change Method to Automatic (DHCP addresses only). Under DNS servers enter 209.222.18.222 209.222.18.218 (Private Internet Access DNS).

All other commands are to be executed in terminal and most of them require root privileges. It might be best if you just become root for a while:

su - root

CentOS repositories are not known for their extensive software collection. But we can always add a repository of our choice:

wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release-6-8.noarch.rpm

This repository has OpenVPN package that we need:

yum install openvpn

Next step is getting configuration in place (replace username and password with yours):

cp /home/MyUserName/pia/ca.crt /etc/openvpn/ca.crt
cp /home/MyUserName/pia/US\ Midwest.ovpn /etc/openvpn/client.conf
echo "auth-user-pass /etc/openvpn/login.pia" >> /etc/openvpn/client.conf
echo "username" > /etc/openvpn/login.pia
echo "password" >> /etc/openvpn/login.pia

Now we can test our connection (after we restart network in order to activate DNS changes):

service network restart
openvpn --config /etc/openvpn/client.conf

Assuming that this last step ended with Initialization Sequence Completed, we just need to verify whether this connection is actually used. I found whatismyipaddress.com quite helpful here. If you see some mid-west town on map, you are golden (assuming that you don’t actually live in US mid-west).

Now you can stop test connection via Ctrl+C in order to properly start it. In addition, you can specify it should start on each system startup:

service openvpn start
chkconfig openvpn on

And that is all.