Hello
After trying for hours and googling around i give up, also used the search here and couldn't find anything that i'm looking for.
I'm trying to make a windows form application where the "user" can enter a offset & new value to be written to the offset.
I've been trying to do it with Console.ReadLine(is there a better way?) and 2 textbox but it kept writing 0x00000000
Example1:
Textbox1>Offset: 0x00001234
Textbox2>Value: 9A05FF80
http://i.imgur.com/733ySBV.jpg
also how about this? instead of offset+value it would be find&replace.
Example2:
Textbox1>Find: whatever the user inputs (example: 6316707C6301947C6307B4E80100C07C)
Textbox2>Replace: whatever the user inputs as new(example: 1F011F3751F5FBA34719F514236FB1B3)
Best Regards
Loading
VulpesPosted May 12, 2013, 11:57 AM
I've added code to my previous effort to get the offset and value from the user including some rudimentary error handling.
For now, I've stuck to 4 byte offsets and values as I'm not sure how a greater number of bytes should be distributed amongst the arrays:
jihyePosted May 12, 2013, 4:43 PM
Although i dislike the way the offset is being read
0x00010203 = 0x00000000-0x00000003
jihyePosted May 11, 2013, 9:32 PM
I'd like to be able to use it with ReadLine(); -unless of course there is something better than ReadLine- on a textbox so it retrieves the offset the user writes and also adds the value entered by the user.
Like the function "find & replace" at an Hex Editor but instead of find it would be "go to" offset and replace.
I'm too afraid to post my C# code cause you gonna laugh so i'll post something in C++ again :)
This would be used with the C++ code above.
int offset;
cout << "Offset:";
cin >> offset;
int data;
cout << "Value:";
cin >> data;
VulpesPosted May 11, 2013, 7:00 PM
That C++ code would translate to this in C# and writes "Hero" starting at offset D2:
jihyePosted May 11, 2013, 4:17 PM
Like this code in C++, however this is in C++ and it's not with cout/cin and besides i gave up on C++ for now.
int main() {
ofstream f("FILE", ios::in | ios::out | ios::binary);
if (f.fail()) return -1;
int offset[] = {0x000000D2};
int offset_2[] = {0x000000D3};
int offset_3[] = {0x000000D4};
int offset_4[] = {0x000000D5};
char data[] = {0x48};
char data_2[] = {0x65};
char data_3[] = {0x72};
char data_4[] = {0x6F};
for (int i=0; i
f.put(data[i]);
f.seekp(offset_2[i], ios::beg);
f.put(data_2[i]);
f.seekp(offset_3[i], ios::beg);
f.put(data_3[i]);
f.seekp(offset_4[i], ios::beg);
f.put(data_4[i]);
}
f.close();
return 0;
}
VulpesPosted May 11, 2013, 1:15 PM
Why would you want to do this anyway as you're likely to corrupt the heap?