Cheating an application

I have con­tact with lots of dif­fer­ent soft­ware. How­ever yes­ter­day I came across an appli­ca­tion, that com­pletely blew my mind… in a neg­a­tive sense. This par­tic­u­lar appli­ca­tion uses its own cus­tom file for­mat, that is basi­cally zip, with spe­cial files and fold­ers inside, much like Open XML and Open Office file for­mats work. What's dif­fer­ent how­ever, is that it requires you to have WinZip installed in order for it to work. And by WinZip, I mean WinZip, not just some generic compressing/decompressing pro­gram that sup­ports zip for­mat. This thing is so ridicu­lous that I just don't know what to say. ANY soft­ware that requires the user to use some other spe­cific tool is bro­ken by design, but requir­ing your users to buy other com­mer­cial tool to do such basic thing as compression/decompression… it's just rude.

Well, any­way, as I really had no other choice but to use it, I decided not to give up and see how much it really needs actual WinZip. To do this I took invalu­able tool from Sys­In­ter­nals (now part of Microsoft) called Process Mon­i­tor. With it you can see how processes on your sys­tem inter­act with each other and with the sys­tem. So I set it up, ran the evil pro­gram, made it do its thing, and then I could ana­lyze what showed up in Process Monitor.

There were two impor­tant things to notice in the log:

  1. How the pro­gram iden­ti­fied WinZip's exeprocmon1
    When you install it, you have to point it to a direc­tory, where you have your WnZip installed. Impor­tant thing to see here, is 'fil­ter' attribute in Details col­umn. The way I under­stand it, it tells us, that the pro­gram was look­ing exactly for "winzip32.exe". So it seemed like it doesn't use WinZip's libraries, nor it's (if WinZip actu­ally has one) automa­tion model, but it just call winzip32.exe with com­mand line parameters.
  2. What are com­mand line para­me­ters it passes to WinZip32.exe
    procmon2 Few (hun­dred) lines below I found out answer, when I looked at com­mand line WinZip was actu­ally called with: –a –x 'path to where it wanted zip file to be saved' 'path to files it wants to com­press'. (it called WinZip in few other places, with other com­mands, like when extract­ing files, but the gen­eral way to do this stayed the same)

It seems, that WinZip's com­mand line para­me­ters are not pub­lic, but this lit­tle site, helped me with that. At this point, it looked like all this appli­ca­tion really needs, is a exe­cutable called winzip32.exe that sup­ports few of WinZip's com­mand line para­me­ters. All I needed to do, was to find one. Unfor­tu­nately, after check­ing out few free compression/decompression tools I wasn't any closer to the solu­tion, as none of them would inter­pret those para­me­ters the way WinZip does.

Then I decided to write my own using some free library. The actual code is not inter­est­ing, only inter­est­ing thing about it is that it was less than 30 LOC long and took me 15 min­utes to imple­ment (includ­ing time spent on learn­ing the library). Now, you can look at it from two per­spec­tives. One is, that with 30 lines of code, I saved my com­pany quite an amount of money, it would have to spend on sev­eral WinZip licenses. The other is, mak­ers of that tool required you to buy 3rd party tool to do some­thing that can be done in few lines of code. I won't com­ment on that…

Tech­no­rati Tags: ,
  • g mor­ley

    v/good