There is no malware here

First of all let me repeat it:

THERE ISN’T OR EVER WAS ANY MALWARE ON THIS SITE.

It was with great confusion that today I realized google had marked this website as malicious, it took me a while because I had the Security features on Chrome disabled on my machine.

Chrome Security Error when visiting madalien.com

I quickly begun looking into what had happened, worrying I might had been hacked without realizing, but it quickly become clear what was going on.

Google Security Issues Report showing UnSafeDiscX has the problem

A few days ago I had restored a download link UnSafeDiscX, scanning the file against virus total which Google owns and likely uses to judge if something is malware or not was  flagging unsafediscx as malware.

The truth is that the file in question isn’t malware, but a set of tools to bypass the old SafeDisc CD copy protection. Tools that I figured might still be useful to people trying to run safedisc games on modern Windows 10 which no longer supports the copy protection.

Some bad Anti Virus companies insist on incorrectly marking such tools as “generic malware” even though they’ve been around and used for over 15 years without problems. Regardless, I was left with no choice but to remove the link for the file from the front page and requested google to re examine my site in the hopes that it will be unblocked.

I’m saddened by this, big red warnings are scary and I’m sure a lot of people will now see bnetlauncher with suspicion, even though it had nothing to do with it and has it’s source code fully available. It’s also a sobering reminder of how much power Google has to simply remove a site from circulation, which somewhat leaves me worried for the future of the internet. 🙁

 

Origin and Uplay launchers

I’ve been getting some requests to do a launcher for Origin and Uplay games the same way I did for Blizzard so I figured I’d I’d make a post about it to let everyone know where I stand and possibly inform them of options they’ve been unaware.

Origin
There has been a lot of people smarter them me creating tools to make Origin users life easier. Stuff like Origin Requirement Remover which made Origin optional on games older then Battlefield 4, or for the Battlefield series the Battlelogium launcher which made using battlelog website much more present and less prone to headakes.

Has I don’t own anything more recent then Battlefield 4 all the games I own are already covered by those two great tools as such I wouldn’t have much to add to them.

Uplay
Unlike Origin, Uplay games still sell on steam, thus they pretty much work out of the box, just add them as a non-steam game and they will launch just fine with steam overlay. However there was one small nagging issue for me which was that Uplay itself did not close after I exited the game. I reckoned it wouldn’t bother anyone else so I just made a tiny launcher that just automatically closed Uplay window on exit for my use only.

Totally overkill and unnecessary (it just saves a single mouse click on game exit), but hey if you’re as annoyed as me you can grab noUplayNag and give it a go yourself.

TL/DR
In short, Uplay games are already fully steam compatible and there’s Origin tools to make it easier to start from steam, as such I won’t be doing anything for those two platforms.

bnetlauncher blunders

When I wrote bnetlauncher everything worked fine, I had been using it for days without any issues, so I figured why not release it in case someone else also found it useful?

But as feedback started to come in I realized that what I had created was utterly broken on other people’s computers! I felt shame and embarrassment on how I had managed to push so many blunders in such a tiny program.

As I pushed forwarded I decided to document my mistakes for future me and any one curious for the technical side of things.

What’s was going on?

When testing an application on your computer things are easy, you can press run on visual studio and step trough every instruction checking their result and effect. On someone else’s computer there’s no such thing. So I figured it would be good to have some sort of log file that would record debug messages as bnetlauncher ran trough it’s steps.

Has bug reports started to come in this proved invaluable, has it allowed me to see at what step of the process things where blowing up and gi what part s problem reports came in the first thing I ended up doing was implementing a Log file to try and give me a clue of what was going on.

Too slow to start

I keep my blizzard games on an SSD, further more I have 16gb of RAM and rarely shutdown my PC (i simply put it on standby). This meant that 99% when I launched the blizzard games I play they would already be cached and start “instantly” sadly though not everyone is running their games under the same conditions.

And for those people bnetlauncher was crashing most of the time, it was only when I used RAMMap to flush my file cache of memory with the game on a regular HDD did I manage to reproduce the issue myself, and after some debugging I realized what was going on.

The way bnetlauncher works is it tries to find the game the battle.net client started and copy it’s arguments. On my computer due to everything being cashed this worked fine, however on a non cached start the game would be found but it’s parameters wouldn’t be available yet which would just result in a crash 🙁

This was fixed by adding error catching code that simply keeps retrying to get the parameters until it succeeds.

Dude, where’s my files?

