Need some help with the InGunz launcher

Joined
Dec 21, 2006
Messages
957
Reaction score
0
Thanks to some help from ThuGie, I got the InGunz launcher working for me for the most part. The only problem is, it download the updates EVERY time it runs.

I know why it's causing it, but can't fix it. It uses some weird checksum values in patch.xml and I can't figure out how they get those values. Gunz.exe makes a lot of references to CRC32, but when I tried the CRC32 values that didn't work, nor did converting the values from hex to decimal work. If anyone has any ideas, I'd greatly appreciate it.

Here's the link to the patch.xml InGunz uses if anyone wants to take a look at it.

 
well the checksum is ten digits long so it is not a crc32 value since they are only eight and definetly not a md5 or any other type of hash valuse since they are much bigger.

it looks more like a upc then a checksum =/.

will take some looking into to figure it out.
 
Upvote 0
What confused me though is that Gunz.exe makes a lot of references to CRC32, and when I convert the CRC32 from hex to dec, the NUMBER of digits is correct, but not the actual digits themselves. I'm pretty stumped on this. I've gotten everything else to work correctly, but until I can get these checksums to be correct, it'll download the updates each time it runs.
 
Upvote 0
are you sure that the crc32 value you had is the correct one, there are different ways to calculate a crc so you could have the wrong value to start with.

find a program called f-crc, it will give you the correct crc32 and md5 that maiet uses.
 
Upvote 0
I'm sure it's the correct CRC32 value. I tried several different programs, including the one you recommended, and none of them match up with the checksum in patch.xml

Maybe I'm going about it incorrectly. I'm finding the CRC32 value, then converting it from hex to base 10. Is that correct? It's giving the correct amount of digits, but not the correct values. And that's the only thing I've done so far that seems remotely close to what I should be getting.
 
Upvote 0
that sounds like it should what they are doing, but without further looking into it i cant give a definet answer.

i'll see what i can come up with in the next couple of days during what ever free time i can muster.
 
Upvote 0
To calculate the checksum you need to read 4 bytes blocks into integer, add everything to an acumulator and then add the file size.

Something like this (dirty code ahead):
Code:
          ifstream fs;
          fs.open("Gunz.exe");
          char c = fs.get();
          unsigned int fsize = 0;
          while ((fs.good()) && (!fs.eof())) {
            fs.putback(c);
            unsigned int var1 = fs.get();
            unsigned int var2 = fs.eof() ? 0 : fs.get();
            unsigned int var3 = fs.eof() ? 0 : fs.get();
            unsigned int var4 = fs.eof() ? 0 : fs.get();
            var4 = var4 << 24; // shift
            var3 = var3 << 16;
            var2 = var2 << 8;
            unsigned int dwVal = var4 | var3 | var2 | var1; // add'em all
            sum += dwVal;
            fsize += 4;
            c = fs.get();
          }
          sum += fsize;

I don't know a cleaner way to read 4 bytes (dword) into a unsigned integer in c++, but that works well. I already have a c++ code that generates a patch.xml file :-), I guess you can do it from scratch now, having this clue :P.

I found this by debugging the gunzlauncher.exe like 2 days with ollydbg, a real pain in the ass. Just finished an hour ago.

Give me some credits if you use it on a tutorial or something :P
 
Upvote 0
To calculate the checksum you need to read 4 bytes blocks into integer, add everything to an acumulator and then add the file size.

Something like this (dirty code ahead):
Code:
          ifstream fs;
          fs.open("Gunz.exe");
          char c = fs.get();
          unsigned int fsize = 0;
          while ((fs.good()) && (!fs.eof())) {
            fs.putback(c);
            unsigned int var1 = fs.get();
            unsigned int var2 = fs.eof() ? 0 : fs.get();
            unsigned int var3 = fs.eof() ? 0 : fs.get();
            unsigned int var4 = fs.eof() ? 0 : fs.get();
            var4 = var4 << 24; // shift
            var3 = var3 << 16;
            var2 = var2 << 8;
            unsigned int dwVal = var4 | var3 | var2 | var1; // add'em all
            sum += dwVal;
            fsize += 4;
            c = fs.get();
          }
          sum += fsize;
