Xerox 152, Win 7 (64 bit) and possible Vista Issue

Discussions about TWAIN & WIA scanning in GdPicture.NET using GdPictureImaging.
Post Reply
andypl
Posts: 15
Joined: Fri Nov 13, 2009 5:10 pm

Xerox 152, Win 7 (64 bit) and possible Vista Issue

Post by andypl » Fri Dec 25, 2009 12:01 am

My application has scanned fine with a Xerox 152 on XP. I recently tried it on Win 7 + 64 bit and it crashed during a scan. The app is targeted for x86. I am also having reports of it crashing on 32 bit Vista using the same Xerox 152 scanner.

I am using the latest TWAIN drivers for the scanner. Here is the TWAIN log from the Win 7+64 Bit. I am working on getting a copy of the TWAIN log for Vista+32 bit.

Code: Select all


#GdTwain Log Start. Version: 632

RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 1
-------------------
Start: OpenSourceManager.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 1
-------------------
DSM library loaded: C:\Windows\TWAIN_32.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
-------------------
Start: OpenDefaultSource.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 3
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
Start: SetXferMech.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
End: SetXferMech.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
End: OpenDefaultSource.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_CAPUNSUPPORTED
-------------------
Start: SetAutoFeed.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
CAP_AUTOFEED. Result for Set False.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
End: SetAutoFeed.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
Start: Set Duplex False.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
End Set Duplex.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADVALUE
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_CAPUNSUPPORTED
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_CAPUNSUPPORTED
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
Start: AcquireNative.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
Source: Xerox DocuMate 152
Manufacturer: Visioneer Inc
-------------------
AcquireNative: Retrieving current device configuration - Start.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS
-------------------
AcquireNative: Retrieving current device configuration - End.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS
-------------------
Start: WaitForXfer.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS
-------------------
Start: SetXferMech.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
End: SetXferMech.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
Start: EnableSource.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_USERINTERFACE - MSG: MSG_ENABLEDS ->RC: TWRC_SUCCESS
-------------------
End: EnableSource.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 5
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_DSEVENT CC: TWCC_SUCCESS
-------------------
MessageHook: MSG_XFERREADY.
RC:   TWRC_DSEVENT
CC:   TWCC_SUCCESS
State: 6
-------------------
Start: DoOneTransfer.
RC:   TWRC_DSEVENT
CC:   TWCC_SUCCESS
State: 6
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS
-------------------
Start: NativeXferHandler.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 6
-------------------
And my code...

Code: Select all


        m_gd.TwainSetHideUI(True)
        m_gd.TwainSetAutoBrightness(True)
        m_gd.TwainSetAutoFeed(settings.useADF)
        m_gd.TwainEnableDuplex(settings.duplexScanning)
        m_gd.TwainSetResolution(settings.dpi)
        If (settings.paperSize <> GdPicture.TwainPaperSize.NONE) Then
            m_gd.TwainSetAutoSize(False)
            m_gd.TwainSetPaperSize(settings.paperSize)
        Else
            m_gd.TwainSetAutoSize(True)
        End If
        Select Case CType(settings.scanType, RGSettings.ScanningColorDefault)
            Case RGSettings.ScanningColorDefault.BW
                m_gd.TwainSetPixelType(TwainPixelType.TWPT_BW)
                m_gd.TwainSetBitDepth(1)
            Case RGSettings.ScanningColorDefault.Grayscale
                m_gd.TwainSetPixelType(TwainPixelType.TWPT_GRAY)
                m_gd.TwainSetBitDepth(8)
            Case RGSettings.ScanningColorDefault.Color
                m_gd.TwainSetPixelType(TwainPixelType.TWPT_RGB)
                m_gd.TwainSetBitDepth(24)
            Case RGSettings.ScanningColorDefault.Unknown
                m_gd.TwainSetPixelType(TwainPixelType.TWPT_GRAY)
                m_gd.TwainSetBitDepth(8)
        End Select

    If (settings.generateLog) Then
            m_gd.TwainLogStart("c:\twainlog.txt")
        End If
        Dim bResult As Boolean = False
        If m_gd.TwainOpenDefaultSource(Nothing) Then
            Configure(settings)
            Do
                Dim iImageId As Integer = m_gd.TwainAcquireToGdPictureImage(Nothing)
                If iImageId <> 0 Then
                    If (Not AddImageFunc(iImageId)) Then
                        m_gd.TwainCloseSource()
                        Return False
                    End If
                End If
            Loop While m_gd.TwainGetState > TwainStatus.TWAIN_SOURCE_ENABLED
            m_gd.TwainCloseSource()
            bResult = True
        Else
            MsgBox("can't open default source, twain state is: " & m_gd.TwainGetState.ToString)
            bResult = False
        End If

        m_parent.BringToFront()
        Return bResult
Thanks
Andy

andypl
Posts: 15
Joined: Fri Nov 13, 2009 5:10 pm

