2 * Copyright (c) 2008-2011 Kernel Drivers, LLC.
3 * Copyright (c) 2009-2011 Your File System, Inc.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * - Redistributions of source code must retain the above copyright notice,
11 * this list of conditions and the following disclaimer.
12 * - Redistributions in binary form must reproduce the above copyright
14 * this list of conditions and the following disclaimer in the
16 * and/or other materials provided with the distribution.
17 * - Neither the name of Kernel Drivers, LLC nor the names of its
19 * used to endorse or promote products derived from this software without
20 * specific prior written permission from Kernel Drivers, LLC
21 * and Your File System, Inc.
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
26 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
27 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 #ifndef _AFS_REDIR_COMMON_DEFINES_H
37 #define _AFS_REDIR_COMMON_DEFINES_H
43 #define AFS_GENERIC_MEMORY_1_TAG '1GFA'
44 #define AFS_GENERIC_MEMORY_2_TAG '2GFA'
45 #define AFS_GENERIC_MEMORY_3_TAG '3GFA'
46 #define AFS_GENERIC_MEMORY_4_TAG '4GFA'
47 #define AFS_GENERIC_MEMORY_5_TAG '5GFA'
48 #define AFS_GENERIC_MEMORY_6_TAG '6GFA'
49 #define AFS_GENERIC_MEMORY_7_TAG '7GFA'
50 #define AFS_GENERIC_MEMORY_8_TAG '8GFA'
51 #define AFS_GENERIC_MEMORY_9_TAG '9GFA'
52 #define AFS_GENERIC_MEMORY_10_TAG 'AGFA'
53 #define AFS_GENERIC_MEMORY_11_TAG 'BGFA'
54 #define AFS_GENERIC_MEMORY_12_TAG 'CGFA'
55 #define AFS_GENERIC_MEMORY_13_TAG 'DGFA'
56 #define AFS_GENERIC_MEMORY_14_TAG 'EGFA'
57 #define AFS_GENERIC_MEMORY_15_TAG 'FGFA'
58 #define AFS_GENERIC_MEMORY_16_TAG 'GGFA'
59 #define AFS_GENERIC_MEMORY_17_TAG 'HGFA'
60 #define AFS_GENERIC_MEMORY_18_TAG 'IGFA'
61 #define AFS_GENERIC_MEMORY_19_TAG 'JGFA'
62 #define AFS_GENERIC_MEMORY_20_TAG 'KGFA'
63 #define AFS_GENERIC_MEMORY_21_TAG 'LGFA'
64 #define AFS_GENERIC_MEMORY_22_TAG 'MGFA'
65 #define AFS_GENERIC_MEMORY_23_TAG 'NGFA'
66 #define AFS_GENERIC_MEMORY_24_TAG 'OGFA'
67 #define AFS_GENERIC_MEMORY_25_TAG 'PGFA'
68 #define AFS_GENERIC_MEMORY_26_TAG 'QGFA'
69 #define AFS_GENERIC_MEMORY_27_TAG 'RGFA'
70 #define AFS_GENERIC_MEMORY_28_TAG 'SGFA'
71 #define AFS_GENERIC_MEMORY_29_TAG 'TGFA'
72 #define AFS_GENERIC_MEMORY_30_TAG 'UGFA'
73 #define AFS_GENERIC_MEMORY_31_TAG 'VGFA'
74 #define AFS_GENERIC_MEMORY_32_TAG 'WGFA'
75 #define AFS_FCB_ALLOCATION_TAG 'AFFA'
76 #define AFS_FCB_NP_ALLOCATION_TAG 'NFFA'
77 #define AFS_VCB_ALLOCATION_TAG 'CVFA'
78 #define AFS_VCB_NP_ALLOCATION_TAG 'NVFA'
79 #define AFS_CCB_ALLOCATION_TAG 'CCFA'
80 #define AFS_CCB_NP_ALLOCATION_TAG 'NCFA'
81 #define AFS_WORKER_CB_TAG 'CWFA'
82 #define AFS_WORK_ITEM_TAG 'IWFA'
83 #define AFS_POOL_ENTRY_TAG 'EPFA'
84 #define AFS_PROCESS_CB_TAG 'CPFA'
85 #define AFS_DIR_BUFFER_TAG 'BDFA'
86 #define AFS_DIR_ENTRY_TAG 'EDFA'
87 #define AFS_NAME_BUFFER_ONE_TAG '1NFA'
88 #define AFS_NAME_BUFFER_TWO_TAG '2NFA'
89 #define AFS_NAME_BUFFER_THREE_TAG '3NFA'
90 #define AFS_NAME_BUFFER_FOUR_TAG '4NFA'
91 #define AFS_NAME_BUFFER_FIVE_TAG '5NFA'
92 #define AFS_NAME_BUFFER_SIX_TAG '6NFA'
93 #define AFS_NAME_BUFFER_SEVEN_TAG '7NFA'
94 #define AFS_NAME_BUFFER_EIGHT_TAG '8NFA'
95 #define AFS_NAME_BUFFER_NINE_TAG '9NFA'
96 #define AFS_NAME_BUFFER_TEN_TAG 'ANFA'
97 #define AFS_SUBST_BUFFER_TAG 'SBFA'
98 #define AFS_FILE_CREATE_BUFFER_TAG 'CFFA'
99 #define AFS_RENAME_REQUEST_TAG 'RFFA'
100 #define AFS_DIR_ENTRY_NP_TAG 'NDFA'
101 #define AFS_PROVIDER_CB 'PNFA'
102 #define AFS_EXTENT_TAG 'xSFA'
103 #define AFS_EXTENT_REQUEST_TAG 'XSFA'
104 #define AFS_EXTENT_RELEASE_TAG 'LSFA'
105 #define AFS_IO_RUN_TAG 'iSFA'
106 #define AFS_GATHER_TAG 'gSFA'
107 #define AFS_UPDATE_RESULT_TAG 'RUFA'
108 #define AFS_EXTENTS_RESULT_TAG 'XEFA'
109 #define AFS_SYS_NAME_NODE_TAG 'NSFA'
110 #define AFS_REPARSE_NAME_TAG 'NRFA'
111 #define AFS_NAME_ARRAY_TAG 'ANFA'
112 #define AFS_OBJECT_INFO_TAG 'IOFA'
113 #define AFS_NP_OBJECT_INFO_TAG 'ONFA'
114 #define AFS_DIR_SNAPSHOT_TAG 'SSFA'
115 #define AFS_LIBRARY_QUEUE_TAG 'QLFA'
116 #define AFS_NETWORK_PROVIDER_1_TAG '1ZFA'
117 #define AFS_NETWORK_PROVIDER_2_TAG '2ZFA'
118 #define AFS_NETWORK_PROVIDER_3_TAG '3ZFA'
119 #define AFS_NETWORK_PROVIDER_4_TAG '4ZFA'
120 #define AFS_NETWORK_PROVIDER_5_TAG '5ZFA'
121 #define AFS_NETWORK_PROVIDER_6_TAG '6ZFA'
122 #define AFS_NETWORK_PROVIDER_7_TAG '7ZFA'
123 #define AFS_NETWORK_PROVIDER_8_TAG '8ZFA'
124 #define AFS_NETWORK_PROVIDER_9_TAG '9ZFA'
125 #define AFS_NETWORK_PROVIDER_10_TAG 'AZFA'
126 #define AFS_NETWORK_PROVIDER_11_TAG 'BZFA'
127 #define AFS_AG_ENTRY_CB_TAG 'GAFA'
128 #define AFS_PROCESS_AG_CB_TAG 'APFA'
129 #define AFS_BYTERANGE_TAG '_RBA'
130 #define AFS_HARDLINK_REQUEST_TAG 'LFFA'
134 #define try_return(S) { S; goto try_exit; }
137 // Object types allocated
140 #define AFS_FILE_FCB 0x0001
141 #define AFS_DIRECTORY_FCB 0x0002
142 #define AFS_NON_PAGED_FCB 0x0003
143 #define AFS_CCB 0x0004
144 #define AFS_ROOT_FCB 0x0006
145 #define AFS_VCB 0x0007
146 #define AFS_NON_PAGED_VCB 0x0008
147 #define AFS_ROOT_ALL 0x0009
148 #define AFS_IOCTL_FCB 0x000A
149 #define AFS_MOUNT_POINT_FCB 0x000B
150 #define AFS_SYMBOLIC_LINK_FCB 0x000C
151 #define AFS_SPECIAL_SHARE_FCB 0x000D
152 #define AFS_DFS_LINK_FCB 0x000E
153 #define AFS_REDIRECTOR_FCB 0x000F
155 #define AFS_INVALID_FCB 0x00FF
161 #define AFS_DBG_FLAG_BREAK_ON_ENTRY 0x00000001 // Only enabled in checked build
162 #define AFS_DBG_TRACE_TO_DEBUGGER 0x00000002
163 #define AFS_DBG_FLAG_ENABLE_FORCE_CRASH 0x00000004 // Only enabled in checked build
164 #define AFS_DBG_BUGCHECK_EXCEPTION 0x00000008
165 #define AFS_DBG_CLEAN_SHUTDOWN 0x00000010
166 #define AFS_DBG_REQUIRE_CLEAN_SHUTDOWN 0x00000020
167 #define AFS_DBG_DISABLE_SYSTEM_SID_CHECK 0x00000040
173 #define POOL_UNKNOWN 0
174 #define POOL_INACTIVE 1
175 #define POOL_ACTIVE 2
181 #define AFS_VOLUME_FLAGS_OFFLINE 0x00000001
182 #define AFS_VOLUME_PRIVATE_WOKER_INITIALIZED 0x00000002
183 #define AFS_VOLUME_INSERTED_HASH_TREE 0x00000004
184 #define AFS_VOLUME_ACTIVE_GLOBAL_ROOT 0x00000008
187 // Need this to handle the break point definition
192 (*PAFSDumpTraceFiles)( void);
194 extern PAFSDumpTraceFiles AFSDumpTraceFilesFnc;
200 static inline void AFS_ASSERT() {
201 AFSDumpTraceFilesFnc();
206 //#define AFS_VALIDATE_EXTENTS 0
208 static inline void AFSBreakPoint() {
209 #if !defined(KD_DEBUGGER_ENABLED)
210 #define KD_DEBUGGER_ENABLED DBG
211 #endif // KD_DEBUGGER_ENABLED
213 #if (NTDDI_VERSION >= NTDDI_WS03)
214 KdRefreshDebuggerNotPresent();
217 #if defined(KD_DEBUGGER_NOT_PRESENT)
218 if (KD_DEBUGGER_NOT_PRESENT == FALSE)
220 #endif // KD_DEBUGGER_NOT_PRESENT
223 #define AFSPrint DbgPrint
227 static inline void AFSBreakPoint() {
236 // Library control device name
239 #define AFS_LIBRARY_CONTROL_DEVICE_NAME L"\\Device\\AFSLibraryControlDevice"
241 #define AFS_REDIR_LIBRARY_SERVICE_ENTRY L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\AFSLibrary"
244 // Common Device flags
247 #define AFS_DEVICE_FLAG_HIDE_DOT_NAMES 0x00000001
248 #define AFS_DEVICE_FLAG_REDIRECTOR_SHUTDOWN 0x00000002
249 #define AFS_DEVICE_FLAG_DISABLE_SHORTNAMES 0x00000004