Sign in to follow this  

Debugging D3DXCreateEffectFromFile on target machines ERROR_MOD_NOT_FOUND

This topic is 2666 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
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
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
The dependency walker shows identical displays on both machines with these two files.

GPSVC.DLL
IESHIMS.DLL

Not being identified, but if it works on here and I cant identify the files then it suggests this program is not indicating where the difference causing the error lies.

Below is the code I use to run the applications within my NSIS installer.

SetOutPath "$INSTDIR\temp"

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"

;The VC redist
nsExec::Exec '"$INSTDIR\temp\vcredist_x86.exe /q:a /c:"VCREDI~1.EXE /q:a /c:""msiexec /i vcredist.msi /qn"" "'
Pop $0 # return value/error/timeout

;DX
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) The installer may pause temporarily as your DirectX Version is checked."
nsExec::Exec '"$INSTDIR\temp\DXSETUP.exe" /silent'

Share this post


Link to post
Share on other sites
I found a link via google discussing the same error with D3DXEffect()

They are saying theres something wrong with their d3dx_xx.dll files as far as I can make out. But then when they come to solve it the translator seems to fail :p

Share this post


Link to post
Share on other sites
It seems the direct x redistributable was crashing during the install process but installing the d3dx9_43.dll but not one of the other .dlls after that used for compiling shaders. I am not sure which .dll it is but including the full redist and installing it seperately made it work searching for a fault in my installers code. Thanks for all the input guys!

Share this post


Link to post
Share on other sites

This topic is 2666 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this