Windows: !overwrite IOMgr populated FileInfo data
[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                     OUT PUNICODE_STRING TargetName);
579
580 NTSTATUS
581 AFSCreateDirEntry( IN GUID            *AuthGroup,
582                    IN AFSObjectInfoCB *ParentObjectInfo,
583                    IN AFSDirectoryCB *ParentDirCB,
584                    IN PUNICODE_STRING FileName,
585                    IN PUNICODE_STRING ComponentName,
586                    IN ULONG Attributes,
587                    IN OUT AFSDirectoryCB **DirEntry);
588
589 void
590 AFSInsertDirectoryNode( IN AFSObjectInfoCB *ParentObjectInfo,
591                         IN AFSDirectoryCB *DirEntry,
592                         IN BOOLEAN InsertInEnumList);
593
594 void
595 AFSDeleteDirEntry( IN AFSObjectInfoCB *ParentObjectInfo,
596                    IN AFSDirectoryCB **ppDirEntry);
597
598 NTSTATUS
599 AFSRemoveDirNodeFromParent( IN AFSObjectInfoCB *ParentObjectInfo,
600                             IN AFSDirectoryCB *DirEntry,
601                             IN BOOLEAN RemoveFromEnumList);
602
603 NTSTATUS
604 AFSFixupTargetName( IN OUT PUNICODE_STRING FileName,
605                     IN OUT PUNICODE_STRING TargetFileName);
606
607 NTSTATUS
608 AFSParseName( IN PIRP Irp,
609               IN GUID *AuthGroup,
610               OUT PUNICODE_STRING FileName,
611               OUT PUNICODE_STRING ParsedFileName,
612               OUT PUNICODE_STRING RootFileName,
613               OUT ULONG *ParseFlags,
614               OUT AFSVolumeCB **VolumeCB,
615               OUT AFSDirectoryCB **ParentDirectoryCB,
616               OUT AFSNameArrayHdr **NameArray);
617
618 NTSTATUS
619 AFSCheckCellName( IN GUID *AuthGroup,
620                   IN UNICODE_STRING *CellName,
621                   OUT AFSDirectoryCB **ShareDirEntry);
622
623 NTSTATUS
624 AFSBuildMountPointTarget( IN GUID *AuthGroup,
625                           IN AFSDirectoryCB *DirectoryCB,
626                           OUT AFSVolumeCB **VolumeCB);
627
628 NTSTATUS
629 AFSBuildRootVolume( IN GUID *AuthGroup,
630                     IN AFSFileID *FileId,
631                     OUT AFSVolumeCB **TargetVolumeCB);
632
633 NTSTATUS
634 AFSProcessDFSLink( IN AFSDirectoryCB *DirEntry,
635                    IN PFILE_OBJECT FileObject,
636                    IN PUNICODE_STRING RemainingPath,
637                    IN GUID *AuthGroup,
638                    OUT PUNICODE_STRING TargetName);
639
640 //
641 // AFSNetworkProviderSupport.cpp
642 //
643
644 NTSTATUS
645 AFSAddConnection( IN AFSNetworkProviderConnectionCB *ConnectCB,
646                   IN OUT PULONG ResultStatus,
647                   IN OUT ULONG_PTR *ReturnOutputBufferLength);
648
649 NTSTATUS
650 AFSCancelConnection( IN AFSNetworkProviderConnectionCB *ConnectCB,
651                      IN OUT AFSCancelConnectionResultCB *ConnectionResult,
652                      IN OUT ULONG_PTR *ReturnOutputBufferLength);
653
654 NTSTATUS
655 AFSGetConnection( IN AFSNetworkProviderConnectionCB *ConnectCB,
656                   IN OUT WCHAR *RemoteName,
657                   IN ULONG RemoteNameBufferLength,
658                   IN OUT ULONG_PTR *ReturnOutputBufferLength);
659
660 NTSTATUS
661 AFSListConnections( IN OUT AFSNetworkProviderConnectionCB *ConnectCB,
662                     IN ULONG ConnectionBufferLength,
663                     IN OUT ULONG_PTR *ReturnOutputBufferLength);
664
665 void
666 AFSInitializeConnectionInfo( IN AFSProviderConnectionCB *Connection,
667                              IN ULONG DisplayType);
668
669 AFSProviderConnectionCB *
670 AFSLocateEnumRootEntry( IN UNICODE_STRING *RemoteName);
671
672 NTSTATUS
673 AFSEnumerateConnection( IN OUT AFSNetworkProviderConnectionCB *ConnectCB,
674                         IN AFSProviderConnectionCB *RootConnection,
675                         IN ULONG BufferLength,
676                         OUT PULONG CopiedLength);
677
678 NTSTATUS
679 AFSGetConnectionInfo( IN AFSNetworkProviderConnectionCB *ConnectCB,
680                       IN ULONG BufferLength,
681                       IN OUT ULONG_PTR *ReturnOutputBufferLength);
682
683 BOOLEAN
684 AFSIsDriveMapped( IN WCHAR DriveMapping);
685
686 //
687 // AFSRead.cpp Prototypes
688 //
689
690 NTSTATUS
691 AFSCommonRead( IN PDEVICE_OBJECT DeviceObject,
692                IN PIRP Irp,
693                IN HANDLE OnBehalfOf);
694
695 NTSTATUS
696 AFSRead( IN PDEVICE_OBJECT DeviceObject,
697          IN PIRP Irp);
698
699
700 NTSTATUS
701 AFSIOCtlRead( IN PDEVICE_OBJECT DeviceObject,
702               IN PIRP Irp);
703
704 NTSTATUS
705 AFSShareRead( IN PDEVICE_OBJECT DeviceObject,
706               IN PIRP Irp);
707
708 //
709 // AFSWrite.cpp Prototypes
710 //
711
712 NTSTATUS
713 AFSCommonWrite( IN PDEVICE_OBJECT DeviceObject,
714                 IN PIRP Irp,
715                 IN HANDLE CallingUser,
716                 IN BOOLEAN bRetry);
717
718 NTSTATUS
719 AFSWrite( IN PDEVICE_OBJECT DeviceObject,
720                 IN PIRP Irp);
721
722 NTSTATUS
723 AFSIOCtlWrite( IN PDEVICE_OBJECT DeviceObject,
724                IN PIRP Irp);
725
726 NTSTATUS
727 AFSShareWrite( IN PDEVICE_OBJECT DeviceObject,
728                IN PIRP Irp);
729
730 NTSTATUS
731 AFSDeferWrite( IN PDEVICE_OBJECT DeviceObject,
732                IN PFILE_OBJECT FileObject,
733                IN HANDLE CallingUser,
734                IN PIRP Irp,
735                IN ULONG BytesToWrite,
736                IN BOOLEAN Retrying);
737
738 //
739 // AFSFileInfo.cpp Prototypes
740 //
741
742 NTSTATUS
743 AFSQueryFileInfo( IN PDEVICE_OBJECT DeviceObject,
744                   IN PIRP Irp);
745
746 NTSTATUS
747 AFSQueryBasicInfo( IN PIRP Irp,
748                    IN AFSDirectoryCB *DirectoryCB,
749                    IN OUT PFILE_BASIC_INFORMATION Buffer,
750                    IN OUT PLONG Length);
751
752 NTSTATUS
753 AFSQueryStandardInfo( IN PIRP Irp,
754                       IN AFSDirectoryCB *DirectoryCB,
755                       IN OUT PFILE_STANDARD_INFORMATION Buffer,
756                       IN OUT PLONG Length);
757
758 NTSTATUS
759 AFSQueryInternalInfo( IN PIRP Irp,
760                       IN AFSFcb *Fcb,
761                       IN OUT PFILE_INTERNAL_INFORMATION Buffer,
762                       IN OUT PLONG Length);
763
764 NTSTATUS
765 AFSQueryEaInfo( IN PIRP Irp,
766                 IN AFSDirectoryCB *DirectoryCB,
767                 IN OUT PFILE_EA_INFORMATION Buffer,
768                 IN OUT PLONG Length);
769
770 NTSTATUS
771 AFSQueryPositionInfo( IN PIRP Irp,
772                       IN AFSFcb *Fcb,
773                       IN OUT PFILE_POSITION_INFORMATION Buffer,
774                       IN OUT PLONG Length);
775
776 NTSTATUS
777 AFSQueryNameInfo( IN PIRP Irp,
778                   IN AFSDirectoryCB *DirectoryCB,
779                   IN OUT PFILE_NAME_INFORMATION Buffer,
780                   IN OUT PLONG Length);
781
782 NTSTATUS
783 AFSQueryShortNameInfo( IN PIRP Irp,
784                        IN AFSDirectoryCB *DirectoryCB,
785                        IN OUT PFILE_NAME_INFORMATION Buffer,
786                        IN OUT PLONG Length);
787
788 NTSTATUS
789 AFSQueryNetworkInfo( IN PIRP Irp,
790                      IN AFSDirectoryCB *DirectoryCB,
791                      IN OUT PFILE_NETWORK_OPEN_INFORMATION Buffer,
792                      IN OUT PLONG Length);
793
794 NTSTATUS
795 AFSQueryStreamInfo( IN PIRP Irp,
796                     IN AFSDirectoryCB *DirectoryCB,
797                     IN OUT FILE_STREAM_INFORMATION *Buffer,
798                     IN OUT PLONG Length);
799
800 NTSTATUS
801 AFSQueryAttribTagInfo( IN PIRP Irp,
802                        IN AFSDirectoryCB *DirectoryCB,
803                        IN OUT FILE_ATTRIBUTE_TAG_INFORMATION *Buffer,
804                        IN OUT PLONG Length);
805
806 NTSTATUS
807 AFSQueryRemoteProtocolInfo( IN PIRP Irp,
808                             IN AFSDirectoryCB *DirectoryCB,
809                             IN OUT FILE_REMOTE_PROTOCOL_INFORMATION *Buffer,
810                             IN OUT PLONG Length);
811
812 NTSTATUS
813 AFSQueryPhysicalNameInfo( IN PIRP Irp,
814                           IN AFSDirectoryCB *DirectoryCB,
815                           IN OUT PFILE_NETWORK_PHYSICAL_NAME_INFORMATION Buffer,
816                           IN OUT PLONG Length);
817
818 NTSTATUS
819 AFSSetFileInfo( IN PDEVICE_OBJECT DeviceObject,
820                 IN PIRP Irp);
821
822 NTSTATUS
823 AFSSetBasicInfo( IN PIRP Irp,
824                  IN AFSDirectoryCB *DirectoryCB,
825                  OUT BOOLEAN *bUpdateFileInfo);
826
827 NTSTATUS
828 AFSSetDispositionInfo( IN PIRP Irp,
829                        IN AFSDirectoryCB *DirectoryCB);
830
831 NTSTATUS
832 AFSSetRenameInfo( IN PIRP Irp);
833
834 NTSTATUS
835 AFSSetFileLinkInfo( IN PIRP Irp);
836
837 NTSTATUS
838 AFSSetPositionInfo( IN PIRP Irp,
839                     IN AFSDirectoryCB *DirectoryCB);
840
841 NTSTATUS
842 AFSSetAllocationInfo( IN PIRP Irp,
843                       IN AFSDirectoryCB *DirectoryCB);
844
845 NTSTATUS
846 AFSSetEndOfFileInfo( IN PIRP Irp,
847                      IN AFSDirectoryCB *DirectoryCB);
848
849 NTSTATUS
850 AFSProcessShareSetInfo( IN IRP *Irp,
851                         IN AFSFcb *Fcb,
852                         IN AFSCcb *Ccb);
853
854 NTSTATUS
855 AFSProcessShareQueryInfo( IN IRP *Irp,
856                           IN AFSFcb *Fcb,
857                           IN AFSCcb *Ccb);
858
859 NTSTATUS
860 AFSProcessPIOCtlQueryInfo( IN IRP *Irp,
861                            IN AFSFcb *Fcb,
862                            IN AFSCcb *Ccb,
863                            IN OUT LONG *Length);
864
865 //
866 // AFSEa.cpp Prototypes
867 //
868
869 NTSTATUS
870 AFSQueryEA( IN PDEVICE_OBJECT DeviceObject,
871             IN PIRP Irp);
872
873 NTSTATUS
874 AFSSetEA( IN PDEVICE_OBJECT DeviceObject,
875           IN PIRP Irp);
876
877 //
878 // AFSFlushBuffers.cpp Prototypes
879 //
880
881 NTSTATUS
882 AFSFlushBuffers( IN PDEVICE_OBJECT DeviceObject,
883                  IN PIRP Irp);
884
885 //
886 // AFSVolume.cpp Prototypes
887 //
888
889 NTSTATUS
890 AFSInitVolume( IN GUID *AuthGroup,
891                IN AFSFileID *RootFid,
892                IN LONG VolumeReferenceReason,
893                OUT AFSVolumeCB **VolumeCB);
894
895 NTSTATUS
896 AFSRemoveVolume( IN AFSVolumeCB *VolumeCB);
897
898 LONG
899 AFSVolumeIncrement( IN AFSVolumeCB *VolumeCB,
900                     IN LONG         Reason);
901
902 LONG
903 AFSVolumeDecrement( IN AFSVolumeCB *VolumeCB,
904                     IN LONG         Reason);
905
906 //
907 // AFSVolumeInfo.cpp Prototypes
908 //
909
910 NTSTATUS
911 AFSQueryVolumeInfo( IN PDEVICE_OBJECT DeviceObject,
912                     IN PIRP Irp);
913
914 NTSTATUS
915 AFSSetVolumeInfo( IN PDEVICE_OBJECT DeviceObject,
916                   IN PIRP Irp);
917
918 NTSTATUS
919 AFSQueryFsVolumeInfo( IN AFSVolumeInfoCB *VolumeInfo,
920                       IN PFILE_FS_VOLUME_INFORMATION Buffer,
921                       IN BOOLEAN bDosDevice,
922                       IN OUT PULONG Length);
923
924 NTSTATUS
925 AFSQueryFsSizeInfo( IN AFSVolumeInfoCB *VolumeInfo,
926                     IN PFILE_FS_SIZE_INFORMATION Buffer,
927                     IN OUT PULONG Length);
928
929 NTSTATUS
930 AFSQueryFsDeviceInfo( IN AFSVolumeInfoCB *VolumeInfo,
931                       IN PFILE_FS_DEVICE_INFORMATION Buffer,
932                       IN OUT PULONG Length);
933
934 NTSTATUS
935 AFSQueryFsAttributeInfo( IN AFSVolumeInfoCB *VolumeInfo,
936                          IN PFILE_FS_ATTRIBUTE_INFORMATION Buffer,
937                          IN OUT PULONG Length);
938
939 NTSTATUS
940 AFSQueryFsFullSizeInfo( IN AFSVolumeInfoCB *VolumeInfo,
941                         IN PFILE_FS_FULL_SIZE_INFORMATION Buffer,
942                         IN OUT PULONG Length);
943
944 //
945 // AFSDirControl.cpp Prototypes
946 //
947
948 NTSTATUS
949 AFSDirControl( IN PDEVICE_OBJECT DeviceObject,
950                IN PIRP Irp);
951
952 NTSTATUS
953 AFSQueryDirectory( IN PIRP Irp);
954
955 NTSTATUS
956 AFSNotifyChangeDirectory( IN PIRP Irp);
957
958 AFSDirectoryCB *
959 AFSLocateNextDirEntry( IN AFSObjectInfoCB *ObjectInfo,
960                        IN AFSCcb *Ccb);
961
962 AFSDirectoryCB *
963 AFSLocateDirEntryByIndex( IN AFSObjectInfoCB *ObjectInfo,
964                           IN AFSCcb *Ccb,
965                           IN ULONG DirIndex);
966
967 NTSTATUS
968 AFSSnapshotDirectory( IN AFSFcb *Fcb,
969                       IN AFSCcb *Ccb,
970                       IN BOOLEAN ResetIndex);
971
972 NTSTATUS
973 AFSFsRtlNotifyFullChangeDirectory( IN AFSObjectInfoCB *ObjectInfo,
974                                    IN AFSCcb *Context,
975                                    IN BOOLEAN WatchTree,
976                                    IN ULONG CompletionFilter,
977                                    IN PIRP NotifyIrp);
978
979 void
980 AFSFsRtlNotifyFullReportChange( IN AFSObjectInfoCB *ObjectInfo,
981                                 IN AFSCcb *Ccb,
982                                 IN ULONG NotifyFilter,
983                                 IN ULONG NotificationAction);
984
985 BOOLEAN
986 AFSNotifyReportChangeCallback( IN void *NotifyContext,
987                                IN void *FilterContext);
988
989 BOOLEAN
990 AFSIsNameInSnapshot( IN AFSSnapshotHdr *SnapshotHdr,
991                      IN ULONG HashIndex);
992
993 NTSTATUS
994 AFSProcessDirectoryQueryDirect( IN AFSFcb *Fcb,
995                                 IN AFSCcb *Ccb,
996                                 IN IRP *Irp);
997
998 //
999 // AFSFSControl.cpp Prototypes
1000 //
1001
1002 NTSTATUS
1003 AFSFSControl( IN PDEVICE_OBJECT DeviceObject,
1004               IN PIRP Irp);
1005
1006 NTSTATUS
1007 AFSProcessUserFsRequest( IN PIRP Irp);
1008
1009 NTSTATUS
1010 AFSProcessShareFsCtrl( IN IRP *Irp,
1011                        IN AFSFcb *Fcb,
1012                        IN AFSCcb *Ccb);
1013
1014 //
1015 // AFSDevControl.cpp Prototypes
1016 //
1017
1018 NTSTATUS
1019 AFSDevControl( IN PDEVICE_OBJECT DeviceObject,
1020                IN PIRP Irp);
1021
1022 //
1023 // AFSInternalDevControl.cpp Prototypes
1024 //
1025
1026 NTSTATUS
1027 AFSInternalDevControl( IN PDEVICE_OBJECT DeviceObject,
1028                        IN PIRP Irp);
1029
1030 //
1031 // AFSShutdown.cpp Prototypes
1032 //
1033
1034 NTSTATUS
1035 AFSShutdown( IN PDEVICE_OBJECT DeviceObject,
1036              IN PIRP Irp);
1037
1038
1039 NTSTATUS
1040 AFSShutdownFilesystem( void);
1041
1042 //
1043 // AFSLockControl.cpp Prototypes
1044 //
1045
1046 NTSTATUS
1047 AFSLockControl( IN PDEVICE_OBJECT DeviceObject,
1048                 IN PIRP Irp);
1049
1050 //
1051 // AFSCleanup.cpp Prototypes
1052 //
1053
1054 NTSTATUS
1055 AFSCleanup( IN PDEVICE_OBJECT DeviceObject,
1056             IN PIRP Irp);
1057
1058 //
1059 // AFSSecurity.cpp Prototypes
1060 //
1061
1062 NTSTATUS
1063 AFSQuerySecurity( IN PDEVICE_OBJECT DeviceObject,
1064                   IN PIRP Irp);
1065
1066 NTSTATUS
1067 AFSSetSecurity( IN PDEVICE_OBJECT DeviceObject,
1068                 IN PIRP Irp);
1069
1070 //
1071 // AFSSystemControl.cpp Prototypes
1072 //
1073
1074 NTSTATUS
1075 AFSSystemControl( IN PDEVICE_OBJECT DeviceObject,
1076                   IN PIRP Irp);
1077
1078 //
1079 // AFSQuota.cpp Prototypes
1080 //
1081
1082 NTSTATUS
1083 AFSQueryQuota( IN PDEVICE_OBJECT DeviceObject,
1084                IN PIRP Irp);
1085
1086 NTSTATUS
1087 AFSSetQuota( IN PDEVICE_OBJECT DeviceObject,
1088              IN PIRP Irp);
1089
1090 //
1091 // AFSGeneric.cpp Prototypes
1092 //
1093
1094 ULONG
1095 AFSExceptionFilter( IN CHAR *FunctionString,
1096                     IN ULONG Code,
1097                     IN PEXCEPTION_POINTERS ExceptPtrs);
1098
1099 BOOLEAN
1100 AFSAcquireExcl( IN PERESOURCE Resource,
1101                 IN BOOLEAN wait);
1102
1103 BOOLEAN
1104 AFSAcquireSharedStarveExclusive( IN PERESOURCE Resource,
1105                                  IN BOOLEAN Wait);
1106
1107 BOOLEAN
1108 AFSAcquireShared( IN PERESOURCE Resource,
1109                   IN BOOLEAN wait);
1110
1111 void
1112 AFSReleaseResource( IN PERESOURCE Resource);
1113
1114 void
1115 AFSConvertToShared( IN PERESOURCE Resource);
1116
1117 void
1118 AFSCompleteRequest( IN PIRP Irp,
1119                     IN ULONG Status);
1120
1121 ULONG
1122 AFSGenerateCRC( IN PUNICODE_STRING FileName,
1123                 IN BOOLEAN UpperCaseName);
1124
1125 void *
1126 AFSLockSystemBuffer( IN PIRP Irp,
1127                      IN ULONG Length);
1128
1129 void *
1130 AFSLockUserBuffer( IN void *UserBuffer,
1131                    IN ULONG BufferLength,
1132                    OUT MDL ** Mdl);
1133
1134 void *
1135 AFSMapToService( IN PIRP Irp,
1136                  IN ULONG ByteCount);
1137
1138 NTSTATUS
1139 AFSUnmapServiceMappedBuffer( IN void *MappedBuffer,
1140                              IN PMDL Mdl);
1141
1142 NTSTATUS
1143 AFSInitializeLibraryDevice( void);
1144
1145 NTSTATUS
1146 AFSRemoveLibraryDevice( void);
1147
1148 NTSTATUS
1149 AFSDefaultDispatch( IN PDEVICE_OBJECT DeviceObject,
1150                     IN PIRP Irp);
1151
1152 NTSTATUS
1153 AFSInitializeGlobalDirectoryEntries( void);
1154
1155 AFSDirectoryCB *
1156 AFSInitDirEntry( IN AFSObjectInfoCB *ParentObjectInfo,
1157                  IN PUNICODE_STRING FileName,
1158                  IN PUNICODE_STRING TargetName,
1159                  IN AFSDirEnumEntry *DirEnumEntry,
1160                  IN ULONG FileIndex);
1161
1162 BOOLEAN
1163 AFSCheckForReadOnlyAccess( IN ACCESS_MASK DesiredAccess,
1164                            IN BOOLEAN DirectoryEntry);
1165
1166 NTSTATUS
1167 AFSEvaluateNode( IN GUID *AuthGroup,
1168                  IN AFSDirectoryCB *DirEntry);
1169
1170 NTSTATUS
1171 AFSValidateSymLink( IN GUID *AuthGroup,
1172                     IN AFSDirectoryCB *DirEntry);
1173
1174 NTSTATUS
1175 AFSInvalidateCache( IN AFSInvalidateCacheCB *InvalidateCB);
1176
1177 NTSTATUS
1178 AFSInvalidateObject( IN OUT AFSObjectInfoCB **ppObjectInfo,
1179                      IN     ULONG Reason);
1180
1181 BOOLEAN
1182 AFSIsChildOfParent( IN AFSFcb *Dcb,
1183                     IN AFSFcb *Fcb);
1184
1185 inline
1186 ULONGLONG
1187 AFSCreateHighIndex( IN AFSFileID *FileID);
1188
1189 inline
1190 ULONGLONG
1191 AFSCreateLowIndex( IN AFSFileID *FileID);
1192
1193 BOOLEAN
1194 AFSCheckAccess( IN ACCESS_MASK DesiredAccess,
1195                 IN ACCESS_MASK GrantedAccess,
1196                 IN BOOLEAN DirectoryEntry);
1197
1198 NTSTATUS
1199 AFSGetDriverStatus( IN AFSDriverStatusRespCB *DriverStatus);
1200
1201 NTSTATUS
1202 AFSSubstituteSysName( IN UNICODE_STRING *ComponentName,
1203                       IN UNICODE_STRING *SubstituteName,
1204                       IN ULONG StringIndex);
1205
1206 NTSTATUS
1207 AFSSubstituteNameInPath( IN OUT UNICODE_STRING *FullPathName,
1208                          IN OUT UNICODE_STRING *ComponentName,
1209                          IN UNICODE_STRING *SubstituteName,
1210                          IN OUT UNICODE_STRING *RemainingPath,
1211                          IN BOOLEAN FreePathName);
1212
1213 NTSTATUS
1214 AFSInvalidateVolume( IN AFSVolumeCB *VolumeCB,
1215                      IN ULONG Reason);
1216
1217 VOID
1218 AFSInvalidateAllVolumes( VOID);
1219
1220 NTSTATUS
1221 AFSVerifyEntry( IN GUID *AuthGroup,
1222                 IN AFSDirectoryCB *DirectoryCB,
1223                 IN BOOLEAN bFollowMountPoint);
1224
1225 NTSTATUS
1226 AFSSetVolumeState( IN AFSVolumeStatusCB *VolumeStatus);
1227
1228 NTSTATUS
1229 AFSSetNetworkState( IN AFSNetworkStatusCB *NetworkStatus);
1230
1231 NTSTATUS
1232 AFSValidateDirectoryCache( IN AFSObjectInfoCB *ObjectInfo,
1233                            IN GUID *AuthGroup);
1234
1235 BOOLEAN
1236 AFSIsVolumeFID( IN AFSFileID *FileID);
1237
1238 BOOLEAN
1239 AFSIsFinalNode( IN AFSFcb *Fcb);
1240
1241 NTSTATUS
1242 AFSUpdateMetaData( IN AFSDirectoryCB *DirEntry,
1243                    IN AFSDirEnumEntry *DirEnumEntry);
1244
1245 NTSTATUS
1246 AFSValidateEntry( IN AFSDirectoryCB *DirEntry,
1247                   IN GUID *AuthGroup,
1248                   IN BOOLEAN FastCall,
1249                   IN BOOLEAN SafeToPurge);
1250
1251 AFSDirectoryCB *
1252 AFSGetSpecialShareNameEntry( IN UNICODE_STRING *ShareName,
1253                              IN UNICODE_STRING *SecondaryName);
1254
1255 NTSTATUS
1256 AFSInitializeSpecialShareNameList( void);
1257
1258 void
1259 AFSWaitOnQueuedFlushes( IN AFSFcb *Fcb);
1260
1261 void
1262 AFSWaitOnQueuedReleases( void);
1263
1264 BOOLEAN
1265 AFSIsEqualFID( IN AFSFileID *FileId1,
1266                IN AFSFileID *FileId2);
1267
1268 NTSTATUS
1269 AFSResetDirectoryContent( IN AFSObjectInfoCB *ObjectInfoCB);
1270
1271 NTSTATUS
1272 AFSEnumerateGlobalRoot( IN GUID *AuthGroup);
1273
1274 BOOLEAN
1275 AFSIsRelativeName( IN UNICODE_STRING *Name);
1276
1277 BOOLEAN
1278 AFSIsAbsoluteAFSName( IN UNICODE_STRING *Name);
1279
1280 void
1281 AFSUpdateName( IN UNICODE_STRING *Name);
1282
1283 NTSTATUS
1284 AFSUpdateTargetName( IN OUT UNICODE_STRING *TargetName,
1285                      IN OUT ULONG *Flags,
1286                      IN WCHAR *NameBuffer,
1287                      IN USHORT NameLength);
1288
1289 void
1290 AFSSetEnumerationEvent( IN AFSFcb *Fcb);
1291
1292 void
1293 AFSClearEnumerationEvent( IN AFSFcb *Fcb);
1294
1295 BOOLEAN
1296 AFSIsEnumerationInProcess( IN AFSObjectInfoCB *ObjectInfo);
1297
1298 NTSTATUS
1299 AFSVerifyVolume( IN ULONGLONG ProcessId,
1300                  IN AFSVolumeCB *VolumeCB);
1301
1302 NTSTATUS
1303 AFSInitPIOCtlDirectoryCB( IN AFSObjectInfoCB *ObjectInfo);
1304
1305 NTSTATUS
1306 AFSRetrieveFileAttributes( IN AFSDirectoryCB *ParentDirectoryCB,
1307                            IN AFSDirectoryCB *DirectoryCB,
1308                            IN UNICODE_STRING *ParentPathName,
1309                            IN AFSNameArrayHdr *RelatedNameArray,
1310                            IN GUID           *AuthGroup,
1311                            OUT AFSFileInfoCB *FileInfo);
1312
1313 AFSObjectInfoCB *
1314 AFSAllocateObjectInfo( IN AFSObjectInfoCB *ParentObjectInfo,
1315                        IN ULONGLONG HashIndex);
1316
1317 LONG
1318 AFSObjectInfoIncrement( IN AFSObjectInfoCB *ObjectInfo,
1319                         IN LONG             Reason);
1320
1321 LONG
1322 AFSObjectInfoDecrement( IN AFSObjectInfoCB *ObjectInfo,
1323                         IN LONG             Reason);
1324
1325 void
1326 AFSDeleteObjectInfo( IN AFSObjectInfoCB **ppObjectInfo);
1327
1328 AFSObjectInfoCB *
1329 AFSFindObjectInfo( IN AFSVolumeCB * VolumeCB,
1330                    IN AFSFileID   * FileID,
1331                    IN BOOLEAN       bUpdateLastUse);
1332
1333 void
1334 AFSReleaseObjectInfo( IN OUT AFSObjectInfoCB **ppObjectInfo);
1335
1336 NTSTATUS
1337 AFSEvaluateRootEntry( IN AFSDirectoryCB *DirectoryCB,
1338                       OUT AFSDirectoryCB **TargetDirEntry);
1339
1340 NTSTATUS
1341 AFSCleanupFcb( IN AFSFcb *Fcb,
1342                IN BOOLEAN ForceFlush);
1343
1344 NTSTATUS
1345 AFSUpdateDirEntryName( IN AFSDirectoryCB *DirectoryCB,
1346                        IN UNICODE_STRING *NewFileName);
1347
1348 NTSTATUS
1349 AFSReadCacheFile( IN void *ReadBuffer,
1350                   IN LARGE_INTEGER *ReadOffset,
1351                   IN ULONG RequestedDataLength,
1352                   IN OUT PULONG BytesRead);
1353
1354 NTSTATUS
1355 AFSIrpComplete( IN PDEVICE_OBJECT DeviceObject,
1356                 IN PIRP           Irp,
1357                 IN PVOID          Context);
1358
1359 BOOLEAN
1360 AFSIsDirectoryEmptyForDelete( IN AFSFcb *Fcb);
1361
1362 void
1363 AFSRemoveNameEntry( IN AFSObjectInfoCB *ParentObjectInfo,
1364                     IN AFSDirectoryCB *DirEntry);
1365
1366 LARGE_INTEGER
1367 AFSGetAuthenticationId( void);
1368
1369 void
1370 AFSUnwindFileInfo( IN AFSFcb *Fcb,
1371                    IN AFSCcb *Ccb);
1372
1373 BOOLEAN
1374 AFSValidateDirList( IN AFSObjectInfoCB *ObjectInfo);
1375
1376 PFILE_OBJECT
1377 AFSReferenceCacheFileObject( void);
1378
1379 void
1380 AFSReleaseCacheFileObject( IN PFILE_OBJECT CacheFileObject);
1381
1382 NTSTATUS
1383 AFSInitializeLibrary( IN AFSLibraryInitCB *LibraryInit);
1384
1385 NTSTATUS
1386 AFSCloseLibrary( void);
1387
1388 NTSTATUS
1389 AFSDefaultLogMsg( IN ULONG Subsystem,
1390                   IN ULONG Level,
1391                   IN PCCH Format,
1392                   ...);
1393
1394 NTSTATUS
1395 AFSGetObjectStatus( IN AFSGetStatusInfoCB *GetStatusInfo,
1396                     IN ULONG InputBufferLength,
1397                     IN AFSStatusInfoCB *StatusInfo,
1398                     OUT ULONG *ReturnLength);
1399
1400 NTSTATUS
1401 AFSCheckSymlinkAccess( IN AFSDirectoryCB *ParentDirectoryCB,
1402                        IN UNICODE_STRING *ComponentName);
1403
1404 NTSTATUS
1405 AFSRetrieveFinalComponent( IN UNICODE_STRING *FullPathName,
1406                            OUT UNICODE_STRING *ComponentName);
1407
1408 void
1409 AFSDumpTraceFiles_Default( void);
1410
1411 void *
1412 AFSLibExAllocatePoolWithTag( IN POOL_TYPE  PoolType,
1413                              IN SIZE_T  NumberOfBytes,
1414                              IN ULONG  Tag);
1415
1416 #define AFSLibExFreePool(x)          ExFreePool(x)
1417
1418 #define AFSLibExFreePoolWithTag(x,y) ExFreePoolWithTag(x,y)
1419
1420 BOOLEAN
1421 AFSValidNameFormat( IN UNICODE_STRING *FileName);
1422
1423 NTSTATUS
1424 AFSCreateDefaultSecurityDescriptor( void);
1425
1426 void
1427 AFSRetrieveParentPath( IN UNICODE_STRING *FullFileName,
1428                        OUT UNICODE_STRING *ParentPath);
1429
1430 NTSTATUS
1431 AFSRetrieveValidAuthGroup( IN AFSFcb *Fcb,
1432                            IN AFSObjectInfoCB *ObjectInfo,
1433                            IN BOOLEAN WriteAccess,
1434                            OUT GUID *AuthGroup);
1435
1436 NTSTATUS
1437 AFSPerformObjectInvalidate( IN AFSObjectInfoCB *ObjectInfo,
1438                             IN ULONG InvalidateReason);
1439
1440 BOOLEAN
1441 AFSIgnoreReparsePointToFile( void);
1442
1443 NTSTATUS
1444 AFSRetrieveTargetFileInfo( IN PUNICODE_STRING TargetName,
1445                            OUT AFSFileInfoCB *FileInfo);
1446
1447 //
1448 // AFSNameArray.cpp Prototypes
1449 //
1450
1451 AFSNameArrayHdr *
1452 AFSInitNameArray( IN AFSDirectoryCB *DirectoryCB,
1453                   IN ULONG InitialElementCount);
1454
1455 NTSTATUS
1456 AFSPopulateNameArray( IN AFSNameArrayHdr *NameArray,
1457                       IN UNICODE_STRING *Path,
1458                       IN AFSDirectoryCB *DirectoryCB);
1459
1460 NTSTATUS
1461 AFSPopulateNameArrayFromRelatedArray( IN AFSNameArrayHdr *NameArray,
1462                                       IN AFSNameArrayHdr *RelatedNameArray,
1463                                       IN AFSDirectoryCB *DirectoryCB);
1464
1465 NTSTATUS
1466 AFSFreeNameArray( IN AFSNameArrayHdr *NameArray);
1467
1468 NTSTATUS
1469 AFSInsertNextElement( IN AFSNameArrayHdr *NameArray,
1470                       IN AFSDirectoryCB *DirEntry);
1471
1472 AFSDirectoryCB *
1473 AFSBackupEntry( IN AFSNameArrayHdr *NameArray);
1474
1475 AFSDirectoryCB *
1476 AFSGetParentEntry( IN AFSNameArrayHdr *NameArray);
1477
1478 void
1479 AFSResetNameArray( IN AFSNameArrayHdr *NameArray,
1480                    IN AFSDirectoryCB *DirEntry);
1481
1482 void
1483 AFSDumpNameArray( IN IN AFSNameArrayHdr *NameArray);
1484
1485 //
1486 // AFSWorker.cpp Prototypes
1487 //
1488
1489 NTSTATUS
1490 AFSInitializeWorkerPool( void);
1491
1492 NTSTATUS
1493 AFSRemoveWorkerPool( void);
1494
1495 NTSTATUS
1496 AFSInitWorkerThread( IN AFSWorkQueueContext *PoolContext,
1497                      IN PKSTART_ROUTINE WorkerRoutine);
1498
1499 NTSTATUS
1500 AFSInitVolumeWorker( IN AFSVolumeCB *VolumeCB);
1501
1502 NTSTATUS
1503 AFSShutdownWorkerThread( IN AFSWorkQueueContext *PoolContext);
1504
1505 NTSTATUS
1506 AFSShutdownIOWorkerThread( IN AFSWorkQueueContext *PoolContext);
1507
1508 NTSTATUS
1509 AFSShutdownVolumeWorker( IN AFSVolumeCB *VolumeCB);
1510
1511 void
1512 AFSWorkerThread( IN PVOID Context);
1513
1514 void
1515 AFSIOWorkerThread( IN PVOID Context);
1516
1517 void
1518 AFSPrimaryVolumeWorkerThread( IN PVOID Context);
1519
1520 NTSTATUS
1521 AFSInsertWorkitem( IN AFSWorkItem *WorkItem);
1522
1523 NTSTATUS
1524 AFSInsertIOWorkitem( IN AFSWorkItem *WorkItem);
1525
1526 NTSTATUS
1527 AFSInsertWorkitemAtHead( IN AFSWorkItem *WorkItem);
1528
1529 AFSWorkItem *
1530 AFSRemoveWorkItem( void);
1531
1532 AFSWorkItem *
1533 AFSRemoveIOWorkItem( void);
1534
1535 NTSTATUS
1536 AFSQueueWorkerRequest( IN AFSWorkItem *WorkItem);
1537
1538 NTSTATUS
1539 AFSQueueIOWorkerRequest( IN AFSWorkItem *WorkItem);
1540
1541 NTSTATUS
1542 AFSQueueWorkerRequestAtHead( IN AFSWorkItem *WorkItem);
1543
1544 NTSTATUS
1545 AFSShutdownVolumeWorker( IN AFSVolumeCB *VolumeCB);
1546
1547 NTSTATUS
1548 AFSQueueFlushExtents( IN AFSFcb *Fcb,
1549                       IN GUID *AuthGroup);
1550
1551 NTSTATUS
1552 AFSQueueGlobalRootEnumeration( void);
1553
1554 NTSTATUS
1555 AFSQueuePurgeObject( IN AFSFcb *Fcb);
1556
1557 NTSTATUS
1558 AFSQueueStartIos( IN PFILE_OBJECT CacheFileObject,
1559                   IN UCHAR FunctionCode,
1560                   IN ULONG RequestFLags,
1561                   IN AFSIoRun *IoRuns,
1562                   IN ULONG RunCount,
1563                   IN AFSGatherIo *GatherIo);
1564
1565 NTSTATUS
1566 AFSQueueInvalidateObject( IN AFSObjectInfoCB *ObjectInfo,
1567                           IN ULONG InvalidateReason);
1568
1569 //
1570 // AFSMD5Support.cpp Prototypes
1571 //
1572
1573 void
1574 AFSGenerateMD5( IN char *DataBuffer,
1575                 IN ULONG Length,
1576                 OUT UCHAR *MD5Digest);
1577
1578 };
1579
1580 #endif /* _AFS_COMMON_H */