Jump to content
  • Advertisement
Sign in to follow this  
EnlightenedOne

Debugging D3DXCreateEffectFromFile on target machines ERROR_MOD_NOT_FOUND

This topic is 2974 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
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 ) ...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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);

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
You need to have your installer actually run the DXSETUP program, which will copy in the d3dx9.dll that the target machine needs.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Never mind that it gets this far, did you or did you not run dxsetup.exe on the machines it fails on?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!