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 


FIXED another bugs for reading and writing unicode strings.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Source
View previous topic :: View next topic  
Author Message
maplecheck
Expert Cheater
Reputation: 0

Joined: 22 Jan 2006
Posts: 139

PostPosted: Mon Feb 28, 2011 10:11 am    Post subject: FIXED another bugs for reading and writing unicode strings. Reply with quote

FIXED another bugs with CE6.0 for reading and writing unicode strings.

The lazarus using UTF8, so we can change it to ANSIstring, following me.

open memoryrecordunit.pas file.

add unit LCLProc

Code:
change currentValue type to ansistring;

currentValue:ansistring;

procedure TMemoryRecord.SetValue(v: string; isFreezer: boolean);
...
currentValue:=utf8toansi(v); 
...

      vtString:
      begin
        if extra.stringData.unicode then
          i:=UTF8Length(v)
        else
          i:=length(currentvalue);
        //x contains the max length in characters for the string
        if extra.stringData.length<i then
        begin
          extra.stringData.length:=i;
          freemem(buf);
          bufsize:=getbytesize;
          getmem(buf, bufsize);
        end;

        x:=bufsize;
        if extra.stringData.unicode then
          x:=bufsize div 2; //each character is 2 bytes so only half the size is available


        if Extra.stringData.ZeroTerminate then
           x:=min(i+1,x) //also copy the zero terminator
        else
           x:=min(i,x);


        tempsw:= currentvalue;

        //copy the string to the buffer

        for i:=0 to x-1 do
        begin
          if extra.stringData.unicode then
          begin
            wc[i]:=pwidechar(tempsw)[i];
          end
          else
          begin
            c[i]:=pchar(currentValue)[i];
          end;
        end;

        if extra.stringData.unicode then
          bufsize:=x*2 //two times the number of characters
        else
          bufsize:=x;
     end;
 

-
function TMemoryRecord.GetValue: string;     
var
awc:ansistring;   
.....

      vtString:
      begin
        pba[bufsize-1]:=0;
        if Extra.stringData.unicode then
        begin
          pba[bufsize-2]:=0;
          awc:=wc;
          result:=ansitoutf8(awc);
        end
        else
          result:=ansitoutf8(c);
      end;


test for chinese system. Laughing


Last edited by maplecheck on Sun Mar 06, 2011 8:28 am; edited 3 times in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25791
Location: The netherlands

PostPosted: Mon Feb 28, 2011 11:26 am    Post subject: Reply with quote

works fine for unicode strings when I use them (even copy/pasting from website or posts), but it seems people that natively use unicode seem to have a problem yes. (Perhaps some kind if IME is interfering)

See if you can fix it

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
maplecheck
Expert Cheater
Reputation: 0

Joined: 22 Jan 2006
Posts: 139

PostPosted: Mon Feb 28, 2011 11:45 am    Post subject: Reply with quote

but I don't know how to fix it.
and the function CreateRemoteAPC also can't works fine.

I check in typepopup.pas, lose "MemoryRecord.Extra.stringData.unicode:=cbunicode.checked;" ???


Code:

procedure TTypeForm.Button1Click(Sender: TObject);
var bit,bitl: Byte;
    err: integer;
    ct: TCustomType;
    wasNotAOB: boolean;
