Jump to content

Workaround for Nomadmemory in Windows 7 x64


Recommended Posts

A few months ago I tried compiling scripts on Windows 7 x64 using NomadMemory. Everywhere I looked no one could figure out why _memoryRead() would only return 0s. The best advice that would be given is set debug privileges.

At the time I just continued compiling my scripts on Vista x64 and accepted there wasn't a solution. However, a few months back I shared my code to a few people whom were using Windows 7 x64 and had to figure out why the scripts were not working.

Here is what I found.

Anything typecast as variable1 would immediately convert to 64 bit representation, however, if typecast instead as variable2 would not.

variable1 = "0xVALUE" ;Bad, auto-converts to x64 representation
variable2 = hex("VALUE") ;Good, stays as needed for x32

So i converted every instance of Variable = "0xVALUE" accordingly.

The scripts still were not reading memory, but I was able to isolate the new problem, NomadMemory would return 64 bit representation for every int value. Floats, Bytes, character arrays, etc were working fine (inherently are the same length), but int, uint, etc were not.

The workaround for this was replacing every _MemoryRead() with a function

Func _NewMemRead($Addr1, $Proc1, $type1)
   If $type1 = "int" Then ;I only used int, if you use uint or any other integer representation, add them in here
      Return (Dec(Hex(StringRegExpReplace(_MemoryRead($Addr1, $Proc1, $type1), "00000000", "", 1))))
   Else
      Return _MemoryRead($Addr1, $Proc1, $type1)
   EndIf
EndFunc   ;==>_NewMemRead

Essentially the function would strip the extra 0s because of the conversion to x64, allowing the script to read memory.

I am writing this up many months after the fact, At this time I cannot remember why I had to type cast the result to Hex and then Dec to get it to return the proper integer value. But it is probably the first problem mentioned above about the value being typecast to the wrong format.

I hope this helps anyone out there who is looking for a solution to this problem.

Link to comment
Share on other sites

Excellent. Really. I would like to ask you a couple of things.

1)Could you post here fullcode of nomadmemory (or .au3 file) with the updated code for everyone use?

2) Is the "new" nomadmemory code working both for 32bit and 64 or i should use old nomad memory for 32bit and this new one you fixed for 64?

Thanks for the brilliant work ;)

I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Link to comment
Share on other sites

  • 2 weeks later...

With these changes, the script can be compiled on both x32 and x64 systems with no adverse effects.

I hesitate to release a modified Nomad Memory as there may be unintended side effects for specialized users that want to do more than read memory using specifically Int, float, char[], byte. There are numerous other parameters accepted by nomad memory which I have not looked into, and since I will not be using them I have not considered how this function would be modified (if it even does need to be) to be compatible with all supported parameters. If I had created a function that was complete I would have no problem posting an updated version of Nomad Memory with the adjustment.

By posting this, I only hope to assist other users in understanding that there exists a previously non-disclosed problem with Nomad Memory in Win7 x64 which can be corrected by making a a very simple dummy function which provides the equivalent output that users expected if scripts were compiled in any other setting (Win7 x32, Vista x64 x32).

Link to comment
Share on other sites

  • 4 years later...
  • Moderators

@Szmycu you obviously didn't bother to read the forum rules that I pointed you to already. Take the next 24 hours being unable to post on the forum to give you plenty of time to read them. Post this kind of question again and you'll be shown the door.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...