Windows: Enforce Share Access
[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
112 #define AFS_REDIR_INIT_NO_PAGING_FILE               0x00000002
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     /* Long Filename and Target (Symlink and MountPoint only) to follow without NULs */
218
219 } AFSDirEnumEntry;
220
221
222 typedef struct _AFS_DIR_ENUM_RESP
223 {
224
225     ULONG_PTR       EnumHandle;
226
227     AFSDirEnumEntry Entry[ 1];     /* Each entry is Quad aligned */
228
229 } AFSDirEnumResp;
230
231 //
232 // Volume information CB passed in the create request
233 //
234
235 typedef struct _AFS_VOLUME_INFORMATION
236 {
237
238     LARGE_INTEGER   TotalAllocationUnits;       /* Partition Max Blocks */
239
240     LARGE_INTEGER   AvailableAllocationUnits;   /* Partition Blocks Avail */
241
242     LARGE_INTEGER   VolumeCreationTime;         /* AFS Last Update - Not Creation */
243
244     ULONG           Characteristics;            /* FILE_READ_ONLY_DEVICE (if readonly)
245                                                  * FILE_REMOTE_DEVICE (always)
246                                                  */
247
248     ULONG           FileSystemAttributes;       /* FILE_CASE_PRESERVED_NAMES (always)
249                                                    FILE_UNICODE_ON_DISK      (always) */
250
251     ULONG           SectorsPerAllocationUnit;   /* = 1 */
252
253     ULONG           BytesPerSector;             /* = 1024 */
254
255     ULONG           CellID;                     /* AFS Cell ID */
256
257     ULONG           VolumeID;                   /* AFS Volume ID */
258
259     ULONG           VolumeLabelLength;
260
261     WCHAR           VolumeLabel[20];            /* Volume:Cell */
262
263 } AFSVolumeInfoCB;
264
265 //
266 // File create CB
267 //
268
269 typedef struct _AFS_FILE_CREATE_CB
270 {
271
272     AFSFileID       ParentId;
273
274     LARGE_INTEGER   AllocationSize;
275
276     ULONG           FileAttributes;
277
278     ULONG           EaSize;
279
280     char            EaBuffer[ 1];
281
282 } AFSFileCreateCB;
283
284 typedef struct _AFS_FILE_CREATE_RESULT_CB
285 {
286
287     LARGE_INTEGER   ParentDataVersion;
288
289     AFSDirEnumEntry DirEnum;
290
291 } AFSFileCreateResultCB;
292
293 //
294 // File open CB
295 //
296
297 typedef struct _AFS_FILE_OPEN_CB
298 {
299
300     AFSFileID       ParentId;
301
302     ULONG           DesiredAccess;
303
304     ULONG           ShareAccess;
305
306     ULONGLONG       ProcessId;
307
308     ULONGLONG       Identifier;
309
310 } AFSFileOpenCB;
311
312 typedef struct _AFS_FILE_OPEN_RESULT_CB
313 {
314
315     ULONG           GrantedAccess;
316
317     ULONG           FileAccess;
318
319 } AFSFileOpenResultCB;
320
321 typedef struct _AFS_FILE_ACCESS_RELEASE_CB
322 {
323
324     ULONG           FileAccess;
325
326     ULONGLONG       ProcessId;
327
328     ULONGLONG       Identifier;
329
330 } AFSFileAccessReleaseCB;
331
332 //
333 // IO Interace control blocks for extent processing when performing
334 // queries via the AFS_REQUEST_TYPE_REQUEST_FILE_EXTENTS or synchronous
335 // results from the service
336 //
337
338 typedef struct _AFS_FILE_EXTENT_CB
339 {
340
341     ULONG           Flags;
342
343     ULONG           Length;
344
345     LARGE_INTEGER   FileOffset;
346
347     LARGE_INTEGER   CacheOffset;
348
349     UCHAR           MD5[16];
350
351     ULONG           DirtyOffset;
352
353     ULONG           DirtyLength;
354
355 } AFSFileExtentCB;
356
357 typedef struct _AFS_REQUEST_EXTENTS_CB
358 {
359
360     ULONG           Flags;
361
362     LARGE_INTEGER   ByteOffset;
363
364     ULONG           Length;
365
366 } AFSRequestExtentsCB;
367
368 //
369 // Extent processing when the file system calls the service to
370 // release extents through the AFS_REQUEST_TYPE_RELEASE_FILE_EXTENTS interface
371 //
372
373 typedef struct _AFS_RELEASE_EXTENTS_CB
374 {
375
376     ULONG           Flags;
377
378     ULONG           ExtentCount;
379
380     LARGE_INTEGER   LastAccessTime;
381
382     LARGE_INTEGER   LastWriteTime;
383
384     LARGE_INTEGER   ChangeTime;
385
386     LARGE_INTEGER   CreateTime;
387
388     LARGE_INTEGER   AllocationSize;
389
390     AFSFileExtentCB FileExtents[ 1];
391
392 } AFSReleaseExtentsCB;
393
394 //
395 // This is the control structure used when the service passes the extent
396 // information via the IOCTL_AFS_SET_FILE_EXTENTS interface
397 //
398
399 typedef struct _AFS_SET_FILE_EXTENTS_CB
400 {
401
402     AFSFileID       FileId;
403
404     ULONG           ExtentCount;
405
406     ULONG           ResultStatus;
407
408     AFSFileExtentCB FileExtents[ 1];
409
410 } AFSSetFileExtentsCB;
411
412 //
413 // This is the control structure used when the service passes the extent
414 // information via the IOCTL_AFS_RELEASE_FILE_EXTENTS interface
415 //
416
417 #define AFS_RELEASE_EXTENTS_FLAGS_RELEASE_ALL       0x00000001
418
419 typedef struct _AFS_RELEASE_FILE_EXTENTS_CB
420 {
421
422     ULONG           Flags;
423
424     AFSFileID       FileId;
425
426     ULONG           ExtentCount;
427
428     LARGE_INTEGER   HeldExtentCount;
429
430     AFSFileExtentCB FileExtents[ 1];
431
432 } AFSReleaseFileExtentsCB;
433
434 //
435 // These are the control structures that the filesystem returns from a
436 // IOCTL_AFS_RELEASE_FILE_EXTENTS
437 //
438
439 typedef struct _AFS_RELEASE_FILE_EXTENTS_RESULT_FILE_CB
440 {
441     AFSFileID       FileId;
442
443     ULONG           Flags;
444
445     GUID            AuthGroup; /* Length: sizeof(GUID) */
446
447     ULONG           ExtentCount;
448
449     LARGE_INTEGER   LastAccessTime;
450
451     LARGE_INTEGER   LastWriteTime;
452
453     LARGE_INTEGER   ChangeTime;
454
455     LARGE_INTEGER   CreateTime;
456
457     LARGE_INTEGER   AllocationSize;
458
459     AFSFileExtentCB FileExtents[ 1];
460
461 } AFSReleaseFileExtentsResultFileCB;
462
463 typedef struct _AFS_RELEASE_FILE_EXTENTS_RESULT_CB
464 {
465     ULONG           SerialNumber;
466
467     ULONG           Flags;
468
469     ULONG           FileCount;
470
471     AFSReleaseFileExtentsResultFileCB Files[ 1];
472
473 } AFSReleaseFileExtentsResultCB;
474
475
476 typedef struct _AFS_EXTENT_FAILURE_CB
477 {
478
479     AFSFileID       FileId;
480
481     ULONG           FailureStatus;
482
483 } AFSExtentFailureCB;
484
485 //
486 // File update CB
487 //
488
489 typedef struct _AFS_FILE_UPDATE_CB
490 {
491
492     AFSFileID       ParentId;
493
494     LARGE_INTEGER   LastAccessTime;
495
496     LARGE_INTEGER   LastWriteTime;
497
498     LARGE_INTEGER   ChangeTime;
499
500     LARGE_INTEGER   CreateTime;
501
502     LARGE_INTEGER   AllocationSize;
503
504     ULONG           FileAttributes;
505
506     ULONG           EaSize;
507
508     char            EaBuffer[ 1];
509
510 } AFSFileUpdateCB;
511
512 //
513 // File update CB result
514 //
515
516 typedef struct _AFS_FILE_UPDATE_RESULT_CB
517 {
518
519     AFSDirEnumEntry DirEnum;
520
521 } AFSFileUpdateResultCB;
522
523 //
524 // File delete CB
525 //
526
527 typedef struct _AFS_FILE_DELETE_CB
528 {
529
530     AFSFileID       ParentId;        /* Must be directory */
531
532     ULONGLONG       ProcessId;
533
534                                      /* File Name and FileID in Common Request Block */
535
536 } AFSFileDeleteCB;
537
538 typedef struct _AFS_FILE_DELETE_RESULT_CB
539 {
540
541     LARGE_INTEGER   ParentDataVersion;
542
543 } AFSFileDeleteResultCB;
544
545 //
546 // File rename CB
547 //
548
549 typedef struct _AFS_FILE_RENAME_CB
550 {
551
552     AFSFileID       SourceParentId;        /* Must be directory */
553
554     AFSFileID       TargetParentId;        /* Must be directory */
555
556                                            /* Source Name and FileID in Common Request Block */
557
558     USHORT          TargetNameLength;
559
560     WCHAR           TargetName[ 1];
561
562 } AFSFileRenameCB;
563
564 typedef struct _AFS_FILE_RENAME_RESULT_CB
565 {
566
567     LARGE_INTEGER   SourceParentDataVersion;
568
569     LARGE_INTEGER   TargetParentDataVersion;
570
571     AFSDirEnumEntry DirEnum;
572
573 } AFSFileRenameResultCB;
574
575
576 //
577 // Control structures for AFS_REQUEST_TYPE_EVAL_TARGET_BY_ID
578 // and AFS_REQUEST_TYPE_EVAL_TARGET_BY_NAME
579 //
580 // The response to these requests is a AFSDirEnumEntry
581 //
582
583 typedef struct _AFS_FILE_EVAL_TARGET_CB
584 {
585
586     AFSFileID       ParentId;
587
588 } AFSEvalTargetCB;
589
590
591 //
592 // Control structure for read and write requests through the PIOCtl interface
593 //
594 // CommRequest FileId field contains the active directory
595
596 typedef struct _AFS_PIOCTL_IO_CB
597 {
598     ULONG       RequestId;
599
600     AFSFileID   RootId;
601
602     ULONG       BufferLength;
603
604     void        *MappedBuffer;
605
606 } AFSPIOCtlIORequestCB;
607
608 //
609 // The returned information for the IO Request
610 //
611
612 typedef struct _AFS_PIOCTL_IO_RESULT_CB
613 {
614
615     ULONG       BytesProcessed;
616
617 } AFSPIOCtlIOResultCB;
618
619
620 //
621 // Control structure for open and close requests through the PIOCtl interface
622 //
623 // CommRequest FileId field contains the active directory
624 //
625 // There is no return structure.
626 //
627 typedef struct _AFS_PIOCTL_OPEN_CLOSE_CB
628 {
629
630     ULONG       RequestId;
631
632     AFSFileID   RootId;
633
634 } AFSPIOCtlOpenCloseRequestCB;
635
636 //
637 // Cache invalidation control block
638 //
639
640 typedef struct _AFS_INVALIDATE_CACHE_CB
641 {
642
643     AFSFileID   FileID;
644
645     ULONG       FileType;
646
647     BOOLEAN     WholeVolume;
648
649     ULONG       Reason;
650
651 } AFSInvalidateCacheCB;
652
653 //
654 // Network Status Control Block
655 //
656
657 typedef struct _AFS_NETWORK_STATUS_CB
658 {
659
660     BOOLEAN     Online;
661
662 } AFSNetworkStatusCB;
663
664 //
665 // Volume Status Control Block
666 //
667
668 typedef struct _AFS_VOLUME_STATUS_CB
669 {
670
671     AFSFileID   FileID;         // only cell and volume fields are set
672
673     BOOLEAN     Online;
674
675 } AFSVolumeStatusCB;
676
677
678 typedef struct _AFS_SYSNAME
679 {
680
681     ULONG       Length;         /* bytes */
682
683     WCHAR       String[AFS_MAX_SYSNAME_LENGTH];
684
685 } AFSSysName;
686
687 //
688 // SysName Notification Control Block
689 //   Sent as the buffer with IOCTL_AFS_SYSNAME_NOTIFICATION
690 //   There is no response
691 //
692
693 typedef struct _AFS_SYSNAME_NOTIFICATION_CB
694 {
695
696     ULONG       Architecture;
697
698     ULONG       NumberOfNames;
699
700     AFSSysName  SysNames[1];
701
702 } AFSSysNameNotificationCB;
703
704
705 //
706 // File System Status Query Control Block
707 //   Received as a response to IOCTL_AFS_STATUS_REQUEST
708 //
709 typedef struct _AFS_DRIVER_STATUS_RESPONSE_CB
710 {
711
712     ULONG       Status;         // bit flags - see below
713
714 } AFSDriverStatusRespCB;
715
716 // Bit flags
717 #define AFS_DRIVER_STATUS_READY         0
718 #define AFS_DRIVER_STATUS_NOT_READY     1
719 #define AFS_DRIVER_STATUS_NO_SERVICE    2
720
721 //
722 // Byte Range Lock Request
723 //
724 typedef struct _AFS_BYTE_RANGE_LOCK_REQUEST
725 {
726     ULONG               LockType;
727
728     LARGE_INTEGER       Offset;
729
730     LARGE_INTEGER       Length;
731
732 } AFSByteRangeLockRequest;
733
734 #define AFS_BYTE_RANGE_LOCK_TYPE_SHARED 0
735 #define AFS_BYTE_RANGE_LOCK_TYPE_EXCL   1
736
737
738 //
739 // Byte Range Lock Request Control Block
740 //
741 // Set ProcessId and FileId in the Comm Request Block
742 //
743 typedef struct _AFS_BYTE_RANGE_LOCK_REQUEST_CB
744 {
745
746     ULONG                       Count;
747
748     ULONGLONG                   ProcessId;
749
750     AFSByteRangeLockRequest     Request[1];
751
752 } AFSByteRangeLockRequestCB;
753
754 //
755 // Byte Range Lock Result
756 //
757 typedef struct _AFS_BYTE_RANGE_LOCK_RESULT
758 {
759
760     ULONG               LockType;
761
762     LARGE_INTEGER       Offset;
763
764     LARGE_INTEGER       Length;
765
766     ULONG               Status;
767
768 } AFSByteRangeLockResult;
769
770 //
771 // Byte Range Lock Results Control Block
772 //
773
774 typedef struct _AFS_BYTE_RANGE_LOCK_RESULT_CB
775 {
776
777     AFSFileID                   FileId;
778
779     ULONG                       Count;
780
781     AFSByteRangeLockResult      Result[1];
782
783 } AFSByteRangeLockResultCB;
784
785 //
786 // Set Byte Range Lock Results Control Block
787 //
788
789 typedef struct _AFS_SET_BYTE_RANGE_LOCK_RESULT_CB
790 {
791
792     ULONG                       SerialNumber;
793
794     AFSFileID                   FileId;
795
796     ULONG                       Count;
797
798     AFSByteRangeLockResult      Result[1];
799
800 } AFSSetByteRangeLockResultCB;
801
802
803 //
804 // Byte Range Unlock Request Control Block
805 //
806
807 typedef struct _AFS_BYTE_RANGE_UNLOCK_CB
808 {
809
810     ULONG                       Count;
811
812     ULONGLONG                   ProcessId;
813
814     AFSByteRangeLockRequest     Request[1];
815
816 } AFSByteRangeUnlockRequestCB;
817
818
819 //
820 // Byte Range Unlock Request Control Block
821 //
822
823 typedef struct _AFS_BYTE_RANGE_UNLOCK_RESULT_CB
824 {
825
826     ULONG                       Count;
827
828     AFSByteRangeLockResult      Result[1];
829
830 } AFSByteRangeUnlockResultCB;
831
832
833 //
834 // Control structure for read and write requests through the PIPE interface
835 //
836 // CommRequest FileId field contains the active directory
837
838 typedef struct _AFS_PIPE_IO_CB
839 {
840     ULONG       RequestId;
841
842     AFSFileID   RootId;
843
844     ULONG       BufferLength;
845
846 } AFSPipeIORequestCB;   // For read requests the buffer is mapped in the request cb block.
847                         // For write requests, the buffer immediately follows this structure
848
849 //
850 // The returned information for the Pipe IO Request. Note that this is
851 // only returned in the write request. Read request info is returned in
852 // the request cb
853 //
854
855 typedef struct _AFS_PIPE_IO_RESULT_CB
856 {
857
858     ULONG       BytesProcessed;
859
860 } AFSPipeIOResultCB;
861
862 //
863 // Control structure for set and query info requests through the PIPE interface
864 //
865
866 typedef struct _AFS_PIPE_INFO_CB
867 {
868
869     ULONG       RequestId;
870
871     AFSFileID   RootId;
872
873     ULONG       InformationClass;
874
875     ULONG       BufferLength;
876
877 } AFSPipeInfoRequestCB;   // For query info requests the buffer is mapped in the request cb block.
878                           // For set info requests, the buffer immediately follows this structure
879
880 //
881 // Control structure for open and close requests through the Pipe interface
882 //
883 // CommRequest FileId field contains the active directory
884 //
885 // There is no return structure.
886 //
887 typedef struct _AFS_PIPE_OPEN_CLOSE_CB
888 {
889
890     ULONG       RequestId;
891
892     AFSFileID   RootId;
893
894 } AFSPipeOpenCloseRequestCB;
895
896
897 //
898 // Hold Fid Request Control Block
899 //
900
901 typedef struct _AFS_HOLD_FID_REQUEST_CB
902 {
903
904     ULONG                       Count;
905
906     AFSFileID                   FileID[ 1];
907
908 } AFSHoldFidRequestCB;
909
910
911 typedef struct _AFS_FID_RESULT
912 {
913
914     AFSFileID                   FileID;
915
916     ULONG                       Status;
917
918 } AFSFidResult;
919
920 typedef struct _AFS_HOLD_FID_RESULT_CB
921 {
922
923     ULONG                       Count;
924
925     AFSFidResult                Result[ 1];
926
927 } AFSHoldFidResultCB;
928
929
930 //
931 // Release Fid Request Control Block
932 //
933
934 typedef struct _AFS_RELEASE_FID_REQUEST_CB
935 {
936
937     ULONG                       Count;
938
939     AFSFileID                   FileID[ 1];
940
941 } AFSReleaseFidRequestCB;
942
943 typedef struct _AFS_RELEASE_FID_RESULT_CB
944 {
945
946     ULONG                       Count;
947
948     AFSFidResult                Result[ 1];
949
950 } AFSReleaseFidResultCB;
951
952
953 //
954 // File cleanup CB
955 //
956
957 typedef struct _AFS_FILE_CLEANUP_CB
958 {
959
960     AFSFileID       ParentId;
961
962     LARGE_INTEGER   LastAccessTime;
963
964     LARGE_INTEGER   LastWriteTime;
965
966     LARGE_INTEGER   ChangeTime;
967
968     LARGE_INTEGER   CreateTime;
969
970     LARGE_INTEGER   AllocationSize;
971
972     ULONG           FileAttributes;
973
974     ULONGLONG       ProcessId;
975
976     ULONG           FileAccess;
977
978     ULONGLONG       Identifier;
979
980 } AFSFileCleanupCB;
981
982 //
983 // Trace configuration cb
984 //
985
986 typedef struct _AFS_DEBUG_TRACE_CONFIG_CB
987 {
988
989     ULONG       TraceLevel;
990
991     ULONG       Subsystem;
992
993     ULONG       TraceBufferLength;
994
995     ULONG       DebugFlags;
996
997 } AFSTraceConfigCB;
998
999 //
1000 // Object Status Information request
1001 //
1002
1003 typedef struct _AFS_REDIR_GET_OBJECT_STATUS_CB
1004 {
1005
1006     AFSFileID       FileID;
1007
1008     USHORT          FileNameLength;
1009
1010     WCHAR           FileName[ 1];
1011
1012 } AFSGetStatusInfoCB;
1013
1014 typedef struct _AFS_REDIR_OBJECT_STATUS_CB
1015 {
1016
1017     AFSFileID               FileId;
1018
1019     AFSFileID               TargetFileId;
1020
1021     LARGE_INTEGER           Expiration;         /* FILETIME */
1022
1023     LARGE_INTEGER           DataVersion;
1024
1025     ULONG                   FileType;           /* File, Dir, MountPoint, Symlink */
1026
1027     ULONG                   ObjectFlags;
1028
1029     LARGE_INTEGER           CreationTime;       /* FILETIME */
1030
1031     LARGE_INTEGER           LastAccessTime;     /* FILETIME */
1032
1033     LARGE_INTEGER           LastWriteTime;      /* FILETIME */
1034
1035     LARGE_INTEGER           ChangeTime;         /* FILETIME */
1036
1037     ULONG                   FileAttributes;     /* NTFS FILE_ATTRIBUTE_xxxx see below */
1038
1039     LARGE_INTEGER           EndOfFile;
1040
1041     LARGE_INTEGER           AllocationSize;
1042
1043     ULONG                   EaSize;
1044
1045     ULONG                   Links;
1046
1047 } AFSStatusInfoCB;
1048
1049 //
1050 // Auth Group (Process and Thread) Processing
1051 //
1052 // afsredir.sys implements a set of generic Authentication Group
1053 // operations that can be executed by processes.  The model supports
1054 // one or more authentication groups per process.  A process may switch
1055 // the active AuthGroup for any thread to any other AuthGroup the process
1056 // is a member of.  However, processes cannot assign itself to an
1057 // AuthGroup that it is not presently a member of.  A process can reset
1058 // its AuthGroup to the SID-AuthGroup or can create a new AuthGroup that
1059 // has not previously been used.
1060 //
1061 //  IOCTL_AFS_AUTHGROUP_CREATE_AND_SET
1062 //      Creates a new AuthGroup and either activates it for
1063 //      the process or the current thread.  If set as the
1064 //      new process AuthGroup, the prior AuthGroup list is
1065 //      cleared.
1066 //
1067 //  IOCTL_AFS_AUTHGROUP_QUERY
1068 //      Returns a list of the AuthGroup GUIDS associated
1069 //      with the current process, the current process GUID,
1070 //      and the current thread GUID.
1071 //
1072 //  IOCTL_AFS_AUTHGROUP_SET
1073 //      Permits the current AuthGroup for the process or
1074 //      thread to be set to the specified GUID.  The GUID
1075 //      must be in the list of current values for the process.
1076 //
1077 //  IOCTL_AFS_AUTHGROUP_RESET
1078 //      Resets the current AuthGroup for the process or
1079 //      thread to the SID-AuthGroup
1080 //
1081 //  IOCTL_AFS_AUTHGROUP_SID_CREATE
1082 //      Given a SID as input, assigns a new AuthGroup GUID.
1083 //      (May only be executed by LOCAL_SYSTEM or the active SID)
1084 //
1085 //  IOCTL_AFS_AUTHGROUP_SID_QUERY
1086 //      Given a SID as input, returns the associated AuthGroup GUID.
1087 //
1088 //  IOCTL_AFS_AUTHGROUP_LOGON_CREATE
1089 //      Given a logon Session as input, assigns a new AuthGroup GUID.
1090 //      (May only be executed by LOCAL_SYSTEM.)
1091 //
1092 // New processes inherit only the active AuthGroup at the time of process
1093 // creation.  Either that of the active thread (if set) or the process.
1094 // All of the other AuthGroups associated with a parent process are
1095 // off-limits.
1096 //
1097
1098 //
1099 // Auth Group processing flags
1100 //
1101
1102 #define AFS_PAG_FLAGS_SET_AS_ACTIVE         0x00000001 // If set, the newly created authgroup is set to the active group
1103 #define AFS_PAG_FLAGS_THREAD_AUTH_GROUP     0x00000002 // If set, the request is targeted for the thread not the process
1104
1105 typedef struct _AFS_AUTH_GROUP_REQUEST
1106 {
1107
1108     USHORT              SIDLength; // If zero the SID of the caller is used
1109
1110     ULONG               SessionId; // If -1 the session id of the caller is used
1111
1112     ULONG               Flags;
1113
1114     GUID                AuthGroup; // The auth group for certain requests
1115
1116     WCHAR               SIDString[ 1];
1117
1118 } AFSAuthGroupRequestCB;
1119
1120 //
1121 // Reparse tag AFS Specific information buffer
1122 //
1123
1124 #define OPENAFS_SUBTAG_MOUNTPOINT 1
1125 #define OPENAFS_SUBTAG_SYMLINK    2
1126 #define OPENAFS_SUBTAG_UNC        3
1127
1128 #define OPENAFS_MOUNTPOINT_TYPE_NORMAL   L'#'
1129 #define OPENAFS_MOUNTPOINT_TYPE_RW       L'%'
1130
1131 typedef struct _AFS_REPARSE_TAG_INFORMATION
1132 {
1133
1134     ULONG SubTag;
1135
1136     union
1137     {
1138         struct
1139         {
1140             ULONG  Type;
1141             USHORT MountPointCellLength;
1142             USHORT MountPointVolumeLength;
1143             WCHAR  Buffer[1];
1144         } AFSMountPoint;
1145
1146         struct
1147         {
1148             BOOLEAN RelativeLink;
1149             USHORT  SymLinkTargetLength;
1150             WCHAR   Buffer[1];
1151         } AFSSymLink;
1152
1153         struct
1154         {
1155             USHORT UNCTargetLength;
1156             WCHAR  Buffer[1];
1157         } UNCReferral;
1158     };
1159
1160 } AFSReparseTagInfo;
1161
1162 #endif /* _AFS_USER_STRUCT_H */
1163