Win32 Exception: 0xc0000005 | dll injection - c#

So today I tried dll injection to game (assult cube) to test my experience with my job.
But I got problems with Win32 Exception: 0xc0000005.
My code looks like:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Memory;
namespace AssultCube_Cheat
{
public partial class Form1 : Form
{
Mem assultcube = new Mem();
public static string RifleAmmo = "ac_client.exe+0x0017E0A8";
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
int PID = assultcube.GetProcIdFromName("ac_client");
if (PID > 0)
{
assultcube.OpenProcess(PID);
Thread WA = new Thread(writeAmmo) { IsBackground = true };
WA.Start();
}
}
private void writeAmmo()
{
while (true)
{
if (checkBox1.Checked)
{
assultcube.WriteMemory(RifleAmmo, "int", "80");
Thread.Sleep(2);
}
Thread.Sleep(2);
}
}
}
}
I tried updating my computer drivers, upgrading my system to Windows 11 but problem didnt fix.

Related

C# client SocketIoClientDotNet.Client is not work(node server)

C# WinForms client:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Quobject.SocketIoClientDotNet.Client;
namespace socket_TEST
{
#nullable enable
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
connect();
}
public void connect()
{
var socket = IO.Socket("http://127.0.0.1:3000/");
socket.On(Socket.EVENT_CONNECT, () =>
{
MessageBox.Show("connection!");
});
socket.On("connection", () =>
{
MessageBox.Show("connection!");
});
}
}
}
Nodejs server:
const app=require('express')();
const server=require('http').Server(app);
const io=require('socket.io')(server);
io.sockets.on("connection",function(socket){
console.log("new client");
});
server.listen(3000,function(){
console.log("------SERVER RUNNING------");
});
I want to connect C# and Nodejs servers.
But the connection is still not working. Can you tell me why and how should I solve it?
i see SocketIoClientDotNet THIS PROJECT IS DEPRECATED

How to prevent the running of rename application?

With this code I can prevent a duplicate application from running the name given in the code .
But after the application is created, the name of that application (exe) can be changed and run multiple times in the same machine.
How to prevent it from running?
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Demo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.Text = "Demo";
int ac = System.Diagnostics.Process.GetProcessesByName(System.IO.Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetEntryAssembly().Location)).Count();
if (ac > 1)
{
MessageBox.Show("Application Already Running");
this.Close();
}
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("Hello World");
}
}
}```

C# Trying to find the RobloxPlayerBeta

Here is my code: I am trying to find the roblox PlayerBeta but its not working
I am not the best in coding but I found out how to find it but cant implent it right into the code
( EDIT ) The program works if I use the PID but that changes everytime I open up a new RobloxPlayerBeta ! so I cannot use that
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Memory;
using System.Diagnostics;
namespace ForceField
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Mem MemLib = new Mem();
private void button1_Click(object sender, EventArgs e)
{
if (System.Diagnostics.Process.GetProcesses().Any((p) => p.ProcessName.Contains("RobloxPlayerBeta")))
{
int robloxPid = System.Diagnostics.Process.GetProcessesByName("RobloxPlayerBeta").FirstOrDefault().Id;
}
Console.WriteLine(robloxPid);
MemLib.writeMemory("0x184C3A98", "string", "PlsNoBan ");
Console.WriteLine(MemLib.readString("0x184C3A98"));
}
}
}
Omg I am stupid.. xD
I needed to do MemLib.OpenGameProcess(robloxPid)

Dll does not seem to be read, why?

I am creating a application form to view/change a tag from a software called InTouch.
I added the dll as a reference and I would like to use the Read(string tagName) fct in the IOM.InTouchDataAccess. VS does not see the fct Read when I write InTouchWrapper TagType = new read(). It only sees InTouchWrapper as I wrote in the code which gives me the error IOM.InTouchDataAccess.InTouchWrapper' does not contain a constructor that takes 0 arguments
I don't understand why is this happening. I am running the InTouch software while coding, maybe there is an access conflict with the software.
MyCode
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using IOM.InTouchDataAccess;
namespace TagBrowser
{
public partial class TagBrowser : Form
{
public TagBrowser()
{
InitializeComponent();
}
private void TagBrowser_Load(object sender, EventArgs e)
{
}
private void TagBox_TextChanged(object sender, EventArgs e)
{
}
private void TypeBox_SelectedIndexChanged(object sender, EventArgs e)
{
InTouchWrapper TagType = new InTouchWrapper();
}
The dll
using System;
using System.Collections.Generic;
using System.Text;
using NDde.Client;
namespace IOM.InTouchDataAccess
{
public class InTouchDdeWrapper : IDisposable
{
private int DDE_TIMEOUT = 60000;
private DdeClient _ddeClient;
public InTouchDdeWrapper()
{
_ddeClient = new DdeClient("View", "Tagname");
}
~InTouchDdeWrapper()
{
Dispose();
}
public void Initialize()
{
_ddeClient.Connect();
}
public string Read(string tagName)
{
return _ddeClient.Request(tagName, DDE_TIMEOUT).Replace("\0", "");
}
I'm putting this here in case somebody else would get the same problem:
Are you sure it's the correct dll you referenced? Try to open the
exact referenced dll in a decompiler (JustDecompile free,
Reflector or dotPeek free) and see if it's the code you
expect.

NullReferenceException was unhandled, when making SlimDX screen capture in C#

Trying to make a screenshot with SlimDX:
using System;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using SlimDX.Direct3D9;
using SlimDX;
namespace dxcapture
{
public partial class Form1 : Form
{
public Device device;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
using (SlimDX.Direct3D9.Surface surface = device.GetRenderTarget(0))
{
using (SlimDX.Direct3D9.Surface surface2 = SlimDX.Direct3D9.Surface.CreateOffscreenPlain(device, surface.Description.Width, surface.Description.Height, surface.Description.Format, SlimDX.Direct3D9.Pool.SystemMemory))
{
device.GetRenderTargetData(surface, surface2);
Bitmap bitmap = new Bitmap(SlimDX.Direct3D9.Surface.ToStream(surface2, SlimDX.Direct3D9.ImageFileFormat.Bmp, new Rectangle(0, 0, 110, 110)));
bitmap.Save(#"c:\wqwqwqwqwqwqwqwq.bmp");
}
}
}
}
}
Getting an error:
NullReferenceException was unhandled.
Object reference not set to an instance of an object.
at the line:
using (SlimDX.Direct3D9.Surface surface = device.GetRenderTarget(0))
What am I doing wrong?
You never initialize 'device'.
You havepublic Device device; in the class definition but its never assigned.

Categories

Resources