Ok ... Je veux que win32api WriteProcessMemory fonctionne.WriteProcessMemory
(Juste pour l'apprentissage WinAPI sur les plates-formes .Net!^___^)
J'utilise Nemerle mais la syntaxe est similaire C# et je peux lire le code C# vous.
Voici donc mon étapes:
1) obtenir gagner fonction api
[DllImport("kernel32.dll",SetLastError = true)]
public static extern WriteProcessMemory
(hProcess : IntPtr,
lpBaseAddress : int,
lpBuffer : array[byte],
nSize : int,
lpNumberOfBytesWritten : out int) : bool;
2) processus ouvert, obtenir des privilèges de débogage^_^et ... appeler la fonction
def WriteToMem(ProcessHandle : IntPtr, BaseAddress : int, NewVal : array[byte]) : bool
{
mutable BytesWritten : int = 0;
WriteProcessMemory(ProcessHandle, BaseAddress, NewVal, NewVal.Length, out BytesWritten)
}
3) paramètres:
PatchOptions.noerror =
if (this.textBox1.Text=="" && !this.checkBox1.Checked)
{
MessageBox.Show("Wind header caption could not be empty");
false
}
else
if (this.textBox4.Text=="" && this.checkBox1.Checked)
{
MessageBox.Show("Process Id could not be empty");
false
}
else
if (this.textBox2.Text=="")
{
MessageBox.Show("BaseAddress could not be empty");
false
}
else
if (this.textBox3.Text=="")
{
MessageBox.Show("NewValue could not be empty");
false
}
else
{
try
{
if(checkBox1.Checked)
{
PatchOptions.WinHeader=this.textBox4.Text.ToString();
PatchOptions.window=false;
}
else
{
PatchOptions.WinHeader=this.textBox1.Text.ToString();
PatchOptions.window=true;
}
PatchOptions.BaseAddress=Int32.Parse(this.textBox2.Text.ToString());
PatchOptions.NewValue=BitConverter.GetBytes(Int32.Parse(this.textBox3.Text.ToString()));
this.Close();
true
}
catch
{
e is Exception => MessageBox.Show("You entered incorrect values.");
false
}
}
4) Appel:
def isinjected() : string
{
if (Options.PatchOptions.noerror)
{
try
{
Memory.Patch(Options.PatchOptions.WinHeader,Options.PatchOptions.BaseAddress,Options.PatchOptions.NewValue,Options.PatchOptions.window);
}
catch
{
| e is Exception => MessageBox.Show("Memory Patching error");
""
}
}
else
{
MessageBox.Show("Patch options Error");
""
}
}
def injection = isinjected();
unless (injection=="")
this.label1.Text =injection;
5) Bloc-notes ShowStatus décalage: D (pour le test)
00b550d2 - 89 35 2c c0 b5 00 - mov [00b5c02c],esi
00b5509d - 89 3d 2c c0 b5 00 - mov [00b5c02c],edi
6) Convertir Hex à décembre en utilisant win Calc: (voici la difficulté)
00b550d2 = B550D2 = 11882706 ... j'espère que c'est correct (c'est l'adresse de base je suppose) hm ... qu'est-ce que NewValue? Et comment puis-je entrer dans tableau d'octets en entier: S
Aidez-moi s'il vous plaît> _ <
Si vous êtes juste essayer d'apprendre .NET, vous ne devriez probablement pas commencer par 'WriteProcessMemory', ce qui est extrêmement compliqué et généralement pas utile. –