Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Windos
win32.3rdparty
win32.directx.audio
win32.directx.ddk
win32.directx.graphics
win32.directx.input
win32.directx.managed
win32.directx.misc
win32.directx.networking
win32.directx.sdk
win32.directx.video
win32.dirx.grap.shaders
win32.gdi
win32.international
win32.kernel
win32.messaging
win32.mmedia
win32.networks
win32.ole
win32.rtc
win32.tapi
win32.tapi.beta
win32.tools
win32.ui
win32.wince
win32.wmi
windows.mediacenter
winfx.aero
winfx.announcements
winfx.avalon
winfx.collaboration
winfx.fundamentals
winfx.general
winfx.indigo
winfx.sdk
winfx.winfs
  
 
date: Sat, 28 Jun 2008 14:19:01 -0700,    group: microsoft.public.win32.programmer.ole        back       


OleCreatePropertyFrame - Same Code Fails on Vista but not on XP.   
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;
}
date: Sat, 28 Jun 2008 14:19:01 -0700   author:   Handy13

Re: OleCreatePropertyFrame - Same Code Fails on Vista but not on XP.   
Hi,

I don't think you have control over property pages because the entire
property page coclass instantiation takes place inside
OleCreatePropertyFrame and the page is released before the function
returns. So the problem is likely to be with implementation of the
property page class. Unless there is memory corruption or this sort of
bad thing prior to the call.

As a side note - please note that in TestProp() you have CoUninitialze
being called before ~CComPtr on pGraph variable. This is not a problem
in this sample (this var is not used), but you probably copy/pasted it
from somewhere so you might want to check your original code.

Roman
date: Sat, 5 Jul 2008 10:36:53 -0700 (PDT)   author:   Roman Ryl...

Re: OleCreatePropertyFrame - Same Code Fails on Vista but not on XP.   
Hi,

Another clue inspired by unreferenced pGraph variable - maybe you are
releasing your graph before you pop up property page frame? And thus
you have the filter reference when it was already removed from graph.
Make sure you have an outstanding reference to IGraphBuilder while you
are showing property frame.

Having graph references release is not a big deal but this way you
leave everything for the filter developer and expect that this filter
will work properly outside filter graph. And this may explain why you
have no problems when accessing property pages using GraphEdit.

Roman
date: Sat, 5 Jul 2008 10:41:25 -0700 (PDT)   author:   Roman Ryl...

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us