How to deactivate (revoke) Far Cry 2

Far Cry 2 comes with a nasty copy protection. Actually, it’s more like a strict DRM variant that needs to be activated online and can only be used X times when not properly deactivating it.

You can manually revoke an activation without uninstalling the game by simply calling:

FarCry2.exe /revoke

Easy, huh? I’d prefer Ubisoft to not use any of these bugger DRM crap at all, but then again we all know the story of software piracy (note: pirates probably have a better version without this crap, so this whole thing is totally beyond the point anyway!).

Making the NX Client portable

NX is great. I’m deeply in love with it. Sometimes it’s acting like a real jerk, though. The NX Web Companion is installing a lot of crap into the active user’s profile. The NX client writes stuff in the active user’s profile. Both isn’t really convenient for me.

I prefer to have all my settings with me on a USB thumbdrive. So, in the spirit of PortableApps I’ll show you how to simply turn NX into a portable application.

First thing to do is installing NX client on a machine, if you have installed already – that’s fine. Copy the entire program folder to a new directory structure like NxClientPortable\App (I’ll follow the PortableApps schema here). In NxClientPortable create a new directory named “Data” and a batch file with the following contents:

@echo off
set USERPROFILE=%CD%\Data

App\nxclient.exe %*

reg delete /f /va "HKCU\Software\Cygnus Solutions"
reg delete /f /va "HKLM\Software\Cygnus Solutions"

That’s it. Start the batch file and you’ll be fine. No need for installations, no files in some stranger’s profile. Everything goes back to your thumbdrive neatly.

This example also demonstrates why batch still isn’t dead: The USERPROFILE variable will be changed just within the scope of our batch file, all other applications will still use the path specified in the “global” instance of the variable.

Making Cygwin portable

One of the very packages I always install when I have to work with Windows is Cygwin. Being able to use my beloved GNU tools really makes things easier. Often I don’t have the option to install it. I grieved a little bit about the fact that some problems could be solved with just 2 commands that were — of course — missing from Windows’ horrendous command prompt. So I snooped around and built the following batch that’ll start a full-blown Cygwin session from i.e. portable harddisk:

@echo off set PATH=%CD%bin;%CD%sbin;%CD%usrsbin;%PATH set HOME=%CD%homePortable mount -bfu %CD%/ / mount -bfu %CD%bin /usr/bin mount -bfu %CD%lib /usr/lib cd %HOME% bash ----login -i

Easy, huh? All you have to do to make it work is renaming your /home/Username to /home/Portable (or simply adjust the setting in the batch). Pretty neat stuff.

Windows Genuine Advantage Validation tool fails to install?

Well, well, well — Windows is full of shit sometimes.

So there’s this dreadful Windows Genuine Validation crap thing Microsoft pushes down your throat. Now, that’s fine as long as the crap works but sometimes it fails to install via Windows Update; consequently you can’t install any other updates at that time. Bummer.

But there’s a (relatively) easy way around it: Try to install the control (yes, it’s a dreadful ActiveX control) directly through Microsoft Genuine: On the site click “Validate Windows” and the control should install. After that you can continue to install Windows updates.

I hate it when companies try so hard to show it the evil software pirates and end up annoying the paying userbase only. Thanks a lot, Microsoft.

Copying User profiles while in use

I know it’s not a feasable way to do it but sometimes you can’t get around to copy a user profile while it’s still locked (think: Windows locks it even after the user logs out).

To copy such a pesky profile I use Hobocopy:

hobocopy /full /y /r “%HOMEDRIVE%\%HOMEPATH%” “C:\UserProfileBackup”

The program makes use of shadow copies to perform the process so the resulting file will still be locked but at least it was copied. This becomes quite useful when used in conjunction with, for instance, the portable version of CCleaner and it’s /AUTO switch.

Moving folders to the server side

Wow, the second Windows-related post today? Something horrible must be happening to me right now…

Anyway, you may know a situation like this: Many clients, one server and a terribly stubborn application that just wants to write into that one pesky folder on the local hard disk. Needless to say that thanks to your policies that won’t last a reboot.

So, how can we tame applications like that? People want their data to be available across the network, in a central location/database. If the application’s data is not transaction-dependant you’re in luck.

Unix-lovers know hard-, soft- and symlinks. Hardlinks are available on Windows XP as well, but the truly wonderful stuff comes in on Vista: You get the two other missing types.

That doesn’t mean that XP users are left in the cold, you can download the necessary tool from various sources on the net for free and give it a shot.

So, what is this mysterious tool? It comes with Vista and is called MKLINK. Just use it like this:

mklink /D "Damn local database folder" "\\SERVER\DatabaseFolder"

Yes, we can actually point to a UNC path and — given the client users have sufficient rights — will be able to browse the folder just like any other folder on your file system. That’s pretty sweet and incredibly useful for ol’ haggy applications.

Don’t forget that this operation (just like everything fun) requires elevated access to do!

Temporarily register fonts using a normal User account

As you may know Windows is quite stiff sometimes. You can’t add additional font directories like you’d do on Unix. Another stiffy problem is that Windows requires an elevated account for operations like installing/removing fonts from the system. That’s quite troublesome at times.

This is exactly when my little tool jumps in. With RegisterFont you can add a number of fonts to your font cache without using an elevated user account. The downside is that all the changes persist only ’till the next reboot; Windows will rebuild it’s cache and the changes will be lost.

Anyway, the archive contains a binary as well as the C# sourcecode to this small utility. Use it like that:

RegisterFont.exe add font1.ttf font2.ttf font3.ttf … font1000.ttf

Easy, huh? If you don’t want to add fonts but remove them, substitute the “add” parameter with “rem” and you’ll be set. I didn’t bother to link up to the MSDN entries explaining the API, this is just a quick and dirty tool I wrote because we were in need of a quick solution to a problem 🙂 .

Update 2010-08-27: dcpurton wrote a tool in C to accomplish the same goal but without the .net dependencies. Best of all: Sourcecode is also available 🙂 .

Mandatory profiles w/XP

Mandatory profiles are an ideal way of keeping a complete set of workstations in sync in regard of their visual appearance and settings.

One thing I was stuck at: Whenever I copied a profile and renamed the NTUSER.DAT to NTUSER.MAN the profile simply wouldn’t load the preferences from it, resulting in ugly window decorations, empty start menus etc. Why is that?

The reason lies in the permissions on HKCU. To circumvent this undesired effects you can use Computer -> Properties -> Advanced -> User Profiles -> Copy To… — and now comes the thing — before clicking OK also click the button on the bottom of the form to set permissions. I used DOMAIN\Everyone but as usual… results may vary.

This way it worked fine, though.
It’s a shame that this little click isn’t mentioned in 90% of the quick’n’dirty guides on the net, it really does make a difference.