twain.exe caused an Access Violation at location 7c809783 in module kernel32.dll Writing to location 0440f6fc.

Registers:
eax=ffffffff ebx=00257a48 ecx=0440f6fc edx=00070000 esi=0022f898 edi=01169ebc
eip=7c809783 esp=0022f608 ebp=0022f8e8 iopl=0         nv up ei pl nz na po cy
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000207

Call stack:
7C809783  kernel32.dll:7C809783  InterlockedDecrement
0114AA85  Scanobj.ds:0114AA85
0114A2BD  Scanobj.ds:0114A2BD
0114A1A0  Scanobj.ds:0114A1A0
0114D98F  Scanobj.ds:0114D98F  DS_Entry
5B653E89  twain_32.dll:5B653E89  WGDlgProc
5B6566F6  twain_32.dll:5B6566F6  WGDlgProc
5B6567BC  twain_32.dll:5B6567BC  WGDlgProc
5B656AA4  twain_32.dll:5B656AA4  WGDlgProc
5B656C98  twain_32.dll:5B656C98  WGDlgProc
5B6561B1  twain_32.dll:5B6561B1  WGDlgProc
5B6562AD  twain_32.dll:5B6562AD  WGDlgProc
5B6563E6  twain_32.dll:5B6563E6  WGDlgProc
5B653C34  twain_32.dll:5B653C34  DSM_Entry
00402B37  twain.exe:00402B37  callDSM  tw_win.c:80
TW_UINT16 callDSM(
	pTW_IDENTITY pOrigin = &{
		TW_UINT32 Id = 20,
		TW_VERSION Version = {
			TW_UINT16 MajorNum = 0,
			TW_UINT16 MinorNum = 1,
			TW_UINT16 Language = 13,
			TW_UINT16 Country = 1,
			TW_STR32 Info = (array)
		},
		TW_UINT16 ProtocolMajor = 1,
		TW_UINT16 ProtocolMinor = 8,
		TW_UINT32 SupportedGroups = 2,
		TW_STR32 Manufacturer = (array),
		TW_STR32 ProductFamily = (array),
		TW_STR32 ProductName = (array)
	},
	pTW_IDENTITY pDest = &{
		TW_UINT32 Id = ,
		TW_VERSION Version = {
			TW_UINT16 MajorNum = ,
			TW_UINT16 MinorNum = ,
			TW_UINT16 Language = ,
			TW_UINT16 Country = ,
			TW_STR32 Info = (array)
		},
		TW_UINT16 ProtocolMajor = ,
		TW_UINT16 ProtocolMinor = ,
		TW_UINT32 SupportedGroups = ,
		TW_STR32 Manufacturer = (array),
		TW_STR32 ProductFamily = (array),
		TW_STR32 ProductName = (array)
	},
	TW_UINT32 DG = 1,
	int DAT = 3,
	int MSG = 1025,
	TW_MEMREF pData = 
)
	...
	{
	  /* Call the function */
>	  return (*dsmEntryPoint) (pOrigin, pDest, DG, DAT, MSG, pData);
	}
	
	...

004015B7  twain.exe:004015B7  openDS  tw_func.c:332
int openDS(
	pTW_SESSION twSession = &{
		TW_HANDLE hwnd = 0x002f08fe,
		TW_UINT16 twRC = 0,
		pTW_IDENTITY appIdentity = 0x003f7ed0,
		pTW_IDENTITY dsIdentity = 0x003f97e8,
		pTXFR_CB_FUNCS transferFunctions = 0x00404060,
		void * clientData = 0x00000000,
		int twainState = 3
	}
)
	...
	  /* Open the TWAIN datasource */
	  dsIdentity = DS_IDENTITY(twSession);
>	  twSession->twRC = callDSM(APP_IDENTITY(twSession), NULL,
	    DG_CONTROL, DAT_IDENTITY, MSG_OPENDS,
	    (TW_MEMREF) dsIdentity);
	...

