.

DHCP test client

While trying to set up my home network, I was dismayed that there was no simple way to test the DHCP server. Snooping packets is limited to examining existing traffic.

DHCP test tools exist (DHCPing and dhquery), however both are outdated and don’t work with the latest versions of their requirements, and both won’t work on Windows.

I’ve written a simple DHCP “client” which can receive and decode broadcasted DHCP replies, as well as send out DHCP “discover” packets. The tool is cross-platform, and should work on Windows and major POSIX systems.

Source, Windows binaries.

64-bit CacheSet

SysInternals CacheSet has a limitation: it is unable to set a cache size larger than 4GB. This is due to the fact that it is a 32-bit application, and the respective API (NtSetSystemInformation) accepts new settings as a 32-bit byte count.

The solution: use the 64-bit API, which uses 64-bit integers. I’ve written a very simple 64-bit CacheSet-alike – just enter the desired cache size (in bytes). You can use the original CacheSet to check the new settings (just don’t hit “Apply”, or your settings might get clobbered).

Source, download.

KeyboardEmperor

If you use Windows and like speed, you may have heard of Keyboard King, a program that allows accelerating your keyboard repeat rate to over Windows’ maximum limit. However, if you did use Keyboard King, you probably ran into its shortcomings: the method it uses to accelerate the repeat rate is buggy, because the approach it uses is insufficient.

Enter KeyboardEmperor, a kernel-mode hack that changes the repeat rate value directly in Windows’ USB keyboard driver. Continue reading →

Fixing DirectMusic on some 64-bit Windows versions

If you’re getting error messages such as “No sound device detected. Sounds might not play.” or “Failed to create Direct Music Performance.” when running Game Maker games, the following may help you. Here’s what I did to fix them on my system:

  1. Download the DirectX redistributable
  2. Unpack it
  3. Unpack dxnt.cab
  4. In dmusic.inf, search and replace “HKCR,” with “HKCR,Wow6432Node\
  5. Install the edited dmusic.inf (from the right-click menu)
  6. Copy missing DLLs (dm*.dll) to %WINDIR%/SysWOW64.

That’s it! The same method could work for other DirectX components as well.

Referrer spam

I got tired of pesky referrer spambots junking up my logs, so I decided to find a way to get rid of them. Turns out, almost all referrer spam on my blog is generated with a small number of User-Agents:

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; Media Center PC 6.0; InfoPath.2; MS-RTC LM 8)
Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.2 (KHTML, like Gecko) Chrome/4.0.221.7 Safari/532.2
Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 8.50
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Opera/9.64(Windows NT 5.1; U; en) Presto/2.1.1
Mozilla/5.0 (X11; U; Linux i686; it-IT; rv:1.9.0.2) Gecko/2008092313 Ubuntu/9.25 (jaunty) Firefox/3.8
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.14) Gecko/2009082707 Firefox/3.0.14 (.NET CLR 3.5.30729)

All of these refer to outdated browsers, very rare configurations (the ones with non-English language codes), and genuinely fake UA strings.

Wikipedia Watchlist RSS

Wikipedia’s Watchlist has a RSS feed, which is a nice way to keep track changes on your watched articles. However, the RSS feed doesn’t seem to conform to the RSS standard, and confuses some feedreaders – notably, Opera M2.

Here’s a simple PHP script, which you can place on your website, that’ll fix the RSS feed. You’ll need to give it the URL to your RSS feed (which you can get by subscribing to your watchlist), since it contains your secret API key.

<?php
$rss_url = 'http://en.wikipedia.org/w/api.php'
	. '?action=feedwatchlist'
	. '&allrev=allrev'
	. '&hours=72'
	. '&wlowner=YOUR_USERNAME_HERE'
	. '&wltoken=YOUR_API_KEY_HERE'
	. '&feedformat=rss';
$feed = `wget -q -O - '$rss_url'`;
$rows = explode("\n", $feed);
header('Content-type: application/rss+xml');
foreach ($rows as $row)
{
	if (strpos($row, '<item>')!==false)
		$alldata = '';
	if (strpos($row, '<guid>')!==false)
		continue;
	$alldata .= $row;
	if (strpos($row, '</item>')!==false)
		$row = '<guid isPermaLink="false">' 
			. md5($alldata) 
			. "</guid>\n"
			. $row;
	echo $row . "\n";
}