Hi can you help me im getting 2 errors

Hi, the error is pretty obvious, injectDLL is not a member of dllInject.

If it's you who made the class then make sure everything is spelled correctly, or perhaps you're missing the type of the function, we can't know unless we see it, otherwise look up the documentation.
Last edited on
Main Cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// ConsoleApplication2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "hook.h"
#include <string>

using namespace std;

int main()
{
	string input;
	string _input;
	dllInjector dllInject;
	cout << "Please Enter path to your dll" << endl;
	cin >> input;
	dllInject._dllPath = input;
	cout << "Please Enter target process name." << endl;
	cin >> _input;
	dllInject.injectDLL(_input);
	system("pause");
}


HOOK.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include <windows.h>
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <tlhelp32.h>
#include <sys/stat.h> 

using namespace std;

class dllInjector
{
public:
	string _dllPath;
	int privileges();
	BOOL injectDll(string procName);
	dllInjector();

	DWORD getPid(string procName);
	int fexist(char *filename);
};

dllInjector::dllInjector() 
{
	dllInjector::privileges();
}

int dllInjector::privileges() 
{
	HANDLE Token;

	TOKEN_PRIVILEGES tp;
	if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &Token))
	{
		LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &tp.Privileges[0].Luid);
		tp.PrivilegeCount = 1;
		tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
		if (AdjustTokenPrivileges(Token, 0, &tp, sizeof(tp), NULL, NULL) == 0) {
			return 1; //FAIL
		}
		else 
		{
			return 0; //SUCCESS
		}
	}
	return 1;
}

BOOL dllInjector::injectDll(string procName) 
{
	char dll[MAX_PATH];

	strcpy(dll, _dllPath.c_str());
	if (fexist(dll) != 0) return false;
	DWORD id = getPid(procName);
	if (id == 0) return false;

	HANDLE p;
	p = OpenProcess(PROCESS_ALL_ACCESS, false, id);

	if (p == NULL) return false;

	LPVOID mem = VirtualAllocEx(p, NULL, sizeof(dll), MEM_COMMIT, PAGE_READWRITE);
	WriteProcessMemory(p, mem, dll, sizeof(dll), NULL);
	HANDLE thread = CreateRemoteThread(p, NULL, 0, (LPTHREAD_START_ROUTINE)GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA"), mem, 0, NULL);
	BOOL done;
	if (thread != 0)
	{
		done = false;
	}
	else 
	{
		done = true;
	}
	CloseHandle(p);
	return done;
}

DWORD dllInjector::getPid(string procName)
{
	HANDLE hsnap;
	PROCESSENTRY32 pt;
	hsnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
	pt.dwSize = sizeof(PROCESSENTRY32);
	do 
	{
		if (pt.szExeFile == procName) 
		{
			DWORD pid = pt.th32ProcessID;
			CloseHandle(hsnap);
			return pid;
		}
	} while (Process32Next(hsnap, &pt));
	CloseHandle(hsnap);
	return 0;
}

int dllInjector::fexist(char *filename) 
{
	struct stat buffer;
	if (stat(filename, &buffer)) return 1;
	return 0;
}
Your function is called injectDll, not injectDLL.

dllInject.injectDLL(_input); // injectDLL

BOOL dllInjector::injectDll(string procName) // injectDll
Last edited on
you are genius thanks man <3 you
Happy to help =) Goodluck!
the programm started to working but from debuuging i got this
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Users\Ga40\Documents\Visual Studio 2015\Projects\ConsoleApplication2\Debug\ConsoleApplication2.exe'. Symbols loaded.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'. Cannot find or open the PDB file.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140d.dll'. Cannot find or open the PDB file.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp140d.dll'. Cannot find or open the PDB file.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'. Cannot find or open the PDB file.
'ConsoleApplication2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel.appcore.dll'. Cannot find or open the PDB file.
The thread 0x10ec has exited with code 0 (0x0).
The thread 0x1aa4 has exited with code 0 (0x0).
The thread 0x230c has exited with code 0 (0x0).
The program '[4588] ConsoleApplication2.exe' has exited with code 0 (0x0).
Last edited on
I fixed it dll injector works perectly fine

But now i wanted to make it automaticly to inject whitout typeing the coardinates
and it stoped working. Swiched back to the manual input and it worked fine.

Dosent work

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// ConsoleApplication2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "hook.h"
#include <string>

using namespace std;

int main()
{
	string input = "C:\lol.dll";
	string _input = "RebusDrop.exe";
	dllInjector Inject;
	Inject._dllPath = input;
	Inject.injectDll (_input);
	system("pause");
}


Works fine

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// ConsoleApplication2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "hook.h"
#include <string>

using namespace std;

int main()
{
	string input;
	string _input;
	dllInjector Inject;
	cout << "Please Enter path to your dll" << endl;
	cin >> input;
	Inject._dllPath = input;
	cout << "Please Enter target process name." << endl;
	cin >> _input;
	Inject.injectDll (_input);
	system("pause");
}
Last edited on
Topic archived. No new replies allowed.