I don't know a cleaner way to read 4 bytes (dword) into a unsigned integer in c++, but that works well. I already have a c++ code that generates a patch.xml file :-), I guess you can do it from scratch now, having this clue :P.

I found this by debugging the gunzlauncher.exe like 2 days with ollydbg, a real pain in the ass. Just finished an hour ago.

Give me some credits if you use it on a tutorial or something :P

I'll try it out now. Thanks a LOT, I really appreciate it. And yes, when I make a tut I will credit you along with ThuGie.
 
Upvote 0
Ok, here you have something that you can blindly compile:

Code:
#include <iostream>
#include <fstream>

using namespace std;

int main() {
  ifstream fs;
  [b]fs.open("Gunz.exe", fstream::in | fstream::binary); // Line fixed after thread discussion, thanks.[/b]
  char c = fs.get();
  unsigned int fsize = 0;
  unsigned int sum = 0;
  while ((fs.good()) && (!fs.eof())) {
    fs.putback(c);
    unsigned int var1 = fs.get();
    unsigned int var2 = fs.eof() ? 0 : fs.get();
    unsigned int var3 = fs.eof() ? 0 : fs.get();
    unsigned int var4 = fs.eof() ? 0 : fs.get();
    var4 = var4 << 24; // shift
    var3 = var3 << 16;
    var2 = var2 << 8;
    unsigned int dwVal = var4 | var3 | var2 | var1; // add'em all
    sum += dwVal;
    fsize += 4;
    c = fs.get();
  }
  sum += fsize;
  cout << "Checksum for Gunz.exe is " << sum << endl;
}

If i run it i get:

Checksum for Gunz.exe is 3421498287

With Indian Gunz.exe, which is the right checksum if you look into the patch.xml file that the launcher downloads:

Code:
        <PATCHNODE file="./Gunz.exe">
                <SIZE>2478080</SIZE>
                <CHECKSUM>[b]3421498287[/b]</CHECKSUM>
        </PATCHNODE>

I also tested it with fmod.dll and others, and it always returns the correct checksum.

Now you should put that code into a function that receives the file name as a parameter, and generate XML with the result, for each file, to have a patch.xml generator.

I may post my generator later, I didn't do it yet because didn't have the time to research how to walk directories in Windows, opendir() seems to be only for *nix, so my current implementation reads from a "filenames.txt".. which is not nice enough for a public release :)

If it's generating long numbers, check your file size. The gunz.exe for my server is about 25mb, so it generates a big number, but if you pack the exe with UPX or some exe compressor, you will get a nice, tiny number.

EDIT:
About the shifts:

1 unsigned int = 4 bytes = 32 bits
So if you have:

A1 2E F3 01

In the exe file, you need to reverse it (to 01 F3 2E A1)

The shifts work like this:

In this statment:

int var1 = 0;

var1's value is 00 00 00 00

I read the first byte into var1, which gets 00 00 00 A1, note that i do not shift var1.

Then i read the second byte into var2, gets 00 00 00 2E, and shift it 8 bits (1 byte) to the left, which results in 00 00 2E 00.

Now, var3 gets 00 00 00 F3, and i shift it 2 bytes to the left: 00 F3 00 00

Finally, var4 gets 00 00 00 01, and i shift it 3 bytes to the left: 01 00 00 00.

Ok, now dwVal is bitwise OR between 00 00 00 A1 | 00 00 2E 00 | 00 F3 00 00 | 01 00 00 00 = 01 F3 2E A1, the value i needed :D.

So.. nothing wrong with the shift, and the code is working fine here. Just pack your exe with UPX, make it smaller, and you will get a tiny number.
 
Last edited:
Upvote 0
Well, almost.

Checksum for Gunz.exe is 1973853826

This is the regular Gunz.exe, since GunzLauncher does not update it. The others don't match, either.
 
Upvote 0
I got 3620098336 as the fmod.dll checksum, and yes it is 161280 bytes.

Oh, and when I said I got different values, it wasn't just for Gunz.exe, it was for every file I tried it on. All the values were different from the patch.xml
 
Upvote 0
Any chance of you uploading your exe? Since we're using the exact source you posted and getting much smaller numbers, something's not going right.
 
Upvote 0
Back