DSMInterface.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /***************************************************************************
  2. * Copyright ?2007 TWAIN Working Group:
  3. * Adobe Systems Incorporated, AnyDoc Software Inc., Eastman Kodak Company,
  4. * Fujitsu Computer Products of America, JFL Peripheral Solutions Inc.,
  5. * Ricoh Corporation, and Xerox Corporation.
  6. * All rights reserved.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions are met:
  10. * * Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * * Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * * Neither the name of the TWAIN Working Group nor the
  16. * names of its contributors may be used to endorse or promote products
  17. * derived from this software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY TWAIN Working Group ``AS IS'' AND ANY
  20. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  21. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  22. * DISCLAIMED. IN NO EVENT SHALL TWAIN Working Group BE LIABLE FOR ANY
  23. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  24. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  25. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  26. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  28. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. *
  30. ***************************************************************************/
  31. /**
  32. * @file DSMInterface.h
  33. * Common defines and typedefs used for accessing DSM for TWAIN Applications.
  34. * @author TWAIN Working Group
  35. * @date April 2007
  36. */
  37. #ifndef __DSMINTERFACE_H__
  38. #define __DSMINTERFACE_H__
  39. #pragma once
  40. #ifdef _WINDOWS
  41. #ifndef __AFXWIN_H__
  42. #error include 'stdafx.h' before including this file for PCH
  43. #endif
  44. #endif
  45. //#include "main.h"
  46. #include "twain.h"
  47. /**
  48. * Load the DSM library.
  49. * @param[in] the name of the DSM library to open
  50. * @return true if success.
  51. */
  52. bool LoadDSMLib(char* _pszLibName);
  53. /**
  54. * Unload the DSM library.
  55. */
  56. void unLoadDSMLib();
  57. /**
  58. * Initialize and register the entry point into the DSM.
  59. * @param[in] _pOrigin Identifies the source module of the message. This could
  60. * identify an Application, a Source, or the Source Manager.
  61. *
  62. * @param[in] _pDest Identifies the destination module for the message.
  63. * This could identify an application or a data source.
  64. * If this is NULL, the message goes to the Source Manager.
  65. *
  66. * @param[in] _DG The Data Group.
  67. * Example: DG_IMAGE.
  68. *
  69. * @param[in] _DAT The Data Attribute Type.
  70. * Example: DAT_IMAGEMEMXFER.
  71. *
  72. * @param[in] _MSG The message. Messages are interpreted by the destination module
  73. * with respect to the Data Group and the Data Attribute Type.
  74. * Example: MSG_GET.
  75. *
  76. * @param[in,out] _pData A pointer to the data structure or variable identified
  77. * by the Data Attribute Type.
  78. * Example: (TW_MEMREF)&ImageMemXfer
  79. * where ImageMemXfer is a TW_IMAGEMEMXFER structure.
  80. *
  81. * @return a valid TWRC_xxxx return code.
  82. * Example: TWRC_SUCCESS.
  83. */
  84. TW_UINT16 _DSM_Entry( pTW_IDENTITY _pOrigin,
  85. pTW_IDENTITY _pDest,
  86. TW_UINT32 _DG,
  87. TW_UINT16 _DAT,
  88. TW_UINT16 _MSG,
  89. TW_MEMREF _pData);
  90. /**
  91. * Allocate global memory
  92. * @param[in] _size of memory to allocate.
  93. * @return TW_HANDLE to the memory allocated.
  94. */
  95. TW_HANDLE _DSM_Alloc(TW_UINT32 _size);
  96. /**
  97. * Free previously allocated global memory
  98. * @param[in] _hMemory TW_HANDLE to the memory needing free.
  99. */
  100. void _DSM_Free(TW_HANDLE _hMemory);
  101. /**
  102. * Lock global memory from being updated by others. return a pointer to the
  103. * memory so we can update it.
  104. * @param[in] _hMemory TW_HANDLE to the memory to update.
  105. * @return TW_MEMREF pointer to the memory.
  106. */
  107. TW_MEMREF _DSM_LockMemory(TW_HANDLE _hMemory);
  108. /**
  109. * Unlock global memory after locking. to allow updating by others.
  110. * @param[in] _hMemory TW_HANDLE to memory returned by _DSM_Alloc
  111. */
  112. void _DSM_UnlockMemory(TW_HANDLE _hMemory);
  113. /**
  114. * Not Used.
  115. * @todo Not Implimented
  116. * @param[in] twEvent reference to the TW_EVENT
  117. * @return TW_UINT16
  118. */
  119. TW_UINT16 HandleEvent(TW_EVENT &twEvent);
  120. #endif // __DSMINTERFACE_H__