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