Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


CE 6.5 bugs
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9, 10
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 942

PostPosted: Tue Apr 19, 2016 12:07 pm    Post subject: registerAssembler bug? Reply with quote

These also applied to ce 6.4.

It seems there is a bug in the address parameter received by the registered custom assembler lua function.
Code:
registerAssembler(function(address, instruction):bytetable)


The following generated by the attached ct, which have a simple 'assembler' function registered, just to print the received address and instruction parameters.
It run with different target, the 32-bit mono target allow allocating memory in 2G+ range.

Code:
== 32-bit normal target ==      == 64-bit target ==                     == 32-bit mono target ==
0:( ) <mov  eax,1111>           0:( ) <mov  eax,1111>                   0:( ) <mov  eax,1111>
-- snip --
0:( ) <jmp  00000000>           0:( ) <jmp  ffffffffffffffff>           0:( ) <jmp  00000000>
7EF61100:(+) <mov  eax,1111>    FFFFFFFF90001100:(-) <mov  eax,1111>    FFFFFFFF90001100:(-) <mov  eax,1111>
7EF61105:(+) <call 029E0000>    FFFFFFFF90001105:(-) <call 06420000>    FFFFFFFF90001105:(-) <call 04F10000>
7EF6110A:(+) <jmp  7EF60000>    FFFFFFFF90001115:(-) <jmp  90000000>    FFFFFFFF9000110A:(-) <jmp  90000000>
29E2200:(+) <mov  eax,2222>     6422200:(+) <mov  eax,2222>             4F12200:(+) <mov  eax,2222>
29E2205:(+) <call 7EF60000>     6422205:(+) <call 90000000>             4F12205:(+) <call 90000000>
29E220A:(+) <jmp  029E0000>     6422215:(+) <jmp  06420000>             4F1220A:(+) <jmp  04F10000>
0:( ) <mov  eax,3333>           0:( ) <mov  eax,3333>                   0:( ) <mov  eax,3333>
0:( ) <jmp  00000000>           0:( ) <jmp  ffffffffffffffff>           0:( ) <jmp  00000000>
0:( ) <mov edi,edi>             0:( ) <jmp 777D1578>                    0:( ) <mov edi,edi>
7EF53300:(+) <mov  eax,3333>    FFFFFFFFFFFF3300:(-) <mov  eax,3333>    FFFFFFFFFFEC3300:(-) <mov  eax,3333>
7EF53305:(+) <jmp  7EF50000>    FFFFFFFFFFFF3305:(-) <jmp  7EFFFF0000>  FFFFFFFFFFEC3305:(-) <jmp  FFEC0000>
774410FF:(+) <mov edi,edi>      777D1570:(+) <jmp 777D1578>             774410FF:(+) <mov edi,edi>


The address with 0 is likely in syntaxcheck stage, some of these lines are snipped.

It can be seen that some address is of form 'ffffff...' which is 'negative', these make the registered assembler function not usable, or at least not reliable, for address higher that 2G+ range,ie. in some case, if the actual address in 64bit is 7f00001234, for example, it will truncated to be 1234 when sending to the lua assembler function.

This is in another 64bit target that show the truncation:
Code:
0:( ) <mov  eax,3333>
0:( ) <jmp  ffffffffffffffff>
3300:(+) <mov  eax,3333>
3305:(+) <jmp  7F00000000>


I checked the ce source, it seem the registered lua assembler function is connected to 'ExtraAssemblers' (@cheat-engine/Cheat Engine/Assemblerunit.pas, line 3377).
Would it be that the address is truncated to 32-bit in ExtraAssemblers, and sign-extended to 64bit in lua side?

Thank you~


ADDED:
Would it be possible that allowing the registered lua assembler function returning a table of zero bytes?
Currently it either return nil or a non-zero-length bytes table, for example, this force mgr.inz.Player's PADDING16 function http://forum.cheatengine.org/viewtopic.php?t=574426 must emit 16bytes nops in case of the address is already 16bytes aligned.



test_regAssm.CT
 Description:

Download
 Filename:  test_regAssm.CT
 Filesize:  1.74 KB
 Downloaded:  838 Time(s)


_________________
- Retarded.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Tue Apr 26, 2016 5:40 am    Post subject: Reply with quote

Sent pull request 69 ( lol Cool )
https://github.com/cheat-engine/cheat-engine/pull/69

Should fix this issue.

_________________
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Page 10 of 10

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites