Memory Functions
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.
The difference between signed and unsigned types is also important. Signed types are those which can be positive or negative. Unsigned types are not denoted as either positive or negative, and so can encompass larger numbers. For example, a byte (also known as a char [character]), can hold a value of -128 to +127. An unsigned byte can hold a value of 0 to 255. If you mix the reading/writing of signed with unsigned, the values will appear erroneous. That is because signed -125 would be equal to unsigned 3.
Contents
- 1 memoryReadByte
- 2 memoryReadShort
- 3 memoryReadInt
- 4 memoryReadUInt
- 5 memoryReadFloat
- 6 memoryReadString
- 7 memoryReadBytePtr
- 8 memoryReadShortPtr
- 9 memoryReadIntPtr
- 10 memoryReadUIntPtr
- 11 memoryReadFloatPtr
- 12 memoryReadStringPtr
- 13 memoryWriteByte
- 14 memoryWriteShort
- 15 memoryWriteInt
- 16 memoryWriteUInt
- 17 memoryWriteFloat
- 18 memoryWriteBytePtr
- 19 memoryWriteShortPtr
- 20 memoryWriteIntPtr
- 21 memoryWriteUIntPtr
- 22 memoryWriteFloatPtr
memoryReadByte
byte,bool memoryReadByte(handle, address)
Reads and returns a single byte (-128 -> +127) from the specified process handle and address. The specified address may be in either decimal or hexadecimal form.
This function will also return a second value: true or false. If the value is true, the function was successful, otherwise, it has failed to read the memory. In the case of a failure, the first value returned will also be 0.
'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,bool 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.
This function will also return a second value: true or false. If the value is true, the function was successful, otherwise, it has failed to read the memory. In the case of a failure, the first value returned will also be 0.
'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,bool 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.
This function will also return a second value: true or false. If the value is true, the function was successful, otherwise, it has failed to read the memory. In the case of a failure, the first value returned will also be 0.
'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,bool memoryReadShort(handle, address)
Exactly like memoryReadInt(), except it returns an unsigned int (0 -> +4,294,967,295).
This function will also return a second value: true or false. If the value is true, the function was successful, otherwise, it has failed to read the memory. In the case of a failure, the first value returned will also be 0.
'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,bool 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.
This function will also return a second value: true or false. If the value is true, the function was successful, otherwise, it has failed to read the memory. In the case of a failure, the first value returned will also be 0.
'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,bool 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.
This function will also return a second value: true or false. If the value is true, the function was successful, otherwise, it has failed to read the memory. In the case of a failure, the first value returned will also be 0.
'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,bool 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.
This function will also return a second value: true or false. If the value is true, the function was successful, otherwise, it has failed to read the memory. In the case of a failure, the first value returned will also be 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,bool 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.
This function will also return a second value: true or false. If the value is true, the function was successful, otherwise, it has failed to read the memory. In the case of a failure, the first value returned will also be 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,bool 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.
This function will also return a second value: true or false. If the value is true, the function was successful, otherwise, it has failed to read the memory. In the case of a failure, the first value returned will also be 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,bool 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.
This function will also return a second value: true or false. If the value is true, the function was successful, otherwise, it has failed to read the memory. In the case of a failure, the first value returned will also be 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,bool 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.
This function will also return a second value: true or false. If the value is true, the function was successful, otherwise, it has failed to read the memory. In the case of a failure, the first value returned will also be 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
string,bool 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.
This function will also return a second value: true or false. If the value is true, the function was successful, otherwise, it has failed to read the memory. In the case of a failure, the first value returned will also be 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);
memoryWriteByte
bool memoryWriteByte(handle, address, data)
Writes a single byte (-128 -> +127) to the specified process handle at the specified address. The specified address may be in either decimal or hexadecimal form. 'data' will be the value you want to write to memory.
This function will return true or false. If the value is true, the function was successful, otherwise, it has failed to read the memory.
'handle' should be the variable that you obtained using openProcess().
Example
-- This will write 123 to 0x0D2E0F90 on MyProcess
myData = 123;
success = memoryWriteByte(myProcess, 0x0D2E0F90, myData);
if( success == false ) then
printf("Failed to write memory\n");
end
memoryWriteShort
bool memoryWriteShort(handle, address, data)
Writes a short (2 bytes, -32,768 -> +32,767) to the specified process handle at the specified address. The specified address may be in either decimal or hexadecimal form. 'data' will be the value you want to write to memory.
This function will return true or false. If the value is true, the function was successful, otherwise, it has failed to read the memory.
'handle' should be the variable that you obtained using openProcess().
Example
-- This will write 123 to 0x0D2E0F90 on MyProcess
myData = 123;
success = memoryWriteShort(myProcess, 0x0D2E0F90, myData);
if( success == false ) then
printf("Failed to write memory\n");
end
memoryWriteInt
bool memoryWriteInt(handle, address, data)
Writes an int (4 bytes, -2,147,483,648 -> +2,147,483,647) to the specified process handle at the specified address. The specified address may be in either decimal or hexadecimal form. 'data' will be the value you want to write to memory.
This function will return true or false. If the value is true, the function was successful, otherwise, it has failed to read the memory.
'handle' should be the variable that you obtained using openProcess().
Example
-- This will write 123 to 0x0D2E0F90 on MyProcess
myData = 123;
success = memoryWriteInt(myProcess, 0x0D2E0F90, myData);
if( success == false ) then
printf("Failed to write memory\n");
end
memoryWriteUInt
bool memoryWriteUInt(handle, address, data)
Writes an unsigned int (0 -> +4,294,967,295) to the specified process handle at the specified address. The specified address may be in either decimal or hexadecimal form. 'data' will be the value you want to write to memory.
This function will return true or false. If the value is true, the function was successful, otherwise, it has failed to read the memory.
'handle' should be the variable that you obtained using openProcess().
Example
-- This will write 123 to 0x0D2E0F90 on MyProcess
myData = 123;
success = memoryWriteUInt(myProcess, 0x0D2E0F90, myData);
if( success == false ) then
printf("Failed to write memory\n");
end
memoryWriteFloat
bool memoryWriteFloat(handle, address, data)
Writes a float (4 bytes, -128 -> +127) to the specified process handle at the specified address. The specified address may be in either decimal or hexadecimal form. 'data' will be the value you want to write to memory.
This function will return true or false. If the value is true, the function was successful, otherwise, it has failed to read the memory.
'handle' should be the variable that you obtained using openProcess().
Example
-- This will write 123.5 to 0x0D2E0F90 on MyProcess
myData = 123.5;
success = memoryWriteFloat(myProcess, 0x0D2E0F90, myData);
if( success == false ) then
printf("Failed to write memory\n");
end
memoryWriteBytePtr
bool memoryWriteBytePtr(handle, address, offset, data)
Writes a single byte to the specified process handle at the specified address + offset. The specified address may be in either decimal or hexadecimal form. 'data' will be the value you want to write to memory. If you do not need an offset, call this function with the offset parameter as 0.
This function will return true or false. If the value is true, the function was successful, otherwise, it has failed to read the memory.
'handle' should be the variable that you obtained using openProcess().
Example
-- This will write 123 to (*0x0D2E0F90) + 0xA8 on MyProcess
myData = 123;
success = memoryWriteBytePtr(myProcess, 0x0D2E0F90, 0xA8, myData);
if( success == false ) then
printf("Failed to write memory\n");
end
memoryWriteShortPtr
bool memoryWriteShortPtr(handle, address, offset, data)
Writes a short to the specified process handle at the specified address + offset. The specified address may be in either decimal or hexadecimal form. 'data' will be the value you want to write to memory. If you do not need an offset, call this function with the offset parameter as 0.
This function will return true or false. If the value is true, the function was successful, otherwise, it has failed to read the memory.
'handle' should be the variable that you obtained using openProcess().
Example
-- This will write 123 to (*0x0D2E0F90) + 0xA8 on MyProcess
myData = 123;
success = memoryWriteShortPtr(myProcess, 0x0D2E0F90, 0xA8, myData);
if( success == false ) then
printf("Failed to write memory\n");
end
memoryWriteIntPtr
bool memoryWriteIntPtr(handle, address, offset, data)
Writes an int to the specified process handle at the specified address + offset. The specified address may be in either decimal or hexadecimal form. 'data' will be the value you want to write to memory. If you do not need an offset, call this function with the offset parameter as 0.
This function will return true or false. If the value is true, the function was successful, otherwise, it has failed to read the memory.
'handle' should be the variable that you obtained using openProcess().
Example
-- This will write 123 to (*0x0D2E0F90) + 0xA8 on MyProcess
myData = 123;
success = memoryWriteIntPtr(myProcess, 0x0D2E0F90, 0xA8, myData);
if( success == false ) then
printf("Failed to write memory\n");
end
memoryWriteUIntPtr
bool memoryWriteUIntPtr(handle, address, offset, data)
Writes an unsigned int to the specified process handle at the specified address + offset. The specified address may be in either decimal or hexadecimal form. 'data' will be the value you want to write to memory. If you do not need an offset, call this function with the offset parameter as 0.
This function will return true or false. If the value is true, the function was successful, otherwise, it has failed to read the memory.
'handle' should be the variable that you obtained using openProcess().
Example
-- This will write 123 to (*0x0D2E0F90) + 0xA8 on MyProcess
myData = 123;
success = memoryWriteUIntPtr(myProcess, 0x0D2E0F90, 0xA8, myData);
if( success == false ) then
printf("Failed to write memory\n");
end
memoryWriteFloatPtr
bool memoryWriteFloatPtr(handle, address, offset, data)
Writes a float to the specified process handle at the specified address + offset. The specified address may be in either decimal or hexadecimal form. 'data' will be the value you want to write to memory. If you do not need an offset, call this function with the offset parameter as 0.
This function will return true or false. If the value is true, the function was successful, otherwise, it has failed to read the memory.
'handle' should be the variable that you obtained using openProcess().
Example
-- This will write 123.5 to (*0x0D2E0F90) + 0xA8 on MyProcess
myData = 123.5;
success = memoryWriteFloatPtr(myProcess, 0x0D2E0F90, 0xA8, myData);
if( success == false ) then
printf("Failed to write memory\n");
end