Help eror code

help me , build eror

1> d3dbase.cpp
1>d3dbase.cpp(59): error C2065: 'pSetStreamSource' : undeclared identifier
1>d3dbase.cpp(59): error C2065: 'SetStreamSource_t' : undeclared identifier
1>d3dbase.cpp(59): error C2146: syntax error : missing ';' before identifier 'DetourFunc'
1>d3dbase.cpp(59): error C2065: 'hkSetStreamSource' : undeclared identifier
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

//==============================================================================
#pragma once
#pragma comment(lib, "d3d9.lib")
#pragma comment(lib, "d3dx9.lib")

#include <windows.h>
#include <d3d9.h>
#include <d3dx9.h>
#include <cstdio>

typedef HRESULT(__stdcall* EndScene_t)(LPDIRECT3DDEVICE9);
EndScene_t pEndScene;

typedef HRESULT(__stdcall* DrawIndexedPrimitive_t)(LPDIRECT3DDEVICE9,D3DPRIMITIVETYPE,INT,UINT,UINT,UINT,UINT);
DrawIndexedPrimitive_t pDrawIndexedPrimitive;

void InitHook();
bool bDataCompare(const BYTE* pData, const BYTE* bMask, const char* szMask);
DWORD dwFindPattern(DWORD dwAddress,DWORD dwLen,BYTE *bMask,char * szMask);
void *DetourFunc(BYTE *src, const BYTE *dst, const int len);
HRESULT __stdcall hkEndScene(LPDIRECT3DDEVICE9 pDevice);
HRESULT __stdcall hkDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice,D3DPRIMITIVETYPE Type,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount);
HRESULT GenerateTexture(IDirect3DDevice9 *pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32);

bool FirstRun = true;
DWORD dwEndScene = NULL;
DWORD dwDrawIndexedPrimitive = NULL;

int APIENTRY DllMain(HINSTANCE hInst,DWORD reason,LPVOID reserved)
{
switch(reason)
{
case DLL_PROCESS_ATTACH:
CreateThread(0, 0, (LPTHREAD_START_ROUTINE) InitHook, 0, 0, 0);
break;
}
return TRUE;
}


