Warcraft-III-Community-Edition/W3CE

BlzGetAbilityStringLevelField crashs game

Closed this issue · 4 comments

I tried to get tooltip & extended tooltip of an ability with the ability SLF_field api, it crashes the game.
Display Ability Tooltip.zip

After that I also tested others ABILITY_SLF_ICON_NORMAL & ABILITY_SLF_MISSILE_ART, they did crash it aswell.

[21:30:33 INF ] launcherDirectory: F:\Spiele\Warcraft III\test2\
[21:30:33 INF ] Module: 00C50000
[21:30:33 INF ] Version: 0.1.0.0
[21:30:33 INF ] Game: 1.29.2.9231
[21:30:33 INF NatPuncher] Searching for NAT devices...
[21:30:33 INF MultiClientSupport] Main instance detected.
[21:30:33 INF NatPuncher] NAT Device located, stopping discovery.
[21:30:33 INF MultiClientSupport] Name: Warcraft III Game Application
[21:30:33 INF MultiClientSupport] Client Port: 6112
[21:30:33 FTL ] Unable to locate assembly: System.Net.Requests.resources, Version=6.0.0.0, Culture=de-DE, PublicKeyToken=b03f5f7f11d50a3a
[21:30:33 FTL ] Unable to locate assembly: System.Net.Requests.resources, Version=6.0.0.0, Culture=de, PublicKeyToken=b03f5f7f11d50a3a
[21:30:33 ERR NatPuncher] Port Mapping Exception.
Mono.Nat.MappingException: Error 403: Not available Action
   at Mono.Nat.Upnp.ResponseMessage.Decode(UpnpNatDevice device, String message)
   at Mono.Nat.Upnp.UpnpNatDevice.DecodeMessageFromResponse(Stream s, Int32 length)
   at Mono.Nat.Upnp.UpnpNatDevice.SendMessageAsync(RequestMessage message)
   at Mono.Nat.Upnp.UpnpNatDevice.CreatePortMapAsync(Mapping mapping)
   at Mono.Nat.NatDeviceExtensions.CreatePortMap(INatDevice device, Mapping mapping)
   at W3CE.NatPuncher.CreatePortMap(Mapping mapping) in C:\Users\David\Documents\W3CE Workspace\TestCompile\Launcher-dev\W3CE\NatPuncher.cs:line 194
[21:30:33 ERR NatPuncher] Port Mapping Exception.
Mono.Nat.MappingException: Error 403: Not available Action
   at Mono.Nat.Upnp.ResponseMessage.Decode(UpnpNatDevice device, String message)
   at Mono.Nat.Upnp.UpnpNatDevice.DecodeMessageFromResponse(Stream s, Int32 length)
   at Mono.Nat.Upnp.UpnpNatDevice.SendMessageAsync(RequestMessage message)
   at Mono.Nat.Upnp.UpnpNatDevice.CreatePortMapAsync(Mapping mapping)
   at Mono.Nat.NatDeviceExtensions.CreatePortMap(INatDevice device, Mapping mapping)
   at W3CE.NatPuncher.CreatePortMap(Mapping mapping) in C:\Users\David\Documents\W3CE Workspace\TestCompile\Launcher-dev\W3CE\NatPuncher.cs:line 194
[21:30:33 WRN ForceFrozenThrone] Preferred Game Version forced to The Frozen Throne.
Read String Level field atp1 level 0
[2024-01-27T20:30:38Z][..\source\main.cpp:690][INFO]: System Survey 2.3.1.44, Data Version 3, Git Revision v2.3.0.42-20-ge49c7e7, Copyright (C) 2013 Blizzard Entertainment. All rights reserved.
[2024-01-27T20:30:38Z][..\source\main.cpp:764][INFO]: Exit value: 0
[21:30:39 DBG ] === CALL STACK START ===
[21:30:39 DBG ] DBG-ADDR<0053FA72>("KERNELBASE.dll")
[21:30:39 DBG ] DBG-ADDR<004A3BAC>("coreclr.dll")
[21:30:39 DBG ] DBG-ADDR<004A3556>("coreclr.dll")

It seems to be an out of bounce exception.

I did some code tests and

 Console.WriteLine("Read String Level field "+ fieldId + " level "+level.Value);
 var a = ability->Data;
 Console.WriteLine("ability->Data");
 var b = ability->Data->UIDef;
 Console.WriteLine("ability->Data->UIDef");
 var c = ability->Data->UIDef->TextTooltipNormal;
 Console.WriteLine("ability->Data->UIDef->TextTooltipNormal");
 var cc = ability->Data->UIDef->TextTooltipNormal.Length;
 Console.WriteLine("Length "+cc);
 var d = ability->Data->UIDef->TextTooltipNormal.At(level)->ToString();
 Console.WriteLine("ability->Data->UIDef->TextTooltipNormal.At(level)->ToString()");
 var x = abilityStringLevelField(ability, level);
 Console.WriteLine("Read was success");

->

Read String Level field atp1 level 0
ability->Data
ability->Data->UIDef
ability->Data->UIDef->TextTooltipNormal
Length 0

ability->Data->UIDef->TextTooltipNormal.Length is 0

It might be something else. I know tested an integer field of UIDef ABILITY_IF_BUTTON_POSITION_NORMAL_Y. for Blizzard. it returned 0 (it should be 2).

writting on ABILITY_IF_BUTTON_POSITION_NORMAL_Y is at the wrong offset I think, + 0x10
As Blizzard has Y=2 that would be x54 but it wrote on x64
image

should be Fixed with StormString fixup #174