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