begin
  err:=0;
  bitl:=0;

  wasNotAOB:=MemoryRecord.Vartype<>vtByteArray;



  case Vartype.ItemIndex of
    0: MemoryRecord.VarType:=vtBinary;
    1: MemoryRecord.Vartype:=vtByte;
    2: MemoryRecord.Vartype:=vtWord;
    3: MemoryRecord.Vartype:=vtDword;
    4: MemoryRecord.Vartype:=vtQword;
    5: MemoryRecord.Vartype:=vtSingle;
    6: MemoryRecord.VarType:=vtDouble;
    7: MemoryRecord.Vartype:=vtString;
    8: MemoryRecord.VarType:=vtByteArray;
    else
    begin
      if Vartype.ItemIndex<>-1 then
      begin
        ct:=TCustomType(vartype.Items.Objects[Vartype.ItemIndex]);
        if ct<>nil then
        begin
          MemoryRecord.VarType:=vtCustom;
          MemoryRecord.CustomTypeName:=ct.name;
        end;
      end;
    end;
  end;

  err:=0;
  if Vartype.ItemIndex<7 then
  begin
    if RadioButton1.checked then bit:=0 else
    if RadioButton2.checked then bit:=1 else
    if RadioButton3.checked then Bit:=2 else
    if RadioButton4.checked then Bit:=3 else
    if RadioButton5.checked then Bit:=4 else
    if RadioButton6.checked then Bit:=5 else
    if RadioButton7.checked then Bit:=6 else
                                 Bit:=7;
  end
  else
    val(edit1.Text,bit,err);

  if vartype.ItemIndex=0 then
    val(edit2.Text,bitl,err);

  if err>0 then
    raise exception.create('Invalid length');



  if memoryrecord.vartype=vtBinary then
  begin
    MemoryRecord.Extra.bitData.Bit:=bit;
    MemoryRecord.Extra.bitData.bitlength:=bitl;
  end;

  if memoryrecord.vartype=vtString then
    MemoryRecord.Extra.stringData.length:=bit;

  if memoryrecord.vartype=vtByteArray then
  begin
    MemoryRecord.Extra.byteData.bytelength:=bit;
    if wasNotAOB then //it wasn't an aob before, set the hexadecimal value
      MemoryRecord.showAsHex:=true;
  end;

  modalresult:=mryes;
end;
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25791
Location: The netherlands

PostPosted: Mon Feb 28, 2011 11:54 am    Post subject: Reply with quote

That's another bug. That's just setting of the unicode checkbox. (and already fix in the svn). The unicode problem people talk about is that it sometimes messes up special characters

you should check memoryrecordunit.pas at the xml parts

remoteapc was just a proof of concept and never worked 100% (which is why I never used it)
But if you want to use it, after running that code you MUST send an unused thread message to the affected thread from usermode to wake it up else it will not run the apc routine

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
maplecheck
Expert Cheater
Reputation: 0

Joined: 22 Jan 2006
Posts: 139

PostPosted: Mon Feb 28, 2011 12:22 pm    Post subject: Reply with quote

thank you, I have been fixed the unicode strings bugs.
the CreateRemoteAPC, I can works fine in my old UCE, but I forgot how to fix it.
Back to top
View user's profile Send private message
maplecheck
Expert Cheater
Reputation: 0

Joined: 22 Jan 2006
Posts: 139

PostPosted: Mon Feb 28, 2011 10:10 pm    Post subject: Reply with quote

I check the code, why the same code, my old ce can works fine, the 6.0 can't work?

"you MUST send an unused thread message "

you means call "PostThreadMessage(x,wm_paint,0,0); "?

I add a sleep(100), maybe can run thread, but is error run
Back to top
View user's profile Send private message
maplecheck
Expert Cheater
Reputation: 0

Joined: 22 Jan 2006
Posts: 139

PostPosted: Sun Mar 06, 2011 2:38 am    Post subject: Reply with quote

..

Last edited by maplecheck on Sun Mar 06, 2011 8:15 am; edited 1 time in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25791
Location: The netherlands

PostPosted: Sun Mar 06, 2011 7:02 am    Post subject: Reply with quote

Thanks, you tested this and it works ?
If so, could you also try the same on the description and comments part of the cheat table and test that? Or is that already working in the current svn?

http://cheatengine.org/mantis/view.php?id=249

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
maplecheck
Expert Cheater
Reputation: 0

Joined: 22 Jan 2006
Posts: 139

PostPosted: Sun Mar 06, 2011 7:44 am    Post subject: Reply with quote

there is a bit bug, i'm try to fixed now, please wait.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25791
Location: The netherlands