Re: Xerox 152, Win 7 (64 bit) and possible Vista Issue

Post by andypl » Fri Dec 25, 2009 5:31 am

Additional pieces of information:

* I just updated my GDPicture.NET to 6.5.0.2 (the latest I believe), and the problem persists
* The same crash happens in your twain scanning sample if I uncheck HIDE UI. I have no idea if this is related, but it happens. If the HIDE UI is checked, it scans.
* I've tried supplying a valid window handle to the TwainOpenDefaultSource and TwainAcquireToGdPictureImage but it made no difference

Also - here is the stack trace, and the crash is definitely happing in TwainAcquireToGdPictureImage

Code: Select all


   <message>System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at Ꮺ.≄.≳(IntPtr ≴)
   at GdPicture.GdPictureImaging.TwainAcquireToDib(IntPtr HANDLE)
   at GdPicture.GdPictureImaging.TwainAcquireToGdPictureImage(IntPtr HANDLE)
   at RockGymPro.Scanner.Scan(Settings settings, AddGDScannedImageDelegrate AddImageFunc) in C:\Documents and Settings\Andy\My Documents\RGPro\RGP\Public\MainApp\Core\Imaging\Scanner.vb:line 70
   at RockGymPro.DlgScanNewDocument.btnScan_Click(Object sender, EventArgs e) in C:\Documents and Settings\Andy\My Documents\RGPro\RGP\Public\MainApp\Windows\DMS\DlgScanNewDocument.vb:line 164
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)</message>
</exception>

Thanks
Andy
Last edited by andypl on Fri Dec 25, 2009 3:35 pm, edited 1 time in total.

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Xerox 152, Win 7 (64 bit) and possible Vista Issue

Post by Loïc » Fri Dec 25, 2009 12:48 pm

Hi Andy,

Thank you for the clear report. Unfortunately I can't see any problem in GdPicture. I suspect a problem into to TWAIN driver.
The log ends at "Start: NativeXferHandler.", this mean the next step is 100% accomplished by your TWAIN driver.

I can give you 2 suggestions:

- Try to find another Driver for your scanner
- Try to use the latest TWAIN DSM provided by twain.org. You can download it from http://sourceforge.net/projects/twain-dsm/files/

With best regards,

Loïc

andypl
Posts: 15
Joined: Fri Nov 13, 2009 5:10 pm

Re: Xerox 152, Win 7 (64 bit) and possible Vista Issue

Post by andypl » Fri Dec 25, 2009 4:04 pm

Hi Loic,

I updated my hardware specific TWAIN driver (I thought I was running the latest), and it fixed the problem on my Win 7 (64 bit). I'm waiting for a report back on Vista (32 bit).

I'll let you know when I know.

Happy Holidays!
Andy

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Xerox 152, Win 7 (64 bit) and possible Vista Issue

Post by Loïc » Fri Dec 25, 2009 4:30 pm

Wonderful Andy.

Thank you very much for the feedback.

Happy holidays too :D

myriam
Posts: 2
Joined: Tue May 06, 2014 12:00 pm

Re: twain.dll on Win 7 (64 bit)

Post by myriam » Tue May 06, 2014 4:44 pm

Hello,

I'm encountering an issue when trying to connect my application winform (.net) using gdpicture.net to a scanner futjisu 6670 on a Windows 7 64bit .
I get the twainlog.txt telling that :

Start: OpenSourceManager,
RC: TWRC_SUCCESS
CC: TWCC8SUCCESS
STATE: 1
-----------------------------
Standard DSM library can not be loaded,
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
STATE: 1
-----------------------------
End: OpenSourceManager,
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
STATE: 1
-----------------------------
Start: OpenSourceManager,
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
STATE: 1
-----------------------------
Standard DSM library can not be loaded,
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
STATE: 1
-----------------------------
End: OpenSourceManager,
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
STATE: 1
-----------------------------
SelectImageSource: Unable to open Source Manager.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
STATE: 1

I haven't met this issue when i installed my application on a win xp 32bit.

Can you help me resolve this issue, because i checked many solutions but in vain.

thank for any helpfull and prompt reply.

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: Xerox 152, Win 7 (64 bit) and possible Vista Issue

Post by SamiKharma » Sun May 11, 2014 12:48 pm

Hi,

Please follow the steps here: viewtopic.php?t=1486

If, that doe snot work, unfortunately, most scanners do not have correctly implemented 64 bit drivers. This is beyond the control of GdPicture. For Twain, it is always better to stick with 32 bit because those are usually the correctly implemented drivers.

Best,
Sami

myriam
Posts: 2
Joined: Tue May 06, 2014 12:00 pm

Re: Xerox 152, Win 7 (64 bit) and possible Vista Issue

Post by myriam » Tue May 13, 2014 11:49 am

Thanks Sami for your reply,

Hope it will resolve the issue.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest