Warcraft-III-Community-Edition/W3CE

EDITBOX BlzFrameGetText adds rubbish

Closed this issue · 2 comments

In 0.1.2 alpha using BlzFrameGetText onto a EditBox returns the text inside the editbox and addtional random rubbish. in the zip is an map in Lua mode (World Editor V1.31.1) which creates an editbox and a button to test this behaviour. The button is there to start the text reading, because in 0.1.2 alpha EDITBOX_ENTER is not supported.

The additional text changes with every try.

[21:23:58 ERR ] TriggerRegisterFrameEvent: Unsupported event EDITBOX_ENTER
[21:24:14 INF Lua] text print("Warcraft 3 is great")���?H
[21:24:17 INF Lua] text print("Warcraft 3 is great")�5�?�6�?�7�?�8�?�8�?�9�?�7�?�7�?�8�?�9�?�:�?�;�?�;�?!>�?#@�?$B�?&F(�?*M�?,O!?/R#?0U$?2W&?5Z)?6[)?7\*?8^+?9`-?:a.?:a.?;b/?<c0?=d0?=d0?>e1?>e1??f2??f2??f2??f2??f2?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3/@g3
@g3�@g3�@g3�Bi5�Dk7�ElCj6�Bi5�Ah4�Bi6',]" ????m?^?2\&=Ck6
[21:23:50 INF ] launcherDirectory: F:\Spiele\Warcraft III\W3CE-v0.1.2-alpha\
[21:23:50 INF ] Module: 00520000
[21:23:50 INF ] Version: 1.29.2.9231
[21:23:50 INF NatPuncher] Searching for NAT devices...
[21:23:50 INF MultiClientSupport] Main instance detected.
[21:23:50 INF MultiClientSupport] Name: Warcraft III Game Application
[21:23:50 INF NatPuncher] NAT Device located, stopping discovery.
[21:23:50 INF MultiClientSupport] Client Port: 6112
[21:23:50 FTL ] Unable to locate assembly: System.Net.Requests.resources, Version=6.0.0.0, Culture=de-DE, PublicKeyToken=b03f5f7f11d50a3a
[21:23:50 FTL ] Unable to locate assembly: System.Net.Requests.resources, Version=6.0.0.0, Culture=de, PublicKeyToken=b03f5f7f11d50a3a
[21:23:50 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)
[21:23:50 ERR NatPuncher] Port Mapping Exception.
Mono.Nat.MappingException: Unexpected error sending a message to the device
 ---> System.Net.WebException: Normalerweise darf jede Socketadresse (Protokoll, Netzwerkadresse oder Anschluss) nur jeweils einmal verwendet werden. (192.168.33.1:49000)
 ---> System.Net.Http.HttpRequestException: Normalerweise darf jede Socketadresse (Protokoll, Netzwerkadresse oder Anschluss) nur jeweils einmal verwendet werden. (192.168.33.1:49000)
 ---> System.Net.Sockets.SocketException (10048): Normalerweise darf jede Socketadresse (Protokoll, Netzwerkadresse oder Anschluss) nur jeweils einmal verwendet werden.
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|277_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
   at System.Net.HttpWebRequest.<>c__DisplayClass216_0.<<CreateHttpClient>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request)
   at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at System.Net.HttpWebRequest.SendRequest(Boolean async)
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.Net.WebRequest.<>c.<GetResponseAsync>b__68_2(IAsyncResult iar)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location ---
   at Mono.Nat.Upnp.UpnpNatDevice.SendMessageAsync(RequestMessage message)
   --- End of inner exception stack trace ---
   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)
[21:23:51 WRN ForceFrozenThrone] Preferred Game Version forced to The Frozen Throne.
[21:23:53 DBG ModificationLoader] Processing war3map.w3a version 2.
[21:23:53 WRN ModificationLoader] Map has unsupported modified object 'AIdg' - Ritual Dagger (Instant Heal).
[21:23:53 WRN ModificationLoader] Map has unsupported modified object 'Ahsb' - Sundering Blades.
[21:23:53 DBG ModificationLoader] Processing war3map.w3t version 2.
[21:23:57 DBG AssetLoader] Loaded SharedModels\NightElfBirth2.tga.
[21:23:57 DBG AssetLoader] Loaded SharedModels\grad2d.tga.
[21:23:57 DBG AssetLoader] Loaded SharedModels\RootsBuild.tga.
[21:23:58 ERR ] TriggerRegisterFrameEvent: Unsupported event EDITBOX_ENTER
[21:24:14 INF Lua] text print("Warcraft 3 is great")���?H
[21:24:17 INF Lua] text print("Warcraft 3 is great")�5�?�6�?�7�?�8�?�8�?�9�?�7�?�7�?�8�?�9�?�:�?�;�?�;�?!>�?#@�?$B�?&F(�?*M�?,O!?/R#?0U$?2W&?5Z)?6[)?7\*?8^+?9`-?:a.?:a.?;b/?<c0?=d0?=d0?>e1?>e1??f2??f2??f2??f2??f2?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3?@g3/@g3
@g3�@g3�@g3�Bi5�Dk7�ElCj6�Bi5�Ah4�Bi6',]" ????m?^?2\&=Ck6

EditBox Display Content.zip

Fixed for 0.1.3.

Turns out text was stored in a big buffer without null terminators. I located the size property and now it only reads as much as it needs.

image

hurray