-
Notifications
You must be signed in to change notification settings - Fork 1
/
precomp.h
149 lines (128 loc) · 6.21 KB
/
precomp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*
+----------------------------------------------------------------------------------------------+
| Windows Cache for PHP |
+----------------------------------------------------------------------------------------------+
| Copyright (c) 2009, Microsoft Corporation. All rights reserved. |
| |
| Redistribution and use in source and binary forms, with or without modification, are |
| permitted provided that the following conditions are met: |
| - Redistributions of source code must retain the above copyright notice, this list of |
| conditions and the following disclaimer. |
| - Redistributions in binary form must reproduce the above copyright notice, this list of |
| conditions and the following disclaimer in the documentation and/or other materials provided |
| with the distribution. |
| - Neither the name of the Microsoft Corporation nor the names of its contributors may be |
| used to endorse or promote products derived from this software without specific prior written|
| permission. |
| |
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS |
| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE|
| GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
| AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| OF THE POSSIBILITY OF SUCH DAMAGE. |
+----------------------------------------------------------------------------------------------+
| Module: precomp.h |
+----------------------------------------------------------------------------------------------+
| Author: Kanwaljeet Singla <[email protected]> |
| Updated: Eric Stenson <[email protected]> |
+----------------------------------------------------------------------------------------------+
*/
#ifndef _PRECOMP_H_
#define _PRECOMP_H_
#define PHP_WINCACHE_EXTNAME "wincache"
#define PHP_WINCACHE_VERSION "2.0.0.9"
#define PHP_WINCACHE_COMPATPHP "7.3 Beta 3"
#define PHP_WINCACHE_VERSION_LEN (sizeof(PHP_WINCACHE_VERSION)-1)
/* comment following line for release builds */
/* #define WINCACHE_DEBUG */
#ifdef PHP_WIN32
#define PHP_WINCACHE_API __declspec(dllexport)
#else
#define PHP_WINCACHE_API
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
#include "php.h"
#include "php_ini.h"
#include "sapi.h"
#include "ext/standard/info.h"
#include "zend_smart_str.h"
#include "ext/session/php_session.h"
#include "zend_extensions.h"
#include "zend_portability.h"
#include "php_open_temporary_file.h"
#include <tlhelp32.h>
#define ALIGNDWORD(size) (((size) % 4) ? ((size)+(4-((size) % 4))) : (size))
#define ALIGNQWORD(size) (((size) % 8) ? ((size)+(8-((size) % 8))) : (size))
#define XSTRVER2(maj, min) #maj "." #min
#define STRVER2(maj, min) XSTRVER2(maj, min)
#ifdef _ASSERT
#undef _ASSERT
#endif
#ifdef WINCACHE_DEBUG
# define WINCACHE_TEST
# define _ASSERT(x) if(!(x)) { dprintalways("%s(%d): " #x "\n", __FILE__, __LINE__ ); if(IsDebuggerPresent()) { DebugBreak(); } }
#else
# define _ASSERT(x)
#endif
#if (defined(_MSC_VER) && (_MSC_VER < 1500))
# define IsDebuggerPresent() (0)
# define memcpy_s(dst, size, src, cnt) memcpy(dst, src, cnt)
# define sprintf_s(buffer, size, format) sprintf(buffer, format)
# define _snprintf_s wincache_php_snprintf_s
# define vsprintf_s(buffer, size, format, va_alist) vsprintf(buffer, format, va_alist)
# define strcpy_s(src, size, dst) strcpy(src, dst)
#endif
#define CACHE_TYPE_FILELIST 1
#define CACHE_TYPE_RESPATHS 2
#define CACHE_TYPE_FILECONTENT 3
#define CACHE_TYPE_BYTECODES 4
#define CACHE_TYPE_USERZVALS 5
#define CACHE_TYPE_SESSZVALS 6
#define CACHE_TYPE_FCNOTIFY 7
#define APLIST_TYPE_INVALID 255
#define APLIST_TYPE_GLOBAL 0
#define NUM_FILES_MINIMUM 1024
#define NUM_FILES_MAXIMUM 16384
#define FCACHE_SIZE_MINIMUM 5
#define FCACHE_SIZE_MAXIMUM 255
#define ZCACHE_SIZE_MINIMUM 5
#define ZCACHE_SIZE_MAXIMUM 930
#define SCACHE_SIZE_MINIMUM 5
#define SCACHE_SIZE_MAXIMUM 85
#define FILE_SIZE_MINIMUM 10
#define FILE_SIZE_MAXIMUM 4096
#define FCHECK_FREQ_MINIMUM 2
#define FCHECK_FREQ_MAXIMUM 300
#define TTL_VALUE_MINIMUM 60
#define TTL_VALUE_MAXIMUM 7200
#define FIVE_SECOND_WAIT 5000
#define MAX_INIT_EVENT_WAIT 30000
#include "wincache_error.h"
#include "wincache_debug.h"
#include "wincache_utils.h"
#include "wincache_lock.h"
#include "wincache_filemap.h"
#include "wincache_alloc.h"
#include "wincache_fcnotify.h"
#include "wincache_fcache.h"
#include "wincache_rplist.h"
#include "wincache_aplist.h"
#include "wincache_zvcache.h"
#include "wincache_session.h"
#if (_MSC_VER >= 1700)
#include "wincache_etw.h"
#else
/* PHP 5.4 supports XP, which *doesn't* support Manifest based ETW events*/
#include "wincache_dummy_etw.h"
#endif /* _MSC_VER 1700 */
#include "php_wincache.h"
#endif /* _PRECOMP_H_ */