void InitHook() {
HMODULE hModule = NULL;
while( !hModule ){
hModule = GetModuleHandleA( "d3d9.dll" ); // Handle zur DLL holen
Sleep(100);
}

DWORD dwDrawIndexedPrimitive;
DWORD dwSetStreamSource;
DWORD* VTableStart = 0;
DWORD FoundByGordon = dwFindPattern((DWORD)hModule, 0x128000,
(PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86", "xx????xx????xx");
memcpy(&VTableStart, (void*)(FoundByGordon+2), 4);
dwDrawIndexedPrimitive = (DWORD)VTableStart[82]; // für mehr: blick in die d3d9.h werfen!
dwEndScene = (DWORD)VTableStart[42];
dwSetStreamSource =(DWORD)VTableStart[100];

pEndScene = ( EndScene_t )DetourFunc((PBYTE)dwEndScene,(PBYTE)hkEndScene, 5);
pDrawIndexedPrimitive = ( DrawIndexedPrimitive_t )DetourFunc((PBYTE)dwDrawIndexedPrimitive, (PBYTE)hkDrawIndexedPrimitive,5);
pSetStreamSource = ( SetStreamSource_t )DetourFunc((PBYTE)dwSetStreamSource,(PBYTE)hkSetStreamSource,5);
}


bool bDataCompare(const BYTE* pData, const BYTE* bMask, const char* szMask)
{
for(;*szMask;++szMask,++pData,++bMask)
if(*szMask=='x' && *pData!=*bMask )
return false;
return (*szMask) == NULL;
}


DWORD dwFindPattern(DWORD dwAddress,DWORD dwLen,BYTE *bMask,char * szMask)
{
for(DWORD i=0; i < dwLen; i++)
if( bDataCompare( (BYTE*)( dwAddress+i ),bMask,szMask) )
return (DWORD)(dwAddress+i);
return 0;
}


void *DetourFunc(BYTE *src, const BYTE *dst, const int len)
{
BYTE *jmp = (BYTE*)malloc(len+5);
DWORD dwback;
VirtualProtect(src, len, PAGE_READWRITE, &dwback);
memcpy(jmp, src, len); jmp += len;
jmp[0] = 0xE9;
*(DWORD*)(jmp+1) = (DWORD)(src+len - jmp) - 5;
src[0] = 0xE9;
*(DWORD*)(src+1) = (DWORD)(dst - src) - 5;
VirtualProtect(src, len, dwback, &dwback);
return (jmp-len);
}


HRESULT GenerateTexture(IDirect3DDevice9 *pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32)
{
if( FAILED(pD3Ddev->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, ppD3Dtex, NULL)) )
return E_FAIL;

WORD colour16 = ((WORD)((colour32>>28)&0xF)<<12)
|(WORD)(((colour32>>20)&0xF)<<8)
|(WORD)(((colour32>>12)&0xF)<<4)
|(WORD)(((colour32>>4)&0xF)<<0);

D3DLOCKED_RECT d3dlr;
(*ppD3Dtex)->LockRect(0, &d3dlr, 0, 0);
WORD *pDst16 = (WORD*)d3dlr.pBits;

for(int xy=0; xy < 8*8; xy++)
*pDst16++ = colour16;

(*ppD3Dtex)->UnlockRect(0);

return S_OK;
}



HRESULT GenerateShader(IDirect3DDevice9 *pD3Ddev, IDirect3DPixelShader9 **pShader, float r, float g, float b )
{
char szShader[ 256 ];
ID3DXBuffer *pShaderBuf = NULL;
sprintf_s( szShader, "ps_3_0\ndef c0, %f, %f, %f, %f\nmov r0,c0", r, g, b, 1.0f );
D3DXAssembleShader( szShader, sizeof( szShader ), NULL, NULL, 0, &pShaderBuf, NULL );
if( FAILED( pD3Ddev->CreatePixelShader((const DWORD*)pShaderBuf->GetBufferPointer(), pShader)) )return E_FAIL;
return S_OK;
}


LPDIRECT3DTEXTURE9 PINK,WHITE;


UINT m_Stride;
IDirect3DVertexBuffer9 *pStreamData;
UINT pOffsetInBytes;


HRESULT __stdcall hkEndScene(LPDIRECT3DDEVICE9 pDevice)
{
if(FirstRun)
{
GenerateTexture( pDevice, &PINK, D3DCOLOR_ARGB(255, 255, 240, 0));
GenerateTexture( pDevice, &WHITE, D3DCOLOR_ARGB(255, 255, 255, 255));


FirstRun = false;
}


return pEndScene(pDevice);
}


HRESULT __stdcall hkDrawIndexedPrimitive(LPDIRECT3DDEVICE9 pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount)
{
pDevice->GetStreamSource(0, &pStreamData, &pOffsetInBytes, &m_Stride);
if(m_Stride == 52 || (m_Stride == 24 && NumVertices == 18 && primCount == 11))
{
pDevice->SetRenderState(D3DRS_ZENABLE, false);
pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
pDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_NEVER);
pDevice->SetTexture(0, PINK);
pDrawIndexedPrimitive(pDevice, Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
pDevice->SetRenderState(D3DRS_ZENABLE, true);
pDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESSEQUAL);
pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
pDevice->SetTexture(0, WHITE);
}


return pDrawIndexedPrimitive(pDevice, Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
}
You are missing these:
1
2
3
4
5
6
7
8
9
10
11
12
...
typedef HRESULT(__stdcall* SetStreamSource_t)(LPDIRECT3DDEVICE9, UINT, LPDIRECT3DVERTEXBUFFER9, UINT, UINT);
SetStreamSource_t pSetStreamSource;
...
HRESULT __stdcall hkSetStreamSource(LPDIRECT3DDEVICE9 pDevice, UINT streamNumber, LPDIRECT3DVERTEXBUFFER9 buffer, UINT offsetInBytes, UINT stride);
...
HRESULT __stdcall hkSetStreamSource(LPDIRECT3DDEVICE9 pDevice, UINT streamNumber, LPDIRECT3DVERTEXBUFFER9 buffer, UINT offsetInBytes, UINT stride)
{
        // You might want to do something different here
        // i just call 'default function'
	return pDevice->SetStreamSource(streamNumber, buffer, offsetInBytes, stride);
}

but code is still incomplete!

May you show me where did you dig this code from?
this wallhack

what you can give me a complete code

thanks for his assistance
Can you give me link to source of this code so that i might answer your question?
What name should be used for this DLL?

EDIT: I think i understand, you want to see thru walls in CS 1.6? CHEATER!!! LOL.
Last edited on
Topic archived. No new replies allowed.