Windows: AFSFileOpenResultCB.Authenticated
[openafs.git] / src / WINNT / afsrdr / common / AFSUserStructs.h
1 /*
2  * Copyright (c) 2008-2011 Kernel Drivers, LLC.
3  * Copyright (c) 2009-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 name of Kernel Drivers, LLC nor the names of its
18  *   contributors may be
19  *   used to endorse or promote products derived from this software without
20  *   specific prior written permission from Kernel Drivers, LLC
21  *   and Your File System, Inc.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
26  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
27  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35
36 #ifndef _AFS_USER_STRUCT_H
37 #define _AFS_USER_STRUCT_H
38
39 typedef struct _AFS_FILE_ID
40 {
41
42     ULONG    Hash;
43
44     ULONG    Cell;
45
46     ULONG    Volume;
47
48     ULONG    Vnode;
49
50     ULONG    Unique;
51
52 } AFSFileID;
53
54 //
55 // This control structure is the request block passed to the filter. The filter will populate the structure
56 // when it requires a request to be handled by the service.
57 //
58
59 typedef struct _AFS_COMM_REQUEST_BLOCK
60 {
61
62     AFSFileID       FileId;             /* Initialize unused elements to 0 */
63
64     ULONG           RequestType;
65
66     ULONG           RequestIndex;    /* Must return to caller */
67
68     ULONG           RequestFlags;    /* AFS_REQUEST_FLAG_xxxx */
69
70     ULONG           NameLength;      // Length of the name in bytes
71
72     ULONG           DataOffset;       // This offset is from the end of the structure, including the name
73
74     ULONG           DataLength;
75
76     GUID            AuthGroup;      // Length: sizeof(GUID) */
77
78     ULONG           ResultBufferLength;    /* Do not exceed this length in response */
79
80     LONG            QueueCount;     // Current outstanding requests in the queue
81
82     WCHAR           Name[ 1];
83
84 } AFSCommRequest;
85
86
87 //
88 // This is the result block passed back to the redirector after a request has been handled
89 //
90
91 typedef struct _AFS_COMM_RESULT_BLOCK
92 {
93
94     ULONG           RequestIndex;        /* Must match the AFSCommRequest value */
95
96     ULONG           ResultStatus;        /* NTSTATUS_xxx */
97
98     ULONG           ResultBufferLength;    /* Not to exceed AFSCommRequest ResultBufferLength */
99
100     ULONG           Reserved;           /* To ease Quad Alignment */
101
102     char            ResultData[ 1];
103
104 } AFSCommResult;
105
106 //
107 // Control block passed to IOCTL_AFS_INITIALIZE_REDIRECTOR_DEVICE
108 //
109
110 #define AFS_REDIR_INIT_FLAG_HIDE_DOT_FILES          0x00000001
111 #define AFS_REDIR_INIT_NO_PAGING_FILE               0x00000002
112 #define AFS_REDIR_INIT_FLAG_DISABLE_SHORTNAMES      0x00000004
113
114 typedef struct _AFS_REDIR_INIT_INFO_CB
115 {
116
117     ULONG       Flags;
118
119     ULONG       MaximumChunkLength;     // Maximum RPC length issued so we should limit
120                                         // requests for data to this length
121
122     AFSFileID   GlobalFileId;           // AFS FID of the Global root.afs volume
123
124     LARGE_INTEGER  ExtentCount;         // Number of extents in the current data cache
125
126     ULONG       CacheBlockSize;         // Size, in bytes, of the current cache block
127
128     ULONG       MaxPathLinkCount;       // Number of symlinks / mountpoints that may
129                                         // be cross during the evaluation of any path
130
131     ULONG       NameArrayLength;        // Number of components that should be allocated
132                                         // in each name array chunk.  Name arrays are
133                                         // dynamic and will be increased in size as
134                                         // needed by this amount
135
136     LARGE_INTEGER MemoryCacheOffset;    // The offset in the afsd_service process memory
137                                         // space at which the extents are allocated
138     LARGE_INTEGER MemoryCacheLength;    // and the length of the allocated region
139
140     ULONG       DumpFileLocationOffset; // Offset from the beginning of this structure to
141                                         // the start of the directory where dump files
142                                         // are to be stored. The path must be fully
143                                         // qualified such as C:\Windows\Temp
144
145     ULONG       DumpFileLocationLength; // Length, in bytes, of the DumpFileLocation path
146
147     ULONG       CacheFileNameLength;    // size, in bytes, of the cache file name
148
149     WCHAR       CacheFileName[ 1];      // Fully qualified cache file name in the form
150                                         // C:\OPenAFSDir\CacheFile.dat
151
152 } AFSRedirectorInitInfo;
153
154 //
155 // Directory query CB
156 //
157
158 typedef struct _AFS_DIR_QUERY_CB
159 {
160
161     ULONG_PTR        EnumHandle;  // If this is 0 then it is a new query,
162                                   // otherwise it is the FileIndex of the last
163                                   // entry processed.
164
165 } AFSDirQueryCB;
166
167 //
168 // Directory enumeration control block
169 // Entries are aligned on a QuadWord boundary
170 //
171
172 typedef struct _AFS_DIR_ENUM_ENTRY
173 {
174
175     AFSFileID       FileId;
176
177     ULONG           FileIndex;          /* Incremented  */
178
179     LARGE_INTEGER   Expiration;         /* FILETIME */
180
181     LARGE_INTEGER   DataVersion;
182
183     ULONG           FileType;           /* File, Dir, MountPoint, Symlink */
184
185     LARGE_INTEGER   CreationTime;       /* FILETIME */
186
187     LARGE_INTEGER   LastAccessTime;     /* FILETIME */
188
189     LARGE_INTEGER   LastWriteTime;      /* FILETIME */
190
191     LARGE_INTEGER   ChangeTime;         /* FILETIME */
192
193     LARGE_INTEGER   EndOfFile;
194
195     LARGE_INTEGER   AllocationSize;
196
197     ULONG           FileAttributes;     /* NTFS FILE_ATTRIBUTE_xxxx see below */
198
199     ULONG           FileNameLength;
200
201     ULONG           EaSize;
202
203     ULONG           Links;
204
205     ULONG           FileNameOffset;     /* From beginning of this structure */
206
207     ULONG           TargetNameOffset;   /* From beginning of this structure */
208
209     ULONG           TargetNameLength;
210
211     AFSFileID       TargetFileId;       /* Target fid for mp's and symlinks */
212
213     CCHAR           ShortNameLength;
214
215     WCHAR           ShortName[12];
216
217     ULONG           NTStatus;           /* Error code during enumeration */
218
219     /* Long Filename and Target (Symlink and MountPoint only) to follow without NULs */
220
221 } AFSDirEnumEntry;
222
223
224 typedef struct _AFS_DIR_ENUM_RESP
225 {
226
227     ULONG_PTR       EnumHandle;
228
229     LARGE_INTEGER   SnapshotDataVersion; /* DV at time Name/FID list was generated */
230
231     LARGE_INTEGER   CurrentDataVersion;   /* DV at time this header was constructed */
232
233     AFSDirEnumEntry Entry[ 1];     /* Each entry is Quad aligned */
234
235 } AFSDirEnumResp;
236
237 //
238 // Volume information CB passed in the create request
239 //
240
241 typedef struct _AFS_VOLUME_INFORMATION
242 {
243
244     LARGE_INTEGER   TotalAllocationUnits;       /* Volume Max Blocks (Partition or Quota) */
245
246     LARGE_INTEGER   AvailableAllocationUnits;   /* Volume Blocks Avail (Partition or Quota) */
247
248     LARGE_INTEGER   VolumeCreationTime;         /* AFS Last Update - Not Creation */
249
250     ULONG           Characteristics;            /* FILE_READ_ONLY_DEVICE (if readonly)
251                                                  * FILE_REMOTE_DEVICE (always)
252                                                  */
253
254     ULONG           FileSystemAttributes;       /* FILE_CASE_PRESERVED_NAMES (always)
255                                                    FILE_UNICODE_ON_DISK      (always) */
256
257     ULONG           SectorsPerAllocationUnit;   /* = 1 */
258
259     ULONG           BytesPerSector;             /* = 1024 */
260
261     ULONG           CellID;                     /* AFS Cell ID */
262
263     ULONG           VolumeID;                   /* AFS Volume ID */
264
265     ULONG           VolumeLabelLength;
266
267     WCHAR           VolumeLabel[128];            /* Volume:Cell */
268
269 } AFSVolumeInfoCB;
270
271
272 //
273 // Volume size information CB passed used to satisfy
274 // FileFsFullSizeInformation and FileFsSizeInformation
275 //
276
277 typedef struct _AFS_VOLUME_SIZE_INFORMATION
278 {
279
280     LARGE_INTEGER   TotalAllocationUnits;       /* Max Blocks (Quota or Partition) */
281
282     LARGE_INTEGER   AvailableAllocationUnits;   /* Blocks Avail (Quota or Partition) */
283
284     ULONG           SectorsPerAllocationUnit;   /* = 1 */
285
286     ULONG           BytesPerSector;             /* = 1024 */
287
288 } AFSVolumeSizeInfoCB;
289
290 //
291 // File create CB
292 //
293
294 typedef struct _AFS_FILE_CREATE_CB
295 {
296
297     AFSFileID       ParentId;
298
299     LARGE_INTEGER   AllocationSize;
300
301     ULONG           FileAttributes;
302
303     ULONG           EaSize;
304
305     char            EaBuffer[ 1];
306
307 } AFSFileCreateCB;
308
309 typedef struct _AFS_FILE_CREATE_RESULT_CB
310 {
311
312     LARGE_INTEGER   ParentDataVersion;
313
314     AFSDirEnumEntry DirEnum;
315
316 } AFSFileCreateResultCB;
317
318 //
319 // File open CB
320 //
321
322 typedef struct _AFS_FILE_OPEN_CB
323 {
324
325     AFSFileID       ParentId;
326
327     ULONG           DesiredAccess;
328
329     ULONG           ShareAccess;
330
331     ULONGLONG       ProcessId;
332
333     ULONGLONG       Identifier;
334
335 } AFSFileOpenCB;
336
337 typedef struct _AFS_FILE_OPEN_RESULT_CB
338 {
339
340     ULONG           GrantedAccess;
341
342     ULONG           FileAccess;
343
344     ULONG           Authenticated;
345
346 } AFSFileOpenResultCB;
347
348 typedef struct _AFS_FILE_ACCESS_RELEASE_CB
349 {
350
351     ULONG           FileAccess;
352
353     ULONGLONG       ProcessId;
354
355     ULONGLONG       Identifier;
356
357 } AFSFileAccessReleaseCB;
358
359 //
360 // IO Interace control blocks for extent processing when performing
361 // queries via the AFS_REQUEST_TYPE_REQUEST_FILE_EXTENTS or synchronous
362 // results from the service
363 //
364
365 typedef struct _AFS_FILE_EXTENT_CB
366 {
367
368     ULONG           Flags;
369
370     ULONG           Length;
371
372     LARGE_INTEGER   FileOffset;
373
374     LARGE_INTEGER   CacheOffset;
375
376     UCHAR           MD5[16];
377
378     ULONG           DirtyOffset;
379
380     ULONG           DirtyLength;
381
382 } AFSFileExtentCB;
383
384 typedef struct _AFS_REQUEST_EXTENTS_CB
385 {
386
387     ULONG           Flags;
388
389     LARGE_INTEGER   ByteOffset;
390
391     ULONG           Length;
392
393 } AFSRequestExtentsCB;
394
395 //
396 // Extent processing when the file system calls the service to
397 // release extents through the AFS_REQUEST_TYPE_RELEASE_FILE_EXTENTS interface
398 //
399
400 typedef struct _AFS_RELEASE_EXTENTS_CB
401 {
402
403     ULONG           Flags;
404
405     ULONG           ExtentCount;
406
407     LARGE_INTEGER   LastAccessTime;
408
409     LARGE_INTEGER   LastWriteTime;
410
411     LARGE_INTEGER   ChangeTime;
412
413     LARGE_INTEGER   CreateTime;
414
415     LARGE_INTEGER   AllocationSize;
416
417     AFSFileExtentCB FileExtents[ 1];
418
419 } AFSReleaseExtentsCB;
420
421 //
422 // This is the control structure used when the service passes the extent
423 // information via the IOCTL_AFS_SET_FILE_EXTENTS interface
424 //
425
426 typedef struct _AFS_SET_FILE_EXTENTS_CB
427 {
428
429     AFSFileID       FileId;
430
431     ULONG           ExtentCount;
432
433     ULONG           ResultStatus;
434
435     AFSFileExtentCB FileExtents[ 1];
436
437 } AFSSetFileExtentsCB;
438
439 //
440 // This is the control structure used when the service passes the extent
441 // information via the IOCTL_AFS_RELEASE_FILE_EXTENTS interface
442 //
443
444 #define AFS_RELEASE_EXTENTS_FLAGS_RELEASE_ALL       0x00000001
445
446 typedef struct _AFS_RELEASE_FILE_EXTENTS_CB
447 {
448
449     ULONG           Flags;
450
451     AFSFileID       FileId;
452
453     ULONG           ExtentCount;
454
455     LARGE_INTEGER   HeldExtentCount;
456
457     AFSFileExtentCB FileExtents[ 1];
458
459 } AFSReleaseFileExtentsCB;
460
461 //
462 // These are the control structures that the filesystem returns from a
463 // IOCTL_AFS_RELEASE_FILE_EXTENTS
464 //
465
466 typedef struct _AFS_RELEASE_FILE_EXTENTS_RESULT_FILE_CB
467 {
468     AFSFileID       FileId;
469
470     ULONG           Flags;
471
472     GUID            AuthGroup; /* Length: sizeof(GUID) */
473
474     ULONG           ExtentCount;
475
476     LARGE_INTEGER   LastAccessTime;
477
478     LARGE_INTEGER   LastWriteTime;
479
480     LARGE_INTEGER   ChangeTime;
481
482     LARGE_INTEGER   CreateTime;
483
484     LARGE_INTEGER   AllocationSize;
485
486     AFSFileExtentCB FileExtents[ 1];
487
488 } AFSReleaseFileExtentsResultFileCB;
489
490 typedef struct _AFS_RELEASE_FILE_EXTENTS_RESULT_CB
491 {
492     ULONG           SerialNumber;
493
494     ULONG           Flags;
495
496     ULONG           FileCount;
497
498     AFSReleaseFileExtentsResultFileCB Files[ 1];
499
500 } AFSReleaseFileExtentsResultCB;
501
502
503 typedef struct _AFS_EXTENT_FAILURE_CB
504 {
505
506     AFSFileID       FileId;
507
508     ULONG           FailureStatus;
509
510     GUID            AuthGroup;      // Length: sizeof(GUID) */
511
512 } AFSExtentFailureCB;
513
514 //
515 // File update CB
516 //
517
518 typedef struct _AFS_FILE_UPDATE_CB
519 {
520
521     AFSFileID       ParentId;
522
523     LARGE_INTEGER   LastAccessTime;
524
525     LARGE_INTEGER   LastWriteTime;
526
527     LARGE_INTEGER   ChangeTime;
528
529     LARGE_INTEGER   CreateTime;
530
531     LARGE_INTEGER   AllocationSize;
532
533     ULONG           FileAttributes;
534
535     ULONG           EaSize;
536
537     char            EaBuffer[ 1];
538
539 } AFSFileUpdateCB;
540
541 //
542 // File update CB result
543 //
544
545 typedef struct _AFS_FILE_UPDATE_RESULT_CB
546 {
547
548     LARGE_INTEGER   ParentDataVersion;
549
550     AFSDirEnumEntry DirEnum;
551
552 } AFSFileUpdateResultCB;
553
554 //
555 // File delete CB
556 //
557
558 typedef struct _AFS_FILE_DELETE_CB
559 {
560
561     AFSFileID       ParentId;        /* Must be directory */
562
563     ULONGLONG       ProcessId;
564
565                                      /* File Name and FileID in Common Request Block */
566
567 } AFSFileDeleteCB;
568
569 typedef struct _AFS_FILE_DELETE_RESULT_CB
570 {
571
572     LARGE_INTEGER   ParentDataVersion;
573
574 } AFSFileDeleteResultCB;
575
576 //
577 // File rename CB
578 //
579
580 typedef struct _AFS_FILE_RENAME_CB
581 {
582
583     AFSFileID       SourceParentId;        /* Must be directory */
584
585     AFSFileID       TargetParentId;        /* Must be directory */
586
587                                            /* Source Name and FileID in Common Request Block */
588
589     USHORT          TargetNameLength;
590
591     WCHAR           TargetName[ 1];
592
593 } AFSFileRenameCB;
594
595 typedef struct _AFS_FILE_RENAME_RESULT_CB
596 {
597
598     LARGE_INTEGER   SourceParentDataVersion;
599
600     LARGE_INTEGER   TargetParentDataVersion;
601
602     AFSDirEnumEntry DirEnum;
603
604 } AFSFileRenameResultCB;
605
606
607 //
608 // File Hard Link CB
609 //
610
611 typedef struct _AFS_FILE_HARDLINK_CB
612 {
613
614     AFSFileID       SourceParentId;        /* Must be directory */
615
616     AFSFileID       TargetParentId;        /* Must be directory */
617
618     BOOLEAN         bReplaceIfExists;
619
620                                            /* Source Name and FileID in Common Request Block */
621
622     USHORT          TargetNameLength;
623
624     WCHAR           TargetName[ 1];
625
626 } AFSFileHardLinkCB;
627
628 typedef struct _AFS_FILE_HARDLINK_RESULT_CB
629 {
630
631     LARGE_INTEGER   SourceParentDataVersion;
632
633     LARGE_INTEGER   TargetParentDataVersion;
634
635     AFSDirEnumEntry DirEnum;
636
637 } AFSFileHardLinkResultCB;
638
639
640 //
641 // Control structures for AFS_REQUEST_TYPE_EVAL_TARGET_BY_ID
642 // and AFS_REQUEST_TYPE_EVAL_TARGET_BY_NAME
643 //
644 // The response to these requests is a AFSDirEnumEntry
645 //
646
647 typedef struct _AFS_FILE_EVAL_TARGET_CB
648 {
649
650     AFSFileID       ParentId;
651
652 } AFSEvalTargetCB;
653
654
655 typedef struct _AFS_FILE_EVAL_RESULT_CB
656 {
657
658     LARGE_INTEGER   ParentDataVersion;
659
660     AFSDirEnumEntry DirEnum;
661
662 } AFSFileEvalResultCB;
663
664
665 //
666 // Control structure for read and write requests through the PIOCtl interface
667 //
668 // CommRequest FileId field contains the active directory
669
670 typedef struct _AFS_PIOCTL_IO_CB
671 {
672     ULONG       RequestId;
673
674     AFSFileID   RootId;
675
676     ULONG       BufferLength;
677
678     void        *MappedBuffer;
679
680 } AFSPIOCtlIORequestCB;
681
682 //
683 // The returned information for the IO Request
684 //
685
686 typedef struct _AFS_PIOCTL_IO_RESULT_CB
687 {
688
689     ULONG       BytesProcessed;
690
691 } AFSPIOCtlIOResultCB;
692
693
694 //
695 // Control structure for open and close requests through the PIOCtl interface
696 //
697 // CommRequest FileId field contains the active directory
698 //
699 // There is no return structure.
700 //
701 typedef struct _AFS_PIOCTL_OPEN_CLOSE_CB
702 {
703
704     ULONG       RequestId;
705
706     AFSFileID   RootId;
707
708 } AFSPIOCtlOpenCloseRequestCB;
709
710 //
711 // Cache invalidation control block
712 //
713
714 typedef struct _AFS_INVALIDATE_CACHE_CB
715 {
716
717     AFSFileID   FileID;
718
719     ULONG       FileType;
720
721     BOOLEAN     WholeVolume;
722
723     ULONG       Reason;
724
725 } AFSInvalidateCacheCB;
726
727 //
728 // Network Status Control Block
729 //
730
731 typedef struct _AFS_NETWORK_STATUS_CB
732 {
733
734     BOOLEAN     Online;
735
736 } AFSNetworkStatusCB;
737
738 //
739 // Volume Status Control Block
740 //
741
742 typedef struct _AFS_VOLUME_STATUS_CB
743 {
744
745     AFSFileID   FileID;         // only cell and volume fields are set
746
747     BOOLEAN     Online;
748
749 } AFSVolumeStatusCB;
750
751
752 typedef struct _AFS_SYSNAME
753 {
754
755     ULONG       Length;         /* bytes */
756
757     WCHAR       String[AFS_MAX_SYSNAME_LENGTH];
758
759 } AFSSysName;
760
761 //
762 // SysName Notification Control Block
763 //   Sent as the buffer with IOCTL_AFS_SYSNAME_NOTIFICATION
764 //   There is no response
765 //
766
767 typedef struct _AFS_SYSNAME_NOTIFICATION_CB
768 {
769
770     ULONG       Architecture;
771
772     ULONG       NumberOfNames;
773
774     AFSSysName  SysNames[1];
775
776 } AFSSysNameNotificationCB;
777
778
779 //
780 // File System Status Query Control Block
781 //   Received as a response to IOCTL_AFS_STATUS_REQUEST
782 //
783 typedef struct _AFS_DRIVER_STATUS_RESPONSE_CB
784 {
785
786     ULONG       Status;         // bit flags - see below
787
788 } AFSDriverStatusRespCB;
789
790 // Bit flags
791 #define AFS_DRIVER_STATUS_READY         0
792 #define AFS_DRIVER_STATUS_NOT_READY     1
793 #define AFS_DRIVER_STATUS_NO_SERVICE    2
794
795 //
796 // Byte Range Lock Request
797 //
798 typedef struct _AFS_BYTE_RANGE_LOCK_REQUEST
799 {
800     ULONG               LockType;
801
802     LARGE_INTEGER       Offset;
803
804     LARGE_INTEGER       Length;
805
806 } AFSByteRangeLockRequest;
807
808 #define AFS_BYTE_RANGE_LOCK_TYPE_SHARED 0
809 #define AFS_BYTE_RANGE_LOCK_TYPE_EXCL   1
810
811
812 //
813 // Byte Range Lock Request Control Block
814 //
815 // Set ProcessId and FileId in the Comm Request Block
816 //
817 typedef struct _AFS_BYTE_RANGE_LOCK_REQUEST_CB
818 {
819
820     ULONG                       Count;
821
822     ULONGLONG                   ProcessId;
823
824     AFSByteRangeLockRequest     Request[1];
825
826 } AFSByteRangeLockRequestCB;
827
828 //
829 // Byte Range Lock Result
830 //
831 typedef struct _AFS_BYTE_RANGE_LOCK_RESULT
832 {
833
834     ULONG               LockType;
835
836     LARGE_INTEGER       Offset;
837
838     LARGE_INTEGER       Length;
839
840     ULONG               Status;
841
842 } AFSByteRangeLockResult;
843
844 //
845 // Byte Range Lock Results Control Block
846 //
847
848 typedef struct _AFS_BYTE_RANGE_LOCK_RESULT_CB
849 {
850
851     AFSFileID                   FileId;
852
853     ULONG                       Count;
854
855     AFSByteRangeLockResult      Result[1];
856
857 } AFSByteRangeLockResultCB;
858
859 //
860 // Set Byte Range Lock Results Control Block
861 //
862
863 typedef struct _AFS_SET_BYTE_RANGE_LOCK_RESULT_CB
864 {
865
866     ULONG                       SerialNumber;
867
868     AFSFileID                   FileId;
869
870     ULONG                       Count;
871
872     AFSByteRangeLockResult      Result[1];
873
874 } AFSSetByteRangeLockResultCB;
875
876
877 //
878 // Byte Range Unlock Request Control Block
879 //
880
881 typedef struct _AFS_BYTE_RANGE_UNLOCK_CB
882 {
883
884     ULONG                       Count;
885
886     ULONGLONG                   ProcessId;
887
888     AFSByteRangeLockRequest     Request[1];
889
890 } AFSByteRangeUnlockRequestCB;
891
892
893 //
894 // Byte Range Unlock Request Control Block
895 //
896
897 typedef struct _AFS_BYTE_RANGE_UNLOCK_RESULT_CB
898 {
899
900     ULONG                       Count;
901
902     AFSByteRangeLockResult      Result[1];
903
904 } AFSByteRangeUnlockResultCB;
905
906
907 //
908 // Control structure for read and write requests through the PIPE interface
909 //
910 // CommRequest FileId field contains the active directory
911
912 typedef struct _AFS_PIPE_IO_CB
913 {
914     ULONG       RequestId;
915
916     AFSFileID   RootId;
917
918     ULONG       BufferLength;
919
920 } AFSPipeIORequestCB;   // For read requests the buffer is mapped in the request cb block.
921                         // For write requests, the buffer immediately follows this structure
922
923 //
924 // The returned information for the Pipe IO Request. Note that this is
925 // only returned in the write request. Read request info is returned in
926 // the request cb
927 //
928
929 typedef struct _AFS_PIPE_IO_RESULT_CB
930 {
931
932     ULONG       BytesProcessed;
933
934 } AFSPipeIOResultCB;
935
936 //
937 // Control structure for set and query info requests through the PIPE interface
938 //
939
940 typedef struct _AFS_PIPE_INFO_CB
941 {
942
943     ULONG       RequestId;
944
945     AFSFileID   RootId;
946
947     ULONG       InformationClass;
948
949     ULONG       BufferLength;
950
951 } AFSPipeInfoRequestCB;   // For query info requests the buffer is mapped in the request cb block.
952                           // For set info requests, the buffer immediately follows this structure
953
954 //
955 // Control structure for open and close requests through the Pipe interface
956 //
957 // CommRequest FileId field contains the active directory
958 //
959 // There is no return structure.
960 //
961 typedef struct _AFS_PIPE_OPEN_CLOSE_CB
962 {
963
964     ULONG       RequestId;
965
966     AFSFileID   RootId;
967
968 } AFSPipeOpenCloseRequestCB;
969
970
971 //
972 // Hold Fid Request Control Block
973 //
974
975 typedef struct _AFS_HOLD_FID_REQUEST_CB
976 {
977
978     ULONG                       Count;
979
980     AFSFileID                   FileID[ 1];
981
982 } AFSHoldFidRequestCB;
983
984
985 typedef struct _AFS_FID_RESULT
986 {
987
988     AFSFileID                   FileID;
989
990     ULONG                       Status;
991
992 } AFSFidResult;
993
994 typedef struct _AFS_HOLD_FID_RESULT_CB
995 {
996
997     ULONG                       Count;
998
999     AFSFidResult                Result[ 1];
1000
1001 } AFSHoldFidResultCB;
1002
1003
1004 //
1005 // Release Fid Request Control Block
1006 //
1007
1008 typedef struct _AFS_RELEASE_FID_REQUEST_CB
1009 {
1010
1011     ULONG                       Count;
1012
1013     AFSFileID                   FileID[ 1];
1014
1015 } AFSReleaseFidRequestCB;
1016
1017 typedef struct _AFS_RELEASE_FID_RESULT_CB
1018 {
1019
1020     ULONG                       Count;
1021
1022     AFSFidResult                Result[ 1];
1023
1024 } AFSReleaseFidResultCB;
1025
1026
1027 //
1028 // File cleanup CB
1029 //
1030
1031 typedef struct _AFS_FILE_CLEANUP_CB
1032 {
1033
1034     AFSFileID       ParentId;
1035
1036     LARGE_INTEGER   LastAccessTime;
1037
1038     LARGE_INTEGER   LastWriteTime;
1039
1040     LARGE_INTEGER   ChangeTime;
1041
1042     LARGE_INTEGER   CreateTime;
1043
1044     LARGE_INTEGER   AllocationSize;
1045
1046     ULONG           FileAttributes;
1047
1048     ULONGLONG       ProcessId;
1049
1050     ULONG           FileAccess;
1051
1052     ULONGLONG       Identifier;
1053
1054 } AFSFileCleanupCB;
1055
1056 typedef struct _AFS_FILE_CLEANUP_RESULT_CB
1057 {
1058
1059     LARGE_INTEGER   ParentDataVersion;
1060
1061 } AFSFileCleanupResultCB;
1062
1063
1064 //
1065 // Trace configuration cb
1066 //
1067
1068 typedef struct _AFS_DEBUG_TRACE_CONFIG_CB
1069 {
1070
1071     ULONG       TraceLevel;
1072
1073     ULONG       Subsystem;
1074
1075     ULONG       TraceBufferLength;
1076
1077     ULONG       DebugFlags;
1078
1079 } AFSTraceConfigCB;
1080
1081 //
1082 // Object Status Information request
1083 //
1084
1085 typedef struct _AFS_REDIR_GET_OBJECT_STATUS_CB
1086 {
1087
1088     AFSFileID       FileID;
1089
1090     USHORT          FileNameLength;
1091
1092     WCHAR           FileName[ 1];
1093
1094 } AFSGetStatusInfoCB;
1095
1096 typedef struct _AFS_REDIR_OBJECT_STATUS_CB
1097 {
1098
1099     AFSFileID               FileId;
1100
1101     AFSFileID               TargetFileId;
1102
1103     LARGE_INTEGER           Expiration;         /* FILETIME */
1104
1105     LARGE_INTEGER           DataVersion;
1106
1107     ULONG                   FileType;           /* File, Dir, MountPoint, Symlink */
1108
1109     ULONG                   ObjectFlags;
1110
1111     LARGE_INTEGER           CreationTime;       /* FILETIME */
1112
1113     LARGE_INTEGER           LastAccessTime;     /* FILETIME */
1114
1115     LARGE_INTEGER           LastWriteTime;      /* FILETIME */
1116
1117     LARGE_INTEGER           ChangeTime;         /* FILETIME */
1118
1119     ULONG                   FileAttributes;     /* NTFS FILE_ATTRIBUTE_xxxx see below */
1120
1121     LARGE_INTEGER           EndOfFile;
1122
1123     LARGE_INTEGER           AllocationSize;
1124
1125     ULONG                   EaSize;
1126
1127     ULONG                   Links;
1128
1129 } AFSStatusInfoCB;
1130
1131 //
1132 // Auth Group (Process and Thread) Processing
1133 //
1134 // afsredir.sys implements a set of generic Authentication Group
1135 // operations that can be executed by processes.  The model supports
1136 // one or more authentication groups per process.  A process may switch
1137 // the active AuthGroup for any thread to any other AuthGroup the process
1138 // is a member of.  However, processes cannot assign itself to an
1139 // AuthGroup that it is not presently a member of.  A process can reset
1140 // its AuthGroup to the SID-AuthGroup or can create a new AuthGroup that
1141 // has not previously been used.
1142 //
1143 //  IOCTL_AFS_AUTHGROUP_CREATE_AND_SET
1144 //      Creates a new AuthGroup and either activates it for
1145 //      the process or the current thread.  If set as the
1146 //      new process AuthGroup, the prior AuthGroup list is
1147 //      cleared.
1148 //
1149 //  IOCTL_AFS_AUTHGROUP_QUERY
1150 //      Returns a list of the AuthGroup GUIDS associated
1151 //      with the current process, the current process GUID,
1152 //      and the current thread GUID.
1153 //
1154 //  IOCTL_AFS_AUTHGROUP_SET
1155 //      Permits the current AuthGroup for the process or
1156 //      thread to be set to the specified GUID.  The GUID
1157 //      must be in the list of current values for the process.
1158 //
1159 //  IOCTL_AFS_AUTHGROUP_RESET
1160 //      Resets the current AuthGroup for the process or
1161 //      thread to the SID-AuthGroup
1162 //
1163 //  IOCTL_AFS_AUTHGROUP_SID_CREATE
1164 //      Given a SID as input, assigns a new AuthGroup GUID.
1165 //      (May only be executed by LOCAL_SYSTEM or the active SID)
1166 //
1167 //  IOCTL_AFS_AUTHGROUP_SID_QUERY
1168 //      Given a SID as input, returns the associated AuthGroup GUID.
1169 //
1170 //  IOCTL_AFS_AUTHGROUP_LOGON_CREATE
1171 //      Given a logon Session as input, assigns a new AuthGroup GUID.
1172 //      (May only be executed by LOCAL_SYSTEM.)
1173 //
1174 // New processes inherit only the active AuthGroup at the time of process
1175 // creation.  Either that of the active thread (if set) or the process.
1176 // All of the other AuthGroups associated with a parent process are
1177 // off-limits.
1178 //
1179
1180 //
1181 // Auth Group processing flags
1182 //
1183
1184 #define AFS_PAG_FLAGS_SET_AS_ACTIVE         0x00000001 // If set, the newly created authgroup is set to the active group
1185 #define AFS_PAG_FLAGS_THREAD_AUTH_GROUP     0x00000002 // If set, the request is targeted for the thread not the process
1186
1187 typedef struct _AFS_AUTH_GROUP_REQUEST
1188 {
1189
1190     USHORT              SIDLength; // If zero the SID of the caller is used
1191
1192     ULONG               SessionId; // If -1 the session id of the caller is used
1193
1194     ULONG               Flags;
1195
1196     GUID                AuthGroup; // The auth group for certain requests
1197
1198     WCHAR               SIDString[ 1];
1199
1200 } AFSAuthGroupRequestCB;
1201
1202 //
1203 // Reparse tag AFS Specific information buffer
1204 //
1205
1206 #define OPENAFS_SUBTAG_MOUNTPOINT 1
1207 #define OPENAFS_SUBTAG_SYMLINK    2
1208 #define OPENAFS_SUBTAG_UNC        3
1209
1210 #define OPENAFS_MOUNTPOINT_TYPE_NORMAL   L'#'
1211 #define OPENAFS_MOUNTPOINT_TYPE_RW       L'%'
1212
1213 typedef struct _AFS_REPARSE_TAG_INFORMATION
1214 {
1215
1216     ULONG SubTag;
1217
1218     union
1219     {
1220         struct
1221         {
1222             ULONG  Type;
1223             USHORT MountPointCellLength;
1224             USHORT MountPointVolumeLength;
1225             WCHAR  Buffer[1];
1226         } AFSMountPoint;
1227
1228         struct
1229         {
1230             BOOLEAN RelativeLink;
1231             USHORT  SymLinkTargetLength;
1232             WCHAR   Buffer[1];
1233         } AFSSymLink;
1234
1235         struct
1236         {
1237             USHORT UNCTargetLength;
1238             WCHAR  Buffer[1];
1239         } UNCReferral;
1240     };
1241
1242 } AFSReparseTagInfo;
1243
1244 #endif /* _AFS_USER_STRUCT_H */
1245