OK Thank all boys...I'll try to explain what i want better:
Well...this is the code I used:
code:
function Hex(number) {return number.toString(16).toUpperCase()}//function by CookieRevised
function SetDataPatch(string){
var newstring=0
for (var i=0;i<string.length;i++){
newstring += "\x" + Hex(string.charCodeAt(i)) + "\x00"}
Debug.Trace(newstring)
return newstring}
function Patch(nAddress, sByteString) {
var sBuffer = Interop.Allocate(++sByteString.length);
for (var j = 0; j < sByteString.length; j++) sBuffer.WriteWORD(j, sByteString.charCodeAt(j));
var hProc = Interop.Call("Kernel32", "GetCurrentProcess");
Interop.Call("Kernel32", "WriteProcessMemory", hProc, nAddress, sBuffer.DataPtr, sByteString.length, 0);
}//Function By CookieRevised
i need to make a function that return in hex the bytes that i have to write in memory but i don't know i have to do it...example
if i used this code
This code:
code:
Patch(0x5F6D5C,"\x00\xFF\xFC")
it works perfectly
but i need to make the sByteString because it is not the constant and the data i have to write memory is an unicode string so i add to my function + "\x00"....for example if i pass to SetPatchData funtion this string "Example" i need to return
"\x45\x00\x78\x00\x61\x00\x6D\x00\x70\x00\x6C\x00\x65\x00"
that then i pass to Patch function.....if i use "\\x" instead "\x" don't work because the data that return is not in hex...
I hope that you understand me....
Thanks in advice and sorry for my english