Windows 7 - Vfw registry problem?

Asked By mike on 05-Feb-08 04:14 AM
I have created two Vfw drivers.  I've registered them both manually by
making what I believe are the correct registry entries.  When I open
up virtualdub and look at the codecs, one of the drivers is displayed
and the other isn't.  When I look in the output of the debugger, I can
see where both dlls get loaded but only one seems to go through the
dllmain and driverproc functions.  The 2nd just loads and unloads.  If
I open up graphedt and add a filesource that is compress with the
codec of the 2nd driver, add an AVI splitter and decompressor and then
have the graph render, the 2nd driver go through dllmain and
driverproc attempting to decode the video.

Where can I find documentation on how a Vfw is to be registered?
(Windows XPsp2)

Thanks,

Mike




Alessandro Angeli replied on 27-Jan-08 01:23 PM
From: "mike"


All that is required is the following registry key:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Drivers32]

Where xxxx is the format's FOURCC. You should use a
DOS-compatible path for the value, e.g. the file's short
parth.

You can also use ICInstall(ICINSTALL_DRIVER) to have the
system install the driver for you or create an INF file. The
easiest way to call the function is to export a function
from your DLL that can be invoked by regsvr32.exe or
rundll32.exe:

/// regsvr32.exe /n /i "path\codec.dll"
EXTERN_C HRESULT CALLBACK MyDllInstall(BOOL zInstall,
LPCWSTR szCmdLine);

/// regsvr32.exe "path\codec.dll"
EXTERN_C HRESULT CALLBACK MyDllRegisterServer(void);

/// rundll32.exe "path\codec.dll",MyRunDll32
EXTERN_C void CALLBACK MyRunDll32W(HWND hwnd, HINSTANCE
hinst, LPWSTR szCmdLine, int nCmdShow);

Add a .def file to your project with the following 2 lines:

EXPORTS
MyDllInstall

Use the correct function name and specify the .def file in
the Linker/ModuleDefinitionFile project settings.

Your function should perform the following:

HMODULE hModule = GetModuleHandle("codec.dll");
LPWSTR szName = GetModuleFileName(hModule);
LPWSTR szFull = GetFullPathName(szName);
LPWSTR szPath = GetShortPathName(szFull);
ICInstall(ICINSTALL_DRIVER,szPath);

Instead of calling GetModuleHandle() you can also simply
cache the HMODULE passed to DllMain().


You need the old VFW 1.1e DK for Win16 (which you can safely
install on XP; download the whole directory and run the
setup):

ftp://ftp.microsoft.com/developr/drg/Multimedia/Jumpstart/VfW11e/DK/VFWDK


--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm