Jump to content

BinaryToString problem


Recommended Posts

Hello.

First of all, this is my first post.

Ok, time for my problem.

I'm currently trying to retrieve the playername from World of Warcraft for a simple little project I've started.

To do so, I have to read the memory etc etc.

Everything works except that when I read the playername and convert it from binary, it only returns the first 4 characters.

But if I read the memory AGAIN with the same offset +0x4, I get the next 4 characters and if I read once again with the offset +0x8, I get the last characters in the name.

However, I'm unable to put them all together in 1 line, for example

$name = msgbox(0, "", $t1 & $t2 $t3)

(T = translate)

That only returns the 1st 4 characters, aka, the ones from $t1 and none from the others. And even if I type &"L" after, the L doesn't show.

Also, if I enter the 3 variables I use to search with into the same binarytostring function.

$t = binarytostring($name1&$name2&$name3)
msgbox(0, "", $t)

That only returns the the values I get from reading the memory, in one line.

Example from my script:

#Include <NomadMemory.au3>

SetPrivilege("SeDebugPrivilege", 1)
$dll = DllOpen("user32.dll")
$wow = _memoryopen(WinGetProcess("World of Warcraft"))
$name1 = _memoryread(0x011CB348, $wow)
$name2 = _memoryread(0x011CB348+0x4, $wow)
$name3 = _memoryread(0x011CB348+0x8, $wow)
$t1 = BinaryToString($name1)
$t2 = BinaryToString($name2)
$t3 = BinaryToString($name3)

So please, if anyone could take their time and check what could be wrong, I'd apreciate it.

Also, if oyu need any more info, just ask for it.

~Jeff Tremaine.

Link to comment
Share on other sites

  • Moderators

JeffTremaine,

Welcome to the AutoIt forums. Good start - code to work on and a clear question!

You have coded this:

$name = msgbox(0, "", $t1 & $t2 $t3)

which will not work because you are trying to concatenate the 2 variables $t1 and $t2 $t3. AutoIt does not know what $t2 $t3 means.

If you were to code this:

$name = msgbox(0, "", $t1 & $t2 & $t3)

you will concatenate the 3 variables $t1 and $t2 and $t3 and it should work!

Happy with the difference between the 2 lines?

Try downloading and installing the full version of SciTE4AutoIt3 to use as your editor, it has a built-in checker to catch things like this (and much more!). I recommend it highly.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

JeffTremaine,

Welcome to the AutoIt forums. Good start - code to work on and a clear question!

You have coded this:

$name = msgbox(0, "", $t1 & $t2 $t3)

which will not work because you are trying to concatenate the 2 variables $t1 and $t2 $t3. AutoIt does not know what $t2 $t3 means.

If you were to code this:

$name = msgbox(0, "", $t1 & $t2 & $t3)

you will concatenate the 3 variables $t1 and $t2 and $t3 and it should work!

Happy with the difference between the 2 lines?

Try downloading and installing the full version of SciTE4AutoIt3 to use as your editor, it has a built-in checker to catch things like this (and much more!). I recommend it highly.

M23

Ye I now realize my typo :)

Well the thing is, I get the values and everything.

Let's say my ingame name is Jefftremaine.

$t1 returns 'Jeff'

$t2 returns 'trem'

$t3 returns 'aine'

The problem is, when I try with the same code as you suggested (same as mine except for the typos which excluded the '&')

It shows a msgbox with the text 'Jeff' and skips everything behind the $t1.

Link to comment
Share on other sites

  • Moderators

JeffTremaine,

It is not that I do not believe you , but are you sure that $t2 and $t3 hold what you think they do? If you them into a MsgBox on their own, do they display?

MsgBox((0, "", $t2)
MsgBox((0, "", $t3)

If a concatenation appears to fail, it is usually because there is nothing there to show!

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

JeffTremaine,

It is not that I do not believe you , but are you sure that $t2 and $t3 hold what you think they do? If you them into a MsgBox on their own, do they display?

MsgBox((0, "", $t2)
MsgBox((0, "", $t3)

If a concatenation appears to fail, it is usually because there is nothing there to show!

M23

As said, $t2 and $t3 returns the next 8 characters in the name.

And it doesn't matter whatever I put after the $t1, it still doesn't show =/

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...