ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Attempting to scan with nothing loaded hangs app

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
JonRobertson Posted - Oct 20 2011 : 17:12:42
I'm using a business card scanner and inadvertently called Acquire when there is nothing ready to scan. I get an External Exception C0000008. But the bigger problem is that the ImageEn code locks up. I'll start at imscan.IETW_Acquire:


    // shut everything down in the right sequence
    // these routines do nothing if the corresponding 'open' failed
    IETW_DisableSource(grec);
    IETW_CloseSource(grec);


IETW_DisableSource fails. IETW_CloseSource is then called. since nState = 5, IETW_DisableSource is called again. That then calls IETW_DS with MSG_DISABLEDS, which calls DSM_Entry.

At this point, my app locks up. The process is not completely locked up because a breakpoint in Classes.StdWndProc will break when I move the mouse over my form, etc. But DSM_Entry never returns and my UI is mostly unresponsive. (UI changes corresponding to mouse enter/exit/move/over related events occur. But buttons, menu items, and other visual controls do not receive focus.)

Is there anything else you need from me so this issue can be resolved?

Thanks

4   L A T E S T    R E P L I E S    (Newest First)
fab Posted - Oct 27 2011 : 08:12:03
It is ok, thank you! This change will be included in next minor release.
JonRobertson Posted - Oct 25 2011 : 07:03:28
Btw, fAborting is being set to True in IETW_XferReadyMulti in the "case rc of", when rc = TWRC_FAILURE.

In this scenario, MSG_DISABLEDS is sent twice. Do most drivers handle this without exception and thus this driver is poorly behaving? Or should ImageEn be altered to avoid sending MSG_DISABLEDS twice?

Now that the exception is not occurring, I confirmed that MIO.Acquire is returning False for my scenario, indicating that the scan did fail. That's good. ;)
JonRobertson Posted - Oct 25 2011 : 06:55:25
Here is a little more detail:

  • IETW_Acquire calls IETW_ModalEventLoop.

  • IETW_ModalEventLoop calls IETW_MessageHook.

  • While handling the MSG_XFERREADY message, fAborting is True, so IETW_DisableSource is called (with no exception occurring).

  • However, IETW_DS(..., MSG_DISABLEDS, ...) returns False so nState is left at 5. But no exception occurs during this call to IETW_DisableSource.

  • Once IETW_ModalEventLoop exits, IETW_Acquire calls IETW_DisableSource.

  • Since nState = 5, IETW_DS(..., MSG_DISABLEDS, ...) is called again, and this time the external exception occurs.


In IETW_DisableSource, I changed the code to set nState := 4 even if the call to IETW_DS returns False. So this:
if (nState = 5) and (IETW_DS(grec, DG_CONTROL, DAT_USERINTERFACE, MSG_DISABLEDS, @twUI)) then
  nState := 4;

is now this:
if nState = 5 then begin
  IETW_DS(grec, DG_CONTROL, DAT_USERINTERFACE, MSG_DISABLEDS, @twUI);
  nState := 4;
end;


IETW_DisableSource no longer sends MSG_DISABLEDS to the driver twice and I no longer receive the external exception.

Now the scan silently fails and I get a black image, which is better than the previous experience. Now I need to see if I can detect whether something is loaded in the scanner before calling Acquire.

Jon
fab Posted - Oct 24 2011 : 00:08:10
Actually I don't know how to solve this problem. The external exception should come from the driver, and should not happen. The driver refuses to be disabled.

That is the unique right closing sequence. One try you should do is to force data source closing changing the code in this way:

IETW_DisableSource(grec);
nState := 4;
IETW_CloseSource(grec);

Please let me know what happens.