Browsed by
Category: Windows

Steam Running in Windows Compatibility Mode

Steam Running in Windows Compatibility Mode

After a recent Steam update I started getting a warning about Windows Compatibility Mode. A quick check of both the shortcut and the executable itself revealed that no such setting was set. At first I was ignoring it as a fluke of Windows but it started screwing with my games… I need muh vida gumes!

The fix was simple, although annoying. Check the following regedit paths for the steam.exe executable. If you find any delete them and reboot.

  • HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
  • HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
  • HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Compatibility Assistant\Persisted

This fixed the issue for me. Good luck to you.

Shutting Down Windows 7 Without Installing Updates

Shutting Down Windows 7 Without Installing Updates

With the exception my gaming machine I have abandoned Windows. Still, however, I do some times deal with it.

One of the more common annoyances is trying to shutdown when Windows has downloaded, but not installed, updates. In this case Windows may take forever and a day to finally cut the power. If you need to go somewhere in a rush, this blows. If you are on a laptop and the battery is about to die you are better off with hibernation (which has to be enabled, takes up a decent amount of disk space, and has its own problems), putting the machine to sleep (which has its own problems), or just letting it die at the desktop. If you interrupt the update process– say, because it has been nearly 30 minutes– you risk explodeorizing your install.

There is an option built into Windows 7 that will allow you to add an ‘Install Updates And Shut Down’ in Shut Down Windows dialog box option. For some reason it is not enabled by default, but that is pretty easy to take care of:

  • Start, Run, enter gpedit.msc.
  • Surf over to User Configuration, Administrative Templates, Windows Components, Windows Update.
  • Edit Do not adjust default option to ‘Install Updates And Shut Down’ in Shut Down Windows dialog box to be Enabled. Make sure Do not display ‘Install Updates and Shut Down’ Option in Shut Down Windows dialog box is not set to Enabled.

The option will only appear when there are updates that need installing. You could also change your Windows Update settings but if you got here you probably are not interested in doing that.

I have not tested this with other versions of Windows. I assume this applies to Vista/Server 2008 and up but do not hold me to that.

Cross Compile Allegro 5 Programs in Linux for Windows

Cross Compile Allegro 5 Programs in Linux for Windows

The Allegro game programming library has released v5 of their popular library and with it comes a whole mess of great changes. Thing is, since most of the applications you make with it are going to be games, your main audience lives in Windows. Since I am really upset with Microsofts offerings in this area I needed a way to capture this audience without having to drive myself insane.

What follows is how I am making Windows executables in Linux using Allegro. Please note that I live in Ubuntu (currently 10.10, Maverick Meerkat). You may have to make some slight changes to fit your distro but that should not be a big deal. These instructions assume a clean installation where no other copy of Allegro has been installed (not sure if that would be a problem or not as I have not tested).

  1. Install the required programs:
    sudo apt-get install cmake mingw32
  2. Retrieve and uncompress DirectX:
    Download and copy the DirectX headers and libraries to /usr/i586-mingw32msvc/. Note the file structure within the archive should compare to the mentioned directory. When prompted to overwrite any files do so but make sure you have a backup first in case something explodes.
  3. Retrieve and uncompress Allegro 5:
    Download allegro-5.x.x.tar.gz from their site. Uncompress some place easy to get to. I used my desktop as we can delete this when done.
  4. Compile from source:
    In a terminal type
    cd [path to uncompressed archive] && mkdir build && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw.cmake .. && make && sudo make install
    This may take a little while depending on your hardware.

You should now have a functioning cross compiler setup for Allegro 5. Just replace gcc with i586-mingw32msvc-gcc or g++ with i586-mingw32msvc-g++ (for example, I compiled my first test with i586-mingw32msvc-g++ alleg.cpp -lallegro.dll -lallegro_image.dll -lallegro_font.dll -o alleg.exe). The DLLs you will need are in /usr/i586-mingw32msvc/bin/. You may now delete all of our working files on your desktop (or wherever you put them).

There are still one or two things I need to figure out. For one, dynamically linked programs are peachy on Linux; I am comfortable in my assumption that most people using Linux either already expect this or are willing to learn. Windows, not so much. I want to statically link for that platform but I have yet to experiment with that. Another thing is the fact that my current method has Windows opening up a console window in addition to the “main” window. I am sure this is also very simple but have not yet played with it.

Use GRUB2 to Boot ISOs off a Flash Drive

