Difference between revisions of "Memory Functions"

From SolarStrike wiki
Jump to: navigation, search
(memoryReadInt)
Line 7: Line 7:
 
Reads a single byte (-128 -> +127) from the specified process handle and address. The specified address may be in either [[decimal]] or [[hexadecimal]] form.
 
Reads a single byte (-128 -> +127) from the specified process handle and address. The specified address may be in either [[decimal]] or [[hexadecimal]] form.
  
handle should be the variable that you obtained using [[ProcessFunctions#openProcess|openProcess]]().
+
'handle' should be the variable that you obtained using [[Process_Functions#openProcess|openProcess]]().
  
  
Line 18: Line 18:
 
end
 
end
 
</source>
 
</source>
 +
  
 
== memoryReadShort ==
 
== memoryReadShort ==
'''byte memoryReadShort(handle, address)'''
+
'''short memoryReadShort(handle, address)'''
  
 
Reads a short (2 bytes, -32,768 -> +32,767) from the specified process handle and address. The specified address may be in either [[decimal]] or [[hexadecimal]] form.
 
Reads a short (2 bytes, -32,768 -> +32,767) from the specified process handle and address. The specified address may be in either [[decimal]] or [[hexadecimal]] form.
  
handle should be the variable that you obtained using [[ProcessFunctions#openProcess|openProcess]]().
+
'handle' should be the variable that you obtained using [[Process_Functions#openProcess|openProcess]]().
  
 
'''Example'''
 
'''Example'''
Line 34: Line 35:
 
end
 
end
 
</source>
 
</source>
 +
  
 
== memoryReadInt ==
 
== memoryReadInt ==
'''byte memoryReadShort(handle, address)'''
+
'''int memoryReadShort(handle, address)'''
  
Reads a int (4 bytes, -2,147,483,648 -> +2,147,483,647) from the specified process handle and address. The specified address may be in either [[decimal]] or [[hexadecimal]] form.
+
Reads an int (4 bytes, -2,147,483,648 -> +2,147,483,647) from the specified process handle and address. The specified address may be in either [[decimal]] or [[hexadecimal]] form.
  
handle should be the variable that you obtained using [[ProcessFunctions#openProcess|openProcess]]().
+
'handle' should be the variable that you obtained using [[Process_Functions#openProcess|openProcess]]().
  
 
'''Example'''
 
'''Example'''
Line 49: Line 51:
 
   printf("Hp[%d] dropping too low!",HP);
 
   printf("Hp[%d] dropping too low!",HP);
 
end
 
end
 +
</source>
 +
 +
 +
== memoryReadUInt ==
 +
'''unsigned int memoryReadShort(handle, address)'''
 +
 +
Exactly like [[Memory_Functions#memoryReadInt|memoryReadInt]](), except it returns an unsigned int (0 -> +4,294,967,295).
 +
 +
'handle' should be the variable that you obtained using [[Process_Functions#openProcess|openProcess]]().
 +
 +
'''Example'''
 +
<source lang="lua">
 +
-- This will read 0x0D2E0F90 on MyProcess and store it into HP
 +
HP = memoryReadUInt( myProcess, 0x0D2E0F90);
 +
if( HP <= 100 ) then
 +
  printf("Hp[%d] dropping too low!",HP);
 +
end
 +
</source>
 +
 +
 +
== memoryReadFloat ==
 +
'''float memoryReadFloat(handle, address)'''
 +
 +
Reads a float (floating point integer - may contain values such as 1.5 or 192083.0) from the specified process handle and address. The specified address may be in either [[decimal]] or [[hexadecimal]] form.
 +
 +
'handle' should be the variable that you obtained using [[Process_Functions#openProcess|openProcess]]().
 +
 +
'''Example'''
 +
<source lang="lua">
 +
-- This will read 0x0D2E0F90 on MyProcess and store it into HP
 +
HP = memoryReadFloat( myProcess, 0x0D2E0F90);
 +
if( HP <= 100 ) then
 +
  printf("Hp[%d] dropping too low!",HP);
 +
end
 +
</source>
 +
 +
 +
== memoryReadString ==
 +
'''string memoryReadString(handle, address)'''
 +
 +
Reads a NULL-terminated string from the specified process handle and address. Make sure it's NULL-terminated, or you will get an infinite loop! The specified address may be in either [[decimal]] or [[hexadecimal]] form.
 +
 +
'handle' should be the variable that you obtained using [[Process_Functions#openProcess|openProcess]]().
 +
 +
'''Example'''
 +
<source lang="lua">
 +
-- This will read 0x0D2E0F90 on MyProcess and store it into name
 +
name = memoryReadString( myProcess, 0x0D2E0F90);
 +
printf("Your character\'s name is %s\n", name);
 +
</source>
 +
 +
 +
== memoryReadBytePtr ==
 +
'''byte memoryReadBytePtr(handle, address, offset)'''
 +
 +
Reads a single byte from the specified address + offset from process denoted by 'handle'. This is exactly like [[Memory_Functions#memoryReadByte|memoryReadByte]] except that it reads from a pointer. If you do not need an offset, call this function with the offset parameter as 0.
 +
 +
'handle' should be the variable that you obtained using [[Process_Functions#openProcess|openProcess]]().
 +
 +
'''Example'''
 +
<source lang="lua">
 +
-- This will read (*0x0D2E0F90) + 0xA8 on MyProcess and store it into HP
 +
HP = memoryReadBytePtr( myProcess, 0x0D2E0F90, 0xA8);
 +
if( HP <= 100 ) then
 +
  printf("Hp[%d] dropping too low!",HP);
 +
end
 +
</source>
 +
 +
 +
== memoryReadShortPtr ==
 +
'''short memoryReadShortPtr(handle, address, offset)'''
 +
 +
Reads a short from the specified address + offset from process denoted by 'handle'. This is exactly like [[Memory_Functions#memoryReadShort|memoryReadShort]] except that it reads from a pointer. If you do not need an offset, call this function with the offset parameter as 0.
 +
 +
'handle' should be the variable that you obtained using [[Process_Functions#openProcess|openProcess]]().
 +
 +
'''Example'''
 +
<source lang="lua">
 +
-- This will read (*0x0D2E0F90) + 0xA8 on MyProcess and store it into HP
 +
HP = memoryReadShortPtr( myProcess, 0x0D2E0F90, 0xA8);
 +
if( HP <= 100 ) then
 +
  printf("Hp[%d] dropping too low!",HP);
 +
end
 +
</source>
 +
 +
 +
== memoryReadIntPtr ==
 +
'''int memoryReadIntPtr(handle, address, offset)'''
 +
 +
Reads an int from the specified address + offset from process denoted by 'handle'. This is exactly like [[Memory_Functions#memoryReadInt|memoryReadInt]] except that it reads from a pointer. If you do not need an offset, call this function with the offset parameter as 0.
 +
 +
'handle' should be the variable that you obtained using [[Process_Functions#openProcess|openProcess]]().
 +
 +
'''Example'''
 +
<source lang="lua">
 +
-- This will read (*0x0D2E0F90) + 0xA8 on MyProcess and store it into HP
 +
HP = memoryReadIntPtr( myProcess, 0x0D2E0F90, 0xA8);
 +
if( HP <= 100 ) then
 +
  printf("Hp[%d] dropping too low!",HP);
 +
end
 +
</source>
 +
 +
 +
== memoryReadUIntPtr ==
 +
'''unsigned int memoryReadIntPtr(handle, address, offset)'''
 +
 +
Reads an unsigned int from the specified address + offset from process denoted by 'handle'. This is exactly like [[Memory_Functions#memoryReadUInt|memoryReadUInt]] except that it reads from a pointer. If you do not need an offset, call this function with the offset parameter as 0.
 +
 +
'handle' should be the variable that you obtained using [[Process_Functions#openProcess|openProcess]]().
 +
 +
'''Example'''
 +
<source lang="lua">
 +
-- This will read (*0x0D2E0F90) + 0xA8 on MyProcess and store it into HP
 +
HP = memoryReadUIntPtr( myProcess, 0x0D2E0F90, 0xA8);
 +
if( HP <= 100 ) then
 +
  printf("Hp[%d] dropping too low!",HP);
 +
end
 +
</source>
 +
 +
 +
== memoryReadFloatPtr ==
 +
'''float memoryReadFloatPtr(handle, address, offset)'''
 +
 +
Reads a float from the specified address + offset from process denoted by 'handle'. This is exactly like [[Memory_Functions#memoryReadFloat|memoryReadFloat]] except that it reads from a pointer. If you do not need an offset, call this function with the offset parameter as 0.
 +
 +
'handle' should be the variable that you obtained using [[Process_Functions#openProcess|openProcess]]().
 +
 +
'''Example'''
 +
<source lang="lua">
 +
-- This will read (*0x0D2E0F90) + 0xA8 on MyProcess and store it into HP
 +
HP = memoryReadUIntPtr( myProcess, 0x0D2E0F90, 0xA8);
 +
if( HP <= 100 ) then
 +
  printf("Hp[%d] dropping too low!",HP);
 +
end
 +
</source>
 +
 +
 +
== memoryReadStringPtr ==
 +
'''float memoryReadStringPtr(handle, address, offset)'''
 +
 +
Reads a NULL-terminated string from the specified address + offset from process denoted by 'handle'. This is exactly like [[Memory_Functions#memoryReadString|memoryReadString]] except that it reads from a pointer. If you do not need an offset, call this function with the offset parameter as 0.
 +
 +
'handle' should be the variable that you obtained using [[Process_Functions#openProcess|openProcess]]().
 +
 +
'''Example'''
 +
<source lang="lua">
 +
-- This will read (*0x0D2E0F90) + 0xA8 on MyProcess and store it into name
 +
name = memoryReadUIntPtr( myProcess, 0x0D2E0F90, 0xA8);
 +
printf("Your character\'s name is", name);
 
</source>
 
</source>

Revision as of 07:14, 15 July 2008

Note that many of the functions here are very similar to each other. The only real difference between functions like memoryReadByte() and memoryReadInt() is the size (number of bytes) they read from the target process's memory space. You should use memory searching/editing software such as ArtMoney or Cheat Engine to figure out the size of the data type you are trying to read before you use these functions; reading the wrong number of bytes can result in erroneous information.


memoryReadByte

byte memoryReadByte(handle, address)

Reads a single byte (-128 -> +127) from the specified process handle and address. The specified address may be in either decimal or hexadecimal form.

'handle' should be the variable that you obtained using openProcess().


Example

-- This will read 0x0D2E0F90 on MyProcess and store it into HP
HP = memoryReadByte( myProcess, 0x0D2E0F90);
if( HP <= 100 ) then 
  printf("Hp[%d] dropping too low!",HP);
end


memoryReadShort

short memoryReadShort(handle, address)

Reads a short (2 bytes, -32,768 -> +32,767) from the specified process handle and address. The specified address may be in either decimal or hexadecimal form.

'handle' should be the variable that you obtained using openProcess().

Example

-- This will read 0x0D2E0F90 on MyProcess and store it into HP
HP = memoryReadShort( myProcess, 0x0D2E0F90);
if( HP <= 100 ) then 
  printf("Hp[%d] dropping too low!",HP);
end


memoryReadInt

int memoryReadShort(handle, address)

Reads an int (4 bytes, -2,147,483,648 -> +2,147,483,647) from the specified process handle and address. The specified address may be in either decimal or hexadecimal form.

'handle' should be the variable that you obtained using openProcess().

Example

-- This will read 0x0D2E0F90 on MyProcess and store it into HP
HP = memoryReadInt( myProcess, 0x0D2E0F90);
if( HP <= 100 ) then 
  printf("Hp[%d] dropping too low!",HP);
end


memoryReadUInt

unsigned int memoryReadShort(handle, address)

Exactly like memoryReadInt(), except it returns an unsigned int (0 -> +4,294,967,295).

'handle' should be the variable that you obtained using openProcess().

Example

-- This will read 0x0D2E0F90 on MyProcess and store it into HP
HP = memoryReadUInt( myProcess, 0x0D2E0F90);
if( HP <= 100 ) then 
  printf("Hp[%d] dropping too low!",HP);
end


memoryReadFloat

float memoryReadFloat(handle, address)

Reads a float (floating point integer - may contain values such as 1.5 or 192083.0) from the specified process handle and address. The specified address may be in either decimal or hexadecimal form.

'handle' should be the variable that you obtained using openProcess().

Example

-- This will read 0x0D2E0F90 on MyProcess and store it into HP
HP = memoryReadFloat( myProcess, 0x0D2E0F90);
if( HP <= 100 ) then 
  printf("Hp[%d] dropping too low!",HP);
end


memoryReadString

string memoryReadString(handle, address)

Reads a NULL-terminated string from the specified process handle and address. Make sure it's NULL-terminated, or you will get an infinite loop! The specified address may be in either decimal or hexadecimal form.

'handle' should be the variable that you obtained using openProcess().

Example

-- This will read 0x0D2E0F90 on MyProcess and store it into name
name = memoryReadString( myProcess, 0x0D2E0F90);
printf("Your character\'s name is %s\n", name);


memoryReadBytePtr

byte memoryReadBytePtr(handle, address, offset)

Reads a single byte from the specified address + offset from process denoted by 'handle'. This is exactly like memoryReadByte except that it reads from a pointer. If you do not need an offset, call this function with the offset parameter as 0.

'handle' should be the variable that you obtained using openProcess().

Example

-- This will read (*0x0D2E0F90) + 0xA8 on MyProcess and store it into HP
HP = memoryReadBytePtr( myProcess, 0x0D2E0F90, 0xA8);
if( HP <= 100 ) then
  printf("Hp[%d] dropping too low!",HP);
end


memoryReadShortPtr

short memoryReadShortPtr(handle, address, offset)

Reads a short from the specified address + offset from process denoted by 'handle'. This is exactly like memoryReadShort except that it reads from a pointer. If you do not need an offset, call this function with the offset parameter as 0.

'handle' should be the variable that you obtained using openProcess().

Example

-- This will read (*0x0D2E0F90) + 0xA8 on MyProcess and store it into HP
HP = memoryReadShortPtr( myProcess, 0x0D2E0F90, 0xA8);
if( HP <= 100 ) then
  printf("Hp[%d] dropping too low!",HP);
end


memoryReadIntPtr

int memoryReadIntPtr(handle, address, offset)

Reads an int from the specified address + offset from process denoted by 'handle'. This is exactly like memoryReadInt except that it reads from a pointer. If you do not need an offset, call this function with the offset parameter as 0.

'handle' should be the variable that you obtained using openProcess().

Example

-- This will read (*0x0D2E0F90) + 0xA8 on MyProcess and store it into HP
HP = memoryReadIntPtr( myProcess, 0x0D2E0F90, 0xA8);
if( HP <= 100 ) then
  printf("Hp[%d] dropping too low!",HP);
end


memoryReadUIntPtr

unsigned int memoryReadIntPtr(handle, address, offset)

Reads an unsigned int from the specified address + offset from process denoted by 'handle'. This is exactly like memoryReadUInt except that it reads from a pointer. If you do not need an offset, call this function with the offset parameter as 0.

'handle' should be the variable that you obtained using openProcess().

Example

-- This will read (*0x0D2E0F90) + 0xA8 on MyProcess and store it into HP
HP = memoryReadUIntPtr( myProcess, 0x0D2E0F90, 0xA8);
if( HP <= 100 ) then
  printf("Hp[%d] dropping too low!",HP);
end


memoryReadFloatPtr

float memoryReadFloatPtr(handle, address, offset)

Reads a float from the specified address + offset from process denoted by 'handle'. This is exactly like memoryReadFloat except that it reads from a pointer. If you do not need an offset, call this function with the offset parameter as 0.

'handle' should be the variable that you obtained using openProcess().

Example

-- This will read (*0x0D2E0F90) + 0xA8 on MyProcess and store it into HP
HP = memoryReadUIntPtr( myProcess, 0x0D2E0F90, 0xA8);
if( HP <= 100 ) then
  printf("Hp[%d] dropping too low!",HP);
end


memoryReadStringPtr

float memoryReadStringPtr(handle, address, offset)

Reads a NULL-terminated string from the specified address + offset from process denoted by 'handle'. This is exactly like memoryReadString except that it reads from a pointer. If you do not need an offset, call this function with the offset parameter as 0.

'handle' should be the variable that you obtained using openProcess().

Example

-- This will read (*0x0D2E0F90) + 0xA8 on MyProcess and store it into name
name = memoryReadUIntPtr( myProcess, 0x0D2E0F90, 0xA8);
printf("Your character\'s name is", name);