soukoku / ntwain

A TWAIN lib for dotnet.
MIT License
119 stars 49 forks source link

Fatal error on Canon DR-G2140 #9

Open mstoicescu opened 4 years ago

mstoicescu commented 4 years ago

Fail on: CANON ELECTRONICS INC. DR-G2000 Driver (1.1) Protocol TWAIN 2.3

2020-03-08 18:57:58.8026|FATAL|Main|An application error(UnhandledException) occurred. (TotalMemory:13716828) 
System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at NTwain.Internals.InternalMessageLoopHook.<>c__DisplayClass3_1.<Start>b__0() in C:\Users\ewang\Source\ntwain\src\NTwain\Internals\InternalMessageLoopHook.cs:line 45
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Just OK on: CANON ELECTRONICS INC. Canon DR-C130 Driver (1.123) Protocol TWAIN 2.0

dcrenl commented 3 years ago

"UnsafeNativeMethods.cs"

[DllImport("kernel32")] modify [DllImport("kernel32", EntryPoint = "***", ExactSpelling = true)]

"Dsm.WinOld.cs" and "Dsm.WinNew.cs" [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY)] modify [SuppressMessage("Microsoft.Interoperability", "CA1400:PInvokeEntryPointsShouldExist")] [DllImport(WIN_NEW_DSM_NAME, EntryPoint = DSM_ENTRY, CharSet = CharSet.Ansi)]