Use GRUB2 to Boot ISOs off a Flash Drive

I will soon need to build a few new PCs that do not have optical drives (one will be a firewall, for example). They do not need the drives for day-to-day usage but I do need to get an OS on them. Since virtually all consumer boards now have USB and I have piles of unused flash drives laying around I decided not to spend the money on an external drive and go the flash drive route.

Here are the steps I took to get my Linux ISOs to boot off a USB flash drive. For these exact steps to work you will need an existing Linux installation (a LiveCD will work just fine).

  1. Create a new, formatted partition big enough to store your ISOs. I am using EXT4 but any filesystem supported by GRUB2 will work. I prefer to use GParted for this.
  2. Mount your new partition. Most Linux desktop distributions will do this automatically for you if you just unplug the device and plug it back in.
  3. Install GRUB2: grub-install --force --no-floppy --root-directory=[path partition was mounted] /dev/sdX where X is the flash drive.
  4. Copy over any ISOs you want to be able to boot to the root of your new partition.
  5. Create [path partition was mounted]/boot/grub/grub.cfg and add the lines

    set timeout=5
    set default=0

  6. In [path partition was mounted]/boot/grub/grub.cfg add any of the following example entries for your favorite distributions:

    menuentry "Ubuntu 10.10 Desktop i386" {
    loopback loop /ubuntu-10.10-desktop-i386.iso
    linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/ubuntu-10.10-desktop-i386.iso noeject noprompt splash --
    initrd (loop)/casper/initrd.lz
    }

    menuentry "Ubuntu 10.10 Server i386" {
    loopback loop /ubuntu-10.10-server-i386.iso
    linux (loop)/install/vmlinuz boot=casper iso-scan/filename=/ubuntu-10.10-server-i386.iso noeject noprompt splash --
    initrd (loop)/install/initrd.gz
    }

    menuentry "Darik's Boot And Nuke" {
    loopback loop /dban-2.2.6_i586.iso
    linux (loop)/DBAN.BZI nuke="dwipe" iso-scan/filename=/dban-2.2.6_i586.iso silent --
    }

    menuentry "Memtest 86+" {
    linux16 /memtest86+.bin
    }

I could not, for the life of me, get any Windows ISOs to boot using GRUB2. On top of that I came across a number of people trying to do the same thing whom all failed. If anyone gets this working please post in the comments. I may be able to chainload into another boot loader but that is for another day.

[Source]

Update 2011.02.18
I found this. It may be nothing but it also may be a jumping off point from which to boot from a Windows ISO.

Update 2021.06.16
I finally figured out how to get the Windows installer to boot from a USB flash drive. Thank you to Doc in the comments for kicking me off in the right direction!

  1. First create an NTFS partition. I made mine a second 8GB partition which fit everything comfortably.
  2. Download the Windows 10 ISO from Microsoft. (I know it feels dirty but Microsoft is offering this for free and legit so why not take advantage?)
  3. Copy the entire contents of this ISO onto your new NTFS partition (not the ISO itself).
  4. Add the following to [path partition was mounted]/boot/grub/grub.cfg

    menuentry "Windows 10" {
    set root=(hd0,msdos2)
    insmod ntfs
    insmod chain
    ntldr /bootmgr
    }

Note the line set root=(hd0,msdos2). msdos2 must be set to whichever partition you copied the Windows 10 files to (counting starts at 1, not 0). Also note this is still using MBR, not GPT/UEFI. Maybe I will update with that at a later date but it should not be too hard to figure out.

You will need to disable Secure Boot for any of this to work.

Apache 2.2 with SSL on Windows

Apache 2.2 with SSL on Windows

