• Welcome to Valhalla Legends Archive.
 

GetFileVersionInfo

Started by iago, January 23, 2006, 11:57 AM

Previous topic - Next topic

iago

Quote from: Skywing on January 29, 2006, 09:56 AM
Looks like BNLS has actually been using an older version of the War2BNE check files for a long time, so either nobody has ever tried War2BNE with BNLS or Battle.net doesn't bother to check the version/checksum for that product anymore if the version code is correct.

If you get a chance, let me know if the values BNLS sends are actually good on Battle.net - if not, I'll fix it.

As for War3, if you look at how CheckRevision is implemented...:

.text:10002A72                 call    VerQueryValueA
.text:10002A77                 test    eax, eax
.text:10002A79                 jz      short loc_10002AAF
.text:10002A7B                 mov     eax, [ebp+lpBuffer]
.text:10002A7E                 cmp     eax, ebx
.text:10002A80                 jz      short loc_10002AAF
.text:10002A82                 cmp     [ebp+puLen], 34h
.text:10002A86                 jb      short loc_10002AAF
.text:10002A88                 mov     ecx, [eax+VS_FIXEDFILEINFO.dwProductVersionMS]
.text:10002A8B                 xor     edx, edx
.text:10002A8D                 shr     ecx, 10h
.text:10002A90                 mov     dh, cl
.text:10002A92                 mov     ecx, [eax+VS_FIXEDFILEINFO.dwProductVersionLS]
.text:10002A95                 mov     dl, byte ptr [eax+VS_FIXEDFILEINFO.dwProductVersionMS]
.text:10002A98                 movzx   eax, byte ptr [eax+VS_FIXEDFILEINFO.dwProductVersionLS]
.text:10002A9C                 shr     ecx, 10h
.text:10002A9F                 movzx   ecx, cl
.text:10002AA2                 shl     edx, 8
.text:10002AA5                 or      edx, ecx
.text:10002AA7                 shl     edx, 8
.text:10002AAA                 or      edx, eax
.text:10002AAC                 mov     [ebp+A], edx


It does something like this:


unsigned char* buf; // allocated above
VS_FIXEDFILEINFO* info;
unsigned long size;
DWORD A;

if(VerQueryValueA(buf, "\\", (void**)&info, &size) && info && size >= sizeof(VS_FIXEDFILEINFO))
{
  A = ((info->dwProductVersionMS >> 16) << 8) & 0x000000FF;
  A |= (info->dwProductVersionMS) & 0x000000FF;
  A <<= 8;
  A |= (info->dwProductVersionLS >> 16) & 0x000000FF;
  A <<= 8;
  A |= (info->dwProductVersionLS) & 0x000000FF;
}


or perhaps cleaned up, the middle bit might look more like this:


DWORD A;

A = (info->dwProductVersionMS <<  8) & 0xFF000000 |
    (info->dwProductVersionMS << 16) & 0x00FF0000 |
    (info->dwProductVersionLS >>  8) & 0x0000FF00 |
    (info->dwProductVersionLS      ) & 00000000FF
    ;


Sure, I can test out BNLS.  I haven't hooked up versioning to the rest of my bot, though, so it'll take some time. 
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


iago

Whatever you're currently using on BNLS is working, but I suspect that you updated because I'm getting different information back today:

ix86 filename: IX86ver0.mpq
Value string: A=578106926 B=903338692 C=439132539 4 A=A+S B=B+C C=C^A A=A-B
** -> bnls: Warcraft II BNE.exe 11/10/01 17:10:00 712704, 0x02000200, 0xd4b47564

This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Skywing

Quote from: iago on January 29, 2006, 03:58 PM
Whatever you're currently using on BNLS is working, but I suspect that you updated because I'm getting different information back today:

ix86 filename: IX86ver0.mpq
Value string: A=578106926 B=903338692 C=439132539 4 A=A+S B=B+C C=C^A A=A-B
** -> bnls: Warcraft II BNE.exe 11/10/01 17:10:00 712704, 0x02000200, 0xd4b47564


No, I haven't altered the version check files since you tested.  W2BN has never had a 1.xx version (for the Battle.net edition anyway) so I assume the first time you must have requested the wrong product or something.  2.02 is not the latest though, the W2BN install I have on this computer has 2.021 (and the exe is not the same as the one on the computer that runs BNLS).  I suppose perhaps 2.021 is an optional upgrade or something (used the standalone patch and not the Battle.net patcher, because W2BN has a bug that makes it incompatible with having NX enabled by default and I was hoping the patch would fix it, which it didn't).

iago

Hmm, that's weird.  I'm sure I was getting 01 versions from BNLS, which was confusing me.  Maybe I was doing it locally and not realizing it. 

In any case, BNLS is working for War2.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*