调试Windows Media SDK时出现的异常中断

类别:VC语言 点击:0 评论:0 推荐:
调试Windows Media SDK时出现的异常中断

Article last modified on 2002-5-20

----------------------------------------------------------------

The information in this article applies to:

-        Microsoft Windows Media Format SDK 7.0

-        Microsoft Visual C++, 32-bit Editions, version 6.0, SP5

----------------------------------------------------------------

Table of Contents

调试Windows Media SDK时出现的异常中断... 1

现象:... 1

原因:... 3

使用过Windows Media SDK的兄弟们,几乎都应该遇到过这种问题。我好像没有看到微软对此有所表示,不知道有没有专门针对于此的KB文章。

现象:

当调试至下面代码的红色语句时,出现BreakPoint中断:

HRESULT AddAudioStream( DWORD dwFormatTag,

                             DWORD dwBitrate,

                             DWORD dwSampleRate,

                             DWORD dwChannels,

                             DWORD dwFlags,

                             IWMProfile *pIWMProfile,

                             IWMProfileManager

*pIWMProfileManager )

{

    HRESULT hr = S_OK;

  IWMStreamConfig *pIWMStreamConfig = NULL;

  IWMMediaProps   *pIMP  = NULL;

  IWMCodecInfo *pIWMInfo = NULL;

  WAVEFORMATEX *pSaveWFX = NULL;

  WM_MEDIA_TYPE   *pType = NULL;

 

  try

  {

     do

     {

        hr =

pIWMProfileManager->QueryInterface( IID_IWMCodecInfo,

                                     (void **) &pIWMInfo );

        if( FAILED( hr ) )

        {

           return hr;

        }

 

        DWORD i, j;

        DWORD cCodecs;

        hr = pIWMInfo->GetCodecInfoCount( WMMEDIATYPE_Audio,

                                &cCodecs );

对话框内容为:

[dialog Microsoft Visual C++]

User Breakpoint called from code at 0x77fa018c

它的定位:

DbgBreakPoint:

77FA018C   int         3

 

VC的Output窗口打出这样的话:

HEAP[elcc.exe]: Invalid Address specified to RtlFreeHeap( 2d70000, 2d751f8 )

 

当时的堆栈调用信息为:

NTDLL! DbgBreakPoint address 0x77fa018c

NTDLL! RtlpNtEnumerateSubKey + 19613 bytes

NTDLL! RtlpNtEnumerateSubKey + 16147 bytes

NTDLL! RtlDestroyHandleTable + 1918 bytes

NTDLL! 77fcba9e()

MSMS001! VoodooUnQuery + 28632 bytes

MSMS001! VoodooUnQuery + 27049 bytes

MSMS001! VoodooUnQuery + -3737 bytes

VCT3216! Dcmp

 

 

其实很久以来,在新闻组中大约有6、7个人说过这个问题,但是一直没有人回答为什么和怎么解决。

比如,Ed Eichman说:

I had quite a few problems getting the genprofile sample [from

the Windows Media Format SDK] to do ANYTHING on my machine besides

giving user breaks with HEAP[genprofile.exe]: Invalid Address

specified to RtlFreeHeap( 4d70000,4d73f30 ) until I got tired of

hitting OK. Stack crawl was something "helpful" like:

NTDLL! 77f7629c()

NTDLL! 77f8c4de()

NTDLL! 77f7e587()

NTDLL! 77f64f43()

MSMS001! 04d17b68()

MSMS001! 04d17539()

MSMS001! 04d0fcf7()

VCT3216! 044a4326()

 

比如,Malcolm Nixon说:

Whenever I try executing

the pIWMAudioWriter->SetOutputFormat(...) line the program

prints the following message then faults:

HEAP[WMATest.exe]: Invalid Address specified to

RtlFreeHeap( 2460000, 2d00000 )

I've tried different arguments to SetOutputFormat but to

no avail.

 

原因:

看着下面的output报告,这些加载的DLL都是在执行初始化Windows Media Format SDK的IWMWriter接口时加载的:

LOAD_DLL  base:04600000  msdmo.dll

LOAD_DLL  base:53600000  DEFFILE.dll

LOAD_DLL  base:74F10000  IMAADP32.dll

LOAD_DLL  base:75CE0000  MSADP32.dll

LOAD_DLL  base:74EF0000  MSG711.dll

LOAD_DLL  base:74EC0000  MSGSM32.dll

LOAD_DLL  base:74EB0000  TSSOFT32.dll

LOAD_DLL  base:661D0000  tsd32.dll

LOAD_DLL  base:74F00000  lhacm.dll

LOAD_DLL  base:74ED0000  msg723.dll

LOAD_DLL  base:63F40000  IAC25_32.ax

LOAD_DLL  base:1C200000  MSAUD32.ACM

LOAD_DLL  base:04F40000  sl_anet.acm

LOAD_DLL  base:04F60000  VCT3216.acm

LOAD_DLL  base:04F80000  vct3216.dll

LOAD_DLL  base:057F0000  MSMS001.vwp

LOAD_DLL  base:05C70000  mvoice.vwp

OutDbStr: HEAP[CallDesigner.exe]:

OutDbStr: Invalid Address specified to RtlFreeHeap( 5860000, 5864228 )

红色的DLL就是根源!

VCT3216.acm就在你的%System32%目录下。它是一个audio codec driver。但是它的调试版本中由于某种原因有异常行为。

你可以删除它。但是据Ed Eichman说并不解决问题。

也可以选择pass这个breakpoint对话框,但是你必须连续跳过这个对话框214次!J

我确实这么做过,连续按了214次F5,和214次确定,终于通过了地雷阵。J

你可以看到这最后一次的output之后,是加载另一个DLL,说明异常确实发生在这几个acm和vwp中:

OutDbStr: HEAP[CallDesigner.exe]:

OutDbStr: Invalid Address specified to RtlFreeHeap( 5860000, 6144140 )

LOAD_DLL  base:063F0000  l3codeca.acm

OutDbStr: Enter InitWriter

 

做VirtualDub video免费程序的作者,在MSMS001.vwp中也步入了同样的怪圈。MSMS001.vwp和VCT3216.acm一样,都是Voxware family of codecs的一部分。

不过看样子,人家并不打算修正这个问题。

所以,你可以买一个自动击键器预备着。

 

Written by [email protected]

本文地址:http://com.8s8s.com/it/it2497.htm