DTWAIN_GetDSMSearchOrderEx

DTWAIN_GetDSMSearchOrderExA

DTWAIN_GetDSMSearchOrderExW

Top  Previous  Next

The DTWAIN_GetDSMSearchOrderEx function gets the directories that are searched whenever DTWAIN attempts to locate and load the TWAIN Data Source Manager.

 

DTWAIN_BOOL DTWAIN_GetDSMSearchOrderEx (

LPTSTR

SearchOrder,

LPTSTR

UserDirectory );

 

Parameters

SearchOrder

A buffer that on return, will denote the order of directory searching when attempting to locate and load the TWAIN Data Source Manager.  This string will be NULL terminated.

 

UserDirectory

A buffer that on return, will denote the user-defined directory when searching for the TWAIN Data Source Manager, or an empty string if no user-defined directory is used.  This string will be NULL terminated.

 

Return Values

TRUE if successful, FALSE otherwise.  If the function returns FALSE, call DTWAIN_GetLastError() to get extended information.

 

Character specific version

ANSI version:

DTWAIN_GetDSMSearchOrderExA

Unicode version:

DTWAIN_GetDSMSearchOrderExW


Comments

The DTWAIN_GetDSMSearchOrderEx function gets the order of the directories searched when attempting to locate and load the TWAIN Data Source Manager (DSM) File.  This file is usually TWAIN_32.DLL or TWAINDSM.DLL, depending on whether the application is 32-bit or 64-bit.  


The DTWAIN_GetDSMSearchOrderEx esentially returns the values set after a call to DTWAIN_SetDSMSearchOrderEx() has been executed, unless the DTWAIN_GetDSMSearchOrderEx function is called before DTWAIN_SysInitialize of DTWAIN_SysInitializeNoBlocking.  In this case, DTWAIN_GetDSMSearchOrderEx will always return for the SearchOrder string "CWSOU", and the UserDirectory as an empty string.


For more information on the definition of the SearchOrder string, see DTWAIN_SetDSMSearchOrderEx


To prevent buffer overruns when calling DTWAIN_GetDSMSearchOrderEx:


1) The SearchOrder string must have a length of at least 6 characters. 


2) For UserDirectory, to ensure there is no buffer overrun, the UserDirectory must have a size of at least 261 characters (this includes the terminating NULL character), or the maximum size of the directory path that the operating system will support plus the terminating NULL.  For Windows, this is usually 261 characters, unless the system is set to accept paths longer than 260 characters.  Note that there is no internal check by DTWAIN to see if the UserBuffer passed is large enough to hold the returned path, so you must be cautious of buffer overrun bugs if you supply a UserDirectory that is too small.


TWAIN State Transitions

None.

 

Prerequisite Function Call(s)

None.