2 Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization
3 dedicated to making software imaging solutions freely available.
5 You may not use this file except in compliance with the License.
6 obtain a copy of the License at
8 http://www.imagemagick.org/script/license.php
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
16 MagickCore Windows NT private methods.
18 #ifndef _MAGICKCORE_NT_BASE_PRIVATE_H
19 #define _MAGICKCORE_NT_BASE_PRIVATE_H
21 #if defined(__cplusplus) || defined(c_plusplus)
25 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
27 #include "MagickCore/delegate.h"
28 #include "MagickCore/delegate-private.h"
29 #include "MagickCore/exception.h"
30 #include "MagickCore/splay-tree.h"
32 #define WIN32_LEAN_AND_MEAN
34 #define _CRT_SECURE_NO_DEPRECATE 1
42 #if defined(_DEBUG) && !defined(__MINGW32__)
46 #define PROT_READ 0x01
47 #define PROT_WRITE 0x02
48 #define MAP_SHARED 0x01
49 #define MAP_PRIVATE 0x02
50 #define MAP_ANONYMOUS 0x20
55 #define _SC_PAGESIZE 1
56 #define _SC_PHYS_PAGES 2
57 #define _SC_OPEN_MAX 3
58 #if !defined(SSIZE_MAX)
59 #define SSIZE_MAX 0x7fffffffL
66 1300 MSVC 7.0 Visual C++ .NET 2002
67 1310 Visual c++ .NET 2003
73 # if defined(__BORLANDC__)
74 # define chsize(file,length) chsize(file,length)
76 # define chsize(file,length) _chsize(file,length)
81 #if defined(_VISUALC_) && (_MSC_VER >= 1400)
82 # define access(path,mode) _access_s(path,mode)
91 #if !defined(closedir)
92 # define closedir(directory) NTCloseDirectory(directory)
95 # define fdopen _fdopen
98 # define fileno _fileno
100 #if !defined(fseek) && !defined(__MINGW32__)
101 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
102 !(defined(_MSC_VER) && (_MSC_VER < 1400)) && (__MSVCRT_VERSION__ < 0x800)
103 # define fseek _fseeki64
106 #if !defined(fstat) && !defined(__BORLANDC__)
107 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
108 !(defined(_MSC_VER) && (_MSC_VER < 1400)) && (__MSVCRT_VERSION__ < 0x800)
109 # define fstat _fstati64
111 # define fstat _fstat
115 # define fsync _commit
117 #if !defined(ftell) && !defined(__MINGW32__)
118 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
119 !(defined(_MSC_VER) && (_MSC_VER < 1400)) && (__MSVCRT_VERSION__ < 0x800)
120 # define ftell _ftelli64
123 #if !defined(ftruncate)
124 # define ftruncate(file,length) NTTruncateFile(file,length)
127 # define getcwd _getcwd
130 # define getpid _getpid
133 # define hypot _hypot
136 # define inline __inline
139 # define isatty _isatty
141 #if !defined(locale_t)
142 #define locale_t _locale_t
144 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
145 !(defined(_MSC_VER) && (_MSC_VER < 1400)) && (__MSVCRT_VERSION__ < 0x800)
146 # define lseek _lseeki64
148 # define lseek _lseek
150 #if !defined(MAGICKCORE_LTDL_DELEGATE)
151 #if !defined(lt_dlclose)
152 # define lt_dlclose(handle) NTCloseLibrary(handle)
154 #if !defined(lt_dlerror)
155 # define lt_dlerror() NTGetLibraryError()
157 #if !defined(lt_dlexit)
158 # define lt_dlexit() NTExitLibrary()
160 #if !defined(lt_dlinit)
161 # define lt_dlinit() NTInitializeLibrary()
163 #if !defined(lt_dlopen)
164 # define lt_dlopen(filename) NTOpenLibrary(filename)
166 #if !defined(lt_dlsetsearchpath)
167 # define lt_dlsetsearchpath(path) NTSetSearchPath(path)
169 #if !defined(lt_dlsym)
170 # define lt_dlsym(handle,name) NTGetLibrarySymbol(handle,name)
174 # define mkdir _mkdir
177 # define mmap(address,length,protection,access,file,offset) \
178 NTMapMemory(address,length,protection,access,file,offset)
181 # define msync(address,length,flags) NTSyncMemory(address,length,flags)
184 # define munmap(address,length) NTUnmapMemory(address,length)
186 #if !defined(opendir)
187 # define opendir(directory) NTOpenDirectory(directory)
193 # define pclose _pclose
196 # define popen _popen
198 #if !defined(fprintf_l)
199 #define fprintf_l _fprintf_s_l
204 #if !defined(readdir)
205 # define readdir(directory) NTReadDirectory(directory)
207 #if !defined(seekdir)
208 # define seekdir(directory,offset) NTSeekDirectory(directory,offset)
210 #if !defined(setmode)
211 # define setmode _setmode
213 #if !defined(spawnvp)
214 # define spawnvp _spawnvp
216 #if !defined(strtod_l)
217 #define strtod_l _strtod_l
219 #if !defined(stat) && !defined(__BORLANDC__)
220 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
221 !(defined(_MSC_VER) && (_MSC_VER < 1400)) && (__MSVCRT_VERSION__ < 0x800)
222 # define stat _stati64
227 #if !defined(strcasecmp)
228 # define strcasecmp _strcmpi
230 #if !defined(strncasecmp)
231 # define strncasecmp _strnicmp
233 #if !defined(sysconf)
234 # define sysconf(name) NTSystemConfiguration(name)
236 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
237 !(defined(_MSC_VER) && (_MSC_VER < 1400)) && (__MSVCRT_VERSION__ < 0x800)
238 # define tell _telli64
242 #if !defined(telldir)
243 # define telldir(directory) NTTellDirectory(directory)
245 #if !defined(tempnam)
246 # define tempnam _tempnam_s
248 #if !defined(vfprintf_l)
249 #define vfprintf_l _vfprintf_l
251 #if !defined(vsnprintf)
252 #if !defined(_MSC_VER) || (defined(_MSC_VER) && _MSC_VER < 1500)
253 #define vsnprintf _vsnprintf
256 #if !defined(vsnprintf_l)
257 #define vsnprintf_l _vsnprintf_l
260 # define write _write
262 #if !defined(wstat) && !defined(__BORLANDC__)
263 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
264 !(defined(_MSC_VER) && (_MSC_VER < 1400)) && (__MSVCRT_VERSION__ < 0x800)
265 # define wstat _wstati64
267 # define wstat _wstat
271 #if defined(_MT) && defined(MAGICKCORE_WINDOWS_SUPPORT)
272 # define SAFE_GLOBAL __declspec(thread)
277 #if defined(__BORLANDC__)
281 #define _O_SEQUENTIAL 0
282 #undef _O_SHORT_LIVED
283 #define _O_SHORT_LIVED 0
285 #define _O_TEMPORARY 0
290 #if !defined(XS_VERSION)
315 typedef struct _NTMEMORYSTATUSEX
328 ullAvailExtendedVirtual;
331 #if !defined(__MINGW32__)
341 (CALLBACK *LPFNDLLFUNC1)(DWORD,UINT);
344 (CALLBACK *LPFNDLLFUNC2)(NTMEMORYSTATUSEX *);
348 #if defined(MAGICKCORE_BZLIB_DELEGATE)
354 extern MagickPrivate char
355 *NTGetLastError(void);
357 #if !defined(MAGICKCORE_LTDL_DELEGATE)
358 extern MagickPrivate const char
359 *NTGetLibraryError(void);
362 #if !defined(XS_VERSION)
363 extern MagickPrivate const char
364 *NTGetLibraryError(void);
366 extern MagickPrivate DIR
367 *NTOpenDirectory(const char *);
369 extern MagickPrivate double
373 extern MagickPrivate int
375 #if !defined(__MINGW32__)
376 gettimeofday(struct timeval *,struct timezone *),
379 NTCloseDirectory(DIR *),
380 NTCloseLibrary(void *),
381 NTControlHandler(void),
383 NTTruncateFile(int,off_t),
384 NTGhostscriptDLL(char *,int),
385 NTGhostscriptEXE(char *,int),
386 NTGhostscriptFonts(char *,int),
387 NTGhostscriptLoadDLL(void),
388 NTInitializeLibrary(void),
389 NTSetSearchPath(const char *),
390 NTSyncMemory(void *,size_t,int),
391 NTUnmapMemory(void *,size_t),
392 NTSystemCommand(const char *);
394 extern MagickPrivate ssize_t
395 NTSystemConfiguration(int),
396 NTTellDirectory(DIR *);
398 extern MagickPrivate MagickBooleanType
399 NTGatherRandomData(const size_t,unsigned char *),
400 NTGetExecutionPath(char *,const size_t),
401 NTGetModulePath(const char *,char *),
402 NTIsMagickConflict(const char *),
403 NTLoadTypeLists(SplayTreeInfo *,ExceptionInfo *),
404 NTReportEvent(const char *,const MagickBooleanType),
405 NTReportException(const char *,const MagickBooleanType);
407 extern MagickPrivate struct dirent
408 *NTReadDirectory(DIR *);
410 extern MagickPrivate unsigned char
411 *NTRegistryKeyLookup(const char *),
412 *NTResourceToBlob(const char *);
414 extern MagickPrivate void
415 *NTGetLibrarySymbol(void *,const char *),
416 *NTMapMemory(char *,size_t,int,int,int,MagickOffsetType),
417 *NTOpenLibrary(const char *),
418 NTSeekDirectory(DIR *,ssize_t);
420 #endif /* !XS_VERSION */
422 #endif /* MAGICKCORE_WINDOWS_SUPPORT */
424 #if defined(__cplusplus) || defined(c_plusplus)
428 #endif /* !_MAGICKCORE_NT_BASE_H */