To my surprise I got reports that bnetlauncher simply did not work, Diablo 3 said it couldn’t find files, Hearthstone showed a black screen, what was going on?

Well the thing is I originally kept my bnetlauncher inside the game folder, only later moving it inside my steam folder this meant on Steam my “Start at” parameter was pointing to the game folder.

Notice the Start In is pointing to the game folder.
Notice the Start In is pointing to the game folder.

As it turns out blizzard games are quite trusting and take the “Start at” parameter as gospel when it comes to finding it’s files. So what was going on was that people leaving their “Start in” parameter unchanged (since they obviously had no idea) it would cause blizzard games to try and find their files in places where they where not.

I looked for a way to obtain the “CurrentDirectory” of another process and began to sweat when every place I looked kept telling me I would have to “inject a thread into the process to make calls in it’s context”. I value my battle.net account a lot and that sounded like something that could be miss interpreted by Blizzard’s anti-cheat systems.

So in the end the solution I picked was to just use the exe folder as the “Start in” parameter, which seems to work for all the games *fingers crossed*.

Launcher Inception

I suck at RTS games, I really do. So it’s only natural Starcraft 2 and Heroes of the Storm never held any appeal to me. Ironically those two proved to be somewhat unique in the way they start up. Even after all the bug fixes above those two where still not working.

Battle.net client launching Starcraft 2
Did I also mention battle.net is started by a launcher that starts a launcher that starts battle.net?

So I downloaded them and took a look at what they normally and this was what I saw:

Starcraft 2 had a launcher of it’s own! Comparing what bnetlauncher was doing and the battle.net client was doing I realised the diference.

battle.net client launched SC2Switcher_x64.exe which in turn launched SC2_x64.exe using it’s own directory as the SC2_x64.exe “Start in” parameter.

bnetlauncher just launched SC2_x64.exe and tried to launch it usin it’s own folder as “Start in” parameter, which simply did not work.

This made me realize a fundamental flaw in the logic of what bnetlauncher was doing, I was looking for the last started process instead of the very first.

So that was fixed and the code upgraded to handle closing a process and it’s children so it could properly close Hots and Sc2 (else you’d get a error 2:-2000).

Click me baby one more time

What would happen when you started two instances of bnetlauncher (be it by accident or on purpose)? As I found out a lot, and none of it good.

Games could get swaped, so the D3 shortcut would bet WoW and the WoW shortcut would D3 and even worse if battle.net client was launched trough bnetlauncher the second instance would simply hang as the first closed the battle.net client making it impossible to actually launch then second game.

So how to fix this issue, first thing I thought was to simply stop bnetlauncher from starting if another instance was already running. It worked but I felt I could do better!

So instead of simply exiting I decided to implement a “wait” system where each instance of bnetlauncher would simply wait for the previous instance to finish before starting it’s own thing with the last in line closing the client if the first one had to start it.

Do the way I decided to fix this it challenging one with me cursing Microsoft vague documentation on Named Mutexes and how they’re suppose to be used. Was this overkill? Probably, but maybe people playing hearthstone while they wait for their turn in WoW’s dungeon queue to pop up might appreciate the feature…

Playing it safe

All these issues left me somewhat paranoid so also ended up adding error checks, logging and crashing protection to almost every step of the process.

Now it may have a bit too much but it’s certainly better then having too little like before.

In conclusion

Hopefully the lesson is learned and I will try to avoid releasing anything without more serious testing. To those that tried bnetlauncher early I can only extend my deepest apologies for the trouble I’ve caused you.

Latest bnetlauncher can be download at it’s page.

Battle.net games under Steam

Ever since steam allowed to add non steam games to it that it become my gaming hub having all my games there ready to be launched.

However every big developer/publisher has it’s own launcher these days which means trying to use steam as a launcher doesn’t always work as intended.

I originally discovered a solution in a reddit post, it worked but felt very clunky so I fired up Visual Studio to see if I could do any better.

The result was bnetlauncher. While not the most elegant solution it does work. and makes adding current and future blizzard games to steam a lot easier.

Additionally I have also the full source code under GPL for those who take their security very seriously or are simply curious about what’s actually happening under the hood.

To use just add it as a non-steam game and put in the appropriate case sensitive code in front as a parameter like in the screenshot bellow.

Example bnetlauncher use

Downloads

Warning: The downloads below are outdated and buggy, please grab the current version from http://madalien.com/stuff/bnetlauncher/


bnetlauncher_v14.zip
bnetlauncher_v14_src.zip

bnetlauncher_v15b.zip (Beta version that should fix crashing issue)