Jump to content

Strange output from Hex() Function


Recommended Posts

It's still worth investigating where the conversion to double occured. It must be happening somewhere within your script. Sanity checking input (forced conversion in this case) is good practice. You should also declare your variables before use.

Local $vTest
ConsoleWrite(VarGetType($vTest) & @LF)
$vTest += 1
ConsoleWrite(VarGetType($vTest) & @LF)
$vTest /= 1
ConsoleWrite(VarGetType($vTest) & @LF)

 

Edited by czardas
Link to comment
Share on other sites

  • Replies 45
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

The thing is, this variable is being passed as a parameter to this function.  If it is an empty string to begin with, because it is not

delclared , it seems like it would inherit the data type of the variable that was being passed to it.  I did try to declare it up top

but it produces the same result,.  I set it to 1. Which i would think would be an integer.  When it is passed to function , it seems to be

inheriting the data type of the receiving variable instead.  Why this would change is odd.  If it is a string , then I would assume it to throw an

error when trying to do arithmetic on a string.  maybe someone knowd the internal type casting when passing parameters and can enlighten me.

 


 

Link to comment
Share on other sites

Just browsing the code you posted, I see that in many places you declare pointer parameters as Int or dword, which is wrong.

Also there is no place where you put anything else than a string of question marks in the prochandle, a.s.o.

Finally I'm done with code meant to cheat on game emulators.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

The example script is pointles now. 

The problem is the type casting of an undeclared var to a funtions input parameter.

The passed variables type is not retained and it is set to String.

This works for the Hex() function, but the variable is then incremented.  At this point it is

converted to a Double.  This does NOT work in the Hex() function. 

Hex( Int( $MyVar ) ) fixed the problem, but strangely enuough:

$MyVar = Int( $MyVar )  then

Hex( $MyVar )  does NOT work.

 

That seems VERY odd.


 

Link to comment
Share on other sites

Ok, I have solved this little problem once and for all.

Thanks to all who helped, and especially the advice on VarGetType(). It was the

reason it was solved.  Turned out that when setting my variables to the values in the

BASIC_MEMORY_STRUCTURE  struct from the VirtualQuerryEx function call , the type in the

struct is PVOID.  I am assuming that the assignment of my variable did not know what type to

cast it to , and defaults to a string.  So I added an Int in front of it , ex: MyVar = Int(MBI[0])

Then it cast it to an Int32, and all works fine.

 

.▀█▀.█▄█.█▀█.█▄.█.█▄▀ █▄█.█▀█.█─█
─.█.─█▀█.█▀█.█.▀█.█▀▄ ─█.─█▄█.█▄█
 

Edited by Tyranna


 

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...