unknowncheats uc-forum.com ucdownloads ucdownloads.com

Go Back   UC-Tutorials - Multiplayer Game Hacking and Cheat Tutorials > Programming > .NET

- Sponsored Advertisement -
http://www.myfpscheats.com/


Reply
 
Thread Tools Display Modes
  #1  
Old 08-08-2010, 11:16 AM
shad0w_ shad0w_ is offline
Junior Member
 
Join Date: Aug 2010
Posts: 16
Default (C#) Dll Injection Class

Original Thread: http://www.uc-forum.com/forum/net/44...ion-class.html

By CopyrightPhilly



ok heres my C# code made in MS C# 05

ok the main function here is:
InjectIt(int PROCESSID,string "DLLNAME");
this will return true or false, true being it injected without errors, false meaning it failed...

it also has a couple of other functions,
like get hwnd from title and so on but i;m sure you can work out how to use then

cheers;
Philly

[NOTE]
You do NOT have permission to share this on any other site, portal or forum. It is exclusive to UC

PHP Code:
// DLL INJECTOR BY COPYRIGHTPHILLY
// FIND MORE AT unknowncheats.com
// WHO SAYS C# IS RUBISH? I LIKE IT! (WELL, AT LEAST ITS BETTER THEN VB6)
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace 
Injection.Functions
{
class 
Misc
{
[
DllImport("User32.dll")]
public static 
extern int MessageBox(int hstring mstring cint type);
}
class 
Injector
{
[
DllImport("kernel32.dll")]
public static 
extern int OpenProcess(int dwDesiredAccessint bInheritHandleint dwProcessId);
[
DllImport("kernel32.dll")]
public static 
extern int VirtualAllocEx(int hProcessint lpAddressint dwSizeint flAllocationTypeint flProtect);
[
DllImport("kernel32.dll")]
public static 
extern bool WriteProcessMemory(int hProcessint lpBaseAddressbyte[] lpBufferint nSize,out uint lpNumberOfBytesWritten);
[
DllImport("kernel32.dll")]
public static 
extern int GetProcAddress(int hModule,string lpProcName);
[
DllImport("kernel32.dll")]
public static 
extern int GetModuleHandle(string lpModuleName);
[
DllImport("kernel32.dll")]
public static 
extern int CreateRemoteThread(int hProcess,int lpThreadAttributes,int dwStackSize,int lpStartAddress,int lpParameter,int dwCreationFlags,int lpThreadId);
[
DllImport("kernel32.dll")]
public static 
extern int WaitForSingleObject(int hHandle,int dwMilliseconds);
[
DllImport("kernel32.dll")]
public static 
extern int CloseHandle(int hObject);
public static 
Boolean InjectIt(int ProcessIDstring DLLPath)
{
int DProc;
int DAdd;
int i;
DProc OpenProcess(0x1F0FFF1ProcessID);
DAdd VirtualAllocEx(DProc0DLLPath.Length0x10000x04);
if (
DAdd 0)
{
byte [] DByte = new byte[DLLPath.Length];
for (
;DLLPath.Lengthi++)
{
string DCTmp DLLPath.Substring(i1);
char DHTmp Convert.ToChar(DCTmp);
int DITmp Convert.ToInt32(DHTmp);
DByte[i] = Convert.ToByte(DITmp);
}
uint DWrote;
WriteProcessMemory(DProcDAddDByteDLLPath.Lengthout DWrote);
int DALL;
int DTHE;
DALL GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA");
DTHE CreateRemoteThread(DProc,0,0,DALL,DAdd,0,0);
if (
DTHE 0)
{
WaitForSingleObject(DTHE20000);
CloseHandle(DTHE);
return 
true;
} else {
return 
false;
}
}
else
{
return 
false;
}
}
}
class 
ProID
{
[
DllImport("User32.dll")]
public static 
extern int FindWindow(string lpClassNamestring lpWindowName);
[
DllImport("User32.dll")]
public static 
extern int GetWindowThreadProcessId(int hWndout int lpdwProcessId);
}

Reply With Quote
Reply

  • Submit Thread to Digg
  • Submit Thread to del.icio.us
  • Submit Thread to StumbleUpon
  • Submit Thread to Google
  • Submit Thread to Facebook
  • Submit Thread to My Yahoo!
  • Submit Thread to MySpace
  • Submit Thread to Twitter
  • Submit Thread to Reddit

Tags
class, dll, injection

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 04:42 PM.