GCRTSSUtilities.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. //-----------------------------------------------------------------------------
  2. // (c) 2014 by Basler Vision Technologies
  3. // Section: Vision Components
  4. // Project: GenICam
  5. // Author: Maxime Dupont
  6. // $Header$
  7. // License: This file is published under the license of the EMVA GenICam Standard Group.
  8. // A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'.
  9. // If for some reason you are missing this file please contact the EMVA or visit the website
  10. // (http://www.genicam.org) for a full copy.
  11. //
  12. // THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
  13. // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  14. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  15. // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD GROUP
  16. // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  17. // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  18. // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  19. // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  20. // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  21. // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  22. // POSSIBILITY OF SUCH DAMAGE.
  23. //-----------------------------------------------------------------------------
  24. /*!
  25. \file
  26. \brief GenICam RTSS utilities
  27. \ingroup Base_PublicUtilities
  28. */
  29. #ifndef GENAPI_GENAPIRTSSUTILITIES_DEF_H_
  30. #define GENAPI_GENAPIRTSSUTILITIES_DEF_H_
  31. #include "crtdefs.h"
  32. #include <stdio.h>
  33. #include <errno.h>
  34. #include <io.h>
  35. #include "windows.h"
  36. #if defined(UNDER_RTSS) && defined(GENICAM_BUILD)
  37. #if defined(htons)
  38. #undef htons
  39. #endif // defined(htons)
  40. #if defined(ntohs)
  41. #undef ntohs
  42. #endif // defined(ntohs)
  43. #if defined(htonl)
  44. #undef htonl
  45. #endif // defined(htonl)
  46. #if defined(ntohl)
  47. #undef ntohl
  48. #endif // defined(ntohl)
  49. #define HTONS(n) (unsigned short)(((((unsigned short)(n) & 0xFF)) << 8) | (((unsigned short)(n) & 0xFF00) >> 8))
  50. #define NTOHS(n) (unsigned short)(((((unsigned short)(n) & 0xFF)) << 8) | (((unsigned short)(n) & 0xFF00) >> 8))
  51. #define HTONL(n) (unsigned long)(((((unsigned long)(n) & 0xFF)) << 24) | \
  52. ((((unsigned long)(n) & 0xFF00)) << 8) | \
  53. ((((unsigned long)(n) & 0xFF0000)) >> 8) | \
  54. ((((unsigned long)(n) & 0xFF000000)) >> 24))
  55. #define NTOHL(n) (unsigned long)(((((unsigned long)(n) & 0xFF)) << 24) | \
  56. ((((unsigned long)(n) & 0xFF00)) << 8) | \
  57. ((((unsigned long)(n) & 0xFF0000)) >> 8) | \
  58. ((((unsigned long)(n) & 0xFF000000)) >> 24))
  59. #define htons(n) HTONS(n)
  60. #define ntohs(n) NTOHS(n)
  61. #define htonl(n) HTONL(n)
  62. #define ntohl(n) NTOHL(n)
  63. #endif
  64. #if defined(UNDER_RTSS)
  65. #ifdef __cplusplus
  66. extern "C" {
  67. #endif
  68. WINBASEAPI __out HANDLE WINAPI FindFirstFileExW(
  69. __in LPCWSTR lpFileName,
  70. __in FINDEX_INFO_LEVELS fInfoLevelId,
  71. __out LPVOID lpFindFileData,
  72. __in FINDEX_SEARCH_OPS fSearchOp,
  73. __reserved LPVOID lpSearchFilter,
  74. __in DWORD dwAdditionalFlags
  75. );
  76. WINBASEAPI __out HANDLE WINAPI FindFirstFileExA(
  77. __in LPCSTR lpFileName,
  78. __in FINDEX_INFO_LEVELS fInfoLevelId,
  79. __out LPVOID lpFindFileData,
  80. __in FINDEX_SEARCH_OPS fSearchOp,
  81. __reserved LPVOID lpSearchFilter,
  82. __in DWORD dwAdditionalFlags
  83. );
  84. WINBASEAPI BOOL WINAPI FindNextFileW(
  85. __in HANDLE hFindFile,
  86. __out LPWIN32_FIND_DATAW lpFindFileData
  87. );
  88. WINBASEAPI BOOL WINAPI FindNextFileA(
  89. __in HANDLE hFindFile,
  90. __out LPWIN32_FIND_DATAA lpFindFileData
  91. );
  92. WINBASEAPI BOOL WINAPI FindClose(
  93. __inout HANDLE hFindHandle
  94. );
  95. WINBASEAPI BOOL WINAPI SystemTimeToTzSpecificLocalTime(
  96. __in_opt CONST TIME_ZONE_INFORMATION * lpTimeZoneInformation,
  97. __in CONST SYSTEMTIME * lpUniversalTime,
  98. __out LPSYSTEMTIME lpLocalTime
  99. );
  100. WINBASEAPI UINT WINAPI GetDriveTypeW(
  101. __in_opt LPCWSTR lpRootPathName
  102. );
  103. WINBASEAPI UINT WINAPI GetDriveTypeA(
  104. __in_opt LPCSTR lpRootPathName
  105. );
  106. WINBASEAPI BOOL WINAPI GetFileInformationByHandle(
  107. __in HANDLE hFile,
  108. __out LPBY_HANDLE_FILE_INFORMATION lpFileInformation
  109. );
  110. WINBASEAPI BOOL WINAPI PeekNamedPipe(
  111. __in HANDLE hNamedPipe,
  112. __out_bcount_part_opt(nBufferSize, *lpBytesRead) LPVOID lpBuffer,
  113. __in DWORD nBufferSize,
  114. __out_opt LPDWORD lpBytesRead,
  115. __out_opt LPDWORD lpTotalBytesAvail,
  116. __out_opt LPDWORD lpBytesLeftThisMessage
  117. );
  118. WINBASEAPI DWORD WINAPI GetFullPathNameW(
  119. __in LPCWSTR lpFileName,
  120. __in DWORD nBufferLength,
  121. __out_ecount_part_opt(nBufferLength, return +1) LPWSTR lpBuffer,
  122. __deref_opt_out LPWSTR * lpFilePart
  123. );
  124. WINBASEAPI BOOL WINAPI SetCurrentDirectoryW(
  125. __in LPCWSTR lpPathName
  126. );
  127. WINBASEAPI DWORD WINAPI GetCurrentDirectoryW(
  128. __in DWORD nBufferLength,
  129. __out_ecount_part_opt(nBufferLength, return +1) LPWSTR lpBuffer
  130. );
  131. WINBASEAPI DWORD WINAPI GetFullPathNameA(
  132. __in LPCSTR lpFileName,
  133. __in DWORD nBufferLength,
  134. __out_ecount_part_opt(nBufferLength, return +1) LPSTR lpBuffer,
  135. __deref_opt_out LPSTR * lpFilePart
  136. );
  137. WINBASEAPI UINT WINAPI SetErrorMode(
  138. __in UINT uMode
  139. );
  140. WINBASEAPI LANGID WINAPI GetUserDefaultLangID(void);
  141. WINBASEAPI DWORD WINAPI GetFileAttributesW(
  142. __in LPCWSTR lpFileName
  143. );
  144. WINBASEAPI DWORD WINAPI GetFileAttributesA(
  145. __in LPCSTR lpFileName
  146. );
  147. WINBASEAPI BOOL WINAPI GetFileAttributesExW(
  148. __in LPCWSTR lpFileName,
  149. __in GET_FILEEX_INFO_LEVELS fInfoLevelId,
  150. __out LPVOID lpFileInformation
  151. );
  152. WINBASEAPI BOOL WINAPI GetModuleHandleExA(
  153. __in DWORD dwFlags,
  154. __in_opt LPCSTR lpModuleName,
  155. __out HMODULE * phModule
  156. );
  157. WINBASEAPI HLOCAL WINAPI LocalFree(
  158. __deref HLOCAL hMem
  159. );
  160. WINBASEAPI BOOL WINAPI CopyFileA(
  161. __in LPCSTR lpExistingFileName,
  162. __in LPCSTR lpNewFileName,
  163. __in BOOL bFailIfExists
  164. );
  165. // ************************************************************************
  166. // ********** GenAPITest section **********
  167. // ************************************************************************
  168. WINBASEAPI UINT WINAPI GetSystemDirectoryA(
  169. __out_ecount_part_opt(uSize, return + 1) LPSTR lpBuffer,
  170. __in UINT uSize
  171. );
  172. WINBASEAPI DWORD WINAPI GetTempPathA(
  173. __in DWORD nBufferLength,
  174. __out_ecount_part_opt(nBufferLength, return + 1) LPSTR lpBuffer
  175. );
  176. WINBASEAPI BOOL WINAPI GetThreadTimes(
  177. __in HANDLE hThread,
  178. __out LPFILETIME lpCreationTime,
  179. __out LPFILETIME lpExitTime,
  180. __out LPFILETIME lpKernelTime,
  181. __out LPFILETIME lpUserTime
  182. );
  183. WINBASEAPI BOOL WINAPI SetConsoleOutputCP(
  184. __in UINT wCodePageID
  185. );
  186. WINBASEAPI BOOL WINAPI SetEnvironmentVariableW(
  187. __in LPCWSTR lpName,
  188. __in_opt LPCWSTR lpValue
  189. );
  190. WINBASEAPI __success(return < nSize) __success(return != 0) DWORD WINAPI GetEnvironmentVariableA(
  191. __in_opt LPCSTR lpName,
  192. __out_ecount_part_opt(nSize, return + 1) LPSTR lpBuffer,
  193. __in DWORD nSize
  194. );
  195. WINBASEAPI BOOL WINAPI CopyFileW(
  196. __in LPCWSTR lpExistingFileName,
  197. __in LPCWSTR lpNewFileName,
  198. __in BOOL bFailIfExists
  199. );
  200. #ifdef __cplusplus
  201. }
  202. #endif
  203. #endif // defined(UNDER_RTSS)
  204. #endif // GENAPI_GENAPIRTSSUTILITIES_DEF_H_