track-o-bot icon indicating copy to clipboard operation
track-o-bot copied to clipboard

PE version detection broken for Hearthstone versions over 65535

Open stanczew opened this issue 5 years ago • 1 comments

After recent Hearthstone upgrade to version 19.0.0.66927, Track-o-Bot stopped correctly parsing version information:

DEBUG: Detected build: 1391
DEBUG: Download cards.json from: https://api.hearthstonejson.com/v1/1391/enUS/cards.json
INFO: Couldn't download card DB: https://api.hearthstonejson.com/v1/1391/enUS/cards.json. Maybe current HS version is too new.

Looking at PeVersionExtractor we see the following code:

version = ( fileinfo.Value.dwFileVersionLS >> 0 ) & 0xffff;

Version 66927 = 0x1056F, so masking it by 0xFFFF gives 0x56F = 1391.

I don't know what the purpose of this mask is/was. dwFileVersionLS field is declared as a dword, and version variable is an int, so the mask doesn't seem to be needed for anything. (Or maybe it should be changed to 0x7FFFFFFF, since dwFileVersionLS is unsigned while version is signed.)

With the mask removed, correct version is returned:

DEBUG: Detected build: 66927
DEBUG: Download cards.json from: https://api.hearthstonejson.com/v1/66927/enUS/cards.json
DEBUG: Downloaded cards.json 2594470 bytes

stanczew avatar Dec 03 '20 23:12 stanczew

Thanks for the feedback, i'll investigate

BOSSoNe0013 avatar Dec 10 '20 15:12 BOSSoNe0013