Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Clever Code
  4. Not so subtle bug... [modified]

Not so subtle bug... [modified]

Scheduled Pinned Locked Moved Clever Code
helpcomsecuritytoolsquestion
1 Posts 1 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gene OK
    wrote on last edited by
    #1

    Microsoft is interested in this issue and they are actively seeking a resolution. After KB950749 was installed by Windows Update, we started getting exceptions from some of our old DAO legacy applications. This particular type of line is used throughout our code:

    fldNew = tdfDestTable->CreateField(_T("MyField5"), DAO::dbText, 12);

    Out of the blue, the above line of code starting throwing exceptions with a DAO error of 3421 We traced it back to the installation of KB950749 which is a fix for some MSJet 4.0 security issues. Uninstalling KB950749 enables the legacy applications to work. However, this is not desirable, due to the fixes contained in KB950749. After a little experimenting, here's what works and what doesn't. I doubt this affects many users here, but just in case, here is what I've found:

    fldNew = tdfDestTable->CreateField(_T("MyField0"), (short) DAO::dbText, (short) 12); // works
    fldNew = tdfDestTable->CreateField(_T("MyField1"), (long) DAO::dbText, (long) 12); // works
    fldNew = tdfDestTable->CreateField(_T("MyField2"), CComVariant(DAO::dbText), CComVariant(12)); // works
    fldNew = tdfDestTable->CreateField(_T("MyField3"), _variant_t(DAO::dbText), _variant_t(12)); // An exception occurs here, DAO error 3421
    fldNew = tdfDestTable->CreateField(_T("MyField4"), (int) DAO::dbText, (int) 12); // An exception occurs here, DAO error 3421
    // The following line used to work before KB950749 was installed. It is representative of what we have in production
    fldNew = tdfDestTable->CreateField(_T("MyField5"), DAO::dbText, 12); // An exception occurs here, DAO error 3421

    I find it really weird that CreateField will take a long and a short, but not an int. This is caused by the way _variant_t casts numbers. CComVariant defaults to longs, whereas _variant_t defaults to int for numbers. However, the real issue is that CreateField no longer accepts VARIANT of type VT_INT! They have to be VT_I4 or VT_I2. Ouch!

    CodeWiz51 -- Life is not a spectator sport. I came to play. Code's Musings | Code's Articles

    modified on Friday, May 16, 2008 5:28 PM

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups