PDA

View Full Version : Crash with xvidvfw.dll


djcel
17th June 2008, 20:25
I use the last version of XviD (v1.1.3) on Windows XP/Vista

I built an application to list the video codecs by using the Win32 C++ function:
ICCompressorChoose()

So it loads xvidvfw.dll (Encoding part)

The problem is that I have a crash with the win32 function only with the XviD codec.
Exception: c0000005
"Memory can't be read"
Instruction: 0x023B97a8
Adress: 0x023e3f60

so I guess it's: MOV EDX,DWORD PTR DS:[ESI+1048] and ESI can't be read


It looks like a thread or a Window not correctly closed to my mind (I guess when the codec is loaded by the function, it opens a thread/window in the background but when we exit the function, the thread/window is not destroyed).

I have tried to look at the source code of xvidvfw.dll but I don't know where the problem could come from.

Here is my code:
COMPVARS cv;
ZeroMemory(&cv, sizeof(COMPVARS));
cv.cbSize = sizeof(COMPVARS);
cv.dwFlags = ICMF_COMPVARS_VALID;
cv.fccType = ICTYPE_VIDEO;
cv.fccHandler=GetDlgItemInt(hDlg,IDC_EDIT16,NULL,FALSE);
cv.lDataRate=GetDlgItemInt(hDlg,IDC_EDIT17,NULL,FALSE); // desired data rate KB/Sec
cv.lKey=GetDlgItemInt(hDlg,IDC_EDIT18,NULL,FALSE); // key frames how often?
cv.lQ=GetDlgItemInt(hDlg,IDC_EDIT19,NULL,FALSE); // desired quality*/

BOOL bSelect = ICCompressorChoose(hDlg, ICMF_CHOOSE_DATARATE | ICMF_CHOOSE_KEYFRAME, NULL,NULL,&cv,"Choose a codec for AVI file");
if (bSelect==FALSE) return;

But there is no problem with my function. I followed with a debugger and the crash appears when I exit my application. My debugger also found a lot of exceptions in xvidvfw.dll

Could someone have a look?

djcel
19th June 2008, 02:40
File: driverproc.c
BOOL WINAPI DllMain(HANDLE hModule,DWORD ul_reason_for_call, LPVOID lpReserved)
{
g_hInst = (HINSTANCE) hModule;
return TRUE;
}

Maybe you could test with:
BOOL WINAPI DllMain(HANDLE hModule,DWORD ul_reason_for_call, LPVOID lpReserved)
{

switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH: // Code to run when the DLL is loaded
g_hInst = (HINSTANCE) hModule;
break;

case DLL_THREAD_ATTACH: // Code to run when a thread is created during the DLL's lifetime
break;

case DLL_THREAD_DETACH: // Code to run when a thread ends normally.
break;

case DLL_PROCESS_DETACH: // Code to run when the DLL is freed
g_hInst=NULL;
break;
}
return TRUE;
}


I compile the dll again with VS2005 and now it correctly works. So the official dll was badly compiled !!!!!!!
(Each time I use the official dll I get the crash and not with my dll)