PostPosted: Sun Mar 06, 2011 8:00 am    Post subject: Reply with quote

also, if you just change currentvalue to type widestring and change "SetValue" and add in a tempsa: ansistring;

and then change he stringwrite routine to:
Code:

        tempsw:=currentvalue;
        tempsa:=currentvalue;

        //copy the string to the buffer
        for i:=0 to x-1 do
        begin
          if extra.stringData.unicode then
          begin
            wc[i]:=pwidechar(tempsw)[i];
          end
          else
          begin
            c[i]:=pchar(tempsa)[i];
          end;
        end; 


does that have any effect ?

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
maplecheck
Expert Cheater
Reputation: 0

Joined: 22 Jan 2006
Posts: 139

PostPosted: Sun Mar 06, 2011 8:20 am    Post subject: Reply with quote

I have been update the code that see top posts.
and I have tested works fine.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25791
Location: The netherlands

PostPosted: Sun Mar 06, 2011 10:09 am    Post subject: Reply with quote

does changing currentvalue to widestring have the same effect ?

When i use the ansi<->utf8 method I can not copy/paste chinese characters as text anymore. They then show up as ??

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
maplecheck
Expert Cheater
Reputation: 0

Joined: 22 Jan 2006
Posts: 139

PostPosted: Sun Mar 06, 2011 10:54 am    Post subject: Reply with quote

does changing currentvalue to widestring have the same effect ?
yes, also can don't changing ansistring, but must add this code

Code:
        if extra.stringData.unicode then
          i:=UTF8Length(v)
        else
          i:=length(currentvalue);   


When i use the ansi<->utf8 method I can not copy/paste chinese characters as text anymore. They then show up as ??

I can work fine with copy/paste chinese characters as text.
can you give me a picture that you do?



another method, don't change currentvalue to ansistring.

Code:
      vtString:
      begin
        tempsa:=utf8toansi(v);

        if extra.stringData.unicode then
          i:=UTF8Length(v)
        else
          i:=length(tempsa);
        //x contains the max length in characters for the string
        if extra.stringData.length<i then
        begin
          extra.stringData.length:=i;
          freemem(buf);
          bufsize:=getbytesize;
          getmem(buf, bufsize);
        end;

        x:=bufsize;
        if extra.stringData.unicode then
          x:=bufsize div 2; //each character is 2 bytes so only half the size is available


        if Extra.stringData.ZeroTerminate then
           x:=min(i+1,x) //also copy the zero terminator
        else
           x:=min(i,x);

        tempsw:= tempsa;

        //copy the string to the buffer


        for i:=0 to x-1 do
        begin
          if extra.stringData.unicode then
          begin
            wc[i]:=pwidechar(tempsw)[i];
          end
          else
          begin
            c[i]:=pchar(tempsa)[i];
          end;
        end;   
Back to top
View user's profile Send private message
idonkey
How do I cheat?
Reputation: 0

Joined: 31 Jan 2009
Posts: 1

PostPosted: Wed Mar 30, 2011 5:36 pm    Post subject: Reply with quote

The operating system itself is in Chinese win7 x64, which is currently experiencing problems, do not know how to solve Shocked
Can have a more detailed description of you! Thank you. . .
I am using the translation machine, so the grammar may be a problem Embarassed



123.jpg
 Description:
 Filesize:  159.85 KB
 Viewed:  23657 Time(s)

123.jpg


Back to top
View user's profile Send private message
frank_mascarado
How do I cheat?
Reputation: 0

Joined: 03 Jun 2007
Posts: 5

PostPosted: Thu Mar 31, 2011 2:48 pm    Post subject: Reply with quote

._.


asd.JPG
 Description:
 Filesize:  201.46 KB
 Viewed:  23595 Time(s)

asd.JPG



_________________
3haat eng1ne 6.0 Rev 1725

img96.imageshack.us/img96/6062/asdryz.jpg
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Source All times are GMT - 6 Hours
Page 1 of 1

 
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