Note that there are some explanatory texts on larger screens.

plurals
  1. POSearching Memory For Specific Values C# (Xbox 360)
    primarykey
    data
    text
    <p><em>EDIT: I think I have an idea of a possible solution for the actual searching of values. By making sure the user input ends in 0 the issue should be resolved. This would involve subtracting the last digit from the uint (which I do not know how to get, unless I go the convert to string, trim end back to uint method which is ugly but I guess it could work) and then subtracting it. If anyone has any tips on how to do this please help me out!</em></p> <p>I've been working on a program to search memory on the Xbox 360 for specific values, if you are familiar, it is similar to "Cheat Engine". I've gotten the basics down, but I just ran into an issue. My method to search memory is dependent on starting your search at an address that will line up with your value. If that doesn't make sense to you here is the code:</p> <pre><code>private void searchInt32(int Value, uint Address, uint BytesToSearch) { for (uint i = 0; i &lt;= BytesToSearch; i+=4) { int recoveredMem = XboxSupport.littleEndtoInt(XboxSupport.GetMem(Address + i, 4), 0); //Recover Memory (As Bytes) and convert to integer from address (incremented based on for loop) if (recoveredMem == Value) //Check if recovered mem = search value { writeToFile(Address + i, Convert.ToString(Value)); //If recovered mem = search value, write to a text file } siStatus.Caption = String.Format("Searching Bytes {0} out of {1}...", i, BytesToSearch); //Update status caption } } </code></pre> <p>As you can see, the code is kept to a minimum and it's also about as fast as possible when it comes to recovering memory from a console. But, if the 4 bytes it recovers don't line up with the value, it will never return what you want. That's obviously a serious issue because the user won't know where their value is or what address to start at to return the correct value. I then attempted to use the following code to fix the issue: </p> <pre><code>private void searchUInt32(uint Value, uint Address, uint BytesToSearch) { siStatus.Caption = String.Format("Recovering Memory..."); byte[] data = XboxSupport.GetMem(Address, BytesToSearch); //Dump Console Memory FileStream output = new FileStream("SearchData.dat", FileMode.Create); BinaryWriter writer = new BinaryWriter(output); writer.Write(data); //Write dump to file writer.Close(); output = new FileStream("SearchData.dat", FileMode.Open); BinaryReader reader = new BinaryReader(output); //Open dumped file for (uint i = 0; i *4 &lt; reader.BaseStream.Length; i++) { byte[] bytes = reader.ReadBytes(4); //Read the 4 bytes Array.Reverse(bytes); uint currentValue = BitConverter.ToUInt32(bytes, 0); //Convert to UInt if(currentValue == Value) //Compare writeToFile(Address + i * 4, Convert.ToString(Value)); siStatus.Caption = String.Format("Searching Bytes {0} out of {1}...", i * 4, BytesToSearch); } reader.Close(); File.Delete("SearchData.dat"); } </code></pre> <p>There is a lot more code, but essentially it does the same thing, just using a file. My original goal was to have users be able to input their own memory blocks to be searched, but right now it seems that just won't work. I do not really want to have the program search all of the memory because that might end up being a slow process (depending on the size of the process being dumped) and often times the values being looked for can be narrowed down to areas of writeable code, removing junk addresses from the executable portion of the process. I am just looking to see if anyone has any suggestions, I was thinking I could possibly get the entry address from the process (I have a function for it) and using a little math correct user input addresses to work properly but I wasn't entirely sure how to do it. If anyone has any suggestions or solutions I'd appreciate any help I can get. If any of my post needs to be clarified/cleaned up please let me know, I'll be glad to do anything that might help me to an answer. Thanks!</p> <p>Edit: Temporary (hopefully) Solution: </p> <p>When I load addresses into the tool they are loaded as strings from a text file, then a conversion to uint is attempted. I solved the not even issue using the following code:</p> <pre><code>sA[0] = sA[0].Remove(sA[0].Length - 1) + "0"; //Remove last character and replace w/ 0 //Add 16 to the search length </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload