Some help for the section, HideDLL, FindDevice, Encrypt/Decrypt, Full vTable and more
got an old base (i have like 60 of em, so i never know what i'll find LOL).
I have a feeling that a lot of people "coding" in this section (use the word coding very loosely) don't know much about the vTable, so i did some research, and created a "defines list" for you guys
vTable d3d9 defines
This is the Helper file i mentioned in the title, might help some of you, although i know a lot of you don't really need it, its good for the people actually trying to learn
cHelpers.h
cPragma.h
cHelpers.cpp
credits for most of this go to xKarraKa
I have a feeling that a lot of people "coding" in this section (use the word coding very loosely) don't know much about the vTable, so i did some research, and created a "defines list" for you guys
vTable d3d9 defines
Code:
#define QUERYINTERFACE 0 #define ADDREF 1 #define RELEASE 2 #define TESTCOOPERATIVELEVEL 3 #define GETAVAILABLETEXTUREMEM 4 #define EVICTMANAGEDRESOURCES 5 #define GETDIRECT3D 6 #define GETDEVICECAPS 7 #define GETDISPLAYMODE 8 #define GETCREATIONPARAMETERS 9 #define SETCURSORPROPERTIES 10 #define SETCURSORPOSITION 11 #define SHOWCURSOR 12 #define CREATEADDITIONALSWAPCHAIN 13 #define GETSWAPCHAIN 14 #define GETNUMBEROFSWAPCHAINS 15 #define RESET 16 #define PRESENT 17 #define GETBACKBUFFER 18 #define GETRASTERSTATUS 19 #define SETDIALOGBOXMODE 20 #define SETGAMMARAMP 21 #define GETGAMMARAMP 22 #define CREATETEXTURE 23 #define CREATEVOLUMETEXTURE 24 #define CREATECUBETEXTURE 25 #define CREATEVERTEXBUFFER 26 #define CREATEINDEXBUFFER 27 #define CREATERENDERTARGET 28 #define CREATEDEPTHSTENCILSURFACE 29 #define UPDATESURFACE 30 #define UPDATETEXTURE 31 #define GETRENDERTARGETDATA 32 #define GETFRONTBUFFERDATA 33 #define STRETCHRECT 34 #define COLORFILL 35 #define CREATEOFFSCREENPLAINSURFACE 36 #define SETRENDERTARGET 37 #define GETRENDERTARGET 38 #define SETDEPTHSTENCILSURFACE 39 #define GETDEPTHSTENCILSURFACE 40 #define BEGINSCENE 41 #define ENDSCENE 42 #define CLEAR 43 #define SETTRANSFORM 44 #define GETTRANSFORM 45 #define MULTIPLYTRANSFORM 46 #define SETVIEWPORT 47 #define GETVIEWPORT 48 #define SETMATERIAL 49 #define GETMATERIAL 50 #define SETLIGHT 51 #define GETLIGHT 52 #define LIGHTENABLE 53 #define GETLIGHTENABLE 54 #define SETCLIPPLANE 55 #define GETCLIPPLANE 56 #define SETRENDERSTATE 57 #define GETRENDERSTATE 58 #define CREATESTATEBLOCK 59 #define BEGINSTATEBLOCK 60 #define ENDSTATEBLOCK 61 #define SETCLIPSTATUS 62 #define GETCLIPSTATUS 63 #define GETTEXTURE 64 #define SETTEXTURE 65 #define GETTEXTURESTAGESTATE 66 #define SETTEXTURESTAGESTATE 67 #define GETSAMPLERSTATE 68 #define SETSAMPLERSTATE 69 #define VALIDATEDEVICE 70 #define SETPALETTEENTRIES 71 #define GETPALETTEENTRIES 72 #define SETCURRENTTEXTUREPALETTE 73 #define SETSCISSORRECT 75 #define GETSCISSORRECT 76 #define SETSOFTWAREVERTEXPROCESSING 77 #define GETSOFTWAREVERTEXPROCESSING 78 #define SETNPATCHMODE 79 #define GETNPATCHMODE 80 #define DRAWPRIMITIVE 81 #define DRAWINDEXEDPRIMITIVE 82 #define DRAWPRIMITIVEUP 83 #define DRAWINDEXEDPRIMITIVEUP 84 #define PROCESSVERTICES 85 #define CREATEVERTEXDECLARATION 86 #define SETVERTEXDECLARATION 87 #define GETVERTEXDECLARATION 88 #define SETFVF 89 #define GETFVF 90 #define CREATEVERTEXSHADER 91 #define SETVERTEXSHADER 92 #define GETVERTEXSHADER 93 #define SETVERTEXSHADERCONSTANTF 94 #define GETVERTEXSHADERCONSTANTF 95 #define SETVERTEXSHADERCONSTANTI 96 #define GETVERTEXSHADERCONSTANTI 97 #define SETVERTEXSHADERCONSTANTB 98 #define GETVERTEXSHADERCONSTANTB 99 #define SETSTREAMSOURCE 100 #define GETSTREAMSOURCE 101 #define SETSTREAMSOURCEFREQ 102 #define GETSTREAMSOURCEFREQ 103 #define SETINDICES 104 #define GETINDICES 105 #define CREATEPIXELSHADER 106 #define SETPIXELSHADER 107 #define GETPIXELSHADER 108 #define SETPIXELSHADERCONSTANTF 109 #define GETPIXELSHADERCONSTANTF 110 #define SETPIXELSHADERCONSTANTI 111 #define GETPIXELSHADERCONSTANTI 112 #define SETPIXELSHADERCONSTANTB 113 #define GETPIXELSHADERCONSTANTB 114 #define DRAWRECTPATCH 115 #define DRAWTRIPATCH 116 #define DELETEPATCH 117 #define CREATEQUERY 118
This is the Helper file i mentioned in the title, might help some of you, although i know a lot of you don't really need it, its good for the people actually trying to learn
cHelpers.h
Code:
#ifndef _CHELPERS_H
#define _CHELPERS_H
#include <windows.h>
#include <wininet.h>
#include <winsock.h>
#include <urlmon.h>
#pragma comment(lib, "wininet.lib")
#pragma comment(lib, "wsock32.lib")
#pragma comment(lib, "urlmon.lib")
class cHelper
{
public:
DWORD_PTR * FindDevice(DWORD Base,DWORD Len);
VOID HideDLL(HINSTANCE hModule);
VOID StarLog(HMODULE hDll);
VOID __cdecl cHelper::WriteLog (const char *fmt, ...);
CHAR* Decrypt(const char* plaintext);
CHAR* Encrypt(const char* plaintext);
CHAR * GetTime();
BOOL CheckVersion();
INT URLGetPage(char *link, char *buffer, int maxsize);
BOOL cHelper::_cCompareHost( char *HostName );
private:
CHAR * GetDirectoryFile(char *filename);
};
#endif
Code:
#ifndef _CPRAGMA_H #define _CPRAGMA_H #pragma warning(disable:4244) #pragma warning(disable:4102) #pragma warning(disable:4996) #pragma warning(disable:4800) #pragma warning(disable:4305) #endif
Code:
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <fstream>
#include <stdio.h>
#include <time.h>
#include "cHelpers.h"
#include "cPragma.h"
#include "cPragma.h"
using namespace std;
void cHelper::HideDLL(HINSTANCE hModule)
{
DWORD dwPEB_LDR_DATA = 0;
_asm
{
pushad;
pushfd;
mov eax, fs:[30h]
mov eax, [eax+0Ch]
mov dwPEB_LDR_DATA, eax
InLoadOrderModuleList:
mov esi, [eax+0Ch]
mov edx, [eax+10h]
LoopInLoadOrderModuleList:
lodsd
mov esi, eax
mov ecx, [eax+18h]
cmp ecx, hModule
jne SkipA
mov ebx, [eax]
mov ecx, [eax+4]
mov [ecx], ebx
mov [ebx+4], ecx
jmp InMemoryOrderModuleList
SkipA:
cmp edx, esi
jne LoopInLoadOrderModuleList
InMemoryOrderModuleList:
mov eax, dwPEB_LDR_DATA
mov esi, [eax+14h]
mov edx, [eax+18h]
LoopInMemoryOrderModuleList:
lodsd
mov esi, eax
mov ecx, [eax+10h]
cmp ecx, hModule
jne SkipB
mov ebx, [eax]
mov ecx, [eax+4]
mov [ecx], ebx
mov [ebx+4], ecx
jmp InInitializationOrderModuleList
SkipB:
cmp edx, esi
jne LoopInMemoryOrderModuleList
InInitializationOrderModuleList:
mov eax, dwPEB_LDR_DATA
mov esi, [eax+1Ch]
mov edx, [eax+20h]
LoopInInitializationOrderModuleList:
lodsd
mov esi, eax
mov ecx, [eax+08h]
cmp ecx, hModule
jne SkipC
mov ebx, [eax]
mov ecx, [eax+4]
mov [ecx], ebx
mov [ebx+4], ecx
jmp Finished
SkipC:
cmp edx, esi
jne LoopInInitializationOrderModuleList
Finished:
popfd;
popad;
}
}
DWORD * cHelper::FindDevice(DWORD Base,DWORD Len)
{
unsigned long i = 0, n = 0;
for( i = 0; i < Len; i++ )
{
if(*(BYTE *)(Base+i+0x00)==0xC7)n++;
if(*(BYTE *)(Base+i+0x01)==0x06)n++;
if(*(BYTE *)(Base+i+0x06)==0x89)n++;
if(*(BYTE *)(Base+i+0x07)==0x86)n++;
if(*(BYTE *)(Base+i+0x0C)==0x89)n++;
if(*(BYTE *)(Base+i+0x0D)==0x86)n++;
if(n == 6) return (DWORD_PTR *)
(Base + i + 2);n = 0;
}
return(0);
}
CHAR* cHelper::Encrypt(const char* plaintext)
{
int len = strlen(plaintext);
char* cyphertext = new char[len+1];
for(int i=0 ; i<len ; ++i)
{
cyphertext[i] = plaintext[i] + 8 - 6;
}
cyphertext[len] = 0;
return cyphertext;
}
CHAR* cHelper::Decrypt(const char* plaintext)
{
int len = strlen(plaintext);
char* cyphertext = new char[len+1];
for(int i=0 ; i<len ; ++i)
{
cyphertext[i] = plaintext[i] - 8 + 6;
}
cyphertext[len] = 0;
return cyphertext;
}
ofstream ofile;
char dlldir[320];
CHAR * cHelper::GetDirectoryFile(char *filename){
static char path[320];
strcpy(path, dlldir);
strcat(path, filename);
return path;
}
VOID __cdecl cHelper::WriteLog (const char *fmt, ...){
if(ofile != NULL)
{
if(!fmt) { return; }
va_list va_alist;
char logbuf[255] = {0};
va_start (va_alist, fmt);
_vsnprintf (logbuf+strlen(logbuf), sizeof(logbuf) - strlen(logbuf), fmt, va_alist);
va_end (va_alist);
ofile << logbuf << endl;
}
}
VOID cHelper::StarLog(HMODULE hDll)
{
GetModuleFileName(hDll, dlldir, 512);
for(int i = strlen(dlldir); i > 0; i--) { if(dlldir[i] == '\\') { dlldir[i+1] = 0; break; } }
DeleteFile(GetDirectoryFile("[mpgh]SuperLoggerz Log.txt"));
ofile.open(GetDirectoryFile("[mpgh]SuperLoggerz Log.txt"), ios::app);
}
