34bee1e9812d4edb95b65f465b8a70681cd14977
[openafs.git] / src / WINNT / afsrdr / kernel / lib / Include / AFSCommon.h
1 /*
2  * Copyright (c) 2008, 2009, 2010, 2011 Kernel Drivers, LLC.
3  * Copyright (c) 2009, 2010, 2011 Your File System, Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
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
13  *   notice,
14  *   this list of conditions and the following disclaimer in the
15  *   documentation
16  *   and/or other materials provided with the distribution.
17  * - Neither the names of Kernel Drivers, LLC and Your File System, Inc.
18  *   nor the names of their contributors may be used to endorse or promote
19  *   products derived from this software without specific prior written
20  *   permission from Kernel Drivers, LLC and Your File System, Inc.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
25  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
26  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34
35 #ifndef _AFS_COMMON_H
36 #define _AFS_COMMON_H
37
38 //
39 // File: AFSCommon.h
40 //
41
42 extern "C"
43 {
44
45 #define AFS_KERNEL_MODE
46
47 #include <ntifs.h>
48 #include <wdmsec.h> // for IoCreateDeviceSecure
49 #include <initguid.h>
50 #include <ntintsafe.h>
51
52 #include "AFSDefines.h"
53
54 #include "AFSUserDefines.h"
55
56 #include "AFSUserIoctl.h"
57
58 #include "AFSUserStructs.h"
59
60 #include "AFSRedirCommonDefines.h"
61
62 #include "AFSRedirCommonStructs.h"
63
64 #include "AFSStructs.h"
65
66 #include "AFSProvider.h"
67
68 #ifndef NO_EXTERN
69 #include "AFSExtern.h"
70 #endif
71
72 #define NTSTRSAFE_LIB
73 #include "ntstrsafe.h"
74
75 NTSTATUS
76 ZwQueryInformationProcess(
77   __in       HANDLE ProcessHandle,
78   __in       PROCESSINFOCLASS ProcessInformationClass,
79   __out      PVOID ProcessInformation,
80   __in       ULONG ProcessInformationLength,
81   __out_opt  PULONG ReturnLength
82 );
83
84 NTSYSAPI
85 NTSTATUS
86 NTAPI
87 RtlAbsoluteToSelfRelativeSD( IN PSECURITY_DESCRIPTOR  AbsoluteSecurityDescriptor,
88                              OUT PSECURITY_DESCRIPTOR  SelfRelativeSecurityDescriptor,
89                              IN OUT PULONG  BufferLength );
90
91 #ifndef FILE_OPEN_REPARSE_POINT
92 #define FILE_OPEN_REPARSE_POINT                 0x00200000
93 #endif
94 //
95 // AFSBTreeSupport.cpp Prototypes
96 //
97
98 NTSTATUS
99 AFSLocateCaseSensitiveDirEntry( IN AFSDirectoryCB *RootNode,
100                                 IN ULONG Index,
101                                 IN OUT AFSDirectoryCB **DirEntry);
102
103 NTSTATUS
104 AFSLocateCaseInsensitiveDirEntry( IN AFSDirectoryCB *RootNode,
105                                   IN ULONG Index,
106                                   IN OUT AFSDirectoryCB **DirEntry);
107
108 NTSTATUS
109 AFSInsertCaseSensitiveDirEntry( IN AFSDirectoryCB *RootNode,
110                                 IN AFSDirectoryCB *DirEntry);
111
112 NTSTATUS
113 AFSInsertCaseInsensitiveDirEntry( IN AFSDirectoryCB *RootNode,
114                                   IN AFSDirectoryCB *DirEntry);
115
116 NTSTATUS
117 AFSRemoveCaseSensitiveDirEntry( IN AFSDirectoryCB **RootNode,
118                                 IN AFSDirectoryCB *DirEntry);
119
120 NTSTATUS
121 AFSRemoveCaseInsensitiveDirEntry( IN AFSDirectoryCB **RootNode,
122                                   IN AFSDirectoryCB *DirEntry);
123
124 NTSTATUS
125 AFSLocateShortNameDirEntry( IN AFSDirectoryCB *RootNode,
126                             IN ULONG Index,
127                             IN OUT AFSDirectoryCB **DirEntry);
128
129 NTSTATUS
130 AFSInsertShortNameDirEntry( IN AFSDirectoryCB *RootNode,
131                             IN AFSDirectoryCB *DirEntry);
132
133 NTSTATUS
134 AFSRemoveShortNameDirEntry( IN AFSDirectoryCB **RootNode,
135                             IN AFSDirectoryCB *DirEntry);
136
137 NTSTATUS
138 AFSLocateHashEntry( IN AFSBTreeEntry *TopNode,
139                     IN ULONGLONG HashIndex,
140                     IN OUT AFSBTreeEntry **TreeEntry);
141
142 NTSTATUS
143 AFSInsertHashEntry( IN AFSBTreeEntry *TopNode,
144                     IN AFSBTreeEntry *FileIDEntry);
145
146 NTSTATUS
147 AFSRemoveHashEntry( IN AFSBTreeEntry **TopNode,
148                     IN AFSBTreeEntry *FileIDEntry);
149
150 //
151 // AFSInit.cpp Prototypes
152 //
153
154 NTSTATUS
155 DriverEntry( IN PDRIVER_OBJECT DriverObj,
156              IN PUNICODE_STRING RegPath);
157
158 void
159 AFSUnload( IN PDRIVER_OBJECT DriverObject);
160
161 //
162 // AFSCommSupport.cpp Prototypes
163 //
164
165 NTSTATUS
166 AFSEnumerateDirectory( IN GUID *AuthGroup,
167                        IN AFSObjectInfoCB *ObjectInfoCB,
168                        IN BOOLEAN   FastQuery);
169
170 NTSTATUS
171 AFSEnumerateDirectoryNoResponse( IN GUID *AuthGroup,
172                                  IN AFSFileID *FileId);
173
174 NTSTATUS
175 AFSVerifyDirectoryContent( IN AFSObjectInfoCB *ObjectInfo,
176                            IN GUID *AuthGroup);
177
178 NTSTATUS
179 AFSNotifyFileCreate( IN GUID            *AuthGroup,
180                      IN AFSObjectInfoCB *ParentObjectInfo,
181                      IN PLARGE_INTEGER FileSize,
182                      IN ULONG FileAttributes,
183                      IN UNICODE_STRING *FileName,
184                      OUT AFSDirectoryCB **DirNode);
185
186 NTSTATUS
187 AFSUpdateFileInformation( IN AFSFileID *ParentFid,
188                           IN AFSObjectInfoCB *ObjectInfo,
189                           IN GUID *AuthGroup);
190
191 NTSTATUS
192 AFSNotifyDelete( IN AFSDirectoryCB *DirectoryCB,
193                  IN GUID           *AuthGroup,
194                  IN BOOLEAN         CheckOnly);
195
196 NTSTATUS
197 AFSNotifyRename( IN AFSObjectInfoCB *ObjectInfo,
198                  IN GUID            *AuthGroup,
199                  IN AFSObjectInfoCB *ParentObjectInfo,
200                  IN AFSObjectInfoCB *TargetParentObjectInfo,
201                  IN AFSDirectoryCB *DirectoryCB,
202                  IN UNICODE_STRING *TargetName,
203                  OUT AFSFileID  *UpdatedFID);
204
205 NTSTATUS
206 AFSNotifyHardLink( IN AFSObjectInfoCB *ObjectInfo,
207                    IN GUID            *AuthGroup,
208                    IN AFSObjectInfoCB *ParentObjectInfo,
209                    IN AFSObjectInfoCB *TargetParentObjectInfo,
210                    IN AFSDirectoryCB  *SourceDirectoryCB,
211                    IN UNICODE_STRING  *TargetName,
212                    IN BOOLEAN          bReplaceIfExists,
213                    OUT AFSDirectoryCB **TargetDirectoryCB);
214
215 NTSTATUS
216 AFSEvaluateTargetByID( IN AFSObjectInfoCB *ObjectInfo,
217                        IN GUID *AuthGroup,
218                        IN BOOLEAN FastCall,
219                        OUT AFSDirEnumEntry **DirEnumEntry);
220
221 NTSTATUS
222 AFSEvaluateTargetByName( IN GUID *AuthGroup,
223                          IN AFSObjectInfoCB *ParentObjectInfo,
224                          IN PUNICODE_STRING SourceName,
225                          IN ULONG Flags,
226                          OUT AFSDirEnumEntry **DirEnumEntry);
227
228 NTSTATUS
229 AFSRetrieveVolumeInformation( IN GUID *AuthGroup,
230                               IN AFSFileID *FileID,
231                               OUT AFSVolumeInfoCB *VolumeInformation);
232
233 NTSTATUS
234 AFSRetrieveVolumeSizeInformation( IN GUID *AuthGroup,
235                                   IN AFSFileID *FileID,
236                                   OUT AFSVolumeSizeInfoCB *VolumeSizeInformation);
237
238 NTSTATUS
239 AFSNotifyPipeTransceive( IN AFSCcb *Ccb,
240                          IN ULONG InputLength,
241                          IN ULONG OutputLength,
242                          IN void *InputDataBuffer,
243                          OUT void *OutputDataBuffer,
244                          OUT ULONG *BytesReturned);
245
246 NTSTATUS
247 AFSNotifySetPipeInfo( IN AFSCcb *Ccb,
248                       IN ULONG InformationClass,
249                       IN ULONG InputLength,
250                       IN void *DataBuffer);
251
252 NTSTATUS
253 AFSNotifyQueryPipeInfo( IN AFSCcb *Ccb,
254                         IN ULONG InformationClass,
255                         IN ULONG OutputLength,
256                         IN void *DataBuffer,
257                         OUT ULONG *BytesReturned);
258
259 NTSTATUS
260 AFSReleaseFid( IN AFSFileID *FileId);
261
262 BOOLEAN
263 AFSIsExtentRequestQueued( IN AFSFileID *FileID,
264                           IN LARGE_INTEGER *ExtentOffset,
265                           IN ULONG Length);
266
267 NTSTATUS
268 AFSCreateSymlink( IN GUID *AuthGroup,
269                   IN AFSObjectInfoCB *ParentObjectInfo,
270                   IN UNICODE_STRING *FileName,
271                   IN AFSObjectInfoCB *ObjectInfo,
272                   IN UNICODE_STRING *TargetName);
273
274 //
275 // AFSCreate.cpp Prototypes
276 //
277
278 NTSTATUS
279 AFSCreate( IN PDEVICE_OBJECT DeviceObject,
280            IN PIRP Irp);
281
282 NTSTATUS
283 AFSCommonCreate( IN PDEVICE_OBJECT DeviceObject,
284                  IN PIRP Irp);
285
286 NTSTATUS
287 AFSOpenRedirector( IN PIRP Irp,
288                    IN AFSFcb **Fcb,
289                    IN AFSCcb **Ccb);
290
291 NTSTATUS
292 AFSOpenAFSRoot( IN PIRP Irp,
293                 IN AFSFcb **Fcb,
294                 IN AFSCcb **Ccb);
295
296 NTSTATUS
297 AFSOpenRoot( IN PIRP Irp,
298              IN AFSVolumeCB *VolumeCB,
299              IN GUID *AuthGroup,
300              OUT AFSFcb **Fcb,
301              OUT AFSCcb **Ccb);
302
303 NTSTATUS
304 AFSProcessCreate( IN PIRP               Irp,
305                   IN GUID              *AuthGroup,
306                   IN AFSVolumeCB       *VolumeCB,
307                   IN AFSDirectoryCB    *ParentDirCB,
308                   IN PUNICODE_STRING    FileName,
309                   IN PUNICODE_STRING    ComponentName,
310                   IN PUNICODE_STRING    FullFileName,
311                   OUT AFSFcb          **Fcb,
312                   OUT AFSCcb          **Ccb);
313
314 NTSTATUS
315 AFSOpenTargetDirectory( IN PIRP Irp,
316                         IN AFSVolumeCB *VolumeCB,
317                         IN AFSDirectoryCB *ParentDirectoryCB,
318                         IN AFSDirectoryCB *TargetDirectoryCB,
319                         IN UNICODE_STRING *TargetName,
320                         OUT AFSFcb **Fcb,
321                         OUT AFSCcb **Ccb);
322
323 NTSTATUS
324 AFSProcessOpen( IN PIRP Irp,
325                 IN GUID *AuthGroup,
326                 IN AFSVolumeCB *VolumeCB,
327                 IN AFSDirectoryCB *ParentDirCB,
328                 IN AFSDirectoryCB *DirectoryCB,
329                 IN BOOLEAN bOpenedReparsePoint,
330                 OUT AFSFcb **Fcb,
331                 OUT AFSCcb **Ccb);
332
333 NTSTATUS
334 AFSProcessOverwriteSupersede( IN PDEVICE_OBJECT DeviceObject,
335                               IN PIRP           Irp,
336                               IN AFSVolumeCB   *VolumeCB,
337                               IN GUID          *AuthGroup,
338                               IN AFSDirectoryCB *ParentDirCB,
339                               IN AFSDirectoryCB *DirectoryCB,
340                               OUT AFSFcb       **Fcb,
341                               OUT AFSCcb       **Ccb);
342
343 NTSTATUS
344 AFSControlDeviceCreate( IN PIRP Irp);
345
346 NTSTATUS
347 AFSOpenIOCtlFcb( IN PIRP Irp,
348                  IN GUID *AuthGroup,
349                  IN AFSDirectoryCB *ParentDirCB,
350                  OUT AFSFcb **Fcb,
351                  OUT AFSCcb **Ccb);
352
353 NTSTATUS
354 AFSOpenSpecialShareFcb( IN PIRP Irp,
355                         IN GUID *AuthGroup,
356                         IN AFSDirectoryCB *DirectoryCB,
357                         OUT AFSFcb **Fcb,
358                         OUT AFSCcb **Ccb);
359
360 //
361 // AFSExtentsSupport.cpp Prototypes
362 //
363 VOID
364 AFSLockForExtentsTrim( IN AFSFcb *Fcb);
365
366 PAFSExtent
367 AFSExtentForOffset( IN AFSFcb *Fcb,
368                     IN PLARGE_INTEGER Offset,
369                     IN BOOLEAN ReturnPrevious);
370 BOOLEAN
371 AFSExtentContains( IN AFSExtent *Extent, IN PLARGE_INTEGER Offset);
372
373
374 NTSTATUS
375 AFSRequestExtents( IN  AFSFcb *Fcb,
376                    IN  AFSCcb *Ccb,
377                    IN  PLARGE_INTEGER Offset,
378                    IN  ULONG Size,
379                    OUT BOOLEAN *FullyMApped);
380
381 BOOLEAN AFSDoExtentsMapRegion(IN AFSFcb *Fcb,
382                               IN PLARGE_INTEGER Offset,
383                               IN ULONG Size,
384                               IN OUT AFSExtent **FirstExtent,
385                               OUT AFSExtent **LastExtent);
386
387 NTSTATUS
388 AFSRequestExtentsAsync( IN AFSFcb *Fcb,
389                         IN AFSCcb *Ccb,
390                         IN PLARGE_INTEGER Offset,
391                         IN ULONG Size);
392
393 NTSTATUS
394 AFSWaitForExtentMapping ( IN AFSFcb *Fcb,
395                           IN AFSCcb *Ccb);
396
397 NTSTATUS
398 AFSProcessSetFileExtents( IN AFSSetFileExtentsCB *SetExtents );
399
400 NTSTATUS
401 AFSProcessReleaseFileExtents( IN PIRP Irp);
402
403 NTSTATUS
404 AFSProcessExtentFailure( PIRP Irp);
405
406 NTSTATUS
407 AFSProcessSetExtents( IN AFSFcb *pFcb,
408                       IN ULONG   Count,
409                       IN AFSFileExtentCB *Result);
410
411 NTSTATUS
412 AFSFlushExtents( IN AFSFcb *pFcb,
413                  IN GUID *AuthGroup);
414
415 NTSTATUS
416 AFSReleaseExtentsWithFlush( IN AFSFcb *Fcb,
417                             IN GUID *AuthGroup,
418                             IN BOOLEAN bReleaseAll);
419
420 NTSTATUS
421 AFSReleaseCleanExtents( IN AFSFcb *Fcb,
422                         IN GUID *AuthGroup);
423
424 VOID
425 AFSMarkDirty( IN AFSFcb *pFcb,
426               IN AFSExtent *StartExtent,
427               IN ULONG ExtentsCount,
428               IN LARGE_INTEGER *StartingByte,
429               IN BOOLEAN DerefExtents);
430
431 VOID
432 AFSTearDownFcbExtents( IN AFSFcb *Fcb,
433                        IN GUID *AuthGroup);
434
435 VOID
436 AFSDeleteFcbExtents( IN AFSFcb *Fcb);
437
438 void
439 AFSTrimExtents( IN AFSFcb *Fcb,
440                 IN PLARGE_INTEGER FileSize);
441
442 void
443 AFSTrimSpecifiedExtents( IN AFSFcb *Fcb,
444                          IN ULONG   Count,
445                          IN AFSFileExtentCB *Result);
446
447 void
448 AFSReferenceActiveExtents( IN AFSExtent *StartExtent,
449                            IN ULONG ExtentsCount);
450
451 void
452 AFSDereferenceActiveExtents( IN AFSExtent *StartExtent,
453                              IN ULONG ExtentsCount);
454
455 void
456 AFSRemoveEntryDirtyList( IN AFSFcb *Fcb,
457                          IN AFSExtent *Extent);
458
459 AFSExtent *
460 ExtentFor( PLIST_ENTRY le, ULONG SkipList );
461
462 AFSExtent *
463 NextExtent( AFSExtent *Extent, ULONG SkipList );
464
465 ULONG
466 AFSConstructCleanByteRangeList( AFSFcb * pFcb,
467                                 AFSByteRange ** pByteRangeList);
468
469 #if GEN_MD5
470 void
471 AFSSetupMD5Hash( IN AFSFcb *Fcb,
472                  IN AFSExtent *StartExtent,
473                  IN ULONG ExtentsCount,
474                  IN void *SystemBuffer,
475                  IN LARGE_INTEGER *ByteOffset,
476                  IN ULONG ByteCount);
477 #endif
478
479 //
480 //
481 // AFSIoSupp.cpp Prototypes
482 //
483 NTSTATUS
484 AFSGetExtents( IN  AFSFcb *pFcb,
485                IN  PLARGE_INTEGER Offset,
486                IN  ULONG Length,
487                IN  AFSExtent *From,
488                OUT ULONG *ExtentCount,
489                OUT ULONG *RunCount);
490
491 NTSTATUS
492 AFSSetupIoRun( IN PDEVICE_OBJECT CacheDevice,
493                IN PIRP           MasterIrp,
494                IN PVOID          SystemBuffer,
495                IN OUT AFSIoRun  *IoRun,
496                IN PLARGE_INTEGER Start,
497                IN ULONG          Length,
498                IN AFSExtent     *From,
499                IN OUT ULONG     *RunCount);
500
501 NTSTATUS
502 AFSStartIos( IN FILE_OBJECT     *CacheFileObject,
503              IN UCHAR            FunctionCode,
504              IN ULONG            IrpFlags,
505              IN AFSIoRun        *IoRun,
506              IN ULONG            Count,
507              IN OUT AFSGatherIo *Gather);
508
509 VOID
510 AFSCompleteIo( IN AFSGatherIo *Gather,
511                IN NTSTATUS Status);
512
513 NTSTATUS
514 AFSProcessExtentRun( IN PVOID          SystemBuffer,
515                      IN PLARGE_INTEGER Start,
516                      IN ULONG          Length,
517                      IN AFSExtent     *From,
518                      IN BOOLEAN        WriteRequest);
519
520 //
521 // AFSClose.cpp Prototypes
522 //
523
524
525 NTSTATUS
526 AFSClose( IN PDEVICE_OBJECT DeviceObject,
527           IN PIRP Irp);
528
529 //
530 // AFSFcbSupport.cpp Prototypes
531 //
532
533 NTSTATUS
534 AFSInitFcb( IN AFSDirectoryCB   *DirEntry);
535
536 NTSTATUS
537 AFSInitRootFcb( IN ULONGLONG ProcessID,
538                 IN AFSVolumeCB *VolumeCB);
539
540 void
541 AFSRemoveRootFcb( IN AFSVolumeCB *VolumeCB);
542
543 NTSTATUS
544 AFSInitCcb( IN OUT AFSCcb **Ccb,
545             IN     AFSDirectoryCB *DirectoryCB,
546             IN     ACCESS_MASK     GrantedAccess,
547             IN     ULONG           FileAccess);
548
549 void
550 AFSRemoveFcb( IN AFSFcb **Fcb);
551
552 void
553 AFSRemoveCcb( IN AFSFcb *Fcb,
554               IN AFSCcb *Ccb);
555
556 NTSTATUS
557 AFSInsertCcb( IN AFSFcb *Fcb,
558               IN AFSCcb *Ccb);
559
560 //
561 // AFSNameSupport.cpp Prototypes
562 //
563
564 NTSTATUS
565 AFSLocateNameEntry( IN GUID *AuthGroup,
566                     IN PFILE_OBJECT FileObject,
567                     IN OUT UNICODE_STRING *RootPathName,
568                     IN UNICODE_STRING *ParsedPathName,
569                     IN AFSNameArrayHdr *NameArray,
570                     IN ULONG Flags,
571                     IN AFSVolumeCB *VolumeCB,
572                     IN AFSDirectoryCB *ParentDirectoryCB,
573                     OUT AFSVolumeCB **OutVolumeCB,
574                     OUT LONG *OutVolumeReferenceReason,
575                     OUT AFSDirectoryCB **OutParentDirectoryCB,
576                     OUT AFSDirectoryCB **OutDirectoryCB,
577                     OUT PUNICODE_STRING ComponentName);
578
579 NTSTATUS
580 AFSCreateDirEntry( IN GUID            *AuthGroup,
581                    IN AFSObjectInfoCB *ParentObjectInfo,
582                    IN AFSDirectoryCB *ParentDirCB,
583                    IN PUNICODE_STRING FileName,
584                    IN PUNICODE_STRING ComponentName,
585                    IN ULONG Attributes,
586                    IN OUT AFSDirectoryCB **DirEntry);
587
588 void
589 AFSInsertDirectoryNode( IN AFSObjectInfoCB *ParentObjectInfo,
590                         IN AFSDirectoryCB *DirEntry,
591                         IN BOOLEAN InsertInEnumList);
592
593 void
594 AFSDeleteDirEntry( IN AFSObjectInfoCB *ParentObjectInfo,
595                    IN AFSDirectoryCB **ppDirEntry);
596
597 NTSTATUS
598 AFSRemoveDirNodeFromParent( IN AFSObjectInfoCB *ParentObjectInfo,
599                             IN AFSDirectoryCB *DirEntry,
600                             IN BOOLEAN RemoveFromEnumList);
601
602 NTSTATUS
603 AFSFixupTargetName( IN OUT PUNICODE_STRING FileName,
604                     IN OUT PUNICODE_STRING TargetFileName);
605
606 NTSTATUS
607 AFSParseName( IN PIRP Irp,
608               IN GUID *AuthGroup,
609               OUT PUNICODE_STRING FileName,
610               OUT PUNICODE_STRING ParsedFileName,
611               OUT PUNICODE_STRING RootFileName,
612               OUT ULONG *ParseFlags,
613               OUT AFSVolumeCB **VolumeCB,
614               OUT AFSDirectoryCB **ParentDirectoryCB,
615               OUT AFSNameArrayHdr **NameArray);
616
617 NTSTATUS
618 AFSCheckCellName( IN GUID *AuthGroup,
619                   IN UNICODE_STRING *CellName,
620                   OUT AFSDirectoryCB **ShareDirEntry);
621
622 NTSTATUS
623 AFSBuildMountPointTarget( IN GUID *AuthGroup,
624                           IN AFSDirectoryCB *DirectoryCB,
625                           OUT AFSVolumeCB **VolumeCB);
626
627 NTSTATUS
628 AFSBuildRootVolume( IN GUID *AuthGroup,
629                     IN AFSFileID *FileId,
630                     OUT AFSVolumeCB **TargetVolumeCB);
631
632 NTSTATUS
633 AFSProcessDFSLink( IN AFSDirectoryCB *DirEntry,
634                    IN PFILE_OBJECT FileObject,
635                    IN UNICODE_STRING *RemainingPath,
636                    IN GUID *AuthGroup);
637
638 //
639 // AFSNetworkProviderSupport.cpp
640 //
641
642 NTSTATUS
643 AFSAddConnection( IN AFSNetworkProviderConnectionCB *ConnectCB,
644                   IN OUT PULONG ResultStatus,
645                   IN OUT ULONG_PTR *ReturnOutputBufferLength);
646
647 NTSTATUS
648 AFSCancelConnection( IN AFSNetworkProviderConnectionCB *ConnectCB,
649                      IN OUT AFSCancelConnectionResultCB *ConnectionResult,
650                      IN OUT ULONG_PTR *ReturnOutputBufferLength);
651
652 NTSTATUS
653 AFSGetConnection( IN AFSNetworkProviderConnectionCB *ConnectCB,
654                   IN OUT WCHAR *RemoteName,
655                   IN ULONG RemoteNameBufferLength,
656                   IN OUT ULONG_PTR *ReturnOutputBufferLength);
657
658 NTSTATUS
659 AFSListConnections( IN OUT AFSNetworkProviderConnectionCB *ConnectCB,
660                     IN ULONG ConnectionBufferLength,
661                     IN OUT ULONG_PTR *ReturnOutputBufferLength);
662
663 void
664 AFSInitializeConnectionInfo( IN AFSProviderConnectionCB *Connection,
665                              IN ULONG DisplayType);
666
667 AFSProviderConnectionCB *
668 AFSLocateEnumRootEntry( IN UNICODE_STRING *RemoteName);
669
670 NTSTATUS
671 AFSEnumerateConnection( IN OUT AFSNetworkProviderConnectionCB *ConnectCB,
672                         IN AFSProviderConnectionCB *RootConnection,
673                         IN ULONG BufferLength,
674                         OUT PULONG CopiedLength);
675
676 NTSTATUS
677 AFSGetConnectionInfo( IN AFSNetworkProviderConnectionCB *ConnectCB,
678                       IN ULONG BufferLength,
679                       IN OUT ULONG_PTR *ReturnOutputBufferLength);
680
681 BOOLEAN
682 AFSIsDriveMapped( IN WCHAR DriveMapping);
683
684 //
685 // AFSRead.cpp Prototypes
686 //
687
688 NTSTATUS
689 AFSCommonRead( IN PDEVICE_OBJECT DeviceObject,
690                IN PIRP Irp,
691                IN HANDLE OnBehalfOf);
692
693 NTSTATUS
694 AFSRead( IN PDEVICE_OBJECT DeviceObject,
695          IN PIRP Irp);
696
697
698 NTSTATUS
699 AFSIOCtlRead( IN PDEVICE_OBJECT DeviceObject,
700               IN PIRP Irp);
701
702 NTSTATUS
703 AFSShareRead( IN PDEVICE_OBJECT DeviceObject,
704               IN PIRP Irp);
705
706 //
707 // AFSWrite.cpp Prototypes
708 //
709
710 NTSTATUS
711 AFSCommonWrite( IN PDEVICE_OBJECT DeviceObject,
712                 IN PIRP Irp,
713                 IN HANDLE CallingUser,
714                 IN BOOLEAN bRetry);
715
716 NTSTATUS
717 AFSWrite( IN PDEVICE_OBJECT DeviceObject,
718                 IN PIRP Irp);
719
720 NTSTATUS
721 AFSIOCtlWrite( IN PDEVICE_OBJECT DeviceObject,
722                IN PIRP Irp);
723
724 NTSTATUS
725 AFSShareWrite( IN PDEVICE_OBJECT DeviceObject,
726                IN PIRP Irp);
727
728 NTSTATUS
729 AFSDeferWrite( IN PDEVICE_OBJECT DeviceObject,
730                IN PFILE_OBJECT FileObject,
731                IN HANDLE CallingUser,
732                IN PIRP Irp,
733                IN ULONG BytesToWrite,
734                IN BOOLEAN Retrying);
735
736 //
737 // AFSFileInfo.cpp Prototypes
738 //
739
740 NTSTATUS
741 AFSQueryFileInfo( IN PDEVICE_OBJECT DeviceObject,
742                   IN PIRP Irp);
743
744 NTSTATUS
745 AFSQueryBasicInfo( IN PIRP Irp,
746                    IN AFSDirectoryCB *DirectoryCB,
747                    IN OUT PFILE_BASIC_INFORMATION Buffer,
748                    IN OUT PLONG Length);
749
750 NTSTATUS
751 AFSQueryStandardInfo( IN PIRP Irp,
752                       IN AFSDirectoryCB *DirectoryCB,
753                       IN OUT PFILE_STANDARD_INFORMATION Buffer,
754                       IN OUT PLONG Length);
755
756 NTSTATUS
757 AFSQueryInternalInfo( IN PIRP Irp,
758                       IN AFSFcb *Fcb,
759                       IN OUT PFILE_INTERNAL_INFORMATION Buffer,
760                       IN OUT PLONG Length);
761
762 NTSTATUS
763 AFSQueryEaInfo( IN PIRP Irp,
764                 IN AFSDirectoryCB *DirectoryCB,
765                 IN OUT PFILE_EA_INFORMATION Buffer,
766                 IN OUT PLONG Length);
767
768 NTSTATUS
769 AFSQueryPositionInfo( IN PIRP Irp,
770                       IN AFSFcb *Fcb,
771                       IN OUT PFILE_POSITION_INFORMATION Buffer,
772                       IN OUT PLONG Length);
773
774 NTSTATUS
775 AFSQueryNameInfo( IN PIRP Irp,
776                   IN AFSDirectoryCB *DirectoryCB,
777                   IN OUT PFILE_NAME_INFORMATION Buffer,
778                   IN OUT PLONG Length);
779
780 NTSTATUS
781 AFSQueryShortNameInfo( IN PIRP Irp,
782                        IN AFSDirectoryCB *DirectoryCB,
783                        IN OUT PFILE_NAME_INFORMATION Buffer,
784                        IN OUT PLONG Length);
785
786 NTSTATUS
787 AFSQueryNetworkInfo( IN PIRP Irp,
788                      IN AFSDirectoryCB *DirectoryCB,
789                      IN OUT PFILE_NETWORK_OPEN_INFORMATION Buffer,
790                      IN OUT PLONG Length);
791
792 NTSTATUS
793 AFSQueryStreamInfo( IN PIRP Irp,
794                     IN AFSDirectoryCB *DirectoryCB,
795                     IN OUT FILE_STREAM_INFORMATION *Buffer,
796                     IN OUT PLONG Length);
797
798 NTSTATUS
799 AFSQueryAccess( IN PIRP Irp,
800                 IN AFSFcb *Fcb,
801                 IN OUT PFILE_ACCESS_INFORMATION Buffer,
802                 IN OUT PLONG Length);
803
804 NTSTATUS
805 AFSQueryMode( IN PIRP Irp,
806               IN AFSFcb *Fcb,
807               IN OUT PFILE_MODE_INFORMATION Buffer,
808               IN OUT PLONG Length);
809
810 NTSTATUS
811 AFSQueryAlignment( IN PIRP Irp,
812                    IN AFSFcb *Fcb,
813                    IN OUT PFILE_ALIGNMENT_INFORMATION Buffer,
814                    IN OUT PLONG Length);
815
816 NTSTATUS
817 AFSQueryAttribTagInfo( IN PIRP Irp,
818                        IN AFSDirectoryCB *DirectoryCB,
819                        IN OUT FILE_ATTRIBUTE_TAG_INFORMATION *Buffer,
820                        IN OUT PLONG Length);
821
822 NTSTATUS
823 AFSQueryRemoteProtocolInfo( IN PIRP Irp,
824                             IN AFSDirectoryCB *DirectoryCB,
825                             IN OUT FILE_REMOTE_PROTOCOL_INFORMATION *Buffer,
826                             IN OUT PLONG Length);
827
828 NTSTATUS
829 AFSQueryPhysicalNameInfo( IN PIRP Irp,
830                           IN AFSDirectoryCB *DirectoryCB,
831                           IN OUT PFILE_NETWORK_PHYSICAL_NAME_INFORMATION Buffer,
832                           IN OUT PLONG Length);
833
834 NTSTATUS
835 AFSSetFileInfo( IN PDEVICE_OBJECT DeviceObject,
836                 IN PIRP Irp);
837
838 NTSTATUS
839 AFSSetBasicInfo( IN PIRP Irp,
840                  IN AFSDirectoryCB *DirectoryCB);
841
842 NTSTATUS
843 AFSSetDispositionInfo( IN PIRP Irp,
844                        IN AFSDirectoryCB *DirectoryCB);
845
846 NTSTATUS
847 AFSSetRenameInfo( IN PIRP Irp);
848
849 NTSTATUS
850 AFSSetFileLinkInfo( IN PIRP Irp);
851
852 NTSTATUS
853 AFSSetPositionInfo( IN PIRP Irp,
854                     IN AFSDirectoryCB *DirectoryCB);
855
856 NTSTATUS
857 AFSSetAllocationInfo( IN PIRP Irp,
858                       IN AFSDirectoryCB *DirectoryCB);
859
860 NTSTATUS
861 AFSSetEndOfFileInfo( IN PIRP Irp,
862                      IN AFSDirectoryCB *DirectoryCB);
863
864 NTSTATUS
865 AFSProcessShareSetInfo( IN IRP *Irp,
866                         IN AFSFcb *Fcb,
867                         IN AFSCcb *Ccb);
868
869 NTSTATUS
870 AFSProcessShareQueryInfo( IN IRP *Irp,
871                           IN AFSFcb *Fcb,
872                           IN AFSCcb *Ccb);
873
874 NTSTATUS
875 AFSProcessPIOCtlQueryInfo( IN IRP *Irp,
876                            IN AFSFcb *Fcb,
877                            IN AFSCcb *Ccb,
878                            IN OUT LONG *Length);
879
880 //
881 // AFSEa.cpp Prototypes
882 //
883
884 NTSTATUS
885 AFSQueryEA( IN PDEVICE_OBJECT DeviceObject,
886             IN PIRP Irp);
887
888 NTSTATUS
889 AFSSetEA( IN PDEVICE_OBJECT DeviceObject,
890           IN PIRP Irp);
891
892 //
893 // AFSFlushBuffers.cpp Prototypes
894 //
895
896 NTSTATUS
897 AFSFlushBuffers( IN PDEVICE_OBJECT DeviceObject,
898                  IN PIRP Irp);
899
900 //
901 // AFSVolume.cpp Prototypes
902 //
903
904 NTSTATUS
905 AFSInitVolume( IN GUID *AuthGroup,
906                IN AFSFileID *RootFid,
907                IN LONG VolumeReferenceReason,
908                OUT AFSVolumeCB **VolumeCB);
909
910 NTSTATUS
911 AFSRemoveVolume( IN AFSVolumeCB *VolumeCB);
912
913 LONG
914 AFSVolumeIncrement( IN AFSVolumeCB *VolumeCB,
915                     IN LONG         Reason);
916
917 LONG
918 AFSVolumeDecrement( IN AFSVolumeCB *VolumeCB,
919                     IN LONG         Reason);
920
921 //
922 // AFSVolumeInfo.cpp Prototypes
923 //
924
925 NTSTATUS
926 AFSQueryVolumeInfo( IN PDEVICE_OBJECT DeviceObject,
927                     IN PIRP Irp);
928
929 NTSTATUS
930 AFSSetVolumeInfo( IN PDEVICE_OBJECT DeviceObject,
931                   IN PIRP Irp);
932
933 NTSTATUS
934 AFSQueryFsVolumeInfo( IN AFSVolumeInfoCB *VolumeInfo,
935                       IN PFILE_FS_VOLUME_INFORMATION Buffer,
936                       IN BOOLEAN bDosDevice,
937                       IN OUT PULONG Length);
938
939 NTSTATUS
940 AFSQueryFsSizeInfo( IN AFSVolumeInfoCB *VolumeInfo,
941                     IN PFILE_FS_SIZE_INFORMATION Buffer,
942                     IN OUT PULONG Length);
943
944 NTSTATUS
945 AFSQueryFsDeviceInfo( IN AFSVolumeInfoCB *VolumeInfo,
946                       IN PFILE_FS_DEVICE_INFORMATION Buffer,
947                       IN OUT PULONG Length);
948
949 NTSTATUS
950 AFSQueryFsAttributeInfo( IN AFSVolumeInfoCB *VolumeInfo,
951                          IN PFILE_FS_ATTRIBUTE_INFORMATION Buffer,
952                          IN OUT PULONG Length);
953
954 NTSTATUS
955 AFSQueryFsFullSizeInfo( IN AFSVolumeInfoCB *VolumeInfo,
956                         IN PFILE_FS_FULL_SIZE_INFORMATION Buffer,
957                         IN OUT PULONG Length);
958
959 //
960 // AFSDirControl.cpp Prototypes
961 //
962
963 NTSTATUS
964 AFSDirControl( IN PDEVICE_OBJECT DeviceObject,
965                IN PIRP Irp);
966
967 NTSTATUS
968 AFSQueryDirectory( IN PIRP Irp);
969
970 NTSTATUS
971 AFSNotifyChangeDirectory( IN PIRP Irp);
972
973 AFSDirectoryCB *
974 AFSLocateNextDirEntry( IN AFSObjectInfoCB *ObjectInfo,
975                        IN AFSCcb *Ccb);
976
977 AFSDirectoryCB *
978 AFSLocateDirEntryByIndex( IN AFSObjectInfoCB *ObjectInfo,
979                           IN AFSCcb *Ccb,
980                           IN ULONG DirIndex);
981
982 NTSTATUS
983 AFSSnapshotDirectory( IN AFSFcb *Fcb,
984                       IN AFSCcb *Ccb,
985                       IN BOOLEAN ResetIndex);
986
987 NTSTATUS
988 AFSFsRtlNotifyFullChangeDirectory( IN AFSObjectInfoCB *ObjectInfo,
989                                    IN AFSCcb *Context,
990                                    IN BOOLEAN WatchTree,
991                                    IN ULONG CompletionFilter,
992                                    IN PIRP NotifyIrp);
993
994 void
995 AFSFsRtlNotifyFullReportChange( IN AFSObjectInfoCB *ObjectInfo,
996                                 IN AFSCcb *Ccb,
997                                 IN ULONG NotifyFilter,
998                                 IN ULONG NotificationAction);
999
1000 BOOLEAN
1001 AFSNotifyReportChangeCallback( IN void *NotifyContext,
1002                                IN void *FilterContext);
1003
1004 BOOLEAN
1005 AFSIsNameInSnapshot( IN AFSSnapshotHdr *SnapshotHdr,
1006                      IN ULONG HashIndex);
1007
1008 NTSTATUS
1009 AFSProcessDirectoryQueryDirect( IN AFSFcb *Fcb,
1010                                 IN AFSCcb *Ccb,
1011                                 IN IRP *Irp);
1012
1013 //
1014 // AFSFSControl.cpp Prototypes
1015 //
1016
1017 NTSTATUS
1018 AFSFSControl( IN PDEVICE_OBJECT DeviceObject,
1019               IN PIRP Irp);
1020
1021 NTSTATUS
1022 AFSProcessUserFsRequest( IN PIRP Irp);
1023
1024 NTSTATUS
1025 AFSProcessShareFsCtrl( IN IRP *Irp,
1026                        IN AFSFcb *Fcb,
1027                        IN AFSCcb *Ccb);
1028
1029 //
1030 // AFSDevControl.cpp Prototypes
1031 //
1032
1033 NTSTATUS
1034 AFSDevControl( IN PDEVICE_OBJECT DeviceObject,
1035                IN PIRP Irp);
1036
1037 //
1038 // AFSInternalDevControl.cpp Prototypes
1039 //
1040
1041 NTSTATUS
1042 AFSInternalDevControl( IN PDEVICE_OBJECT DeviceObject,
1043                        IN PIRP Irp);
1044
1045 //
1046 // AFSShutdown.cpp Prototypes
1047 //
1048
1049 NTSTATUS
1050 AFSShutdown( IN PDEVICE_OBJECT DeviceObject,
1051              IN PIRP Irp);
1052
1053
1054 NTSTATUS
1055 AFSShutdownFilesystem( void);
1056
1057 //
1058 // AFSLockControl.cpp Prototypes
1059 //
1060
1061 NTSTATUS
1062 AFSLockControl( IN PDEVICE_OBJECT DeviceObject,
1063                 IN PIRP Irp);
1064
1065 //
1066 // AFSCleanup.cpp Prototypes
1067 //
1068
1069 NTSTATUS
1070 AFSCleanup( IN PDEVICE_OBJECT DeviceObject,
1071             IN PIRP Irp);
1072
1073 //
1074 // AFSSecurity.cpp Prototypes
1075 //
1076
1077 NTSTATUS
1078 AFSQuerySecurity( IN PDEVICE_OBJECT DeviceObject,
1079                   IN PIRP Irp);
1080
1081 NTSTATUS
1082 AFSSetSecurity( IN PDEVICE_OBJECT DeviceObject,
1083                 IN PIRP Irp);
1084
1085 //
1086 // AFSSystemControl.cpp Prototypes
1087 //
1088
1089 NTSTATUS
1090 AFSSystemControl( IN PDEVICE_OBJECT DeviceObject,
1091                   IN PIRP Irp);
1092
1093 //
1094 // AFSQuota.cpp Prototypes
1095 //
1096
1097 NTSTATUS
1098 AFSQueryQuota( IN PDEVICE_OBJECT DeviceObject,
1099                IN PIRP Irp);
1100
1101 NTSTATUS
1102 AFSSetQuota( IN PDEVICE_OBJECT DeviceObject,
1103              IN PIRP Irp);
1104
1105 //
1106 // AFSGeneric.cpp Prototypes
1107 //
1108
1109 ULONG
1110 AFSExceptionFilter( IN CHAR *FunctionString,
1111                     IN ULONG Code,
1112                     IN PEXCEPTION_POINTERS ExceptPtrs);
1113
1114 BOOLEAN
1115 AFSAcquireExcl( IN PERESOURCE Resource,
1116                 IN BOOLEAN wait);
1117
1118 BOOLEAN
1119 AFSAcquireSharedStarveExclusive( IN PERESOURCE Resource,
1120                                  IN BOOLEAN Wait);
1121
1122 BOOLEAN
1123 AFSAcquireShared( IN PERESOURCE Resource,
1124                   IN BOOLEAN wait);
1125
1126 void
1127 AFSReleaseResource( IN PERESOURCE Resource);
1128
1129 void
1130 AFSConvertToShared( IN PERESOURCE Resource);
1131
1132 void
1133 AFSCompleteRequest( IN PIRP Irp,
1134                     IN ULONG Status);
1135
1136 ULONG
1137 AFSGenerateCRC( IN PUNICODE_STRING FileName,
1138                 IN BOOLEAN UpperCaseName);
1139
1140 void *
1141 AFSLockSystemBuffer( IN PIRP Irp,
1142                      IN ULONG Length);
1143
1144 void *
1145 AFSLockUserBuffer( IN void *UserBuffer,
1146                    IN ULONG BufferLength,
1147                    OUT MDL ** Mdl);
1148
1149 void *
1150 AFSMapToService( IN PIRP Irp,
1151                  IN ULONG ByteCount);
1152
1153 NTSTATUS
1154 AFSUnmapServiceMappedBuffer( IN void *MappedBuffer,
1155                              IN PMDL Mdl);
1156
1157 NTSTATUS
1158 AFSInitializeLibraryDevice( void);
1159
1160 NTSTATUS
1161 AFSRemoveLibraryDevice( void);
1162
1163 NTSTATUS
1164 AFSDefaultDispatch( IN PDEVICE_OBJECT DeviceObject,
1165                     IN PIRP Irp);
1166
1167 NTSTATUS
1168 AFSInitializeGlobalDirectoryEntries( void);
1169
1170 AFSDirectoryCB *
1171 AFSInitDirEntry( IN AFSObjectInfoCB *ParentObjectInfo,
1172                  IN PUNICODE_STRING FileName,
1173                  IN PUNICODE_STRING TargetName,
1174                  IN AFSDirEnumEntry *DirEnumEntry,
1175                  IN ULONG FileIndex);
1176
1177 BOOLEAN
1178 AFSCheckForReadOnlyAccess( IN ACCESS_MASK DesiredAccess,
1179                            IN BOOLEAN DirectoryEntry);
1180
1181 NTSTATUS
1182 AFSEvaluateNode( IN GUID *AuthGroup,
1183                  IN AFSDirectoryCB *DirEntry);
1184
1185 NTSTATUS
1186 AFSValidateSymLink( IN GUID *AuthGroup,
1187                     IN AFSDirectoryCB *DirEntry);
1188
1189 NTSTATUS
1190 AFSInvalidateCache( IN AFSInvalidateCacheCB *InvalidateCB);
1191
1192 NTSTATUS
1193 AFSInvalidateObject( IN OUT AFSObjectInfoCB **ppObjectInfo,
1194                      IN     ULONG Reason);
1195
1196 BOOLEAN
1197 AFSIsChildOfParent( IN AFSFcb *Dcb,
1198                     IN AFSFcb *Fcb);
1199
1200 inline
1201 ULONGLONG
1202 AFSCreateHighIndex( IN AFSFileID *FileID);
1203
1204 inline
1205 ULONGLONG
1206 AFSCreateLowIndex( IN AFSFileID *FileID);
1207
1208 BOOLEAN
1209 AFSCheckAccess( IN ACCESS_MASK DesiredAccess,
1210                 IN ACCESS_MASK GrantedAccess,
1211                 IN BOOLEAN DirectoryEntry);
1212
1213 NTSTATUS
1214 AFSGetDriverStatus( IN AFSDriverStatusRespCB *DriverStatus);
1215
1216 NTSTATUS
1217 AFSSubstituteSysName( IN UNICODE_STRING *ComponentName,
1218                       IN UNICODE_STRING *SubstituteName,
1219                       IN ULONG StringIndex);
1220
1221 NTSTATUS
1222 AFSSubstituteNameInPath( IN OUT UNICODE_STRING *FullPathName,
1223                          IN OUT UNICODE_STRING *ComponentName,
1224                          IN UNICODE_STRING *SubstituteName,
1225                          IN OUT UNICODE_STRING *RemainingPath,
1226                          IN BOOLEAN FreePathName);
1227
1228 NTSTATUS
1229 AFSInvalidateVolume( IN AFSVolumeCB *VolumeCB,
1230                      IN ULONG Reason);
1231
1232 VOID
1233 AFSInvalidateAllVolumes( VOID);
1234
1235 NTSTATUS
1236 AFSVerifyEntry( IN GUID *AuthGroup,
1237                 IN AFSDirectoryCB *DirectoryCB,
1238                 IN BOOLEAN bFollowMountPoint);
1239
1240 NTSTATUS
1241 AFSSetVolumeState( IN AFSVolumeStatusCB *VolumeStatus);
1242
1243 NTSTATUS
1244 AFSSetNetworkState( IN AFSNetworkStatusCB *NetworkStatus);
1245
1246 NTSTATUS
1247 AFSValidateDirectoryCache( IN AFSObjectInfoCB *ObjectInfo,
1248                            IN GUID *AuthGroup);
1249
1250 BOOLEAN
1251 AFSIsVolumeFID( IN AFSFileID *FileID);
1252
1253 BOOLEAN
1254 AFSIsFinalNode( IN AFSFcb *Fcb);
1255
1256 NTSTATUS
1257 AFSUpdateMetaData( IN AFSDirectoryCB *DirEntry,
1258                    IN AFSDirEnumEntry *DirEnumEntry);
1259
1260 NTSTATUS
1261 AFSValidateEntry( IN AFSDirectoryCB *DirEntry,
1262                   IN GUID *AuthGroup,
1263                   IN BOOLEAN FastCall,
1264                   IN BOOLEAN SafeToPurge);
1265
1266 AFSDirectoryCB *
1267 AFSGetSpecialShareNameEntry( IN UNICODE_STRING *ShareName,
1268                              IN UNICODE_STRING *SecondaryName);
1269
1270 NTSTATUS
1271 AFSInitializeSpecialShareNameList( void);
1272
1273 void
1274 AFSWaitOnQueuedFlushes( IN AFSFcb *Fcb);
1275
1276 void
1277 AFSWaitOnQueuedReleases( void);
1278
1279 BOOLEAN
1280 AFSIsEqualFID( IN AFSFileID *FileId1,
1281                IN AFSFileID *FileId2);
1282
1283 NTSTATUS
1284 AFSResetDirectoryContent( IN AFSObjectInfoCB *ObjectInfoCB);
1285
1286 NTSTATUS
1287 AFSEnumerateGlobalRoot( IN GUID *AuthGroup);
1288
1289 BOOLEAN
1290 AFSIsRelativeName( IN UNICODE_STRING *Name);
1291
1292 BOOLEAN
1293 AFSIsAbsoluteAFSName( IN UNICODE_STRING *Name);
1294
1295 void
1296 AFSUpdateName( IN UNICODE_STRING *Name);
1297
1298 NTSTATUS
1299 AFSUpdateTargetName( IN OUT UNICODE_STRING *TargetName,
1300                      IN OUT ULONG *Flags,
1301                      IN WCHAR *NameBuffer,
1302                      IN USHORT NameLength);
1303
1304 void
1305 AFSSetEnumerationEvent( IN AFSFcb *Fcb);
1306
1307 void
1308 AFSClearEnumerationEvent( IN AFSFcb *Fcb);
1309
1310 BOOLEAN
1311 AFSIsEnumerationInProcess( IN AFSObjectInfoCB *ObjectInfo);
1312
1313 NTSTATUS
1314 AFSVerifyVolume( IN ULONGLONG ProcessId,
1315                  IN AFSVolumeCB *VolumeCB);
1316
1317 NTSTATUS
1318 AFSInitPIOCtlDirectoryCB( IN AFSObjectInfoCB *ObjectInfo);
1319
1320 NTSTATUS
1321 AFSRetrieveFileAttributes( IN AFSDirectoryCB *ParentDirectoryCB,
1322                            IN AFSDirectoryCB *DirectoryCB,
1323                            IN UNICODE_STRING *ParentPathName,
1324                            IN AFSNameArrayHdr *RelatedNameArray,
1325                            IN GUID           *AuthGroup,
1326                            OUT AFSFileInfoCB *FileInfo);
1327
1328 AFSObjectInfoCB *
1329 AFSAllocateObjectInfo( IN AFSObjectInfoCB *ParentObjectInfo,
1330                        IN ULONGLONG HashIndex);
1331
1332 LONG
1333 AFSObjectInfoIncrement( IN AFSObjectInfoCB *ObjectInfo,
1334                         IN LONG             Reason);
1335
1336 LONG
1337 AFSObjectInfoDecrement( IN AFSObjectInfoCB *ObjectInfo,
1338                         IN LONG             Reason);
1339
1340 void
1341 AFSDeleteObjectInfo( IN AFSObjectInfoCB **ppObjectInfo);
1342
1343 AFSObjectInfoCB *
1344 AFSFindObjectInfo( IN AFSVolumeCB * VolumeCB,
1345                    IN AFSFileID   * FileID,
1346                    IN BOOLEAN       bUpdateLastUse);
1347
1348 void
1349 AFSReleaseObjectInfo( IN OUT AFSObjectInfoCB **ppObjectInfo);
1350
1351 NTSTATUS
1352 AFSEvaluateRootEntry( IN AFSDirectoryCB *DirectoryCB,
1353                       OUT AFSDirectoryCB **TargetDirEntry);
1354
1355 NTSTATUS
1356 AFSCleanupFcb( IN AFSFcb *Fcb,
1357                IN BOOLEAN ForceFlush);
1358
1359 NTSTATUS
1360 AFSUpdateDirEntryName( IN AFSDirectoryCB *DirectoryCB,
1361                        IN UNICODE_STRING *NewFileName);
1362
1363 NTSTATUS
1364 AFSReadCacheFile( IN void *ReadBuffer,
1365                   IN LARGE_INTEGER *ReadOffset,
1366                   IN ULONG RequestedDataLength,
1367                   IN OUT PULONG BytesRead);
1368
1369 NTSTATUS
1370 AFSIrpComplete( IN PDEVICE_OBJECT DeviceObject,
1371                 IN PIRP           Irp,
1372                 IN PVOID          Context);
1373
1374 BOOLEAN
1375 AFSIsDirectoryEmptyForDelete( IN AFSFcb *Fcb);
1376
1377 void
1378 AFSRemoveNameEntry( IN AFSObjectInfoCB *ParentObjectInfo,
1379                     IN AFSDirectoryCB *DirEntry);
1380
1381 LARGE_INTEGER
1382 AFSGetAuthenticationId( void);
1383
1384 void
1385 AFSUnwindFileInfo( IN AFSFcb *Fcb,
1386                    IN AFSCcb *Ccb);
1387
1388 BOOLEAN
1389 AFSValidateDirList( IN AFSObjectInfoCB *ObjectInfo);
1390
1391 PFILE_OBJECT
1392 AFSReferenceCacheFileObject( void);
1393
1394 void
1395 AFSReleaseCacheFileObject( IN PFILE_OBJECT CacheFileObject);
1396
1397 NTSTATUS
1398 AFSInitializeLibrary( IN AFSLibraryInitCB *LibraryInit);
1399
1400 NTSTATUS
1401 AFSCloseLibrary( void);
1402
1403 NTSTATUS
1404 AFSDefaultLogMsg( IN ULONG Subsystem,
1405                   IN ULONG Level,
1406                   IN PCCH Format,
1407                   ...);
1408
1409 NTSTATUS
1410 AFSGetObjectStatus( IN AFSGetStatusInfoCB *GetStatusInfo,
1411                     IN ULONG InputBufferLength,
1412                     IN AFSStatusInfoCB *StatusInfo,
1413                     OUT ULONG *ReturnLength);
1414
1415 NTSTATUS
1416 AFSCheckSymlinkAccess( IN AFSDirectoryCB *ParentDirectoryCB,
1417                        IN UNICODE_STRING *ComponentName);
1418
1419 NTSTATUS
1420 AFSRetrieveFinalComponent( IN UNICODE_STRING *FullPathName,
1421                            OUT UNICODE_STRING *ComponentName);
1422
1423 void
1424 AFSDumpTraceFiles_Default( void);
1425
1426 void *
1427 AFSLibExAllocatePoolWithTag( IN POOL_TYPE  PoolType,
1428                              IN SIZE_T  NumberOfBytes,
1429                              IN ULONG  Tag);
1430
1431 #define AFSLibExFreePool(x)          ExFreePool(x)
1432
1433 #define AFSLibExFreePoolWithTag(x,y) ExFreePoolWithTag(x,y)
1434
1435 BOOLEAN
1436 AFSValidNameFormat( IN UNICODE_STRING *FileName);
1437
1438 NTSTATUS
1439 AFSCreateDefaultSecurityDescriptor( void);
1440
1441 void
1442 AFSRetrieveParentPath( IN UNICODE_STRING *FullFileName,
1443                        OUT UNICODE_STRING *ParentPath);
1444
1445 NTSTATUS
1446 AFSRetrieveValidAuthGroup( IN AFSFcb *Fcb,
1447                            IN AFSObjectInfoCB *ObjectInfo,
1448                            IN BOOLEAN WriteAccess,
1449                            OUT GUID *AuthGroup);
1450
1451 NTSTATUS
1452 AFSPerformObjectInvalidate( IN AFSObjectInfoCB *ObjectInfo,
1453                             IN ULONG InvalidateReason);
1454
1455 BOOLEAN
1456 AFSIgnoreReparsePointToFile( void);
1457
1458 //
1459 // AFSNameArray.cpp Prototypes
1460 //
1461
1462 AFSNameArrayHdr *
1463 AFSInitNameArray( IN AFSDirectoryCB *DirectoryCB,
1464                   IN ULONG InitialElementCount);
1465
1466 NTSTATUS
1467 AFSPopulateNameArray( IN AFSNameArrayHdr *NameArray,
1468                       IN UNICODE_STRING *Path,
1469                       IN AFSDirectoryCB *DirectoryCB);
1470
1471 NTSTATUS
1472 AFSPopulateNameArrayFromRelatedArray( IN AFSNameArrayHdr *NameArray,
1473                                       IN AFSNameArrayHdr *RelatedNameArray,
1474                                       IN AFSDirectoryCB *DirectoryCB);
1475
1476 NTSTATUS
1477 AFSFreeNameArray( IN AFSNameArrayHdr *NameArray);
1478
1479 NTSTATUS
1480 AFSInsertNextElement( IN AFSNameArrayHdr *NameArray,
1481                       IN AFSDirectoryCB *DirEntry);
1482
1483 AFSDirectoryCB *
1484 AFSBackupEntry( IN AFSNameArrayHdr *NameArray);
1485
1486 AFSDirectoryCB *
1487 AFSGetParentEntry( IN AFSNameArrayHdr *NameArray);
1488
1489 void
1490 AFSResetNameArray( IN AFSNameArrayHdr *NameArray,
1491                    IN AFSDirectoryCB *DirEntry);
1492
1493 void
1494 AFSDumpNameArray( IN IN AFSNameArrayHdr *NameArray);
1495
1496 //
1497 // AFSWorker.cpp Prototypes
1498 //
1499
1500 NTSTATUS
1501 AFSInitializeWorkerPool( void);
1502
1503 NTSTATUS
1504 AFSRemoveWorkerPool( void);
1505
1506 NTSTATUS
1507 AFSInitWorkerThread( IN AFSWorkQueueContext *PoolContext,
1508                      IN PKSTART_ROUTINE WorkerRoutine);
1509
1510 NTSTATUS
1511 AFSInitVolumeWorker( IN AFSVolumeCB *VolumeCB);
1512
1513 NTSTATUS
1514 AFSShutdownWorkerThread( IN AFSWorkQueueContext *PoolContext);
1515
1516 NTSTATUS
1517 AFSShutdownIOWorkerThread( IN AFSWorkQueueContext *PoolContext);
1518
1519 NTSTATUS
1520 AFSShutdownVolumeWorker( IN AFSVolumeCB *VolumeCB);
1521
1522 void
1523 AFSWorkerThread( IN PVOID Context);
1524
1525 void
1526 AFSIOWorkerThread( IN PVOID Context);
1527
1528 void
1529 AFSPrimaryVolumeWorkerThread( IN PVOID Context);
1530
1531 NTSTATUS
1532 AFSInsertWorkitem( IN AFSWorkItem *WorkItem);
1533
1534 NTSTATUS
1535 AFSInsertIOWorkitem( IN AFSWorkItem *WorkItem);
1536
1537 NTSTATUS
1538 AFSInsertWorkitemAtHead( IN AFSWorkItem *WorkItem);
1539
1540 AFSWorkItem *
1541 AFSRemoveWorkItem( void);
1542
1543 AFSWorkItem *
1544 AFSRemoveIOWorkItem( void);
1545
1546 NTSTATUS
1547 AFSQueueWorkerRequest( IN AFSWorkItem *WorkItem);
1548
1549 NTSTATUS
1550 AFSQueueIOWorkerRequest( IN AFSWorkItem *WorkItem);
1551
1552 NTSTATUS
1553 AFSQueueWorkerRequestAtHead( IN AFSWorkItem *WorkItem);
1554
1555 NTSTATUS
1556 AFSShutdownVolumeWorker( IN AFSVolumeCB *VolumeCB);
1557
1558 NTSTATUS
1559 AFSQueueFlushExtents( IN AFSFcb *Fcb,
1560                       IN GUID *AuthGroup);
1561
1562 NTSTATUS
1563 AFSQueueGlobalRootEnumeration( void);
1564
1565 NTSTATUS
1566 AFSQueuePurgeObject( IN AFSFcb *Fcb);
1567
1568 NTSTATUS
1569 AFSQueueStartIos( IN PFILE_OBJECT CacheFileObject,
1570                   IN UCHAR FunctionCode,
1571                   IN ULONG RequestFLags,
1572                   IN AFSIoRun *IoRuns,
1573                   IN ULONG RunCount,
1574                   IN AFSGatherIo *GatherIo);
1575
1576 NTSTATUS
1577 AFSQueueInvalidateObject( IN AFSObjectInfoCB *ObjectInfo,
1578                           IN ULONG InvalidateReason);
1579
1580 //
1581 // AFSMD5Support.cpp Prototypes
1582 //
1583
1584 void
1585 AFSGenerateMD5( IN char *DataBuffer,
1586                 IN ULONG Length,
1587                 OUT UCHAR *MD5Digest);
1588
1589 };
1590
1591 #endif /* _AFS_COMMON_H */