MagickCore  7.1.2-29
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 "MagickCore/delegate.h"
22 #include "MagickCore/delegate-private.h"
23 #include "MagickCore/exception.h"
24 #include "MagickCore/memory_.h"
25 #include "MagickCore/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 timeval;
110 
111 struct timezone
112 {
113  int
114  tz_minuteswest,
115  tz_dsttime;
116 };
117 
118 typedef int
119  mode_t;
120 #endif
121 
122 #endif
123 
124 static inline void *NTAcquireQuantumMemory(const size_t count,
125  const size_t quantum)
126 {
127  size_t
128  size;
129 
130  if (HeapOverflowSanityCheckGetSize(count,quantum,&size) != MagickFalse)
131  {
132  errno=ENOMEM;
133  return(NULL);
134  }
135  return(AcquireMagickMemory(size));
136 }
137 
138 extern MagickExport char
139  *NTRealPathWide(const char *);
140 
141 extern MagickPrivate char
142  *NTGetEnvironmentValue(const char *);
143 
144 #if !defined(MAGICKCORE_LTDL_DELEGATE)
145 extern MagickPrivate const char
146  *NTGetLibraryError(void);
147 #endif
148 
149 #if !defined(XS_VERSION)
150 extern MagickPrivate const char
151  *NTGetLibraryError(void);
152 
153 extern MagickPrivate DIR
154  *NTOpenDirectory(const char *);
155 
156 extern MagickPrivate double
157  NTElapsedTime(void),
158  NTErf(double);
159 
160 extern MagickExport FILE
161  *NTOpenFileWide(const char *,const char *),
162  *NTOpenPipeWide(const char *,const char *);
163 
164 extern MagickExport int
165  NTAccessWide(const char *,int),
166  NTOpenWide(const char *,int,mode_t),
167  NTRemoveWide(const char *),
168  NTRenameWide(const char *, const char *),
169  NTSetFileTimestamp(const char *,struct stat *),
170  NTStatWide(const char *,struct stat *);
171 
172 extern MagickPrivate int
173 #if !defined(__MINGW32__)
174  gettimeofday(struct timeval *,struct timezone *),
175 #endif
176  NTCloseDirectory(DIR *),
177  NTCloseLibrary(void *),
178  NTTruncateFile(int,off_t),
179  NTUnmapMemory(void *,size_t),
180  NTSystemCommand(const char *,char *);
181 
182 extern MagickPrivate ssize_t
183  NTSystemConfiguration(int);
184 
185 extern MagickPrivate MagickBooleanType
186  NTGatherRandomData(const size_t,unsigned char *),
187  NTGetExecutionPath(char *,const size_t),
188  NTGetModulePath(const char *,char *),
189  NTGhostscriptFonts(char *,int),
190  NTReportEvent(const char *,const MagickBooleanType);
191 
192 extern MagickExport MagickBooleanType
193  NTIsSymlinkWide(const char *),
194  NTLongPathsEnabled(void);
195 
196 extern MagickPrivate struct dirent
197  *NTReadDirectory(DIR *);
198 
199 extern MagickPrivate unsigned char
200  *NTRegistryKeyLookup(const char *),
201  *NTResourceToBlob(const char *);
202 
203 extern MagickPrivate void
204  *NTGetLibrarySymbol(void *,const char *),
205  NTGhostscriptEXE(char *,int),
206  *NTMapMemory(char *,size_t,int,int,int,MagickOffsetType),
207  *NTOpenLibrary(const char *),
208  NTWindowsGenesis(void),
209  NTWindowsTerminus(void);
210 
211 extern MagickExport wchar_t
212  *NTCreateWidePath(const char *);
213 
214 #endif /* !XS_VERSION */
215 
216 #endif /* MAGICKCORE_WINDOWS_SUPPORT */
217 
218 #if defined(__cplusplus) || defined(c_plusplus)
219 }
220 #endif /* !C++ */
221 
222 #endif /* !MAGICKCORE_NT_BASE_H */