CWinApp Assertion failure/ Access violation in odbc32.dll

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Visual Studio 6.0 Visual C++ SP6
Operating System: Windows Server 2003 Enterprise SP1

Issue as to why debugging: Access violations in odbc32.dll (version
3.526.1830.0) when executing SQLFetchScroll in a MFC EXE (Using MVF in a
Shared DLL).

What I’m seeing in the debugger: Before the .EXE reaches the main()
function I am seeing ASSERTION failures on the instantiation of a CWinApp
object.


Background: All of the code referenced below is written with Visual Studio
6.0 Visual C++ SP6.
We have several “utility” DLLs that we’ve created. They are MVFC Extension
DLLs that are linked implicitly to our .EXE modules. The DLLs are also
linked implicitly to each other.

I’ve simplified things by using the app wizard to create the same type of
EXE that is having the issue.

I’m only using 2 of our 5 DLLs, FileUtil & GenUtil. FileUtil is implicitly
linked to GenUtil and FileUtil is implicitly linked to GenUtil. Both are
implicitly linked to my EXE.

In the GenUtil class an instance of FileUtil is created.

In the Genutil.h file – please note there is more to the class than listed
below:

#ifdef EXPORT_GENUTIL
#define IMPORT_OR_EXPORT_GENUTIL __declspec(dllexport)
#else
#define IMPORT_OR_EXPORT_GENUTIL __declspec(dllimport)
#endif

class IMPORT_OR_EXPORT_GENUTIL GenUtil : public CWinApp
{
public:
FileUtil file_name;
}


The stack when the ASSERTION failure occurs:

MFC42D.DLL!CWinApp::CWinApp(const char * lpszAppName=0x00000000) Line 85 +
0x19 C++
FileUtil.dll!FileUtil::FileUtil() Line 27 + 0x2f C++
GenUtil.dll!GenUtil::GenUtil() Line 29 + 0xa9 C++
FileUtil.dll!$E291() Line 21 + 0x11 C++
FileUtil.dll!$E294() + 0x8 C++
MSVCRTD.DLL!_initterm(void (void)* * pfbegin=0x10008008, void (void)* *
pfend=0x1000800c) Line 525 C
FileUtil.dll!_CRT_INIT(void * hDllHandle=0x10000000, unsigned long
dwReason=0x00000001, void * lpreserved=0x0012fd28) Line 184 + 0xf C
FileUtil.dll!_DllMainCRTStartup(void * hDllHandle=0x10000000, unsigned long
dwReason=0x00000001, void * lpreserved=0x0012fd28) Line 267 + 0x11 C
ntdll.dll!_LdrpCallInitRoutine@16() + 0x14
ntdll.dll!_LdrpRunInitializeRoutines@4() - 0xa4
ntdll.dll!_LdrpInitializeProcess@8() - 0x185
ntdll.dll!__LdrpInitialize@12() - 0xc7cc
ntdll.dll!_KiUserApcDispatcher@16() + 0x25

The ASSERTION failure seems to occur when the FileUtil Constructor is called
– I assume when the GenUtil class is instantiated.

- this 0x10009010 {CWinApp <Bad Ptr>} CWinApp * const



If I choose to ABORT the first ASSERTION failure, I get the following dump:

'Jeff_Test4.exe': Loaded 'E:\Jeff_Test4\Debug\Jeff_Test4.exe', Symbols loaded.
'Jeff_Test4.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', Symbols loaded.
'Jeff_Test4.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', Symbols loaded.
'Jeff_Test4.exe': Loaded 'E:\Jeff_Test4\Debug\FileUtil.dll', Symbols loaded.
'Jeff_Test4.exe': Loaded 'E:\Jeff_Test4\Debug\GenUtil.dll', Symbols loaded.
'Jeff_Test4.exe': Loaded 'C:\WINDOWS\system32\MFC42D.DLL', Symbols loaded.
'Jeff_Test4.exe': Loaded 'C:\WINDOWS\system32\MSVCRTD.DLL', Symbols loaded.
'Jeff_Test4.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', Symbols loaded.
'Jeff_Test4.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', Symbols loaded.
'Jeff_Test4.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', Symbols loaded.
'Jeff_Test4.exe': Loaded 'C:\WINDOWS\system32\user32.dll', Symbols loaded.
'Jeff_Test4.exe': Loaded 'C:\WINDOWS\system32\winspool.drv', Symbols loaded.
'Jeff_Test4.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', Symbols loaded.
'Jeff_Test4.exe': Loaded 'C:\WINDOWS\system32\MSVCIRTD.DLL', Symbols loaded.
'Jeff_Test4.exe': Loaded 'C:\WINDOWS\system32\MSVCP60D.DLL', Symbols loaded.
'Jeff_Test4.exe': Loaded 'C:\WINDOWS\system32\uxtheme.dll', Symbols loaded.
'Jeff_Test4.exe': Loaded 'C:\WINDOWS\system32\msctf.dll', Symbols loaded.
'Jeff_Test4.exe': Loaded 'C:\WINDOWS\system32\mslbui.dll', Symbols loaded.
'Jeff_Test4.exe': Loaded 'C:\WINDOWS\system32\oleaut32.dll', Symbols loaded.
'Jeff_Test4.exe': Loaded 'C:\WINDOWS\system32\ole32.dll', Symbols loaded.
Detected memory leaks!
Dumping objects ->
{47} client block at 0x00332440, subtype 0, 64 bytes long.
a CDynLinkLibrary object at $00332440, 64 bytes long
Object dump complete.
The program '[872] Jeff_Test4.exe: Native' has exited with code 3 (0x3).

- this 0x10009010 {CWinApp <Bad Ptr>} CWinApp * const


I am questioning if I am looking in the right place - are these issues
causing memory corruption (showing up in the odbc32.dll calls) or is this
something that can be ignored??

Thanks.


.



Relevant Pages

  • Re: Asus V9250 magic graphics driver - cant see adaptor in Contro
    ... This is a painstaking procedure as there are a lot of dlls and ... exe files to open in depends. ... only created on successful install which hasn't happened. ... driver inf file. ...
    (microsoft.public.windowsxp.embedded)
  • Re: C# Exceptions
    ... I did a runtime analysis of the exe and some important DLLs as ... > signature is valid then the app can decrypt the response and process it. ... > the source code of a managed app. ... NOT FOR THE MAIN PROGRAM EXE FILE. ...
    (Pen-Test)
  • My.Settings Thoughts
    ... was a GLOBAL shared memory map that allowed the EXE and her .NET dlls to shared this "namespace" ... But for the settings, it uses the same file, but the sections are different. ... To provide access to the EXE, I had created Get/Set properties but I did that in the Form partial class. ... That way it can be used by the application DLLs. ...
    (microsoft.public.dotnet.languages.vb)
  • =?ISO-8859-1?Q?DLLs_zur_Laufzeit_austauschen_=2F_ausw=E4hlen?=
    ... einer Exe nach dem Kompilieren eine andere DLL als die ... public static class DingsBums { ... wenn ich alle DLLs gleichzeitig verwenden ... selbst wenn sie alle eine BindingList derselben Datenklasse ...
    (microsoft.public.de.german.entwickler.dotnet.csharp)