Exetools  

Go Back   Exetools > General > General Discussion

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 06-19-2005, 19:24
ArC ArC is offline
VIP
 
Join Date: Jan 2003
Location: NTOSKRNL.EXE
Posts: 172
Rept. Given: 0
Rept. Rcvd 1 Time in 1 Post
Thanks Given: 5
Thanks Rcvd at 17 Times in 12 Posts
ArC Reputation: 1
Debugging Direct3D Fullscreen App

I'm trying to "debug" a Direct3D game that runs in fullscreen mode with Olly.
The problem is that once a breakpoint is triggered there's no way to get to the debugger window in order to start tracing or continue execution.
I know this is a common problem when debugging Direct3D fullscreen apps.
I'd like to know whether there're ways to debug such a fullscreen app. I read sth about a second monitor or remote debugging but they're out of question since I don't have a second monitor and OllyDbg doesn't support Remote Debugging. One way I found was to run the app in windowed mode. The game itself doesn't support windowed mode so are there tools available I can use to force the game to run in windowed mode? I know that 3D Analyzer can do this but the game quits immediately when I start it with the "force windowed mode" option enabled.

Thx
Reply With Quote
  #2  
Old 06-19-2005, 20:27
ricnar456 ricnar456 is offline
Friend
 
Join Date: May 2002
Posts: 290
Rept. Given: 1
Rept. Rcvd 28 Times in 10 Posts
Thanks Given: 0
Thanks Rcvd at 52 Times in 40 Posts
ricnar456 Reputation: 28
i´m debugging a direct x now with olly.

i use olly and have good results the method of work is very limited but i have good results.

1)never put a breakpoint of hardware bpx, this freeze your machine.
2)for use breakpints i made a litlle script in this form, i run the game, alt mas tab for switch to olly, run the script


var aux
start:

eob break
run

break:
log eax
log ebx
log ecx
log edx
log esp
log ebp
log esi
log edi
log eip
mov aux,esp
log [aux]
add aux,4
log [aux]
add aux,4
log [aux]
add aux,4
log [aux]
add aux,4
log [aux]
add aux,4
log [aux]
add aux,4
log [aux]
mov aux,0

jmp start

this make olly dont stop in the HE and continue running the game without freeze, next you can go out of the game woth alt mas tab and look the values stored in the log, plus if is a repetitive address the screen will swith to olly without freeze and you can pause the script and pause olly and continue working.
Is a very hard method but work for me

if you can make a good script than change eip and execute a loop in the program, your screen don´t freeze and you can switch to olly with alt + tab and return to the adress of the HE and continue tracing:

I make all dirty tricks how this and with more work, but always can crack direct X games with olly, only you need prevent olly stop completely in a BP o HE while you have the screen of the game in the monitor.
if you work without stop olly, and you can switch to olly, you can continue tracing.

Ricardo Narvaja
Reply With Quote
  #3  
Old 06-19-2005, 20:40
ArC ArC is offline
VIP
 
Join Date: Jan 2003
Location: NTOSKRNL.EXE
Posts: 172
Rept. Given: 0
Rept. Rcvd 1 Time in 1 Post
Thanks Given: 5
Thanks Rcvd at 17 Times in 12 Posts
ArC Reputation: 1
Thx interesting tips. I'll try them.
Reply With Quote
  #4  
Old 06-20-2005, 17:06
nskSem
 
Posts: n/a
Try to use SoftIce (May be in FullScreen Mode).
Reply With Quote
  #5  
Old 06-20-2005, 19:06
JuneMouse
 
Posts: n/a
well directdraw means it aslo uses vtable and alomost all calls would be of
the kind call[reg32+const] in these situations using log breakpoints (never pause) log always or log on condition log expression always or log expression on condition log arguments always or on condition gets you almost all the info with alt+tab and application runnnig

