Message: Attempted to read or write protected memory. This is often an indication that other memory

xp oracle access 链接表
//z 2012-08-10 17:33:09 IS2120@csdn.T3850797830[T70,L664,R22,V685]
总是遇到这个异常,暂无解决方案

//z 2012-08-13 17:07:41 IS2120@csdn.T2028960486[T86,L1205,R32,V819]
改用新的jet engine,可以避开该问题。

//z 2012-08-10 17:33:09 IS2120@csdn.T3850797830[T70,L664,R22,V685]
[1240] ____#0 Message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
[1240]     !StackTrace #    at System.Data.Common.UnsafeNativeMethods.ICommandText.Execute(IntPtr pUnkOuter, Guid& riid, tagDBPARAMS pDBParams, IntPtr& pcRowsAffected, Object& ppRowset)
[1240]    at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
[1240]    at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
[1240]    at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
[1240]    at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
[1240]    at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()

用windbg看了下,具体而表面的原因是msjet40.dll内部出错了,传给 wcscpy 的两个参数都存在问题
FAULTING_IP:
msjet40!wcscpy+12
1b00b5d7 668908          mov     word ptr [eax],cx

EXCEPTION_RECORD:  ffffffff -- (.exr 0xffffffffffffffff)
ExceptionAddress: 1b00b5d7 (msjet40!wcscpy+0x00000012)
   ExceptionCode: c0000005 (Access violation)
  ExceptionFlags: 00000000
NumberParameters: 2
   Parameter[0]: 00000001
   Parameter[1]: 00000000

Attempt to write to address 00000000


//z 2012-08-13 17:07:41 IS2120@csdn.T2028960486[T86,L1205,R32,V819]
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_CODE_STR:  c0000005

EXCEPTION_PARAMETER1:  00000001

EXCEPTION_PARAMETER2:  00000000

WRITE_ADDRESS:  00000000

FOLLOWUP_IP:
msjet40!wcscpy+12
1b00b5d7 668908          mov     word ptr [eax],cx

WATSON_BKT_MODULE:  msjet40.dll

WATSON_BKT_MODVER:  4.0.9511.0

MODULE_VER_PRODUCT:  Microsoft (R) Jet

BUILD_VERSION_STRING:  5.1.2600.5781 (xpsp_sp3_gdr.090321-1317)

MANAGED_STACK:
(TransitionMU)
0022E0CC 146B7E37 System_Data_ni!System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(System.Data.OleDb.tagDBPARAMS, System.Object ByRef)+0xe3
0022E0EC 146B7FFD System_Data_ni!System.Data.OleDb.OleDbCommand.ExecuteCommandText(System.Object ByRef)+0xbd
0022E124 146B7347 System_Data_ni!System.Data.OleDb.OleDbCommand.ExecuteCommand(System.Data.CommandBehavior, System.Object ByRef)+0x3b
0022E138 146B70A2 System_Data_ni!System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(System.Data.CommandBehavior, System.String)+0xa2
0022E17C 146B7B42 System_Data_ni!System.Data.OleDb.OleDbCommand.ExecuteNonQuery()+0x72
//z 2012-08-13 17:07:41 IS2120@csdn.T2028960486[T86,L1205,R32,V819]

原文地址:https://www.cnblogs.com/IS2120/p/6745857.html