nt-base-private.h revision 1db8adce21f437333b3b24dcd923389636e84527
1/*
2  Copyright 1999-2014 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.
6  obtain a copy of the License at
7
8    http://www.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/splay-tree.h"
25
26#if defined(__cplusplus) || defined(c_plusplus)
27extern "C" {
28#endif
29
30#if defined(MAGICKCORE_WINDOWS_SUPPORT)
31
32#define WIN32_LEAN_AND_MEAN
33#define VC_EXTRALEAN
34#define _CRT_SECURE_NO_DEPRECATE  1
35#include <windows.h>
36#include <wchar.h>
37#include <winuser.h>
38#include <wingdi.h>
39#include <io.h>
40#include <process.h>
41#include <errno.h>
42#if defined(_DEBUG) && !defined(__MINGW32__) && !defined(__MINGW64__)
43#include <crtdbg.h>
44#endif
45
46#if !defined(XS_VERSION)
47struct dirent
48{
49  char
50    d_name[2048];
51
52  int
53    d_namlen;
54};
55
56typedef struct _DIR
57{
58  HANDLE
59    hSearch;
60
61  WIN32_FIND_DATAW
62    Win32FindData;
63
64  BOOL
65    firsttime;
66
67  struct dirent
68    file_info;
69} DIR;
70
71typedef struct _NTMEMORYSTATUSEX
72{
73  DWORD
74    dwLength,
75    dwMemoryLoad;
76
77  DWORDLONG
78    ullTotalPhys,
79    ullAvailPhys,
80    ullTotalPageFile,
81    ullAvailPageFile,
82    ullTotalVirtual,
83    ullAvailVirtual,
84    ullAvailExtendedVirtual;
85} NTMEMORYSTATUSEX;
86
87#if !defined(__MINGW32__) && !defined(__MINGW64__)
88struct timezone
89{
90  int
91    tz_minuteswest,
92    tz_dsttime;
93};
94#endif
95
96typedef UINT
97  (CALLBACK *LPFNDLLFUNC1)(DWORD,UINT);
98
99typedef UINT
100  (CALLBACK *LPFNDLLFUNC2)(NTMEMORYSTATUSEX *);
101
102#endif
103
104#if defined(MAGICKCORE_BZLIB_DELEGATE)
105#  if defined(_WIN32)
106#    define BZ_IMPORT 1
107#  endif
108#endif
109
110extern MagickPrivate char
111  *NTGetLastError(void);
112
113#if !defined(MAGICKCORE_LTDL_DELEGATE)
114extern MagickPrivate const char
115  *NTGetLibraryError(void);
116#endif
117
118#if !defined(XS_VERSION)
119extern MagickPrivate const char
120  *NTGetLibraryError(void);
121
122extern MagickPrivate DIR
123  *NTOpenDirectory(const char *);
124
125extern MagickPrivate double
126  NTElapsedTime(void),
127  NTUserTime(void);
128
129extern MagickPrivate int
130  Exit(int),
131#if !defined(__MINGW32__) && !defined(__MINGW64__)
132  gettimeofday(struct timeval *,struct timezone *),
133#endif
134  IsWindows95(void),
135  NTCloseDirectory(DIR *),
136  NTCloseLibrary(void *),
137  NTControlHandler(void),
138  NTExitLibrary(void),
139  NTTruncateFile(int,off_t),
140  NTGhostscriptDLL(char *,int),
141  NTGhostscriptEXE(char *,int),
142  NTGhostscriptFonts(char *,int),
143  NTGhostscriptLoadDLL(void),
144  NTInitializeLibrary(void),
145  NTSetSearchPath(const char *),
146  NTSyncMemory(void *,size_t,int),
147  NTUnmapMemory(void *,size_t),
148  NTSystemCommand(const char *);
149
150extern MagickPrivate ssize_t
151  NTSystemConfiguration(int),
152  NTTellDirectory(DIR *);
153
154extern MagickPrivate MagickBooleanType
155  NTGatherRandomData(const size_t,unsigned char *),
156  NTGetExecutionPath(char *,const size_t),
157  NTGetModulePath(const char *,char *),
158  NTReportEvent(const char *,const MagickBooleanType),
159  NTReportException(const char *,const MagickBooleanType);
160
161extern MagickPrivate struct dirent
162  *NTReadDirectory(DIR *);
163
164extern MagickPrivate unsigned char
165  *NTRegistryKeyLookup(const char *),
166  *NTResourceToBlob(const char *);
167
168extern MagickPrivate void
169  NTWindowsGenesis(void),
170  *NTGetLibrarySymbol(void *,const char *),
171  *NTMapMemory(char *,size_t,int,int,int,MagickOffsetType),
172  *NTOpenLibrary(const char *),
173  NTSeekDirectory(DIR *,ssize_t);
174
175#endif /* !XS_VERSION */
176
177#endif /* MAGICKCORE_WINDOWS_SUPPORT */
178
179#if defined(__cplusplus) || defined(c_plusplus)
180}
181#endif /* !C++ */
182
183#endif /* !_MAGICKCORE_NT_BASE_H */
184