MagickCore  6.9.13-44
Convert, Edit, Or Compose Bitmap Images
nt-base-private.h
1 /*
2  Copyright 1999 ImageMagick Studio LLC, a non-profit organization
3  dedicated to making software imaging solutions freely available.
4 
5  You may not use this file except in compliance with the License. You may
6  obtain a copy of the License at
7 
8  https://imagemagick.org/license/
9 
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.
15 
16  MagickCore Windows NT private methods.
17 */
18 #ifndef MAGICKCORE_NT_BASE_PRIVATE_H
19 #define MAGICKCORE_NT_BASE_PRIVATE_H
20 
21 #include "magick/delegate.h"
22 #include "magick/delegate-private.h"
23 #include "magick/exception.h"
24 #include "magick/memory_.h"
25 #include "magick/splay-tree.h"
26 
27 #if defined(__cplusplus) || defined(c_plusplus)
28 extern "C" {
29 #endif
30 
31 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
32 
33 #if !defined(closedir)
34 # define closedir(directory) NTCloseDirectory(directory)
35 #endif
36 #if !defined(MAGICKCORE_LTDL_DELEGATE)
37 #if !defined(lt_dlclose)
38 # define lt_dlclose(handle) NTCloseLibrary(handle)
39 #endif
40 #if !defined(lt_dlerror)
41 # define lt_dlerror() NTGetLibraryError()
42 #endif
43 #if !defined(lt_dlopen)
44 # define lt_dlopen(filename) NTOpenLibrary(filename)
45 #endif
46 #if !defined(lt_dlsym)
47 # define lt_dlsym(handle,name) NTGetLibrarySymbol(handle,name)
48 #endif
49 #endif
50 #if !defined(opendir)
51 # define opendir(directory) NTOpenDirectory(directory)
52 #endif
53 #if !defined(read)
54 # define read(fd,buffer,count) _read(fd,buffer,(unsigned int) count)
55 #endif
56 #if !defined(readdir)
57 # define readdir(directory) NTReadDirectory(directory)
58 #endif
59 #if !defined(sysconf)
60 # define sysconf(name) NTSystemConfiguration(name)
61 # define MAGICKCORE_HAVE_SYSCONF 1
62 #endif
63 #if !defined(write)
64 # define write(fd,buffer,count) _write(fd,buffer,(unsigned int) count)
65 #endif
66 #if !defined(__MINGW32__)
67 # define fdopen _fdopen
68 # define fileno _fileno
69 # define fseek _fseeki64
70 # define ftell _ftelli64
71 # define getpid _getpid
72 #if !defined(getcwd)
73 # define getcwd _getcwd
74 #endif
75 # define lseek _lseeki64
76 # define fstat _fstat64
77 # define setmode _setmode
78 # define stat _stat64
79 # define tell _telli64
80 # define wstat _wstat64
81 #endif
82 
83 #if !defined(XS_VERSION)
84 struct dirent
85 {
86  char
87  d_name[2048];
88 
89  int
90  d_namlen;
91 };
92 
93 typedef struct _DIR
94 {
95  HANDLE
96  hSearch;
97 
98  WIN32_FIND_DATAW
99  Win32FindData;
100 
101  BOOL
102  firsttime;
103 
104  struct dirent
105  file_info;
106 } DIR;
107 
108 #if !defined(__MINGW32__)
109 struct timezone
110 {
111  int
112  tz_minuteswest,
113  tz_dsttime;
114 };
115 
116 typedef int
117  mode_t;
118 #endif
119 
120 #endif
121 
122 #if defined(MAGICKCORE_BZLIB_DELEGATE)
123 # if defined(_WIN32)
124 # define BZ_IMPORT 1
125 # endif
126 #endif
127 
128 static inline void *NTAcquireQuantumMemory(const size_t count,
129  const size_t quantum)
130 {
131  size_t
132  size;
133 
134  if (HeapOverflowSanityCheckGetSize(count,quantum,&size) != MagickFalse)
135  {
136  errno=ENOMEM;
137  return(NULL);
138  }
139  return(AcquireMagickMemory(size));
140 }
141 
142 extern MagickExport char
143  *NTRealPathWide(const char *);
144 
145 extern MagickPrivate char
146  *NTGetEnvironmentValue(const char *);
147 
148 #if !defined(MAGICKCORE_LTDL_DELEGATE)
149 extern MagickPrivate const char
150  *NTGetLibraryError(void);
151 #endif
152 
153 #if !defined(XS_VERSION)
154 extern MagickPrivate const char
155  *NTGetLibraryError(void);
156 
157 extern MagickPrivate DIR
158  *NTOpenDirectory(const char *);
159 
160 extern MagickPrivate double
161  NTElapsedTime(void),
162  NTUserTime(void);
163 
164 extern MagickExport FILE
165  *NTOpenFileWide(const char *,const char *),
166  *NTOpenPipeWide(const char *,const char *);
167 
168 extern MagickExport int
169  NTAccessWide(const char *,int),
170  NTOpenWide(const char *,int,mode_t),
171  NTRemoveWide(const char *),
172  NTRenameWide(const char *, const char *),
173  NTSetFileTimestamp(const char *,struct stat *),
174  NTStatWide(const char *,struct stat *);
175 
176 extern MagickPrivate int
177 #if !defined(__MINGW32__)
178  gettimeofday(struct timeval *,struct timezone *),
179 #endif
180  NTCloseDirectory(DIR *),
181  NTCloseLibrary(void *),
182  NTControlHandler(void),
183  NTExitLibrary(void),
184  NTTruncateFile(int,off_t),
185  NTGhostscriptEXE(char *,int),
186  NTGhostscriptFonts(char *,int),
187  NTInitializeLibrary(void),
188  NTSetSearchPath(const char *),
189  NTUnmapMemory(void *,size_t),
190  NTSystemCommand(const char *,char *);
191 
192 extern MagickPrivate ssize_t
193  NTSystemConfiguration(int);
194 
195 extern MagickPrivate MagickBooleanType
196  NTGatherRandomData(const size_t,unsigned char *),
197  NTGetExecutionPath(char *,const size_t),
198  NTGetModulePath(const char *,char *),
199  NTReportEvent(const char *,const MagickBooleanType);
200 
201 extern MagickExport MagickBooleanType
202  NTLongPathsEnabled(void);
203 
204 extern MagickPrivate struct dirent
205  *NTReadDirectory(DIR *);
206 
207 extern MagickPrivate unsigned char
208  *NTRegistryKeyLookup(const char *),
209  *NTResourceToBlob(const char *);
210 
211 extern MagickPrivate void
212  *NTGetLibrarySymbol(void *,const char *),
213  NTInitializeWinsock(MagickBooleanType),
214  *NTMapMemory(char *,size_t,int,int,int,MagickOffsetType),
215  *NTOpenLibrary(const char *),
216  NTWindowsGenesis(void),
217  NTWindowsTerminus(void);
218 
219 extern MagickExport wchar_t
220  *NTCreateWidePath(const char *);
221 
222 #endif /* !XS_VERSION */
223 
224 #endif /* MAGICKCORE_WINDOWS_SUPPORT */
225 
226 #if defined(__cplusplus) || defined(c_plusplus)
227 }
228 #endif /* !C++ */
229 
230 #endif /* !MAGICKCORE_NT_BASE_H */
Definition: mac.h:53
Definition: mac.h:41