There are a few services I run that I need to access over the web that I do not want anyone watching (phpMyAdmin, for example). The simple solution is to encrypt this traffic with SSL certificates. Here is how I did it on Windows with Apache 2.2:

  • Install the latest Apache 2.2 with OpenSSL: http://httpd.apache.org/download.cgi.
  • Open the Command Prompt and browse to [apache 2.2 path]/bin.
  • Enter openssl req -config ../conf/openssl.cnf -new -out foo.csr -keyout foo.pem. Fill out this information the best you can but you can leave most of it blank. The most notable exceptions are the PEM Pass Phrase fields and the Common Name field (which should be the domain name you will use this certificate on). It is best that you leave the Challenge Password at the end blank.
  • Enter openssl rsa -in foo.pem -out foo.key. You will be asked to reenter the password you entered in the last step.
  • Enter openssl x509 -in foo.csr -out foo.crt -req -signkey foo.key -days 3650. You can replace 3560 with however long you want to certificate to be valid for.
  • You will now wind up with four files: foo.crt, foo.csr, foo.key, and foo.pem. At this point you really only need foo.crt and foo.key and may delete the other two (unless you want to sign more certificates later on).
  • Move your two remaining files somewhere safe (not any place where the web server will be able to serve them to clients).
  • Open [apache 2.2 path]/conf/httpd.conf in your favorite text editor. Uncomment out the line LoadModule ssl_module modules/mod_ssl.so.
  • Open [apache 2.2 path]/conf/extra/httpd-ssl.conf. Uncomment out the line Listen 443.
  • In Windows Explorer browse to [apache 2.2 path]/conf and open up the configuration for the site you want to SSL enable. Make sure you are setup to listen on port 443 if you are running a virtual host. Add the lines SSLEngine on, SSLCertificateFile "[foo.crt path]", and SSLCertificateKeyFile "[foo.key path]".
  • Restart Apache 2.2: net stop apache2.2 and net start apache2.2

Some notes:

  • Certificates can only be used for whole domains or virtual hosts as opposed to a single directory. However with some clever allows, denies, and redirects in your web root you can do just about anything.
  • Only one SSL connection per IP on the same server is allowed. This is by design within SSL.
  • These certificates are self-signed. That means that anyone who views your new secure site will most likely be greeted with a warning they must accept before continuing. You setup the certificates yourself so you know there is nothing fishy going on but they might not know that. If you want to avoid this you will have to put out the cash to Verisign or someone else who can offer the same service.
  • Check out the SSLCipherSuite and SSLCARevocationFile directives (which you will notice are missing in my instructions) to further lock down your site.
  • Remember that if you ever change your certificate in any way the client may need to remove their old certificate before they will be able to view the site again.
  • I generally replace foo with the domain name.
  • Since this was always meant as a quick-and-dirty howto you can find more information at the Apache site.
  • I am running Windows XP SP3, Apache 2.2.14, and the included OpenSSL 0.9.8k.
Tether Motorola Droid with Windows 7

Tether Motorola Droid with Windows 7

As a follow up to my Tether Motorola Droid with Ubuntu 9.10 and Ubuntu 10.04 article I have decided to post the steps for Windows 7.

  • Grab and install the latest Droid Drivers: http://www.motorola.com/Support/US-EN/Support-Homepage/Software_and_Drivers/USB-and-PC-Charging-Drivers/
  • Grab and install the latest OpenVPN: http://www.openvpn.net/index.php/open-source/downloads.html
  • Grab the latest Android SDK and extract it: http://developer.android.com/sdk/
  • Create a file called azilink.ovpn file and enter into it:

    dev tun
    route-method exe
    remote 127.0.0.1 41927 tcp-client
    ifconfig 192.168.56.2 192.168.56.1
    route 0.0.0.0 128.0.0.0
    route 128.0.0.0 128.0.0.0
    socket-flags TCP_NODELAY
    ping 10
    dhcp-option DNS 192.168.56.1

  • Create a file called azilink.bat and enter into it:

    "[path to android sdk]\tools\adb.exe" forward tcp:41927 tcp:41927
    openvpn "[path to azilink.ovpn]"

  • Set your Droid to debugging mode: Settings -> Applications -> Development -> USB debugging
  • Grab and install the latest Azilink .apk file onto your Droid: http://azilink.googlecode.com/ (This can be done by pointing the Droid’s web browser directly to the download link or loading it onto the SD card. Either way you may need to go to Settings -> Applications -> Unknown sources to allow it to be installed.)
  • Start up Azilink on your Droid and select Service active.
  • Right-click azilink.bat and select Run as Administrator.

If all these steps went well you should be able to access the Internet on your computer via Azilink’s tethering capabilities. Be sure to check out the About screen in the Azilink application on the Droid to see if any of that applies to you.

A few things worth mentioning:

  • This method does not require your Droid to be rooted.
  • I am under the impression that these steps will also work for Windows Vista but I can not confirm that.
  • I am under the impression that these steps will also work for Windows XP with the route-method exe line removed from azilink.ovpn but I can not confirm that.
  • I am running Droid firmware 2.1, OpenVPN 2.1.1, Azilink 2.0.2, and MotoConnect 4.6.0.