[request] LSS script/tut to poke value in a complex address

Ask for Help on Using the Language With Memory Hacking Software

Moderators: g3nuin3, SpeedWing, WhiteHat, mezzo

[request] LSS script/tut to poke value in a complex address

Postby liqmysaq » Thu Mar 27, 2008 12:36 am

can somebody make a basic LSS script (prefer a tutorial) so i can poke values into an address that isnt static, and poke into locked value also. i try to learn it but i dont know where to start.. its all jibberish to me so far and i get frustrated with the help file and have to stop. any help would be appreciated.
User avatar
liqmysaq
I Know Your Poop
 
Posts: 538
Joined: Tue Jan 01, 2008 2:02 am

Postby Silv3rShi3ld » Thu Mar 27, 2008 12:40 am

what is LSS script precisely??? does it has + points instead of other script language??? (if im anoying don't answer xD)

was LSS not the language of World of Warcraft??? 8) :shock:
(sorry i don't know anything about this... but i want also to learn it^^ can always be usefull! :lol: )
User avatar
Silv3rShi3ld
Acker
 
Posts: 86
Joined: Fri Mar 07, 2008 11:11 pm
Location: Netherlands!!!

Postby mezzo » Thu Mar 27, 2008 2:02 am

[offtopic] LSS = L.Spiro Script
It's the scripting language you write in the script editor in MHS..

helpfile... forum search function... use them.

--------------------------------------

As for the question;

Code: Select all
extern WORD     bHitPoints =    { "NetHackw.exe", 0x1696D4 }; //vanilla

void On_HK_1(DWORD dw1, DWORD dw2)
{   
bHitPoints = 100000;
}


pointer example:

Code: Select all
extern int * test = { "NetHackw.exe", 0x111111 };

void On_HK_2(DWORD dw1, DWORD dw2)
{   
*test = 10000;
}


I'm not sure what the effect is of writing a value to a location that is
already locked.. I would think that it gets overwritten by the lock right away.
- No thanks, I already have a penguin -
User avatar
mezzo
El Mariachi
 
Posts: 738
Joined: Mon Apr 30, 2007 10:27 pm
Location: Antwerp

Postby liqmysaq » Thu Mar 27, 2008 4:17 am

i still dont understand. could u make an example using this address: [[[[0x12345678]+0xD]+0xC]+0xB]+0xA as float and the hotkey is control+P and the value set when hotkey pressed is 24.12345

that way i can see the numbers/letters and where they are and all that jazz. i can keep askin a million questions till i understand but that must be annoying for u guys. like what is NetHackw.exe, what is the hex after it, what is...
the helpfile doesnt help too much if u dont already know the basics, and i know nothing lol.
User avatar
liqmysaq
I Know Your Poop
 
Posts: 538
Joined: Tue Jan 01, 2008 2:02 am

Postby mezzo » Thu Mar 27, 2008 8:37 am

seems to me that you don't know what a pointer is...

Okay, I'm going to answer you in snippets form the helpfile:

(1)
Square brackets ([ ]) indicate that a value should be obtained from the target process. The expression inside the brackets indicates the address from where to get the value. Any numeric value inside the brackets is converted to an unsigned integral value and treated as the address in the target process from where the value is obtained.

Simple no ? so [0x12345678] means the value located at that memory address... could be 4 or 10000 or a float, BUT unless specified as in point nr (3), it will ALWAYS be treated as a DWORD.

(2)
[[0x01005334]+0x44] gets the value from 0x01005334 in the target process, adds 0x44 to it, and then gets that value from that address in the target process.

Also pretty simple.. Get the *value* at the specified address 0x01005334, add a number to it 0x44 and use that result as a new memory location, as is described in (1)

(3)
By default the value obtained from the target process is in DWORD format, however prefixes on the brackets can be used to change this.
b[ ] gets a byte value.
w[ ] gets a word value.
[ ] (no prefix) gets a dword value.
q[ ] gets qword value.
f[ ] gets a float value.
d[ ] gets a double value.

As you can see form the helpfile, the DEFAULT is to treat whatever is between brackets as a DWORD. This was probably done to make it easier
to work with pointers, as a pointer is ALWAYS a DWORD.

(4)
Module names are resolved into the actual address of the module (unless used inside a special operator) as a 64-bit unsigned integer type. This means an expression such as gamex86.dll+0x154C is valid. gamex86.dll becomes a numeric value and is added to 0x154C for the final result

Okay, back to my example from the previous post so it's easier to explain:
extern WORD bHitPoints = { "NetHackw.exe", 0x1696D4 };

I play a game called nethack and what I'm telling LSS with that line is that the location of the hitpoints (which is of size WORD) for my character is located at base_address_of_nethack.exe+0x1686D4.

So if you add all that I stated above:

extern WORD bHitPoints = { "NetHackw.exe", 0x1696D4 };
is exactly the same as w[nethackw.exe+0x1696D4]

If you are still with me, let's have a look at your question:
liqmysaq wrote:could u make an example using this address: [[[[0x12345678]+0xD]+0xC]+0xB]+0xA as float and the hotkey is control+P and the value set when hotkey pressed is 24.12345


This tells me that you are not completely familiar with complex notation yet..

* As point (1) and (2) told us, if you want to tell MHS that something is an address you need to enclose it in []
So you should put [[[[[0x12345678]+0xD]+0xC]+0xB]+0xA]
Unless you mean take the value at address [[[[0x12345678]+0xD]+0xC]+0xB] and add 0xA to that value.

* As per point (3), if you want to tell MHS that the value at [address] is a
float, you need to put an 'f' in front of it:
f[[[[[0x12345678]+0xD]+0xC]+0xB]+0xA]

Okay, now for your answer (also check this thread):
Code: Select all
struct something {
   BYTE bBuffer[0xD];
   struct {
      BYTE bBuffer[0xC];
         struct {
            BYTE bBuffer[0xB];
            struct {
               bBuffer[0xA];
               FLOAT fValue;
            } * poObj;
         } * poObj;
   } * poObj;
} * poBase = (something *)0x12345678;

void On_HK_1(DWORD dw1, DWORD dw2)
{   
poBase->poObj->poObj->poObj->fValue = 24.12345;
}


There.... if anybody sees any holes in my 'lengthy' explanation, feel free to shout..
(I've been up for 16 hours, so mistakes are not out of the question).
Anyway, most of the snippets on this page were taken from the "expression evaluator" page from the helpfile except for the thread mentioned above.
- No thanks, I already have a penguin -
User avatar
mezzo
El Mariachi
 
Posts: 738
Joined: Mon Apr 30, 2007 10:27 pm
Location: Antwerp

Postby L. Spiro » Thu Mar 27, 2008 10:21 am

For the sake of L. Spiro Script your structure would be:

Code: Select all
extern struct something {
   BYTE bBuffer[0xD];
   struct {
      BYTE bBuffer[0xC];
         struct {
            BYTE bBuffer[0xB];
            struct {
               bBuffer[0xA];
               FLOAT fValue;
            } * poObj;
         } * poObj;
   } * poObj;
} * poBase = { "", 0x12345678 };

void On_HK_1( DWORD dw1, DWORD dw2 ) {   
  poBase->poObj->poObj->poObj->fValue = 24.12345;
}




This is the most efficient and correct way to do it. It also makes it easy to keep up with updates when the game changes addresses and offsets—you change one structure and it will update all addresses that use it.



However if you really can not get it to work, you can use the EvalExp() function.

Code: Select all
void On_HK_1( DWORD dw1, DWORD dw2 ) {
  EVAL_RET_TYPE ertRet;
  if ( EvalExp( "[[[[0x12345678]+0xD]+0xC]+0xB]+0xA", &ertRet, FALSE ) {
    FLOAT pfVal = { "", ertRet.ui64Int64 };
    pfVal = 24.12345;
  }
}

But this is much slower but easier to understand.


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3126
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby liqmysaq » Thu Mar 27, 2008 12:47 pm

thanks. the helpfile i have doesnt talk about complex addys. at least i havent found where it does. maybe i have an old one or something. ill get a new one and look again.
you guys rock, ill try to soak all this in and try it out.
User avatar
liqmysaq
I Know Your Poop
 
Posts: 538
Joined: Tue Jan 01, 2008 2:02 am

Postby liqmysaq » Sat Mar 29, 2008 12:58 am

ok i been messin with this a couple days now, i made a test script for my ammo (its not float but its shorter complex to test with). it says theres an error and i dont know whats wrong. ive messed with it a bit to try to figure it out but i really dont know what im doing. my code is
Code: Select all
extern struct noreload {
   BYTE bBuffer[0x4B8];
   struct {
      BYTE bBuffer[0x160];
      struct {
       BYTE bBuffer[0x208];
         struct {
            BYTE bBuffer[0xC];
            struct {
               bBuffer[0x2D4];
               DWORD dwValue;
            } * poObj;
         } * poObj;
      } * poObj;   
   } * poObj;
} * poBase = { "", 0x341F1DFC };

void On_HK_1( DWORD dw1, DWORD dw2 ) {   
  poBase->poObj->poObj->poObj->poObj->dwValue = 5;
}

the error i get is:
ERROR: Line: 10 Syntax error. which is bBuffer[0x2D4];

if i try to compile the examples u guys put it gives even more errors. what am i doing wrong?
User avatar
liqmysaq
I Know Your Poop
 
Posts: 538
Joined: Tue Jan 01, 2008 2:02 am

Postby L. Spiro » Sat Mar 29, 2008 9:45 am

There is no BYTE in front of it.


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3126
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby mezzo » Sat Mar 29, 2008 10:14 am

Oops, looks like I missed that one in my example too :\
sorry about that, liqmysaq.
- No thanks, I already have a penguin -
User avatar
mezzo
El Mariachi
 
Posts: 738
Joined: Mon Apr 30, 2007 10:27 pm
Location: Antwerp

Postby liqmysaq » Sat Mar 29, 2008 10:34 am

np mezzo, thank you for such a great tut. i swear i tried putting BYTE in there but it still errored, anyway its working perfect now thank you both.
User avatar
liqmysaq
I Know Your Poop
 
Posts: 538
Joined: Tue Jan 01, 2008 2:02 am

Postby WhiteHat » Thu Oct 09, 2008 9:41 pm

My apology to liqmysaq for asking my own question to his thread here..

L. Spiro’s example for liq’s question above is something i am able to comprehend, since it is a fairly common pointer or
expression...

But, please, i really need help with this:
I am trying to make a simple conditional value lock using LSS and i have no idea at all (my C is not good at all) of how to
put this complex address into LSS:

[ePSXe.exe+0x176DC0] + ([[ePSXe.exe+0x176DC0]+0xE7F3C]&0x1FFFFF) + 0x130 + (0x4*0x2C) + 0x06

That’s a complex address for Selected Mech’s Left-Grip Weapon-Accuracy in Front Mission 3. It is a PlayStation game i play
with ePSXe v1.6.0.

I’m aware that the rightmost offset: 0x130 + (0x4*0x2C) + 0x06 can be written as 0x1E6, but please leave them be...


Appreciate any help. Thank you very much in advance...
.. to boldly go where no eagle has gone before...
User avatar
WhiteHat
Elang Djawa
 
Posts: 1059
Joined: Fri Jul 21, 2006 12:49 pm
Location: Away for a while...

Postby L. Spiro » Fri Oct 10, 2008 8:01 am

Use EvalExp().
Buffer the return value so that EvalExp() does not need to be called every time the lock occurs.
Flush the buffer and recall EvalExp() every 30 times or so.


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3126
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Postby toffey » Fri Sep 25, 2009 12:50 pm

I know this is quite an old topic, but I was trying to use this method for a complex address I had and I came to an error for it.

The complex address:
Code: Select all
[[[[0x149E928]+0x0]+0x8]+0x54]+0x24


My code:
Code: Select all
extern struct playerYAddy {
   BYTE bBuffer[0x0];
   struct {
      BYTE bBuffer[0x8];
         struct {
            BYTE bBuffer[0x54];
            struct {
               BYTE bBuffer[0x24];
               FLOAT fValue;
         } * poObj;
         } * poObj;
      } * poObj;
} * poBase = { "", 0x149E928 };

void On_HK_1( DWORD dw1, DWORD dw2 ) {   
  poBase->poObj->poObj->poObj->fValue = 24.12345;
}


And here are the errors:
Code: Select all
ERROR: Line: 1702101107 Zero-sized arrays not allowed.
ERROR: Line: 2 Unable to declare variable.
ERROR: Line: 12 Failed creating struct or union “playerYAddy”.


I believe the first error comes from Line 2 and is causing the problems since if I change the "0x0" to something such as "0x1" it compiles just fine, but doesn't give me what I'm looking for obviously. The first error changes its line number each time I compile.

My question is how can I get around this?

Edit:
I'm having the same problems with the other method that you (L. Spiro) described. I tried looking through the help file for some help, but couldn't figure anything out.

Code:
Code: Select all
void On_Open_CLIENT_EXE( DWORD dw1, DWORD dw2 ) {
  EVAL_RET_TYPE ertRet;
  FLOAT pfVal = 0;
  if ( EvalExp( "[[[[0x149E928]+0x0]+0x8]+0x54]+0x24", &ertRet, FALSE )) {
    pfVal = { "", ertRet.ui64Int64 };
    pfVal = 24.12345;
  }
}


Error:
Code: Select all
ERROR: Line: 5 Syntax error.  File: C:\Downloads\Test.lss

Which refers to this line:
Code: Select all
pfVal = { "", ertRet.ui64Int64 };


I initialized pfVal before the if statement to eliminate one error, but the syntax error remained. I was not able to figure out where the syntax error was even after trying many different things that I could think of. Note that the complex address I input also ends up as a float.
User avatar
toffey
Hack-Master Hex
 
Posts: 689
Joined: Fri Sep 05, 2008 5:39 pm
Location: California, USA

Postby CoMPMStR » Sat Sep 26, 2009 9:42 am

toffey wrote:I know this is quite an old topic, but I was trying to use this method for a complex address I had and I came to an error for it.

The complex address:
Code: Select all
[[[[0x149E928]+0x0]+0x8]+0x54]+0x24


My code:
Code: Select all
extern struct playerYAddy {
   BYTE bBuffer[0x0];
   struct {
      BYTE bBuffer[0x8];
         struct {
            BYTE bBuffer[0x54];
            struct {
               BYTE bBuffer[0x24];
               FLOAT fValue;
         } * poObj;
         } * poObj;
      } * poObj;
} * poBase = { "", 0x149E928 };

void On_HK_1( DWORD dw1, DWORD dw2 ) {   
  poBase->poObj->poObj->poObj->fValue = 24.12345;
}


And here are the errors:
Code: Select all
ERROR: Line: 1702101107 Zero-sized arrays not allowed.
ERROR: Line: 2 Unable to declare variable.
ERROR: Line: 12 Failed creating struct or union “playerYAddy”.


I believe the first error comes from Line 2 and is causing the problems since if I change the "0x0" to something such as "0x1" it compiles just fine, but doesn't give me what I'm looking for obviously. The first error changes its line number each time I compile.

My question is how can I get around this?

You didn't look hard enough: http://memoryhacking.com/forums/viewtopic.php?t=1605 :P


toffey wrote:I'm having the same problems with the other method that you (L. Spiro) described. I tried looking through the help file for some help, but couldn't figure anything out.

Code:
Code: Select all
void On_Open_CLIENT_EXE( DWORD dw1, DWORD dw2 ) {
  EVAL_RET_TYPE ertRet;
  FLOAT pfVal = 0;
  if ( EvalExp( "[[[[0x149E928]+0x0]+0x8]+0x54]+0x24", &ertRet, FALSE )) {
    pfVal = { "", ertRet.ui64Int64 };
    pfVal = 24.12345;
  }
}


Error:
Code: Select all
ERROR: Line: 5 Syntax error.  File: C:\Downloads\Test.lss

Which refers to this line:
Code: Select all
pfVal = { "", ertRet.ui64Int64 };


I initialized pfVal before the if statement to eliminate one error, but the syntax error remained. I was not able to figure out where the syntax error was even after trying many different things that I could think of. Note that the complex address I input also ends up as a float.


I don't think you can set a FLOAT variable to what you have entered (how is { "", ertRet.ui64Int64 } a FLOAT? :lol:). Another thing is that it should be ertRet.u.ui64Int64, as taken from the help file (Scripting->Writing Scripts->Predefined Structs & Unions). So this should be the result, at least it compiles successfully. :?

Code: Select all
pfVal = ertRet.u.ui64Int64; //{ "", ertRet.ui64Int64 };
Image

______________________________________________________
My Utilities:
CT <-> LSSAVE Converter
LSS Visual Dialog Designer
.NET Trainer Helper Library

~Whether you think you can or you think you can't, you're right.

L. Spiro wrote:In my left hand is a red pill. If you take it I will show you the truth. I lost my right hand in the war, so I’m afraid you’re stuck with the red pill.
User avatar
CoMPMStR
(P)ot (I)n (M)y (P)ipe
 
Posts: 451
Joined: Thu Mar 06, 2008 7:50 am
Location: Best Place

Next

Return to Help

Who is online

Users browsing this forum: No registered users and 2 guests

cron