Helpd3d hook help needed

Posts 1–5 of 5 · Page 1 of 1
d3d hook help needed
hi i am new in DIRECTX 9
i maked a simple d3d dll code and i got a test application so i can inject my dll to the application and test it
so thats my code:
Code:
#pragma comment(lib, "d3d9.lib")
#include <windows.h>
#include <d3d9.h>
//משתהנים ליצירת הDEVICE
LPDIRECT3D9 m_D3D = NULL;
LPDIRECT3DDEVICE9 m_D3DD = NULL;
void initD3D(HWND hWnd);   
void Render(void);   

//יצירת החלון -- שלב ה initialize

void initD3D(HWND hWnd) {
m_D3D = Direct3DCreate9( D3D_SDK_VERSION );
// בודקים שהערך שחוזר חיובי
if(m_D3D == NULL)
{
MessageBox(0, L"D3D create failed", L"error", 0);

}
// הגדרת האפשרויות ל החלון
D3DPRESENT_PARAMETERS d3dpm;
ZeroMemory(&d3dpm, sizeof(d3dpm));
d3dpm.BackBufferFormat = D3DFMT_UNKNOWN;
d3dpm.Windowed = TRUE;
d3dpm.SwapEffect = D3DSWAPEFFECT_DISCARD;

// יצירת הDEVICE שירנדר
if(FAILED(m_D3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpm, &m_D3DD)))
{
MessageBox(0, L"D3D Device creation failed", L"error", 0);

}

}
void WinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
	switch(msg)
	{
	case WM_PAINT:
Render();
	}
}
void Render() {

	m_D3DD->Clear(0, 0, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,255), 1.0f, 0);
m_D3DD->BeginScene();
m_D3DD->EndScene();
m_D3DD->Present(0,0,0,0);
}
i need help making the dll main and HOOKING ??
edit:
why i get D3D Device creation failed???

Code:
#pragma comment(lib, "d3d9.lib")
#include <windows.h>
#include <d3d9.h>
//משתהנים ליצירת הDEVICE
LPDIRECT3D9 m_D3D = NULL;
LPDIRECT3DDEVICE9 m_D3DD = NULL;
void initD3D(HWND hWnd);   
void Render(void);   
HWND hWnd;
//יצירת החלון -- שלב ה initialize

void initD3D() {
m_D3D = Direct3DCreate9( D3D_SDK_VERSION );
// בודקים שהערך שחוזר חיובי
if(m_D3D == NULL)
{
MessageBox(0, L"D3D create failed", L"error", 0);

}
// הגדרת האפשרויות ל החלון
D3DPRESENT_PARAMETERS d3dpm;
ZeroMemory(&d3dpm, sizeof(d3dpm));
d3dpm.BackBufferFormat = D3DFMT_UNKNOWN;
d3dpm.Windowed = TRUE;
d3dpm.SwapEffect = D3DSWAPEFFECT_DISCARD;

// יצירת הDEVICE שירנדר
if(FAILED(m_D3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpm, &m_D3DD)))
{
MessageBox(0, L"D3D Device creation failed", L"error", 0);

}

}
void WinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
	switch(msg)
	{
	case WM_PAINT:
Render();
	}
}
void Render() {

	m_D3DD->Clear(0, 0, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,255), 1.0f, 0);
m_D3DD->BeginScene();
m_D3DD->EndScene();
m_D3DD->Present(0,0,0,0);
}
DWORD WINAPI ThreadMain(LPVOID lpParam);

BOOL APIENTRY DllMain(HANDLE hInst, DWORD dwReason, LPVOID lpReserved)
{
	switch(dwReason)
	{
		case DLL_PROCESS_ATTACH:
			{
				
				DWORD  dwThreadId;
				HANDLE hThread = CreateThread(
					NULL, 0, ThreadMain, NULL, 0, &dwThreadId);
			}
			return TRUE;
		
		case DLL_PROCESS_DETACH:
			return TRUE;
	}
	return FALSE;
}

DWORD WINAPI ThreadMain(LPVOID lpParam)
{
	initD3D();
	MessageBox(NULL, L"From new thread", L"From new thread", MB_OK);
	return true;
}
please help me!
and please someone can give me a good tutorial from mpgh how to draw some text with font using directx 9?
thx : )
First off all, dont double post. You risk infraction's with this.
Second off all, we can help you but why don't u figure it out by urself ?
u will learn many more for this -.-
i dont know what wrong with the device setup its just faild
there are mistakes and some missing possibilities:

- #pragma comment(lib, "d3dx9.lib") and #include<d3dx9.h> are missing.
- some basic dependencies are not included properly (e.g. d3d9.lib, d3dx9.lib, winmm.lib and etc)
- you should have check D3DDEVTYPE_REF as well instead of D3DDEVTYPE_HAL. your gfx hardware card could possibility not support for d3dx9.
- your "DWORD WINAPI ThreadMain(LPVOID lpParam);" should declare to the correct section...
- your WinProc method doesn't use up.

like he said, you do not know what you are doing. you have a lot learn. don't copy from others.
Posts 1–5 of 5 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us