Hi guys im here to bring to you an easy way to make a NOP in C#.
N.O.P. = No Operation (computer processor instruction)
I think this might help someone, anyway...
Credits: itsmods.com for some help
Thanks Barata...
N.O.P. = No Operation (computer processor instruction)
CSHARP Code
- using System;
- using System.IO;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using System.Diagnostics;
- using System.Runtime.InteropServices;
- using System.Threading;
-
- namespace mw3_t
- {
- public partial class Form1 : Form
- {
- private static int ProcessID = -1;
- private static IntPtr ProcessHandle = IntPtr.Zero;
-
- [DllImport("kernel32.dll", EntryPoint = "WriteProcessMemory")]
- private static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, uint nSize, [Out] int lpNumberOfBytesWritten);
-
-
- [DllImport("kernel32.dll", EntryPoint = "ReadProcessMemory")]
- private static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out] byte[] lpBuffer, int dwSize, [Out] int lpNumberOfBytesRead);
-
- [DllImport("kernel32.dll", EntryPoint = "OpenProcess")]
- private static extern IntPtr OpenProcess(uint dwDesiredAccess, bool bInheritHandle, int dwProcessId);
-
- public Form1()
- {
- InitializeComponent();
- }
-
- private void Form1_Load(object sender, EventArgs e)
- {
- System.Diagnostics.Process[] myprocesses = System.Diagnostics.Process.GetProcessesByName("iw5sp");
- if (myprocesses.Length != 0)
- {
- Process[] processes = Process.GetProcessesByName("iw5sp"); // in the "iw5sp" is the name of the process
- ProcessID = processes[0].Id;
- ProcessHandle = OpenProcess(0x001F0FFF/*PROCESS_ALL_ACCESS*/, false, ProcessID);
- byte[] nop = { 0x90, 0x90, 0x90, 0x90, 0x90 };// 5 bytes
- WriteProcessMemory(ProcessHandle, (IntPtr)0x004ECF46, nop, 5/*amount of bytes written(5)*/, 0);
- }
- }
- }
- }
I think this might help someone, anyway...
Credits: itsmods.com for some help
Thanks Barata...
Don't worry if things aren't the way you planned, in the end everything will solve itself...