Debugging D3DXCreateEffectFromFile on target machines ERROR_MOD_NOT_FOUND

Started by
13 comments, last by EnlightenedOne 13 years, 7 months ago
Hi there I have a piece of code I have isolated as dying on certain target machines.

         //Load the HLSL shader	HRESULT hr = D3DXCreateEffectFromFile(D3DDevice, "AdvancedPassShader.fx", 0, 0, 0, 0, &ParallaxMapEffect, &pErrorMsg);	if (FAILED(hr)){		MessageBox(hwnd, "The graphics failed where is the error.txt?!?! FIND IT", "ITS DIED!", 0);		MessageBox(hwnd, "Fetching error", "ITS DIED!", 0);		//Error(s) have occured.	    //Allocate a character buffer the size of the ID3DXBuffer		char *data = new char[pErrorMsg->GetBufferSize]; //(the program freezes on this line)		MessageBox(hwnd, "Gathered data", "ITS DIED!", 0);	    // Copy the buffer data over	    memcpy( data, pErrorMsg->GetBufferPointer(), pErrorMsg->GetBufferSize());


Any attempt to interact with pErrorMsg causes the program to crash, how on earth can I identify the error when I cannot interact with the error holding device without causing a crash?

Obviously I cannot debug the code on these machines without putting the SDK on. What can I do to test things?

[Edited by - EnlightenedOne on August 29, 2010 4:52:29 PM]
Advertisement
Check the docs:

It says:

If the function fails, the return value can be one of the following: D3DERR_INVALIDCALL, D3DXERR_INVALIDDATA, E_OUTOFMEMORY.

What did it return in your case?

pErrorMsg might not have gotten filled in, depending on the error. Check that the pointer is not null before you try to dereference it

if( pErrorMsg ) ...
I tried the following to identify a problem.

	//Load the HLSL shader	HRESULT hr = D3DXCreateEffectFromFile(D3DDevice, "AdvancedPassShader.fx", 0, 0, 0, 0, &ParallaxMapEffect, &pErrorMsg);	switch (hr)	{		case D3DERR_INVALIDCALL : 			MessageBox(hwnd, "Create Effect Invalid Call", "ITS DIED!", 0);			break;		case D3DXERR_INVALIDDATA : 			MessageBox(hwnd, "Create Effect Holds Invalid Data", "ITS DIED!", 0);			break;		case E_OUTOFMEMORY : 			MessageBox(hwnd, "Create Effect Ran out of system memory", "ITS DIED!", 0);			break;	}	if (FAILED(hr)){


None of these were true. I cannot get at the value of HRESULT just verify its below 0.

#define FAILED(hr) (((HRESULT)(hr)) < 0)

I tried this.

	HRESULT hr = D3DXCreateEffectFromFile(D3DDevice, "AdvancedPassShader.fx", 0, 0, 0, 0, &ParallaxMapEffect, &pErrorMsg);		char *data2 = new char[sizeof(hr)];	memcpy( data2, (void*)hr, sizeof(hr));


To try and get the hr value into a form I can output, but the program crashes.
The hresult is just an integer. Print it out, it's probably going to match one of the standard windows system error codes

std::stringstream ss;
ss << hr;

std::string hresult_string = ss.str();

MessageBox(hwnd, hresult_string.c_str(), "Hresult value:", 0);
I was not aware string stream existed in C++ I have only used it in java! fantastic, I have the value now.

-2147024770

Error lookup says.

HRESULT: 0x8007007e (2147942526)
Name: ERROR_MOD_NOT_FOUND
Description: n/a
Severity code: Failed
Facility Code: FACILITY_WIN32 (7)
Error Code: 0x007e (126)

Module not found? am I missing an DX include for performing shader tasks?
I have these two dependencies in my program.

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

I have these files I install onto the target machine before running it.

File "Jun2010_d3dx9_43_x64.cab"
File "Jun2010_d3dx9_43_x86.cab"
File "dxdllreg_x86.cab"
File "dxupdate.cab"
File "DSETUP.dll"
File "dsetup32.dll"
File "DXSETUP.exe"

File "vcredist_x86.exe"

Can anyone tell me what .dll is used to perform D3DXCreateEffectFromFile?

I am searching for this dependency walker program referenced here.
http://www.gamedev.net/community/forums/topic.asp?topic_id=560677
You need to have your installer actually run the DXSETUP program, which will copy in the d3dx9.dll that the target machine needs.
It does run the file otherwise before this stage the program would go d3dx9_43.dll is missing. My problem is that it is behaving like its missing a dll without picking up on it to begin with its confusing me no end.
Dependency Walker states I am using.

D3D9.dll
D3DX9_43.dll
WINMM.dll
DINPUT8.dll
USER32.dll
GDI32.dll
KERNAL32.dll

It even shows you what functions your using from the applications, my first look at how reverse engineering might happen.

Just going to run the dependency walker on the target machine to isolate the missing link.
Never mind that it gets this far, did you or did you not run dxsetup.exe on the machines it fails on?

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

This topic is closed to new replies.

Advertisement