MagickCore  7.1.1-43
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/script/license.php
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 fseek _fseeki64
68 # define ftell _ftelli64
69 # define lseek _lseeki64
70 # define fstat _fstat64
71 # define stat _stat64
72 # define tell _telli64
73 #endif
74 
75 #if !defined(XS_VERSION)
76 struct dirent
77 {
78  char
79  d_name[2048];
80 
81  int
82  d_namlen;
83 };
84 
85 typedef struct _DIR
86 {
87  HANDLE
88  hSearch;
89 
90  WIN32_FIND_DATAW
91  Win32FindData;
92 
93  BOOL
94  firsttime;
95 
96  struct dirent
97  file_info;
98 } DIR;
99 
100 #if !defined(__MINGW32__)
101 struct timeval;
102 
103 struct timezone
104 {
105  int
106  tz_minuteswest,
107  tz_dsttime;
108 };
109 #endif
110 
111 #endif
112 
113 static inline void *NTAcquireQuantumMemory(const size_t count,
114  const size_t quantum)
115 {
116  size_t
117  size;
118 
119  if (HeapOverflowSanityCheckGetSize(count,quantum,&size) != MagickFalse)
120  {
121  errno=ENOMEM;
122  return(NULL);
123  }
124  return(AcquireMagickMemory(size));
125 }
126 
127 extern MagickPrivate char
128  *NTGetEnvironmentValue(const char *);
129 
130 #if !defined(MAGICKCORE_LTDL_DELEGATE)
131 extern MagickPrivate const char
132  *NTGetLibraryError(void);
133 #endif
134 
135 #if !defined(XS_VERSION)
136 extern MagickPrivate const char
137  *NTGetLibraryError(void);
138 
139 extern MagickPrivate DIR
140  *NTOpenDirectory(const char *);
141 
142 extern MagickPrivate double
143  NTElapsedTime(void),
144  NTErf(double);
145 
146 extern MagickPrivate int
147 #if !defined(__MINGW32__)
148  gettimeofday(struct timeval *,struct timezone *),
149 #endif
150  NTCloseDirectory(DIR *),
151  NTCloseLibrary(void *),
152  NTTruncateFile(int,off_t),
153  NTUnmapMemory(void *,size_t),
154  NTSystemCommand(const char *,char *);
155 
156 extern MagickPrivate ssize_t
157  NTSystemConfiguration(int);
158 
159 extern MagickPrivate MagickBooleanType
160  NTGatherRandomData(const size_t,unsigned char *),
161  NTGetExecutionPath(char *,const size_t),
162  NTGetModulePath(const char *,char *),
163  NTGhostscriptFonts(char *,int),
164  NTReportEvent(const char *,const MagickBooleanType);
165 
166 extern MagickExport MagickBooleanType
167  NTLongPathsEnabled(void);
168 
169 extern MagickPrivate struct dirent
170  *NTReadDirectory(DIR *);
171 
172 extern MagickPrivate unsigned char
173  *NTRegistryKeyLookup(const char *),
174  *NTResourceToBlob(const char *);
175 
176 extern MagickPrivate void
177  *NTGetLibrarySymbol(void *,const char *),
178  NTGhostscriptEXE(char *,int),
179  *NTMapMemory(char *,size_t,int,int,int,MagickOffsetType),
180  *NTOpenLibrary(const char *),
181  NTWindowsGenesis(void),
182  NTWindowsTerminus(void);
183 
184 #endif /* !XS_VERSION */
185 
186 #endif /* MAGICKCORE_WINDOWS_SUPPORT */
187 
188 #if defined(__cplusplus) || defined(c_plusplus)
189 }
190 #endif /* !C++ */
191 
192 #endif /* !MAGICKCORE_NT_BASE_H */