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 


readString() for Widestrings?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
strcat32
How do I cheat?
Reputation: 0

Joined: 29 Mar 2013
Posts: 5

PostPosted: Fri Mar 29, 2013 9:58 am    Post subject: readString() for Widestrings? Reply with quote

In CreateFileA i can use:

Code:

dwFileName=readInteger(ESP+4)
lpFileName=readString(dwFileName)
print(string.format("lpFileName: %s\n",lpFileName))


to log filenames.

But i want to hook CreateFileW.

Is there a readString() function, which supports WideStrings?

Confused

Thanks in Advance
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Fri Mar 29, 2013 10:45 am    Post subject: Reply with quote

lpFileName=readString(dwFileName, true)
_________________
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
strcat32
How do I cheat?
Reputation: 0

Joined: 29 Mar 2013
Posts: 5

PostPosted: Fri Mar 29, 2013 11:02 am    Post subject: Reply with quote

Dark Byte wrote:
lpFileName=readString(dwFileName, true)


With this i get:

Code:
ret: 101643cf - lpFileName: (Y   
ret: 101643cf - lpFileName: 8??
ret: 101643cf - lpFileName: (Y   


I made me a little function which works:

Code:
function readWideString(dwAddress)
  lpString = ""
  i = 0
  while readString(dwAddress+i) ~= "" do
    lpString = lpString..readString(dwAddress+i)
    i = i + 2
  end
  return lpString
end

...
lpFileName = readWideString(dwFileName)



With this i get:

Code:

ret: 101643cf - lpFileName: C:/Program Files (x86)/[...]
 ret: 101643cf - lpFileName: C:/Program Files (x86)/[...]
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Fri Mar 29, 2013 11:18 am    Post subject: Reply with quote

sorry, I forgot it's the 3th param
lpFileName=readString(dwFileName, 512, true)

_________________
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
strcat32
How do I cheat?
Reputation: 0

Joined: 29 Mar 2013
Posts: 5

PostPosted: Fri Mar 29, 2013 11:23 am    Post subject: Reply with quote

It still prints only the first Char with your solution.

Code:
       
  lpFileName = readString(dwFileName,512,true)
  print(string.format("ret: %x - lpFileName: %s\n", ret,lpFileName))


Code:

ret: 101643cf - lpFileName: C
ret: 101643cf - lpFileName: C
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Fri Mar 29, 2013 11:31 am    Post subject: Reply with quote

you're using ce 6.2 ?

I just wrote an unicode string to 00400500 (63 00 3A 00 5C 00 62 00 6C 00 61 00 00 - c:\bla)

and filled in some test variables in your code:
Code:

ret=0x00500000
dwFileName=0x00400500
lpFileName = readString(dwFileName,512,true)
print(string.format("ret: %x - lpFileName: %s\n", ret,lpFileName))


and it outputs :
Code:

ret: 500000 - lpFileName: c:\bla

_________________
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
strcat32
How do I cheat?
Reputation: 0

Joined: 29 Mar 2013
Posts: 5

PostPosted: Fri Mar 29, 2013 11:58 am    Post subject: Reply with quote

I was using 6.1. Maybe this was the issue?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Fri Mar 29, 2013 12:40 pm    Post subject: Reply with quote

Yeah, the third parameter (isWidestring) was added in 6.2
_________________
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
strcat32
How do I cheat?
Reputation: 0

Joined: 29 Mar 2013
Posts: 5

PostPosted: Fri Mar 29, 2013 12:51 pm    Post subject: Reply with quote

Sorry for the trouble (wiki should be updated?)
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 Lua Scripting 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