Twain_DSM  1.0
Classes | Macros | Enumerations | Functions | Variables
dsm.h File Reference

Everything we need to make our .cpp files happy. More...

#include <windows.h>
#include <direct.h>
#include <share.h>
#include "resource.h"
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <stdlib.h>
#include "twain.h"
Include dependency graph for dsm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CTwnDsmLog
 Our logging class. More...
 
class  CTwnDsmApps
 Class to hold list of connected applications. More...
 
class  CTwnDsm
 This is the main class for the Data Source Manager. More...
 
struct  CTwnDsm::_pod
 We use a pod system because it help prevents us from making dumb initialization mistakes. More...
 

Macros

#define TWNDSM_CMP_VISUALCPP   0x1001
 Preferably 2005+.
 
#define TWNDSM_CMP_GNUGPP   0x1002
 Preferably v4.x+.
 
#define TWNDSM_OS_WINDOWS   0x2001
 Preferably Win2K+.
 
#define TWNDSM_OS_MACOSX   0x2002
 Preferably 10.4+.
 
#define TWNDSM_OS_LINUX   0x2003
 Preferably 2.6+ kernel.
 
#define TWNDSM_CMP   TWNDSM_CMP_VISUALCPP
 If the user defines TWNDSM_CMP in their make file or project, then we'll assume they want to take responsibility for picking how we'll build the system. More...
 
#define TWNDSM_CMP_VERSION   _MSC_VER
 The version of the compliler used.
 
#define TWNDSM_OS   TWNDSM_OS_WINDOWS
 The Operating system of the compliler used.
 
#define TWNDSM_OS_32BIT   1
 defined to 1 if system is 32 bit
 
#define WIN32_LEAN_AND_MEAN
 Pull in the system specific headers...
 
#define __in
 We use resource.h to specify version info on all platforms... More...
 
#define __out
 
#define __in_opt
 
#define TWID_T   TW_UINT32
 
#define TWIDDEST_T   TW_UINT32
 
#define LOADLIBRARY(lib, hook, DSID)   InstallTwain32DllHooks(lib,hook,DSID)
 Call system loadibrary function. More...
 
#define UNLOADLIBRARY(hmodule, unhook, DSID)   UninstallTwain32DllHooks((HMODULE)hmodule,unhook,DSID)
 Call system FreeLibrary function. More...
 
#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 LOADFUNCTION(lib, func)   GetProcAddress((HMODULE)lib, func)
 Call system GetProcAddress 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 SSTRCPY(d, z, s)   strncpy_s(d,z,s,_TRUNCATE)
 Secure String copy. More...
 
#define SSTRCAT(d, z, s)   strncat_s(d,z,s,_TRUNCATE)
 Secure String catinate. More...
 
#define SSTRNCPY(d, z, s, m)   strncpy_s(d,z,s,m)
 Secure String n copy. More...
 
#define SGETENV(d, z, n)   ::GetEnvironmentVariable(n,d,z)
 Secure Get enviroment varable. More...
 
#define kLOGINFO   0,__FILE__,__LINE__
 write info messages to LogFile.
 
#define kLOGERR   1,__FILE__,__LINE__
 write error messages to LogFile.
 
#define kLOG(a)   if (g_ptwndsmlog) g_ptwndsmlog->Log a
 Define to write messages to LogFile. More...
 
#define kPANIC(msg)   ::MessageBox(NULL,msg,"TWAIN Data Source Manager",MB_OK);
 Display message to user. More...
 
#define MAX_NUM_DS   50
 Maximum number of Data Sources that can be opened under one application. More...
 

Enumerations

enum  DSM_State { dsmState_PreSession = 1, dsmState_Loaded = 2, dsmState_Open = 3 }
 Possible States of the DSM. More...
 

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)
 
int SSNPRINTF (char *d, const size_t z, const size_t c, const char *const f,...)
 
void * DSM_LoadFunction (void *_pHandle, const char *_pszSymbol)
 This function wraps the function loading calls. More...
 

Variables

CTwnDsmLogg_ptwndsmlog
 The logging object, only access through macros.
 

Detailed Description

Everything we need to make our .cpp files happy.

Author
TWAIN Working Group
Date
March 2007

Definition in file dsm.h.