View previous topic :: View next topic |
Author |
Message |
strcat32 How do I cheat? Reputation: 0
Joined: 29 Mar 2013 Posts: 5
|
Posted: Fri Mar 29, 2013 9:58 am Post subject: readString() for Widestrings? |
|
|
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?
Thanks in Advance
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Fri Mar 29, 2013 10:45 am Post subject: |
|
|
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 |
|
|
strcat32 How do I cheat? Reputation: 0
Joined: 29 Mar 2013 Posts: 5
|
Posted: Fri Mar 29, 2013 11:02 am Post subject: |
|
|
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 |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Fri Mar 29, 2013 11:18 am Post subject: |
|
|
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 |
|
|
strcat32 How do I cheat? Reputation: 0
Joined: 29 Mar 2013 Posts: 5
|
Posted: Fri Mar 29, 2013 11:23 am Post subject: |
|
|
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 |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Fri Mar 29, 2013 11:31 am Post subject: |
|
|
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 |
|
|
strcat32 How do I cheat? Reputation: 0
Joined: 29 Mar 2013 Posts: 5
|
Posted: Fri Mar 29, 2013 11:58 am Post subject: |
|
|
I was using 6.1. Maybe this was the issue?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Fri Mar 29, 2013 12:40 pm Post subject: |
|
|
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 |
|
|
strcat32 How do I cheat? Reputation: 0
Joined: 29 Mar 2013 Posts: 5
|
Posted: Fri Mar 29, 2013 12:51 pm Post subject: |
|
|
Sorry for the trouble (wiki should be updated?)
|
|
Back to top |
|
|
|