1 
2 
3 /*max@home*/
4 #include "twain.h"
5 #include "ttwain_state.h"
6 #include "ttwainP.h"
7 #include "ttwain_statePD.h"
8 #include "ttwain_util.h"
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 extern void TTWAIN_SetState(TWAINSTATE status);
15 
TTWAIN_LoadSourceManagerPD(void)16 int TTWAIN_LoadSourceManagerPD(void) {
17   if (TTWAIN_GetState() >= TWAIN_SM_LOADED)
18     return TRUE; /* DSM already loaded */
19   TTwainData.DSM_Entry = DSM_Entry;
20   if (TTwainData.DSM_Entry != 0 /*kUnresolveCFragSymbolAddress*/) {
21     TTWAIN_SetAvailable(AVAIABLE_YES);
22     TTWAIN_SetState(TWAIN_SM_LOADED);
23   } else {
24     printf("DSM Entry NOT found !\n");
25     return FALSE;
26   }
27 
28   return (TTWAIN_GetState() >= TWAIN_SM_LOADED);
29 }
TTWAIN_UnloadSourceManagerPD(void)30 int TTWAIN_UnloadSourceManagerPD(void) {
31   if (TTWAIN_GetState() == TWAIN_SM_LOADED) {
32     TTwainData.DSM_Entry = 0;
33     TTWAIN_SetState(TWAIN_PRESESSION);
34   }
35   return (TTWAIN_GetState() == TWAIN_PRESESSION);
36 }
37 
38 /*-----------------------------------------------------------------------------*/
39 #ifdef __cplusplus
40 }
41 #endif
42