背景
我构建了具有以下控制流程的应用程序: -
托管C ++ DLL(编译器 - VS2015,OS-windows 7) - > C ++库(编译器 - VS2015,OS - windows 7) - > C库(VS 2015 - win 7) - > C库(编译器 - gcc(minGW) - windows 10)。
我在测试虚拟机(带有VS2015运行时环境的Windows 7)中的c ++库中面临访问内存冲突错误。相同的应用程序在我们的开发机器上工作正常(Windows 7与VS 2015)。
分析
由于我无法在我的开发机器上重现这一点,我无法调试流程。我首先尝试使用GetExceptioninformation()
给了我以下信息: -
Exception code: 0xc0000005
Fault offset: 0x00000000001271f0
Faulting process id: 0xedc
Faulting application start time: 0x01d3e6e36e2cbda8
Faulting application path: C:\Program Files\Microsoft Office\Office15\OUTLOOK.EXE
Faulting module path: C:\Users\Admin\AppData\Local\assembly\dl3\TMCVP0K3.2WC\VCW47EJV.PV7\26e400ac\00b47d69_f8e6d301\DarkMailEngine.DLL
Report Id: c4450271-52d6-11e8-a558-080027fa51ab
作为第二种方法,我在我的测试机器上运行了WinDBG,它给了我跟踪堆栈跟踪: -
FAULTING_IP:
ntdll!RtlSizeHeap+89
00000000`77506789 0fb74118 movzx eax,word ptr [rcx+18h]
EXCEPTION_RECORD: ffffffffffffffff -- (.exr 0xffffffffffffffff)
ExceptionAddress: 0000000077506789 (ntdll!
+0x0000000000000089)
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000000
NumberParameters: 2
Parameter[0]: 0000000000000000
Parameter[1]: 00000f8668c7dd18
Attempt to read from address 00000f8668c7dd18
FAULTING_THREAD: 00000000000006d0
PROCESS_NAME: OUTLOOK.EXE
ERROR_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%08lx referenced memory at 0x%08lx. The memory could not be %s.
EXCEPTION_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%08lx referenced memory at 0x%08lx. The memory could not be %s.
EXCEPTION_PARAMETER1: 0000000000000000
EXCEPTION_PARAMETER2: 00000f8668c7dd18
READ_ADDRESS: 00000f8668c7dd18
FOLLOWUP_IP:
ntdll!RtlSizeHeap+89
00000000`77506789 0fb74118 movzx eax,word ptr [rcx+18h]
MOD_LIST: <ANALYSIS/>
NTGLOBALFLAG: 0
APPLICATION_VERIFIER_FLAGS: 0
MANAGED_STACK:
(TransitionMU)
000000002C02DEC0 000007FE8DD156FB UNKNOWN!DomainBoundILStubClass.IL_STUB_PInvoke(sqlite3*, Void*, Int32)+0x7b
000000002C02DF70 000007FE8DD1565C DarkMailEngine!<Module>.DarkMatter.Client.Internal.CppSQLite3DB.setPassword(DarkMatter.Client.Internal.CppSQLite3DB*, SByte*)+0x4c
000000002C02DFA0 000007FE8DD14842 DarkMailEngine!<Module>.DarkMatter.Client.Internal.ModelStore.initialize(DarkMatter.Client.Internal.ModelStore*, std.vector<unsigned char,std::allocator<unsigned char> >*)+0x152
000000002C02E0D0 000007FE8DD1420D DarkMailEngine!<Module>.DarkMatter.Client.Internal.ModelStore.initialize(DarkMatter.Client.Internal.ModelStore*)+0x9d
000000002C02E1E0 000007FE8DD13EA9 DarkMailEngine!<Module>.DarkMatter.Client.Internal.DatabaseOpenManager.{ctor}(DarkMatter.Client.Internal.DatabaseOpenManager*)+0x49
000000002C02E220 000007FE8DD188D9 DarkMailEngine!<Module>.DarkMatter.Client.Internal.ModelStore.getSetting(DarkMatter.Client.Internal.ModelStore*, std.vector<std::vector<unsigned char,std::allocator<unsigned char> >,std::allocator<std::vector<unsigned char,std::allocator<unsigned char> > > >*, std.basic_string<char,std::char_traits<char>,std::allocator<char> >*, std.basic_string<char,std::char_traits<char>,std::allocator<char> >*)+0x99
有人可以建议我如何解决这个问题或者可能导致这个问题的原因。