OleCreatePropertyFrame - Same Code Fails on Vista but not on XP.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,

HELP!

I am a highly experienced software engineer but I am stumped by some
peculiar behavior associated with the “Philips SPC 900NC PC” webcam.

Below is a test case. I compiled it both on XP and on Vista. The
executables run without any problem on XP but there is a catastrophic failure
that occurs on Vista. Unfortunately, you need a the “Philips SPC 900NC PC”
webcam to see the problem.

When TestProp is executed, the “Properties” window is displayed. Works fine
on Vista and XP. The “Properties” window has three tabs, “General”, “Video”
and “Audio”. Clicking on each tab works fine and displays the right stuff on
XP. The first two tabs work fine on Vista but when you click on the third
tab, “Video”, you get the message :

“Unhandled exception at 0x691275a3 in HandyAvi.exe: 0xC0000005: Access
violation reading location 0xc0c0c0c0.”

The stack trace says:

CamExt40V32.ax.6a7175a3()
[Frames below may be incorrect and/or missing, no symbols loaded for
CamExt40V32.ax]
Ntdll.dll!_RtlInsertElementGenericTableFullAvl@24() + 0x91 bytes
Ntdll.dll!_RtlDebugFreeHeap@12() + 0x2f bytes

Yes, there is probably something “different” about the Philips driver.
Other webcams do not exhibit any problems but I need to crashproof my
application. Can’t have my application crashing just because the hapless
user clicks on some third-party “Properties” tab.

GraphEdit has no problem displaying the Audio Properties tab in either XP or
Vista.
GraphEditPlus has no problem displaying the Audio Properties tab in either
XP or Vista.
VirtualDub has the same problem my application has. Crashes on Vista when
the Audio tab is selected.
GraphStudio “hangs” when it tries to display the Properties window on the
following statement:

HRESULT hr = page->Activate(owner, &rc, FALSE);

And yes, I tried the GraphStudio downloadable executable as well as
downloading the source and compiling it and testing it myself to see where it
was hanging…

Wish I had source code for the real GraphEdit or for GraphEditPlus to see
what they know that I don’t know.

So what am I overlooking?

How do I crashproof my application? (I tried making the code a separate
thread but it still crashed my whole application. I tried try-catch on (…)
but it didn’t catch the error. I tried to use __try but the compiler mumbled
something about unwinding something and refused to compile it. This stuff is
really whacko…)

So here is source code that will display the problem. Remember, you do need
a "Philips SPC 900NC PC Camera" webcam to see the problem…


int CTimeLapseDlg::TestProp()
{

CComPtr< IGraphBuilder > pGraph;
CComPtr< IBaseFilter > pVideoInputFilter;

// Initialize the COM library.
HRESULT hr = CoInitialize(NULL);
if (FAILED(hr))
{
printf("ERROR - Could not initialize COM library");
return hr;
}

// Get the video input filter for the webcam
hr = GetVideoInputFilter(&pVideoInputFilter, L"Philips SPC 900NC PC
Camera");

if (SUCCEEDED(hr)) {
//SHOW THE FILTER PROPERTY PAGES
ShowFilterPropertyPages(pVideoInputFilter);
}else{
printf("Could not find 'Philips SPC 900NC PC Camera'");
}

if(pVideoInputFilter) pVideoInputFilter.Release();
CoUninitialize();

return 0;
}


// SHOW THE PROPERTY PAGES FOR A FILTER
HRESULT CTimeLapseDlg::ShowFilterPropertyPages(IBaseFilter *pFilter) {

/* Obtain the filter's IBaseFilter interface. (Not shown) */
ISpecifyPropertyPages *pProp;
HRESULT hr = pFilter->QueryInterface(IID_ISpecifyPropertyPages, (void
**)&pProp);
if (SUCCEEDED(hr))
{
// Get the filter's name and IUnknown pointer.
FILTER_INFO FilterInfo;
hr = pFilter->QueryFilterInfo(&FilterInfo);
IUnknown *pFilterUnk;
pFilter->QueryInterface(IID_IUnknown, (void **)&pFilterUnk);

// Show the page.
CAUUID caGUID;
pProp->GetPages(&caGUID);
OleCreatePropertyFrame(
NULL, // Parent window
0, 0, // Reserved
FilterInfo.achName, // Caption for the dialog box
1, // Number of objects (just the filter)
&pFilterUnk, // Array of object pointers.
caGUID.cElems, // Number of property pages
caGUID.pElems, // Array of property page CLSIDs
0, // Locale identifier
0, NULL // Reserved
);

// Clean up.
pProp->Release();
if(pFilterUnk)pFilterUnk->Release();
if(FilterInfo.pGraph) FilterInfo.pGraph->Release();
if(caGUID.pElems)CoTaskMemFree(caGUID.pElems);
}
return hr;
}


.



Relevant Pages

  • Re: Auto start of IE tab group
    ... "Michael Chare" wrote in message ... With IE8 on Vista the three web pages appear as three separate Internet Explorer windows sessions. ... You go to Internet Options, which you can find either under Tools on your IE menu or under the Windows Control Panel, and type in your home pageon the General tab. ...
    (microsoft.public.windows.vista.general)
  • Re: Auto start of IE tab group
    ... With IE8 on Vista the three web pages appear as three separate Internet Explorer windows sessions. ... You go to Internet Options, which you can find either under Tools on your IE menu or under the Windows Control Panel, and type in your home pageon the General tab. ...
    (microsoft.public.windows.vista.general)
  • Re: Tab key query
    ... " Use Flip 3D (VISTA) ... Flip 3D is one of vistas most impressive tricks,but many people dont ... the windows in a useful but dull way. ... key and pushing Tab a few times- Vista will use the impressive- looking ...
    (microsoft.public.windows.vista.general)
  • Re: Hating Microsoft is an Involuntary Reaction
    ... search capabilties and dual windows to do this job. ... When wonderful Vista came out I didn't want to use any ... one tab, drag files from that pane to another "tab" and drop them ...
    (alt.sys.pc-clone.dell)
  • Painting problem with Vista
    ... The problem is that the component does not display the contents but instead only the colored background. ... This problem only occurs when I compile + run the application on Vista: ... Compiling with D2007 on Vista and running on Win2000: ...
    (borland.public.delphi.thirdpartytools.general)