004018C4  twain.exe:004018C4  getImage  tw_func.c:198
int getImage(
	pTW_SESSION twSession = &{
		TW_HANDLE hwnd = 0x002f08fe,
		TW_UINT16 twRC = 0,
		pTW_IDENTITY appIdentity = 0x003f7ed0,
		pTW_IDENTITY dsIdentity = 0x003f97e8,
		pTXFR_CB_FUNCS transferFunctions = 0x00404060,
		void * clientData = 0x00000000,
		int twainState = 3
	}
)
	...
	  }
	
>	  if (!openDS(twSession)) {
	    LogMessage("Unable to open datasource\n");
	    return FALSE;
	...

00401FE3  twain.exe:00401FE3  scanImage  twain.c:217
int scanImage(
	
)
	...
	#endif /* _DEBUG */
	    return getImage (twSession);
>	}
	
	/*
	...

0040312D  twain.exe:0040312D  WndProc  tw_win.c:452
LRESULT WndProc(
	HWND hWnd = &{
		int i = 
	},
	UINT message = 1124,
	WPARAM wParam = 0,
	LPARAM lParam = 0
)
	...
	  }
	  return 0;
>	}
	
	
	...

77D18734  USER32.dll:77D18734  GetDC
77D18816  USER32.dll:77D18816  GetDC
77D189CD  USER32.dll:77D189CD  GetWindowLongW
77D196C7  USER32.dll:77D196C7  DispatchMessageA
00402D99  twain.exe:00402D99  twainMessageLoop  tw_win.c:221
int twainMessageLoop(
	pTW_SESSION twSession = &{
		TW_HANDLE hwnd = 0x002f08fe,
		TW_UINT16 twRC = 0,
		pTW_IDENTITY appIdentity = 0x003f7ed0,
		pTW_IDENTITY dsIdentity = 0x003f97e8,
		pTXFR_CB_FUNCS transferFunctions = 0x00404060,
		void * clientData = 0x00000000,
		int twainState = 3
	}
)
	...
	    if (DS_IS_CLOSED(twSession) || !TwainProcessMessage(&msg, twSession)) {
	      TranslateMessage((LPMSG)&msg);
>	      DispatchMessage(&msg);
	    }
	  }
	...

004030C5  twain.exe:004030C5  twainMain  tw_win.c:425
int twainMain(
	
)
	...
	   * exits.
	   */
>	  return twainMessageLoop(twSession);
	}
	
	...

0040228A  twain.exe:0040228A  run  twain.c:443
static void run(
	const gchar * name = &'t',
	gint nparams = 1,
	const GimpParam * param = &(indirect),
	gint * nreturn_vals = &1,
	GimpParam * * return_vals = &0x00406038
)
	...
	  /* Have we succeeded so far? */
	  if (values[0].data.d_status == GIMP_PDB_SUCCESS)
>	    twainMain ();
	
	  /* Check to make sure we got at least one valid
	...

6E1C29A0  libgimp-2.0-0.dll:6E1C29A0  gimp_main  gimp.c:1808
gint gimp_main(
	const GimpPlugInInfo * info = &(indirect),
	gint argc = 6,
	gchar * * argv = &0x003f2b35
)
	...
	                                 &return_vals);
	
>	      proc_return.name    = proc_run->name;
	      proc_return.nparams = n_return_vals;
	      proc_return.params  = (GPParam *) return_vals;
	...

00402EDD  twain.exe:00402EDD  main  tw_win.c:327
int main(
	int argc = 6,
	char * * argv = &0x003f2b35
)
	...
	   */
	  return gimp_main(&PLUG_IN_INFO, __argc, __argv);
>	}
	
	/*
	...

00401247  twain.exe:00401247
004012B8  twain.exe:004012B8
7C816FD7  kernel32.dll:7C816FD7  RegisterWaitForInputIdle
