UIKit0 / dspack

Automatically exported from code.google.com/p/dspack
2 stars 1 forks source link

Access Violation in TSysDevEnum.GetBaseFilter() #14

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Moniker.BindToObject(nil, nil, IID_IBaseFilter, result); crashed because 
Moniker was always nil. Changed to:

  function TSysDevEnum.GetBaseFilter(index: integer): IBaseFilter;
  var
    SysDevEnum  : ICreateDevEnum;
    EnumCat     : IEnumMoniker;
    Moniker     : IMoniker;
    // martin begin
    {$IFDEF FPC}
    Fetched     : ULONG;
    {$ENDIF}
    // martin end
  begin
    result := nil;
   if ((index < CountFilters) and (index >= 0)) then
      begin
        CocreateInstance(CLSID_SystemDeviceEnum, nil, CLSCTX_INPROC, IID_ICreateDevEnum, SysDevEnum);
        SysDevEnum.CreateClassEnumerator(FGUID, EnumCat, 0);
        EnumCat.Skip(index);
        {$IFDEF FPC}
        // martin begin
        EnumCat.Next(1, Moniker, Fetched); // RESULT replaced by MONIKER, OD 27.02.2013
        // martin end
        {$ELSE}
        EnumCat.Next(1, Moniker, nil);     // RESULT replaced by MONIKER, OD 27.02.2013
        {$ENDIF}
        Moniker.BindToObject(nil, nil, IID_IBaseFilter, result);
        EnumCat.Reset;
        SysDevEnum := nil;
        EnumCat    := nil;
        Moniker    := nil;
      end
  end;

Original issue reported on code.google.com by ddaahhll...@gmail.com on 27 Feb 2013 at 9:10