In Windows 7, an unhandled exception occurs when calling the method TwainOpenSource. The user sees an error message saying “vshost32.exe has stopped working”. While debugging in Visual Studio 2008, an unhandled exception occurs indicating an access violation reading from a specific location. The access violation code given is 0xC0000005.
I’ve researched this issue and what is often cited as a probable cause is Windows 7 use of Data Execution Protection (DEP).
I have replicated this problem with GdPicture.NET in one of our in-house Windows applications, as well as with one of your latest sample applications (twain_sample).
System Details:
Toolkit: GdPicture.NET Ver 7.4.2
Device: Fujitsu fi-6230
Twain Driver: TWAINDSM.dll, version 2.1.4.0
Operating System: Windows 7 Enterprise
Code Snippet: This is from your sample vb app twain_sample
Code: Select all
Private Function OpenSelectedSource() As Boolean
If lstDevices.Items.Count > 0 Then
Dim ItemIdx As Integer = lstDevices.SelectedIndex
If ItemIdx >= 0 Then
Dim Success As Boolean = oGdPictureImaging.TwainOpenSource(Me.Handle, CStr(lstDevices.Items.Item(ItemIdx)))
If Not Success Then MsgBox("Can't open selected TWAIN device")
Return Success
Else
MsgBox("Please, select a TWAIN device first !")
Return False
End If
Else
MsgBox("No TWAIN Device available !")
End If
End Function
#GdTwain Log Start. Version: 650
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 1
-------------------
Start: OpenSourceManager.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 1
-------------------
DSM 32-bit library loaded: C:\Windows\SysWow64\TWAINDSM.DLL
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 1
-------------------
Entry point of the DSM found.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 1
-------------------
End: OpenSourceManager.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 3
-------------------
GDTWAIN_Mgr: Start Getting DAT_STATUS
RC: TWRC_ENDOFLIST
CC: TWCC_SUCCESS
State: 3
-------------------
GDTWAIN_Mgr: End Getting DAT_STATUS
RC: TWRC_ENDOFLIST
CC: TWCC_SUCCESS
State: 3
-------------------
Start: OpenSource.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 3
-------------------
Exact Error Message:
Unhandled exception at 0x76359775 in twain_sample.exe: 0xC0000005: Access violation
I have followed the steps at viewtopic.php?t=1486, but that did not solve the problem.
Have you had other reports of this problem? And do you have a solution?