FYI: KB4015217 breaks ADODB.Recordset Filter property-VBForums
Results 1 to 8 of 8

Thread: FYI: KB4015217 breaks ADODB.Recordset Filter property

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2011
    Posts
    264

    FYI: KB4015217 breaks ADODB.Recordset Filter property

    Latest Windows 10 Update KB4015217 breaks ADODB.Recordset Filter property when using array of bookmarks.

    Here is repro
    Code:
    Option Explicit
    
    Private Sub Form_Load()
        Const adInteger As Long = 3
        Dim rs          As Object
        
        Set rs = CreateObject("ADODB.Recordset")
        rs.Fields.Append "ID", adInteger
        rs.Open
        rs.AddNew "ID", 1
        rs.AddNew "ID", 2
        rs.MoveFirst
        rs.Filter = Array(rs.Bookmark)
    End Sub
    Last line causes Access Violation when using early bound calls and renders most of our applications unusable.

    The equivalent KB4015549 (Monthly Rollup) patch for Windows 7 breaks client-side cursor library in similar manner.

    The offending version of C:\Program Files (x86)\Common Files\System\ado\msado15.dll is 10.0.14393.1066

    cheers,
    </wqw>

  2. #2
    New Member
    Join Date
    Apr 2017
    Posts
    1

    Re: FYI: KB4015217 breaks ADODB.Recordset Filter property

    I'm having this exact problem starting today as well, but I'm accessing the ancient adodb.dll version 7.10.2346 from C# in VS 2013 (a COM interface from VB6 is involved, too). I have no idea how to start fixing this. "Embed interop types" is set to false for the reference, so I'm starting with turning that on. Have you discovered anything yet?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2011
    Posts
    264

    Re: FYI: KB4015217 breaks ADODB.Recordset Filter property

    We just removed the cumulative update (refusing supporting it) and are waiting for a fix from MS now. A simple workaround that worked in our particular case was to replace the array of bookmarks with ID=x OR ID=y OR ID=z but we almost always do have ID field in our recordsets.

    Unfortunately this is not 1:1 replacement for the bookmarks array filter as when you filter on Array(8, 3, 5) you get the recordset in exactly the same order (8th row, then 3rd row, then 5th) while with `ID=x OR y OR z` the original order is kept no matter the order x, y or z in the filter.

    cheers,
    </wqw>

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Posts
    16,328

    Re: FYI: KB4015217 breaks ADODB.Recordset Filter property

    We saw it with early-bound Recordsets as well. Users were reporting "program just blows up" but this is exactly what is going on.

    On Windows 10 Pro you can uninstall the patch and then run the wushowhide.diagcab from:

    How to temporarily prevent a driver update from reinstalling in Windows 10.

    This isn't just for driver updates as the name suggests.

    Win10 Home users have little option but to set their Internet network adapter to "metered connection" to stave off updates until this is resolved.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    May 2011
    Posts
    264

    Re: FYI: KB4015217 breaks ADODB.Recordset Filter property

    Setting `Filter` property late-bound converts AV to a trappable `Method 'Filter' of object '_Recordset' failed` error as VB installs custom SEH during late-bound calls for this exact purpose but at this point the Recordset object internals are messed up and in the error handler it's not possible to access `Filter` property -- it just AVs again.

    Here is my attempted (not working) work-around:
    Code:
    Public Function SetRecordsetFilter(rs As Recordset, vFilter As Variant) As Recordset
        Const FUNC_NAME     As String = "SetRecordsetFilter"
        Dim oObj            As Object
        
        On Error GoTo EH
        If Not IsArray(vFilter) Then
            rs.Filter = vFilter
        Else
            rs.Filter = adFilterNone
            Set oObj = rs
            On Error GoTo EH_Filter
            Debug.Print 1 / 0
            oObj.Filter = vFilter
    AfterFilter:
            On Error GoTo EH
        End If
        Set SetRecordsetFilter = rs
        Exit Function
    EH:
        If RaiseError(FUNC_NAME & "(vFilter=" & DumpParam(vFilter) & ")") = vbRetry Then
            Resume
        End If
    EH_Filter:
        Dim oFld            As ADODB.Field
        Dim cBuilder        As Collection
        Dim vBmk            As Variant
        Dim sFilter         As String
    
        Set oFld = rs!ID
        Set cBuilder = New Collection
        For Each vBmk In vFilter
            If SetBookmark(rs, vBmk) Then
                cBuilder.Add "ID=" & oFld.Value
            End If
        Next
        sFilter = ConcatCollection(cBuilder, " OR ")
        If LenB(sFilter) <> 0 Then
            rs.Filter = sFilter  '<-- at this point Recordset is messed up beyond repair and blows up again
        Else
            rs.Filter = EmptyVariantArray
        End If
        Resume AfterFilter
    End Function
    cheers,
    </wqw>
    Last edited by wqweto; Apr 13th, 2017 at 04:11 AM.

  6. #6
    Frenzied Member
    Join Date
    May 2014
    Location
    Central Europe
    Posts
    1,116

    Re: FYI: KB4015217 breaks ADODB.Recordset Filter property

    Its a shame how MS deals with legacy components nowadays. i have seen several updates affecting especially common controls library in the past few years and it seems that they do not really care about this or even want to push developers away from the these old technics.
    does not help, i know, but i just wanted to say i find it a disgrace for MS.

  7. #7
    PowerPoster
    Join Date
    Feb 2006
    Posts
    16,328

    Re: FYI: KB4015217 breaks ADODB.Recordset Filter property

    April 2017 Monthly Rollup Breaks VB6 App mentions Win7 and Win8.1 as well as Win10.

    It has a link back to this thread.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    May 2011
    Posts
    264

    Re: FYI: KB4015217 breaks ADODB.Recordset Filter property

    Reversing `Filter` property I just found out that one can use byte-arrays for bookmarks -- this is not documented as far as I can google it. Something like `Redim baBmk(0 to 3) As Byte` is a valid bookmark and can be assigned to `Filter` for a single-record view of the recordset. So using `Array(baBmk1, baBmk2, ...)` is also valid but does not solve the problem w/ KB4015217 (AV in `ExtractArray` function which does not check a NULL pointer in last argument, passed by `ExtractBookmarksArray` where the actual bug is).

    The workaround I'm currently deploying is by using activation context to force usage of previous version of msado15.dll like this
    Code:
        With CreateObject("Microsoft.Windows.ActCtx")
            .Manifest = App.Path & "\support\msado15.dll.manifest"
            Set rs = .CreateObject("ADODB.Recordset")
        End With
    . . . where the msado15.dll.manifest is created either by UMMM or DLLAsm.

    There are a couple of quirks in this workaround mode: First, rs.NextRecordset creates an ADODB.Recordset from the system registered coclass (so don't filter these!) and second, cloning a recordset with PropertyBag (.WriteProperty and then Set rs = .ReadProperty("rs")) also might "escape" the activation context.

    For the second case I just create a recordset from ActCtx and then `rs.Open .ReadProperty("rs")` to "clone" the data.

    cheers,
    </wqw>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.