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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
#include "stuff.h"
#include "Functions.h"
//Hack List
#define MSG_SuperJump 0
#define MSG_Tubi 1
#define MSG_NoKB 2
#define MSG_BGM 3
#define MSG_MFreeze 4
#define MSG_Revive 5
#define MSG_Vac 6
#define ReadHP 0
//-----
HMODULE hInst;
HANDLE hPipe;
BOOL startread = FALSE;
char chRequest[4096];
char chReply[4096];
DWORD cbBytesRead, cbReplyBytes, cbWritten;
CONST DWORD BUFSIZE = 4096;
BOOL loopstop = FALSE;
LPWSTR lpszPipename = TEXT("\\\\.\\pipe\\Jabba"); //Pipe Name Jabba
void __stdcall GetAnswerToRequest(__in char* szRequest) // Process Messages from JabbaTrainer.exe
{
// Packets -[identifier] [packet length][packet]
switch (szRequest[0])
{
// Hacks ---------------
case MSG_SuperJump:
SuperJump((BOOL)szRequest[1]);
break;
case MSG_Tubi:
Tubi((BOOL)szRequest[1]);
break;
case MSG_NoKB:
NoKB((BOOL)szRequest[1]);
break;
case MSG_BGM:
BGM((BOOL)szRequest[1]);
break;
case MSG_MFreeze:
MFreeze((BOOL)szRequest[1]);
break;
case MSG_Revive:
Revive((BOOL)szRequest[1]);
break;
case MSG_Vac:
Vac((BOOL)szRequest[1]);
break;
}
}
/*
void SendMsg(__in char* szReply)
{
switch (szReply[0])
{
case ReadHP:
//WriteFile(hPipe, chReply, BUFSIZE, &cbWritten, NULL);
percent_HP((int)szReply[1]);
break;
}
}
*/
DWORD ServerCreate()
{
hPipe = CreateNamedPipe(lpszPipename,
PIPE_ACCESS_DUPLEX,
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_NOWAIT,
PIPE_UNLIMITED_INSTANCES,
BUFSIZE ,
BUFSIZE ,
0,
NULL);
if(hPipe== INVALID_HANDLE_VALUE)
{
MessageBox(NULL, L"ERROR: Could not start pipe server!", L"JabbaTrainer: GameKiller", MB_OK | MB_ICONWARNING | MB_SETFOREGROUND);
return 1;//Fail
}
else
MessageBox(NULL, L"Jabba.dll locked and loaded! Please open JabbaTrainer.exe! - www.GameKiller.net", L"JabbaTrainer: GameKiller", MB_OK | MB_ICONWARNING | MB_SETFOREGROUND);
return 0;//Success
}
void PipeInstanceProc()
{
while(ServerCreate() == 1)
{
Sleep(1000);
}
ConnectNamedPipe(hPipe, NULL);
startread=TRUE;
for(;;)
{
if( ConnectNamedPipe(hPipe, NULL)==0)
if(GetLastError()==ERROR_NO_DATA)
{
DisconnectNamedPipe(hPipe);
ConnectNamedPipe(hPipe, NULL);
}
Sleep(1000);
}
}
DWORD ReadClient()
{
while(!loopstop)
{
if(startread)
{
while(ReadFile(hPipe, chRequest, BUFSIZE, &cbBytesRead, NULL) >0)
{
GetAnswerToRequest(chRequest);
Sleep(10);
}
//I Added This
while(WriteFile(hPipe, chReply, BUFSIZE, &cbWritten, NULL) > 0)
{
SendMsg(chReply);
Sleep(10);
}
//---------
Sleep(100);
}
else
Sleep(500);
}
return 0;
}
BOOL WINAPI DllMain(__in HMODULE hInsDll,__in unsigned long fwdReason,__in void* lp)
{
switch (fwdReason)
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hInsDll);
hInst = hInsDll;
//Added Bypass
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&Start, NULL, 0, NULL);
//----
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&ReadClient, NULL, 0, NULL);
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&PipeInstanceProc, NULL , 0, NULL );
break;
case DLL_PROCESS_DETACH:
DisconnectNamedPipe(hPipe);
CloseHandle(hPipe);
break;
}
return TRUE;
}
|