ODBC Driver Manager memory corruption on call to SQLDriverConnect
- From: JGFoster <JGFoster@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 23 Apr 2008 11:26:01 -0700
I am building an ODBC Driver for Microsoft Windows XP. I am getting memory
corruption during a call from the application to SQLDriverConnect(). I
observe the following:
1. The application allocates an environment handle (provided by the Driver
Manager);
2. The application allocates a connection handle (provided by the Driver
Manager);
3. The application calls SQLSetEnvAttr with SQL_ATTR_ODBC_VERSION as 2;
4. The application calls SQLDriverConnect() with appropriate arguments;
5. The Driver Manager calls my driver to allocate an environment handle
which I return;
6. The Driver Manager calls my driver to set the ODBC version to 2 (and
passes in the correct environment handle created in step #5);
7. The Driver Manager calls my driver to allocate a connection handle (and
passes in the correct environment handle created in step #5) which I return;
8. The Driver Manager calls my driver to query the driver ODBC version
string (and passes in the correct environment handle created in step #5) and
I return "03.52";
9. At this point things become a bit fuzzy. It appears that the Driver
Manager decides to abandon the connection attempt--my SQLDriverConnect()
function is never called--and the Driver Manager modifies its copy of the
driver environment handle;
10. The Driver Manager calls my driver to free the connection handle (and
passes in the correct connection handle allocated in step #7);
11. The Driver Manager calls my driver to free the environment handle--and
passes in a bad value;
12. When my driver attempts to free the environment handle the Driver
Manager provides, the memory manager reports this as a corrupt pointer.
I assume that there is something missing from or wrong with my driver, but I
can't see what it might be--or why such an error would prompt the Driver
Manager to corrupt memory. Calls to SQLConnect() do not suffer the same fate.
I'm logging all entrypoints in my driver, and these are the only calls the
Driver Manager makes.
.
- Follow-Ups:
- Prev by Date: Microsoft OLE DB Provider for ODBC Drivers error '80004005'
- Next by Date: RE: ODBC Driver Manager memory corruption on call to SQLDriverConnect
- Previous by thread: Microsoft OLE DB Provider for ODBC Drivers error '80004005'
- Next by thread: RE: ODBC Driver Manager memory corruption on call to SQLDriverConnect
- Index(es):
Relevant Pages
|
|