also if you set a breakpoint and it froze you can use taskmanager (open it earlier and alttab to it or use ctrl+shift+esc to bring it up and then
use bring to front olly with task manager you can even trace live
ok the graphics will be garish and some other problems
bit you can single step
Reply With Quote
  #6  
Old 06-21-2005, 19:06
xxxxx
 
Posts: n/a
Best and simpliest - use another graphic card and monitor - its not so expenisive today.
Reply With Quote
  #7  
Old 06-24-2005, 01:05
niom niom is offline
Friend
 
Join Date: Jul 2004
Posts: 21
Rept. Given: 0
Rept. Rcvd 0 Times in 0 Posts
Thanks Given: 0
Thanks Rcvd at 0 Times in 0 Posts
niom Reputation: 0
some time ago i wrote a dll, that simply hooks IDirect3DDevice9::CreateDevice

and when this function is called by the game, i set windowed bits in the D3DPRESENT_PARAMETERS param

this works for many games
Reply With Quote
  #8  
Old 06-24-2005, 05:16
homersux
 
Posts: n/a
Then we are back to the same problem of finding ID3DDevice9, which of course is not terribly difficult. Once the ID3DDevice9 pointer is found, the rest is simply cake.
Reply With Quote
  #9  
Old 06-25-2005, 06:53
niom niom is offline
Friend
 
Join Date: Jul 2004
Posts: 21
Rept. Given: 0
Rept. Rcvd 0 Times in 0 Posts
Thanks Given: 0
Thanks Rcvd at 0 Times in 0 Posts
niom Reputation: 0
Code:
HRESULT __stdcall myCreateDevice(CREATEDEVICE tramp, IDirect3D9 *d3d, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS *pPresentationParameters, IDirect3DDevice9 **ppReturnedDeviceInterface)
{
	HWND wnd;

	wnd = pPresentationParameters->hDeviceWindow;

	SetWindowPos(wnd, 0, 10, 10, 640, 480, SWP_NOZORDER);
	SetWindowLong(wnd, GWL_STYLE, WS_VISIBLE);
	SetWindowLong(wnd, GWL_EXSTYLE, 0);

	memset(pPresentationParameters, 0, sizeof(D3DPRESENT_PARAMETERS));
	pPresentationParameters->BackBufferCount = 2;
	pPresentationParameters->Windowed = TRUE;
	pPresentationParameters->SwapEffect =  D3DSWAPEFFECT_FLIP;
	pPresentationParameters->BackBufferFormat = D3DFMT_UNKNOWN;
	pPresentationParameters->hDeviceWindow = wnd;
	pPresentationParameters->EnableAutoDepthStencil = TRUE;
	pPresentationParameters->AutoDepthStencilFormat = D3DFMT_D16;
	pPresentationParameters->PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;

	return tramp(d3d, Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface);
}

IDirect3D9 *WINAPI Direct3DCreate9(UINT SDKVersion)
{
	IDirect3D9 *result;
	DWORD *vtable;
	HMODULE dll;
	DIRECT3DCREATE9 orgDirect3DCreate9;

	if ((dll = LoadLibrary("\\windows\\system32\\d3d9.dll")) == NULL) return NULL;

	if ((orgDirect3DCreate9 = (DIRECT3DCREATE9)GetProcAddress(dll, "Direct3DCreate9")) == NULL) return NULL;

	if ((result = orgDirect3DCreate9(SDKVersion)) == NULL) return NULL;

	vtable = *(DWORD **)result;

	hookPre(myCreateDevice, (void *)vtable[16]);		//vtable[16]: d3d->CreateDevice()

	return result;
}
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
x64 and anti-debugging lena151 x64 OS 19 11-15-2011 05:24
Avast 5 and Debugging TmC General Discussion 6 05-08-2010 20:33
Remote Debugging Git General Discussion 5 08-21-2005 21:52
Anti-Debugging ? ? LOUZEW General Discussion 7 04-02-2005 18:38


All times are GMT +8. The time now is 12:10.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( Since 1998 )