Twain_DSM  1.0
Modules | Macros | Functions
Cross platform functions, defines, and macroes

Don't forget to include TWAIN... More...

Collaboration diagram for Cross platform functions, defines, and macroes:

Modules

 use secure string functions if we have them
 We want to use secure string functions whenever possible, if g++ every includes a set I think it would be excellent to switch over to it, but at least with Windows using them we stand a better chance of finding boo-boos...
 

Macros

#define DllExport   __declspec( dllexport )
 set system dll export configuration __declspec( dllexport )
 
#define NCHARS(s)   sizeof(s)/sizeof(s[0])
 The number of characters in a charter array.
 
#define PATH_SEPERATOR   '\\'
 the operating system's symble used as a path seperator
 
#define LOADLIBRARY(lib, hook, DSID)   InstallTwain32DllHooks(lib,hook,DSID)
 Call system loadibrary function. More...
 
#define LOADFUNCTION(lib, func)   GetProcAddress((HMODULE)lib, func)
 Call system GetProcAddress function. More...
 
#define UNLOADLIBRARY(hmodule, unhook, DSID)   UninstallTwain32DllHooks((HMODULE)hmodule,unhook,DSID)
 Call system FreeLibrary function. More...
 
#define READ   _read
 OS abstraction macro that calls system _read function.
 
#define CLOSE   _close
 OS abstraction macro that calls system _close function.
 
#define SNPRINTF   _snprintf_s
 OS abstraction macro that calls system _snprintf function.
 
#define UNLINK   _unlink
 OS abstraction macro that calls system _unlink function.
 
#define STRNICMP   _strnicmp
 OS abstraction macro that calls system _strnicmp function.
 
#define DSMENTRY   TW_UINT16 FAR PASCAL
 the DSM entry point type
 
#define GETTHREADID   ::GetCurrentThreadId
 get the thread ID
 
#define FOPEN(pf, name, mode)   pf = _fsopen(name, mode, _SH_DENYNO)
 
#define kTWAIN_DS_DIR   "twain_32"
 The path to where TWAIN Data Sources are stored on the system.
 
#define TWID_T   TW_UINT32
 
#define TWIDDEST_T   TW_UINT32
 

Functions

HMODULE InstallTwain32DllHooks (const char *const _lib, const bool _hook, const TWID_T _DSID)
 
BOOL UninstallTwain32DllHooks (const HMODULE _hmodule, const bool _unhook, const TWID_T _DSID)
 

Detailed Description

Don't forget to include TWAIN...

Macro Definition Documentation

◆ FOPEN

#define FOPEN (   pf,
  name,
  mode 
)    pf = _fsopen(name, mode, _SH_DENYNO)
Parameters
[out]pfpointer to the file to store the opened file
[in]namethe path and name of the file to open
[in]modethe mode to open the file

Definition at line 300 of file dsm.h.

◆ LOADFUNCTION

#define LOADFUNCTION (   lib,
  func 
)    GetProcAddress((HMODULE)lib, func)

Call system GetProcAddress function.

OS abstraction macro that tries to locate the addess of a funtion name.

Parameters
[in]libpath and name of library
[in]funcname of the funtion

Definition at line 288 of file dsm.h.

◆ LOADLIBRARY

#define LOADLIBRARY (   lib,
  hook,
  DSID 
)    InstallTwain32DllHooks(lib,hook,DSID)

Call system loadibrary function.

OS abstraction macro that tries to load a library.

Parameters
[in]libpath and name of library
[in]hooktrue if we want to attempt to hook this library
[in]DSidif hooking is the ID of the DS we are hooking

Definition at line 280 of file dsm.h.

◆ UNLOADLIBRARY

#define UNLOADLIBRARY (   hmodule,
  unhook,
  DSID 
)    UninstallTwain32DllHooks((HMODULE)hmodule,unhook,DSID)

Call system FreeLibrary function.

OS abstraction macro that tries to release the library.

Parameters
[in]liblibrary modual to unload
[in]unhooktrue if we want to attempt to unhook this library
[in]DSidif unhooking is the ID of the DS we are unhooking

Definition at line 281 of file dsm.h.